diff --git a/webui/dist/assets/index-Bh0H0ZnO.js b/webui/dist/assets/index-CrIP7TYI.js similarity index 55% rename from webui/dist/assets/index-Bh0H0ZnO.js rename to webui/dist/assets/index-CrIP7TYI.js index d35b20b3..f8728c7b 100644 --- a/webui/dist/assets/index-Bh0H0ZnO.js +++ b/webui/dist/assets/index-CrIP7TYI.js @@ -1,103 +1,103 @@ -import{r as b,j as l,u as Ma,R as he,b as hu,d as iY,e as aY,L as lY,f as oY,g as ss,h as cY,k as uY,O as wD,l as dY}from"./router-SinpzM5S.js";import{a as hY,b as fY,g as zk}from"./react-vendor-Dtc2IqVY.js";import{c as SD,R as mY,T as pY,L as gY,a as xY,C as $g,X as Qg,Y as Wf,b as vY,B as Y2,d as Hg,P as yY,e as bY,f as wY,_ as SY,g as kY,i as OY,h as DC,j as jY,k as zC,l as NY,m as CY,n as TY,r as kD,o as EY,p as Pk,q as OD,s as Bu,t as Lk,u as _Y,v as MY,w as jD,x as ND,y as CD,z as Ik,A as Bk,D as qk,E as AY,F as RY,G as DY,H as zY,I as PY,J as LY,K as IY,M as Fk,N as kv,O as BY,Q as qY,S as $k,U as FY,V as $Y,W as TD,Z as ED,$ as _D,a0 as MD,a1 as Ov,a2 as AD,a3 as RD,a4 as QY,a5 as HY,a6 as VY,a7 as UY,a8 as WY,a9 as GY,aa as XY,ab as YY,ac as DD,ad as zD,ae as KY,af as ZY,ag as JY,ah as eK,ai as tK,aj as nK,ak as rK,al as sK,am as iK,an as aK,ao as lK,ap as oK,aq as cK,ar as uK,as as dK,at as hK}from"./charts-BH1Uno6i.js";import{c as ua,a as jv,u as Ei,P as nn,b as Ze,d as Dn,e as M0,f as wo,g as bs,h as Ps,i as Qk,j as Hk,k as Vk,S as fK,l as PD,m as LD,R as ID,O as Nv,n as Uk,C as Cv,o as Tv,T as Wk,D as Gk,p as Xk,q as BD,r as qD,W as mK,s as FD,I as pK,t as $D,v as QD,w as gK,x as HD,V as xK,L as VD,y as UD,z as vK,A as yK,B as WD,E as bK,F as wK,G as gc,H as Ev,J as Rh,K as GD,M as XD,N as YD,Q as KD,U as Yk,X as Kk,Y as _v,Z as Mv,_ as Zk,$ as ZD,a0 as SK,a1 as JD,a2 as kK,a3 as OK,a4 as ez,a5 as jK}from"./ui-vendor-BLBhIcJ8.js";import{R as ti,A as NK,D as CK,a as N3,Z as C3,C as Yd,M as A0,T as TK,X as R0,P as tz,S as EK,b as yu,I as Oa,c as ja,d as so,e as k1,E as O1,f as aa,g as xc,h as _K,i as MK,j as T3,k as E3,L as PC,K as nz,l as ju,m as Av,n as AK,F as io,o as Kd,p as hh,q as RK,B as DK,U as rz,r as Jk,s as zK,t as PK,u as li,H as qm,v as sz,w as Nu,x as Fm,y as LK,z as IK,G as Rv,J as e6,N as gs,O as ln,Q as j1,V as fh,W as D0,Y as qu,_ as Fu,$ as z0,a0 as iz,a1 as BK,a2 as qK,a3 as mh,a4 as LC,a5 as FK,a6 as bu,a7 as _3,a8 as $m,a9 as $K,aa as M3,ab as QK,ac as az,ad as IC,ae as HK,af as VK,ag as UK,ah as sc,ai as K2,aj as BC,ak as WK,al as lz,am as oz,an as cz,ao as GK,ap as XK,aq as qC,ar as YK,as as KK,at as FC,au as ZK,av as JK}from"./icons-Bom2zaMH.js";(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.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 a of i.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).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 Z2={exports:{}},Gf={},J2={exports:{}},ew={};var $C;function eZ(){return $C||($C=1,(function(t){function e(P,W){var J=P.length;P.push(W);e:for(;0>>1,R=P[X];if(0>>1;Xs(F,J))Us(te,F)?(P[X]=te,P[U]=J,X=U):(P[X]=F,P[G]=J,X=G);else if(Us(te,J))P[X]=te,P[U]=J,X=U;else break e}}return W}function s(P,W){var J=P.sortIndex-W.sortIndex;return J!==0?J:P.id-W.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var i=performance;t.unstable_now=function(){return i.now()}}else{var a=Date,o=a.now();t.unstable_now=function(){return a.now()-o}}var c=[],h=[],f=1,m=null,g=3,x=!1,y=!1,w=!1,S=!1,k=typeof setTimeout=="function"?setTimeout:null,N=typeof clearTimeout=="function"?clearTimeout:null,C=typeof setImmediate<"u"?setImmediate:null;function T(P){for(var W=n(h);W!==null;){if(W.callback===null)r(h);else if(W.startTime<=P)r(h),W.sortIndex=W.expirationTime,e(c,W);else break;W=n(h)}}function _(P){if(w=!1,T(P),!y)if(n(c)!==null)y=!0,E||(E=!0,V());else{var W=n(h);W!==null&&H(_,W.startTime-P)}}var E=!1,M=-1,q=5,L=-1;function I(){return S?!0:!(t.unstable_now()-LP&&I());){var X=m.callback;if(typeof X=="function"){m.callback=null,g=m.priorityLevel;var R=X(m.expirationTime<=P);if(P=t.unstable_now(),typeof R=="function"){m.callback=R,T(P),W=!0;break t}m===n(c)&&r(c),T(P)}else r(c);m=n(c)}if(m!==null)W=!0;else{var se=n(h);se!==null&&H(_,se.startTime-P),W=!1}}break e}finally{m=null,g=J,x=!1}W=void 0}}finally{W?V():E=!1}}}var V;if(typeof C=="function")V=function(){C($)};else if(typeof MessageChannel<"u"){var ee=new MessageChannel,z=ee.port2;ee.port1.onmessage=$,V=function(){z.postMessage(null)}}else V=function(){k($,0)};function H(P,W){M=k(function(){P(t.unstable_now())},W)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(P){P.callback=null},t.unstable_forceFrameRate=function(P){0>P||125X?(P.sortIndex=J,e(h,P),n(c)===null&&P===n(h)&&(w?(N(M),M=-1):w=!0,H(_,J-X))):(P.sortIndex=R,e(c,P),y||x||(y=!0,E||(E=!0,V()))),P},t.unstable_shouldYield=I,t.unstable_wrapCallback=function(P){var W=g;return function(){var J=g;g=W;try{return P.apply(this,arguments)}finally{g=J}}}})(ew)),ew}var QC;function tZ(){return QC||(QC=1,J2.exports=eZ()),J2.exports}var HC;function nZ(){if(HC)return Gf;HC=1;var t=tZ(),e=hY(),n=fY();function r(u){var d="https://react.dev/errors/"+u;if(1R||(u.current=X[R],X[R]=null,R--)}function F(u,d){R++,X[R]=u.current,u.current=d}var U=se(null),te=se(null),ne=se(null),Y=se(null);function ae(u,d){switch(F(ne,d),F(te,u),F(U,null),d.nodeType){case 9:case 11:u=(u=d.documentElement)&&(u=u.namespaceURI)?rC(u):0;break;default:if(u=d.tagName,d=d.namespaceURI)d=rC(d),u=sC(d,u);else switch(u){case"svg":u=1;break;case"math":u=2;break;default:u=0}}G(U),F(U,u)}function re(){G(U),G(te),G(ne)}function le(u){u.memoizedState!==null&&F(Y,u);var d=U.current,p=sC(d,u.type);d!==p&&(F(te,u),F(U,p))}function _e(u){te.current===u&&(G(U),G(te)),Y.current===u&&(G(Y),Qf._currentValue=J)}var Ge,tt;function Xe(u){if(Ge===void 0)try{throw Error()}catch(p){var d=p.stack.trim().match(/\n( *(at )?)/);Ge=d&&d[1]||"",tt=-1{for(const i of s)if(i.type==="childList")for(const a of i.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).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 sw={exports:{}},Gf={},iw={exports:{}},aw={};var QC;function nZ(){return QC||(QC=1,(function(t){function e(B,X){var J=B.length;B.push(X);e:for(;0>>1,R=B[G];if(0>>1;Gs(F,J))Vs(te,F)?(B[G]=te,B[V]=J,G=V):(B[G]=F,B[W]=J,G=W);else if(Vs(te,J))B[G]=te,B[V]=J,G=V;else break e}}return X}function s(B,X){var J=B.sortIndex-X.sortIndex;return J!==0?J:B.id-X.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var i=performance;t.unstable_now=function(){return i.now()}}else{var a=Date,o=a.now();t.unstable_now=function(){return a.now()-o}}var c=[],h=[],f=1,m=null,g=3,x=!1,y=!1,w=!1,S=!1,k=typeof setTimeout=="function"?setTimeout:null,N=typeof clearTimeout=="function"?clearTimeout:null,C=typeof setImmediate<"u"?setImmediate:null;function T(B){for(var X=n(h);X!==null;){if(X.callback===null)r(h);else if(X.startTime<=B)r(h),X.sortIndex=X.expirationTime,e(c,X);else break;X=n(h)}}function _(B){if(w=!1,T(B),!y)if(n(c)!==null)y=!0,E||(E=!0,U());else{var X=n(h);X!==null&&H(_,X.startTime-B)}}var E=!1,M=-1,L=5,P=-1;function I(){return S?!0:!(t.unstable_now()-PB&&I());){var G=m.callback;if(typeof G=="function"){m.callback=null,g=m.priorityLevel;var R=G(m.expirationTime<=B);if(B=t.unstable_now(),typeof R=="function"){m.callback=R,T(B),X=!0;break t}m===n(c)&&r(c),T(B)}else r(c);m=n(c)}if(m!==null)X=!0;else{var se=n(h);se!==null&&H(_,se.startTime-B),X=!1}}break e}finally{m=null,g=J,x=!1}X=void 0}}finally{X?U():E=!1}}}var U;if(typeof C=="function")U=function(){C(Q)};else if(typeof MessageChannel<"u"){var ee=new MessageChannel,z=ee.port2;ee.port1.onmessage=Q,U=function(){z.postMessage(null)}}else U=function(){k(Q,0)};function H(B,X){M=k(function(){B(t.unstable_now())},X)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(B){B.callback=null},t.unstable_forceFrameRate=function(B){0>B||125G?(B.sortIndex=J,e(h,B),n(c)===null&&B===n(h)&&(w?(N(M),M=-1):w=!0,H(_,J-G))):(B.sortIndex=R,e(c,B),y||x||(y=!0,E||(E=!0,U()))),B},t.unstable_shouldYield=I,t.unstable_wrapCallback=function(B){var X=g;return function(){var J=g;g=X;try{return B.apply(this,arguments)}finally{g=J}}}})(aw)),aw}var HC;function rZ(){return HC||(HC=1,iw.exports=nZ()),iw.exports}var VC;function sZ(){if(VC)return Gf;VC=1;var t=rZ(),e=mY(),n=pY();function r(u){var d="https://react.dev/errors/"+u;if(1R||(u.current=G[R],G[R]=null,R--)}function F(u,d){R++,G[R]=u.current,u.current=d}var V=se(null),te=se(null),ne=se(null),K=se(null);function ie(u,d){switch(F(ne,d),F(te,u),F(V,null),d.nodeType){case 9:case 11:u=(u=d.documentElement)&&(u=u.namespaceURI)?sC(u):0;break;default:if(u=d.tagName,d=d.namespaceURI)d=sC(d),u=iC(d,u);else switch(u){case"svg":u=1;break;case"math":u=2;break;default:u=0}}W(V),F(V,u)}function re(){W(V),W(te),W(ne)}function ae(u){u.memoizedState!==null&&F(K,u);var d=V.current,p=iC(d,u.type);d!==p&&(F(te,u),F(V,p))}function _e(u){te.current===u&&(W(V),W(te)),K.current===u&&(W(K),Qf._currentValue=J)}var Ue,Xe;function Ze(u){if(Ue===void 0)try{throw Error()}catch(p){var d=p.stack.trim().match(/\n( *(at )?)/);Ue=d&&d[1]||"",Xe=-1)":-1O||ue[v]!==Se[O]){var Ee=` -`+ue[v].replace(" at new "," at ");return u.displayName&&Ee.includes("")&&(Ee=Ee.replace("",u.displayName)),Ee}while(1<=v&&0<=O);break}}}finally{je=!1,Error.prepareStackTrace=p}return(p=u?u.displayName||u.name:"")?Xe(p):""}function He(u,d){switch(u.tag){case 26:case 27:case 5:return Xe(u.type);case 16:return Xe("Lazy");case 13:return u.child!==d&&d!==null?Xe("Suspense Fallback"):Xe("Suspense");case 19:return Xe("SuspenseList");case 0:case 15:return Qe(u.type,!1);case 11:return Qe(u.type.render,!1);case 1:return Qe(u.type,!0);case 31:return Xe("Activity");default:return""}}function $e(u){try{var d="",p=null;do d+=He(u,p),p=u,u=u.return;while(u);return d}catch(v){return` +`+Ue+u+Xe}var Oe=!1;function He(u,d){if(!u||Oe)return"";Oe=!0;var p=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var v={DetermineComponentFrameRoot:function(){try{if(d){var Re=function(){throw Error()};if(Object.defineProperty(Re.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Re,[])}catch(Ne){var Se=Ne}Reflect.construct(u,[],Re)}else{try{Re.call()}catch(Ne){Se=Ne}u.call(Re.prototype)}}else{try{throw Error()}catch(Ne){Se=Ne}(Re=u())&&typeof Re.catch=="function"&&Re.catch(function(){})}}catch(Ne){if(Ne&&Se&&typeof Ne.stack=="string")return[Ne.stack,Se.stack]}return[null,null]}};v.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var j=Object.getOwnPropertyDescriptor(v.DetermineComponentFrameRoot,"name");j&&j.configurable&&Object.defineProperty(v.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var O=v.DetermineComponentFrameRoot(),q=O[0],Y=O[1];if(q&&Y){var ce=q.split(` +`),we=Y.split(` +`);for(j=v=0;vj||ce[v]!==we[j]){var Ee=` +`+ce[v].replace(" at new "," at ");return u.displayName&&Ee.includes("")&&(Ee=Ee.replace("",u.displayName)),Ee}while(1<=v&&0<=j);break}}}finally{Oe=!1,Error.prepareStackTrace=p}return(p=u?u.displayName||u.name:"")?Ze(p):""}function Ve(u,d){switch(u.tag){case 26:case 27:case 5:return Ze(u.type);case 16:return Ze("Lazy");case 13:return u.child!==d&&d!==null?Ze("Suspense Fallback"):Ze("Suspense");case 19:return Ze("SuspenseList");case 0:case 15:return He(u.type,!1);case 11:return He(u.type.render,!1);case 1:return He(u.type,!0);case 31:return Ze("Activity");default:return""}}function Be(u){try{var d="",p=null;do d+=Ve(u,p),p=u,u=u.return;while(u);return d}catch(v){return` Error generating stack: `+v.message+` -`+v.stack}}var bt=Object.prototype.hasOwnProperty,lt=t.unstable_scheduleCallback,xn=t.unstable_cancelCallback,_n=t.unstable_shouldYield,Cn=t.unstable_requestPaint,Dt=t.unstable_now,xt=t.unstable_getCurrentPriorityLevel,Te=t.unstable_ImmediatePriority,Re=t.unstable_UserBlockingPriority,qe=t.unstable_NormalPriority,rt=t.unstable_LowPriority,wt=t.unstable_IdlePriority,jt=t.log,Ne=t.unstable_setDisableYieldValue,ie=null,xe=null;function Je(u){if(typeof jt=="function"&&Ne(u),xe&&typeof xe.setStrictMode=="function")try{xe.setStrictMode(ie,u)}catch{}}var dt=Math.clz32?Math.clz32:kn,er=Math.log,pt=Math.LN2;function kn(u){return u>>>=0,u===0?32:31-(er(u)/pt|0)|0}var vt=256,Gt=262144,Vt=4194304;function ot(u){var d=u&42;if(d!==0)return d;switch(u&-u){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return u&261888;case 262144:case 524288:case 1048576:case 2097152:return u&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return u&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return u}}function mr(u,d,p){var v=u.pendingLanes;if(v===0)return 0;var O=0,j=u.suspendedLanes,B=u.pingedLanes;u=u.warmLanes;var K=v&134217727;return K!==0?(v=K&~j,v!==0?O=ot(v):(B&=K,B!==0?O=ot(B):p||(p=K&~u,p!==0&&(O=ot(p))))):(K=v&~j,K!==0?O=ot(K):B!==0?O=ot(B):p||(p=v&~u,p!==0&&(O=ot(p)))),O===0?0:d!==0&&d!==O&&(d&j)===0&&(j=O&-O,p=d&-d,j>=p||j===32&&(p&4194048)!==0)?d:O}function Yr(u,d){return(u.pendingLanes&~(u.suspendedLanes&~u.pingedLanes)&d)===0}function Kr(u,d){switch(u){case 1:case 2:case 4:case 8:case 64:return d+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return d+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function pr(){var u=Vt;return Vt<<=1,(Vt&62914560)===0&&(Vt=4194304),u}function Cr(u){for(var d=[],p=0;31>p;p++)d.push(u);return d}function Bs(u,d){u.pendingLanes|=d,d!==268435456&&(u.suspendedLanes=0,u.pingedLanes=0,u.warmLanes=0)}function wr(u,d,p,v,O,j){var B=u.pendingLanes;u.pendingLanes=p,u.suspendedLanes=0,u.pingedLanes=0,u.warmLanes=0,u.expiredLanes&=p,u.entangledLanes&=p,u.errorRecoveryDisabledLanes&=p,u.shellSuspendCounter=0;var K=u.entanglements,ue=u.expirationTimes,Se=u.hiddenUpdates;for(p=B&~p;0"u")return null;try{return u.activeElement||u.body}catch{return u.body}}var JW=/[\n"\\]/g;function Li(u){return u.replace(JW,function(d){return"\\"+d.charCodeAt(0).toString(16)+" "})}function Hy(u,d,p,v,O,j,B,K){u.name="",B!=null&&typeof B!="function"&&typeof B!="symbol"&&typeof B!="boolean"?u.type=B:u.removeAttribute("type"),d!=null?B==="number"?(d===0&&u.value===""||u.value!=d)&&(u.value=""+Pi(d)):u.value!==""+Pi(d)&&(u.value=""+Pi(d)):B!=="submit"&&B!=="reset"||u.removeAttribute("value"),d!=null?Vy(u,B,Pi(d)):p!=null?Vy(u,B,Pi(p)):v!=null&&u.removeAttribute("value"),O==null&&j!=null&&(u.defaultChecked=!!j),O!=null&&(u.checked=O&&typeof O!="function"&&typeof O!="symbol"),K!=null&&typeof K!="function"&&typeof K!="symbol"&&typeof K!="boolean"?u.name=""+Pi(K):u.removeAttribute("name")}function Kj(u,d,p,v,O,j,B,K){if(j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"&&(u.type=j),d!=null||p!=null){if(!(j!=="submit"&&j!=="reset"||d!=null)){Qy(u);return}p=p!=null?""+Pi(p):"",d=d!=null?""+Pi(d):p,K||d===u.value||(u.value=d),u.defaultValue=d}v=v??O,v=typeof v!="function"&&typeof v!="symbol"&&!!v,u.checked=K?u.checked:!!v,u.defaultChecked=!!v,B!=null&&typeof B!="function"&&typeof B!="symbol"&&typeof B!="boolean"&&(u.name=B),Qy(u)}function Vy(u,d,p){d==="number"&&Ap(u.ownerDocument)===u||u.defaultValue===""+p||(u.defaultValue=""+p)}function Wu(u,d,p,v){if(u=u.options,d){d={};for(var O=0;O"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Yy=!1;if(Nl)try{var lf={};Object.defineProperty(lf,"passive",{get:function(){Yy=!0}}),window.addEventListener("test",lf,lf),window.removeEventListener("test",lf,lf)}catch{Yy=!1}var Eo=null,Ky=null,Dp=null;function sN(){if(Dp)return Dp;var u,d=Ky,p=d.length,v,O="value"in Eo?Eo.value:Eo.textContent,j=O.length;for(u=0;u=uf),uN=" ",dN=!1;function hN(u,d){switch(u){case"keyup":return CG.indexOf(d.keyCode)!==-1;case"keydown":return d.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function fN(u){return u=u.detail,typeof u=="object"&&"data"in u?u.data:null}var Ku=!1;function EG(u,d){switch(u){case"compositionend":return fN(d);case"keypress":return d.which!==32?null:(dN=!0,uN);case"textInput":return u=d.data,u===uN&&dN?null:u;default:return null}}function _G(u,d){if(Ku)return u==="compositionend"||!nb&&hN(u,d)?(u=sN(),Dp=Ky=Eo=null,Ku=!1,u):null;switch(u){case"paste":return null;case"keypress":if(!(d.ctrlKey||d.altKey||d.metaKey)||d.ctrlKey&&d.altKey){if(d.char&&1=d)return{node:p,offset:d-u};u=v}e:{for(;p;){if(p.nextSibling){p=p.nextSibling;break e}p=p.parentNode}p=void 0}p=wN(p)}}function kN(u,d){return u&&d?u===d?!0:u&&u.nodeType===3?!1:d&&d.nodeType===3?kN(u,d.parentNode):"contains"in u?u.contains(d):u.compareDocumentPosition?!!(u.compareDocumentPosition(d)&16):!1:!1}function ON(u){u=u!=null&&u.ownerDocument!=null&&u.ownerDocument.defaultView!=null?u.ownerDocument.defaultView:window;for(var d=Ap(u.document);d instanceof u.HTMLIFrameElement;){try{var p=typeof d.contentWindow.location.href=="string"}catch{p=!1}if(p)u=d.contentWindow;else break;d=Ap(u.document)}return d}function ib(u){var d=u&&u.nodeName&&u.nodeName.toLowerCase();return d&&(d==="input"&&(u.type==="text"||u.type==="search"||u.type==="tel"||u.type==="url"||u.type==="password")||d==="textarea"||u.contentEditable==="true")}var IG=Nl&&"documentMode"in document&&11>=document.documentMode,Zu=null,ab=null,mf=null,lb=!1;function jN(u,d,p){var v=p.window===p?p.document:p.nodeType===9?p:p.ownerDocument;lb||Zu==null||Zu!==Ap(v)||(v=Zu,"selectionStart"in v&&ib(v)?v={start:v.selectionStart,end:v.selectionEnd}:(v=(v.ownerDocument&&v.ownerDocument.defaultView||window).getSelection(),v={anchorNode:v.anchorNode,anchorOffset:v.anchorOffset,focusNode:v.focusNode,focusOffset:v.focusOffset}),mf&&ff(mf,v)||(mf=v,v=Cg(ab,"onSelect"),0>=B,O-=B,La=1<<32-dt(d)+O|p<qt?(en=ct,ct=null):en=ct.sibling;var jn=ke(ge,ct,be[qt],Me);if(jn===null){ct===null&&(ct=en);break}u&&ct&&jn.alternate===null&&d(ge,ct),me=j(jn,me,qt),On===null?yt=jn:On.sibling=jn,On=jn,ct=en}if(qt===be.length)return p(ge,ct),rn&&Tl(ge,qt),yt;if(ct===null){for(;qtqt?(en=ct,ct=null):en=ct.sibling;var Ko=ke(ge,ct,jn.value,Me);if(Ko===null){ct===null&&(ct=en);break}u&&ct&&Ko.alternate===null&&d(ge,ct),me=j(Ko,me,qt),On===null?yt=Ko:On.sibling=Ko,On=Ko,ct=en}if(jn.done)return p(ge,ct),rn&&Tl(ge,qt),yt;if(ct===null){for(;!jn.done;qt++,jn=be.next())jn=De(ge,jn.value,Me),jn!==null&&(me=j(jn,me,qt),On===null?yt=jn:On.sibling=jn,On=jn);return rn&&Tl(ge,qt),yt}for(ct=v(ct);!jn.done;qt++,jn=be.next())jn=Ce(ct,ge,qt,jn.value,Me),jn!==null&&(u&&jn.alternate!==null&&ct.delete(jn.key===null?qt:jn.key),me=j(jn,me,qt),On===null?yt=jn:On.sibling=jn,On=jn);return u&&ct.forEach(function(sY){return d(ge,sY)}),rn&&Tl(ge,qt),yt}function Ln(ge,me,be,Me){if(typeof be=="object"&&be!==null&&be.type===w&&be.key===null&&(be=be.props.children),typeof be=="object"&&be!==null){switch(be.$$typeof){case x:e:{for(var yt=be.key;me!==null;){if(me.key===yt){if(yt=be.type,yt===w){if(me.tag===7){p(ge,me.sibling),Me=O(me,be.props.children),Me.return=ge,ge=Me;break e}}else if(me.elementType===yt||typeof yt=="object"&&yt!==null&&yt.$$typeof===q&&Xc(yt)===me.type){p(ge,me.sibling),Me=O(me,be.props),bf(Me,be),Me.return=ge,ge=Me;break e}p(ge,me);break}else d(ge,me);me=me.sibling}be.type===w?(Me=Hc(be.props.children,ge.mode,Me,be.key),Me.return=ge,ge=Me):(Me=Hp(be.type,be.key,be.props,null,ge.mode,Me),bf(Me,be),Me.return=ge,ge=Me)}return B(ge);case y:e:{for(yt=be.key;me!==null;){if(me.key===yt)if(me.tag===4&&me.stateNode.containerInfo===be.containerInfo&&me.stateNode.implementation===be.implementation){p(ge,me.sibling),Me=O(me,be.children||[]),Me.return=ge,ge=Me;break e}else{p(ge,me);break}else d(ge,me);me=me.sibling}Me=mb(be,ge.mode,Me),Me.return=ge,ge=Me}return B(ge);case q:return be=Xc(be),Ln(ge,me,be,Me)}if(H(be))return st(ge,me,be,Me);if(V(be)){if(yt=V(be),typeof yt!="function")throw Error(r(150));return be=yt.call(be),Ot(ge,me,be,Me)}if(typeof be.then=="function")return Ln(ge,me,Kp(be),Me);if(be.$$typeof===C)return Ln(ge,me,Wp(ge,be),Me);Zp(ge,be)}return typeof be=="string"&&be!==""||typeof be=="number"||typeof be=="bigint"?(be=""+be,me!==null&&me.tag===6?(p(ge,me.sibling),Me=O(me,be),Me.return=ge,ge=Me):(p(ge,me),Me=fb(be,ge.mode,Me),Me.return=ge,ge=Me),B(ge)):p(ge,me)}return function(ge,me,be,Me){try{yf=0;var yt=Ln(ge,me,be,Me);return cd=null,yt}catch(ct){if(ct===od||ct===Xp)throw ct;var On=pi(29,ct,null,ge.mode);return On.lanes=Me,On.return=ge,On}finally{}}}var Kc=GN(!0),XN=GN(!1),Do=!1;function Nb(u){u.updateQueue={baseState:u.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Cb(u,d){u=u.updateQueue,d.updateQueue===u&&(d.updateQueue={baseState:u.baseState,firstBaseUpdate:u.firstBaseUpdate,lastBaseUpdate:u.lastBaseUpdate,shared:u.shared,callbacks:null})}function zo(u){return{lane:u,tag:0,payload:null,callback:null,next:null}}function Po(u,d,p){var v=u.updateQueue;if(v===null)return null;if(v=v.shared,(Tn&2)!==0){var O=v.pending;return O===null?d.next=d:(d.next=O.next,O.next=d),v.pending=d,d=Qp(u),AN(u,null,p),d}return $p(u,v,d,p),Qp(u)}function wf(u,d,p){if(d=d.updateQueue,d!==null&&(d=d.shared,(p&4194048)!==0)){var v=d.lanes;v&=u.pendingLanes,p|=v,d.lanes=p,Cs(u,p)}}function Tb(u,d){var p=u.updateQueue,v=u.alternate;if(v!==null&&(v=v.updateQueue,p===v)){var O=null,j=null;if(p=p.firstBaseUpdate,p!==null){do{var B={lane:p.lane,tag:p.tag,payload:p.payload,callback:null,next:null};j===null?O=j=B:j=j.next=B,p=p.next}while(p!==null);j===null?O=j=d:j=j.next=d}else O=j=d;p={baseState:v.baseState,firstBaseUpdate:O,lastBaseUpdate:j,shared:v.shared,callbacks:v.callbacks},u.updateQueue=p;return}u=p.lastBaseUpdate,u===null?p.firstBaseUpdate=d:u.next=d,p.lastBaseUpdate=d}var Eb=!1;function Sf(){if(Eb){var u=ld;if(u!==null)throw u}}function kf(u,d,p,v){Eb=!1;var O=u.updateQueue;Do=!1;var j=O.firstBaseUpdate,B=O.lastBaseUpdate,K=O.shared.pending;if(K!==null){O.shared.pending=null;var ue=K,Se=ue.next;ue.next=null,B===null?j=Se:B.next=Se,B=ue;var Ee=u.alternate;Ee!==null&&(Ee=Ee.updateQueue,K=Ee.lastBaseUpdate,K!==B&&(K===null?Ee.firstBaseUpdate=Se:K.next=Se,Ee.lastBaseUpdate=ue))}if(j!==null){var De=O.baseState;B=0,Ee=Se=ue=null,K=j;do{var ke=K.lane&-536870913,Ce=ke!==K.lane;if(Ce?(Jt&ke)===ke:(v&ke)===ke){ke!==0&&ke===ad&&(Eb=!0),Ee!==null&&(Ee=Ee.next={lane:0,tag:K.tag,payload:K.payload,callback:null,next:null});e:{var st=u,Ot=K;ke=d;var Ln=p;switch(Ot.tag){case 1:if(st=Ot.payload,typeof st=="function"){De=st.call(Ln,De,ke);break e}De=st;break e;case 3:st.flags=st.flags&-65537|128;case 0:if(st=Ot.payload,ke=typeof st=="function"?st.call(Ln,De,ke):st,ke==null)break e;De=m({},De,ke);break e;case 2:Do=!0}}ke=K.callback,ke!==null&&(u.flags|=64,Ce&&(u.flags|=8192),Ce=O.callbacks,Ce===null?O.callbacks=[ke]:Ce.push(ke))}else Ce={lane:ke,tag:K.tag,payload:K.payload,callback:K.callback,next:null},Ee===null?(Se=Ee=Ce,ue=De):Ee=Ee.next=Ce,B|=ke;if(K=K.next,K===null){if(K=O.shared.pending,K===null)break;Ce=K,K=Ce.next,Ce.next=null,O.lastBaseUpdate=Ce,O.shared.pending=null}}while(!0);Ee===null&&(ue=De),O.baseState=ue,O.firstBaseUpdate=Se,O.lastBaseUpdate=Ee,j===null&&(O.shared.lanes=0),Fo|=B,u.lanes=B,u.memoizedState=De}}function YN(u,d){if(typeof u!="function")throw Error(r(191,u));u.call(d)}function KN(u,d){var p=u.callbacks;if(p!==null)for(u.callbacks=null,u=0;uj?j:8;var B=P.T,K={};P.T=K,Gb(u,!1,d,p);try{var ue=O(),Se=P.S;if(Se!==null&&Se(K,ue),ue!==null&&typeof ue=="object"&&typeof ue.then=="function"){var Ee=WG(ue,v);Nf(u,d,Ee,bi(u))}else Nf(u,d,v,bi(u))}catch(De){Nf(u,d,{then:function(){},status:"rejected",reason:De},bi())}finally{W.p=j,B!==null&&K.types!==null&&(B.types=K.types),P.T=B}}function JG(){}function Ub(u,d,p,v){if(u.tag!==5)throw Error(r(476));var O=E7(u).queue;T7(u,O,d,J,p===null?JG:function(){return _7(u),p(v)})}function E7(u){var d=u.memoizedState;if(d!==null)return d;d={memoizedState:J,baseState:J,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Al,lastRenderedState:J},next:null};var p={};return d.next={memoizedState:p,baseState:p,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Al,lastRenderedState:p},next:null},u.memoizedState=d,u=u.alternate,u!==null&&(u.memoizedState=d),d}function _7(u){var d=E7(u);d.next===null&&(d=u.alternate.memoizedState),Nf(u,d.next.queue,{},bi())}function Wb(){return os(Qf)}function M7(){return kr().memoizedState}function A7(){return kr().memoizedState}function eX(u){for(var d=u.return;d!==null;){switch(d.tag){case 24:case 3:var p=bi();u=zo(p);var v=Po(d,u,p);v!==null&&(Ws(v,d,p),wf(v,d,p)),d={cache:Sb()},u.payload=d;return}d=d.return}}function tX(u,d,p){var v=bi();p={lane:v,revertLane:0,gesture:null,action:p,hasEagerState:!1,eagerState:null,next:null},og(u)?D7(d,p):(p=db(u,d,p,v),p!==null&&(Ws(p,u,v),z7(p,d,v)))}function R7(u,d,p){var v=bi();Nf(u,d,p,v)}function Nf(u,d,p,v){var O={lane:v,revertLane:0,gesture:null,action:p,hasEagerState:!1,eagerState:null,next:null};if(og(u))D7(d,O);else{var j=u.alternate;if(u.lanes===0&&(j===null||j.lanes===0)&&(j=d.lastRenderedReducer,j!==null))try{var B=d.lastRenderedState,K=j(B,p);if(O.hasEagerState=!0,O.eagerState=K,mi(K,B))return $p(u,d,O,0),Fn===null&&Fp(),!1}catch{}finally{}if(p=db(u,d,O,v),p!==null)return Ws(p,u,v),z7(p,d,v),!0}return!1}function Gb(u,d,p,v){if(v={lane:2,revertLane:N2(),gesture:null,action:v,hasEagerState:!1,eagerState:null,next:null},og(u)){if(d)throw Error(r(479))}else d=db(u,p,v,2),d!==null&&Ws(d,u,2)}function og(u){var d=u.alternate;return u===Lt||d!==null&&d===Lt}function D7(u,d){dd=tg=!0;var p=u.pending;p===null?d.next=d:(d.next=p.next,p.next=d),u.pending=d}function z7(u,d,p){if((p&4194048)!==0){var v=d.lanes;v&=u.pendingLanes,p|=v,d.lanes=p,Cs(u,p)}}var Cf={readContext:os,use:sg,useCallback:gr,useContext:gr,useEffect:gr,useImperativeHandle:gr,useLayoutEffect:gr,useInsertionEffect:gr,useMemo:gr,useReducer:gr,useRef:gr,useState:gr,useDebugValue:gr,useDeferredValue:gr,useTransition:gr,useSyncExternalStore:gr,useId:gr,useHostTransitionStatus:gr,useFormState:gr,useActionState:gr,useOptimistic:gr,useMemoCache:gr,useCacheRefresh:gr};Cf.useEffectEvent=gr;var P7={readContext:os,use:sg,useCallback:function(u,d){return Ts().memoizedState=[u,d===void 0?null:d],u},useContext:os,useEffect:y7,useImperativeHandle:function(u,d,p){p=p!=null?p.concat([u]):null,ag(4194308,4,k7.bind(null,d,u),p)},useLayoutEffect:function(u,d){return ag(4194308,4,u,d)},useInsertionEffect:function(u,d){ag(4,2,u,d)},useMemo:function(u,d){var p=Ts();d=d===void 0?null:d;var v=u();if(Zc){Je(!0);try{u()}finally{Je(!1)}}return p.memoizedState=[v,d],v},useReducer:function(u,d,p){var v=Ts();if(p!==void 0){var O=p(d);if(Zc){Je(!0);try{p(d)}finally{Je(!1)}}}else O=d;return v.memoizedState=v.baseState=O,u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:u,lastRenderedState:O},v.queue=u,u=u.dispatch=tX.bind(null,Lt,u),[v.memoizedState,u]},useRef:function(u){var d=Ts();return u={current:u},d.memoizedState=u},useState:function(u){u=Fb(u);var d=u.queue,p=R7.bind(null,Lt,d);return d.dispatch=p,[u.memoizedState,p]},useDebugValue:Hb,useDeferredValue:function(u,d){var p=Ts();return Vb(p,u,d)},useTransition:function(){var u=Fb(!1);return u=T7.bind(null,Lt,u.queue,!0,!1),Ts().memoizedState=u,[!1,u]},useSyncExternalStore:function(u,d,p){var v=Lt,O=Ts();if(rn){if(p===void 0)throw Error(r(407));p=p()}else{if(p=d(),Fn===null)throw Error(r(349));(Jt&127)!==0||r7(v,d,p)}O.memoizedState=p;var j={value:p,getSnapshot:d};return O.queue=j,y7(i7.bind(null,v,j,u),[u]),v.flags|=2048,fd(9,{destroy:void 0},s7.bind(null,v,j,p,d),null),p},useId:function(){var u=Ts(),d=Fn.identifierPrefix;if(rn){var p=Ia,v=La;p=(v&~(1<<32-dt(v)-1)).toString(32)+p,d="_"+d+"R_"+p,p=ng++,0<\/script>",j=j.removeChild(j.firstChild);break;case"select":j=typeof v.is=="string"?B.createElement("select",{is:v.is}):B.createElement("select"),v.multiple?j.multiple=!0:v.size&&(j.size=v.size);break;default:j=typeof v.is=="string"?B.createElement(O,{is:v.is}):B.createElement(O)}}j[Fr]=d,j[as]=v;e:for(B=d.child;B!==null;){if(B.tag===5||B.tag===6)j.appendChild(B.stateNode);else if(B.tag!==4&&B.tag!==27&&B.child!==null){B.child.return=B,B=B.child;continue}if(B===d)break e;for(;B.sibling===null;){if(B.return===null||B.return===d)break e;B=B.return}B.sibling.return=B.return,B=B.sibling}d.stateNode=j;e:switch(us(j,O,v),O){case"button":case"input":case"select":case"textarea":v=!!v.autoFocus;break e;case"img":v=!0;break e;default:v=!1}v&&Dl(d)}}return Kn(d),o2(d,d.type,u===null?null:u.memoizedProps,d.pendingProps,p),null;case 6:if(u&&d.stateNode!=null)u.memoizedProps!==v&&Dl(d);else{if(typeof v!="string"&&d.stateNode===null)throw Error(r(166));if(u=ne.current,sd(d)){if(u=d.stateNode,p=d.memoizedProps,v=null,O=ls,O!==null)switch(O.tag){case 27:case 5:v=O.memoizedProps}u[Fr]=d,u=!!(u.nodeValue===p||v!==null&&v.suppressHydrationWarning===!0||tC(u.nodeValue,p)),u||Ao(d,!0)}else u=Tg(u).createTextNode(v),u[Fr]=d,d.stateNode=u}return Kn(d),null;case 31:if(p=d.memoizedState,u===null||u.memoizedState!==null){if(v=sd(d),p!==null){if(u===null){if(!v)throw Error(r(318));if(u=d.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(r(557));u[Fr]=d}else Vc(),(d.flags&128)===0&&(d.memoizedState=null),d.flags|=4;Kn(d),u=!1}else p=vb(),u!==null&&u.memoizedState!==null&&(u.memoizedState.hydrationErrors=p),u=!0;if(!u)return d.flags&256?(xi(d),d):(xi(d),null);if((d.flags&128)!==0)throw Error(r(558))}return Kn(d),null;case 13:if(v=d.memoizedState,u===null||u.memoizedState!==null&&u.memoizedState.dehydrated!==null){if(O=sd(d),v!==null&&v.dehydrated!==null){if(u===null){if(!O)throw Error(r(318));if(O=d.memoizedState,O=O!==null?O.dehydrated:null,!O)throw Error(r(317));O[Fr]=d}else Vc(),(d.flags&128)===0&&(d.memoizedState=null),d.flags|=4;Kn(d),O=!1}else O=vb(),u!==null&&u.memoizedState!==null&&(u.memoizedState.hydrationErrors=O),O=!0;if(!O)return d.flags&256?(xi(d),d):(xi(d),null)}return xi(d),(d.flags&128)!==0?(d.lanes=p,d):(p=v!==null,u=u!==null&&u.memoizedState!==null,p&&(v=d.child,O=null,v.alternate!==null&&v.alternate.memoizedState!==null&&v.alternate.memoizedState.cachePool!==null&&(O=v.alternate.memoizedState.cachePool.pool),j=null,v.memoizedState!==null&&v.memoizedState.cachePool!==null&&(j=v.memoizedState.cachePool.pool),j!==O&&(v.flags|=2048)),p!==u&&p&&(d.child.flags|=8192),fg(d,d.updateQueue),Kn(d),null);case 4:return re(),u===null&&_2(d.stateNode.containerInfo),Kn(d),null;case 10:return _l(d.type),Kn(d),null;case 19:if(G(Sr),v=d.memoizedState,v===null)return Kn(d),null;if(O=(d.flags&128)!==0,j=v.rendering,j===null)if(O)Ef(v,!1);else{if(xr!==0||u!==null&&(u.flags&128)!==0)for(u=d.child;u!==null;){if(j=eg(u),j!==null){for(d.flags|=128,Ef(v,!1),u=j.updateQueue,d.updateQueue=u,fg(d,u),d.subtreeFlags=0,u=p,p=d.child;p!==null;)RN(p,u),p=p.sibling;return F(Sr,Sr.current&1|2),rn&&Tl(d,v.treeForkCount),d.child}u=u.sibling}v.tail!==null&&Dt()>vg&&(d.flags|=128,O=!0,Ef(v,!1),d.lanes=4194304)}else{if(!O)if(u=eg(j),u!==null){if(d.flags|=128,O=!0,u=u.updateQueue,d.updateQueue=u,fg(d,u),Ef(v,!0),v.tail===null&&v.tailMode==="hidden"&&!j.alternate&&!rn)return Kn(d),null}else 2*Dt()-v.renderingStartTime>vg&&p!==536870912&&(d.flags|=128,O=!0,Ef(v,!1),d.lanes=4194304);v.isBackwards?(j.sibling=d.child,d.child=j):(u=v.last,u!==null?u.sibling=j:d.child=j,v.last=j)}return v.tail!==null?(u=v.tail,v.rendering=u,v.tail=u.sibling,v.renderingStartTime=Dt(),u.sibling=null,p=Sr.current,F(Sr,O?p&1|2:p&1),rn&&Tl(d,v.treeForkCount),u):(Kn(d),null);case 22:case 23:return xi(d),Mb(),v=d.memoizedState!==null,u!==null?u.memoizedState!==null!==v&&(d.flags|=8192):v&&(d.flags|=8192),v?(p&536870912)!==0&&(d.flags&128)===0&&(Kn(d),d.subtreeFlags&6&&(d.flags|=8192)):Kn(d),p=d.updateQueue,p!==null&&fg(d,p.retryQueue),p=null,u!==null&&u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(p=u.memoizedState.cachePool.pool),v=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(v=d.memoizedState.cachePool.pool),v!==p&&(d.flags|=2048),u!==null&&G(Gc),null;case 24:return p=null,u!==null&&(p=u.memoizedState.cache),d.memoizedState.cache!==p&&(d.flags|=2048),_l(Er),Kn(d),null;case 25:return null;case 30:return null}throw Error(r(156,d.tag))}function aX(u,d){switch(gb(d),d.tag){case 1:return u=d.flags,u&65536?(d.flags=u&-65537|128,d):null;case 3:return _l(Er),re(),u=d.flags,(u&65536)!==0&&(u&128)===0?(d.flags=u&-65537|128,d):null;case 26:case 27:case 5:return _e(d),null;case 31:if(d.memoizedState!==null){if(xi(d),d.alternate===null)throw Error(r(340));Vc()}return u=d.flags,u&65536?(d.flags=u&-65537|128,d):null;case 13:if(xi(d),u=d.memoizedState,u!==null&&u.dehydrated!==null){if(d.alternate===null)throw Error(r(340));Vc()}return u=d.flags,u&65536?(d.flags=u&-65537|128,d):null;case 19:return G(Sr),null;case 4:return re(),null;case 10:return _l(d.type),null;case 22:case 23:return xi(d),Mb(),u!==null&&G(Gc),u=d.flags,u&65536?(d.flags=u&-65537|128,d):null;case 24:return _l(Er),null;case 25:return null;default:return null}}function a8(u,d){switch(gb(d),d.tag){case 3:_l(Er),re();break;case 26:case 27:case 5:_e(d);break;case 4:re();break;case 31:d.memoizedState!==null&&xi(d);break;case 13:xi(d);break;case 19:G(Sr);break;case 10:_l(d.type);break;case 22:case 23:xi(d),Mb(),u!==null&&G(Gc);break;case 24:_l(Er)}}function _f(u,d){try{var p=d.updateQueue,v=p!==null?p.lastEffect:null;if(v!==null){var O=v.next;p=O;do{if((p.tag&u)===u){v=void 0;var j=p.create,B=p.inst;v=j(),B.destroy=v}p=p.next}while(p!==O)}}catch(K){An(d,d.return,K)}}function Bo(u,d,p){try{var v=d.updateQueue,O=v!==null?v.lastEffect:null;if(O!==null){var j=O.next;v=j;do{if((v.tag&u)===u){var B=v.inst,K=B.destroy;if(K!==void 0){B.destroy=void 0,O=d;var ue=p,Se=K;try{Se()}catch(Ee){An(O,ue,Ee)}}}v=v.next}while(v!==j)}}catch(Ee){An(d,d.return,Ee)}}function l8(u){var d=u.updateQueue;if(d!==null){var p=u.stateNode;try{KN(d,p)}catch(v){An(u,u.return,v)}}}function o8(u,d,p){p.props=Jc(u.type,u.memoizedProps),p.state=u.memoizedState;try{p.componentWillUnmount()}catch(v){An(u,d,v)}}function Mf(u,d){try{var p=u.ref;if(p!==null){switch(u.tag){case 26:case 27:case 5:var v=u.stateNode;break;case 30:v=u.stateNode;break;default:v=u.stateNode}typeof p=="function"?u.refCleanup=p(v):p.current=v}}catch(O){An(u,d,O)}}function Ba(u,d){var p=u.ref,v=u.refCleanup;if(p!==null)if(typeof v=="function")try{v()}catch(O){An(u,d,O)}finally{u.refCleanup=null,u=u.alternate,u!=null&&(u.refCleanup=null)}else if(typeof p=="function")try{p(null)}catch(O){An(u,d,O)}else p.current=null}function c8(u){var d=u.type,p=u.memoizedProps,v=u.stateNode;try{e:switch(d){case"button":case"input":case"select":case"textarea":p.autoFocus&&v.focus();break e;case"img":p.src?v.src=p.src:p.srcSet&&(v.srcset=p.srcSet)}}catch(O){An(u,u.return,O)}}function c2(u,d,p){try{var v=u.stateNode;TX(v,u.type,p,d),v[as]=d}catch(O){An(u,u.return,O)}}function u8(u){return u.tag===5||u.tag===3||u.tag===26||u.tag===27&&Uo(u.type)||u.tag===4}function u2(u){e:for(;;){for(;u.sibling===null;){if(u.return===null||u8(u.return))return null;u=u.return}for(u.sibling.return=u.return,u=u.sibling;u.tag!==5&&u.tag!==6&&u.tag!==18;){if(u.tag===27&&Uo(u.type)||u.flags&2||u.child===null||u.tag===4)continue e;u.child.return=u,u=u.child}if(!(u.flags&2))return u.stateNode}}function d2(u,d,p){var v=u.tag;if(v===5||v===6)u=u.stateNode,d?(p.nodeType===9?p.body:p.nodeName==="HTML"?p.ownerDocument.body:p).insertBefore(u,d):(d=p.nodeType===9?p.body:p.nodeName==="HTML"?p.ownerDocument.body:p,d.appendChild(u),p=p._reactRootContainer,p!=null||d.onclick!==null||(d.onclick=jl));else if(v!==4&&(v===27&&Uo(u.type)&&(p=u.stateNode,d=null),u=u.child,u!==null))for(d2(u,d,p),u=u.sibling;u!==null;)d2(u,d,p),u=u.sibling}function mg(u,d,p){var v=u.tag;if(v===5||v===6)u=u.stateNode,d?p.insertBefore(u,d):p.appendChild(u);else if(v!==4&&(v===27&&Uo(u.type)&&(p=u.stateNode),u=u.child,u!==null))for(mg(u,d,p),u=u.sibling;u!==null;)mg(u,d,p),u=u.sibling}function d8(u){var d=u.stateNode,p=u.memoizedProps;try{for(var v=u.type,O=d.attributes;O.length;)d.removeAttributeNode(O[0]);us(d,v,p),d[Fr]=u,d[as]=p}catch(j){An(u,u.return,j)}}var zl=!1,Ar=!1,h2=!1,h8=typeof WeakSet=="function"?WeakSet:Set,Zr=null;function lX(u,d){if(u=u.containerInfo,R2=zg,u=ON(u),ib(u)){if("selectionStart"in u)var p={start:u.selectionStart,end:u.selectionEnd};else e:{p=(p=u.ownerDocument)&&p.defaultView||window;var v=p.getSelection&&p.getSelection();if(v&&v.rangeCount!==0){p=v.anchorNode;var O=v.anchorOffset,j=v.focusNode;v=v.focusOffset;try{p.nodeType,j.nodeType}catch{p=null;break e}var B=0,K=-1,ue=-1,Se=0,Ee=0,De=u,ke=null;t:for(;;){for(var Ce;De!==p||O!==0&&De.nodeType!==3||(K=B+O),De!==j||v!==0&&De.nodeType!==3||(ue=B+v),De.nodeType===3&&(B+=De.nodeValue.length),(Ce=De.firstChild)!==null;)ke=De,De=Ce;for(;;){if(De===u)break t;if(ke===p&&++Se===O&&(K=B),ke===j&&++Ee===v&&(ue=B),(Ce=De.nextSibling)!==null)break;De=ke,ke=De.parentNode}De=Ce}p=K===-1||ue===-1?null:{start:K,end:ue}}else p=null}p=p||{start:0,end:0}}else p=null;for(D2={focusedElem:u,selectionRange:p},zg=!1,Zr=d;Zr!==null;)if(d=Zr,u=d.child,(d.subtreeFlags&1028)!==0&&u!==null)u.return=d,Zr=u;else for(;Zr!==null;){switch(d=Zr,j=d.alternate,u=d.flags,d.tag){case 0:if((u&4)!==0&&(u=d.updateQueue,u=u!==null?u.events:null,u!==null))for(p=0;p title"))),us(j,v,p),j[Fr]=u,Tr(j),v=j;break e;case"link":var B=vC("link","href",O).get(v+(p.href||""));if(B){for(var K=0;KLn&&(B=Ln,Ln=Ot,Ot=B);var ge=SN(K,Ot),me=SN(K,Ln);if(ge&&me&&(Ce.rangeCount!==1||Ce.anchorNode!==ge.node||Ce.anchorOffset!==ge.offset||Ce.focusNode!==me.node||Ce.focusOffset!==me.offset)){var be=De.createRange();be.setStart(ge.node,ge.offset),Ce.removeAllRanges(),Ot>Ln?(Ce.addRange(be),Ce.extend(me.node,me.offset)):(be.setEnd(me.node,me.offset),Ce.addRange(be))}}}}for(De=[],Ce=K;Ce=Ce.parentNode;)Ce.nodeType===1&&De.push({element:Ce,left:Ce.scrollLeft,top:Ce.scrollTop});for(typeof K.focus=="function"&&K.focus(),K=0;Kp?32:p,P.T=null,p=y2,y2=null;var j=Qo,B=ql;if($r=0,vd=Qo=null,ql=0,(Tn&6)!==0)throw Error(r(331));var K=Tn;if(Tn|=4,k8(j.current),b8(j,j.current,B,p),Tn=K,Lf(0,!1),xe&&typeof xe.onPostCommitFiberRoot=="function")try{xe.onPostCommitFiberRoot(ie,j)}catch{}return!0}finally{W.p=O,P.T=v,F8(u,d)}}function Q8(u,d,p){d=Bi(p,d),d=Zb(u.stateNode,d,2),u=Po(u,d,2),u!==null&&(Bs(u,2),qa(u))}function An(u,d,p){if(u.tag===3)Q8(u,u,p);else for(;d!==null;){if(d.tag===3){Q8(d,u,p);break}else if(d.tag===1){var v=d.stateNode;if(typeof d.type.getDerivedStateFromError=="function"||typeof v.componentDidCatch=="function"&&($o===null||!$o.has(v))){u=Bi(p,u),p=H7(2),v=Po(d,p,2),v!==null&&(V7(p,v,d,u),Bs(v,2),qa(v));break}}d=d.return}}function k2(u,d,p){var v=u.pingCache;if(v===null){v=u.pingCache=new uX;var O=new Set;v.set(d,O)}else O=v.get(d),O===void 0&&(O=new Set,v.set(d,O));O.has(p)||(p2=!0,O.add(p),u=pX.bind(null,u,d,p),d.then(u,u))}function pX(u,d,p){var v=u.pingCache;v!==null&&v.delete(d),u.pingedLanes|=u.suspendedLanes&p,u.warmLanes&=~p,Fn===u&&(Jt&p)===p&&(xr===4||xr===3&&(Jt&62914560)===Jt&&300>Dt()-xg?(Tn&2)===0&&yd(u,0):g2|=p,xd===Jt&&(xd=0)),qa(u)}function H8(u,d){d===0&&(d=pr()),u=Qc(u,d),u!==null&&(Bs(u,d),qa(u))}function gX(u){var d=u.memoizedState,p=0;d!==null&&(p=d.retryLane),H8(u,p)}function xX(u,d){var p=0;switch(u.tag){case 31:case 13:var v=u.stateNode,O=u.memoizedState;O!==null&&(p=O.retryLane);break;case 19:v=u.stateNode;break;case 22:v=u.stateNode._retryCache;break;default:throw Error(r(314))}v!==null&&v.delete(d),H8(u,p)}function vX(u,d){return lt(u,d)}var Og=null,wd=null,O2=!1,jg=!1,j2=!1,Vo=0;function qa(u){u!==wd&&u.next===null&&(wd===null?Og=wd=u:wd=wd.next=u),jg=!0,O2||(O2=!0,bX())}function Lf(u,d){if(!j2&&jg){j2=!0;do for(var p=!1,v=Og;v!==null;){if(u!==0){var O=v.pendingLanes;if(O===0)var j=0;else{var B=v.suspendedLanes,K=v.pingedLanes;j=(1<<31-dt(42|u)+1)-1,j&=O&~(B&~K),j=j&201326741?j&201326741|1:j?j|2:0}j!==0&&(p=!0,G8(v,j))}else j=Jt,j=mr(v,v===Fn?j:0,v.cancelPendingCommit!==null||v.timeoutHandle!==-1),(j&3)===0||Yr(v,j)||(p=!0,G8(v,j));v=v.next}while(p);j2=!1}}function yX(){V8()}function V8(){jg=O2=!1;var u=0;Vo!==0&&_X()&&(u=Vo);for(var d=Dt(),p=null,v=Og;v!==null;){var O=v.next,j=U8(v,d);j===0?(v.next=null,p===null?Og=O:p.next=O,O===null&&(wd=p)):(p=v,(u!==0||(j&3)!==0)&&(jg=!0)),v=O}$r!==0&&$r!==5||Lf(u),Vo!==0&&(Vo=0)}function U8(u,d){for(var p=u.suspendedLanes,v=u.pingedLanes,O=u.expirationTimes,j=u.pendingLanes&-62914561;0K)break;var Ee=ue.transferSize,De=ue.initiatorType;Ee&&nC(De)&&(ue=ue.responseEnd,B+=Ee*(ue"u"?null:document;function mC(u,d,p){var v=Sd;if(v&&typeof d=="string"&&d){var O=Li(d);O='link[rel="'+u+'"][href="'+O+'"]',typeof p=="string"&&(O+='[crossorigin="'+p+'"]'),fC.has(O)||(fC.add(O),u={rel:u,crossOrigin:p,href:d},v.querySelector(O)===null&&(d=v.createElement("link"),us(d,"link",u),Tr(d),v.head.appendChild(d)))}}function BX(u){Fl.D(u),mC("dns-prefetch",u,null)}function qX(u,d){Fl.C(u,d),mC("preconnect",u,d)}function FX(u,d,p){Fl.L(u,d,p);var v=Sd;if(v&&u&&d){var O='link[rel="preload"][as="'+Li(d)+'"]';d==="image"&&p&&p.imageSrcSet?(O+='[imagesrcset="'+Li(p.imageSrcSet)+'"]',typeof p.imageSizes=="string"&&(O+='[imagesizes="'+Li(p.imageSizes)+'"]')):O+='[href="'+Li(u)+'"]';var j=O;switch(d){case"style":j=kd(u);break;case"script":j=Od(u)}Vi.has(j)||(u=m({rel:"preload",href:d==="image"&&p&&p.imageSrcSet?void 0:u,as:d},p),Vi.set(j,u),v.querySelector(O)!==null||d==="style"&&v.querySelector(Ff(j))||d==="script"&&v.querySelector($f(j))||(d=v.createElement("link"),us(d,"link",u),Tr(d),v.head.appendChild(d)))}}function $X(u,d){Fl.m(u,d);var p=Sd;if(p&&u){var v=d&&typeof d.as=="string"?d.as:"script",O='link[rel="modulepreload"][as="'+Li(v)+'"][href="'+Li(u)+'"]',j=O;switch(v){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":j=Od(u)}if(!Vi.has(j)&&(u=m({rel:"modulepreload",href:u},d),Vi.set(j,u),p.querySelector(O)===null)){switch(v){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(p.querySelector($f(j)))return}v=p.createElement("link"),us(v,"link",u),Tr(v),p.head.appendChild(v)}}}function QX(u,d,p){Fl.S(u,d,p);var v=Sd;if(v&&u){var O=To(v).hoistableStyles,j=kd(u);d=d||"default";var B=O.get(j);if(!B){var K={loading:0,preload:null};if(B=v.querySelector(Ff(j)))K.loading=5;else{u=m({rel:"stylesheet",href:u,"data-precedence":d},p),(p=Vi.get(j))&&F2(u,p);var ue=B=v.createElement("link");Tr(ue),us(ue,"link",u),ue._p=new Promise(function(Se,Ee){ue.onload=Se,ue.onerror=Ee}),ue.addEventListener("load",function(){K.loading|=1}),ue.addEventListener("error",function(){K.loading|=2}),K.loading|=4,_g(B,d,v)}B={type:"stylesheet",instance:B,count:1,state:K},O.set(j,B)}}}function HX(u,d){Fl.X(u,d);var p=Sd;if(p&&u){var v=To(p).hoistableScripts,O=Od(u),j=v.get(O);j||(j=p.querySelector($f(O)),j||(u=m({src:u,async:!0},d),(d=Vi.get(O))&&$2(u,d),j=p.createElement("script"),Tr(j),us(j,"link",u),p.head.appendChild(j)),j={type:"script",instance:j,count:1,state:null},v.set(O,j))}}function VX(u,d){Fl.M(u,d);var p=Sd;if(p&&u){var v=To(p).hoistableScripts,O=Od(u),j=v.get(O);j||(j=p.querySelector($f(O)),j||(u=m({src:u,async:!0,type:"module"},d),(d=Vi.get(O))&&$2(u,d),j=p.createElement("script"),Tr(j),us(j,"link",u),p.head.appendChild(j)),j={type:"script",instance:j,count:1,state:null},v.set(O,j))}}function pC(u,d,p,v){var O=(O=ne.current)?Eg(O):null;if(!O)throw Error(r(446));switch(u){case"meta":case"title":return null;case"style":return typeof p.precedence=="string"&&typeof p.href=="string"?(d=kd(p.href),p=To(O).hoistableStyles,v=p.get(d),v||(v={type:"style",instance:null,count:0,state:null},p.set(d,v)),v):{type:"void",instance:null,count:0,state:null};case"link":if(p.rel==="stylesheet"&&typeof p.href=="string"&&typeof p.precedence=="string"){u=kd(p.href);var j=To(O).hoistableStyles,B=j.get(u);if(B||(O=O.ownerDocument||O,B={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},j.set(u,B),(j=O.querySelector(Ff(u)))&&!j._p&&(B.instance=j,B.state.loading=5),Vi.has(u)||(p={rel:"preload",as:"style",href:p.href,crossOrigin:p.crossOrigin,integrity:p.integrity,media:p.media,hrefLang:p.hrefLang,referrerPolicy:p.referrerPolicy},Vi.set(u,p),j||UX(O,u,p,B.state))),d&&v===null)throw Error(r(528,""));return B}if(d&&v!==null)throw Error(r(529,""));return null;case"script":return d=p.async,p=p.src,typeof p=="string"&&d&&typeof d!="function"&&typeof d!="symbol"?(d=Od(p),p=To(O).hoistableScripts,v=p.get(d),v||(v={type:"script",instance:null,count:0,state:null},p.set(d,v)),v):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,u))}}function kd(u){return'href="'+Li(u)+'"'}function Ff(u){return'link[rel="stylesheet"]['+u+"]"}function gC(u){return m({},u,{"data-precedence":u.precedence,precedence:null})}function UX(u,d,p,v){u.querySelector('link[rel="preload"][as="style"]['+d+"]")?v.loading=1:(d=u.createElement("link"),v.preload=d,d.addEventListener("load",function(){return v.loading|=1}),d.addEventListener("error",function(){return v.loading|=2}),us(d,"link",p),Tr(d),u.head.appendChild(d))}function Od(u){return'[src="'+Li(u)+'"]'}function $f(u){return"script[async]"+u}function xC(u,d,p){if(d.count++,d.instance===null)switch(d.type){case"style":var v=u.querySelector('style[data-href~="'+Li(p.href)+'"]');if(v)return d.instance=v,Tr(v),v;var O=m({},p,{"data-href":p.href,"data-precedence":p.precedence,href:null,precedence:null});return v=(u.ownerDocument||u).createElement("style"),Tr(v),us(v,"style",O),_g(v,p.precedence,u),d.instance=v;case"stylesheet":O=kd(p.href);var j=u.querySelector(Ff(O));if(j)return d.state.loading|=4,d.instance=j,Tr(j),j;v=gC(p),(O=Vi.get(O))&&F2(v,O),j=(u.ownerDocument||u).createElement("link"),Tr(j);var B=j;return B._p=new Promise(function(K,ue){B.onload=K,B.onerror=ue}),us(j,"link",v),d.state.loading|=4,_g(j,p.precedence,u),d.instance=j;case"script":return j=Od(p.src),(O=u.querySelector($f(j)))?(d.instance=O,Tr(O),O):(v=p,(O=Vi.get(j))&&(v=m({},p),$2(v,O)),u=u.ownerDocument||u,O=u.createElement("script"),Tr(O),us(O,"link",v),u.head.appendChild(O),d.instance=O);case"void":return null;default:throw Error(r(443,d.type))}else d.type==="stylesheet"&&(d.state.loading&4)===0&&(v=d.instance,d.state.loading|=4,_g(v,p.precedence,u));return d.instance}function _g(u,d,p){for(var v=p.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),O=v.length?v[v.length-1]:null,j=O,B=0;B title"):null)}function WX(u,d,p){if(p===1||d.itemProp!=null)return!1;switch(u){case"meta":case"title":return!0;case"style":if(typeof d.precedence!="string"||typeof d.href!="string"||d.href==="")break;return!0;case"link":if(typeof d.rel!="string"||typeof d.href!="string"||d.href===""||d.onLoad||d.onError)break;switch(d.rel){case"stylesheet":return u=d.disabled,typeof d.precedence=="string"&&u==null;default:return!0}case"script":if(d.async&&typeof d.async!="function"&&typeof d.async!="symbol"&&!d.onLoad&&!d.onError&&d.src&&typeof d.src=="string")return!0}return!1}function bC(u){return!(u.type==="stylesheet"&&(u.state.loading&3)===0)}function GX(u,d,p,v){if(p.type==="stylesheet"&&(typeof v.media!="string"||matchMedia(v.media).matches!==!1)&&(p.state.loading&4)===0){if(p.instance===null){var O=kd(v.href),j=d.querySelector(Ff(O));if(j){d=j._p,d!==null&&typeof d=="object"&&typeof d.then=="function"&&(u.count++,u=Ag.bind(u),d.then(u,u)),p.state.loading|=4,p.instance=j,Tr(j);return}j=d.ownerDocument||d,v=gC(v),(O=Vi.get(O))&&F2(v,O),j=j.createElement("link"),Tr(j);var B=j;B._p=new Promise(function(K,ue){B.onload=K,B.onerror=ue}),us(j,"link",v),p.instance=j}u.stylesheets===null&&(u.stylesheets=new Map),u.stylesheets.set(p,d),(d=p.state.preload)&&(p.state.loading&3)===0&&(u.count++,p=Ag.bind(u),d.addEventListener("load",p),d.addEventListener("error",p))}}var Q2=0;function XX(u,d){return u.stylesheets&&u.count===0&&Dg(u,u.stylesheets),0Q2?50:800)+d);return u.unsuspend=p,function(){u.unsuspend=null,clearTimeout(v),clearTimeout(O)}}:null}function Ag(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Dg(this,this.stylesheets);else if(this.unsuspend){var u=this.unsuspend;this.unsuspend=null,u()}}}var Rg=null;function Dg(u,d){u.stylesheets=null,u.unsuspend!==null&&(u.count++,Rg=new Map,d.forEach(YX,u),Rg=null,Ag.call(u))}function YX(u,d){if(!(d.state.loading&4)){var p=Rg.get(u);if(p)var v=p.get(null);else{p=new Map,Rg.set(u,p);for(var O=u.querySelectorAll("link[data-precedence],style[data-precedence]"),j=0;j"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),Z2.exports=nZ(),Z2.exports}var sZ=rZ();function uz(t,e){return function(){return t.apply(e,arguments)}}const{toString:iZ}=Object.prototype,{getPrototypeOf:t6}=Object,{iterator:Dv,toStringTag:dz}=Symbol,zv=(t=>e=>{const n=iZ.call(e);return t[n]||(t[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),Aa=t=>(t=t.toLowerCase(),e=>zv(e)===t),Pv=t=>e=>typeof e===t,{isArray:Dh}=Array,ph=Pv("undefined");function P0(t){return t!==null&&!ph(t)&&t.constructor!==null&&!ph(t.constructor)&&ni(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const hz=Aa("ArrayBuffer");function aZ(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&hz(t.buffer),e}const lZ=Pv("string"),ni=Pv("function"),fz=Pv("number"),L0=t=>t!==null&&typeof t=="object",oZ=t=>t===!0||t===!1,Xx=t=>{if(zv(t)!=="object")return!1;const e=t6(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(dz in t)&&!(Dv in t)},cZ=t=>{if(!L0(t)||P0(t))return!1;try{return Object.keys(t).length===0&&Object.getPrototypeOf(t)===Object.prototype}catch{return!1}},uZ=Aa("Date"),dZ=Aa("File"),hZ=Aa("Blob"),fZ=Aa("FileList"),mZ=t=>L0(t)&&ni(t.pipe),pZ=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||ni(t.append)&&((e=zv(t))==="formdata"||e==="object"&&ni(t.toString)&&t.toString()==="[object FormData]"))},gZ=Aa("URLSearchParams"),[xZ,vZ,yZ,bZ]=["ReadableStream","Request","Response","Headers"].map(Aa),wZ=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function I0(t,e,{allOwnKeys:n=!1}={}){if(t===null||typeof t>"u")return;let r,s;if(typeof t!="object"&&(t=[t]),Dh(t))for(r=0,s=t.length;r0;)if(s=n[r],e===s.toLowerCase())return s;return null}const fu=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,pz=t=>!ph(t)&&t!==fu;function A3(){const{caseless:t,skipUndefined:e}=pz(this)&&this||{},n={},r=(s,i)=>{const a=t&&mz(n,i)||i;Xx(n[a])&&Xx(s)?n[a]=A3(n[a],s):Xx(s)?n[a]=A3({},s):Dh(s)?n[a]=s.slice():(!e||!ph(s))&&(n[a]=s)};for(let s=0,i=arguments.length;s(I0(e,(s,i)=>{n&&ni(s)?t[i]=uz(s,n):t[i]=s},{allOwnKeys:r}),t),kZ=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),OZ=(t,e,n,r)=>{t.prototype=Object.create(e.prototype,r),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),n&&Object.assign(t.prototype,n)},jZ=(t,e,n,r)=>{let s,i,a;const o={};if(e=e||{},t==null)return e;do{for(s=Object.getOwnPropertyNames(t),i=s.length;i-- >0;)a=s[i],(!r||r(a,t,e))&&!o[a]&&(e[a]=t[a],o[a]=!0);t=n!==!1&&t6(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},NZ=(t,e,n)=>{t=String(t),(n===void 0||n>t.length)&&(n=t.length),n-=e.length;const r=t.indexOf(e,n);return r!==-1&&r===n},CZ=t=>{if(!t)return null;if(Dh(t))return t;let e=t.length;if(!fz(e))return null;const n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},TZ=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&t6(Uint8Array)),EZ=(t,e)=>{const r=(t&&t[Dv]).call(t);let s;for(;(s=r.next())&&!s.done;){const i=s.value;e.call(t,i[0],i[1])}},_Z=(t,e)=>{let n;const r=[];for(;(n=t.exec(e))!==null;)r.push(n);return r},MZ=Aa("HTMLFormElement"),AZ=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),UC=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),RZ=Aa("RegExp"),gz=(t,e)=>{const n=Object.getOwnPropertyDescriptors(t),r={};I0(n,(s,i)=>{let a;(a=e(s,i,t))!==!1&&(r[i]=a||s)}),Object.defineProperties(t,r)},DZ=t=>{gz(t,(e,n)=>{if(ni(t)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=t[n];if(ni(r)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},zZ=(t,e)=>{const n={},r=s=>{s.forEach(i=>{n[i]=!0})};return Dh(t)?r(t):r(String(t).split(e)),n},PZ=()=>{},LZ=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function IZ(t){return!!(t&&ni(t.append)&&t[dz]==="FormData"&&t[Dv])}const BZ=t=>{const e=new Array(10),n=(r,s)=>{if(L0(r)){if(e.indexOf(r)>=0)return;if(P0(r))return r;if(!("toJSON"in r)){e[s]=r;const i=Dh(r)?[]:{};return I0(r,(a,o)=>{const c=n(a,s+1);!ph(c)&&(i[o]=c)}),e[s]=void 0,i}}return r};return n(t,0)},qZ=Aa("AsyncFunction"),FZ=t=>t&&(L0(t)||ni(t))&&ni(t.then)&&ni(t.catch),xz=((t,e)=>t?setImmediate:e?((n,r)=>(fu.addEventListener("message",({source:s,data:i})=>{s===fu&&i===n&&r.length&&r.shift()()},!1),s=>{r.push(s),fu.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",ni(fu.postMessage)),$Z=typeof queueMicrotask<"u"?queueMicrotask.bind(fu):typeof process<"u"&&process.nextTick||xz,QZ=t=>t!=null&&ni(t[Dv]),Oe={isArray:Dh,isArrayBuffer:hz,isBuffer:P0,isFormData:pZ,isArrayBufferView:aZ,isString:lZ,isNumber:fz,isBoolean:oZ,isObject:L0,isPlainObject:Xx,isEmptyObject:cZ,isReadableStream:xZ,isRequest:vZ,isResponse:yZ,isHeaders:bZ,isUndefined:ph,isDate:uZ,isFile:dZ,isBlob:hZ,isRegExp:RZ,isFunction:ni,isStream:mZ,isURLSearchParams:gZ,isTypedArray:TZ,isFileList:fZ,forEach:I0,merge:A3,extend:SZ,trim:wZ,stripBOM:kZ,inherits:OZ,toFlatObject:jZ,kindOf:zv,kindOfTest:Aa,endsWith:NZ,toArray:CZ,forEachEntry:EZ,matchAll:_Z,isHTMLForm:MZ,hasOwnProperty:UC,hasOwnProp:UC,reduceDescriptors:gz,freezeMethods:DZ,toObjectSet:zZ,toCamelCase:AZ,noop:PZ,toFiniteNumber:LZ,findKey:mz,global:fu,isContextDefined:pz,isSpecCompliantForm:IZ,toJSONObject:BZ,isAsyncFn:qZ,isThenable:FZ,setImmediate:xz,asap:$Z,isIterable:QZ};function Bt(t,e,n,r,s){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),n&&(this.config=n),r&&(this.request=r),s&&(this.response=s,this.status=s.status?s.status:null)}Oe.inherits(Bt,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Oe.toJSONObject(this.config),code:this.code,status:this.status}}});const vz=Bt.prototype,yz={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{yz[t]={value:t}});Object.defineProperties(Bt,yz);Object.defineProperty(vz,"isAxiosError",{value:!0});Bt.from=(t,e,n,r,s,i)=>{const a=Object.create(vz);Oe.toFlatObject(t,a,function(f){return f!==Error.prototype},h=>h!=="isAxiosError");const o=t&&t.message?t.message:"Error",c=e==null&&t?t.code:e;return Bt.call(a,o,c,n,r,s),t&&a.cause==null&&Object.defineProperty(a,"cause",{value:t,configurable:!0}),a.name=t&&t.name||"Error",i&&Object.assign(a,i),a};const HZ=null;function R3(t){return Oe.isPlainObject(t)||Oe.isArray(t)}function bz(t){return Oe.endsWith(t,"[]")?t.slice(0,-2):t}function WC(t,e,n){return t?t.concat(e).map(function(s,i){return s=bz(s),!n&&i?"["+s+"]":s}).join(n?".":""):e}function VZ(t){return Oe.isArray(t)&&!t.some(R3)}const UZ=Oe.toFlatObject(Oe,{},null,function(e){return/^is[A-Z]/.test(e)});function Lv(t,e,n){if(!Oe.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,n=Oe.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(w,S){return!Oe.isUndefined(S[w])});const r=n.metaTokens,s=n.visitor||f,i=n.dots,a=n.indexes,c=(n.Blob||typeof Blob<"u"&&Blob)&&Oe.isSpecCompliantForm(e);if(!Oe.isFunction(s))throw new TypeError("visitor must be a function");function h(y){if(y===null)return"";if(Oe.isDate(y))return y.toISOString();if(Oe.isBoolean(y))return y.toString();if(!c&&Oe.isBlob(y))throw new Bt("Blob is not supported. Use a Buffer instead.");return Oe.isArrayBuffer(y)||Oe.isTypedArray(y)?c&&typeof Blob=="function"?new Blob([y]):Buffer.from(y):y}function f(y,w,S){let k=y;if(y&&!S&&typeof y=="object"){if(Oe.endsWith(w,"{}"))w=r?w:w.slice(0,-2),y=JSON.stringify(y);else if(Oe.isArray(y)&&VZ(y)||(Oe.isFileList(y)||Oe.endsWith(w,"[]"))&&(k=Oe.toArray(y)))return w=bz(w),k.forEach(function(C,T){!(Oe.isUndefined(C)||C===null)&&e.append(a===!0?WC([w],T,i):a===null?w:w+"[]",h(C))}),!1}return R3(y)?!0:(e.append(WC(S,w,i),h(y)),!1)}const m=[],g=Object.assign(UZ,{defaultVisitor:f,convertValue:h,isVisitable:R3});function x(y,w){if(!Oe.isUndefined(y)){if(m.indexOf(y)!==-1)throw Error("Circular reference detected in "+w.join("."));m.push(y),Oe.forEach(y,function(k,N){(!(Oe.isUndefined(k)||k===null)&&s.call(e,k,Oe.isString(N)?N.trim():N,w,g))===!0&&x(k,w?w.concat(N):[N])}),m.pop()}}if(!Oe.isObject(t))throw new TypeError("data must be an object");return x(t),e}function GC(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(r){return e[r]})}function n6(t,e){this._pairs=[],t&&Lv(t,this,e)}const wz=n6.prototype;wz.append=function(e,n){this._pairs.push([e,n])};wz.toString=function(e){const n=e?function(r){return e.call(this,r,GC)}:GC;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function WZ(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Sz(t,e,n){if(!e)return t;const r=n&&n.encode||WZ;Oe.isFunction(n)&&(n={serialize:n});const s=n&&n.serialize;let i;if(s?i=s(e,n):i=Oe.isURLSearchParams(e)?e.toString():new n6(e,n).toString(r),i){const a=t.indexOf("#");a!==-1&&(t=t.slice(0,a)),t+=(t.indexOf("?")===-1?"?":"&")+i}return t}class XC{constructor(){this.handlers=[]}use(e,n,r){return this.handlers.push({fulfilled:e,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){Oe.forEach(this.handlers,function(r){r!==null&&e(r)})}}const kz={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},GZ=typeof URLSearchParams<"u"?URLSearchParams:n6,XZ=typeof FormData<"u"?FormData:null,YZ=typeof Blob<"u"?Blob:null,KZ={isBrowser:!0,classes:{URLSearchParams:GZ,FormData:XZ,Blob:YZ},protocols:["http","https","file","blob","url","data"]},r6=typeof window<"u"&&typeof document<"u",D3=typeof navigator=="object"&&navigator||void 0,ZZ=r6&&(!D3||["ReactNative","NativeScript","NS"].indexOf(D3.product)<0),JZ=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",eJ=r6&&window.location.href||"http://localhost",tJ=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:r6,hasStandardBrowserEnv:ZZ,hasStandardBrowserWebWorkerEnv:JZ,navigator:D3,origin:eJ},Symbol.toStringTag,{value:"Module"})),ws={...tJ,...KZ};function nJ(t,e){return Lv(t,new ws.classes.URLSearchParams,{visitor:function(n,r,s,i){return ws.isNode&&Oe.isBuffer(n)?(this.append(r,n.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...e})}function rJ(t){return Oe.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function sJ(t){const e={},n=Object.keys(t);let r;const s=n.length;let i;for(r=0;r=n.length;return a=!a&&Oe.isArray(s)?s.length:a,c?(Oe.hasOwnProp(s,a)?s[a]=[s[a],r]:s[a]=r,!o):((!s[a]||!Oe.isObject(s[a]))&&(s[a]=[]),e(n,r,s[a],i)&&Oe.isArray(s[a])&&(s[a]=sJ(s[a])),!o)}if(Oe.isFormData(t)&&Oe.isFunction(t.entries)){const n={};return Oe.forEachEntry(t,(r,s)=>{e(rJ(r),s,n,0)}),n}return null}function iJ(t,e,n){if(Oe.isString(t))try{return(e||JSON.parse)(t),Oe.trim(t)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(t)}const B0={transitional:kz,adapter:["xhr","http","fetch"],transformRequest:[function(e,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,i=Oe.isObject(e);if(i&&Oe.isHTMLForm(e)&&(e=new FormData(e)),Oe.isFormData(e))return s?JSON.stringify(Oz(e)):e;if(Oe.isArrayBuffer(e)||Oe.isBuffer(e)||Oe.isStream(e)||Oe.isFile(e)||Oe.isBlob(e)||Oe.isReadableStream(e))return e;if(Oe.isArrayBufferView(e))return e.buffer;if(Oe.isURLSearchParams(e))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let o;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return nJ(e,this.formSerializer).toString();if((o=Oe.isFileList(e))||r.indexOf("multipart/form-data")>-1){const c=this.env&&this.env.FormData;return Lv(o?{"files[]":e}:e,c&&new c,this.formSerializer)}}return i||s?(n.setContentType("application/json",!1),iJ(e)):e}],transformResponse:[function(e){const n=this.transitional||B0.transitional,r=n&&n.forcedJSONParsing,s=this.responseType==="json";if(Oe.isResponse(e)||Oe.isReadableStream(e))return e;if(e&&Oe.isString(e)&&(r&&!this.responseType||s)){const a=!(n&&n.silentJSONParsing)&&s;try{return JSON.parse(e,this.parseReviver)}catch(o){if(a)throw o.name==="SyntaxError"?Bt.from(o,Bt.ERR_BAD_RESPONSE,this,null,this.response):o}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:ws.classes.FormData,Blob:ws.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Oe.forEach(["delete","get","head","post","put","patch"],t=>{B0.headers[t]={}});const aJ=Oe.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),lJ=t=>{const e={};let n,r,s;return t&&t.split(` -`).forEach(function(a){s=a.indexOf(":"),n=a.substring(0,s).trim().toLowerCase(),r=a.substring(s+1).trim(),!(!n||e[n]&&aJ[n])&&(n==="set-cookie"?e[n]?e[n].push(r):e[n]=[r]:e[n]=e[n]?e[n]+", "+r:r)}),e},YC=Symbol("internals");function Xf(t){return t&&String(t).trim().toLowerCase()}function Yx(t){return t===!1||t==null?t:Oe.isArray(t)?t.map(Yx):String(t)}function oJ(t){const e=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(t);)e[r[1]]=r[2];return e}const cJ=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function tw(t,e,n,r,s){if(Oe.isFunction(r))return r.call(this,e,n);if(s&&(e=n),!!Oe.isString(e)){if(Oe.isString(r))return e.indexOf(r)!==-1;if(Oe.isRegExp(r))return r.test(e)}}function uJ(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,n,r)=>n.toUpperCase()+r)}function dJ(t,e){const n=Oe.toCamelCase(" "+e);["get","set","has"].forEach(r=>{Object.defineProperty(t,r+n,{value:function(s,i,a){return this[r].call(this,e,s,i,a)},configurable:!0})})}let ri=class{constructor(e){e&&this.set(e)}set(e,n,r){const s=this;function i(o,c,h){const f=Xf(c);if(!f)throw new Error("header name must be a non-empty string");const m=Oe.findKey(s,f);(!m||s[m]===void 0||h===!0||h===void 0&&s[m]!==!1)&&(s[m||c]=Yx(o))}const a=(o,c)=>Oe.forEach(o,(h,f)=>i(h,f,c));if(Oe.isPlainObject(e)||e instanceof this.constructor)a(e,n);else if(Oe.isString(e)&&(e=e.trim())&&!cJ(e))a(lJ(e),n);else if(Oe.isObject(e)&&Oe.isIterable(e)){let o={},c,h;for(const f of e){if(!Oe.isArray(f))throw TypeError("Object iterator must return a key-value pair");o[h=f[0]]=(c=o[h])?Oe.isArray(c)?[...c,f[1]]:[c,f[1]]:f[1]}a(o,n)}else e!=null&&i(n,e,r);return this}get(e,n){if(e=Xf(e),e){const r=Oe.findKey(this,e);if(r){const s=this[r];if(!n)return s;if(n===!0)return oJ(s);if(Oe.isFunction(n))return n.call(this,s,r);if(Oe.isRegExp(n))return n.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,n){if(e=Xf(e),e){const r=Oe.findKey(this,e);return!!(r&&this[r]!==void 0&&(!n||tw(this,this[r],r,n)))}return!1}delete(e,n){const r=this;let s=!1;function i(a){if(a=Xf(a),a){const o=Oe.findKey(r,a);o&&(!n||tw(r,r[o],o,n))&&(delete r[o],s=!0)}}return Oe.isArray(e)?e.forEach(i):i(e),s}clear(e){const n=Object.keys(this);let r=n.length,s=!1;for(;r--;){const i=n[r];(!e||tw(this,this[i],i,e,!0))&&(delete this[i],s=!0)}return s}normalize(e){const n=this,r={};return Oe.forEach(this,(s,i)=>{const a=Oe.findKey(r,i);if(a){n[a]=Yx(s),delete n[i];return}const o=e?uJ(i):String(i).trim();o!==i&&delete n[i],n[o]=Yx(s),r[o]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const n=Object.create(null);return Oe.forEach(this,(r,s)=>{r!=null&&r!==!1&&(n[s]=e&&Oe.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,n])=>e+": "+n).join(` -`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...n){const r=new this(e);return n.forEach(s=>r.set(s)),r}static accessor(e){const r=(this[YC]=this[YC]={accessors:{}}).accessors,s=this.prototype;function i(a){const o=Xf(a);r[o]||(dJ(s,a),r[o]=!0)}return Oe.isArray(e)?e.forEach(i):i(e),this}};ri.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);Oe.reduceDescriptors(ri.prototype,({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(r){this[n]=r}}});Oe.freezeMethods(ri);function nw(t,e){const n=this||B0,r=e||n,s=ri.from(r.headers);let i=r.data;return Oe.forEach(t,function(o){i=o.call(n,i,s.normalize(),e?e.status:void 0)}),s.normalize(),i}function jz(t){return!!(t&&t.__CANCEL__)}function zh(t,e,n){Bt.call(this,t??"canceled",Bt.ERR_CANCELED,e,n),this.name="CanceledError"}Oe.inherits(zh,Bt,{__CANCEL__:!0});function Nz(t,e,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?t(n):e(new Bt("Request failed with status code "+n.status,[Bt.ERR_BAD_REQUEST,Bt.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function hJ(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function fJ(t,e){t=t||10;const n=new Array(t),r=new Array(t);let s=0,i=0,a;return e=e!==void 0?e:1e3,function(c){const h=Date.now(),f=r[i];a||(a=h),n[s]=c,r[s]=h;let m=i,g=0;for(;m!==s;)g+=n[m++],m=m%t;if(s=(s+1)%t,s===i&&(i=(i+1)%t),h-a{n=f,s=null,i&&(clearTimeout(i),i=null),t(...h)};return[(...h)=>{const f=Date.now(),m=f-n;m>=r?a(h,f):(s=h,i||(i=setTimeout(()=>{i=null,a(s)},r-m)))},()=>s&&a(s)]}const N1=(t,e,n=3)=>{let r=0;const s=fJ(50,250);return mJ(i=>{const a=i.loaded,o=i.lengthComputable?i.total:void 0,c=a-r,h=s(c),f=a<=o;r=a;const m={loaded:a,total:o,progress:o?a/o:void 0,bytes:c,rate:h||void 0,estimated:h&&o&&f?(o-a)/h:void 0,event:i,lengthComputable:o!=null,[e?"download":"upload"]:!0};t(m)},n)},KC=(t,e)=>{const n=t!=null;return[r=>e[0]({lengthComputable:n,total:t,loaded:r}),e[1]]},ZC=t=>(...e)=>Oe.asap(()=>t(...e)),pJ=ws.hasStandardBrowserEnv?((t,e)=>n=>(n=new URL(n,ws.origin),t.protocol===n.protocol&&t.host===n.host&&(e||t.port===n.port)))(new URL(ws.origin),ws.navigator&&/(msie|trident)/i.test(ws.navigator.userAgent)):()=>!0,gJ=ws.hasStandardBrowserEnv?{write(t,e,n,r,s,i,a){if(typeof document>"u")return;const o=[`${t}=${encodeURIComponent(e)}`];Oe.isNumber(n)&&o.push(`expires=${new Date(n).toUTCString()}`),Oe.isString(r)&&o.push(`path=${r}`),Oe.isString(s)&&o.push(`domain=${s}`),i===!0&&o.push("secure"),Oe.isString(a)&&o.push(`SameSite=${a}`),document.cookie=o.join("; ")},read(t){if(typeof document>"u")return null;const e=document.cookie.match(new RegExp("(?:^|; )"+t+"=([^;]*)"));return e?decodeURIComponent(e[1]):null},remove(t){this.write(t,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function xJ(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function vJ(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function Cz(t,e,n){let r=!xJ(e);return t&&(r||n==!1)?vJ(t,e):e}const JC=t=>t instanceof ri?{...t}:t;function Cu(t,e){e=e||{};const n={};function r(h,f,m,g){return Oe.isPlainObject(h)&&Oe.isPlainObject(f)?Oe.merge.call({caseless:g},h,f):Oe.isPlainObject(f)?Oe.merge({},f):Oe.isArray(f)?f.slice():f}function s(h,f,m,g){if(Oe.isUndefined(f)){if(!Oe.isUndefined(h))return r(void 0,h,m,g)}else return r(h,f,m,g)}function i(h,f){if(!Oe.isUndefined(f))return r(void 0,f)}function a(h,f){if(Oe.isUndefined(f)){if(!Oe.isUndefined(h))return r(void 0,h)}else return r(void 0,f)}function o(h,f,m){if(m in e)return r(h,f);if(m in t)return r(void 0,h)}const c={url:i,method:i,data:i,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:o,headers:(h,f,m)=>s(JC(h),JC(f),m,!0)};return Oe.forEach(Object.keys({...t,...e}),function(f){const m=c[f]||s,g=m(t[f],e[f],f);Oe.isUndefined(g)&&m!==o||(n[f]=g)}),n}const Tz=t=>{const e=Cu({},t);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:i,headers:a,auth:o}=e;if(e.headers=a=ri.from(a),e.url=Sz(Cz(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),o&&a.set("Authorization","Basic "+btoa((o.username||"")+":"+(o.password?unescape(encodeURIComponent(o.password)):""))),Oe.isFormData(n)){if(ws.hasStandardBrowserEnv||ws.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if(Oe.isFunction(n.getHeaders)){const c=n.getHeaders(),h=["content-type","content-length"];Object.entries(c).forEach(([f,m])=>{h.includes(f.toLowerCase())&&a.set(f,m)})}}if(ws.hasStandardBrowserEnv&&(r&&Oe.isFunction(r)&&(r=r(e)),r||r!==!1&&pJ(e.url))){const c=s&&i&&gJ.read(i);c&&a.set(s,c)}return e},yJ=typeof XMLHttpRequest<"u",bJ=yJ&&function(t){return new Promise(function(n,r){const s=Tz(t);let i=s.data;const a=ri.from(s.headers).normalize();let{responseType:o,onUploadProgress:c,onDownloadProgress:h}=s,f,m,g,x,y;function w(){x&&x(),y&&y(),s.cancelToken&&s.cancelToken.unsubscribe(f),s.signal&&s.signal.removeEventListener("abort",f)}let S=new XMLHttpRequest;S.open(s.method.toUpperCase(),s.url,!0),S.timeout=s.timeout;function k(){if(!S)return;const C=ri.from("getAllResponseHeaders"in S&&S.getAllResponseHeaders()),_={data:!o||o==="text"||o==="json"?S.responseText:S.response,status:S.status,statusText:S.statusText,headers:C,config:t,request:S};Nz(function(M){n(M),w()},function(M){r(M),w()},_),S=null}"onloadend"in S?S.onloadend=k:S.onreadystatechange=function(){!S||S.readyState!==4||S.status===0&&!(S.responseURL&&S.responseURL.indexOf("file:")===0)||setTimeout(k)},S.onabort=function(){S&&(r(new Bt("Request aborted",Bt.ECONNABORTED,t,S)),S=null)},S.onerror=function(T){const _=T&&T.message?T.message:"Network Error",E=new Bt(_,Bt.ERR_NETWORK,t,S);E.event=T||null,r(E),S=null},S.ontimeout=function(){let T=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const _=s.transitional||kz;s.timeoutErrorMessage&&(T=s.timeoutErrorMessage),r(new Bt(T,_.clarifyTimeoutError?Bt.ETIMEDOUT:Bt.ECONNABORTED,t,S)),S=null},i===void 0&&a.setContentType(null),"setRequestHeader"in S&&Oe.forEach(a.toJSON(),function(T,_){S.setRequestHeader(_,T)}),Oe.isUndefined(s.withCredentials)||(S.withCredentials=!!s.withCredentials),o&&o!=="json"&&(S.responseType=s.responseType),h&&([g,y]=N1(h,!0),S.addEventListener("progress",g)),c&&S.upload&&([m,x]=N1(c),S.upload.addEventListener("progress",m),S.upload.addEventListener("loadend",x)),(s.cancelToken||s.signal)&&(f=C=>{S&&(r(!C||C.type?new zh(null,t,S):C),S.abort(),S=null)},s.cancelToken&&s.cancelToken.subscribe(f),s.signal&&(s.signal.aborted?f():s.signal.addEventListener("abort",f)));const N=hJ(s.url);if(N&&ws.protocols.indexOf(N)===-1){r(new Bt("Unsupported protocol "+N+":",Bt.ERR_BAD_REQUEST,t));return}S.send(i||null)})},wJ=(t,e)=>{const{length:n}=t=t?t.filter(Boolean):[];if(e||n){let r=new AbortController,s;const i=function(h){if(!s){s=!0,o();const f=h instanceof Error?h:this.reason;r.abort(f instanceof Bt?f:new zh(f instanceof Error?f.message:f))}};let a=e&&setTimeout(()=>{a=null,i(new Bt(`timeout ${e} of ms exceeded`,Bt.ETIMEDOUT))},e);const o=()=>{t&&(a&&clearTimeout(a),a=null,t.forEach(h=>{h.unsubscribe?h.unsubscribe(i):h.removeEventListener("abort",i)}),t=null)};t.forEach(h=>h.addEventListener("abort",i));const{signal:c}=r;return c.unsubscribe=()=>Oe.asap(o),c}},SJ=function*(t,e){let n=t.byteLength;if(n{const s=kJ(t,e);let i=0,a,o=c=>{a||(a=!0,r&&r(c))};return new ReadableStream({async pull(c){try{const{done:h,value:f}=await s.next();if(h){o(),c.close();return}let m=f.byteLength;if(n){let g=i+=m;n(g)}c.enqueue(new Uint8Array(f))}catch(h){throw o(h),h}},cancel(c){return o(c),s.return()}},{highWaterMark:2})},t9=64*1024,{isFunction:Vg}=Oe,jJ=(({Request:t,Response:e})=>({Request:t,Response:e}))(Oe.global),{ReadableStream:n9,TextEncoder:r9}=Oe.global,s9=(t,...e)=>{try{return!!t(...e)}catch{return!1}},NJ=t=>{t=Oe.merge.call({skipUndefined:!0},jJ,t);const{fetch:e,Request:n,Response:r}=t,s=e?Vg(e):typeof fetch=="function",i=Vg(n),a=Vg(r);if(!s)return!1;const o=s&&Vg(n9),c=s&&(typeof r9=="function"?(y=>w=>y.encode(w))(new r9):async y=>new Uint8Array(await new n(y).arrayBuffer())),h=i&&o&&s9(()=>{let y=!1;const w=new n(ws.origin,{body:new n9,method:"POST",get duplex(){return y=!0,"half"}}).headers.has("Content-Type");return y&&!w}),f=a&&o&&s9(()=>Oe.isReadableStream(new r("").body)),m={stream:f&&(y=>y.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(y=>{!m[y]&&(m[y]=(w,S)=>{let k=w&&w[y];if(k)return k.call(w);throw new Bt(`Response type '${y}' is not supported`,Bt.ERR_NOT_SUPPORT,S)})});const g=async y=>{if(y==null)return 0;if(Oe.isBlob(y))return y.size;if(Oe.isSpecCompliantForm(y))return(await new n(ws.origin,{method:"POST",body:y}).arrayBuffer()).byteLength;if(Oe.isArrayBufferView(y)||Oe.isArrayBuffer(y))return y.byteLength;if(Oe.isURLSearchParams(y)&&(y=y+""),Oe.isString(y))return(await c(y)).byteLength},x=async(y,w)=>{const S=Oe.toFiniteNumber(y.getContentLength());return S??g(w)};return async y=>{let{url:w,method:S,data:k,signal:N,cancelToken:C,timeout:T,onDownloadProgress:_,onUploadProgress:E,responseType:M,headers:q,withCredentials:L="same-origin",fetchOptions:I}=Tz(y),$=e||fetch;M=M?(M+"").toLowerCase():"text";let V=wJ([N,C&&C.toAbortSignal()],T),ee=null;const z=V&&V.unsubscribe&&(()=>{V.unsubscribe()});let H;try{if(E&&h&&S!=="get"&&S!=="head"&&(H=await x(q,k))!==0){let se=new n(w,{method:"POST",body:k,duplex:"half"}),G;if(Oe.isFormData(k)&&(G=se.headers.get("content-type"))&&q.setContentType(G),se.body){const[F,U]=KC(H,N1(ZC(E)));k=e9(se.body,t9,F,U)}}Oe.isString(L)||(L=L?"include":"omit");const P=i&&"credentials"in n.prototype,W={...I,signal:V,method:S.toUpperCase(),headers:q.normalize().toJSON(),body:k,duplex:"half",credentials:P?L:void 0};ee=i&&new n(w,W);let J=await(i?$(ee,I):$(w,W));const X=f&&(M==="stream"||M==="response");if(f&&(_||X&&z)){const se={};["status","statusText","headers"].forEach(te=>{se[te]=J[te]});const G=Oe.toFiniteNumber(J.headers.get("content-length")),[F,U]=_&&KC(G,N1(ZC(_),!0))||[];J=new r(e9(J.body,t9,F,()=>{U&&U(),z&&z()}),se)}M=M||"text";let R=await m[Oe.findKey(m,M)||"text"](J,y);return!X&&z&&z(),await new Promise((se,G)=>{Nz(se,G,{data:R,headers:ri.from(J.headers),status:J.status,statusText:J.statusText,config:y,request:ee})})}catch(P){throw z&&z(),P&&P.name==="TypeError"&&/Load failed|fetch/i.test(P.message)?Object.assign(new Bt("Network Error",Bt.ERR_NETWORK,y,ee),{cause:P.cause||P}):Bt.from(P,P&&P.code,y,ee)}}},CJ=new Map,Ez=t=>{let e=t&&t.env||{};const{fetch:n,Request:r,Response:s}=e,i=[r,s,n];let a=i.length,o=a,c,h,f=CJ;for(;o--;)c=i[o],h=f.get(c),h===void 0&&f.set(c,h=o?new Map:NJ(e)),f=h;return h};Ez();const s6={http:HZ,xhr:bJ,fetch:{get:Ez}};Oe.forEach(s6,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const i9=t=>`- ${t}`,TJ=t=>Oe.isFunction(t)||t===null||t===!1;function EJ(t,e){t=Oe.isArray(t)?t:[t];const{length:n}=t;let r,s;const i={};for(let a=0;a`adapter ${c} `+(h===!1?"is not supported by the environment":"is not available in the build"));let o=n?a.length>1?`since : -`+a.map(i9).join(` -`):" "+i9(a[0]):"as no adapter specified";throw new Bt("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return s}const _z={getAdapter:EJ,adapters:s6};function rw(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new zh(null,t)}function a9(t){return rw(t),t.headers=ri.from(t.headers),t.data=nw.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),_z.getAdapter(t.adapter||B0.adapter,t)(t).then(function(r){return rw(t),r.data=nw.call(t,t.transformResponse,r),r.headers=ri.from(r.headers),r},function(r){return jz(r)||(rw(t),r&&r.response&&(r.response.data=nw.call(t,t.transformResponse,r.response),r.response.headers=ri.from(r.response.headers))),Promise.reject(r)})}const Mz="1.13.2",Iv={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{Iv[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}});const l9={};Iv.transitional=function(e,n,r){function s(i,a){return"[Axios v"+Mz+"] Transitional option '"+i+"'"+a+(r?". "+r:"")}return(i,a,o)=>{if(e===!1)throw new Bt(s(a," has been removed"+(n?" in "+n:"")),Bt.ERR_DEPRECATED);return n&&!l9[a]&&(l9[a]=!0,console.warn(s(a," has been deprecated since v"+n+" and will be removed in the near future"))),e?e(i,a,o):!0}};Iv.spelling=function(e){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};function _J(t,e,n){if(typeof t!="object")throw new Bt("options must be an object",Bt.ERR_BAD_OPTION_VALUE);const r=Object.keys(t);let s=r.length;for(;s-- >0;){const i=r[s],a=e[i];if(a){const o=t[i],c=o===void 0||a(o,i,t);if(c!==!0)throw new Bt("option "+i+" must be "+c,Bt.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new Bt("Unknown option "+i,Bt.ERR_BAD_OPTION)}}const Kx={assertOptions:_J,validators:Iv},Fa=Kx.validators;let wu=class{constructor(e){this.defaults=e||{},this.interceptors={request:new XC,response:new XC}}async request(e,n){try{return await this._request(e,n)}catch(r){if(r instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const i=s.stack?s.stack.replace(/^.+\n/,""):"";try{r.stack?i&&!String(r.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(r.stack+=` -`+i):r.stack=i}catch{}}throw r}}_request(e,n){typeof e=="string"?(n=n||{},n.url=e):n=e||{},n=Cu(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:i}=n;r!==void 0&&Kx.assertOptions(r,{silentJSONParsing:Fa.transitional(Fa.boolean),forcedJSONParsing:Fa.transitional(Fa.boolean),clarifyTimeoutError:Fa.transitional(Fa.boolean)},!1),s!=null&&(Oe.isFunction(s)?n.paramsSerializer={serialize:s}:Kx.assertOptions(s,{encode:Fa.function,serialize:Fa.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Kx.assertOptions(n,{baseUrl:Fa.spelling("baseURL"),withXsrfToken:Fa.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let a=i&&Oe.merge(i.common,i[n.method]);i&&Oe.forEach(["delete","get","head","post","put","patch","common"],y=>{delete i[y]}),n.headers=ri.concat(a,i);const o=[];let c=!0;this.interceptors.request.forEach(function(w){typeof w.runWhen=="function"&&w.runWhen(n)===!1||(c=c&&w.synchronous,o.unshift(w.fulfilled,w.rejected))});const h=[];this.interceptors.response.forEach(function(w){h.push(w.fulfilled,w.rejected)});let f,m=0,g;if(!c){const y=[a9.bind(this),void 0];for(y.unshift(...o),y.push(...h),g=y.length,f=Promise.resolve(n);m{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](s);r._listeners=null}),this.promise.then=s=>{let i;const a=new Promise(o=>{r.subscribe(o),i=o}).then(s);return a.cancel=function(){r.unsubscribe(i)},a},e(function(i,a,o){r.reason||(r.reason=new zh(i,a,o),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const n=this._listeners.indexOf(e);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const e=new AbortController,n=r=>{e.abort(r)};return this.subscribe(n),e.signal.unsubscribe=()=>this.unsubscribe(n),e.signal}static source(){let e;return{token:new Az(function(s){e=s}),cancel:e}}};function AJ(t){return function(n){return t.apply(null,n)}}function RJ(t){return Oe.isObject(t)&&t.isAxiosError===!0}const z3={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(z3).forEach(([t,e])=>{z3[e]=t});function Rz(t){const e=new wu(t),n=uz(wu.prototype.request,e);return Oe.extend(n,wu.prototype,e,{allOwnKeys:!0}),Oe.extend(n,e,null,{allOwnKeys:!0}),n.create=function(s){return Rz(Cu(t,s))},n}const br=Rz(B0);br.Axios=wu;br.CanceledError=zh;br.CancelToken=MJ;br.isCancel=jz;br.VERSION=Mz;br.toFormData=Lv;br.AxiosError=Bt;br.Cancel=br.CanceledError;br.all=function(e){return Promise.all(e)};br.spread=AJ;br.isAxiosError=RJ;br.mergeConfig=Cu;br.AxiosHeaders=ri;br.formToJSON=t=>Oz(Oe.isHTMLForm(t)?new FormData(t):t);br.getAdapter=_z.getAdapter;br.HttpStatusCode=z3;br.default=br;const{Axios:VTe,AxiosError:UTe,CanceledError:WTe,isCancel:GTe,CancelToken:XTe,VERSION:YTe,all:KTe,Cancel:ZTe,isAxiosError:JTe,spread:eEe,toFormData:tEe,AxiosHeaders:nEe,HttpStatusCode:rEe,formToJSON:sEe,getAdapter:iEe,mergeConfig:aEe}=br,DJ=(t,e)=>{const n=new Array(t.length+e.length);for(let r=0;r({classGroupId:t,validator:e}),Dz=(t=new Map,e=null,n)=>({nextPart:t,validators:e,classGroupId:n}),C1="-",o9=[],PJ="arbitrary..",LJ=t=>{const e=BJ(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:a=>{if(a.startsWith("[")&&a.endsWith("]"))return IJ(a);const o=a.split(C1),c=o[0]===""&&o.length>1?1:0;return zz(o,c,e)},getConflictingClassGroupIds:(a,o)=>{if(o){const c=r[a],h=n[a];return c?h?DJ(h,c):c:h||o9}return n[a]||o9}}},zz=(t,e,n)=>{if(t.length-e===0)return n.classGroupId;const s=t[e],i=n.nextPart.get(s);if(i){const h=zz(t,e+1,i);if(h)return h}const a=n.validators;if(a===null)return;const o=e===0?t.join(C1):t.slice(e).join(C1),c=a.length;for(let h=0;ht.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=t.slice(1,-1),n=e.indexOf(":"),r=e.slice(0,n);return r?PJ+r:void 0})(),BJ=t=>{const{theme:e,classGroups:n}=t;return qJ(n,e)},qJ=(t,e)=>{const n=Dz();for(const r in t){const s=t[r];i6(s,n,r,e)}return n},i6=(t,e,n,r)=>{const s=t.length;for(let i=0;i{if(typeof t=="string"){$J(t,e,n);return}if(typeof t=="function"){QJ(t,e,n,r);return}HJ(t,e,n,r)},$J=(t,e,n)=>{const r=t===""?e:Pz(e,t);r.classGroupId=n},QJ=(t,e,n,r)=>{if(VJ(t)){i6(t(r),e,n,r);return}e.validators===null&&(e.validators=[]),e.validators.push(zJ(n,t))},HJ=(t,e,n,r)=>{const s=Object.entries(t),i=s.length;for(let a=0;a{let n=t;const r=e.split(C1),s=r.length;for(let i=0;i"isThemeGetter"in t&&t.isThemeGetter===!0,UJ=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=Object.create(null),r=Object.create(null);const s=(i,a)=>{n[i]=a,e++,e>t&&(e=0,r=n,n=Object.create(null))};return{get(i){let a=n[i];if(a!==void 0)return a;if((a=r[i])!==void 0)return s(i,a),a},set(i,a){i in n?n[i]=a:s(i,a)}}},P3="!",c9=":",WJ=[],u9=(t,e,n,r,s)=>({modifiers:t,hasImportantModifier:e,baseClassName:n,maybePostfixModifierPosition:r,isExternal:s}),GJ=t=>{const{prefix:e,experimentalParseClassName:n}=t;let r=s=>{const i=[];let a=0,o=0,c=0,h;const f=s.length;for(let w=0;wc?h-c:void 0;return u9(i,x,g,y)};if(e){const s=e+c9,i=r;r=a=>a.startsWith(s)?i(a.slice(s.length)):u9(WJ,!1,a,void 0,!0)}if(n){const s=r;r=i=>n({className:i,parseClassName:s})}return r},XJ=t=>{const e=new Map;return t.orderSensitiveModifiers.forEach((n,r)=>{e.set(n,1e6+r)}),n=>{const r=[];let s=[];for(let i=0;i0&&(s.sort(),r.push(...s),s=[]),r.push(a)):s.push(a)}return s.length>0&&(s.sort(),r.push(...s)),r}},YJ=t=>({cache:UJ(t.cacheSize),parseClassName:GJ(t),sortModifiers:XJ(t),...LJ(t)}),KJ=/\s+/,ZJ=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s,sortModifiers:i}=e,a=[],o=t.trim().split(KJ);let c="";for(let h=o.length-1;h>=0;h-=1){const f=o[h],{isExternal:m,modifiers:g,hasImportantModifier:x,baseClassName:y,maybePostfixModifierPosition:w}=n(f);if(m){c=f+(c.length>0?" "+c:c);continue}let S=!!w,k=r(S?y.substring(0,w):y);if(!k){if(!S){c=f+(c.length>0?" "+c:c);continue}if(k=r(y),!k){c=f+(c.length>0?" "+c:c);continue}S=!1}const N=g.length===0?"":g.length===1?g[0]:i(g).join(":"),C=x?N+P3:N,T=C+k;if(a.indexOf(T)>-1)continue;a.push(T);const _=s(k,S);for(let E=0;E<_.length;++E){const M=_[E];a.push(C+M)}c=f+(c.length>0?" "+c:c)}return c},JJ=(...t)=>{let e=0,n,r,s="";for(;e{if(typeof t=="string")return t;let e,n="";for(let r=0;r{let n,r,s,i;const a=c=>{const h=e.reduce((f,m)=>m(f),t());return n=YJ(h),r=n.cache.get,s=n.cache.set,i=o,o(c)},o=c=>{const h=r(c);if(h)return h;const f=ZJ(c,n);return s(c,f),f};return i=a,(...c)=>i(JJ(...c))},tee=[],Qr=t=>{const e=n=>n[t]||tee;return e.isThemeGetter=!0,e},Iz=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Bz=/^\((?:(\w[\w-]*):)?(.+)\)$/i,nee=/^\d+\/\d+$/,ree=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,see=/\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$/,iee=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,aee=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,lee=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Nd=t=>nee.test(t),Qt=t=>!!t&&!Number.isNaN(Number(t)),Zo=t=>!!t&&Number.isInteger(Number(t)),sw=t=>t.endsWith("%")&&Qt(t.slice(0,-1)),$l=t=>ree.test(t),oee=()=>!0,cee=t=>see.test(t)&&!iee.test(t),qz=()=>!1,uee=t=>aee.test(t),dee=t=>lee.test(t),hee=t=>!it(t)&&!at(t),fee=t=>Ph(t,Qz,qz),it=t=>Iz.test(t),nu=t=>Ph(t,Hz,cee),iw=t=>Ph(t,vee,Qt),d9=t=>Ph(t,Fz,qz),mee=t=>Ph(t,$z,dee),Ug=t=>Ph(t,Vz,uee),at=t=>Bz.test(t),Yf=t=>Lh(t,Hz),pee=t=>Lh(t,yee),h9=t=>Lh(t,Fz),gee=t=>Lh(t,Qz),xee=t=>Lh(t,$z),Wg=t=>Lh(t,Vz,!0),Ph=(t,e,n)=>{const r=Iz.exec(t);return r?r[1]?e(r[1]):n(r[2]):!1},Lh=(t,e,n=!1)=>{const r=Bz.exec(t);return r?r[1]?e(r[1]):n:!1},Fz=t=>t==="position"||t==="percentage",$z=t=>t==="image"||t==="url",Qz=t=>t==="length"||t==="size"||t==="bg-size",Hz=t=>t==="length",vee=t=>t==="number",yee=t=>t==="family-name",Vz=t=>t==="shadow",bee=()=>{const t=Qr("color"),e=Qr("font"),n=Qr("text"),r=Qr("font-weight"),s=Qr("tracking"),i=Qr("leading"),a=Qr("breakpoint"),o=Qr("container"),c=Qr("spacing"),h=Qr("radius"),f=Qr("shadow"),m=Qr("inset-shadow"),g=Qr("text-shadow"),x=Qr("drop-shadow"),y=Qr("blur"),w=Qr("perspective"),S=Qr("aspect"),k=Qr("ease"),N=Qr("animate"),C=()=>["auto","avoid","all","avoid-page","page","left","right","column"],T=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],_=()=>[...T(),at,it],E=()=>["auto","hidden","clip","visible","scroll"],M=()=>["auto","contain","none"],q=()=>[at,it,c],L=()=>[Nd,"full","auto",...q()],I=()=>[Zo,"none","subgrid",at,it],$=()=>["auto",{span:["full",Zo,at,it]},Zo,at,it],V=()=>[Zo,"auto",at,it],ee=()=>["auto","min","max","fr",at,it],z=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],H=()=>["start","end","center","stretch","center-safe","end-safe"],P=()=>["auto",...q()],W=()=>[Nd,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...q()],J=()=>[t,at,it],X=()=>[...T(),h9,d9,{position:[at,it]}],R=()=>["no-repeat",{repeat:["","x","y","space","round"]}],se=()=>["auto","cover","contain",gee,fee,{size:[at,it]}],G=()=>[sw,Yf,nu],F=()=>["","none","full",h,at,it],U=()=>["",Qt,Yf,nu],te=()=>["solid","dashed","dotted","double"],ne=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Y=()=>[Qt,sw,h9,d9],ae=()=>["","none",y,at,it],re=()=>["none",Qt,at,it],le=()=>["none",Qt,at,it],_e=()=>[Qt,at,it],Ge=()=>[Nd,"full",...q()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[$l],breakpoint:[$l],color:[oee],container:[$l],"drop-shadow":[$l],ease:["in","out","in-out"],font:[hee],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[$l],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[$l],shadow:[$l],spacing:["px",Qt],text:[$l],"text-shadow":[$l],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Nd,it,at,S]}],container:["container"],columns:[{columns:[Qt,it,at,o]}],"break-after":[{"break-after":C()}],"break-before":[{"break-before":C()}],"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:_()}],overflow:[{overflow:E()}],"overflow-x":[{"overflow-x":E()}],"overflow-y":[{"overflow-y":E()}],overscroll:[{overscroll:M()}],"overscroll-x":[{"overscroll-x":M()}],"overscroll-y":[{"overscroll-y":M()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:L()}],"inset-x":[{"inset-x":L()}],"inset-y":[{"inset-y":L()}],start:[{start:L()}],end:[{end:L()}],top:[{top:L()}],right:[{right:L()}],bottom:[{bottom:L()}],left:[{left:L()}],visibility:["visible","invisible","collapse"],z:[{z:[Zo,"auto",at,it]}],basis:[{basis:[Nd,"full","auto",o,...q()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Qt,Nd,"auto","initial","none",it]}],grow:[{grow:["",Qt,at,it]}],shrink:[{shrink:["",Qt,at,it]}],order:[{order:[Zo,"first","last","none",at,it]}],"grid-cols":[{"grid-cols":I()}],"col-start-end":[{col:$()}],"col-start":[{"col-start":V()}],"col-end":[{"col-end":V()}],"grid-rows":[{"grid-rows":I()}],"row-start-end":[{row:$()}],"row-start":[{"row-start":V()}],"row-end":[{"row-end":V()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":ee()}],"auto-rows":[{"auto-rows":ee()}],gap:[{gap:q()}],"gap-x":[{"gap-x":q()}],"gap-y":[{"gap-y":q()}],"justify-content":[{justify:[...z(),"normal"]}],"justify-items":[{"justify-items":[...H(),"normal"]}],"justify-self":[{"justify-self":["auto",...H()]}],"align-content":[{content:["normal",...z()]}],"align-items":[{items:[...H(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...H(),{baseline:["","last"]}]}],"place-content":[{"place-content":z()}],"place-items":[{"place-items":[...H(),"baseline"]}],"place-self":[{"place-self":["auto",...H()]}],p:[{p:q()}],px:[{px:q()}],py:[{py:q()}],ps:[{ps:q()}],pe:[{pe:q()}],pt:[{pt:q()}],pr:[{pr:q()}],pb:[{pb:q()}],pl:[{pl:q()}],m:[{m:P()}],mx:[{mx:P()}],my:[{my:P()}],ms:[{ms:P()}],me:[{me:P()}],mt:[{mt:P()}],mr:[{mr:P()}],mb:[{mb:P()}],ml:[{ml:P()}],"space-x":[{"space-x":q()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":q()}],"space-y-reverse":["space-y-reverse"],size:[{size:W()}],w:[{w:[o,"screen",...W()]}],"min-w":[{"min-w":[o,"screen","none",...W()]}],"max-w":[{"max-w":[o,"screen","none","prose",{screen:[a]},...W()]}],h:[{h:["screen","lh",...W()]}],"min-h":[{"min-h":["screen","lh","none",...W()]}],"max-h":[{"max-h":["screen","lh",...W()]}],"font-size":[{text:["base",n,Yf,nu]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,at,iw]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",sw,it]}],"font-family":[{font:[pee,it,e]}],"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,at,it]}],"line-clamp":[{"line-clamp":[Qt,"none",at,iw]}],leading:[{leading:[i,...q()]}],"list-image":[{"list-image":["none",at,it]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",at,it]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:J()}],"text-color":[{text:J()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...te(),"wavy"]}],"text-decoration-thickness":[{decoration:[Qt,"from-font","auto",at,nu]}],"text-decoration-color":[{decoration:J()}],"underline-offset":[{"underline-offset":[Qt,"auto",at,it]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:q()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",at,it]}],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",at,it]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:X()}],"bg-repeat":[{bg:R()}],"bg-size":[{bg:se()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Zo,at,it],radial:["",at,it],conic:[Zo,at,it]},xee,mee]}],"bg-color":[{bg:J()}],"gradient-from-pos":[{from:G()}],"gradient-via-pos":[{via:G()}],"gradient-to-pos":[{to:G()}],"gradient-from":[{from:J()}],"gradient-via":[{via:J()}],"gradient-to":[{to:J()}],rounded:[{rounded:F()}],"rounded-s":[{"rounded-s":F()}],"rounded-e":[{"rounded-e":F()}],"rounded-t":[{"rounded-t":F()}],"rounded-r":[{"rounded-r":F()}],"rounded-b":[{"rounded-b":F()}],"rounded-l":[{"rounded-l":F()}],"rounded-ss":[{"rounded-ss":F()}],"rounded-se":[{"rounded-se":F()}],"rounded-ee":[{"rounded-ee":F()}],"rounded-es":[{"rounded-es":F()}],"rounded-tl":[{"rounded-tl":F()}],"rounded-tr":[{"rounded-tr":F()}],"rounded-br":[{"rounded-br":F()}],"rounded-bl":[{"rounded-bl":F()}],"border-w":[{border:U()}],"border-w-x":[{"border-x":U()}],"border-w-y":[{"border-y":U()}],"border-w-s":[{"border-s":U()}],"border-w-e":[{"border-e":U()}],"border-w-t":[{"border-t":U()}],"border-w-r":[{"border-r":U()}],"border-w-b":[{"border-b":U()}],"border-w-l":[{"border-l":U()}],"divide-x":[{"divide-x":U()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":U()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...te(),"hidden","none"]}],"divide-style":[{divide:[...te(),"hidden","none"]}],"border-color":[{border:J()}],"border-color-x":[{"border-x":J()}],"border-color-y":[{"border-y":J()}],"border-color-s":[{"border-s":J()}],"border-color-e":[{"border-e":J()}],"border-color-t":[{"border-t":J()}],"border-color-r":[{"border-r":J()}],"border-color-b":[{"border-b":J()}],"border-color-l":[{"border-l":J()}],"divide-color":[{divide:J()}],"outline-style":[{outline:[...te(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Qt,at,it]}],"outline-w":[{outline:["",Qt,Yf,nu]}],"outline-color":[{outline:J()}],shadow:[{shadow:["","none",f,Wg,Ug]}],"shadow-color":[{shadow:J()}],"inset-shadow":[{"inset-shadow":["none",m,Wg,Ug]}],"inset-shadow-color":[{"inset-shadow":J()}],"ring-w":[{ring:U()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:J()}],"ring-offset-w":[{"ring-offset":[Qt,nu]}],"ring-offset-color":[{"ring-offset":J()}],"inset-ring-w":[{"inset-ring":U()}],"inset-ring-color":[{"inset-ring":J()}],"text-shadow":[{"text-shadow":["none",g,Wg,Ug]}],"text-shadow-color":[{"text-shadow":J()}],opacity:[{opacity:[Qt,at,it]}],"mix-blend":[{"mix-blend":[...ne(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ne()}],"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":[Qt]}],"mask-image-linear-from-pos":[{"mask-linear-from":Y()}],"mask-image-linear-to-pos":[{"mask-linear-to":Y()}],"mask-image-linear-from-color":[{"mask-linear-from":J()}],"mask-image-linear-to-color":[{"mask-linear-to":J()}],"mask-image-t-from-pos":[{"mask-t-from":Y()}],"mask-image-t-to-pos":[{"mask-t-to":Y()}],"mask-image-t-from-color":[{"mask-t-from":J()}],"mask-image-t-to-color":[{"mask-t-to":J()}],"mask-image-r-from-pos":[{"mask-r-from":Y()}],"mask-image-r-to-pos":[{"mask-r-to":Y()}],"mask-image-r-from-color":[{"mask-r-from":J()}],"mask-image-r-to-color":[{"mask-r-to":J()}],"mask-image-b-from-pos":[{"mask-b-from":Y()}],"mask-image-b-to-pos":[{"mask-b-to":Y()}],"mask-image-b-from-color":[{"mask-b-from":J()}],"mask-image-b-to-color":[{"mask-b-to":J()}],"mask-image-l-from-pos":[{"mask-l-from":Y()}],"mask-image-l-to-pos":[{"mask-l-to":Y()}],"mask-image-l-from-color":[{"mask-l-from":J()}],"mask-image-l-to-color":[{"mask-l-to":J()}],"mask-image-x-from-pos":[{"mask-x-from":Y()}],"mask-image-x-to-pos":[{"mask-x-to":Y()}],"mask-image-x-from-color":[{"mask-x-from":J()}],"mask-image-x-to-color":[{"mask-x-to":J()}],"mask-image-y-from-pos":[{"mask-y-from":Y()}],"mask-image-y-to-pos":[{"mask-y-to":Y()}],"mask-image-y-from-color":[{"mask-y-from":J()}],"mask-image-y-to-color":[{"mask-y-to":J()}],"mask-image-radial":[{"mask-radial":[at,it]}],"mask-image-radial-from-pos":[{"mask-radial-from":Y()}],"mask-image-radial-to-pos":[{"mask-radial-to":Y()}],"mask-image-radial-from-color":[{"mask-radial-from":J()}],"mask-image-radial-to-color":[{"mask-radial-to":J()}],"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":T()}],"mask-image-conic-pos":[{"mask-conic":[Qt]}],"mask-image-conic-from-pos":[{"mask-conic-from":Y()}],"mask-image-conic-to-pos":[{"mask-conic-to":Y()}],"mask-image-conic-from-color":[{"mask-conic-from":J()}],"mask-image-conic-to-color":[{"mask-conic-to":J()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:X()}],"mask-repeat":[{mask:R()}],"mask-size":[{mask:se()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",at,it]}],filter:[{filter:["","none",at,it]}],blur:[{blur:ae()}],brightness:[{brightness:[Qt,at,it]}],contrast:[{contrast:[Qt,at,it]}],"drop-shadow":[{"drop-shadow":["","none",x,Wg,Ug]}],"drop-shadow-color":[{"drop-shadow":J()}],grayscale:[{grayscale:["",Qt,at,it]}],"hue-rotate":[{"hue-rotate":[Qt,at,it]}],invert:[{invert:["",Qt,at,it]}],saturate:[{saturate:[Qt,at,it]}],sepia:[{sepia:["",Qt,at,it]}],"backdrop-filter":[{"backdrop-filter":["","none",at,it]}],"backdrop-blur":[{"backdrop-blur":ae()}],"backdrop-brightness":[{"backdrop-brightness":[Qt,at,it]}],"backdrop-contrast":[{"backdrop-contrast":[Qt,at,it]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Qt,at,it]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Qt,at,it]}],"backdrop-invert":[{"backdrop-invert":["",Qt,at,it]}],"backdrop-opacity":[{"backdrop-opacity":[Qt,at,it]}],"backdrop-saturate":[{"backdrop-saturate":[Qt,at,it]}],"backdrop-sepia":[{"backdrop-sepia":["",Qt,at,it]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":q()}],"border-spacing-x":[{"border-spacing-x":q()}],"border-spacing-y":[{"border-spacing-y":q()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",at,it]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Qt,"initial",at,it]}],ease:[{ease:["linear","initial",k,at,it]}],delay:[{delay:[Qt,at,it]}],animate:[{animate:["none",N,at,it]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[w,at,it]}],"perspective-origin":[{"perspective-origin":_()}],rotate:[{rotate:re()}],"rotate-x":[{"rotate-x":re()}],"rotate-y":[{"rotate-y":re()}],"rotate-z":[{"rotate-z":re()}],scale:[{scale:le()}],"scale-x":[{"scale-x":le()}],"scale-y":[{"scale-y":le()}],"scale-z":[{"scale-z":le()}],"scale-3d":["scale-3d"],skew:[{skew:_e()}],"skew-x":[{"skew-x":_e()}],"skew-y":[{"skew-y":_e()}],transform:[{transform:[at,it,"","none","gpu","cpu"]}],"transform-origin":[{origin:_()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Ge()}],"translate-x":[{"translate-x":Ge()}],"translate-y":[{"translate-y":Ge()}],"translate-z":[{"translate-z":Ge()}],"translate-none":["translate-none"],accent:[{accent:J()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:J()}],"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",at,it]}],"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":q()}],"scroll-mx":[{"scroll-mx":q()}],"scroll-my":[{"scroll-my":q()}],"scroll-ms":[{"scroll-ms":q()}],"scroll-me":[{"scroll-me":q()}],"scroll-mt":[{"scroll-mt":q()}],"scroll-mr":[{"scroll-mr":q()}],"scroll-mb":[{"scroll-mb":q()}],"scroll-ml":[{"scroll-ml":q()}],"scroll-p":[{"scroll-p":q()}],"scroll-px":[{"scroll-px":q()}],"scroll-py":[{"scroll-py":q()}],"scroll-ps":[{"scroll-ps":q()}],"scroll-pe":[{"scroll-pe":q()}],"scroll-pt":[{"scroll-pt":q()}],"scroll-pr":[{"scroll-pr":q()}],"scroll-pb":[{"scroll-pb":q()}],"scroll-pl":[{"scroll-pl":q()}],"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",at,it]}],fill:[{fill:["none",...J()]}],"stroke-w":[{stroke:[Qt,Yf,nu,iw]}],stroke:[{stroke:["none",...J()]}],"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"]}},wee=eee(bee);function ye(...t){return wee(SD(t))}const Tt=b.forwardRef(({className:t,...e},n)=>l.jsx("div",{ref:n,className:ye("rounded-xl border bg-card text-card-foreground shadow",t),...e}));Tt.displayName="Card";const vn=b.forwardRef(({className:t,...e},n)=>l.jsx("div",{ref:n,className:ye("flex flex-col space-y-1.5 p-6",t),...e}));vn.displayName="CardHeader";const yn=b.forwardRef(({className:t,...e},n)=>l.jsx("div",{ref:n,className:ye("font-semibold leading-none tracking-tight",t),...e}));yn.displayName="CardTitle";const zr=b.forwardRef(({className:t,...e},n)=>l.jsx("div",{ref:n,className:ye("text-sm text-muted-foreground",t),...e}));zr.displayName="CardDescription";const En=b.forwardRef(({className:t,...e},n)=>l.jsx("div",{ref:n,className:ye("p-6 pt-0",t),...e}));En.displayName="CardContent";const Uz=b.forwardRef(({className:t,...e},n)=>l.jsx("div",{ref:n,className:ye("flex items-center p-6 pt-0",t),...e}));Uz.displayName="CardFooter";var aw="rovingFocusGroup.onEntryFocus",See={bubbles:!1,cancelable:!0},q0="RovingFocusGroup",[L3,Wz,kee]=jv(q0),[Oee,Bv]=ua(q0,[kee]),[jee,Nee]=Oee(q0),Gz=b.forwardRef((t,e)=>l.jsx(L3.Provider,{scope:t.__scopeRovingFocusGroup,children:l.jsx(L3.Slot,{scope:t.__scopeRovingFocusGroup,children:l.jsx(Cee,{...t,ref:e})})}));Gz.displayName=q0;var Cee=b.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:s=!1,dir:i,currentTabStopId:a,defaultCurrentTabStopId:o,onCurrentTabStopIdChange:c,onEntryFocus:h,preventScrollOnEntryFocus:f=!1,...m}=t,g=b.useRef(null),x=Dn(e,g),y=M0(i),[w,S]=wo({prop:a,defaultProp:o??null,onChange:c,caller:q0}),[k,N]=b.useState(!1),C=bs(h),T=Wz(n),_=b.useRef(!1),[E,M]=b.useState(0);return b.useEffect(()=>{const q=g.current;if(q)return q.addEventListener(aw,C),()=>q.removeEventListener(aw,C)},[C]),l.jsx(jee,{scope:n,orientation:r,dir:y,loop:s,currentTabStopId:w,onItemFocus:b.useCallback(q=>S(q),[S]),onItemShiftTab:b.useCallback(()=>N(!0),[]),onFocusableItemAdd:b.useCallback(()=>M(q=>q+1),[]),onFocusableItemRemove:b.useCallback(()=>M(q=>q-1),[]),children:l.jsx(nn.div,{tabIndex:k||E===0?-1:0,"data-orientation":r,...m,ref:x,style:{outline:"none",...t.style},onMouseDown:Ze(t.onMouseDown,()=>{_.current=!0}),onFocus:Ze(t.onFocus,q=>{const L=!_.current;if(q.target===q.currentTarget&&L&&!k){const I=new CustomEvent(aw,See);if(q.currentTarget.dispatchEvent(I),!I.defaultPrevented){const $=T().filter(P=>P.focusable),V=$.find(P=>P.active),ee=$.find(P=>P.id===w),H=[V,ee,...$].filter(Boolean).map(P=>P.ref.current);Kz(H,f)}}_.current=!1}),onBlur:Ze(t.onBlur,()=>N(!1))})})}),Xz="RovingFocusGroupItem",Yz=b.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:s=!1,tabStopId:i,children:a,...o}=t,c=Ei(),h=i||c,f=Nee(Xz,n),m=f.currentTabStopId===h,g=Wz(n),{onFocusableItemAdd:x,onFocusableItemRemove:y,currentTabStopId:w}=f;return b.useEffect(()=>{if(r)return x(),()=>y()},[r,x,y]),l.jsx(L3.ItemSlot,{scope:n,id:h,focusable:r,active:s,children:l.jsx(nn.span,{tabIndex:m?0:-1,"data-orientation":f.orientation,...o,ref:e,onMouseDown:Ze(t.onMouseDown,S=>{r?f.onItemFocus(h):S.preventDefault()}),onFocus:Ze(t.onFocus,()=>f.onItemFocus(h)),onKeyDown:Ze(t.onKeyDown,S=>{if(S.key==="Tab"&&S.shiftKey){f.onItemShiftTab();return}if(S.target!==S.currentTarget)return;const k=_ee(S,f.orientation,f.dir);if(k!==void 0){if(S.metaKey||S.ctrlKey||S.altKey||S.shiftKey)return;S.preventDefault();let C=g().filter(T=>T.focusable).map(T=>T.ref.current);if(k==="last")C.reverse();else if(k==="prev"||k==="next"){k==="prev"&&C.reverse();const T=C.indexOf(S.currentTarget);C=f.loop?Mee(C,T+1):C.slice(T+1)}setTimeout(()=>Kz(C))}}),children:typeof a=="function"?a({isCurrentTabStop:m,hasTabStop:w!=null}):a})})});Yz.displayName=Xz;var Tee={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Eee(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function _ee(t,e,n){const r=Eee(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return Tee[r]}function Kz(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function Mee(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var Zz=Gz,Jz=Yz,qv="Tabs",[Aee]=ua(qv,[Bv]),eP=Bv(),[Ree,a6]=Aee(qv),tP=b.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,onValueChange:s,defaultValue:i,orientation:a="horizontal",dir:o,activationMode:c="automatic",...h}=t,f=M0(o),[m,g]=wo({prop:r,onChange:s,defaultProp:i??"",caller:qv});return l.jsx(Ree,{scope:n,baseId:Ei(),value:m,onValueChange:g,orientation:a,dir:f,activationMode:c,children:l.jsx(nn.div,{dir:f,"data-orientation":a,...h,ref:e})})});tP.displayName=qv;var nP="TabsList",rP=b.forwardRef((t,e)=>{const{__scopeTabs:n,loop:r=!0,...s}=t,i=a6(nP,n),a=eP(n);return l.jsx(Zz,{asChild:!0,...a,orientation:i.orientation,dir:i.dir,loop:r,children:l.jsx(nn.div,{role:"tablist","aria-orientation":i.orientation,...s,ref:e})})});rP.displayName=nP;var sP="TabsTrigger",iP=b.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,disabled:s=!1,...i}=t,a=a6(sP,n),o=eP(n),c=oP(a.baseId,r),h=cP(a.baseId,r),f=r===a.value;return l.jsx(Jz,{asChild:!0,...o,focusable:!s,active:f,children:l.jsx(nn.button,{type:"button",role:"tab","aria-selected":f,"aria-controls":h,"data-state":f?"active":"inactive","data-disabled":s?"":void 0,disabled:s,id:c,...i,ref:e,onMouseDown:Ze(t.onMouseDown,m=>{!s&&m.button===0&&m.ctrlKey===!1?a.onValueChange(r):m.preventDefault()}),onKeyDown:Ze(t.onKeyDown,m=>{[" ","Enter"].includes(m.key)&&a.onValueChange(r)}),onFocus:Ze(t.onFocus,()=>{const m=a.activationMode!=="manual";!f&&!s&&m&&a.onValueChange(r)})})})});iP.displayName=sP;var aP="TabsContent",lP=b.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,forceMount:s,children:i,...a}=t,o=a6(aP,n),c=oP(o.baseId,r),h=cP(o.baseId,r),f=r===o.value,m=b.useRef(f);return b.useEffect(()=>{const g=requestAnimationFrame(()=>m.current=!1);return()=>cancelAnimationFrame(g)},[]),l.jsx(Ps,{present:s||f,children:({present:g})=>l.jsx(nn.div,{"data-state":f?"active":"inactive","data-orientation":o.orientation,role:"tabpanel","aria-labelledby":c,hidden:!g,id:h,tabIndex:0,...a,ref:e,style:{...t.style,animationDuration:m.current?"0s":void 0},children:g&&i})})});lP.displayName=aP;function oP(t,e){return`${t}-trigger-${e}`}function cP(t,e){return`${t}-content-${e}`}var Dee=tP,uP=rP,dP=iP,hP=lP;const na=Dee,_i=b.forwardRef(({className:t,...e},n)=>l.jsx(uP,{ref:n,className:ye("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",t),...e}));_i.displayName=uP.displayName;const Et=b.forwardRef(({className:t,...e},n)=>l.jsx(dP,{ref:n,className:ye("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all duration-300 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",t),...e}));Et.displayName=dP.displayName;const Kt=b.forwardRef(({className:t,...e},n)=>l.jsx(hP,{ref:n,className:ye("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 data-[state=active]:animate-in data-[state=active]:fade-in data-[state=active]:duration-300",t),...e}));Kt.displayName=hP.displayName;function zee(t,e){return b.useReducer((n,r)=>e[n][r]??n,t)}var l6="ScrollArea",[fP]=ua(l6),[Pee,da]=fP(l6),mP=b.forwardRef((t,e)=>{const{__scopeScrollArea:n,type:r="hover",dir:s,scrollHideDelay:i=600,...a}=t,[o,c]=b.useState(null),[h,f]=b.useState(null),[m,g]=b.useState(null),[x,y]=b.useState(null),[w,S]=b.useState(null),[k,N]=b.useState(0),[C,T]=b.useState(0),[_,E]=b.useState(!1),[M,q]=b.useState(!1),L=Dn(e,$=>c($)),I=M0(s);return l.jsx(Pee,{scope:n,type:r,dir:I,scrollHideDelay:i,scrollArea:o,viewport:h,onViewportChange:f,content:m,onContentChange:g,scrollbarX:x,onScrollbarXChange:y,scrollbarXEnabled:_,onScrollbarXEnabledChange:E,scrollbarY:w,onScrollbarYChange:S,scrollbarYEnabled:M,onScrollbarYEnabledChange:q,onCornerWidthChange:N,onCornerHeightChange:T,children:l.jsx(nn.div,{dir:I,...a,ref:L,style:{position:"relative","--radix-scroll-area-corner-width":k+"px","--radix-scroll-area-corner-height":C+"px",...t.style}})})});mP.displayName=l6;var pP="ScrollAreaViewport",gP=b.forwardRef((t,e)=>{const{__scopeScrollArea:n,children:r,nonce:s,...i}=t,a=da(pP,n),o=b.useRef(null),c=Dn(e,o,a.onViewportChange);return l.jsxs(l.Fragment,{children:[l.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:s}),l.jsx(nn.div,{"data-radix-scroll-area-viewport":"",...i,ref:c,style:{overflowX:a.scrollbarXEnabled?"scroll":"hidden",overflowY:a.scrollbarYEnabled?"scroll":"hidden",...t.style},children:l.jsx("div",{ref:a.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});gP.displayName=pP;var dl="ScrollAreaScrollbar",o6=b.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=da(dl,t.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:a}=s,o=t.orientation==="horizontal";return b.useEffect(()=>(o?i(!0):a(!0),()=>{o?i(!1):a(!1)}),[o,i,a]),s.type==="hover"?l.jsx(Lee,{...r,ref:e,forceMount:n}):s.type==="scroll"?l.jsx(Iee,{...r,ref:e,forceMount:n}):s.type==="auto"?l.jsx(xP,{...r,ref:e,forceMount:n}):s.type==="always"?l.jsx(c6,{...r,ref:e}):null});o6.displayName=dl;var Lee=b.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=da(dl,t.__scopeScrollArea),[i,a]=b.useState(!1);return b.useEffect(()=>{const o=s.scrollArea;let c=0;if(o){const h=()=>{window.clearTimeout(c),a(!0)},f=()=>{c=window.setTimeout(()=>a(!1),s.scrollHideDelay)};return o.addEventListener("pointerenter",h),o.addEventListener("pointerleave",f),()=>{window.clearTimeout(c),o.removeEventListener("pointerenter",h),o.removeEventListener("pointerleave",f)}}},[s.scrollArea,s.scrollHideDelay]),l.jsx(Ps,{present:n||i,children:l.jsx(xP,{"data-state":i?"visible":"hidden",...r,ref:e})})}),Iee=b.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=da(dl,t.__scopeScrollArea),i=t.orientation==="horizontal",a=$v(()=>c("SCROLL_END"),100),[o,c]=zee("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return b.useEffect(()=>{if(o==="idle"){const h=window.setTimeout(()=>c("HIDE"),s.scrollHideDelay);return()=>window.clearTimeout(h)}},[o,s.scrollHideDelay,c]),b.useEffect(()=>{const h=s.viewport,f=i?"scrollLeft":"scrollTop";if(h){let m=h[f];const g=()=>{const x=h[f];m!==x&&(c("SCROLL"),a()),m=x};return h.addEventListener("scroll",g),()=>h.removeEventListener("scroll",g)}},[s.viewport,i,c,a]),l.jsx(Ps,{present:n||o!=="hidden",children:l.jsx(c6,{"data-state":o==="hidden"?"hidden":"visible",...r,ref:e,onPointerEnter:Ze(t.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:Ze(t.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),xP=b.forwardRef((t,e)=>{const n=da(dl,t.__scopeScrollArea),{forceMount:r,...s}=t,[i,a]=b.useState(!1),o=t.orientation==="horizontal",c=$v(()=>{if(n.viewport){const h=n.viewport.offsetWidth{const{orientation:n="vertical",...r}=t,s=da(dl,t.__scopeScrollArea),i=b.useRef(null),a=b.useRef(0),[o,c]=b.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),h=SP(o.viewport,o.content),f={...r,sizes:o,onSizesChange:c,hasThumb:h>0&&h<1,onThumbChange:g=>i.current=g,onThumbPointerUp:()=>a.current=0,onThumbPointerDown:g=>a.current=g};function m(g,x){return Hee(g,a.current,o,x)}return n==="horizontal"?l.jsx(Bee,{...f,ref:e,onThumbPositionChange:()=>{if(s.viewport&&i.current){const g=s.viewport.scrollLeft,x=f9(g,o,s.dir);i.current.style.transform=`translate3d(${x}px, 0, 0)`}},onWheelScroll:g=>{s.viewport&&(s.viewport.scrollLeft=g)},onDragScroll:g=>{s.viewport&&(s.viewport.scrollLeft=m(g,s.dir))}}):n==="vertical"?l.jsx(qee,{...f,ref:e,onThumbPositionChange:()=>{if(s.viewport&&i.current){const g=s.viewport.scrollTop,x=f9(g,o);i.current.style.transform=`translate3d(0, ${x}px, 0)`}},onWheelScroll:g=>{s.viewport&&(s.viewport.scrollTop=g)},onDragScroll:g=>{s.viewport&&(s.viewport.scrollTop=m(g))}}):null}),Bee=b.forwardRef((t,e)=>{const{sizes:n,onSizesChange:r,...s}=t,i=da(dl,t.__scopeScrollArea),[a,o]=b.useState(),c=b.useRef(null),h=Dn(e,c,i.onScrollbarXChange);return b.useEffect(()=>{c.current&&o(getComputedStyle(c.current))},[c]),l.jsx(yP,{"data-orientation":"horizontal",...s,ref:h,sizes:n,style:{bottom:0,left:i.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:i.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":Fv(n)+"px",...t.style},onThumbPointerDown:f=>t.onThumbPointerDown(f.x),onDragScroll:f=>t.onDragScroll(f.x),onWheelScroll:(f,m)=>{if(i.viewport){const g=i.viewport.scrollLeft+f.deltaX;t.onWheelScroll(g),OP(g,m)&&f.preventDefault()}},onResize:()=>{c.current&&i.viewport&&a&&r({content:i.viewport.scrollWidth,viewport:i.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:E1(a.paddingLeft),paddingEnd:E1(a.paddingRight)}})}})}),qee=b.forwardRef((t,e)=>{const{sizes:n,onSizesChange:r,...s}=t,i=da(dl,t.__scopeScrollArea),[a,o]=b.useState(),c=b.useRef(null),h=Dn(e,c,i.onScrollbarYChange);return b.useEffect(()=>{c.current&&o(getComputedStyle(c.current))},[c]),l.jsx(yP,{"data-orientation":"vertical",...s,ref:h,sizes:n,style:{top:0,right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":Fv(n)+"px",...t.style},onThumbPointerDown:f=>t.onThumbPointerDown(f.y),onDragScroll:f=>t.onDragScroll(f.y),onWheelScroll:(f,m)=>{if(i.viewport){const g=i.viewport.scrollTop+f.deltaY;t.onWheelScroll(g),OP(g,m)&&f.preventDefault()}},onResize:()=>{c.current&&i.viewport&&a&&r({content:i.viewport.scrollHeight,viewport:i.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:E1(a.paddingTop),paddingEnd:E1(a.paddingBottom)}})}})}),[Fee,vP]=fP(dl),yP=b.forwardRef((t,e)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:s,onThumbChange:i,onThumbPointerUp:a,onThumbPointerDown:o,onThumbPositionChange:c,onDragScroll:h,onWheelScroll:f,onResize:m,...g}=t,x=da(dl,n),[y,w]=b.useState(null),S=Dn(e,L=>w(L)),k=b.useRef(null),N=b.useRef(""),C=x.viewport,T=r.content-r.viewport,_=bs(f),E=bs(c),M=$v(m,10);function q(L){if(k.current){const I=L.clientX-k.current.left,$=L.clientY-k.current.top;h({x:I,y:$})}}return b.useEffect(()=>{const L=I=>{const $=I.target;y?.contains($)&&_(I,T)};return document.addEventListener("wheel",L,{passive:!1}),()=>document.removeEventListener("wheel",L,{passive:!1})},[C,y,T,_]),b.useEffect(E,[r,E]),gh(y,M),gh(x.content,M),l.jsx(Fee,{scope:n,scrollbar:y,hasThumb:s,onThumbChange:bs(i),onThumbPointerUp:bs(a),onThumbPositionChange:E,onThumbPointerDown:bs(o),children:l.jsx(nn.div,{...g,ref:S,style:{position:"absolute",...g.style},onPointerDown:Ze(t.onPointerDown,L=>{L.button===0&&(L.target.setPointerCapture(L.pointerId),k.current=y.getBoundingClientRect(),N.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",x.viewport&&(x.viewport.style.scrollBehavior="auto"),q(L))}),onPointerMove:Ze(t.onPointerMove,q),onPointerUp:Ze(t.onPointerUp,L=>{const I=L.target;I.hasPointerCapture(L.pointerId)&&I.releasePointerCapture(L.pointerId),document.body.style.webkitUserSelect=N.current,x.viewport&&(x.viewport.style.scrollBehavior=""),k.current=null})})})}),T1="ScrollAreaThumb",bP=b.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=vP(T1,t.__scopeScrollArea);return l.jsx(Ps,{present:n||s.hasThumb,children:l.jsx($ee,{ref:e,...r})})}),$ee=b.forwardRef((t,e)=>{const{__scopeScrollArea:n,style:r,...s}=t,i=da(T1,n),a=vP(T1,n),{onThumbPositionChange:o}=a,c=Dn(e,m=>a.onThumbChange(m)),h=b.useRef(void 0),f=$v(()=>{h.current&&(h.current(),h.current=void 0)},100);return b.useEffect(()=>{const m=i.viewport;if(m){const g=()=>{if(f(),!h.current){const x=Vee(m,o);h.current=x,o()}};return o(),m.addEventListener("scroll",g),()=>m.removeEventListener("scroll",g)}},[i.viewport,f,o]),l.jsx(nn.div,{"data-state":a.hasThumb?"visible":"hidden",...s,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:Ze(t.onPointerDownCapture,m=>{const x=m.target.getBoundingClientRect(),y=m.clientX-x.left,w=m.clientY-x.top;a.onThumbPointerDown({x:y,y:w})}),onPointerUp:Ze(t.onPointerUp,a.onThumbPointerUp)})});bP.displayName=T1;var u6="ScrollAreaCorner",wP=b.forwardRef((t,e)=>{const n=da(u6,t.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?l.jsx(Qee,{...t,ref:e}):null});wP.displayName=u6;var Qee=b.forwardRef((t,e)=>{const{__scopeScrollArea:n,...r}=t,s=da(u6,n),[i,a]=b.useState(0),[o,c]=b.useState(0),h=!!(i&&o);return gh(s.scrollbarX,()=>{const f=s.scrollbarX?.offsetHeight||0;s.onCornerHeightChange(f),c(f)}),gh(s.scrollbarY,()=>{const f=s.scrollbarY?.offsetWidth||0;s.onCornerWidthChange(f),a(f)}),h?l.jsx(nn.div,{...r,ref:e,style:{width:i,height:o,position:"absolute",right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null});function E1(t){return t?parseInt(t,10):0}function SP(t,e){const n=t/e;return isNaN(n)?0:n}function Fv(t){const e=SP(t.viewport,t.content),n=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,r=(t.scrollbar.size-n)*e;return Math.max(r,18)}function Hee(t,e,n,r="ltr"){const s=Fv(n),i=s/2,a=e||i,o=s-a,c=n.scrollbar.paddingStart+a,h=n.scrollbar.size-n.scrollbar.paddingEnd-o,f=n.content-n.viewport,m=r==="ltr"?[0,f]:[f*-1,0];return kP([c,h],m)(t)}function f9(t,e,n="ltr"){const r=Fv(e),s=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,i=e.scrollbar.size-s,a=e.content-e.viewport,o=i-r,c=n==="ltr"?[0,a]:[a*-1,0],h=Hk(t,c);return kP([0,a],[0,o])(h)}function kP(t,e){return n=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const r=(e[1]-e[0])/(t[1]-t[0]);return e[0]+r*(n-t[0])}}function OP(t,e){return t>0&&t{})=>{let n={left:t.scrollLeft,top:t.scrollTop},r=0;return(function s(){const i={left:t.scrollLeft,top:t.scrollTop},a=n.left!==i.left,o=n.top!==i.top;(a||o)&&e(),n=i,r=window.requestAnimationFrame(s)})(),()=>window.cancelAnimationFrame(r)};function $v(t,e){const n=bs(t),r=b.useRef(0);return b.useEffect(()=>()=>window.clearTimeout(r.current),[]),b.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,e)},[n,e])}function gh(t,e){const n=bs(e);Qk(()=>{let r=0;if(t){const s=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return s.observe(t),()=>{window.cancelAnimationFrame(r),s.unobserve(t)}}},[t,n])}var jP=mP,Uee=gP,Wee=wP;const on=b.forwardRef(({className:t,children:e,viewportRef:n,...r},s)=>l.jsxs(jP,{ref:s,className:ye("relative overflow-hidden",t),...r,children:[l.jsx(Uee,{ref:n,className:"h-full w-full rounded-[inherit]",children:e}),l.jsx(I3,{}),l.jsx(I3,{orientation:"horizontal"}),l.jsx(Wee,{})]}));on.displayName=jP.displayName;const I3=b.forwardRef(({className:t,orientation:e="vertical",...n},r)=>l.jsx(o6,{ref:r,orientation:e,className:ye("flex touch-none select-none transition-colors",e==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",e==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",t),...n,children:l.jsx(bP,{className:"relative flex-1 rounded-full bg-border"})}));I3.displayName=o6.displayName;function m9({className:t,...e}){return l.jsx("div",{className:ye("animate-pulse rounded-md bg-primary/10",t),...e})}function Gee(t,e=[]){let n=[];function r(i,a){const o=b.createContext(a);o.displayName=i+"Context";const c=n.length;n=[...n,a];const h=m=>{const{scope:g,children:x,...y}=m,w=g?.[t]?.[c]||o,S=b.useMemo(()=>y,Object.values(y));return l.jsx(w.Provider,{value:S,children:x})};h.displayName=i+"Provider";function f(m,g){const x=g?.[t]?.[c]||o,y=b.useContext(x);if(y)return y;if(a!==void 0)return a;throw new Error(`\`${m}\` must be used within \`${i}\``)}return[h,f]}const s=()=>{const i=n.map(a=>b.createContext(a));return function(o){const c=o?.[t]||i;return b.useMemo(()=>({[`__scope${t}`]:{...o,[t]:c}}),[o,c])}};return s.scopeName=t,[r,Xee(s,...e)]}function Xee(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(i){const a=r.reduce((o,{useScope:c,scopeName:h})=>{const m=c(i)[`__scope${h}`];return{...o,...m}},{});return b.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return n.scopeName=e.scopeName,n}var Yee=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],NP=Yee.reduce((t,e)=>{const n=Vk(`Primitive.${e}`),r=b.forwardRef((s,i)=>{const{asChild:a,...o}=s,c=a?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(c,{...o,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),d6="Progress",h6=100,[Kee]=Gee(d6),[Zee,Jee]=Kee(d6),CP=b.forwardRef((t,e)=>{const{__scopeProgress:n,value:r=null,max:s,getValueLabel:i=ete,...a}=t;(s||s===0)&&!p9(s)&&console.error(tte(`${s}`,"Progress"));const o=p9(s)?s:h6;r!==null&&!g9(r,o)&&console.error(nte(`${r}`,"Progress"));const c=g9(r,o)?r:null,h=_1(c)?i(c,o):void 0;return l.jsx(Zee,{scope:n,value:c,max:o,children:l.jsx(NP.div,{"aria-valuemax":o,"aria-valuemin":0,"aria-valuenow":_1(c)?c:void 0,"aria-valuetext":h,role:"progressbar","data-state":_P(c,o),"data-value":c??void 0,"data-max":o,...a,ref:e})})});CP.displayName=d6;var TP="ProgressIndicator",EP=b.forwardRef((t,e)=>{const{__scopeProgress:n,...r}=t,s=Jee(TP,n);return l.jsx(NP.div,{"data-state":_P(s.value,s.max),"data-value":s.value??void 0,"data-max":s.max,...r,ref:e})});EP.displayName=TP;function ete(t,e){return`${Math.round(t/e*100)}%`}function _P(t,e){return t==null?"indeterminate":t===e?"complete":"loading"}function _1(t){return typeof t=="number"}function p9(t){return _1(t)&&!isNaN(t)&&t>0}function g9(t,e){return _1(t)&&!isNaN(t)&&t<=e&&t>=0}function tte(t,e){return`Invalid prop \`max\` of value \`${t}\` supplied to \`${e}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${h6}\`.`}function nte(t,e){return`Invalid prop \`value\` of value \`${t}\` supplied to \`${e}\`. The \`value\` prop must be: +`+v.stack}}var ut=Object.prototype.hasOwnProperty,rt=t.unstable_scheduleCallback,rn=t.unstable_cancelCallback,Rn=t.unstable_shouldYield,Tn=t.unstable_requestPaint,Mt=t.unstable_now,vt=t.unstable_getCurrentPriorityLevel,Ce=t.unstable_ImmediatePriority,Le=t.unstable_UserBlockingPriority,Ge=t.unstable_NormalPriority,lt=t.unstable_LowPriority,jt=t.unstable_IdlePriority,Tt=t.log,ke=t.unstable_setDisableYieldValue,Te=null,qe=null;function Rt(u){if(typeof Tt=="function"&&ke(u),qe&&typeof qe.setStrictMode=="function")try{qe.setStrictMode(Te,u)}catch{}}var At=Math.clz32?Math.clz32:mn,vr=Math.log,ft=Math.LN2;function mn(u){return u>>>=0,u===0?32:31-(vr(u)/ft|0)|0}var gt=256,Nt=262144,Ot=4194304;function it(u){var d=u&42;if(d!==0)return d;switch(u&-u){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return u&261888;case 262144:case 524288:case 1048576:case 2097152:return u&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return u&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return u}}function Vn(u,d,p){var v=u.pendingLanes;if(v===0)return 0;var j=0,O=u.suspendedLanes,q=u.pingedLanes;u=u.warmLanes;var Y=v&134217727;return Y!==0?(v=Y&~O,v!==0?j=it(v):(q&=Y,q!==0?j=it(q):p||(p=Y&~u,p!==0&&(j=it(p))))):(Y=v&~O,Y!==0?j=it(Y):q!==0?j=it(q):p||(p=v&~u,p!==0&&(j=it(p)))),j===0?0:d!==0&&d!==j&&(d&O)===0&&(O=j&-j,p=d&-d,O>=p||O===32&&(p&4194048)!==0)?d:j}function jr(u,d){return(u.pendingLanes&~(u.suspendedLanes&~u.pingedLanes)&d)===0}function Or(u,d){switch(u){case 1:case 2:case 4:case 8:case 64:return d+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return d+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function ge(){var u=Ot;return Ot<<=1,(Ot&62914560)===0&&(Ot=4194304),u}function ze(u){for(var d=[],p=0;31>p;p++)d.push(u);return d}function Et(u,d){u.pendingLanes|=d,d!==268435456&&(u.suspendedLanes=0,u.pingedLanes=0,u.warmLanes=0)}function Gt(u,d,p,v,j,O){var q=u.pendingLanes;u.pendingLanes=p,u.suspendedLanes=0,u.pingedLanes=0,u.warmLanes=0,u.expiredLanes&=p,u.entangledLanes&=p,u.errorRecoveryDisabledLanes&=p,u.shellSuspendCounter=0;var Y=u.entanglements,ce=u.expirationTimes,we=u.hiddenUpdates;for(p=q&~p;0"u")return null;try{return u.activeElement||u.body}catch{return u.body}}var tG=/[\n"\\]/g;function Ii(u){return u.replace(tG,function(d){return"\\"+d.charCodeAt(0).toString(16)+" "})}function Yy(u,d,p,v,j,O,q,Y){u.name="",q!=null&&typeof q!="function"&&typeof q!="symbol"&&typeof q!="boolean"?u.type=q:u.removeAttribute("type"),d!=null?q==="number"?(d===0&&u.value===""||u.value!=d)&&(u.value=""+Li(d)):u.value!==""+Li(d)&&(u.value=""+Li(d)):q!=="submit"&&q!=="reset"||u.removeAttribute("value"),d!=null?Ky(u,q,Li(d)):p!=null?Ky(u,q,Li(p)):v!=null&&u.removeAttribute("value"),j==null&&O!=null&&(u.defaultChecked=!!O),j!=null&&(u.checked=j&&typeof j!="function"&&typeof j!="symbol"),Y!=null&&typeof Y!="function"&&typeof Y!="symbol"&&typeof Y!="boolean"?u.name=""+Li(Y):u.removeAttribute("name")}function ZO(u,d,p,v,j,O,q,Y){if(O!=null&&typeof O!="function"&&typeof O!="symbol"&&typeof O!="boolean"&&(u.type=O),d!=null||p!=null){if(!(O!=="submit"&&O!=="reset"||d!=null)){Xy(u);return}p=p!=null?""+Li(p):"",d=d!=null?""+Li(d):p,Y||d===u.value||(u.value=d),u.defaultValue=d}v=v??j,v=typeof v!="function"&&typeof v!="symbol"&&!!v,u.checked=Y?u.checked:!!v,u.defaultChecked=!!v,q!=null&&typeof q!="function"&&typeof q!="symbol"&&typeof q!="boolean"&&(u.name=q),Xy(u)}function Ky(u,d,p){d==="number"&&zp(u.ownerDocument)===u||u.defaultValue===""+p||(u.defaultValue=""+p)}function Xu(u,d,p,v){if(u=u.options,d){d={};for(var j=0;j"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),nb=!1;if(El)try{var lf={};Object.defineProperty(lf,"passive",{get:function(){nb=!0}}),window.addEventListener("test",lf,lf),window.removeEventListener("test",lf,lf)}catch{nb=!1}var Eo=null,rb=null,Lp=null;function iN(){if(Lp)return Lp;var u,d=rb,p=d.length,v,j="value"in Eo?Eo.value:Eo.textContent,O=j.length;for(u=0;u=uf),dN=" ",hN=!1;function fN(u,d){switch(u){case"keyup":return EG.indexOf(d.keyCode)!==-1;case"keydown":return d.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function mN(u){return u=u.detail,typeof u=="object"&&"data"in u?u.data:null}var Ju=!1;function MG(u,d){switch(u){case"compositionend":return mN(d);case"keypress":return d.which!==32?null:(hN=!0,dN);case"textInput":return u=d.data,u===dN&&hN?null:u;default:return null}}function AG(u,d){if(Ju)return u==="compositionend"||!ob&&fN(u,d)?(u=iN(),Lp=rb=Eo=null,Ju=!1,u):null;switch(u){case"paste":return null;case"keypress":if(!(d.ctrlKey||d.altKey||d.metaKey)||d.ctrlKey&&d.altKey){if(d.char&&1=d)return{node:p,offset:d-u};u=v}e:{for(;p;){if(p.nextSibling){p=p.nextSibling;break e}p=p.parentNode}p=void 0}p=SN(p)}}function jN(u,d){return u&&d?u===d?!0:u&&u.nodeType===3?!1:d&&d.nodeType===3?jN(u,d.parentNode):"contains"in u?u.contains(d):u.compareDocumentPosition?!!(u.compareDocumentPosition(d)&16):!1:!1}function ON(u){u=u!=null&&u.ownerDocument!=null&&u.ownerDocument.defaultView!=null?u.ownerDocument.defaultView:window;for(var d=zp(u.document);d instanceof u.HTMLIFrameElement;){try{var p=typeof d.contentWindow.location.href=="string"}catch{p=!1}if(p)u=d.contentWindow;else break;d=zp(u.document)}return d}function db(u){var d=u&&u.nodeName&&u.nodeName.toLowerCase();return d&&(d==="input"&&(u.type==="text"||u.type==="search"||u.type==="tel"||u.type==="url"||u.type==="password")||d==="textarea"||u.contentEditable==="true")}var qG=El&&"documentMode"in document&&11>=document.documentMode,ed=null,hb=null,mf=null,fb=!1;function NN(u,d,p){var v=p.window===p?p.document:p.nodeType===9?p:p.ownerDocument;fb||ed==null||ed!==zp(v)||(v=ed,"selectionStart"in v&&db(v)?v={start:v.selectionStart,end:v.selectionEnd}:(v=(v.ownerDocument&&v.ownerDocument.defaultView||window).getSelection(),v={anchorNode:v.anchorNode,anchorOffset:v.anchorOffset,focusNode:v.focusNode,focusOffset:v.focusOffset}),mf&&ff(mf,v)||(mf=v,v=_g(hb,"onSelect"),0>=q,j-=q,qa=1<<32-At(d)+j|p<Vt?(an=dt,dt=null):an=dt.sibling;var _n=Se(pe,dt,ye[Vt],Me);if(_n===null){dt===null&&(dt=an);break}u&&dt&&_n.alternate===null&&d(pe,dt),fe=O(_n,fe,Vt),En===null?bt=_n:En.sibling=_n,En=_n,dt=an}if(Vt===ye.length)return p(pe,dt),cn&&Ml(pe,Vt),bt;if(dt===null){for(;VtVt?(an=dt,dt=null):an=dt.sibling;var Ko=Se(pe,dt,_n.value,Me);if(Ko===null){dt===null&&(dt=an);break}u&&dt&&Ko.alternate===null&&d(pe,dt),fe=O(Ko,fe,Vt),En===null?bt=Ko:En.sibling=Ko,En=Ko,dt=an}if(_n.done)return p(pe,dt),cn&&Ml(pe,Vt),bt;if(dt===null){for(;!_n.done;Vt++,_n=ye.next())_n=Re(pe,_n.value,Me),_n!==null&&(fe=O(_n,fe,Vt),En===null?bt=_n:En.sibling=_n,En=_n);return cn&&Ml(pe,Vt),bt}for(dt=v(dt);!_n.done;Vt++,_n=ye.next())_n=Ne(dt,pe,Vt,_n.value,Me),_n!==null&&(u&&_n.alternate!==null&&dt.delete(_n.key===null?Vt:_n.key),fe=O(_n,fe,Vt),En===null?bt=_n:En.sibling=_n,En=_n);return u&&dt.forEach(function(aY){return d(pe,aY)}),cn&&Ml(pe,Vt),bt}function $n(pe,fe,ye,Me){if(typeof ye=="object"&&ye!==null&&ye.type===w&&ye.key===null&&(ye=ye.props.children),typeof ye=="object"&&ye!==null){switch(ye.$$typeof){case x:e:{for(var bt=ye.key;fe!==null;){if(fe.key===bt){if(bt=ye.type,bt===w){if(fe.tag===7){p(pe,fe.sibling),Me=j(fe,ye.props.children),Me.return=pe,pe=Me;break e}}else if(fe.elementType===bt||typeof bt=="object"&&bt!==null&&bt.$$typeof===L&&Yc(bt)===fe.type){p(pe,fe.sibling),Me=j(fe,ye.props),bf(Me,ye),Me.return=pe,pe=Me;break e}p(pe,fe);break}else d(pe,fe);fe=fe.sibling}ye.type===w?(Me=Vc(ye.props.children,pe.mode,Me,ye.key),Me.return=pe,pe=Me):(Me=Wp(ye.type,ye.key,ye.props,null,pe.mode,Me),bf(Me,ye),Me.return=pe,pe=Me)}return q(pe);case y:e:{for(bt=ye.key;fe!==null;){if(fe.key===bt)if(fe.tag===4&&fe.stateNode.containerInfo===ye.containerInfo&&fe.stateNode.implementation===ye.implementation){p(pe,fe.sibling),Me=j(fe,ye.children||[]),Me.return=pe,pe=Me;break e}else{p(pe,fe);break}else d(pe,fe);fe=fe.sibling}Me=bb(ye,pe.mode,Me),Me.return=pe,pe=Me}return q(pe);case L:return ye=Yc(ye),$n(pe,fe,ye,Me)}if(H(ye))return at(pe,fe,ye,Me);if(U(ye)){if(bt=U(ye),typeof bt!="function")throw Error(r(150));return ye=bt.call(ye),kt(pe,fe,ye,Me)}if(typeof ye.then=="function")return $n(pe,fe,eg(ye),Me);if(ye.$$typeof===C)return $n(pe,fe,Yp(pe,ye),Me);tg(pe,ye)}return typeof ye=="string"&&ye!==""||typeof ye=="number"||typeof ye=="bigint"?(ye=""+ye,fe!==null&&fe.tag===6?(p(pe,fe.sibling),Me=j(fe,ye),Me.return=pe,pe=Me):(p(pe,fe),Me=yb(ye,pe.mode,Me),Me.return=pe,pe=Me),q(pe)):p(pe,fe)}return function(pe,fe,ye,Me){try{yf=0;var bt=$n(pe,fe,ye,Me);return dd=null,bt}catch(dt){if(dt===ud||dt===Zp)throw dt;var En=gi(29,dt,null,pe.mode);return En.lanes=Me,En.return=pe,En}finally{}}}var Zc=XN(!0),YN=XN(!1),Do=!1;function Ab(u){u.updateQueue={baseState:u.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Rb(u,d){u=u.updateQueue,d.updateQueue===u&&(d.updateQueue={baseState:u.baseState,firstBaseUpdate:u.firstBaseUpdate,lastBaseUpdate:u.lastBaseUpdate,shared:u.shared,callbacks:null})}function zo(u){return{lane:u,tag:0,payload:null,callback:null,next:null}}function Po(u,d,p){var v=u.updateQueue;if(v===null)return null;if(v=v.shared,(An&2)!==0){var j=v.pending;return j===null?d.next=d:(d.next=j.next,j.next=d),v.pending=d,d=Up(u),RN(u,null,p),d}return Vp(u,v,d,p),Up(u)}function wf(u,d,p){if(d=d.updateQueue,d!==null&&(d=d.shared,(p&4194048)!==0)){var v=d.lanes;v&=u.pendingLanes,p|=v,d.lanes=p,Wr(u,p)}}function Db(u,d){var p=u.updateQueue,v=u.alternate;if(v!==null&&(v=v.updateQueue,p===v)){var j=null,O=null;if(p=p.firstBaseUpdate,p!==null){do{var q={lane:p.lane,tag:p.tag,payload:p.payload,callback:null,next:null};O===null?j=O=q:O=O.next=q,p=p.next}while(p!==null);O===null?j=O=d:O=O.next=d}else j=O=d;p={baseState:v.baseState,firstBaseUpdate:j,lastBaseUpdate:O,shared:v.shared,callbacks:v.callbacks},u.updateQueue=p;return}u=p.lastBaseUpdate,u===null?p.firstBaseUpdate=d:u.next=d,p.lastBaseUpdate=d}var zb=!1;function Sf(){if(zb){var u=cd;if(u!==null)throw u}}function kf(u,d,p,v){zb=!1;var j=u.updateQueue;Do=!1;var O=j.firstBaseUpdate,q=j.lastBaseUpdate,Y=j.shared.pending;if(Y!==null){j.shared.pending=null;var ce=Y,we=ce.next;ce.next=null,q===null?O=we:q.next=we,q=ce;var Ee=u.alternate;Ee!==null&&(Ee=Ee.updateQueue,Y=Ee.lastBaseUpdate,Y!==q&&(Y===null?Ee.firstBaseUpdate=we:Y.next=we,Ee.lastBaseUpdate=ce))}if(O!==null){var Re=j.baseState;q=0,Ee=we=ce=null,Y=O;do{var Se=Y.lane&-536870913,Ne=Se!==Y.lane;if(Ne?(sn&Se)===Se:(v&Se)===Se){Se!==0&&Se===od&&(zb=!0),Ee!==null&&(Ee=Ee.next={lane:0,tag:Y.tag,payload:Y.payload,callback:null,next:null});e:{var at=u,kt=Y;Se=d;var $n=p;switch(kt.tag){case 1:if(at=kt.payload,typeof at=="function"){Re=at.call($n,Re,Se);break e}Re=at;break e;case 3:at.flags=at.flags&-65537|128;case 0:if(at=kt.payload,Se=typeof at=="function"?at.call($n,Re,Se):at,Se==null)break e;Re=m({},Re,Se);break e;case 2:Do=!0}}Se=Y.callback,Se!==null&&(u.flags|=64,Ne&&(u.flags|=8192),Ne=j.callbacks,Ne===null?j.callbacks=[Se]:Ne.push(Se))}else Ne={lane:Se,tag:Y.tag,payload:Y.payload,callback:Y.callback,next:null},Ee===null?(we=Ee=Ne,ce=Re):Ee=Ee.next=Ne,q|=Se;if(Y=Y.next,Y===null){if(Y=j.shared.pending,Y===null)break;Ne=Y,Y=Ne.next,Ne.next=null,j.lastBaseUpdate=Ne,j.shared.pending=null}}while(!0);Ee===null&&(ce=Re),j.baseState=ce,j.firstBaseUpdate=we,j.lastBaseUpdate=Ee,O===null&&(j.shared.lanes=0),Fo|=q,u.lanes=q,u.memoizedState=Re}}function KN(u,d){if(typeof u!="function")throw Error(r(191,u));u.call(d)}function ZN(u,d){var p=u.callbacks;if(p!==null)for(u.callbacks=null,u=0;uO?O:8;var q=B.T,Y={};B.T=Y,e2(u,!1,d,p);try{var ce=j(),we=B.S;if(we!==null&&we(Y,ce),ce!==null&&typeof ce=="object"&&typeof ce.then=="function"){var Ee=XG(ce,v);Nf(u,d,Ee,wi(u))}else Nf(u,d,v,wi(u))}catch(Re){Nf(u,d,{then:function(){},status:"rejected",reason:Re},wi())}finally{X.p=O,q!==null&&Y.types!==null&&(q.types=Y.types),B.T=q}}function tX(){}function Zb(u,d,p,v){if(u.tag!==5)throw Error(r(476));var j=_7(u).queue;E7(u,j,d,J,p===null?tX:function(){return M7(u),p(v)})}function _7(u){var d=u.memoizedState;if(d!==null)return d;d={memoizedState:J,baseState:J,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:zl,lastRenderedState:J},next:null};var p={};return d.next={memoizedState:p,baseState:p,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:zl,lastRenderedState:p},next:null},u.memoizedState=d,u=u.alternate,u!==null&&(u.memoizedState=d),d}function M7(u){var d=_7(u);d.next===null&&(d=u.alternate.memoizedState),Nf(u,d.next.queue,{},wi())}function Jb(){return fs(Qf)}function A7(){return Cr().memoizedState}function R7(){return Cr().memoizedState}function nX(u){for(var d=u.return;d!==null;){switch(d.tag){case 24:case 3:var p=wi();u=zo(p);var v=Po(d,u,p);v!==null&&(Ys(v,d,p),wf(v,d,p)),d={cache:Tb()},u.payload=d;return}d=d.return}}function rX(u,d,p){var v=wi();p={lane:v,revertLane:0,gesture:null,action:p,hasEagerState:!1,eagerState:null,next:null},dg(u)?z7(d,p):(p=xb(u,d,p,v),p!==null&&(Ys(p,u,v),P7(p,d,v)))}function D7(u,d,p){var v=wi();Nf(u,d,p,v)}function Nf(u,d,p,v){var j={lane:v,revertLane:0,gesture:null,action:p,hasEagerState:!1,eagerState:null,next:null};if(dg(u))z7(d,j);else{var O=u.alternate;if(u.lanes===0&&(O===null||O.lanes===0)&&(O=d.lastRenderedReducer,O!==null))try{var q=d.lastRenderedState,Y=O(q,p);if(j.hasEagerState=!0,j.eagerState=Y,pi(Y,q))return Vp(u,d,j,0),Un===null&&Hp(),!1}catch{}finally{}if(p=xb(u,d,j,v),p!==null)return Ys(p,u,v),P7(p,d,v),!0}return!1}function e2(u,d,p,v){if(v={lane:2,revertLane:A2(),gesture:null,action:v,hasEagerState:!1,eagerState:null,next:null},dg(u)){if(d)throw Error(r(479))}else d=xb(u,p,v,2),d!==null&&Ys(d,u,2)}function dg(u){var d=u.alternate;return u===$t||d!==null&&d===$t}function z7(u,d){fd=sg=!0;var p=u.pending;p===null?d.next=d:(d.next=p.next,p.next=d),u.pending=d}function P7(u,d,p){if((p&4194048)!==0){var v=d.lanes;v&=u.pendingLanes,p|=v,d.lanes=p,Wr(u,p)}}var Cf={readContext:fs,use:lg,useCallback:yr,useContext:yr,useEffect:yr,useImperativeHandle:yr,useLayoutEffect:yr,useInsertionEffect:yr,useMemo:yr,useReducer:yr,useRef:yr,useState:yr,useDebugValue:yr,useDeferredValue:yr,useTransition:yr,useSyncExternalStore:yr,useId:yr,useHostTransitionStatus:yr,useFormState:yr,useActionState:yr,useOptimistic:yr,useMemoCache:yr,useCacheRefresh:yr};Cf.useEffectEvent=yr;var L7={readContext:fs,use:lg,useCallback:function(u,d){return As().memoizedState=[u,d===void 0?null:d],u},useContext:fs,useEffect:b7,useImperativeHandle:function(u,d,p){p=p!=null?p.concat([u]):null,cg(4194308,4,j7.bind(null,d,u),p)},useLayoutEffect:function(u,d){return cg(4194308,4,u,d)},useInsertionEffect:function(u,d){cg(4,2,u,d)},useMemo:function(u,d){var p=As();d=d===void 0?null:d;var v=u();if(Jc){Rt(!0);try{u()}finally{Rt(!1)}}return p.memoizedState=[v,d],v},useReducer:function(u,d,p){var v=As();if(p!==void 0){var j=p(d);if(Jc){Rt(!0);try{p(d)}finally{Rt(!1)}}}else j=d;return v.memoizedState=v.baseState=j,u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:u,lastRenderedState:j},v.queue=u,u=u.dispatch=rX.bind(null,$t,u),[v.memoizedState,u]},useRef:function(u){var d=As();return u={current:u},d.memoizedState=u},useState:function(u){u=Wb(u);var d=u.queue,p=D7.bind(null,$t,d);return d.dispatch=p,[u.memoizedState,p]},useDebugValue:Yb,useDeferredValue:function(u,d){var p=As();return Kb(p,u,d)},useTransition:function(){var u=Wb(!1);return u=E7.bind(null,$t,u.queue,!0,!1),As().memoizedState=u,[!1,u]},useSyncExternalStore:function(u,d,p){var v=$t,j=As();if(cn){if(p===void 0)throw Error(r(407));p=p()}else{if(p=d(),Un===null)throw Error(r(349));(sn&127)!==0||s7(v,d,p)}j.memoizedState=p;var O={value:p,getSnapshot:d};return j.queue=O,b7(a7.bind(null,v,O,u),[u]),v.flags|=2048,pd(9,{destroy:void 0},i7.bind(null,v,O,p,d),null),p},useId:function(){var u=As(),d=Un.identifierPrefix;if(cn){var p=Fa,v=qa;p=(v&~(1<<32-At(v)-1)).toString(32)+p,d="_"+d+"R_"+p,p=ig++,0<\/script>",O=O.removeChild(O.firstChild);break;case"select":O=typeof v.is=="string"?q.createElement("select",{is:v.is}):q.createElement("select"),v.multiple?O.multiple=!0:v.size&&(O.size=v.size);break;default:O=typeof v.is=="string"?q.createElement(j,{is:v.is}):q.createElement(j)}}O[Gr]=d,O[ds]=v;e:for(q=d.child;q!==null;){if(q.tag===5||q.tag===6)O.appendChild(q.stateNode);else if(q.tag!==4&&q.tag!==27&&q.child!==null){q.child.return=q,q=q.child;continue}if(q===d)break e;for(;q.sibling===null;){if(q.return===null||q.return===d)break e;q=q.return}q.sibling.return=q.return,q=q.sibling}d.stateNode=O;e:switch(ps(O,j,v),j){case"button":case"input":case"select":case"textarea":v=!!v.autoFocus;break e;case"img":v=!0;break e;default:v=!1}v&&Ll(d)}}return nr(d),m2(d,d.type,u===null?null:u.memoizedProps,d.pendingProps,p),null;case 6:if(u&&d.stateNode!=null)u.memoizedProps!==v&&Ll(d);else{if(typeof v!="string"&&d.stateNode===null)throw Error(r(166));if(u=ne.current,ad(d)){if(u=d.stateNode,p=d.memoizedProps,v=null,j=hs,j!==null)switch(j.tag){case 27:case 5:v=j.memoizedProps}u[Gr]=d,u=!!(u.nodeValue===p||v!==null&&v.suppressHydrationWarning===!0||nC(u.nodeValue,p)),u||Ao(d,!0)}else u=Mg(u).createTextNode(v),u[Gr]=d,d.stateNode=u}return nr(d),null;case 31:if(p=d.memoizedState,u===null||u.memoizedState!==null){if(v=ad(d),p!==null){if(u===null){if(!v)throw Error(r(318));if(u=d.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(r(557));u[Gr]=d}else Uc(),(d.flags&128)===0&&(d.memoizedState=null),d.flags|=4;nr(d),u=!1}else p=jb(),u!==null&&u.memoizedState!==null&&(u.memoizedState.hydrationErrors=p),u=!0;if(!u)return d.flags&256?(vi(d),d):(vi(d),null);if((d.flags&128)!==0)throw Error(r(558))}return nr(d),null;case 13:if(v=d.memoizedState,u===null||u.memoizedState!==null&&u.memoizedState.dehydrated!==null){if(j=ad(d),v!==null&&v.dehydrated!==null){if(u===null){if(!j)throw Error(r(318));if(j=d.memoizedState,j=j!==null?j.dehydrated:null,!j)throw Error(r(317));j[Gr]=d}else Uc(),(d.flags&128)===0&&(d.memoizedState=null),d.flags|=4;nr(d),j=!1}else j=jb(),u!==null&&u.memoizedState!==null&&(u.memoizedState.hydrationErrors=j),j=!0;if(!j)return d.flags&256?(vi(d),d):(vi(d),null)}return vi(d),(d.flags&128)!==0?(d.lanes=p,d):(p=v!==null,u=u!==null&&u.memoizedState!==null,p&&(v=d.child,j=null,v.alternate!==null&&v.alternate.memoizedState!==null&&v.alternate.memoizedState.cachePool!==null&&(j=v.alternate.memoizedState.cachePool.pool),O=null,v.memoizedState!==null&&v.memoizedState.cachePool!==null&&(O=v.memoizedState.cachePool.pool),O!==j&&(v.flags|=2048)),p!==u&&p&&(d.child.flags|=8192),gg(d,d.updateQueue),nr(d),null);case 4:return re(),u===null&&P2(d.stateNode.containerInfo),nr(d),null;case 10:return Rl(d.type),nr(d),null;case 19:if(W(Nr),v=d.memoizedState,v===null)return nr(d),null;if(j=(d.flags&128)!==0,O=v.rendering,O===null)if(j)Ef(v,!1);else{if(br!==0||u!==null&&(u.flags&128)!==0)for(u=d.child;u!==null;){if(O=rg(u),O!==null){for(d.flags|=128,Ef(v,!1),u=O.updateQueue,d.updateQueue=u,gg(d,u),d.subtreeFlags=0,u=p,p=d.child;p!==null;)DN(p,u),p=p.sibling;return F(Nr,Nr.current&1|2),cn&&Ml(d,v.treeForkCount),d.child}u=u.sibling}v.tail!==null&&Mt()>wg&&(d.flags|=128,j=!0,Ef(v,!1),d.lanes=4194304)}else{if(!j)if(u=rg(O),u!==null){if(d.flags|=128,j=!0,u=u.updateQueue,d.updateQueue=u,gg(d,u),Ef(v,!0),v.tail===null&&v.tailMode==="hidden"&&!O.alternate&&!cn)return nr(d),null}else 2*Mt()-v.renderingStartTime>wg&&p!==536870912&&(d.flags|=128,j=!0,Ef(v,!1),d.lanes=4194304);v.isBackwards?(O.sibling=d.child,d.child=O):(u=v.last,u!==null?u.sibling=O:d.child=O,v.last=O)}return v.tail!==null?(u=v.tail,v.rendering=u,v.tail=u.sibling,v.renderingStartTime=Mt(),u.sibling=null,p=Nr.current,F(Nr,j?p&1|2:p&1),cn&&Ml(d,v.treeForkCount),u):(nr(d),null);case 22:case 23:return vi(d),Lb(),v=d.memoizedState!==null,u!==null?u.memoizedState!==null!==v&&(d.flags|=8192):v&&(d.flags|=8192),v?(p&536870912)!==0&&(d.flags&128)===0&&(nr(d),d.subtreeFlags&6&&(d.flags|=8192)):nr(d),p=d.updateQueue,p!==null&&gg(d,p.retryQueue),p=null,u!==null&&u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(p=u.memoizedState.cachePool.pool),v=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(v=d.memoizedState.cachePool.pool),v!==p&&(d.flags|=2048),u!==null&&W(Xc),null;case 24:return p=null,u!==null&&(p=u.memoizedState.cache),d.memoizedState.cache!==p&&(d.flags|=2048),Rl(zr),nr(d),null;case 25:return null;case 30:return null}throw Error(r(156,d.tag))}function oX(u,d){switch(Sb(d),d.tag){case 1:return u=d.flags,u&65536?(d.flags=u&-65537|128,d):null;case 3:return Rl(zr),re(),u=d.flags,(u&65536)!==0&&(u&128)===0?(d.flags=u&-65537|128,d):null;case 26:case 27:case 5:return _e(d),null;case 31:if(d.memoizedState!==null){if(vi(d),d.alternate===null)throw Error(r(340));Uc()}return u=d.flags,u&65536?(d.flags=u&-65537|128,d):null;case 13:if(vi(d),u=d.memoizedState,u!==null&&u.dehydrated!==null){if(d.alternate===null)throw Error(r(340));Uc()}return u=d.flags,u&65536?(d.flags=u&-65537|128,d):null;case 19:return W(Nr),null;case 4:return re(),null;case 10:return Rl(d.type),null;case 22:case 23:return vi(d),Lb(),u!==null&&W(Xc),u=d.flags,u&65536?(d.flags=u&-65537|128,d):null;case 24:return Rl(zr),null;case 25:return null;default:return null}}function l8(u,d){switch(Sb(d),d.tag){case 3:Rl(zr),re();break;case 26:case 27:case 5:_e(d);break;case 4:re();break;case 31:d.memoizedState!==null&&vi(d);break;case 13:vi(d);break;case 19:W(Nr);break;case 10:Rl(d.type);break;case 22:case 23:vi(d),Lb(),u!==null&&W(Xc);break;case 24:Rl(zr)}}function _f(u,d){try{var p=d.updateQueue,v=p!==null?p.lastEffect:null;if(v!==null){var j=v.next;p=j;do{if((p.tag&u)===u){v=void 0;var O=p.create,q=p.inst;v=O(),q.destroy=v}p=p.next}while(p!==j)}}catch(Y){Pn(d,d.return,Y)}}function Bo(u,d,p){try{var v=d.updateQueue,j=v!==null?v.lastEffect:null;if(j!==null){var O=j.next;v=O;do{if((v.tag&u)===u){var q=v.inst,Y=q.destroy;if(Y!==void 0){q.destroy=void 0,j=d;var ce=p,we=Y;try{we()}catch(Ee){Pn(j,ce,Ee)}}}v=v.next}while(v!==O)}}catch(Ee){Pn(d,d.return,Ee)}}function o8(u){var d=u.updateQueue;if(d!==null){var p=u.stateNode;try{ZN(d,p)}catch(v){Pn(u,u.return,v)}}}function c8(u,d,p){p.props=eu(u.type,u.memoizedProps),p.state=u.memoizedState;try{p.componentWillUnmount()}catch(v){Pn(u,d,v)}}function Mf(u,d){try{var p=u.ref;if(p!==null){switch(u.tag){case 26:case 27:case 5:var v=u.stateNode;break;case 30:v=u.stateNode;break;default:v=u.stateNode}typeof p=="function"?u.refCleanup=p(v):p.current=v}}catch(j){Pn(u,d,j)}}function $a(u,d){var p=u.ref,v=u.refCleanup;if(p!==null)if(typeof v=="function")try{v()}catch(j){Pn(u,d,j)}finally{u.refCleanup=null,u=u.alternate,u!=null&&(u.refCleanup=null)}else if(typeof p=="function")try{p(null)}catch(j){Pn(u,d,j)}else p.current=null}function u8(u){var d=u.type,p=u.memoizedProps,v=u.stateNode;try{e:switch(d){case"button":case"input":case"select":case"textarea":p.autoFocus&&v.focus();break e;case"img":p.src?v.src=p.src:p.srcSet&&(v.srcset=p.srcSet)}}catch(j){Pn(u,u.return,j)}}function p2(u,d,p){try{var v=u.stateNode;_X(v,u.type,p,d),v[ds]=d}catch(j){Pn(u,u.return,j)}}function d8(u){return u.tag===5||u.tag===3||u.tag===26||u.tag===27&&Uo(u.type)||u.tag===4}function g2(u){e:for(;;){for(;u.sibling===null;){if(u.return===null||d8(u.return))return null;u=u.return}for(u.sibling.return=u.return,u=u.sibling;u.tag!==5&&u.tag!==6&&u.tag!==18;){if(u.tag===27&&Uo(u.type)||u.flags&2||u.child===null||u.tag===4)continue e;u.child.return=u,u=u.child}if(!(u.flags&2))return u.stateNode}}function x2(u,d,p){var v=u.tag;if(v===5||v===6)u=u.stateNode,d?(p.nodeType===9?p.body:p.nodeName==="HTML"?p.ownerDocument.body:p).insertBefore(u,d):(d=p.nodeType===9?p.body:p.nodeName==="HTML"?p.ownerDocument.body:p,d.appendChild(u),p=p._reactRootContainer,p!=null||d.onclick!==null||(d.onclick=Tl));else if(v!==4&&(v===27&&Uo(u.type)&&(p=u.stateNode,d=null),u=u.child,u!==null))for(x2(u,d,p),u=u.sibling;u!==null;)x2(u,d,p),u=u.sibling}function xg(u,d,p){var v=u.tag;if(v===5||v===6)u=u.stateNode,d?p.insertBefore(u,d):p.appendChild(u);else if(v!==4&&(v===27&&Uo(u.type)&&(p=u.stateNode),u=u.child,u!==null))for(xg(u,d,p),u=u.sibling;u!==null;)xg(u,d,p),u=u.sibling}function h8(u){var d=u.stateNode,p=u.memoizedProps;try{for(var v=u.type,j=d.attributes;j.length;)d.removeAttributeNode(j[0]);ps(d,v,p),d[Gr]=u,d[ds]=p}catch(O){Pn(u,u.return,O)}}var Il=!1,Ir=!1,v2=!1,f8=typeof WeakSet=="function"?WeakSet:Set,rs=null;function cX(u,d){if(u=u.containerInfo,B2=Ig,u=ON(u),db(u)){if("selectionStart"in u)var p={start:u.selectionStart,end:u.selectionEnd};else e:{p=(p=u.ownerDocument)&&p.defaultView||window;var v=p.getSelection&&p.getSelection();if(v&&v.rangeCount!==0){p=v.anchorNode;var j=v.anchorOffset,O=v.focusNode;v=v.focusOffset;try{p.nodeType,O.nodeType}catch{p=null;break e}var q=0,Y=-1,ce=-1,we=0,Ee=0,Re=u,Se=null;t:for(;;){for(var Ne;Re!==p||j!==0&&Re.nodeType!==3||(Y=q+j),Re!==O||v!==0&&Re.nodeType!==3||(ce=q+v),Re.nodeType===3&&(q+=Re.nodeValue.length),(Ne=Re.firstChild)!==null;)Se=Re,Re=Ne;for(;;){if(Re===u)break t;if(Se===p&&++we===j&&(Y=q),Se===O&&++Ee===v&&(ce=q),(Ne=Re.nextSibling)!==null)break;Re=Se,Se=Re.parentNode}Re=Ne}p=Y===-1||ce===-1?null:{start:Y,end:ce}}else p=null}p=p||{start:0,end:0}}else p=null;for(q2={focusedElem:u,selectionRange:p},Ig=!1,rs=d;rs!==null;)if(d=rs,u=d.child,(d.subtreeFlags&1028)!==0&&u!==null)u.return=d,rs=u;else for(;rs!==null;){switch(d=rs,O=d.alternate,u=d.flags,d.tag){case 0:if((u&4)!==0&&(u=d.updateQueue,u=u!==null?u.events:null,u!==null))for(p=0;p title"))),ps(O,v,p),O[Gr]=u,Dr(O),v=O;break e;case"link":var q=yC("link","href",j).get(v+(p.href||""));if(q){for(var Y=0;Y$n&&(q=$n,$n=kt,kt=q);var pe=kN(Y,kt),fe=kN(Y,$n);if(pe&&fe&&(Ne.rangeCount!==1||Ne.anchorNode!==pe.node||Ne.anchorOffset!==pe.offset||Ne.focusNode!==fe.node||Ne.focusOffset!==fe.offset)){var ye=Re.createRange();ye.setStart(pe.node,pe.offset),Ne.removeAllRanges(),kt>$n?(Ne.addRange(ye),Ne.extend(fe.node,fe.offset)):(ye.setEnd(fe.node,fe.offset),Ne.addRange(ye))}}}}for(Re=[],Ne=Y;Ne=Ne.parentNode;)Ne.nodeType===1&&Re.push({element:Ne,left:Ne.scrollLeft,top:Ne.scrollTop});for(typeof Y.focus=="function"&&Y.focus(),Y=0;Yp?32:p,B.T=null,p=O2,O2=null;var O=Qo,q=Ql;if(Xr=0,bd=Qo=null,Ql=0,(An&6)!==0)throw Error(r(331));var Y=An;if(An|=4,j8(O.current),w8(O,O.current,q,p),An=Y,Lf(0,!1),qe&&typeof qe.onPostCommitFiberRoot=="function")try{qe.onPostCommitFiberRoot(Te,O)}catch{}return!0}finally{X.p=j,B.T=v,$8(u,d)}}function H8(u,d,p){d=qi(p,d),d=s2(u.stateNode,d,2),u=Po(u,d,2),u!==null&&(Et(u,2),Qa(u))}function Pn(u,d,p){if(u.tag===3)H8(u,u,p);else for(;d!==null;){if(d.tag===3){H8(d,u,p);break}else if(d.tag===1){var v=d.stateNode;if(typeof d.type.getDerivedStateFromError=="function"||typeof v.componentDidCatch=="function"&&($o===null||!$o.has(v))){u=qi(p,u),p=V7(2),v=Po(d,p,2),v!==null&&(U7(p,v,d,u),Et(v,2),Qa(v));break}}d=d.return}}function E2(u,d,p){var v=u.pingCache;if(v===null){v=u.pingCache=new hX;var j=new Set;v.set(d,j)}else j=v.get(d),j===void 0&&(j=new Set,v.set(d,j));j.has(p)||(w2=!0,j.add(p),u=xX.bind(null,u,d,p),d.then(u,u))}function xX(u,d,p){var v=u.pingCache;v!==null&&v.delete(d),u.pingedLanes|=u.suspendedLanes&p,u.warmLanes&=~p,Un===u&&(sn&p)===p&&(br===4||br===3&&(sn&62914560)===sn&&300>Mt()-bg?(An&2)===0&&wd(u,0):S2|=p,yd===sn&&(yd=0)),Qa(u)}function V8(u,d){d===0&&(d=ge()),u=Hc(u,d),u!==null&&(Et(u,d),Qa(u))}function vX(u){var d=u.memoizedState,p=0;d!==null&&(p=d.retryLane),V8(u,p)}function yX(u,d){var p=0;switch(u.tag){case 31:case 13:var v=u.stateNode,j=u.memoizedState;j!==null&&(p=j.retryLane);break;case 19:v=u.stateNode;break;case 22:v=u.stateNode._retryCache;break;default:throw Error(r(314))}v!==null&&v.delete(d),V8(u,p)}function bX(u,d){return rt(u,d)}var Cg=null,kd=null,_2=!1,Tg=!1,M2=!1,Vo=0;function Qa(u){u!==kd&&u.next===null&&(kd===null?Cg=kd=u:kd=kd.next=u),Tg=!0,_2||(_2=!0,SX())}function Lf(u,d){if(!M2&&Tg){M2=!0;do for(var p=!1,v=Cg;v!==null;){if(u!==0){var j=v.pendingLanes;if(j===0)var O=0;else{var q=v.suspendedLanes,Y=v.pingedLanes;O=(1<<31-At(42|u)+1)-1,O&=j&~(q&~Y),O=O&201326741?O&201326741|1:O?O|2:0}O!==0&&(p=!0,X8(v,O))}else O=sn,O=Vn(v,v===Un?O:0,v.cancelPendingCommit!==null||v.timeoutHandle!==-1),(O&3)===0||jr(v,O)||(p=!0,X8(v,O));v=v.next}while(p);M2=!1}}function wX(){U8()}function U8(){Tg=_2=!1;var u=0;Vo!==0&&AX()&&(u=Vo);for(var d=Mt(),p=null,v=Cg;v!==null;){var j=v.next,O=W8(v,d);O===0?(v.next=null,p===null?Cg=j:p.next=j,j===null&&(kd=p)):(p=v,(u!==0||(O&3)!==0)&&(Tg=!0)),v=j}Xr!==0&&Xr!==5||Lf(u),Vo!==0&&(Vo=0)}function W8(u,d){for(var p=u.suspendedLanes,v=u.pingedLanes,j=u.expirationTimes,O=u.pendingLanes&-62914561;0Y)break;var Ee=ce.transferSize,Re=ce.initiatorType;Ee&&rC(Re)&&(ce=ce.responseEnd,q+=Ee*(ce"u"?null:document;function pC(u,d,p){var v=jd;if(v&&typeof d=="string"&&d){var j=Ii(d);j='link[rel="'+u+'"][href="'+j+'"]',typeof p=="string"&&(j+='[crossorigin="'+p+'"]'),mC.has(j)||(mC.add(j),u={rel:u,crossOrigin:p,href:d},v.querySelector(j)===null&&(d=v.createElement("link"),ps(d,"link",u),Dr(d),v.head.appendChild(d)))}}function FX(u){Hl.D(u),pC("dns-prefetch",u,null)}function $X(u,d){Hl.C(u,d),pC("preconnect",u,d)}function QX(u,d,p){Hl.L(u,d,p);var v=jd;if(v&&u&&d){var j='link[rel="preload"][as="'+Ii(d)+'"]';d==="image"&&p&&p.imageSrcSet?(j+='[imagesrcset="'+Ii(p.imageSrcSet)+'"]',typeof p.imageSizes=="string"&&(j+='[imagesizes="'+Ii(p.imageSizes)+'"]')):j+='[href="'+Ii(u)+'"]';var O=j;switch(d){case"style":O=Od(u);break;case"script":O=Nd(u)}Ui.has(O)||(u=m({rel:"preload",href:d==="image"&&p&&p.imageSrcSet?void 0:u,as:d},p),Ui.set(O,u),v.querySelector(j)!==null||d==="style"&&v.querySelector(Ff(O))||d==="script"&&v.querySelector($f(O))||(d=v.createElement("link"),ps(d,"link",u),Dr(d),v.head.appendChild(d)))}}function HX(u,d){Hl.m(u,d);var p=jd;if(p&&u){var v=d&&typeof d.as=="string"?d.as:"script",j='link[rel="modulepreload"][as="'+Ii(v)+'"][href="'+Ii(u)+'"]',O=j;switch(v){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":O=Nd(u)}if(!Ui.has(O)&&(u=m({rel:"modulepreload",href:u},d),Ui.set(O,u),p.querySelector(j)===null)){switch(v){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(p.querySelector($f(O)))return}v=p.createElement("link"),ps(v,"link",u),Dr(v),p.head.appendChild(v)}}}function VX(u,d,p){Hl.S(u,d,p);var v=jd;if(v&&u){var j=To(v).hoistableStyles,O=Od(u);d=d||"default";var q=j.get(O);if(!q){var Y={loading:0,preload:null};if(q=v.querySelector(Ff(O)))Y.loading=5;else{u=m({rel:"stylesheet",href:u,"data-precedence":d},p),(p=Ui.get(O))&&W2(u,p);var ce=q=v.createElement("link");Dr(ce),ps(ce,"link",u),ce._p=new Promise(function(we,Ee){ce.onload=we,ce.onerror=Ee}),ce.addEventListener("load",function(){Y.loading|=1}),ce.addEventListener("error",function(){Y.loading|=2}),Y.loading|=4,Rg(q,d,v)}q={type:"stylesheet",instance:q,count:1,state:Y},j.set(O,q)}}}function UX(u,d){Hl.X(u,d);var p=jd;if(p&&u){var v=To(p).hoistableScripts,j=Nd(u),O=v.get(j);O||(O=p.querySelector($f(j)),O||(u=m({src:u,async:!0},d),(d=Ui.get(j))&&G2(u,d),O=p.createElement("script"),Dr(O),ps(O,"link",u),p.head.appendChild(O)),O={type:"script",instance:O,count:1,state:null},v.set(j,O))}}function WX(u,d){Hl.M(u,d);var p=jd;if(p&&u){var v=To(p).hoistableScripts,j=Nd(u),O=v.get(j);O||(O=p.querySelector($f(j)),O||(u=m({src:u,async:!0,type:"module"},d),(d=Ui.get(j))&&G2(u,d),O=p.createElement("script"),Dr(O),ps(O,"link",u),p.head.appendChild(O)),O={type:"script",instance:O,count:1,state:null},v.set(j,O))}}function gC(u,d,p,v){var j=(j=ne.current)?Ag(j):null;if(!j)throw Error(r(446));switch(u){case"meta":case"title":return null;case"style":return typeof p.precedence=="string"&&typeof p.href=="string"?(d=Od(p.href),p=To(j).hoistableStyles,v=p.get(d),v||(v={type:"style",instance:null,count:0,state:null},p.set(d,v)),v):{type:"void",instance:null,count:0,state:null};case"link":if(p.rel==="stylesheet"&&typeof p.href=="string"&&typeof p.precedence=="string"){u=Od(p.href);var O=To(j).hoistableStyles,q=O.get(u);if(q||(j=j.ownerDocument||j,q={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},O.set(u,q),(O=j.querySelector(Ff(u)))&&!O._p&&(q.instance=O,q.state.loading=5),Ui.has(u)||(p={rel:"preload",as:"style",href:p.href,crossOrigin:p.crossOrigin,integrity:p.integrity,media:p.media,hrefLang:p.hrefLang,referrerPolicy:p.referrerPolicy},Ui.set(u,p),O||GX(j,u,p,q.state))),d&&v===null)throw Error(r(528,""));return q}if(d&&v!==null)throw Error(r(529,""));return null;case"script":return d=p.async,p=p.src,typeof p=="string"&&d&&typeof d!="function"&&typeof d!="symbol"?(d=Nd(p),p=To(j).hoistableScripts,v=p.get(d),v||(v={type:"script",instance:null,count:0,state:null},p.set(d,v)),v):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,u))}}function Od(u){return'href="'+Ii(u)+'"'}function Ff(u){return'link[rel="stylesheet"]['+u+"]"}function xC(u){return m({},u,{"data-precedence":u.precedence,precedence:null})}function GX(u,d,p,v){u.querySelector('link[rel="preload"][as="style"]['+d+"]")?v.loading=1:(d=u.createElement("link"),v.preload=d,d.addEventListener("load",function(){return v.loading|=1}),d.addEventListener("error",function(){return v.loading|=2}),ps(d,"link",p),Dr(d),u.head.appendChild(d))}function Nd(u){return'[src="'+Ii(u)+'"]'}function $f(u){return"script[async]"+u}function vC(u,d,p){if(d.count++,d.instance===null)switch(d.type){case"style":var v=u.querySelector('style[data-href~="'+Ii(p.href)+'"]');if(v)return d.instance=v,Dr(v),v;var j=m({},p,{"data-href":p.href,"data-precedence":p.precedence,href:null,precedence:null});return v=(u.ownerDocument||u).createElement("style"),Dr(v),ps(v,"style",j),Rg(v,p.precedence,u),d.instance=v;case"stylesheet":j=Od(p.href);var O=u.querySelector(Ff(j));if(O)return d.state.loading|=4,d.instance=O,Dr(O),O;v=xC(p),(j=Ui.get(j))&&W2(v,j),O=(u.ownerDocument||u).createElement("link"),Dr(O);var q=O;return q._p=new Promise(function(Y,ce){q.onload=Y,q.onerror=ce}),ps(O,"link",v),d.state.loading|=4,Rg(O,p.precedence,u),d.instance=O;case"script":return O=Nd(p.src),(j=u.querySelector($f(O)))?(d.instance=j,Dr(j),j):(v=p,(j=Ui.get(O))&&(v=m({},p),G2(v,j)),u=u.ownerDocument||u,j=u.createElement("script"),Dr(j),ps(j,"link",v),u.head.appendChild(j),d.instance=j);case"void":return null;default:throw Error(r(443,d.type))}else d.type==="stylesheet"&&(d.state.loading&4)===0&&(v=d.instance,d.state.loading|=4,Rg(v,p.precedence,u));return d.instance}function Rg(u,d,p){for(var v=p.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),j=v.length?v[v.length-1]:null,O=j,q=0;q title"):null)}function XX(u,d,p){if(p===1||d.itemProp!=null)return!1;switch(u){case"meta":case"title":return!0;case"style":if(typeof d.precedence!="string"||typeof d.href!="string"||d.href==="")break;return!0;case"link":if(typeof d.rel!="string"||typeof d.href!="string"||d.href===""||d.onLoad||d.onError)break;switch(d.rel){case"stylesheet":return u=d.disabled,typeof d.precedence=="string"&&u==null;default:return!0}case"script":if(d.async&&typeof d.async!="function"&&typeof d.async!="symbol"&&!d.onLoad&&!d.onError&&d.src&&typeof d.src=="string")return!0}return!1}function wC(u){return!(u.type==="stylesheet"&&(u.state.loading&3)===0)}function YX(u,d,p,v){if(p.type==="stylesheet"&&(typeof v.media!="string"||matchMedia(v.media).matches!==!1)&&(p.state.loading&4)===0){if(p.instance===null){var j=Od(v.href),O=d.querySelector(Ff(j));if(O){d=O._p,d!==null&&typeof d=="object"&&typeof d.then=="function"&&(u.count++,u=zg.bind(u),d.then(u,u)),p.state.loading|=4,p.instance=O,Dr(O);return}O=d.ownerDocument||d,v=xC(v),(j=Ui.get(j))&&W2(v,j),O=O.createElement("link"),Dr(O);var q=O;q._p=new Promise(function(Y,ce){q.onload=Y,q.onerror=ce}),ps(O,"link",v),p.instance=O}u.stylesheets===null&&(u.stylesheets=new Map),u.stylesheets.set(p,d),(d=p.state.preload)&&(p.state.loading&3)===0&&(u.count++,p=zg.bind(u),d.addEventListener("load",p),d.addEventListener("error",p))}}var X2=0;function KX(u,d){return u.stylesheets&&u.count===0&&Lg(u,u.stylesheets),0X2?50:800)+d);return u.unsuspend=p,function(){u.unsuspend=null,clearTimeout(v),clearTimeout(j)}}:null}function zg(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Lg(this,this.stylesheets);else if(this.unsuspend){var u=this.unsuspend;this.unsuspend=null,u()}}}var Pg=null;function Lg(u,d){u.stylesheets=null,u.unsuspend!==null&&(u.count++,Pg=new Map,d.forEach(ZX,u),Pg=null,zg.call(u))}function ZX(u,d){if(!(d.state.loading&4)){var p=Pg.get(u);if(p)var v=p.get(null);else{p=new Map,Pg.set(u,p);for(var j=u.querySelectorAll("link[data-precedence],style[data-precedence]"),O=0;O"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),sw.exports=sZ(),sw.exports}var aZ=iZ();function hz(t,e){return function(){return t.apply(e,arguments)}}const{toString:lZ}=Object.prototype,{getPrototypeOf:o6}=Object,{iterator:Pv,toStringTag:fz}=Symbol,Lv=(t=>e=>{const n=lZ.call(e);return t[n]||(t[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),za=t=>(t=t.toLowerCase(),e=>Lv(e)===t),Iv=t=>e=>typeof e===t,{isArray:Dh}=Array,ph=Iv("undefined");function B0(t){return t!==null&&!ph(t)&&t.constructor!==null&&!ph(t.constructor)&&si(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const mz=za("ArrayBuffer");function oZ(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&mz(t.buffer),e}const cZ=Iv("string"),si=Iv("function"),pz=Iv("number"),q0=t=>t!==null&&typeof t=="object",uZ=t=>t===!0||t===!1,Kx=t=>{if(Lv(t)!=="object")return!1;const e=o6(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(fz in t)&&!(Pv in t)},dZ=t=>{if(!q0(t)||B0(t))return!1;try{return Object.keys(t).length===0&&Object.getPrototypeOf(t)===Object.prototype}catch{return!1}},hZ=za("Date"),fZ=za("File"),mZ=za("Blob"),pZ=za("FileList"),gZ=t=>q0(t)&&si(t.pipe),xZ=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||si(t.append)&&((e=Lv(t))==="formdata"||e==="object"&&si(t.toString)&&t.toString()==="[object FormData]"))},vZ=za("URLSearchParams"),[yZ,bZ,wZ,SZ]=["ReadableStream","Request","Response","Headers"].map(za),kZ=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function F0(t,e,{allOwnKeys:n=!1}={}){if(t===null||typeof t>"u")return;let r,s;if(typeof t!="object"&&(t=[t]),Dh(t))for(r=0,s=t.length;r0;)if(s=n[r],e===s.toLowerCase())return s;return null}const mu=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,xz=t=>!ph(t)&&t!==mu;function I3(){const{caseless:t,skipUndefined:e}=xz(this)&&this||{},n={},r=(s,i)=>{const a=t&&gz(n,i)||i;Kx(n[a])&&Kx(s)?n[a]=I3(n[a],s):Kx(s)?n[a]=I3({},s):Dh(s)?n[a]=s.slice():(!e||!ph(s))&&(n[a]=s)};for(let s=0,i=arguments.length;s(F0(e,(s,i)=>{n&&si(s)?t[i]=hz(s,n):t[i]=s},{allOwnKeys:r}),t),OZ=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),NZ=(t,e,n,r)=>{t.prototype=Object.create(e.prototype,r),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),n&&Object.assign(t.prototype,n)},CZ=(t,e,n,r)=>{let s,i,a;const o={};if(e=e||{},t==null)return e;do{for(s=Object.getOwnPropertyNames(t),i=s.length;i-- >0;)a=s[i],(!r||r(a,t,e))&&!o[a]&&(e[a]=t[a],o[a]=!0);t=n!==!1&&o6(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},TZ=(t,e,n)=>{t=String(t),(n===void 0||n>t.length)&&(n=t.length),n-=e.length;const r=t.indexOf(e,n);return r!==-1&&r===n},EZ=t=>{if(!t)return null;if(Dh(t))return t;let e=t.length;if(!pz(e))return null;const n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},_Z=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&o6(Uint8Array)),MZ=(t,e)=>{const r=(t&&t[Pv]).call(t);let s;for(;(s=r.next())&&!s.done;){const i=s.value;e.call(t,i[0],i[1])}},AZ=(t,e)=>{let n;const r=[];for(;(n=t.exec(e))!==null;)r.push(n);return r},RZ=za("HTMLFormElement"),DZ=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),WC=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),zZ=za("RegExp"),vz=(t,e)=>{const n=Object.getOwnPropertyDescriptors(t),r={};F0(n,(s,i)=>{let a;(a=e(s,i,t))!==!1&&(r[i]=a||s)}),Object.defineProperties(t,r)},PZ=t=>{vz(t,(e,n)=>{if(si(t)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=t[n];if(si(r)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},LZ=(t,e)=>{const n={},r=s=>{s.forEach(i=>{n[i]=!0})};return Dh(t)?r(t):r(String(t).split(e)),n},IZ=()=>{},BZ=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function qZ(t){return!!(t&&si(t.append)&&t[fz]==="FormData"&&t[Pv])}const FZ=t=>{const e=new Array(10),n=(r,s)=>{if(q0(r)){if(e.indexOf(r)>=0)return;if(B0(r))return r;if(!("toJSON"in r)){e[s]=r;const i=Dh(r)?[]:{};return F0(r,(a,o)=>{const c=n(a,s+1);!ph(c)&&(i[o]=c)}),e[s]=void 0,i}}return r};return n(t,0)},$Z=za("AsyncFunction"),QZ=t=>t&&(q0(t)||si(t))&&si(t.then)&&si(t.catch),yz=((t,e)=>t?setImmediate:e?((n,r)=>(mu.addEventListener("message",({source:s,data:i})=>{s===mu&&i===n&&r.length&&r.shift()()},!1),s=>{r.push(s),mu.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",si(mu.postMessage)),HZ=typeof queueMicrotask<"u"?queueMicrotask.bind(mu):typeof process<"u"&&process.nextTick||yz,VZ=t=>t!=null&&si(t[Pv]),je={isArray:Dh,isArrayBuffer:mz,isBuffer:B0,isFormData:xZ,isArrayBufferView:oZ,isString:cZ,isNumber:pz,isBoolean:uZ,isObject:q0,isPlainObject:Kx,isEmptyObject:dZ,isReadableStream:yZ,isRequest:bZ,isResponse:wZ,isHeaders:SZ,isUndefined:ph,isDate:hZ,isFile:fZ,isBlob:mZ,isRegExp:zZ,isFunction:si,isStream:gZ,isURLSearchParams:vZ,isTypedArray:_Z,isFileList:pZ,forEach:F0,merge:I3,extend:jZ,trim:kZ,stripBOM:OZ,inherits:NZ,toFlatObject:CZ,kindOf:Lv,kindOfTest:za,endsWith:TZ,toArray:EZ,forEachEntry:MZ,matchAll:AZ,isHTMLForm:RZ,hasOwnProperty:WC,hasOwnProp:WC,reduceDescriptors:vz,freezeMethods:PZ,toObjectSet:LZ,toCamelCase:DZ,noop:IZ,toFiniteNumber:BZ,findKey:gz,global:mu,isContextDefined:xz,isSpecCompliantForm:qZ,toJSONObject:FZ,isAsyncFn:$Z,isThenable:QZ,setImmediate:yz,asap:HZ,isIterable:VZ};function Ht(t,e,n,r,s){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),n&&(this.config=n),r&&(this.request=r),s&&(this.response=s,this.status=s.status?s.status:null)}je.inherits(Ht,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:je.toJSONObject(this.config),code:this.code,status:this.status}}});const bz=Ht.prototype,wz={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{wz[t]={value:t}});Object.defineProperties(Ht,wz);Object.defineProperty(bz,"isAxiosError",{value:!0});Ht.from=(t,e,n,r,s,i)=>{const a=Object.create(bz);je.toFlatObject(t,a,function(f){return f!==Error.prototype},h=>h!=="isAxiosError");const o=t&&t.message?t.message:"Error",c=e==null&&t?t.code:e;return Ht.call(a,o,c,n,r,s),t&&a.cause==null&&Object.defineProperty(a,"cause",{value:t,configurable:!0}),a.name=t&&t.name||"Error",i&&Object.assign(a,i),a};const UZ=null;function B3(t){return je.isPlainObject(t)||je.isArray(t)}function Sz(t){return je.endsWith(t,"[]")?t.slice(0,-2):t}function GC(t,e,n){return t?t.concat(e).map(function(s,i){return s=Sz(s),!n&&i?"["+s+"]":s}).join(n?".":""):e}function WZ(t){return je.isArray(t)&&!t.some(B3)}const GZ=je.toFlatObject(je,{},null,function(e){return/^is[A-Z]/.test(e)});function Bv(t,e,n){if(!je.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,n=je.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(w,S){return!je.isUndefined(S[w])});const r=n.metaTokens,s=n.visitor||f,i=n.dots,a=n.indexes,c=(n.Blob||typeof Blob<"u"&&Blob)&&je.isSpecCompliantForm(e);if(!je.isFunction(s))throw new TypeError("visitor must be a function");function h(y){if(y===null)return"";if(je.isDate(y))return y.toISOString();if(je.isBoolean(y))return y.toString();if(!c&&je.isBlob(y))throw new Ht("Blob is not supported. Use a Buffer instead.");return je.isArrayBuffer(y)||je.isTypedArray(y)?c&&typeof Blob=="function"?new Blob([y]):Buffer.from(y):y}function f(y,w,S){let k=y;if(y&&!S&&typeof y=="object"){if(je.endsWith(w,"{}"))w=r?w:w.slice(0,-2),y=JSON.stringify(y);else if(je.isArray(y)&&WZ(y)||(je.isFileList(y)||je.endsWith(w,"[]"))&&(k=je.toArray(y)))return w=Sz(w),k.forEach(function(C,T){!(je.isUndefined(C)||C===null)&&e.append(a===!0?GC([w],T,i):a===null?w:w+"[]",h(C))}),!1}return B3(y)?!0:(e.append(GC(S,w,i),h(y)),!1)}const m=[],g=Object.assign(GZ,{defaultVisitor:f,convertValue:h,isVisitable:B3});function x(y,w){if(!je.isUndefined(y)){if(m.indexOf(y)!==-1)throw Error("Circular reference detected in "+w.join("."));m.push(y),je.forEach(y,function(k,N){(!(je.isUndefined(k)||k===null)&&s.call(e,k,je.isString(N)?N.trim():N,w,g))===!0&&x(k,w?w.concat(N):[N])}),m.pop()}}if(!je.isObject(t))throw new TypeError("data must be an object");return x(t),e}function XC(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(r){return e[r]})}function c6(t,e){this._pairs=[],t&&Bv(t,this,e)}const kz=c6.prototype;kz.append=function(e,n){this._pairs.push([e,n])};kz.toString=function(e){const n=e?function(r){return e.call(this,r,XC)}:XC;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function XZ(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function jz(t,e,n){if(!e)return t;const r=n&&n.encode||XZ;je.isFunction(n)&&(n={serialize:n});const s=n&&n.serialize;let i;if(s?i=s(e,n):i=je.isURLSearchParams(e)?e.toString():new c6(e,n).toString(r),i){const a=t.indexOf("#");a!==-1&&(t=t.slice(0,a)),t+=(t.indexOf("?")===-1?"?":"&")+i}return t}class YC{constructor(){this.handlers=[]}use(e,n,r){return this.handlers.push({fulfilled:e,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){je.forEach(this.handlers,function(r){r!==null&&e(r)})}}const Oz={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},YZ=typeof URLSearchParams<"u"?URLSearchParams:c6,KZ=typeof FormData<"u"?FormData:null,ZZ=typeof Blob<"u"?Blob:null,JZ={isBrowser:!0,classes:{URLSearchParams:YZ,FormData:KZ,Blob:ZZ},protocols:["http","https","file","blob","url","data"]},u6=typeof window<"u"&&typeof document<"u",q3=typeof navigator=="object"&&navigator||void 0,eJ=u6&&(!q3||["ReactNative","NativeScript","NS"].indexOf(q3.product)<0),tJ=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",nJ=u6&&window.location.href||"http://localhost",rJ=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:u6,hasStandardBrowserEnv:eJ,hasStandardBrowserWebWorkerEnv:tJ,navigator:q3,origin:nJ},Symbol.toStringTag,{value:"Module"})),Ns={...rJ,...JZ};function sJ(t,e){return Bv(t,new Ns.classes.URLSearchParams,{visitor:function(n,r,s,i){return Ns.isNode&&je.isBuffer(n)?(this.append(r,n.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...e})}function iJ(t){return je.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function aJ(t){const e={},n=Object.keys(t);let r;const s=n.length;let i;for(r=0;r=n.length;return a=!a&&je.isArray(s)?s.length:a,c?(je.hasOwnProp(s,a)?s[a]=[s[a],r]:s[a]=r,!o):((!s[a]||!je.isObject(s[a]))&&(s[a]=[]),e(n,r,s[a],i)&&je.isArray(s[a])&&(s[a]=aJ(s[a])),!o)}if(je.isFormData(t)&&je.isFunction(t.entries)){const n={};return je.forEachEntry(t,(r,s)=>{e(iJ(r),s,n,0)}),n}return null}function lJ(t,e,n){if(je.isString(t))try{return(e||JSON.parse)(t),je.trim(t)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(t)}const $0={transitional:Oz,adapter:["xhr","http","fetch"],transformRequest:[function(e,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,i=je.isObject(e);if(i&&je.isHTMLForm(e)&&(e=new FormData(e)),je.isFormData(e))return s?JSON.stringify(Nz(e)):e;if(je.isArrayBuffer(e)||je.isBuffer(e)||je.isStream(e)||je.isFile(e)||je.isBlob(e)||je.isReadableStream(e))return e;if(je.isArrayBufferView(e))return e.buffer;if(je.isURLSearchParams(e))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let o;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return sJ(e,this.formSerializer).toString();if((o=je.isFileList(e))||r.indexOf("multipart/form-data")>-1){const c=this.env&&this.env.FormData;return Bv(o?{"files[]":e}:e,c&&new c,this.formSerializer)}}return i||s?(n.setContentType("application/json",!1),lJ(e)):e}],transformResponse:[function(e){const n=this.transitional||$0.transitional,r=n&&n.forcedJSONParsing,s=this.responseType==="json";if(je.isResponse(e)||je.isReadableStream(e))return e;if(e&&je.isString(e)&&(r&&!this.responseType||s)){const a=!(n&&n.silentJSONParsing)&&s;try{return JSON.parse(e,this.parseReviver)}catch(o){if(a)throw o.name==="SyntaxError"?Ht.from(o,Ht.ERR_BAD_RESPONSE,this,null,this.response):o}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Ns.classes.FormData,Blob:Ns.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};je.forEach(["delete","get","head","post","put","patch"],t=>{$0.headers[t]={}});const oJ=je.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),cJ=t=>{const e={};let n,r,s;return t&&t.split(` +`).forEach(function(a){s=a.indexOf(":"),n=a.substring(0,s).trim().toLowerCase(),r=a.substring(s+1).trim(),!(!n||e[n]&&oJ[n])&&(n==="set-cookie"?e[n]?e[n].push(r):e[n]=[r]:e[n]=e[n]?e[n]+", "+r:r)}),e},KC=Symbol("internals");function Xf(t){return t&&String(t).trim().toLowerCase()}function Zx(t){return t===!1||t==null?t:je.isArray(t)?t.map(Zx):String(t)}function uJ(t){const e=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(t);)e[r[1]]=r[2];return e}const dJ=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function lw(t,e,n,r,s){if(je.isFunction(r))return r.call(this,e,n);if(s&&(e=n),!!je.isString(e)){if(je.isString(r))return e.indexOf(r)!==-1;if(je.isRegExp(r))return r.test(e)}}function hJ(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,n,r)=>n.toUpperCase()+r)}function fJ(t,e){const n=je.toCamelCase(" "+e);["get","set","has"].forEach(r=>{Object.defineProperty(t,r+n,{value:function(s,i,a){return this[r].call(this,e,s,i,a)},configurable:!0})})}let ii=class{constructor(e){e&&this.set(e)}set(e,n,r){const s=this;function i(o,c,h){const f=Xf(c);if(!f)throw new Error("header name must be a non-empty string");const m=je.findKey(s,f);(!m||s[m]===void 0||h===!0||h===void 0&&s[m]!==!1)&&(s[m||c]=Zx(o))}const a=(o,c)=>je.forEach(o,(h,f)=>i(h,f,c));if(je.isPlainObject(e)||e instanceof this.constructor)a(e,n);else if(je.isString(e)&&(e=e.trim())&&!dJ(e))a(cJ(e),n);else if(je.isObject(e)&&je.isIterable(e)){let o={},c,h;for(const f of e){if(!je.isArray(f))throw TypeError("Object iterator must return a key-value pair");o[h=f[0]]=(c=o[h])?je.isArray(c)?[...c,f[1]]:[c,f[1]]:f[1]}a(o,n)}else e!=null&&i(n,e,r);return this}get(e,n){if(e=Xf(e),e){const r=je.findKey(this,e);if(r){const s=this[r];if(!n)return s;if(n===!0)return uJ(s);if(je.isFunction(n))return n.call(this,s,r);if(je.isRegExp(n))return n.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,n){if(e=Xf(e),e){const r=je.findKey(this,e);return!!(r&&this[r]!==void 0&&(!n||lw(this,this[r],r,n)))}return!1}delete(e,n){const r=this;let s=!1;function i(a){if(a=Xf(a),a){const o=je.findKey(r,a);o&&(!n||lw(r,r[o],o,n))&&(delete r[o],s=!0)}}return je.isArray(e)?e.forEach(i):i(e),s}clear(e){const n=Object.keys(this);let r=n.length,s=!1;for(;r--;){const i=n[r];(!e||lw(this,this[i],i,e,!0))&&(delete this[i],s=!0)}return s}normalize(e){const n=this,r={};return je.forEach(this,(s,i)=>{const a=je.findKey(r,i);if(a){n[a]=Zx(s),delete n[i];return}const o=e?hJ(i):String(i).trim();o!==i&&delete n[i],n[o]=Zx(s),r[o]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const n=Object.create(null);return je.forEach(this,(r,s)=>{r!=null&&r!==!1&&(n[s]=e&&je.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,n])=>e+": "+n).join(` +`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...n){const r=new this(e);return n.forEach(s=>r.set(s)),r}static accessor(e){const r=(this[KC]=this[KC]={accessors:{}}).accessors,s=this.prototype;function i(a){const o=Xf(a);r[o]||(fJ(s,a),r[o]=!0)}return je.isArray(e)?e.forEach(i):i(e),this}};ii.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);je.reduceDescriptors(ii.prototype,({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(r){this[n]=r}}});je.freezeMethods(ii);function ow(t,e){const n=this||$0,r=e||n,s=ii.from(r.headers);let i=r.data;return je.forEach(t,function(o){i=o.call(n,i,s.normalize(),e?e.status:void 0)}),s.normalize(),i}function Cz(t){return!!(t&&t.__CANCEL__)}function zh(t,e,n){Ht.call(this,t??"canceled",Ht.ERR_CANCELED,e,n),this.name="CanceledError"}je.inherits(zh,Ht,{__CANCEL__:!0});function Tz(t,e,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?t(n):e(new Ht("Request failed with status code "+n.status,[Ht.ERR_BAD_REQUEST,Ht.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function mJ(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function pJ(t,e){t=t||10;const n=new Array(t),r=new Array(t);let s=0,i=0,a;return e=e!==void 0?e:1e3,function(c){const h=Date.now(),f=r[i];a||(a=h),n[s]=c,r[s]=h;let m=i,g=0;for(;m!==s;)g+=n[m++],m=m%t;if(s=(s+1)%t,s===i&&(i=(i+1)%t),h-a{n=f,s=null,i&&(clearTimeout(i),i=null),t(...h)};return[(...h)=>{const f=Date.now(),m=f-n;m>=r?a(h,f):(s=h,i||(i=setTimeout(()=>{i=null,a(s)},r-m)))},()=>s&&a(s)]}const T1=(t,e,n=3)=>{let r=0;const s=pJ(50,250);return gJ(i=>{const a=i.loaded,o=i.lengthComputable?i.total:void 0,c=a-r,h=s(c),f=a<=o;r=a;const m={loaded:a,total:o,progress:o?a/o:void 0,bytes:c,rate:h||void 0,estimated:h&&o&&f?(o-a)/h:void 0,event:i,lengthComputable:o!=null,[e?"download":"upload"]:!0};t(m)},n)},ZC=(t,e)=>{const n=t!=null;return[r=>e[0]({lengthComputable:n,total:t,loaded:r}),e[1]]},JC=t=>(...e)=>je.asap(()=>t(...e)),xJ=Ns.hasStandardBrowserEnv?((t,e)=>n=>(n=new URL(n,Ns.origin),t.protocol===n.protocol&&t.host===n.host&&(e||t.port===n.port)))(new URL(Ns.origin),Ns.navigator&&/(msie|trident)/i.test(Ns.navigator.userAgent)):()=>!0,vJ=Ns.hasStandardBrowserEnv?{write(t,e,n,r,s,i,a){if(typeof document>"u")return;const o=[`${t}=${encodeURIComponent(e)}`];je.isNumber(n)&&o.push(`expires=${new Date(n).toUTCString()}`),je.isString(r)&&o.push(`path=${r}`),je.isString(s)&&o.push(`domain=${s}`),i===!0&&o.push("secure"),je.isString(a)&&o.push(`SameSite=${a}`),document.cookie=o.join("; ")},read(t){if(typeof document>"u")return null;const e=document.cookie.match(new RegExp("(?:^|; )"+t+"=([^;]*)"));return e?decodeURIComponent(e[1]):null},remove(t){this.write(t,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function yJ(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function bJ(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function Ez(t,e,n){let r=!yJ(e);return t&&(r||n==!1)?bJ(t,e):e}const e9=t=>t instanceof ii?{...t}:t;function Eu(t,e){e=e||{};const n={};function r(h,f,m,g){return je.isPlainObject(h)&&je.isPlainObject(f)?je.merge.call({caseless:g},h,f):je.isPlainObject(f)?je.merge({},f):je.isArray(f)?f.slice():f}function s(h,f,m,g){if(je.isUndefined(f)){if(!je.isUndefined(h))return r(void 0,h,m,g)}else return r(h,f,m,g)}function i(h,f){if(!je.isUndefined(f))return r(void 0,f)}function a(h,f){if(je.isUndefined(f)){if(!je.isUndefined(h))return r(void 0,h)}else return r(void 0,f)}function o(h,f,m){if(m in e)return r(h,f);if(m in t)return r(void 0,h)}const c={url:i,method:i,data:i,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:o,headers:(h,f,m)=>s(e9(h),e9(f),m,!0)};return je.forEach(Object.keys({...t,...e}),function(f){const m=c[f]||s,g=m(t[f],e[f],f);je.isUndefined(g)&&m!==o||(n[f]=g)}),n}const _z=t=>{const e=Eu({},t);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:i,headers:a,auth:o}=e;if(e.headers=a=ii.from(a),e.url=jz(Ez(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),o&&a.set("Authorization","Basic "+btoa((o.username||"")+":"+(o.password?unescape(encodeURIComponent(o.password)):""))),je.isFormData(n)){if(Ns.hasStandardBrowserEnv||Ns.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if(je.isFunction(n.getHeaders)){const c=n.getHeaders(),h=["content-type","content-length"];Object.entries(c).forEach(([f,m])=>{h.includes(f.toLowerCase())&&a.set(f,m)})}}if(Ns.hasStandardBrowserEnv&&(r&&je.isFunction(r)&&(r=r(e)),r||r!==!1&&xJ(e.url))){const c=s&&i&&vJ.read(i);c&&a.set(s,c)}return e},wJ=typeof XMLHttpRequest<"u",SJ=wJ&&function(t){return new Promise(function(n,r){const s=_z(t);let i=s.data;const a=ii.from(s.headers).normalize();let{responseType:o,onUploadProgress:c,onDownloadProgress:h}=s,f,m,g,x,y;function w(){x&&x(),y&&y(),s.cancelToken&&s.cancelToken.unsubscribe(f),s.signal&&s.signal.removeEventListener("abort",f)}let S=new XMLHttpRequest;S.open(s.method.toUpperCase(),s.url,!0),S.timeout=s.timeout;function k(){if(!S)return;const C=ii.from("getAllResponseHeaders"in S&&S.getAllResponseHeaders()),_={data:!o||o==="text"||o==="json"?S.responseText:S.response,status:S.status,statusText:S.statusText,headers:C,config:t,request:S};Tz(function(M){n(M),w()},function(M){r(M),w()},_),S=null}"onloadend"in S?S.onloadend=k:S.onreadystatechange=function(){!S||S.readyState!==4||S.status===0&&!(S.responseURL&&S.responseURL.indexOf("file:")===0)||setTimeout(k)},S.onabort=function(){S&&(r(new Ht("Request aborted",Ht.ECONNABORTED,t,S)),S=null)},S.onerror=function(T){const _=T&&T.message?T.message:"Network Error",E=new Ht(_,Ht.ERR_NETWORK,t,S);E.event=T||null,r(E),S=null},S.ontimeout=function(){let T=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const _=s.transitional||Oz;s.timeoutErrorMessage&&(T=s.timeoutErrorMessage),r(new Ht(T,_.clarifyTimeoutError?Ht.ETIMEDOUT:Ht.ECONNABORTED,t,S)),S=null},i===void 0&&a.setContentType(null),"setRequestHeader"in S&&je.forEach(a.toJSON(),function(T,_){S.setRequestHeader(_,T)}),je.isUndefined(s.withCredentials)||(S.withCredentials=!!s.withCredentials),o&&o!=="json"&&(S.responseType=s.responseType),h&&([g,y]=T1(h,!0),S.addEventListener("progress",g)),c&&S.upload&&([m,x]=T1(c),S.upload.addEventListener("progress",m),S.upload.addEventListener("loadend",x)),(s.cancelToken||s.signal)&&(f=C=>{S&&(r(!C||C.type?new zh(null,t,S):C),S.abort(),S=null)},s.cancelToken&&s.cancelToken.subscribe(f),s.signal&&(s.signal.aborted?f():s.signal.addEventListener("abort",f)));const N=mJ(s.url);if(N&&Ns.protocols.indexOf(N)===-1){r(new Ht("Unsupported protocol "+N+":",Ht.ERR_BAD_REQUEST,t));return}S.send(i||null)})},kJ=(t,e)=>{const{length:n}=t=t?t.filter(Boolean):[];if(e||n){let r=new AbortController,s;const i=function(h){if(!s){s=!0,o();const f=h instanceof Error?h:this.reason;r.abort(f instanceof Ht?f:new zh(f instanceof Error?f.message:f))}};let a=e&&setTimeout(()=>{a=null,i(new Ht(`timeout ${e} of ms exceeded`,Ht.ETIMEDOUT))},e);const o=()=>{t&&(a&&clearTimeout(a),a=null,t.forEach(h=>{h.unsubscribe?h.unsubscribe(i):h.removeEventListener("abort",i)}),t=null)};t.forEach(h=>h.addEventListener("abort",i));const{signal:c}=r;return c.unsubscribe=()=>je.asap(o),c}},jJ=function*(t,e){let n=t.byteLength;if(n{const s=OJ(t,e);let i=0,a,o=c=>{a||(a=!0,r&&r(c))};return new ReadableStream({async pull(c){try{const{done:h,value:f}=await s.next();if(h){o(),c.close();return}let m=f.byteLength;if(n){let g=i+=m;n(g)}c.enqueue(new Uint8Array(f))}catch(h){throw o(h),h}},cancel(c){return o(c),s.return()}},{highWaterMark:2})},n9=64*1024,{isFunction:Gg}=je,CJ=(({Request:t,Response:e})=>({Request:t,Response:e}))(je.global),{ReadableStream:r9,TextEncoder:s9}=je.global,i9=(t,...e)=>{try{return!!t(...e)}catch{return!1}},TJ=t=>{t=je.merge.call({skipUndefined:!0},CJ,t);const{fetch:e,Request:n,Response:r}=t,s=e?Gg(e):typeof fetch=="function",i=Gg(n),a=Gg(r);if(!s)return!1;const o=s&&Gg(r9),c=s&&(typeof s9=="function"?(y=>w=>y.encode(w))(new s9):async y=>new Uint8Array(await new n(y).arrayBuffer())),h=i&&o&&i9(()=>{let y=!1;const w=new n(Ns.origin,{body:new r9,method:"POST",get duplex(){return y=!0,"half"}}).headers.has("Content-Type");return y&&!w}),f=a&&o&&i9(()=>je.isReadableStream(new r("").body)),m={stream:f&&(y=>y.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(y=>{!m[y]&&(m[y]=(w,S)=>{let k=w&&w[y];if(k)return k.call(w);throw new Ht(`Response type '${y}' is not supported`,Ht.ERR_NOT_SUPPORT,S)})});const g=async y=>{if(y==null)return 0;if(je.isBlob(y))return y.size;if(je.isSpecCompliantForm(y))return(await new n(Ns.origin,{method:"POST",body:y}).arrayBuffer()).byteLength;if(je.isArrayBufferView(y)||je.isArrayBuffer(y))return y.byteLength;if(je.isURLSearchParams(y)&&(y=y+""),je.isString(y))return(await c(y)).byteLength},x=async(y,w)=>{const S=je.toFiniteNumber(y.getContentLength());return S??g(w)};return async y=>{let{url:w,method:S,data:k,signal:N,cancelToken:C,timeout:T,onDownloadProgress:_,onUploadProgress:E,responseType:M,headers:L,withCredentials:P="same-origin",fetchOptions:I}=_z(y),Q=e||fetch;M=M?(M+"").toLowerCase():"text";let U=kJ([N,C&&C.toAbortSignal()],T),ee=null;const z=U&&U.unsubscribe&&(()=>{U.unsubscribe()});let H;try{if(E&&h&&S!=="get"&&S!=="head"&&(H=await x(L,k))!==0){let se=new n(w,{method:"POST",body:k,duplex:"half"}),W;if(je.isFormData(k)&&(W=se.headers.get("content-type"))&&L.setContentType(W),se.body){const[F,V]=ZC(H,T1(JC(E)));k=t9(se.body,n9,F,V)}}je.isString(P)||(P=P?"include":"omit");const B=i&&"credentials"in n.prototype,X={...I,signal:U,method:S.toUpperCase(),headers:L.normalize().toJSON(),body:k,duplex:"half",credentials:B?P:void 0};ee=i&&new n(w,X);let J=await(i?Q(ee,I):Q(w,X));const G=f&&(M==="stream"||M==="response");if(f&&(_||G&&z)){const se={};["status","statusText","headers"].forEach(te=>{se[te]=J[te]});const W=je.toFiniteNumber(J.headers.get("content-length")),[F,V]=_&&ZC(W,T1(JC(_),!0))||[];J=new r(t9(J.body,n9,F,()=>{V&&V(),z&&z()}),se)}M=M||"text";let R=await m[je.findKey(m,M)||"text"](J,y);return!G&&z&&z(),await new Promise((se,W)=>{Tz(se,W,{data:R,headers:ii.from(J.headers),status:J.status,statusText:J.statusText,config:y,request:ee})})}catch(B){throw z&&z(),B&&B.name==="TypeError"&&/Load failed|fetch/i.test(B.message)?Object.assign(new Ht("Network Error",Ht.ERR_NETWORK,y,ee),{cause:B.cause||B}):Ht.from(B,B&&B.code,y,ee)}}},EJ=new Map,Mz=t=>{let e=t&&t.env||{};const{fetch:n,Request:r,Response:s}=e,i=[r,s,n];let a=i.length,o=a,c,h,f=EJ;for(;o--;)c=i[o],h=f.get(c),h===void 0&&f.set(c,h=o?new Map:TJ(e)),f=h;return h};Mz();const d6={http:UZ,xhr:SJ,fetch:{get:Mz}};je.forEach(d6,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const a9=t=>`- ${t}`,_J=t=>je.isFunction(t)||t===null||t===!1;function MJ(t,e){t=je.isArray(t)?t:[t];const{length:n}=t;let r,s;const i={};for(let a=0;a`adapter ${c} `+(h===!1?"is not supported by the environment":"is not available in the build"));let o=n?a.length>1?`since : +`+a.map(a9).join(` +`):" "+a9(a[0]):"as no adapter specified";throw new Ht("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return s}const Az={getAdapter:MJ,adapters:d6};function cw(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new zh(null,t)}function l9(t){return cw(t),t.headers=ii.from(t.headers),t.data=ow.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),Az.getAdapter(t.adapter||$0.adapter,t)(t).then(function(r){return cw(t),r.data=ow.call(t,t.transformResponse,r),r.headers=ii.from(r.headers),r},function(r){return Cz(r)||(cw(t),r&&r.response&&(r.response.data=ow.call(t,t.transformResponse,r.response),r.response.headers=ii.from(r.response.headers))),Promise.reject(r)})}const Rz="1.13.2",qv={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{qv[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}});const o9={};qv.transitional=function(e,n,r){function s(i,a){return"[Axios v"+Rz+"] Transitional option '"+i+"'"+a+(r?". "+r:"")}return(i,a,o)=>{if(e===!1)throw new Ht(s(a," has been removed"+(n?" in "+n:"")),Ht.ERR_DEPRECATED);return n&&!o9[a]&&(o9[a]=!0,console.warn(s(a," has been deprecated since v"+n+" and will be removed in the near future"))),e?e(i,a,o):!0}};qv.spelling=function(e){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};function AJ(t,e,n){if(typeof t!="object")throw new Ht("options must be an object",Ht.ERR_BAD_OPTION_VALUE);const r=Object.keys(t);let s=r.length;for(;s-- >0;){const i=r[s],a=e[i];if(a){const o=t[i],c=o===void 0||a(o,i,t);if(c!==!0)throw new Ht("option "+i+" must be "+c,Ht.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new Ht("Unknown option "+i,Ht.ERR_BAD_OPTION)}}const Jx={assertOptions:AJ,validators:qv},Ha=Jx.validators;let ku=class{constructor(e){this.defaults=e||{},this.interceptors={request:new YC,response:new YC}}async request(e,n){try{return await this._request(e,n)}catch(r){if(r instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const i=s.stack?s.stack.replace(/^.+\n/,""):"";try{r.stack?i&&!String(r.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(r.stack+=` +`+i):r.stack=i}catch{}}throw r}}_request(e,n){typeof e=="string"?(n=n||{},n.url=e):n=e||{},n=Eu(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:i}=n;r!==void 0&&Jx.assertOptions(r,{silentJSONParsing:Ha.transitional(Ha.boolean),forcedJSONParsing:Ha.transitional(Ha.boolean),clarifyTimeoutError:Ha.transitional(Ha.boolean)},!1),s!=null&&(je.isFunction(s)?n.paramsSerializer={serialize:s}:Jx.assertOptions(s,{encode:Ha.function,serialize:Ha.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Jx.assertOptions(n,{baseUrl:Ha.spelling("baseURL"),withXsrfToken:Ha.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let a=i&&je.merge(i.common,i[n.method]);i&&je.forEach(["delete","get","head","post","put","patch","common"],y=>{delete i[y]}),n.headers=ii.concat(a,i);const o=[];let c=!0;this.interceptors.request.forEach(function(w){typeof w.runWhen=="function"&&w.runWhen(n)===!1||(c=c&&w.synchronous,o.unshift(w.fulfilled,w.rejected))});const h=[];this.interceptors.response.forEach(function(w){h.push(w.fulfilled,w.rejected)});let f,m=0,g;if(!c){const y=[l9.bind(this),void 0];for(y.unshift(...o),y.push(...h),g=y.length,f=Promise.resolve(n);m{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](s);r._listeners=null}),this.promise.then=s=>{let i;const a=new Promise(o=>{r.subscribe(o),i=o}).then(s);return a.cancel=function(){r.unsubscribe(i)},a},e(function(i,a,o){r.reason||(r.reason=new zh(i,a,o),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const n=this._listeners.indexOf(e);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const e=new AbortController,n=r=>{e.abort(r)};return this.subscribe(n),e.signal.unsubscribe=()=>this.unsubscribe(n),e.signal}static source(){let e;return{token:new Dz(function(s){e=s}),cancel:e}}};function DJ(t){return function(n){return t.apply(null,n)}}function zJ(t){return je.isObject(t)&&t.isAxiosError===!0}const F3={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(F3).forEach(([t,e])=>{F3[e]=t});function zz(t){const e=new ku(t),n=hz(ku.prototype.request,e);return je.extend(n,ku.prototype,e,{allOwnKeys:!0}),je.extend(n,e,null,{allOwnKeys:!0}),n.create=function(s){return zz(Eu(t,s))},n}const kr=zz($0);kr.Axios=ku;kr.CanceledError=zh;kr.CancelToken=RJ;kr.isCancel=Cz;kr.VERSION=Rz;kr.toFormData=Bv;kr.AxiosError=Ht;kr.Cancel=kr.CanceledError;kr.all=function(e){return Promise.all(e)};kr.spread=DJ;kr.isAxiosError=zJ;kr.mergeConfig=Eu;kr.AxiosHeaders=ii;kr.formToJSON=t=>Nz(je.isHTMLForm(t)?new FormData(t):t);kr.getAdapter=Az.getAdapter;kr.HttpStatusCode=F3;kr.default=kr;const{Axios:YTe,AxiosError:KTe,CanceledError:ZTe,isCancel:JTe,CancelToken:eEe,VERSION:tEe,all:nEe,Cancel:rEe,isAxiosError:sEe,spread:iEe,toFormData:aEe,AxiosHeaders:lEe,HttpStatusCode:oEe,formToJSON:cEe,getAdapter:uEe,mergeConfig:dEe}=kr,PJ=(t,e)=>{const n=new Array(t.length+e.length);for(let r=0;r({classGroupId:t,validator:e}),Pz=(t=new Map,e=null,n)=>({nextPart:t,validators:e,classGroupId:n}),E1="-",c9=[],IJ="arbitrary..",BJ=t=>{const e=FJ(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:a=>{if(a.startsWith("[")&&a.endsWith("]"))return qJ(a);const o=a.split(E1),c=o[0]===""&&o.length>1?1:0;return Lz(o,c,e)},getConflictingClassGroupIds:(a,o)=>{if(o){const c=r[a],h=n[a];return c?h?PJ(h,c):c:h||c9}return n[a]||c9}}},Lz=(t,e,n)=>{if(t.length-e===0)return n.classGroupId;const s=t[e],i=n.nextPart.get(s);if(i){const h=Lz(t,e+1,i);if(h)return h}const a=n.validators;if(a===null)return;const o=e===0?t.join(E1):t.slice(e).join(E1),c=a.length;for(let h=0;ht.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=t.slice(1,-1),n=e.indexOf(":"),r=e.slice(0,n);return r?IJ+r:void 0})(),FJ=t=>{const{theme:e,classGroups:n}=t;return $J(n,e)},$J=(t,e)=>{const n=Pz();for(const r in t){const s=t[r];h6(s,n,r,e)}return n},h6=(t,e,n,r)=>{const s=t.length;for(let i=0;i{if(typeof t=="string"){HJ(t,e,n);return}if(typeof t=="function"){VJ(t,e,n,r);return}UJ(t,e,n,r)},HJ=(t,e,n)=>{const r=t===""?e:Iz(e,t);r.classGroupId=n},VJ=(t,e,n,r)=>{if(WJ(t)){h6(t(r),e,n,r);return}e.validators===null&&(e.validators=[]),e.validators.push(LJ(n,t))},UJ=(t,e,n,r)=>{const s=Object.entries(t),i=s.length;for(let a=0;a{let n=t;const r=e.split(E1),s=r.length;for(let i=0;i"isThemeGetter"in t&&t.isThemeGetter===!0,GJ=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=Object.create(null),r=Object.create(null);const s=(i,a)=>{n[i]=a,e++,e>t&&(e=0,r=n,n=Object.create(null))};return{get(i){let a=n[i];if(a!==void 0)return a;if((a=r[i])!==void 0)return s(i,a),a},set(i,a){i in n?n[i]=a:s(i,a)}}},$3="!",u9=":",XJ=[],d9=(t,e,n,r,s)=>({modifiers:t,hasImportantModifier:e,baseClassName:n,maybePostfixModifierPosition:r,isExternal:s}),YJ=t=>{const{prefix:e,experimentalParseClassName:n}=t;let r=s=>{const i=[];let a=0,o=0,c=0,h;const f=s.length;for(let w=0;wc?h-c:void 0;return d9(i,x,g,y)};if(e){const s=e+u9,i=r;r=a=>a.startsWith(s)?i(a.slice(s.length)):d9(XJ,!1,a,void 0,!0)}if(n){const s=r;r=i=>n({className:i,parseClassName:s})}return r},KJ=t=>{const e=new Map;return t.orderSensitiveModifiers.forEach((n,r)=>{e.set(n,1e6+r)}),n=>{const r=[];let s=[];for(let i=0;i0&&(s.sort(),r.push(...s),s=[]),r.push(a)):s.push(a)}return s.length>0&&(s.sort(),r.push(...s)),r}},ZJ=t=>({cache:GJ(t.cacheSize),parseClassName:YJ(t),sortModifiers:KJ(t),...BJ(t)}),JJ=/\s+/,eee=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s,sortModifiers:i}=e,a=[],o=t.trim().split(JJ);let c="";for(let h=o.length-1;h>=0;h-=1){const f=o[h],{isExternal:m,modifiers:g,hasImportantModifier:x,baseClassName:y,maybePostfixModifierPosition:w}=n(f);if(m){c=f+(c.length>0?" "+c:c);continue}let S=!!w,k=r(S?y.substring(0,w):y);if(!k){if(!S){c=f+(c.length>0?" "+c:c);continue}if(k=r(y),!k){c=f+(c.length>0?" "+c:c);continue}S=!1}const N=g.length===0?"":g.length===1?g[0]:i(g).join(":"),C=x?N+$3:N,T=C+k;if(a.indexOf(T)>-1)continue;a.push(T);const _=s(k,S);for(let E=0;E<_.length;++E){const M=_[E];a.push(C+M)}c=f+(c.length>0?" "+c:c)}return c},tee=(...t)=>{let e=0,n,r,s="";for(;e{if(typeof t=="string")return t;let e,n="";for(let r=0;r{let n,r,s,i;const a=c=>{const h=e.reduce((f,m)=>m(f),t());return n=ZJ(h),r=n.cache.get,s=n.cache.set,i=o,o(c)},o=c=>{const h=r(c);if(h)return h;const f=eee(c,n);return s(c,f),f};return i=a,(...c)=>i(tee(...c))},ree=[],Yr=t=>{const e=n=>n[t]||ree;return e.isThemeGetter=!0,e},qz=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Fz=/^\((?:(\w[\w-]*):)?(.+)\)$/i,see=/^\d+\/\d+$/,iee=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,aee=/\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$/,lee=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,oee=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,cee=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Td=t=>see.test(t),Xt=t=>!!t&&!Number.isNaN(Number(t)),Zo=t=>!!t&&Number.isInteger(Number(t)),uw=t=>t.endsWith("%")&&Xt(t.slice(0,-1)),Vl=t=>iee.test(t),uee=()=>!0,dee=t=>aee.test(t)&&!lee.test(t),$z=()=>!1,hee=t=>oee.test(t),fee=t=>cee.test(t),mee=t=>!ot(t)&&!ct(t),pee=t=>Ph(t,Vz,$z),ot=t=>qz.test(t),ru=t=>Ph(t,Uz,dee),dw=t=>Ph(t,bee,Xt),h9=t=>Ph(t,Qz,$z),gee=t=>Ph(t,Hz,fee),Xg=t=>Ph(t,Wz,hee),ct=t=>Fz.test(t),Yf=t=>Lh(t,Uz),xee=t=>Lh(t,wee),f9=t=>Lh(t,Qz),vee=t=>Lh(t,Vz),yee=t=>Lh(t,Hz),Yg=t=>Lh(t,Wz,!0),Ph=(t,e,n)=>{const r=qz.exec(t);return r?r[1]?e(r[1]):n(r[2]):!1},Lh=(t,e,n=!1)=>{const r=Fz.exec(t);return r?r[1]?e(r[1]):n:!1},Qz=t=>t==="position"||t==="percentage",Hz=t=>t==="image"||t==="url",Vz=t=>t==="length"||t==="size"||t==="bg-size",Uz=t=>t==="length",bee=t=>t==="number",wee=t=>t==="family-name",Wz=t=>t==="shadow",See=()=>{const t=Yr("color"),e=Yr("font"),n=Yr("text"),r=Yr("font-weight"),s=Yr("tracking"),i=Yr("leading"),a=Yr("breakpoint"),o=Yr("container"),c=Yr("spacing"),h=Yr("radius"),f=Yr("shadow"),m=Yr("inset-shadow"),g=Yr("text-shadow"),x=Yr("drop-shadow"),y=Yr("blur"),w=Yr("perspective"),S=Yr("aspect"),k=Yr("ease"),N=Yr("animate"),C=()=>["auto","avoid","all","avoid-page","page","left","right","column"],T=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],_=()=>[...T(),ct,ot],E=()=>["auto","hidden","clip","visible","scroll"],M=()=>["auto","contain","none"],L=()=>[ct,ot,c],P=()=>[Td,"full","auto",...L()],I=()=>[Zo,"none","subgrid",ct,ot],Q=()=>["auto",{span:["full",Zo,ct,ot]},Zo,ct,ot],U=()=>[Zo,"auto",ct,ot],ee=()=>["auto","min","max","fr",ct,ot],z=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],H=()=>["start","end","center","stretch","center-safe","end-safe"],B=()=>["auto",...L()],X=()=>[Td,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...L()],J=()=>[t,ct,ot],G=()=>[...T(),f9,h9,{position:[ct,ot]}],R=()=>["no-repeat",{repeat:["","x","y","space","round"]}],se=()=>["auto","cover","contain",vee,pee,{size:[ct,ot]}],W=()=>[uw,Yf,ru],F=()=>["","none","full",h,ct,ot],V=()=>["",Xt,Yf,ru],te=()=>["solid","dashed","dotted","double"],ne=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],K=()=>[Xt,uw,f9,h9],ie=()=>["","none",y,ct,ot],re=()=>["none",Xt,ct,ot],ae=()=>["none",Xt,ct,ot],_e=()=>[Xt,ct,ot],Ue=()=>[Td,"full",...L()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Vl],breakpoint:[Vl],color:[uee],container:[Vl],"drop-shadow":[Vl],ease:["in","out","in-out"],font:[mee],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Vl],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Vl],shadow:[Vl],spacing:["px",Xt],text:[Vl],"text-shadow":[Vl],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Td,ot,ct,S]}],container:["container"],columns:[{columns:[Xt,ot,ct,o]}],"break-after":[{"break-after":C()}],"break-before":[{"break-before":C()}],"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:_()}],overflow:[{overflow:E()}],"overflow-x":[{"overflow-x":E()}],"overflow-y":[{"overflow-y":E()}],overscroll:[{overscroll:M()}],"overscroll-x":[{"overscroll-x":M()}],"overscroll-y":[{"overscroll-y":M()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:P()}],"inset-x":[{"inset-x":P()}],"inset-y":[{"inset-y":P()}],start:[{start:P()}],end:[{end:P()}],top:[{top:P()}],right:[{right:P()}],bottom:[{bottom:P()}],left:[{left:P()}],visibility:["visible","invisible","collapse"],z:[{z:[Zo,"auto",ct,ot]}],basis:[{basis:[Td,"full","auto",o,...L()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Xt,Td,"auto","initial","none",ot]}],grow:[{grow:["",Xt,ct,ot]}],shrink:[{shrink:["",Xt,ct,ot]}],order:[{order:[Zo,"first","last","none",ct,ot]}],"grid-cols":[{"grid-cols":I()}],"col-start-end":[{col:Q()}],"col-start":[{"col-start":U()}],"col-end":[{"col-end":U()}],"grid-rows":[{"grid-rows":I()}],"row-start-end":[{row:Q()}],"row-start":[{"row-start":U()}],"row-end":[{"row-end":U()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":ee()}],"auto-rows":[{"auto-rows":ee()}],gap:[{gap:L()}],"gap-x":[{"gap-x":L()}],"gap-y":[{"gap-y":L()}],"justify-content":[{justify:[...z(),"normal"]}],"justify-items":[{"justify-items":[...H(),"normal"]}],"justify-self":[{"justify-self":["auto",...H()]}],"align-content":[{content:["normal",...z()]}],"align-items":[{items:[...H(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...H(),{baseline:["","last"]}]}],"place-content":[{"place-content":z()}],"place-items":[{"place-items":[...H(),"baseline"]}],"place-self":[{"place-self":["auto",...H()]}],p:[{p:L()}],px:[{px:L()}],py:[{py:L()}],ps:[{ps:L()}],pe:[{pe:L()}],pt:[{pt:L()}],pr:[{pr:L()}],pb:[{pb:L()}],pl:[{pl:L()}],m:[{m:B()}],mx:[{mx:B()}],my:[{my:B()}],ms:[{ms:B()}],me:[{me:B()}],mt:[{mt:B()}],mr:[{mr:B()}],mb:[{mb:B()}],ml:[{ml:B()}],"space-x":[{"space-x":L()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":L()}],"space-y-reverse":["space-y-reverse"],size:[{size:X()}],w:[{w:[o,"screen",...X()]}],"min-w":[{"min-w":[o,"screen","none",...X()]}],"max-w":[{"max-w":[o,"screen","none","prose",{screen:[a]},...X()]}],h:[{h:["screen","lh",...X()]}],"min-h":[{"min-h":["screen","lh","none",...X()]}],"max-h":[{"max-h":["screen","lh",...X()]}],"font-size":[{text:["base",n,Yf,ru]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,ct,dw]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",uw,ot]}],"font-family":[{font:[xee,ot,e]}],"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,ct,ot]}],"line-clamp":[{"line-clamp":[Xt,"none",ct,dw]}],leading:[{leading:[i,...L()]}],"list-image":[{"list-image":["none",ct,ot]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ct,ot]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:J()}],"text-color":[{text:J()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...te(),"wavy"]}],"text-decoration-thickness":[{decoration:[Xt,"from-font","auto",ct,ru]}],"text-decoration-color":[{decoration:J()}],"underline-offset":[{"underline-offset":[Xt,"auto",ct,ot]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:L()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ct,ot]}],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",ct,ot]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:G()}],"bg-repeat":[{bg:R()}],"bg-size":[{bg:se()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Zo,ct,ot],radial:["",ct,ot],conic:[Zo,ct,ot]},yee,gee]}],"bg-color":[{bg:J()}],"gradient-from-pos":[{from:W()}],"gradient-via-pos":[{via:W()}],"gradient-to-pos":[{to:W()}],"gradient-from":[{from:J()}],"gradient-via":[{via:J()}],"gradient-to":[{to:J()}],rounded:[{rounded:F()}],"rounded-s":[{"rounded-s":F()}],"rounded-e":[{"rounded-e":F()}],"rounded-t":[{"rounded-t":F()}],"rounded-r":[{"rounded-r":F()}],"rounded-b":[{"rounded-b":F()}],"rounded-l":[{"rounded-l":F()}],"rounded-ss":[{"rounded-ss":F()}],"rounded-se":[{"rounded-se":F()}],"rounded-ee":[{"rounded-ee":F()}],"rounded-es":[{"rounded-es":F()}],"rounded-tl":[{"rounded-tl":F()}],"rounded-tr":[{"rounded-tr":F()}],"rounded-br":[{"rounded-br":F()}],"rounded-bl":[{"rounded-bl":F()}],"border-w":[{border:V()}],"border-w-x":[{"border-x":V()}],"border-w-y":[{"border-y":V()}],"border-w-s":[{"border-s":V()}],"border-w-e":[{"border-e":V()}],"border-w-t":[{"border-t":V()}],"border-w-r":[{"border-r":V()}],"border-w-b":[{"border-b":V()}],"border-w-l":[{"border-l":V()}],"divide-x":[{"divide-x":V()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":V()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...te(),"hidden","none"]}],"divide-style":[{divide:[...te(),"hidden","none"]}],"border-color":[{border:J()}],"border-color-x":[{"border-x":J()}],"border-color-y":[{"border-y":J()}],"border-color-s":[{"border-s":J()}],"border-color-e":[{"border-e":J()}],"border-color-t":[{"border-t":J()}],"border-color-r":[{"border-r":J()}],"border-color-b":[{"border-b":J()}],"border-color-l":[{"border-l":J()}],"divide-color":[{divide:J()}],"outline-style":[{outline:[...te(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Xt,ct,ot]}],"outline-w":[{outline:["",Xt,Yf,ru]}],"outline-color":[{outline:J()}],shadow:[{shadow:["","none",f,Yg,Xg]}],"shadow-color":[{shadow:J()}],"inset-shadow":[{"inset-shadow":["none",m,Yg,Xg]}],"inset-shadow-color":[{"inset-shadow":J()}],"ring-w":[{ring:V()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:J()}],"ring-offset-w":[{"ring-offset":[Xt,ru]}],"ring-offset-color":[{"ring-offset":J()}],"inset-ring-w":[{"inset-ring":V()}],"inset-ring-color":[{"inset-ring":J()}],"text-shadow":[{"text-shadow":["none",g,Yg,Xg]}],"text-shadow-color":[{"text-shadow":J()}],opacity:[{opacity:[Xt,ct,ot]}],"mix-blend":[{"mix-blend":[...ne(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ne()}],"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":[Xt]}],"mask-image-linear-from-pos":[{"mask-linear-from":K()}],"mask-image-linear-to-pos":[{"mask-linear-to":K()}],"mask-image-linear-from-color":[{"mask-linear-from":J()}],"mask-image-linear-to-color":[{"mask-linear-to":J()}],"mask-image-t-from-pos":[{"mask-t-from":K()}],"mask-image-t-to-pos":[{"mask-t-to":K()}],"mask-image-t-from-color":[{"mask-t-from":J()}],"mask-image-t-to-color":[{"mask-t-to":J()}],"mask-image-r-from-pos":[{"mask-r-from":K()}],"mask-image-r-to-pos":[{"mask-r-to":K()}],"mask-image-r-from-color":[{"mask-r-from":J()}],"mask-image-r-to-color":[{"mask-r-to":J()}],"mask-image-b-from-pos":[{"mask-b-from":K()}],"mask-image-b-to-pos":[{"mask-b-to":K()}],"mask-image-b-from-color":[{"mask-b-from":J()}],"mask-image-b-to-color":[{"mask-b-to":J()}],"mask-image-l-from-pos":[{"mask-l-from":K()}],"mask-image-l-to-pos":[{"mask-l-to":K()}],"mask-image-l-from-color":[{"mask-l-from":J()}],"mask-image-l-to-color":[{"mask-l-to":J()}],"mask-image-x-from-pos":[{"mask-x-from":K()}],"mask-image-x-to-pos":[{"mask-x-to":K()}],"mask-image-x-from-color":[{"mask-x-from":J()}],"mask-image-x-to-color":[{"mask-x-to":J()}],"mask-image-y-from-pos":[{"mask-y-from":K()}],"mask-image-y-to-pos":[{"mask-y-to":K()}],"mask-image-y-from-color":[{"mask-y-from":J()}],"mask-image-y-to-color":[{"mask-y-to":J()}],"mask-image-radial":[{"mask-radial":[ct,ot]}],"mask-image-radial-from-pos":[{"mask-radial-from":K()}],"mask-image-radial-to-pos":[{"mask-radial-to":K()}],"mask-image-radial-from-color":[{"mask-radial-from":J()}],"mask-image-radial-to-color":[{"mask-radial-to":J()}],"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":T()}],"mask-image-conic-pos":[{"mask-conic":[Xt]}],"mask-image-conic-from-pos":[{"mask-conic-from":K()}],"mask-image-conic-to-pos":[{"mask-conic-to":K()}],"mask-image-conic-from-color":[{"mask-conic-from":J()}],"mask-image-conic-to-color":[{"mask-conic-to":J()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:G()}],"mask-repeat":[{mask:R()}],"mask-size":[{mask:se()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ct,ot]}],filter:[{filter:["","none",ct,ot]}],blur:[{blur:ie()}],brightness:[{brightness:[Xt,ct,ot]}],contrast:[{contrast:[Xt,ct,ot]}],"drop-shadow":[{"drop-shadow":["","none",x,Yg,Xg]}],"drop-shadow-color":[{"drop-shadow":J()}],grayscale:[{grayscale:["",Xt,ct,ot]}],"hue-rotate":[{"hue-rotate":[Xt,ct,ot]}],invert:[{invert:["",Xt,ct,ot]}],saturate:[{saturate:[Xt,ct,ot]}],sepia:[{sepia:["",Xt,ct,ot]}],"backdrop-filter":[{"backdrop-filter":["","none",ct,ot]}],"backdrop-blur":[{"backdrop-blur":ie()}],"backdrop-brightness":[{"backdrop-brightness":[Xt,ct,ot]}],"backdrop-contrast":[{"backdrop-contrast":[Xt,ct,ot]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Xt,ct,ot]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Xt,ct,ot]}],"backdrop-invert":[{"backdrop-invert":["",Xt,ct,ot]}],"backdrop-opacity":[{"backdrop-opacity":[Xt,ct,ot]}],"backdrop-saturate":[{"backdrop-saturate":[Xt,ct,ot]}],"backdrop-sepia":[{"backdrop-sepia":["",Xt,ct,ot]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":L()}],"border-spacing-x":[{"border-spacing-x":L()}],"border-spacing-y":[{"border-spacing-y":L()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",ct,ot]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Xt,"initial",ct,ot]}],ease:[{ease:["linear","initial",k,ct,ot]}],delay:[{delay:[Xt,ct,ot]}],animate:[{animate:["none",N,ct,ot]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[w,ct,ot]}],"perspective-origin":[{"perspective-origin":_()}],rotate:[{rotate:re()}],"rotate-x":[{"rotate-x":re()}],"rotate-y":[{"rotate-y":re()}],"rotate-z":[{"rotate-z":re()}],scale:[{scale:ae()}],"scale-x":[{"scale-x":ae()}],"scale-y":[{"scale-y":ae()}],"scale-z":[{"scale-z":ae()}],"scale-3d":["scale-3d"],skew:[{skew:_e()}],"skew-x":[{"skew-x":_e()}],"skew-y":[{"skew-y":_e()}],transform:[{transform:[ct,ot,"","none","gpu","cpu"]}],"transform-origin":[{origin:_()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Ue()}],"translate-x":[{"translate-x":Ue()}],"translate-y":[{"translate-y":Ue()}],"translate-z":[{"translate-z":Ue()}],"translate-none":["translate-none"],accent:[{accent:J()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:J()}],"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",ct,ot]}],"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":L()}],"scroll-mx":[{"scroll-mx":L()}],"scroll-my":[{"scroll-my":L()}],"scroll-ms":[{"scroll-ms":L()}],"scroll-me":[{"scroll-me":L()}],"scroll-mt":[{"scroll-mt":L()}],"scroll-mr":[{"scroll-mr":L()}],"scroll-mb":[{"scroll-mb":L()}],"scroll-ml":[{"scroll-ml":L()}],"scroll-p":[{"scroll-p":L()}],"scroll-px":[{"scroll-px":L()}],"scroll-py":[{"scroll-py":L()}],"scroll-ps":[{"scroll-ps":L()}],"scroll-pe":[{"scroll-pe":L()}],"scroll-pt":[{"scroll-pt":L()}],"scroll-pr":[{"scroll-pr":L()}],"scroll-pb":[{"scroll-pb":L()}],"scroll-pl":[{"scroll-pl":L()}],"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",ct,ot]}],fill:[{fill:["none",...J()]}],"stroke-w":[{stroke:[Xt,Yf,ru,dw]}],stroke:[{stroke:["none",...J()]}],"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"]}},kee=nee(See);function ve(...t){return kee(OD(t))}const Dt=b.forwardRef(({className:t,...e},n)=>l.jsx("div",{ref:n,className:ve("rounded-xl border bg-card text-card-foreground shadow",t),...e}));Dt.displayName="Card";const kn=b.forwardRef(({className:t,...e},n)=>l.jsx("div",{ref:n,className:ve("flex flex-col space-y-1.5 p-6",t),...e}));kn.displayName="CardHeader";const jn=b.forwardRef(({className:t,...e},n)=>l.jsx("div",{ref:n,className:ve("font-semibold leading-none tracking-tight",t),...e}));jn.displayName="CardTitle";const Fr=b.forwardRef(({className:t,...e},n)=>l.jsx("div",{ref:n,className:ve("text-sm text-muted-foreground",t),...e}));Fr.displayName="CardDescription";const Dn=b.forwardRef(({className:t,...e},n)=>l.jsx("div",{ref:n,className:ve("p-6 pt-0",t),...e}));Dn.displayName="CardContent";const Gz=b.forwardRef(({className:t,...e},n)=>l.jsx("div",{ref:n,className:ve("flex items-center p-6 pt-0",t),...e}));Gz.displayName="CardFooter";var hw="rovingFocusGroup.onEntryFocus",jee={bubbles:!1,cancelable:!0},Q0="RovingFocusGroup",[Q3,Xz,Oee]=Cv(Q0),[Nee,Fv]=ha(Q0,[Oee]),[Cee,Tee]=Nee(Q0),Yz=b.forwardRef((t,e)=>l.jsx(Q3.Provider,{scope:t.__scopeRovingFocusGroup,children:l.jsx(Q3.Slot,{scope:t.__scopeRovingFocusGroup,children:l.jsx(Eee,{...t,ref:e})})}));Yz.displayName=Q0;var Eee=b.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:s=!1,dir:i,currentTabStopId:a,defaultCurrentTabStopId:o,onCurrentTabStopIdChange:c,onEntryFocus:h,preventScrollOnEntryFocus:f=!1,...m}=t,g=b.useRef(null),x=Bn(e,g),y=D0(i),[w,S]=wo({prop:a,defaultProp:o??null,onChange:c,caller:Q0}),[k,N]=b.useState(!1),C=Os(h),T=Xz(n),_=b.useRef(!1),[E,M]=b.useState(0);return b.useEffect(()=>{const L=g.current;if(L)return L.addEventListener(hw,C),()=>L.removeEventListener(hw,C)},[C]),l.jsx(Cee,{scope:n,orientation:r,dir:y,loop:s,currentTabStopId:w,onItemFocus:b.useCallback(L=>S(L),[S]),onItemShiftTab:b.useCallback(()=>N(!0),[]),onFocusableItemAdd:b.useCallback(()=>M(L=>L+1),[]),onFocusableItemRemove:b.useCallback(()=>M(L=>L-1),[]),children:l.jsx(on.div,{tabIndex:k||E===0?-1:0,"data-orientation":r,...m,ref:x,style:{outline:"none",...t.style},onMouseDown:tt(t.onMouseDown,()=>{_.current=!0}),onFocus:tt(t.onFocus,L=>{const P=!_.current;if(L.target===L.currentTarget&&P&&!k){const I=new CustomEvent(hw,jee);if(L.currentTarget.dispatchEvent(I),!I.defaultPrevented){const Q=T().filter(B=>B.focusable),U=Q.find(B=>B.active),ee=Q.find(B=>B.id===w),H=[U,ee,...Q].filter(Boolean).map(B=>B.ref.current);Jz(H,f)}}_.current=!1}),onBlur:tt(t.onBlur,()=>N(!1))})})}),Kz="RovingFocusGroupItem",Zz=b.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:s=!1,tabStopId:i,children:a,...o}=t,c=_i(),h=i||c,f=Tee(Kz,n),m=f.currentTabStopId===h,g=Xz(n),{onFocusableItemAdd:x,onFocusableItemRemove:y,currentTabStopId:w}=f;return b.useEffect(()=>{if(r)return x(),()=>y()},[r,x,y]),l.jsx(Q3.ItemSlot,{scope:n,id:h,focusable:r,active:s,children:l.jsx(on.span,{tabIndex:m?0:-1,"data-orientation":f.orientation,...o,ref:e,onMouseDown:tt(t.onMouseDown,S=>{r?f.onItemFocus(h):S.preventDefault()}),onFocus:tt(t.onFocus,()=>f.onItemFocus(h)),onKeyDown:tt(t.onKeyDown,S=>{if(S.key==="Tab"&&S.shiftKey){f.onItemShiftTab();return}if(S.target!==S.currentTarget)return;const k=Aee(S,f.orientation,f.dir);if(k!==void 0){if(S.metaKey||S.ctrlKey||S.altKey||S.shiftKey)return;S.preventDefault();let C=g().filter(T=>T.focusable).map(T=>T.ref.current);if(k==="last")C.reverse();else if(k==="prev"||k==="next"){k==="prev"&&C.reverse();const T=C.indexOf(S.currentTarget);C=f.loop?Ree(C,T+1):C.slice(T+1)}setTimeout(()=>Jz(C))}}),children:typeof a=="function"?a({isCurrentTabStop:m,hasTabStop:w!=null}):a})})});Zz.displayName=Kz;var _ee={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Mee(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function Aee(t,e,n){const r=Mee(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return _ee[r]}function Jz(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function Ree(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var eP=Yz,tP=Zz,$v="Tabs",[Dee]=ha($v,[Fv]),nP=Fv(),[zee,f6]=Dee($v),rP=b.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,onValueChange:s,defaultValue:i,orientation:a="horizontal",dir:o,activationMode:c="automatic",...h}=t,f=D0(o),[m,g]=wo({prop:r,onChange:s,defaultProp:i??"",caller:$v});return l.jsx(zee,{scope:n,baseId:_i(),value:m,onValueChange:g,orientation:a,dir:f,activationMode:c,children:l.jsx(on.div,{dir:f,"data-orientation":a,...h,ref:e})})});rP.displayName=$v;var sP="TabsList",iP=b.forwardRef((t,e)=>{const{__scopeTabs:n,loop:r=!0,...s}=t,i=f6(sP,n),a=nP(n);return l.jsx(eP,{asChild:!0,...a,orientation:i.orientation,dir:i.dir,loop:r,children:l.jsx(on.div,{role:"tablist","aria-orientation":i.orientation,...s,ref:e})})});iP.displayName=sP;var aP="TabsTrigger",lP=b.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,disabled:s=!1,...i}=t,a=f6(aP,n),o=nP(n),c=uP(a.baseId,r),h=dP(a.baseId,r),f=r===a.value;return l.jsx(tP,{asChild:!0,...o,focusable:!s,active:f,children:l.jsx(on.button,{type:"button",role:"tab","aria-selected":f,"aria-controls":h,"data-state":f?"active":"inactive","data-disabled":s?"":void 0,disabled:s,id:c,...i,ref:e,onMouseDown:tt(t.onMouseDown,m=>{!s&&m.button===0&&m.ctrlKey===!1?a.onValueChange(r):m.preventDefault()}),onKeyDown:tt(t.onKeyDown,m=>{[" ","Enter"].includes(m.key)&&a.onValueChange(r)}),onFocus:tt(t.onFocus,()=>{const m=a.activationMode!=="manual";!f&&!s&&m&&a.onValueChange(r)})})})});lP.displayName=aP;var oP="TabsContent",cP=b.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,forceMount:s,children:i,...a}=t,o=f6(oP,n),c=uP(o.baseId,r),h=dP(o.baseId,r),f=r===o.value,m=b.useRef(f);return b.useEffect(()=>{const g=requestAnimationFrame(()=>m.current=!1);return()=>cancelAnimationFrame(g)},[]),l.jsx(Fs,{present:s||f,children:({present:g})=>l.jsx(on.div,{"data-state":f?"active":"inactive","data-orientation":o.orientation,role:"tabpanel","aria-labelledby":c,hidden:!g,id:h,tabIndex:0,...a,ref:e,style:{...t.style,animationDuration:m.current?"0s":void 0},children:g&&i})})});cP.displayName=oP;function uP(t,e){return`${t}-trigger-${e}`}function dP(t,e){return`${t}-content-${e}`}var Pee=rP,hP=iP,fP=lP,mP=cP;const sa=Pee,Mi=b.forwardRef(({className:t,...e},n)=>l.jsx(hP,{ref:n,className:ve("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",t),...e}));Mi.displayName=hP.displayName;const zt=b.forwardRef(({className:t,...e},n)=>l.jsx(fP,{ref:n,className:ve("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all duration-300 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",t),...e}));zt.displayName=fP.displayName;const tn=b.forwardRef(({className:t,...e},n)=>l.jsx(mP,{ref:n,className:ve("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 data-[state=active]:animate-in data-[state=active]:fade-in data-[state=active]:duration-300",t),...e}));tn.displayName=mP.displayName;function Lee(t,e){return b.useReducer((n,r)=>e[n][r]??n,t)}var m6="ScrollArea",[pP]=ha(m6),[Iee,fa]=pP(m6),gP=b.forwardRef((t,e)=>{const{__scopeScrollArea:n,type:r="hover",dir:s,scrollHideDelay:i=600,...a}=t,[o,c]=b.useState(null),[h,f]=b.useState(null),[m,g]=b.useState(null),[x,y]=b.useState(null),[w,S]=b.useState(null),[k,N]=b.useState(0),[C,T]=b.useState(0),[_,E]=b.useState(!1),[M,L]=b.useState(!1),P=Bn(e,Q=>c(Q)),I=D0(s);return l.jsx(Iee,{scope:n,type:r,dir:I,scrollHideDelay:i,scrollArea:o,viewport:h,onViewportChange:f,content:m,onContentChange:g,scrollbarX:x,onScrollbarXChange:y,scrollbarXEnabled:_,onScrollbarXEnabledChange:E,scrollbarY:w,onScrollbarYChange:S,scrollbarYEnabled:M,onScrollbarYEnabledChange:L,onCornerWidthChange:N,onCornerHeightChange:T,children:l.jsx(on.div,{dir:I,...a,ref:P,style:{position:"relative","--radix-scroll-area-corner-width":k+"px","--radix-scroll-area-corner-height":C+"px",...t.style}})})});gP.displayName=m6;var xP="ScrollAreaViewport",vP=b.forwardRef((t,e)=>{const{__scopeScrollArea:n,children:r,nonce:s,...i}=t,a=fa(xP,n),o=b.useRef(null),c=Bn(e,o,a.onViewportChange);return l.jsxs(l.Fragment,{children:[l.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:s}),l.jsx(on.div,{"data-radix-scroll-area-viewport":"",...i,ref:c,style:{overflowX:a.scrollbarXEnabled?"scroll":"hidden",overflowY:a.scrollbarYEnabled?"scroll":"hidden",...t.style},children:l.jsx("div",{ref:a.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});vP.displayName=xP;var ml="ScrollAreaScrollbar",p6=b.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=fa(ml,t.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:a}=s,o=t.orientation==="horizontal";return b.useEffect(()=>(o?i(!0):a(!0),()=>{o?i(!1):a(!1)}),[o,i,a]),s.type==="hover"?l.jsx(Bee,{...r,ref:e,forceMount:n}):s.type==="scroll"?l.jsx(qee,{...r,ref:e,forceMount:n}):s.type==="auto"?l.jsx(yP,{...r,ref:e,forceMount:n}):s.type==="always"?l.jsx(g6,{...r,ref:e}):null});p6.displayName=ml;var Bee=b.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=fa(ml,t.__scopeScrollArea),[i,a]=b.useState(!1);return b.useEffect(()=>{const o=s.scrollArea;let c=0;if(o){const h=()=>{window.clearTimeout(c),a(!0)},f=()=>{c=window.setTimeout(()=>a(!1),s.scrollHideDelay)};return o.addEventListener("pointerenter",h),o.addEventListener("pointerleave",f),()=>{window.clearTimeout(c),o.removeEventListener("pointerenter",h),o.removeEventListener("pointerleave",f)}}},[s.scrollArea,s.scrollHideDelay]),l.jsx(Fs,{present:n||i,children:l.jsx(yP,{"data-state":i?"visible":"hidden",...r,ref:e})})}),qee=b.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=fa(ml,t.__scopeScrollArea),i=t.orientation==="horizontal",a=Hv(()=>c("SCROLL_END"),100),[o,c]=Lee("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return b.useEffect(()=>{if(o==="idle"){const h=window.setTimeout(()=>c("HIDE"),s.scrollHideDelay);return()=>window.clearTimeout(h)}},[o,s.scrollHideDelay,c]),b.useEffect(()=>{const h=s.viewport,f=i?"scrollLeft":"scrollTop";if(h){let m=h[f];const g=()=>{const x=h[f];m!==x&&(c("SCROLL"),a()),m=x};return h.addEventListener("scroll",g),()=>h.removeEventListener("scroll",g)}},[s.viewport,i,c,a]),l.jsx(Fs,{present:n||o!=="hidden",children:l.jsx(g6,{"data-state":o==="hidden"?"hidden":"visible",...r,ref:e,onPointerEnter:tt(t.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:tt(t.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),yP=b.forwardRef((t,e)=>{const n=fa(ml,t.__scopeScrollArea),{forceMount:r,...s}=t,[i,a]=b.useState(!1),o=t.orientation==="horizontal",c=Hv(()=>{if(n.viewport){const h=n.viewport.offsetWidth{const{orientation:n="vertical",...r}=t,s=fa(ml,t.__scopeScrollArea),i=b.useRef(null),a=b.useRef(0),[o,c]=b.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),h=jP(o.viewport,o.content),f={...r,sizes:o,onSizesChange:c,hasThumb:h>0&&h<1,onThumbChange:g=>i.current=g,onThumbPointerUp:()=>a.current=0,onThumbPointerDown:g=>a.current=g};function m(g,x){return Uee(g,a.current,o,x)}return n==="horizontal"?l.jsx(Fee,{...f,ref:e,onThumbPositionChange:()=>{if(s.viewport&&i.current){const g=s.viewport.scrollLeft,x=m9(g,o,s.dir);i.current.style.transform=`translate3d(${x}px, 0, 0)`}},onWheelScroll:g=>{s.viewport&&(s.viewport.scrollLeft=g)},onDragScroll:g=>{s.viewport&&(s.viewport.scrollLeft=m(g,s.dir))}}):n==="vertical"?l.jsx($ee,{...f,ref:e,onThumbPositionChange:()=>{if(s.viewport&&i.current){const g=s.viewport.scrollTop,x=m9(g,o);i.current.style.transform=`translate3d(0, ${x}px, 0)`}},onWheelScroll:g=>{s.viewport&&(s.viewport.scrollTop=g)},onDragScroll:g=>{s.viewport&&(s.viewport.scrollTop=m(g))}}):null}),Fee=b.forwardRef((t,e)=>{const{sizes:n,onSizesChange:r,...s}=t,i=fa(ml,t.__scopeScrollArea),[a,o]=b.useState(),c=b.useRef(null),h=Bn(e,c,i.onScrollbarXChange);return b.useEffect(()=>{c.current&&o(getComputedStyle(c.current))},[c]),l.jsx(wP,{"data-orientation":"horizontal",...s,ref:h,sizes:n,style:{bottom:0,left:i.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:i.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":Qv(n)+"px",...t.style},onThumbPointerDown:f=>t.onThumbPointerDown(f.x),onDragScroll:f=>t.onDragScroll(f.x),onWheelScroll:(f,m)=>{if(i.viewport){const g=i.viewport.scrollLeft+f.deltaX;t.onWheelScroll(g),NP(g,m)&&f.preventDefault()}},onResize:()=>{c.current&&i.viewport&&a&&r({content:i.viewport.scrollWidth,viewport:i.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:M1(a.paddingLeft),paddingEnd:M1(a.paddingRight)}})}})}),$ee=b.forwardRef((t,e)=>{const{sizes:n,onSizesChange:r,...s}=t,i=fa(ml,t.__scopeScrollArea),[a,o]=b.useState(),c=b.useRef(null),h=Bn(e,c,i.onScrollbarYChange);return b.useEffect(()=>{c.current&&o(getComputedStyle(c.current))},[c]),l.jsx(wP,{"data-orientation":"vertical",...s,ref:h,sizes:n,style:{top:0,right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":Qv(n)+"px",...t.style},onThumbPointerDown:f=>t.onThumbPointerDown(f.y),onDragScroll:f=>t.onDragScroll(f.y),onWheelScroll:(f,m)=>{if(i.viewport){const g=i.viewport.scrollTop+f.deltaY;t.onWheelScroll(g),NP(g,m)&&f.preventDefault()}},onResize:()=>{c.current&&i.viewport&&a&&r({content:i.viewport.scrollHeight,viewport:i.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:M1(a.paddingTop),paddingEnd:M1(a.paddingBottom)}})}})}),[Qee,bP]=pP(ml),wP=b.forwardRef((t,e)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:s,onThumbChange:i,onThumbPointerUp:a,onThumbPointerDown:o,onThumbPositionChange:c,onDragScroll:h,onWheelScroll:f,onResize:m,...g}=t,x=fa(ml,n),[y,w]=b.useState(null),S=Bn(e,P=>w(P)),k=b.useRef(null),N=b.useRef(""),C=x.viewport,T=r.content-r.viewport,_=Os(f),E=Os(c),M=Hv(m,10);function L(P){if(k.current){const I=P.clientX-k.current.left,Q=P.clientY-k.current.top;h({x:I,y:Q})}}return b.useEffect(()=>{const P=I=>{const Q=I.target;y?.contains(Q)&&_(I,T)};return document.addEventListener("wheel",P,{passive:!1}),()=>document.removeEventListener("wheel",P,{passive:!1})},[C,y,T,_]),b.useEffect(E,[r,E]),gh(y,M),gh(x.content,M),l.jsx(Qee,{scope:n,scrollbar:y,hasThumb:s,onThumbChange:Os(i),onThumbPointerUp:Os(a),onThumbPositionChange:E,onThumbPointerDown:Os(o),children:l.jsx(on.div,{...g,ref:S,style:{position:"absolute",...g.style},onPointerDown:tt(t.onPointerDown,P=>{P.button===0&&(P.target.setPointerCapture(P.pointerId),k.current=y.getBoundingClientRect(),N.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",x.viewport&&(x.viewport.style.scrollBehavior="auto"),L(P))}),onPointerMove:tt(t.onPointerMove,L),onPointerUp:tt(t.onPointerUp,P=>{const I=P.target;I.hasPointerCapture(P.pointerId)&&I.releasePointerCapture(P.pointerId),document.body.style.webkitUserSelect=N.current,x.viewport&&(x.viewport.style.scrollBehavior=""),k.current=null})})})}),_1="ScrollAreaThumb",SP=b.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=bP(_1,t.__scopeScrollArea);return l.jsx(Fs,{present:n||s.hasThumb,children:l.jsx(Hee,{ref:e,...r})})}),Hee=b.forwardRef((t,e)=>{const{__scopeScrollArea:n,style:r,...s}=t,i=fa(_1,n),a=bP(_1,n),{onThumbPositionChange:o}=a,c=Bn(e,m=>a.onThumbChange(m)),h=b.useRef(void 0),f=Hv(()=>{h.current&&(h.current(),h.current=void 0)},100);return b.useEffect(()=>{const m=i.viewport;if(m){const g=()=>{if(f(),!h.current){const x=Wee(m,o);h.current=x,o()}};return o(),m.addEventListener("scroll",g),()=>m.removeEventListener("scroll",g)}},[i.viewport,f,o]),l.jsx(on.div,{"data-state":a.hasThumb?"visible":"hidden",...s,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:tt(t.onPointerDownCapture,m=>{const x=m.target.getBoundingClientRect(),y=m.clientX-x.left,w=m.clientY-x.top;a.onThumbPointerDown({x:y,y:w})}),onPointerUp:tt(t.onPointerUp,a.onThumbPointerUp)})});SP.displayName=_1;var x6="ScrollAreaCorner",kP=b.forwardRef((t,e)=>{const n=fa(x6,t.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?l.jsx(Vee,{...t,ref:e}):null});kP.displayName=x6;var Vee=b.forwardRef((t,e)=>{const{__scopeScrollArea:n,...r}=t,s=fa(x6,n),[i,a]=b.useState(0),[o,c]=b.useState(0),h=!!(i&&o);return gh(s.scrollbarX,()=>{const f=s.scrollbarX?.offsetHeight||0;s.onCornerHeightChange(f),c(f)}),gh(s.scrollbarY,()=>{const f=s.scrollbarY?.offsetWidth||0;s.onCornerWidthChange(f),a(f)}),h?l.jsx(on.div,{...r,ref:e,style:{width:i,height:o,position:"absolute",right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null});function M1(t){return t?parseInt(t,10):0}function jP(t,e){const n=t/e;return isNaN(n)?0:n}function Qv(t){const e=jP(t.viewport,t.content),n=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,r=(t.scrollbar.size-n)*e;return Math.max(r,18)}function Uee(t,e,n,r="ltr"){const s=Qv(n),i=s/2,a=e||i,o=s-a,c=n.scrollbar.paddingStart+a,h=n.scrollbar.size-n.scrollbar.paddingEnd-o,f=n.content-n.viewport,m=r==="ltr"?[0,f]:[f*-1,0];return OP([c,h],m)(t)}function m9(t,e,n="ltr"){const r=Qv(e),s=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,i=e.scrollbar.size-s,a=e.content-e.viewport,o=i-r,c=n==="ltr"?[0,a]:[a*-1,0],h=Yk(t,c);return OP([0,a],[0,o])(h)}function OP(t,e){return n=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const r=(e[1]-e[0])/(t[1]-t[0]);return e[0]+r*(n-t[0])}}function NP(t,e){return t>0&&t{})=>{let n={left:t.scrollLeft,top:t.scrollTop},r=0;return(function s(){const i={left:t.scrollLeft,top:t.scrollTop},a=n.left!==i.left,o=n.top!==i.top;(a||o)&&e(),n=i,r=window.requestAnimationFrame(s)})(),()=>window.cancelAnimationFrame(r)};function Hv(t,e){const n=Os(t),r=b.useRef(0);return b.useEffect(()=>()=>window.clearTimeout(r.current),[]),b.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,e)},[n,e])}function gh(t,e){const n=Os(e);Xk(()=>{let r=0;if(t){const s=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return s.observe(t),()=>{window.cancelAnimationFrame(r),s.unobserve(t)}}},[t,n])}var CP=gP,Gee=vP,Xee=kP;const hn=b.forwardRef(({className:t,children:e,viewportRef:n,...r},s)=>l.jsxs(CP,{ref:s,className:ve("relative overflow-hidden",t),...r,children:[l.jsx(Gee,{ref:n,className:"h-full w-full rounded-[inherit]",children:e}),l.jsx(H3,{}),l.jsx(H3,{orientation:"horizontal"}),l.jsx(Xee,{})]}));hn.displayName=CP.displayName;const H3=b.forwardRef(({className:t,orientation:e="vertical",...n},r)=>l.jsx(p6,{ref:r,orientation:e,className:ve("flex touch-none select-none transition-colors",e==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",e==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",t),...n,children:l.jsx(SP,{className:"relative flex-1 rounded-full bg-border"})}));H3.displayName=p6.displayName;function p9({className:t,...e}){return l.jsx("div",{className:ve("animate-pulse rounded-md bg-primary/10",t),...e})}function Yee(t,e=[]){let n=[];function r(i,a){const o=b.createContext(a);o.displayName=i+"Context";const c=n.length;n=[...n,a];const h=m=>{const{scope:g,children:x,...y}=m,w=g?.[t]?.[c]||o,S=b.useMemo(()=>y,Object.values(y));return l.jsx(w.Provider,{value:S,children:x})};h.displayName=i+"Provider";function f(m,g){const x=g?.[t]?.[c]||o,y=b.useContext(x);if(y)return y;if(a!==void 0)return a;throw new Error(`\`${m}\` must be used within \`${i}\``)}return[h,f]}const s=()=>{const i=n.map(a=>b.createContext(a));return function(o){const c=o?.[t]||i;return b.useMemo(()=>({[`__scope${t}`]:{...o,[t]:c}}),[o,c])}};return s.scopeName=t,[r,Kee(s,...e)]}function Kee(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(i){const a=r.reduce((o,{useScope:c,scopeName:h})=>{const m=c(i)[`__scope${h}`];return{...o,...m}},{});return b.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return n.scopeName=e.scopeName,n}var Zee=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],TP=Zee.reduce((t,e)=>{const n=Kk(`Primitive.${e}`),r=b.forwardRef((s,i)=>{const{asChild:a,...o}=s,c=a?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(c,{...o,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),v6="Progress",y6=100,[Jee]=Yee(v6),[ete,tte]=Jee(v6),EP=b.forwardRef((t,e)=>{const{__scopeProgress:n,value:r=null,max:s,getValueLabel:i=nte,...a}=t;(s||s===0)&&!g9(s)&&console.error(rte(`${s}`,"Progress"));const o=g9(s)?s:y6;r!==null&&!x9(r,o)&&console.error(ste(`${r}`,"Progress"));const c=x9(r,o)?r:null,h=A1(c)?i(c,o):void 0;return l.jsx(ete,{scope:n,value:c,max:o,children:l.jsx(TP.div,{"aria-valuemax":o,"aria-valuemin":0,"aria-valuenow":A1(c)?c:void 0,"aria-valuetext":h,role:"progressbar","data-state":AP(c,o),"data-value":c??void 0,"data-max":o,...a,ref:e})})});EP.displayName=v6;var _P="ProgressIndicator",MP=b.forwardRef((t,e)=>{const{__scopeProgress:n,...r}=t,s=tte(_P,n);return l.jsx(TP.div,{"data-state":AP(s.value,s.max),"data-value":s.value??void 0,"data-max":s.max,...r,ref:e})});MP.displayName=_P;function nte(t,e){return`${Math.round(t/e*100)}%`}function AP(t,e){return t==null?"indeterminate":t===e?"complete":"loading"}function A1(t){return typeof t=="number"}function g9(t){return A1(t)&&!isNaN(t)&&t>0}function x9(t,e){return A1(t)&&!isNaN(t)&&t<=e&&t>=0}function rte(t,e){return`Invalid prop \`max\` of value \`${t}\` supplied to \`${e}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${y6}\`.`}function ste(t,e){return`Invalid prop \`value\` of value \`${t}\` supplied to \`${e}\`. The \`value\` prop must be: - a positive number - - less than the value passed to \`max\` (or ${h6} if no \`max\` prop is set) + - less than the value passed to \`max\` (or ${y6} if no \`max\` prop is set) - \`null\` or \`undefined\` if the progress is indeterminate. -Defaulting to \`null\`.`}var MP=CP,rte=EP;const F0=b.forwardRef(({className:t,value:e,...n},r)=>l.jsx(MP,{ref:r,className:ye("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",t),...n,children:l.jsx(rte,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(e||0)}%)`}})}));F0.displayName=MP.displayName;const ste={light:"",dark:".dark"},AP=b.createContext(null);function RP(){const t=b.useContext(AP);if(!t)throw new Error("useChart must be used within a ");return t}const Pd=b.forwardRef(({id:t,className:e,children:n,config:r,...s},i)=>{const a=b.useId(),o=`chart-${t||a.replace(/:/g,"")}`;return l.jsx(AP.Provider,{value:{config:r},children:l.jsxs("div",{"data-chart":o,ref:i,className:ye("flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none",e),...s,children:[l.jsx(ite,{id:o,config:r}),l.jsx(mY,{children:n})]})})});Pd.displayName="Chart";const ite=({id:t,config:e})=>{const n=Object.entries(e).filter(([,r])=>r.theme||r.color);return n.length?l.jsx("style",{dangerouslySetInnerHTML:{__html:Object.entries(ste).map(([r,s])=>` +Defaulting to \`null\`.`}var RP=EP,ite=MP;const H0=b.forwardRef(({className:t,value:e,...n},r)=>l.jsx(RP,{ref:r,className:ve("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",t),...n,children:l.jsx(ite,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(e||0)}%)`}})}));H0.displayName=RP.displayName;const ate={light:"",dark:".dark"},DP=b.createContext(null);function zP(){const t=b.useContext(DP);if(!t)throw new Error("useChart must be used within a ");return t}const Id=b.forwardRef(({id:t,className:e,children:n,config:r,...s},i)=>{const a=b.useId(),o=`chart-${t||a.replace(/:/g,"")}`;return l.jsx(DP.Provider,{value:{config:r},children:l.jsxs("div",{"data-chart":o,ref:i,className:ve("flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none",e),...s,children:[l.jsx(lte,{id:o,config:r}),l.jsx(gY,{children:n})]})})});Id.displayName="Chart";const lte=({id:t,config:e})=>{const n=Object.entries(e).filter(([,r])=>r.theme||r.color);return n.length?l.jsx("style",{dangerouslySetInnerHTML:{__html:Object.entries(ate).map(([r,s])=>` ${s} [data-chart=${t}] { ${n.map(([i,a])=>{const o=a.theme?.[r]||a.color;return o?` --color-${i}: ${o};`:null}).join(` `)} } `).join(` -`)}}):null},Kf=pY,Ld=b.forwardRef(({active:t,payload:e,className:n,indicator:r="dot",hideLabel:s=!1,hideIndicator:i=!1,label:a,labelFormatter:o,labelClassName:c,formatter:h,color:f,nameKey:m,labelKey:g},x)=>{const{config:y}=RP(),w=b.useMemo(()=>{if(s||!e?.length)return null;const[k]=e,N=`${g||k?.dataKey||k?.name||"value"}`,C=B3(y,k,N),T=!g&&typeof a=="string"?y[a]?.label||a:C?.label;return o?l.jsx("div",{className:ye("font-medium",c),children:o(T,e)}):T?l.jsx("div",{className:ye("font-medium",c),children:T}):null},[a,o,e,s,c,y,g]);if(!t||!e?.length)return null;const S=e.length===1&&r!=="dot";return l.jsxs("div",{ref:x,className:ye("grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl",n),children:[S?null:w,l.jsx("div",{className:"grid gap-1.5",children:e.filter(k=>k.type!=="none").map((k,N)=>{const C=`${m||k.name||k.dataKey||"value"}`,T=B3(y,k,C),_=f||k.payload.fill||k.color;return l.jsx("div",{className:ye("flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground",r==="dot"&&"items-center"),children:h&&k?.value!==void 0&&k.name?h(k.value,k.name,k,N,k.payload):l.jsxs(l.Fragment,{children:[T?.icon?l.jsx(T.icon,{}):!i&&l.jsx("div",{className:ye("shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]",{"h-2.5 w-2.5":r==="dot","w-1":r==="line","w-0 border-[1.5px] border-dashed bg-transparent":r==="dashed","my-0.5":S&&r==="dashed"}),style:{"--color-bg":_,"--color-border":_}}),l.jsxs("div",{className:ye("flex flex-1 justify-between leading-none",S?"items-end":"items-center"),children:[l.jsxs("div",{className:"grid gap-1.5",children:[S?w:null,l.jsx("span",{className:"text-muted-foreground",children:T?.label||k.name})]}),k.value&&l.jsx("span",{className:"font-mono font-medium tabular-nums text-foreground",children:k.value.toLocaleString()})]})]})},k.dataKey)})})]})});Ld.displayName="ChartTooltip";const ate=gY,DP=b.forwardRef(({className:t,hideIcon:e=!1,payload:n,verticalAlign:r="bottom",nameKey:s},i)=>{const{config:a}=RP();return n?.length?l.jsx("div",{ref:i,className:ye("flex items-center justify-center gap-4",r==="top"?"pb-3":"pt-3",t),children:n.filter(o=>o.type!=="none").map(o=>{const c=`${s||o.dataKey||"value"}`,h=B3(a,o,c);return l.jsxs("div",{className:ye("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"),children:[h?.icon&&!e?l.jsx(h.icon,{}):l.jsx("div",{className:"h-2 w-2 shrink-0 rounded-[2px]",style:{backgroundColor:o.color}}),h?.label]},o.value)})}):null});DP.displayName="ChartLegend";function B3(t,e,n){if(typeof e!="object"||e===null)return;const r="payload"in e&&typeof e.payload=="object"&&e.payload!==null?e.payload:void 0;let s=n;return n in e&&typeof e[n]=="string"?s=e[n]:r&&n in r&&typeof r[n]=="string"&&(s=r[n]),s in t?t[s]:t[n]}const x9=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,v9=SD,Ih=(t,e)=>n=>{var r;if(e?.variants==null)return v9(t,n?.class,n?.className);const{variants:s,defaultVariants:i}=e,a=Object.keys(s).map(h=>{const f=n?.[h],m=i?.[h];if(f===null)return null;const g=x9(f)||x9(m);return s[h][g]}),o=n&&Object.entries(n).reduce((h,f)=>{let[m,g]=f;return g===void 0||(h[m]=g),h},{}),c=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((h,f)=>{let{class:m,className:g,...x}=f;return Object.entries(x).every(y=>{let[w,S]=y;return Array.isArray(S)?S.includes({...i,...o}[w]):{...i,...o}[w]===S})?[...h,m,g]:h},[]);return v9(t,a,c,n?.class,n?.className)},Qm=Ih("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),fe=b.forwardRef(({className:t,variant:e,size:n,asChild:r=!1,...s},i)=>{const a=r?fK:"button";return l.jsx(a,{className:ye(Qm({variant:e,size:n,className:t})),ref:i,...s})});fe.displayName="Button";function lte(){const[t,e]=b.useState(null),[n,r]=b.useState(!0),[s,i]=b.useState(0),[a,o]=b.useState(24),[c,h]=b.useState(!0),[f,m]=b.useState(null),[g,x]=b.useState(!0),y=b.useCallback(async()=>{try{x(!0);const L=await br.get("https://v1.hitokoto.cn/?c=a&c=b&c=c&c=d&c=h&c=i&c=k");m({hitokoto:L.data.hitokoto,from:L.data.from||L.data.from_who||"未知"})}catch(L){console.error("获取一言失败:",L),m({hitokoto:"人生就像一盒巧克力,你永远不知道下一颗是什么味道。",from:"阿甘正传"})}finally{x(!1)}},[]),w=b.useCallback(async()=>{try{const L=localStorage.getItem("access-token"),I=await br.get(`/api/webui/statistics/dashboard?hours=${a}`,{headers:{Authorization:`Bearer ${L}`}});e(I.data),r(!1),i(100)}catch(L){console.error("Failed to fetch dashboard data:",L),r(!1),i(100)}},[a]);if(b.useEffect(()=>{if(!n)return;i(0);const L=setTimeout(()=>i(15),200),I=setTimeout(()=>i(30),800),$=setTimeout(()=>i(45),2e3),V=setTimeout(()=>i(60),4e3),ee=setTimeout(()=>i(75),6500),z=setTimeout(()=>i(85),9e3),H=setTimeout(()=>i(92),11e3);return()=>{clearTimeout(L),clearTimeout(I),clearTimeout($),clearTimeout(V),clearTimeout(ee),clearTimeout(z),clearTimeout(H)}},[n]),b.useEffect(()=>{w(),y()},[w,y]),b.useEffect(()=>{if(!c)return;const L=setInterval(()=>{w()},3e4);return()=>clearInterval(L)},[c,w]),n||!t)return l.jsx("div",{className:"flex items-center justify-center h-[calc(100vh-200px)]",children:l.jsxs("div",{className:"text-center space-y-6 w-full max-w-md px-4",children:[l.jsx(ti,{className:"h-12 w-12 animate-spin mx-auto text-primary"}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("p",{className:"text-lg font-medium",children:"加载统计数据中..."}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"正在获取麦麦运行数据"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(F0,{value:s,className:"h-2"}),l.jsxs("p",{className:"text-xs text-muted-foreground",children:[s,"%"]})]})]})});const{summary:S,model_stats:k,hourly_data:N,daily_data:C,recent_activity:T}=t,_=L=>{const I=Math.floor(L/3600),$=Math.floor(L%3600/60);return`${I}小时${$}分钟`},E=L=>new Date(L).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}),M=k.slice(0,6).map(L=>({name:L.model_name,value:L.request_count,fill:`hsl(var(--chart-${k.indexOf(L)%5+1}))`})),q={requests:{label:"请求数",color:"hsl(var(--chart-1))"},cost:{label:"花费(¥)",color:"hsl(var(--chart-2))"},tokens:{label:"Tokens",color:"hsl(var(--chart-3))"}};return l.jsx(on,{className:"h-full",children:l.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[l.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[l.jsxs("div",{children:[l.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"实时监控面板"}),l.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"麦麦运行状态和统计数据一览"})]}),l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsx(na,{value:a.toString(),onValueChange:L=>o(Number(L)),children:l.jsxs(_i,{className:"grid grid-cols-3 w-full sm:w-auto",children:[l.jsx(Et,{value:"24",children:"24小时"}),l.jsx(Et,{value:"168",children:"7天"}),l.jsx(Et,{value:"720",children:"30天"})]})}),l.jsxs(fe,{variant:c?"default":"outline",size:"sm",onClick:()=>h(!c),className:"gap-2",children:[l.jsx(ti,{className:`h-4 w-4 ${c?"animate-spin":""}`}),l.jsx("span",{className:"hidden sm:inline",children:"自动刷新"})]}),l.jsx(fe,{variant:"outline",size:"sm",onClick:w,children:l.jsx(ti,{className:"h-4 w-4"})})]})]}),l.jsxs("div",{className:"grid gap-4 grid-cols-1 xs:grid-cols-2 lg:grid-cols-4",children:[l.jsxs(Tt,{children:[l.jsxs(vn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[l.jsx(yn,{className:"text-sm font-medium",children:"总请求数"}),l.jsx(NK,{className:"h-4 w-4 text-muted-foreground"})]}),l.jsxs(En,{children:[l.jsx("div",{className:"text-2xl font-bold",children:S.total_requests.toLocaleString()}),l.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["最近",a<48?a+"小时":Math.floor(a/24)+"天"]})]})]}),l.jsxs(Tt,{children:[l.jsxs(vn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[l.jsx(yn,{className:"text-sm font-medium",children:"总花费"}),l.jsx(CK,{className:"h-4 w-4 text-muted-foreground"})]}),l.jsxs(En,{children:[l.jsxs("div",{className:"text-2xl font-bold",children:["¥",S.total_cost.toFixed(2)]}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:S.cost_per_hour>0?`¥${S.cost_per_hour.toFixed(2)}/小时`:"暂无数据"})]})]}),l.jsxs(Tt,{children:[l.jsxs(vn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[l.jsx(yn,{className:"text-sm font-medium",children:"Token消耗"}),l.jsx(N3,{className:"h-4 w-4 text-muted-foreground"})]}),l.jsxs(En,{children:[l.jsxs("div",{className:"text-2xl font-bold",children:[(S.total_tokens/1e3).toFixed(1),"K"]}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:S.tokens_per_hour>0?`${(S.tokens_per_hour/1e3).toFixed(1)}K/小时`:"暂无数据"})]})]}),l.jsxs(Tt,{children:[l.jsxs(vn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[l.jsx(yn,{className:"text-sm font-medium",children:"平均响应"}),l.jsx(C3,{className:"h-4 w-4 text-muted-foreground"})]}),l.jsxs(En,{children:[l.jsxs("div",{className:"text-2xl font-bold",children:[S.avg_response_time.toFixed(2),"s"]}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"API平均耗时"})]})]})]}),l.jsxs("div",{className:"grid gap-4 grid-cols-1 sm:grid-cols-3",children:[l.jsxs(Tt,{children:[l.jsxs(vn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[l.jsx(yn,{className:"text-sm font-medium",children:"在线时长"}),l.jsx(Yd,{className:"h-4 w-4 text-muted-foreground"})]}),l.jsx(En,{children:l.jsx("div",{className:"text-xl font-bold",children:_(S.online_time)})})]}),l.jsxs(Tt,{children:[l.jsxs(vn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[l.jsx(yn,{className:"text-sm font-medium",children:"消息处理"}),l.jsx(A0,{className:"h-4 w-4 text-muted-foreground"})]}),l.jsxs(En,{children:[l.jsx("div",{className:"text-xl font-bold",children:S.total_messages.toLocaleString()}),l.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["回复 ",S.total_replies.toLocaleString()," 条"]})]})]}),l.jsxs(Tt,{children:[l.jsxs(vn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[l.jsx(yn,{className:"text-sm font-medium",children:"成本效率"}),l.jsx(TK,{className:"h-4 w-4 text-muted-foreground"})]}),l.jsxs(En,{children:[l.jsx("div",{className:"text-xl font-bold",children:S.total_messages>0?`¥${(S.total_cost/S.total_messages*100).toFixed(2)}`:"¥0.00"}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"每100条消息"})]})]})]}),l.jsxs(na,{defaultValue:"trends",className:"space-y-4",children:[l.jsxs(_i,{className:"grid w-full grid-cols-2 sm:grid-cols-4",children:[l.jsx(Et,{value:"trends",children:"趋势"}),l.jsx(Et,{value:"models",children:"模型"}),l.jsx(Et,{value:"activity",children:"活动"}),l.jsx(Et,{value:"daily",children:"日统计"})]}),l.jsxs(Kt,{value:"trends",className:"space-y-4",children:[l.jsxs(Tt,{children:[l.jsxs(vn,{children:[l.jsx(yn,{children:"请求趋势"}),l.jsxs(zr,{children:["最近",a,"小时的请求量变化"]})]}),l.jsx(En,{children:l.jsx(Pd,{config:q,className:"h-[300px] sm:h-[400px] w-full aspect-auto",children:l.jsxs(xY,{data:N,children:[l.jsx($g,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),l.jsx(Qg,{dataKey:"timestamp",tickFormatter:L=>E(L),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),l.jsx(Wf,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),l.jsx(Kf,{content:l.jsx(Ld,{labelFormatter:L=>E(L)})}),l.jsx(vY,{type:"monotone",dataKey:"requests",stroke:"var(--color-requests)",strokeWidth:2})]})})})]}),l.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-2",children:[l.jsxs(Tt,{children:[l.jsxs(vn,{children:[l.jsx(yn,{children:"花费趋势"}),l.jsx(zr,{children:"API调用成本变化"})]}),l.jsx(En,{children:l.jsx(Pd,{config:q,className:"h-[250px] sm:h-[300px] w-full aspect-auto",children:l.jsxs(Y2,{data:N,children:[l.jsx($g,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),l.jsx(Qg,{dataKey:"timestamp",tickFormatter:L=>E(L),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),l.jsx(Wf,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),l.jsx(Kf,{content:l.jsx(Ld,{labelFormatter:L=>E(L)})}),l.jsx(Hg,{dataKey:"cost",fill:"var(--color-cost)"})]})})})]}),l.jsxs(Tt,{children:[l.jsxs(vn,{children:[l.jsx(yn,{children:"Token消耗"}),l.jsx(zr,{children:"Token使用量变化"})]}),l.jsx(En,{children:l.jsx(Pd,{config:q,className:"h-[250px] sm:h-[300px] w-full aspect-auto",children:l.jsxs(Y2,{data:N,children:[l.jsx($g,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),l.jsx(Qg,{dataKey:"timestamp",tickFormatter:L=>E(L),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),l.jsx(Wf,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),l.jsx(Kf,{content:l.jsx(Ld,{labelFormatter:L=>E(L)})}),l.jsx(Hg,{dataKey:"tokens",fill:"var(--color-tokens)"})]})})})]})]})]}),l.jsx(Kt,{value:"models",className:"space-y-4",children:l.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-2",children:[l.jsxs(Tt,{children:[l.jsxs(vn,{children:[l.jsx(yn,{children:"模型请求分布"}),l.jsx(zr,{children:"各模型使用占比"})]}),l.jsx(En,{children:l.jsx(Pd,{config:Object.fromEntries(k.slice(0,6).map((L,I)=>[L.model_name,{label:L.model_name,color:`hsl(var(--chart-${I%5+1}))`}])),className:"h-[300px] sm:h-[400px] w-full aspect-auto",children:l.jsxs(yY,{children:[l.jsx(Kf,{content:l.jsx(Ld,{})}),l.jsx(bY,{data:M,cx:"50%",cy:"50%",labelLine:!1,label:({name:L,percent:I})=>`${L} ${I?(I*100).toFixed(0):0}%`,outerRadius:100,dataKey:"value",children:M.map((L,I)=>l.jsx(wY,{fill:L.fill},`cell-${I}`))})]})})})]}),l.jsxs(Tt,{children:[l.jsxs(vn,{children:[l.jsx(yn,{children:"模型详细统计"}),l.jsx(zr,{children:"请求数、花费和性能"})]}),l.jsx(En,{children:l.jsx(on,{className:"h-[300px] sm:h-[400px]",children:l.jsx("div",{className:"space-y-3",children:k.map((L,I)=>l.jsxs("div",{className:"p-4 rounded-lg border bg-card hover:bg-accent/50 transition-colors",children:[l.jsxs("div",{className:"flex items-center justify-between mb-2",children:[l.jsx("h4",{className:"font-semibold text-sm truncate flex-1 min-w-0",children:L.model_name}),l.jsx("div",{className:"w-3 h-3 rounded-full ml-2 flex-shrink-0",style:{backgroundColor:`hsl(var(--chart-${I%5+1}))`}})]}),l.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[l.jsxs("div",{children:[l.jsx("span",{className:"text-muted-foreground",children:"请求数:"}),l.jsx("span",{className:"ml-1 font-medium",children:L.request_count.toLocaleString()})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-muted-foreground",children:"花费:"}),l.jsxs("span",{className:"ml-1 font-medium",children:["¥",L.total_cost.toFixed(2)]})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-muted-foreground",children:"Tokens:"}),l.jsxs("span",{className:"ml-1 font-medium",children:[(L.total_tokens/1e3).toFixed(1),"K"]})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-muted-foreground",children:"平均耗时:"}),l.jsxs("span",{className:"ml-1 font-medium",children:[L.avg_response_time.toFixed(2),"s"]})]})]})]},I))})})})]})]})}),l.jsx(Kt,{value:"activity",children:l.jsxs(Tt,{children:[l.jsxs(vn,{children:[l.jsx(yn,{children:"最近活动"}),l.jsx(zr,{children:"最新的API调用记录"})]}),l.jsx(En,{children:l.jsx(on,{className:"h-[400px] sm:h-[500px]",children:l.jsx("div",{className:"space-y-2",children:T.map((L,I)=>l.jsxs("div",{className:"p-3 sm:p-4 rounded-lg border bg-card hover:bg-accent/50 transition-colors",children:[l.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-2 mb-2",children:[l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"font-medium text-sm truncate",children:L.model}),l.jsx("div",{className:"text-xs text-muted-foreground",children:L.request_type})]}),l.jsx("div",{className:"text-xs text-muted-foreground flex-shrink-0",children:E(L.timestamp)})]}),l.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2 text-xs",children:[l.jsxs("div",{children:[l.jsx("span",{className:"text-muted-foreground",children:"Tokens:"}),l.jsx("span",{className:"ml-1",children:L.tokens})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-muted-foreground",children:"花费:"}),l.jsxs("span",{className:"ml-1",children:["¥",L.cost.toFixed(4)]})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-muted-foreground",children:"耗时:"}),l.jsxs("span",{className:"ml-1",children:[L.time_cost.toFixed(2),"s"]})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-muted-foreground",children:"状态:"}),l.jsx("span",{className:`ml-1 ${L.status==="success"?"text-green-600":"text-red-600"}`,children:L.status})]})]})]},I))})})})]})}),l.jsx(Kt,{value:"daily",children:l.jsxs(Tt,{children:[l.jsxs(vn,{children:[l.jsx(yn,{children:"每日统计"}),l.jsx(zr,{children:"最近7天的数据汇总"})]}),l.jsx(En,{children:l.jsx(Pd,{config:{requests:{label:"请求数",color:"hsl(var(--chart-1))"},cost:{label:"花费(¥)",color:"hsl(var(--chart-2))"}},className:"h-[400px] sm:h-[500px] w-full aspect-auto",children:l.jsxs(Y2,{data:C,children:[l.jsx($g,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),l.jsx(Qg,{dataKey:"timestamp",tickFormatter:L=>{const I=new Date(L);return`${I.getMonth()+1}/${I.getDate()}`},stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),l.jsx(Wf,{yAxisId:"left",stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),l.jsx(Wf,{yAxisId:"right",orientation:"right",stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),l.jsx(Kf,{content:l.jsx(Ld,{labelFormatter:L=>new Date(L).toLocaleDateString("zh-CN")})}),l.jsx(ate,{content:l.jsx(DP,{})}),l.jsx(Hg,{yAxisId:"left",dataKey:"requests",fill:"var(--color-requests)"}),l.jsx(Hg,{yAxisId:"right",dataKey:"cost",fill:"var(--color-cost)"})]})})})]})})]}),l.jsxs(Tt,{className:"border-2 border-primary/20",children:[l.jsx(vn,{className:"pb-3",children:l.jsx(yn,{className:"text-lg",children:"每日一言"})}),l.jsx(En,{children:g?l.jsxs("div",{className:"space-y-2",children:[l.jsx(m9,{className:"h-6 w-3/4"}),l.jsx(m9,{className:"h-4 w-1/4"})]}):f?l.jsxs("div",{className:"space-y-2",children:[l.jsxs("p",{className:"text-lg font-medium leading-relaxed italic",children:['"',f.hitokoto,'"']}),l.jsxs("p",{className:"text-sm text-muted-foreground text-right",children:["—— ",f.from]})]}):null})]})]})})}const ote={theme:"system",setTheme:()=>null},zP=b.createContext(ote),f6=()=>{const t=b.useContext(zP);if(t===void 0)throw new Error("useTheme must be used within a ThemeProvider");return t},cte=(t,e,n)=>{const r=document.documentElement.classList.contains("no-animations");if(!document.startViewTransition||r){e(t);return}const s=n.clientX,i=n.clientY,a=Math.hypot(Math.max(s,innerWidth-s),Math.max(i,innerHeight-i));document.startViewTransition(()=>{e(t)}).ready.then(()=>{document.documentElement.animate({clipPath:[`circle(0px at ${s}px ${i}px)`,`circle(${a}px at ${s}px ${i}px)`]},{duration:500,easing:"ease-in-out",pseudoElement:"::view-transition-new(root)"})})},PP=b.createContext(void 0),LP=()=>{const t=b.useContext(PP);if(t===void 0)throw new Error("useAnimation must be used within an AnimationProvider");return t};var Qv="Switch",[ute]=ua(Qv),[dte,hte]=ute(Qv),IP=b.forwardRef((t,e)=>{const{__scopeSwitch:n,name:r,checked:s,defaultChecked:i,required:a,disabled:o,value:c="on",onCheckedChange:h,form:f,...m}=t,[g,x]=b.useState(null),y=Dn(e,C=>x(C)),w=b.useRef(!1),S=g?f||!!g.closest("form"):!0,[k,N]=wo({prop:s,defaultProp:i??!1,onChange:h,caller:Qv});return l.jsxs(dte,{scope:n,checked:k,disabled:o,children:[l.jsx(nn.button,{type:"button",role:"switch","aria-checked":k,"aria-required":a,"data-state":$P(k),"data-disabled":o?"":void 0,disabled:o,value:c,...m,ref:y,onClick:Ze(t.onClick,C=>{N(T=>!T),S&&(w.current=C.isPropagationStopped(),w.current||C.stopPropagation())})}),S&&l.jsx(FP,{control:g,bubbles:!w.current,name:r,value:c,checked:k,required:a,disabled:o,form:f,style:{transform:"translateX(-100%)"}})]})});IP.displayName=Qv;var BP="SwitchThumb",qP=b.forwardRef((t,e)=>{const{__scopeSwitch:n,...r}=t,s=hte(BP,n);return l.jsx(nn.span,{"data-state":$P(s.checked),"data-disabled":s.disabled?"":void 0,...r,ref:e})});qP.displayName=BP;var fte="SwitchBubbleInput",FP=b.forwardRef(({__scopeSwitch:t,control:e,checked:n,bubbles:r=!0,...s},i)=>{const a=b.useRef(null),o=Dn(a,i),c=PD(n),h=LD(e);return b.useEffect(()=>{const f=a.current;if(!f)return;const m=window.HTMLInputElement.prototype,x=Object.getOwnPropertyDescriptor(m,"checked").set;if(c!==n&&x){const y=new Event("click",{bubbles:r});x.call(f,n),f.dispatchEvent(y)}},[c,n,r]),l.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...s,tabIndex:-1,ref:o,style:{...s.style,...h,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});FP.displayName=fte;function $P(t){return t?"checked":"unchecked"}var QP=IP,mte=qP;const _t=b.forwardRef(({className:t,...e},n)=>l.jsx(QP,{className:ye("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",t),...e,ref:n,children:l.jsx(mte,{className:ye("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));_t.displayName=QP.displayName;const pte=Ih("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),de=b.forwardRef(({className:t,...e},n)=>l.jsx(ID,{ref:n,className:ye(pte(),t),...e}));de.displayName=ID.displayName;const Pe=b.forwardRef(({className:t,type:e,...n},r)=>l.jsx("input",{type:e,className:ye("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),ref:r,...n}));Pe.displayName="Input";const gte=5,xte=5e3;let lw=0;function vte(){return lw=(lw+1)%Number.MAX_SAFE_INTEGER,lw.toString()}const ow=new Map,y9=t=>{if(ow.has(t))return;const e=setTimeout(()=>{ow.delete(t),jm({type:"REMOVE_TOAST",toastId:t})},xte);ow.set(t,e)},yte=(t,e)=>{switch(e.type){case"ADD_TOAST":return{...t,toasts:[e.toast,...t.toasts].slice(0,gte)};case"UPDATE_TOAST":return{...t,toasts:t.toasts.map(n=>n.id===e.toast.id?{...n,...e.toast}:n)};case"DISMISS_TOAST":{const{toastId:n}=e;return n?y9(n):t.toasts.forEach(r=>{y9(r.id)}),{...t,toasts:t.toasts.map(r=>r.id===n||n===void 0?{...r,open:!1}:r)}}case"REMOVE_TOAST":return e.toastId===void 0?{...t,toasts:[]}:{...t,toasts:t.toasts.filter(n=>n.id!==e.toastId)}}},Zx=[];let Jx={toasts:[]};function jm(t){Jx=yte(Jx,t),Zx.forEach(e=>{e(Jx)})}function bte({...t}){const e=vte(),n=s=>jm({type:"UPDATE_TOAST",toast:{...s,id:e}}),r=()=>jm({type:"DISMISS_TOAST",toastId:e});return jm({type:"ADD_TOAST",toast:{...t,id:e,open:!0,onOpenChange:s=>{s||r()}}}),{id:e,dismiss:r,update:n}}function Gr(){const[t,e]=b.useState(Jx);return b.useEffect(()=>(Zx.push(e),()=>{const n=Zx.indexOf(e);n>-1&&Zx.splice(n,1)}),[t]),{...t,toast:bte,dismiss:n=>jm({type:"DISMISS_TOAST",toastId:n})}}const wte=[{id:"minLength",label:"长度至少 10 位",description:"Token 长度必须大于等于 10 个字符",validate:t=>t.length>=10},{id:"hasUppercase",label:"包含大写字母",description:"至少包含一个大写字母 (A-Z)",validate:t=>/[A-Z]/.test(t)},{id:"hasLowercase",label:"包含小写字母",description:"至少包含一个小写字母 (a-z)",validate:t=>/[a-z]/.test(t)},{id:"hasSpecialChar",label:"包含特殊符号",description:"至少包含一个特殊符号 (!@#$%^&*()_+-=[]{}|;:,.<>?/)",validate:t=>/[!@#$%^&*()_+\-=[\]{}|;:,.<>?/]/.test(t)}];function Ste(t){const e=wte.map(r=>({id:r.id,label:r.label,description:r.description,passed:r.validate(t)}));return{isValid:e.every(r=>r.passed),rules:e}}const m6="0.11.5",p6="MaiBot Dashboard",kte=`${p6} v${m6}`,Ote=(t="v")=>`${t}${m6}`,fr=Xk,Bh=BD,jte=Uk,g6=Tv,HP=b.forwardRef(({className:t,...e},n)=>l.jsx(Nv,{ref:n,className:ye("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e}));HP.displayName=Nv.displayName;const rr=b.forwardRef(({className:t,children:e,...n},r)=>l.jsxs(jte,{children:[l.jsx(HP,{}),l.jsxs(Cv,{ref:r,className:ye("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...n,children:[e,l.jsxs(Tv,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[l.jsx(R0,{className:"h-4 w-4"}),l.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));rr.displayName=Cv.displayName;const sr=({className:t,...e})=>l.jsx("div",{className:ye("flex flex-col space-y-1.5 text-center sm:text-left",t),...e});sr.displayName="DialogHeader";const ts=({className:t,...e})=>l.jsx("div",{className:ye("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});ts.displayName="DialogFooter";const ir=b.forwardRef(({className:t,...e},n)=>l.jsx(Wk,{ref:n,className:ye("text-lg font-semibold leading-none tracking-tight",t),...e}));ir.displayName=Wk.displayName;const Ir=b.forwardRef(({className:t,...e},n)=>l.jsx(Gk,{ref:n,className:ye("text-sm text-muted-foreground",t),...e}));Ir.displayName=Gk.displayName;var Nte=Symbol("radix.slottable");function Cte(t){const e=({children:n})=>l.jsx(l.Fragment,{children:n});return e.displayName=`${t}.Slottable`,e.__radixId=Nte,e}var VP="AlertDialog",[Tte]=ua(VP,[qD]),So=qD(),UP=t=>{const{__scopeAlertDialog:e,...n}=t,r=So(e);return l.jsx(Xk,{...r,...n,modal:!0})};UP.displayName=VP;var Ete="AlertDialogTrigger",WP=b.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=So(n);return l.jsx(BD,{...s,...r,ref:e})});WP.displayName=Ete;var _te="AlertDialogPortal",GP=t=>{const{__scopeAlertDialog:e,...n}=t,r=So(e);return l.jsx(Uk,{...r,...n})};GP.displayName=_te;var Mte="AlertDialogOverlay",XP=b.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=So(n);return l.jsx(Nv,{...s,...r,ref:e})});XP.displayName=Mte;var Zd="AlertDialogContent",[Ate,Rte]=Tte(Zd),Dte=Cte("AlertDialogContent"),YP=b.forwardRef((t,e)=>{const{__scopeAlertDialog:n,children:r,...s}=t,i=So(n),a=b.useRef(null),o=Dn(e,a),c=b.useRef(null);return l.jsx(mK,{contentName:Zd,titleName:KP,docsSlug:"alert-dialog",children:l.jsx(Ate,{scope:n,cancelRef:c,children:l.jsxs(Cv,{role:"alertdialog",...i,...s,ref:o,onOpenAutoFocus:Ze(s.onOpenAutoFocus,h=>{h.preventDefault(),c.current?.focus({preventScroll:!0})}),onPointerDownOutside:h=>h.preventDefault(),onInteractOutside:h=>h.preventDefault(),children:[l.jsx(Dte,{children:r}),l.jsx(Pte,{contentRef:a})]})})})});YP.displayName=Zd;var KP="AlertDialogTitle",ZP=b.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=So(n);return l.jsx(Wk,{...s,...r,ref:e})});ZP.displayName=KP;var JP="AlertDialogDescription",eL=b.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=So(n);return l.jsx(Gk,{...s,...r,ref:e})});eL.displayName=JP;var zte="AlertDialogAction",tL=b.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=So(n);return l.jsx(Tv,{...s,...r,ref:e})});tL.displayName=zte;var nL="AlertDialogCancel",rL=b.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,{cancelRef:s}=Rte(nL,n),i=So(n),a=Dn(e,s);return l.jsx(Tv,{...i,...r,ref:a})});rL.displayName=nL;var Pte=({contentRef:t})=>{const e=`\`${Zd}\` requires a description for the component to be accessible for screen reader users. +`)}}):null},Kf=xY,Bd=b.forwardRef(({active:t,payload:e,className:n,indicator:r="dot",hideLabel:s=!1,hideIndicator:i=!1,label:a,labelFormatter:o,labelClassName:c,formatter:h,color:f,nameKey:m,labelKey:g},x)=>{const{config:y}=zP(),w=b.useMemo(()=>{if(s||!e?.length)return null;const[k]=e,N=`${g||k?.dataKey||k?.name||"value"}`,C=V3(y,k,N),T=!g&&typeof a=="string"?y[a]?.label||a:C?.label;return o?l.jsx("div",{className:ve("font-medium",c),children:o(T,e)}):T?l.jsx("div",{className:ve("font-medium",c),children:T}):null},[a,o,e,s,c,y,g]);if(!t||!e?.length)return null;const S=e.length===1&&r!=="dot";return l.jsxs("div",{ref:x,className:ve("grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl",n),children:[S?null:w,l.jsx("div",{className:"grid gap-1.5",children:e.filter(k=>k.type!=="none").map((k,N)=>{const C=`${m||k.name||k.dataKey||"value"}`,T=V3(y,k,C),_=f||k.payload.fill||k.color;return l.jsx("div",{className:ve("flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground",r==="dot"&&"items-center"),children:h&&k?.value!==void 0&&k.name?h(k.value,k.name,k,N,k.payload):l.jsxs(l.Fragment,{children:[T?.icon?l.jsx(T.icon,{}):!i&&l.jsx("div",{className:ve("shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]",{"h-2.5 w-2.5":r==="dot","w-1":r==="line","w-0 border-[1.5px] border-dashed bg-transparent":r==="dashed","my-0.5":S&&r==="dashed"}),style:{"--color-bg":_,"--color-border":_}}),l.jsxs("div",{className:ve("flex flex-1 justify-between leading-none",S?"items-end":"items-center"),children:[l.jsxs("div",{className:"grid gap-1.5",children:[S?w:null,l.jsx("span",{className:"text-muted-foreground",children:T?.label||k.name})]}),k.value&&l.jsx("span",{className:"font-mono font-medium tabular-nums text-foreground",children:k.value.toLocaleString()})]})]})},k.dataKey)})})]})});Bd.displayName="ChartTooltip";const ote=vY,PP=b.forwardRef(({className:t,hideIcon:e=!1,payload:n,verticalAlign:r="bottom",nameKey:s},i)=>{const{config:a}=zP();return n?.length?l.jsx("div",{ref:i,className:ve("flex items-center justify-center gap-4",r==="top"?"pb-3":"pt-3",t),children:n.filter(o=>o.type!=="none").map(o=>{const c=`${s||o.dataKey||"value"}`,h=V3(a,o,c);return l.jsxs("div",{className:ve("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"),children:[h?.icon&&!e?l.jsx(h.icon,{}):l.jsx("div",{className:"h-2 w-2 shrink-0 rounded-[2px]",style:{backgroundColor:o.color}}),h?.label]},o.value)})}):null});PP.displayName="ChartLegend";function V3(t,e,n){if(typeof e!="object"||e===null)return;const r="payload"in e&&typeof e.payload=="object"&&e.payload!==null?e.payload:void 0;let s=n;return n in e&&typeof e[n]=="string"?s=e[n]:r&&n in r&&typeof r[n]=="string"&&(s=r[n]),s in t?t[s]:t[n]}const v9=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,y9=OD,Ih=(t,e)=>n=>{var r;if(e?.variants==null)return y9(t,n?.class,n?.className);const{variants:s,defaultVariants:i}=e,a=Object.keys(s).map(h=>{const f=n?.[h],m=i?.[h];if(f===null)return null;const g=v9(f)||v9(m);return s[h][g]}),o=n&&Object.entries(n).reduce((h,f)=>{let[m,g]=f;return g===void 0||(h[m]=g),h},{}),c=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((h,f)=>{let{class:m,className:g,...x}=f;return Object.entries(x).every(y=>{let[w,S]=y;return Array.isArray(S)?S.includes({...i,...o}[w]):{...i,...o}[w]===S})?[...h,m,g]:h},[]);return y9(t,a,c,n?.class,n?.className)},Hm=Ih("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),de=b.forwardRef(({className:t,variant:e,size:n,asChild:r=!1,...s},i)=>{const a=r?pK:"button";return l.jsx(a,{className:ve(Hm({variant:e,size:n,className:t})),ref:i,...s})});de.displayName="Button";function cte(){const[t,e]=b.useState(null),[n,r]=b.useState(!0),[s,i]=b.useState(0),[a,o]=b.useState(24),[c,h]=b.useState(!0),[f,m]=b.useState(null),[g,x]=b.useState(!0),y=b.useCallback(async()=>{try{x(!0);const P=await kr.get("https://v1.hitokoto.cn/?c=a&c=b&c=c&c=d&c=h&c=i&c=k");m({hitokoto:P.data.hitokoto,from:P.data.from||P.data.from_who||"未知"})}catch(P){console.error("获取一言失败:",P),m({hitokoto:"人生就像一盒巧克力,你永远不知道下一颗是什么味道。",from:"阿甘正传"})}finally{x(!1)}},[]),w=b.useCallback(async()=>{try{const P=localStorage.getItem("access-token"),I=await kr.get(`/api/webui/statistics/dashboard?hours=${a}`,{headers:{Authorization:`Bearer ${P}`}});e(I.data),r(!1),i(100)}catch(P){console.error("Failed to fetch dashboard data:",P),r(!1),i(100)}},[a]);if(b.useEffect(()=>{if(!n)return;i(0);const P=setTimeout(()=>i(15),200),I=setTimeout(()=>i(30),800),Q=setTimeout(()=>i(45),2e3),U=setTimeout(()=>i(60),4e3),ee=setTimeout(()=>i(75),6500),z=setTimeout(()=>i(85),9e3),H=setTimeout(()=>i(92),11e3);return()=>{clearTimeout(P),clearTimeout(I),clearTimeout(Q),clearTimeout(U),clearTimeout(ee),clearTimeout(z),clearTimeout(H)}},[n]),b.useEffect(()=>{w(),y()},[w,y]),b.useEffect(()=>{if(!c)return;const P=setInterval(()=>{w()},3e4);return()=>clearInterval(P)},[c,w]),n||!t)return l.jsx("div",{className:"flex items-center justify-center h-[calc(100vh-200px)]",children:l.jsxs("div",{className:"text-center space-y-6 w-full max-w-md px-4",children:[l.jsx(Ls,{className:"h-12 w-12 animate-spin mx-auto text-primary"}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("p",{className:"text-lg font-medium",children:"加载统计数据中..."}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"正在获取麦麦运行数据"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(H0,{value:s,className:"h-2"}),l.jsxs("p",{className:"text-xs text-muted-foreground",children:[s,"%"]})]})]})});const{summary:S,model_stats:k,hourly_data:N,daily_data:C,recent_activity:T}=t,_=P=>{const I=Math.floor(P/3600),Q=Math.floor(P%3600/60);return`${I}小时${Q}分钟`},E=P=>new Date(P).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}),M=k.slice(0,6).map(P=>({name:P.model_name,value:P.request_count,fill:`hsl(var(--chart-${k.indexOf(P)%5+1}))`})),L={requests:{label:"请求数",color:"hsl(var(--chart-1))"},cost:{label:"花费(¥)",color:"hsl(var(--chart-2))"},tokens:{label:"Tokens",color:"hsl(var(--chart-3))"}};return l.jsx(hn,{className:"h-full",children:l.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[l.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[l.jsxs("div",{children:[l.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"实时监控面板"}),l.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"麦麦运行状态和统计数据一览"})]}),l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsx(sa,{value:a.toString(),onValueChange:P=>o(Number(P)),children:l.jsxs(Mi,{className:"grid grid-cols-3 w-full sm:w-auto",children:[l.jsx(zt,{value:"24",children:"24小时"}),l.jsx(zt,{value:"168",children:"7天"}),l.jsx(zt,{value:"720",children:"30天"})]})}),l.jsxs(de,{variant:c?"default":"outline",size:"sm",onClick:()=>h(!c),className:"gap-2",children:[l.jsx(Ls,{className:`h-4 w-4 ${c?"animate-spin":""}`}),l.jsx("span",{className:"hidden sm:inline",children:"自动刷新"})]}),l.jsx(de,{variant:"outline",size:"sm",onClick:w,children:l.jsx(Ls,{className:"h-4 w-4"})})]})]}),l.jsxs("div",{className:"grid gap-4 grid-cols-1 xs:grid-cols-2 lg:grid-cols-4",children:[l.jsxs(Dt,{children:[l.jsxs(kn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[l.jsx(jn,{className:"text-sm font-medium",children:"总请求数"}),l.jsx(TK,{className:"h-4 w-4 text-muted-foreground"})]}),l.jsxs(Dn,{children:[l.jsx("div",{className:"text-2xl font-bold",children:S.total_requests.toLocaleString()}),l.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["最近",a<48?a+"小时":Math.floor(a/24)+"天"]})]})]}),l.jsxs(Dt,{children:[l.jsxs(kn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[l.jsx(jn,{className:"text-sm font-medium",children:"总花费"}),l.jsx(EK,{className:"h-4 w-4 text-muted-foreground"})]}),l.jsxs(Dn,{children:[l.jsxs("div",{className:"text-2xl font-bold",children:["¥",S.total_cost.toFixed(2)]}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:S.cost_per_hour>0?`¥${S.cost_per_hour.toFixed(2)}/小时`:"暂无数据"})]})]}),l.jsxs(Dt,{children:[l.jsxs(kn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[l.jsx(jn,{className:"text-sm font-medium",children:"Token消耗"}),l.jsx(A3,{className:"h-4 w-4 text-muted-foreground"})]}),l.jsxs(Dn,{children:[l.jsxs("div",{className:"text-2xl font-bold",children:[(S.total_tokens/1e3).toFixed(1),"K"]}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:S.tokens_per_hour>0?`${(S.tokens_per_hour/1e3).toFixed(1)}K/小时`:"暂无数据"})]})]}),l.jsxs(Dt,{children:[l.jsxs(kn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[l.jsx(jn,{className:"text-sm font-medium",children:"平均响应"}),l.jsx(R3,{className:"h-4 w-4 text-muted-foreground"})]}),l.jsxs(Dn,{children:[l.jsxs("div",{className:"text-2xl font-bold",children:[S.avg_response_time.toFixed(2),"s"]}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"API平均耗时"})]})]})]}),l.jsxs("div",{className:"grid gap-4 grid-cols-1 sm:grid-cols-3",children:[l.jsxs(Dt,{children:[l.jsxs(kn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[l.jsx(jn,{className:"text-sm font-medium",children:"在线时长"}),l.jsx(Zd,{className:"h-4 w-4 text-muted-foreground"})]}),l.jsx(Dn,{children:l.jsx("div",{className:"text-xl font-bold",children:_(S.online_time)})})]}),l.jsxs(Dt,{children:[l.jsxs(kn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[l.jsx(jn,{className:"text-sm font-medium",children:"消息处理"}),l.jsx(z0,{className:"h-4 w-4 text-muted-foreground"})]}),l.jsxs(Dn,{children:[l.jsx("div",{className:"text-xl font-bold",children:S.total_messages.toLocaleString()}),l.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["回复 ",S.total_replies.toLocaleString()," 条"]})]})]}),l.jsxs(Dt,{children:[l.jsxs(kn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[l.jsx(jn,{className:"text-sm font-medium",children:"成本效率"}),l.jsx(_K,{className:"h-4 w-4 text-muted-foreground"})]}),l.jsxs(Dn,{children:[l.jsx("div",{className:"text-xl font-bold",children:S.total_messages>0?`¥${(S.total_cost/S.total_messages*100).toFixed(2)}`:"¥0.00"}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"每100条消息"})]})]})]}),l.jsxs(sa,{defaultValue:"trends",className:"space-y-4",children:[l.jsxs(Mi,{className:"grid w-full grid-cols-2 sm:grid-cols-4",children:[l.jsx(zt,{value:"trends",children:"趋势"}),l.jsx(zt,{value:"models",children:"模型"}),l.jsx(zt,{value:"activity",children:"活动"}),l.jsx(zt,{value:"daily",children:"日统计"})]}),l.jsxs(tn,{value:"trends",className:"space-y-4",children:[l.jsxs(Dt,{children:[l.jsxs(kn,{children:[l.jsx(jn,{children:"请求趋势"}),l.jsxs(Fr,{children:["最近",a,"小时的请求量变化"]})]}),l.jsx(Dn,{children:l.jsx(Id,{config:L,className:"h-[300px] sm:h-[400px] w-full aspect-auto",children:l.jsxs(yY,{data:N,children:[l.jsx(Vg,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),l.jsx(Ug,{dataKey:"timestamp",tickFormatter:P=>E(P),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),l.jsx(Wf,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),l.jsx(Kf,{content:l.jsx(Bd,{labelFormatter:P=>E(P)})}),l.jsx(bY,{type:"monotone",dataKey:"requests",stroke:"var(--color-requests)",strokeWidth:2})]})})})]}),l.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-2",children:[l.jsxs(Dt,{children:[l.jsxs(kn,{children:[l.jsx(jn,{children:"花费趋势"}),l.jsx(Fr,{children:"API调用成本变化"})]}),l.jsx(Dn,{children:l.jsx(Id,{config:L,className:"h-[250px] sm:h-[300px] w-full aspect-auto",children:l.jsxs(nw,{data:N,children:[l.jsx(Vg,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),l.jsx(Ug,{dataKey:"timestamp",tickFormatter:P=>E(P),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),l.jsx(Wf,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),l.jsx(Kf,{content:l.jsx(Bd,{labelFormatter:P=>E(P)})}),l.jsx(Wg,{dataKey:"cost",fill:"var(--color-cost)"})]})})})]}),l.jsxs(Dt,{children:[l.jsxs(kn,{children:[l.jsx(jn,{children:"Token消耗"}),l.jsx(Fr,{children:"Token使用量变化"})]}),l.jsx(Dn,{children:l.jsx(Id,{config:L,className:"h-[250px] sm:h-[300px] w-full aspect-auto",children:l.jsxs(nw,{data:N,children:[l.jsx(Vg,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),l.jsx(Ug,{dataKey:"timestamp",tickFormatter:P=>E(P),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),l.jsx(Wf,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),l.jsx(Kf,{content:l.jsx(Bd,{labelFormatter:P=>E(P)})}),l.jsx(Wg,{dataKey:"tokens",fill:"var(--color-tokens)"})]})})})]})]})]}),l.jsx(tn,{value:"models",className:"space-y-4",children:l.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-2",children:[l.jsxs(Dt,{children:[l.jsxs(kn,{children:[l.jsx(jn,{children:"模型请求分布"}),l.jsx(Fr,{children:"各模型使用占比"})]}),l.jsx(Dn,{children:l.jsx(Id,{config:Object.fromEntries(k.slice(0,6).map((P,I)=>[P.model_name,{label:P.model_name,color:`hsl(var(--chart-${I%5+1}))`}])),className:"h-[300px] sm:h-[400px] w-full aspect-auto",children:l.jsxs(wY,{children:[l.jsx(Kf,{content:l.jsx(Bd,{})}),l.jsx(SY,{data:M,cx:"50%",cy:"50%",labelLine:!1,label:({name:P,percent:I})=>`${P} ${I?(I*100).toFixed(0):0}%`,outerRadius:100,dataKey:"value",children:M.map((P,I)=>l.jsx(kY,{fill:P.fill},`cell-${I}`))})]})})})]}),l.jsxs(Dt,{children:[l.jsxs(kn,{children:[l.jsx(jn,{children:"模型详细统计"}),l.jsx(Fr,{children:"请求数、花费和性能"})]}),l.jsx(Dn,{children:l.jsx(hn,{className:"h-[300px] sm:h-[400px]",children:l.jsx("div",{className:"space-y-3",children:k.map((P,I)=>l.jsxs("div",{className:"p-4 rounded-lg border bg-card hover:bg-accent/50 transition-colors",children:[l.jsxs("div",{className:"flex items-center justify-between mb-2",children:[l.jsx("h4",{className:"font-semibold text-sm truncate flex-1 min-w-0",children:P.model_name}),l.jsx("div",{className:"w-3 h-3 rounded-full ml-2 flex-shrink-0",style:{backgroundColor:`hsl(var(--chart-${I%5+1}))`}})]}),l.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[l.jsxs("div",{children:[l.jsx("span",{className:"text-muted-foreground",children:"请求数:"}),l.jsx("span",{className:"ml-1 font-medium",children:P.request_count.toLocaleString()})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-muted-foreground",children:"花费:"}),l.jsxs("span",{className:"ml-1 font-medium",children:["¥",P.total_cost.toFixed(2)]})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-muted-foreground",children:"Tokens:"}),l.jsxs("span",{className:"ml-1 font-medium",children:[(P.total_tokens/1e3).toFixed(1),"K"]})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-muted-foreground",children:"平均耗时:"}),l.jsxs("span",{className:"ml-1 font-medium",children:[P.avg_response_time.toFixed(2),"s"]})]})]})]},I))})})})]})]})}),l.jsx(tn,{value:"activity",children:l.jsxs(Dt,{children:[l.jsxs(kn,{children:[l.jsx(jn,{children:"最近活动"}),l.jsx(Fr,{children:"最新的API调用记录"})]}),l.jsx(Dn,{children:l.jsx(hn,{className:"h-[400px] sm:h-[500px]",children:l.jsx("div",{className:"space-y-2",children:T.map((P,I)=>l.jsxs("div",{className:"p-3 sm:p-4 rounded-lg border bg-card hover:bg-accent/50 transition-colors",children:[l.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-2 mb-2",children:[l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"font-medium text-sm truncate",children:P.model}),l.jsx("div",{className:"text-xs text-muted-foreground",children:P.request_type})]}),l.jsx("div",{className:"text-xs text-muted-foreground flex-shrink-0",children:E(P.timestamp)})]}),l.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2 text-xs",children:[l.jsxs("div",{children:[l.jsx("span",{className:"text-muted-foreground",children:"Tokens:"}),l.jsx("span",{className:"ml-1",children:P.tokens})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-muted-foreground",children:"花费:"}),l.jsxs("span",{className:"ml-1",children:["¥",P.cost.toFixed(4)]})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-muted-foreground",children:"耗时:"}),l.jsxs("span",{className:"ml-1",children:[P.time_cost.toFixed(2),"s"]})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-muted-foreground",children:"状态:"}),l.jsx("span",{className:`ml-1 ${P.status==="success"?"text-green-600":"text-red-600"}`,children:P.status})]})]})]},I))})})})]})}),l.jsx(tn,{value:"daily",children:l.jsxs(Dt,{children:[l.jsxs(kn,{children:[l.jsx(jn,{children:"每日统计"}),l.jsx(Fr,{children:"最近7天的数据汇总"})]}),l.jsx(Dn,{children:l.jsx(Id,{config:{requests:{label:"请求数",color:"hsl(var(--chart-1))"},cost:{label:"花费(¥)",color:"hsl(var(--chart-2))"}},className:"h-[400px] sm:h-[500px] w-full aspect-auto",children:l.jsxs(nw,{data:C,children:[l.jsx(Vg,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),l.jsx(Ug,{dataKey:"timestamp",tickFormatter:P=>{const I=new Date(P);return`${I.getMonth()+1}/${I.getDate()}`},stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),l.jsx(Wf,{yAxisId:"left",stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),l.jsx(Wf,{yAxisId:"right",orientation:"right",stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),l.jsx(Kf,{content:l.jsx(Bd,{labelFormatter:P=>new Date(P).toLocaleDateString("zh-CN")})}),l.jsx(ote,{content:l.jsx(PP,{})}),l.jsx(Wg,{yAxisId:"left",dataKey:"requests",fill:"var(--color-requests)"}),l.jsx(Wg,{yAxisId:"right",dataKey:"cost",fill:"var(--color-cost)"})]})})})]})})]}),l.jsxs(Dt,{className:"border-2 border-primary/20",children:[l.jsx(kn,{className:"pb-3",children:l.jsx(jn,{className:"text-lg",children:"每日一言"})}),l.jsx(Dn,{children:g?l.jsxs("div",{className:"space-y-2",children:[l.jsx(p9,{className:"h-6 w-3/4"}),l.jsx(p9,{className:"h-4 w-1/4"})]}):f?l.jsxs("div",{className:"space-y-2",children:[l.jsxs("p",{className:"text-lg font-medium leading-relaxed italic",children:['"',f.hitokoto,'"']}),l.jsxs("p",{className:"text-sm text-muted-foreground text-right",children:["—— ",f.from]})]}):null})]})]})})}const ute={theme:"system",setTheme:()=>null},LP=b.createContext(ute),b6=()=>{const t=b.useContext(LP);if(t===void 0)throw new Error("useTheme must be used within a ThemeProvider");return t},dte=(t,e,n)=>{const r=document.documentElement.classList.contains("no-animations");if(!document.startViewTransition||r){e(t);return}const s=n.clientX,i=n.clientY,a=Math.hypot(Math.max(s,innerWidth-s),Math.max(i,innerHeight-i));document.startViewTransition(()=>{e(t)}).ready.then(()=>{document.documentElement.animate({clipPath:[`circle(0px at ${s}px ${i}px)`,`circle(${a}px at ${s}px ${i}px)`]},{duration:500,easing:"ease-in-out",pseudoElement:"::view-transition-new(root)"})})},IP=b.createContext(void 0),BP=()=>{const t=b.useContext(IP);if(t===void 0)throw new Error("useAnimation must be used within an AnimationProvider");return t};var Vv="Switch",[hte]=ha(Vv),[fte,mte]=hte(Vv),qP=b.forwardRef((t,e)=>{const{__scopeSwitch:n,name:r,checked:s,defaultChecked:i,required:a,disabled:o,value:c="on",onCheckedChange:h,form:f,...m}=t,[g,x]=b.useState(null),y=Bn(e,C=>x(C)),w=b.useRef(!1),S=g?f||!!g.closest("form"):!0,[k,N]=wo({prop:s,defaultProp:i??!1,onChange:h,caller:Vv});return l.jsxs(fte,{scope:n,checked:k,disabled:o,children:[l.jsx(on.button,{type:"button",role:"switch","aria-checked":k,"aria-required":a,"data-state":HP(k),"data-disabled":o?"":void 0,disabled:o,value:c,...m,ref:y,onClick:tt(t.onClick,C=>{N(T=>!T),S&&(w.current=C.isPropagationStopped(),w.current||C.stopPropagation())})}),S&&l.jsx(QP,{control:g,bubbles:!w.current,name:r,value:c,checked:k,required:a,disabled:o,form:f,style:{transform:"translateX(-100%)"}})]})});qP.displayName=Vv;var FP="SwitchThumb",$P=b.forwardRef((t,e)=>{const{__scopeSwitch:n,...r}=t,s=mte(FP,n);return l.jsx(on.span,{"data-state":HP(s.checked),"data-disabled":s.disabled?"":void 0,...r,ref:e})});$P.displayName=FP;var pte="SwitchBubbleInput",QP=b.forwardRef(({__scopeSwitch:t,control:e,checked:n,bubbles:r=!0,...s},i)=>{const a=b.useRef(null),o=Bn(a,i),c=BD(n),h=qD(e);return b.useEffect(()=>{const f=a.current;if(!f)return;const m=window.HTMLInputElement.prototype,x=Object.getOwnPropertyDescriptor(m,"checked").set;if(c!==n&&x){const y=new Event("click",{bubbles:r});x.call(f,n),f.dispatchEvent(y)}},[c,n,r]),l.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...s,tabIndex:-1,ref:o,style:{...s.style,...h,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});QP.displayName=pte;function HP(t){return t?"checked":"unchecked"}var VP=qP,gte=$P;const Pt=b.forwardRef(({className:t,...e},n)=>l.jsx(VP,{className:ve("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",t),...e,ref:n,children:l.jsx(gte,{className:ve("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));Pt.displayName=VP.displayName;const xte=Ih("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),ue=b.forwardRef(({className:t,...e},n)=>l.jsx(FD,{ref:n,className:ve(xte(),t),...e}));ue.displayName=FD.displayName;const Pe=b.forwardRef(({className:t,type:e,...n},r)=>l.jsx("input",{type:e,className:ve("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),ref:r,...n}));Pe.displayName="Input";const vte=5,yte=5e3;let fw=0;function bte(){return fw=(fw+1)%Number.MAX_SAFE_INTEGER,fw.toString()}const mw=new Map,b9=t=>{if(mw.has(t))return;const e=setTimeout(()=>{mw.delete(t),Nm({type:"REMOVE_TOAST",toastId:t})},yte);mw.set(t,e)},wte=(t,e)=>{switch(e.type){case"ADD_TOAST":return{...t,toasts:[e.toast,...t.toasts].slice(0,vte)};case"UPDATE_TOAST":return{...t,toasts:t.toasts.map(n=>n.id===e.toast.id?{...n,...e.toast}:n)};case"DISMISS_TOAST":{const{toastId:n}=e;return n?b9(n):t.toasts.forEach(r=>{b9(r.id)}),{...t,toasts:t.toasts.map(r=>r.id===n||n===void 0?{...r,open:!1}:r)}}case"REMOVE_TOAST":return e.toastId===void 0?{...t,toasts:[]}:{...t,toasts:t.toasts.filter(n=>n.id!==e.toastId)}}},e1=[];let t1={toasts:[]};function Nm(t){t1=wte(t1,t),e1.forEach(e=>{e(t1)})}function Ste({...t}){const e=bte(),n=s=>Nm({type:"UPDATE_TOAST",toast:{...s,id:e}}),r=()=>Nm({type:"DISMISS_TOAST",toastId:e});return Nm({type:"ADD_TOAST",toast:{...t,id:e,open:!0,onOpenChange:s=>{s||r()}}}),{id:e,dismiss:r,update:n}}function ts(){const[t,e]=b.useState(t1);return b.useEffect(()=>(e1.push(e),()=>{const n=e1.indexOf(e);n>-1&&e1.splice(n,1)}),[t]),{...t,toast:Ste,dismiss:n=>Nm({type:"DISMISS_TOAST",toastId:n})}}const kte=[{id:"minLength",label:"长度至少 10 位",description:"Token 长度必须大于等于 10 个字符",validate:t=>t.length>=10},{id:"hasUppercase",label:"包含大写字母",description:"至少包含一个大写字母 (A-Z)",validate:t=>/[A-Z]/.test(t)},{id:"hasLowercase",label:"包含小写字母",description:"至少包含一个小写字母 (a-z)",validate:t=>/[a-z]/.test(t)},{id:"hasSpecialChar",label:"包含特殊符号",description:"至少包含一个特殊符号 (!@#$%^&*()_+-=[]{}|;:,.<>?/)",validate:t=>/[!@#$%^&*()_+\-=[\]{}|;:,.<>?/]/.test(t)}];function jte(t){const e=kte.map(r=>({id:r.id,label:r.label,description:r.description,passed:r.validate(t)}));return{isValid:e.every(r=>r.passed),rules:e}}const w6="0.11.5",S6="MaiBot Dashboard",Ote=`${S6} v${w6}`,Nte=(t="v")=>`${t}${w6}`,xr=t6,Bh=$D,Cte=Zk,k6=_v,UP=b.forwardRef(({className:t,...e},n)=>l.jsx(Tv,{ref:n,className:ve("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e}));UP.displayName=Tv.displayName;const lr=b.forwardRef(({className:t,children:e,...n},r)=>l.jsxs(Cte,{children:[l.jsx(UP,{}),l.jsxs(Ev,{ref:r,className:ve("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...n,children:[e,l.jsxs(_v,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[l.jsx(P0,{className:"h-4 w-4"}),l.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));lr.displayName=Ev.displayName;const or=({className:t,...e})=>l.jsx("div",{className:ve("flex flex-col space-y-1.5 text-center sm:text-left",t),...e});or.displayName="DialogHeader";const as=({className:t,...e})=>l.jsx("div",{className:ve("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});as.displayName="DialogFooter";const cr=b.forwardRef(({className:t,...e},n)=>l.jsx(Jk,{ref:n,className:ve("text-lg font-semibold leading-none tracking-tight",t),...e}));cr.displayName=Jk.displayName;const Hr=b.forwardRef(({className:t,...e},n)=>l.jsx(e6,{ref:n,className:ve("text-sm text-muted-foreground",t),...e}));Hr.displayName=e6.displayName;var Tte=Symbol("radix.slottable");function Ete(t){const e=({children:n})=>l.jsx(l.Fragment,{children:n});return e.displayName=`${t}.Slottable`,e.__radixId=Tte,e}var WP="AlertDialog",[_te]=ha(WP,[QD]),So=QD(),GP=t=>{const{__scopeAlertDialog:e,...n}=t,r=So(e);return l.jsx(t6,{...r,...n,modal:!0})};GP.displayName=WP;var Mte="AlertDialogTrigger",XP=b.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=So(n);return l.jsx($D,{...s,...r,ref:e})});XP.displayName=Mte;var Ate="AlertDialogPortal",YP=t=>{const{__scopeAlertDialog:e,...n}=t,r=So(e);return l.jsx(Zk,{...r,...n})};YP.displayName=Ate;var Rte="AlertDialogOverlay",KP=b.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=So(n);return l.jsx(Tv,{...s,...r,ref:e})});KP.displayName=Rte;var eh="AlertDialogContent",[Dte,zte]=_te(eh),Pte=Ete("AlertDialogContent"),ZP=b.forwardRef((t,e)=>{const{__scopeAlertDialog:n,children:r,...s}=t,i=So(n),a=b.useRef(null),o=Bn(e,a),c=b.useRef(null);return l.jsx(gK,{contentName:eh,titleName:JP,docsSlug:"alert-dialog",children:l.jsx(Dte,{scope:n,cancelRef:c,children:l.jsxs(Ev,{role:"alertdialog",...i,...s,ref:o,onOpenAutoFocus:tt(s.onOpenAutoFocus,h=>{h.preventDefault(),c.current?.focus({preventScroll:!0})}),onPointerDownOutside:h=>h.preventDefault(),onInteractOutside:h=>h.preventDefault(),children:[l.jsx(Pte,{children:r}),l.jsx(Ite,{contentRef:a})]})})})});ZP.displayName=eh;var JP="AlertDialogTitle",eL=b.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=So(n);return l.jsx(Jk,{...s,...r,ref:e})});eL.displayName=JP;var tL="AlertDialogDescription",nL=b.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=So(n);return l.jsx(e6,{...s,...r,ref:e})});nL.displayName=tL;var Lte="AlertDialogAction",rL=b.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=So(n);return l.jsx(_v,{...s,...r,ref:e})});rL.displayName=Lte;var sL="AlertDialogCancel",iL=b.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,{cancelRef:s}=zte(sL,n),i=So(n),a=Bn(e,s);return l.jsx(_v,{...i,...r,ref:a})});iL.displayName=sL;var Ite=({contentRef:t})=>{const e=`\`${eh}\` requires a description for the component to be accessible for screen reader users. -You can add a description to the \`${Zd}\` by passing a \`${JP}\` component as a child, which also benefits sighted users by adding visible context to the dialog. +You can add a description to the \`${eh}\` by passing a \`${tL}\` component as a child, which also benefits sighted users by adding visible context to the dialog. -Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${Zd}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component. +Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${eh}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component. -For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return b.useEffect(()=>{document.getElementById(t.current?.getAttribute("aria-describedby"))||console.warn(e)},[e,t]),null},Lte=UP,Ite=WP,Bte=GP,sL=XP,iL=YP,aL=tL,lL=rL,oL=ZP,cL=eL;const wn=Lte,Lr=Ite,qte=Bte,uL=b.forwardRef(({className:t,...e},n)=>l.jsx(sL,{className:ye("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e,ref:n}));uL.displayName=sL.displayName;const un=b.forwardRef(({className:t,...e},n)=>l.jsxs(qte,{children:[l.jsx(uL,{}),l.jsx(iL,{ref:n,className:ye("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...e})]}));un.displayName=iL.displayName;const dn=({className:t,...e})=>l.jsx("div",{className:ye("flex flex-col space-y-2 text-center sm:text-left",t),...e});dn.displayName="AlertDialogHeader";const hn=({className:t,...e})=>l.jsx("div",{className:ye("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});hn.displayName="AlertDialogFooter";const fn=b.forwardRef(({className:t,...e},n)=>l.jsx(oL,{ref:n,className:ye("text-lg font-semibold",t),...e}));fn.displayName=oL.displayName;const mn=b.forwardRef(({className:t,...e},n)=>l.jsx(cL,{ref:n,className:ye("text-sm text-muted-foreground",t),...e}));mn.displayName=cL.displayName;const pn=b.forwardRef(({className:t,...e},n)=>l.jsx(aL,{ref:n,className:ye(Qm(),t),...e}));pn.displayName=aL.displayName;const gn=b.forwardRef(({className:t,...e},n)=>l.jsx(lL,{ref:n,className:ye(Qm({variant:"outline"}),"mt-2 sm:mt-0",t),...e}));gn.displayName=lL.displayName;function Fte(){return l.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[l.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:l.jsxs("div",{children:[l.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"系统设置"}),l.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理您的应用偏好设置"})]})}),l.jsxs(na,{defaultValue:"appearance",className:"w-full",children:[l.jsxs(_i,{className:"grid w-full grid-cols-2 sm:grid-cols-4 gap-0.5 sm:gap-1 h-auto p-1",children:[l.jsxs(Et,{value:"appearance",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[l.jsx(tz,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),l.jsx("span",{children:"外观"})]}),l.jsxs(Et,{value:"security",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[l.jsx(EK,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),l.jsx("span",{children:"安全"})]}),l.jsxs(Et,{value:"other",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[l.jsx(yu,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),l.jsx("span",{children:"其他"})]}),l.jsxs(Et,{value:"about",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[l.jsx(Oa,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),l.jsx("span",{children:"关于"})]})]}),l.jsxs(on,{className:"h-[calc(100vh-240px)] sm:h-[calc(100vh-280px)] mt-4 sm:mt-6",children:[l.jsx(Kt,{value:"appearance",className:"mt-0",children:l.jsx($te,{})}),l.jsx(Kt,{value:"security",className:"mt-0",children:l.jsx(Qte,{})}),l.jsx(Kt,{value:"other",className:"mt-0",children:l.jsx(Hte,{})}),l.jsx(Kt,{value:"about",className:"mt-0",children:l.jsx(Vte,{})})]})]})]})}function b9(t){const e=document.documentElement,r={blue:{hsl:"221.2 83.2% 53.3%",darkHsl:"217.2 91.2% 59.8%",gradient:null},purple:{hsl:"271 91% 65%",darkHsl:"270 95% 75%",gradient:null},green:{hsl:"142 71% 45%",darkHsl:"142 76% 36%",gradient:null},orange:{hsl:"25 95% 53%",darkHsl:"20 90% 48%",gradient:null},pink:{hsl:"330 81% 60%",darkHsl:"330 85% 70%",gradient:null},red:{hsl:"0 84% 60%",darkHsl:"0 90% 70%",gradient:null},"gradient-sunset":{hsl:"15 95% 60%",darkHsl:"15 95% 65%",gradient:"linear-gradient(135deg, hsl(25 95% 53%) 0%, hsl(330 81% 60%) 100%)"},"gradient-ocean":{hsl:"200 90% 55%",darkHsl:"200 90% 60%",gradient:"linear-gradient(135deg, hsl(221.2 83.2% 53.3%) 0%, hsl(189 94% 43%) 100%)"},"gradient-forest":{hsl:"150 70% 45%",darkHsl:"150 75% 40%",gradient:"linear-gradient(135deg, hsl(142 71% 45%) 0%, hsl(158 64% 52%) 100%)"},"gradient-aurora":{hsl:"310 85% 65%",darkHsl:"310 90% 70%",gradient:"linear-gradient(135deg, hsl(271 91% 65%) 0%, hsl(330 81% 60%) 100%)"},"gradient-fire":{hsl:"15 95% 55%",darkHsl:"15 95% 60%",gradient:"linear-gradient(135deg, hsl(0 84% 60%) 0%, hsl(25 95% 53%) 100%)"},"gradient-twilight":{hsl:"250 90% 60%",darkHsl:"250 95% 65%",gradient:"linear-gradient(135deg, hsl(239 84% 67%) 0%, hsl(271 91% 65%) 100%)"}}[t];if(r)e.style.setProperty("--primary",r.hsl),r.gradient?(e.style.setProperty("--primary-gradient",r.gradient),e.classList.add("has-gradient")):(e.style.removeProperty("--primary-gradient"),e.classList.remove("has-gradient"));else if(t.startsWith("#")){const s=i=>{i=i.replace("#","");const a=parseInt(i.substring(0,2),16)/255,o=parseInt(i.substring(2,4),16)/255,c=parseInt(i.substring(4,6),16)/255,h=Math.max(a,o,c),f=Math.min(a,o,c);let m=0,g=0;const x=(h+f)/2;if(h!==f){const y=h-f;switch(g=x>.5?y/(2-h-f):y/(h+f),h){case a:m=((o-c)/y+(olocalStorage.getItem("accent-color")||"blue");b.useEffect(()=>{const h=localStorage.getItem("accent-color")||"blue";b9(h)},[]);const c=h=>{o(h),localStorage.setItem("accent-color",h),b9(h)};return l.jsxs("div",{className:"space-y-6 sm:space-y-8",children:[l.jsxs("div",{children:[l.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"主题模式"}),l.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3 sm:gap-4",children:[l.jsx(cw,{value:"light",current:t,onChange:e,label:"浅色",description:"始终使用浅色主题"}),l.jsx(cw,{value:"dark",current:t,onChange:e,label:"深色",description:"始终使用深色主题"}),l.jsx(cw,{value:"system",current:t,onChange:e,label:"跟随系统",description:"根据系统设置自动切换"})]})]}),l.jsxs("div",{children:[l.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"主题色"}),l.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[l.jsxs("div",{children:[l.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"单色"}),l.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-6 gap-2 sm:gap-3",children:[l.jsx(Ui,{value:"blue",current:a,onChange:c,label:"蓝色",colorClass:"bg-blue-500"}),l.jsx(Ui,{value:"purple",current:a,onChange:c,label:"紫色",colorClass:"bg-purple-500"}),l.jsx(Ui,{value:"green",current:a,onChange:c,label:"绿色",colorClass:"bg-green-500"}),l.jsx(Ui,{value:"orange",current:a,onChange:c,label:"橙色",colorClass:"bg-orange-500"}),l.jsx(Ui,{value:"pink",current:a,onChange:c,label:"粉色",colorClass:"bg-pink-500"}),l.jsx(Ui,{value:"red",current:a,onChange:c,label:"红色",colorClass:"bg-red-500"})]})]}),l.jsxs("div",{children:[l.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"渐变色"}),l.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-6 gap-2 sm:gap-3",children:[l.jsx(Ui,{value:"gradient-sunset",current:a,onChange:c,label:"日落",colorClass:"bg-gradient-to-r from-orange-500 to-pink-500"}),l.jsx(Ui,{value:"gradient-ocean",current:a,onChange:c,label:"海洋",colorClass:"bg-gradient-to-r from-blue-500 to-cyan-500"}),l.jsx(Ui,{value:"gradient-forest",current:a,onChange:c,label:"森林",colorClass:"bg-gradient-to-r from-green-500 to-emerald-500"}),l.jsx(Ui,{value:"gradient-aurora",current:a,onChange:c,label:"极光",colorClass:"bg-gradient-to-r from-purple-500 to-pink-500"}),l.jsx(Ui,{value:"gradient-fire",current:a,onChange:c,label:"烈焰",colorClass:"bg-gradient-to-r from-red-500 to-orange-500"}),l.jsx(Ui,{value:"gradient-twilight",current:a,onChange:c,label:"暮光",colorClass:"bg-gradient-to-r from-indigo-500 to-purple-500"})]})]}),l.jsxs("div",{children:[l.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"自定义颜色"}),l.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 sm:gap-4",children:[l.jsx("div",{className:"flex-1",children:l.jsx("input",{type:"color",value:a.startsWith("#")?a:"#3b82f6",onChange:h=>c(h.target.value),className:"h-10 sm:h-12 w-full rounded-lg border-2 border-border cursor-pointer",title:"选择自定义颜色"})}),l.jsx("div",{className:"flex-1",children:l.jsx(Pe,{type:"text",value:a,onChange:h=>c(h.target.value),placeholder:"#3b82f6",className:"font-mono text-sm"})})]}),l.jsx("p",{className:"text-[10px] sm:text-xs text-muted-foreground mt-2",children:"点击色块选择颜色,或手动输入 HEX 颜色代码"})]})]})]}),l.jsxs("div",{children:[l.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"动画效果"}),l.jsxs("div",{className:"space-y-2 sm:space-y-3",children:[l.jsx("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"space-y-0.5 flex-1",children:[l.jsx(de,{htmlFor:"animations",className:"text-base font-medium cursor-pointer",children:"启用动画效果"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭后将禁用所有过渡动画和特效,提升性能"})]}),l.jsx(_t,{id:"animations",checked:n,onCheckedChange:r})]})}),l.jsx("div",{className:"rounded-lg border bg-card p-4",children:l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"space-y-0.5 flex-1",children:[l.jsx(de,{htmlFor:"waves-background",className:"text-base font-medium cursor-pointer",children:"登录页波浪背景"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭后登录页将使用纯色背景,适合低性能设备"})]}),l.jsx(_t,{id:"waves-background",checked:s,onCheckedChange:i})]})})]})]})]})}function Qte(){const t=Ma(),[e,n]=b.useState(""),[r,s]=b.useState(""),[i,a]=b.useState(!1),[o,c]=b.useState(!1),[h,f]=b.useState(!1),[m,g]=b.useState(!1),[x,y]=b.useState(!1),[w,S]=b.useState(!1),[k,N]=b.useState(""),[C,T]=b.useState(!1),{toast:_}=Gr(),E=b.useMemo(()=>Ste(r),[r]),M=()=>localStorage.getItem("access-token")||"",q=async z=>{try{await navigator.clipboard.writeText(z),y(!0),_({title:"复制成功",description:"Token 已复制到剪贴板"}),setTimeout(()=>y(!1),2e3)}catch{_({title:"复制失败",description:"请手动复制 Token",variant:"destructive"})}},L=async()=>{if(!r.trim()){_({title:"输入错误",description:"请输入新的 Token",variant:"destructive"});return}if(!E.isValid){const z=E.rules.filter(H=>!H.passed).map(H=>H.label).join(", ");_({title:"格式错误",description:`Token 不符合要求: ${z}`,variant:"destructive"});return}f(!0);try{const z=M(),H=await fetch("/api/webui/auth/update",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${z}`},body:JSON.stringify({new_token:r.trim()})}),P=await H.json();H.ok&&P.success?(localStorage.setItem("access-token",r.trim()),s(""),e&&n(r.trim()),_({title:"更新成功",description:"Access Token 已更新,即将跳转到登录页"}),setTimeout(()=>{localStorage.removeItem("access-token"),t({to:"/auth"})},1500)):_({title:"更新失败",description:P.message||"无法更新 Token",variant:"destructive"})}catch(z){console.error("更新 Token 错误:",z),_({title:"更新失败",description:"连接服务器失败",variant:"destructive"})}finally{f(!1)}},I=async()=>{g(!0);try{const z=M(),H=await fetch("/api/webui/auth/regenerate",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${z}`}}),P=await H.json();H.ok&&P.success?(localStorage.setItem("access-token",P.token),n(P.token),N(P.token),S(!0),T(!1),_({title:"生成成功",description:"新的 Access Token 已生成,请及时保存"})):_({title:"生成失败",description:P.message||"无法生成新 Token",variant:"destructive"})}catch(z){console.error("生成 Token 错误:",z),_({title:"生成失败",description:"连接服务器失败",variant:"destructive"})}finally{g(!1)}},$=async()=>{try{await navigator.clipboard.writeText(k),T(!0),_({title:"复制成功",description:"Token 已复制到剪贴板"})}catch{_({title:"复制失败",description:"请手动复制 Token",variant:"destructive"})}},V=()=>{S(!1),setTimeout(()=>{N(""),T(!1)},300),setTimeout(()=>{localStorage.removeItem("access-token"),t({to:"/auth"})},500)},ee=z=>{z||V()};return l.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[l.jsx(fr,{open:w,onOpenChange:ee,children:l.jsxs(rr,{className:"sm:max-w-md",children:[l.jsxs(sr,{children:[l.jsxs(ir,{className:"flex items-center gap-2",children:[l.jsx(ja,{className:"h-5 w-5 text-yellow-500"}),"新的 Access Token"]}),l.jsx(Ir,{children:"这是您的新 Token,请立即保存。关闭此窗口后将跳转到登录页面。"})]}),l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"rounded-lg border-2 border-primary/20 bg-primary/5 p-4",children:[l.jsx(de,{className:"text-xs text-muted-foreground mb-2 block",children:"您的新 Token (64位安全令牌)"}),l.jsx("div",{className:"font-mono text-sm break-all select-all bg-background p-3 rounded border",children:k})]}),l.jsx("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3",children:l.jsxs("div",{className:"flex gap-2",children:[l.jsx(ja,{className:"h-4 w-4 text-yellow-600 dark:text-yellow-500 flex-shrink-0 mt-0.5"}),l.jsxs("div",{className:"text-sm text-yellow-800 dark:text-yellow-300 space-y-1",children:[l.jsx("p",{className:"font-semibold",children:"重要提示"}),l.jsxs("ul",{className:"list-disc list-inside space-y-0.5 text-xs",children:[l.jsx("li",{children:"此 Token 仅显示一次,关闭后无法再查看"}),l.jsx("li",{children:"请立即复制并保存到安全的位置"}),l.jsx("li",{children:"关闭窗口后将自动跳转到登录页面"}),l.jsx("li",{children:"请使用新 Token 重新登录系统"})]})]})]})})]}),l.jsxs(ts,{className:"gap-2 sm:gap-0",children:[l.jsx(fe,{variant:"outline",onClick:$,className:"gap-2",children:C?l.jsxs(l.Fragment,{children:[l.jsx(so,{className:"h-4 w-4 text-green-500"}),"已复制"]}):l.jsxs(l.Fragment,{children:[l.jsx(k1,{className:"h-4 w-4"}),"复制 Token"]})}),l.jsx(fe,{onClick:V,children:"我已保存,关闭"})]})]})}),l.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[l.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"当前 Access Token"}),l.jsx("div",{className:"space-y-3 sm:space-y-4",children:l.jsxs("div",{className:"space-y-2",children:[l.jsx(de,{htmlFor:"current-token",className:"text-sm",children:"您的访问令牌"}),l.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[l.jsxs("div",{className:"relative flex-1",children:[l.jsx(Pe,{id:"current-token",type:i?"text":"password",value:e||M(),readOnly:!0,className:"pr-10 font-mono text-sm",placeholder:"点击查看按钮显示 Token"}),l.jsx("button",{onClick:()=>{e||n(M()),a(!i)},className:"absolute right-2 top-1/2 -translate-y-1/2 p-1.5 hover:bg-accent rounded",title:i?"隐藏":"显示",children:i?l.jsx(O1,{className:"h-4 w-4 text-muted-foreground"}):l.jsx(aa,{className:"h-4 w-4 text-muted-foreground"})})]}),l.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[l.jsx(fe,{variant:"outline",size:"icon",onClick:()=>q(M()),title:"复制到剪贴板",className:"flex-shrink-0",children:x?l.jsx(so,{className:"h-4 w-4 text-green-500"}):l.jsx(k1,{className:"h-4 w-4"})}),l.jsxs(wn,{children:[l.jsx(Lr,{asChild:!0,children:l.jsxs(fe,{variant:"outline",disabled:m,className:"gap-2 flex-1 sm:flex-none",children:[l.jsx(ti,{className:ye("h-4 w-4",m&&"animate-spin")}),l.jsx("span",{className:"hidden sm:inline",children:"重新生成"}),l.jsx("span",{className:"sm:hidden",children:"生成"})]})}),l.jsxs(un,{children:[l.jsxs(dn,{children:[l.jsx(fn,{children:"确认重新生成 Token"}),l.jsx(mn,{children:"这将生成一个新的 64 位安全令牌,并使当前 Token 立即失效。 您需要使用新 Token 重新登录系统。此操作不可撤销,确定要继续吗?"})]}),l.jsxs(hn,{children:[l.jsx(gn,{children:"取消"}),l.jsx(pn,{onClick:I,children:"确认生成"})]})]})]})]})]}),l.jsx("p",{className:"text-[10px] sm:text-xs text-muted-foreground",children:"请妥善保管您的 Access Token,不要泄露给他人"})]})})]}),l.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[l.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"自定义 Access Token"}),l.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(de,{htmlFor:"new-token",className:"text-sm",children:"新的访问令牌"}),l.jsxs("div",{className:"relative",children:[l.jsx(Pe,{id:"new-token",type:o?"text":"password",value:r,onChange:z=>s(z.target.value),className:"pr-10 font-mono text-sm",placeholder:"输入自定义 Token"}),l.jsx("button",{onClick:()=>c(!o),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1.5 hover:bg-accent rounded",title:o?"隐藏":"显示",children:o?l.jsx(O1,{className:"h-4 w-4 text-muted-foreground"}):l.jsx(aa,{className:"h-4 w-4 text-muted-foreground"})})]}),r&&l.jsxs("div",{className:"mt-3 space-y-2 p-3 rounded-lg bg-muted/50",children:[l.jsx("p",{className:"text-sm font-medium text-foreground",children:"Token 安全要求:"}),l.jsx("div",{className:"space-y-1.5",children:E.rules.map(z=>l.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[z.passed?l.jsx(xc,{className:"h-4 w-4 text-green-500 flex-shrink-0"}):l.jsx(_K,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),l.jsx("span",{className:ye(z.passed?"text-green-600 dark:text-green-400":"text-muted-foreground"),children:z.label})]},z.id))}),E.isValid&&l.jsx("div",{className:"mt-2 pt-2 border-t border-border",children:l.jsxs("div",{className:"flex items-center gap-2 text-sm text-green-600 dark:text-green-400",children:[l.jsx(so,{className:"h-4 w-4"}),l.jsx("span",{className:"font-medium",children:"Token 格式正确,可以使用"})]})})]})]}),l.jsx(fe,{onClick:L,disabled:h||!E.isValid||!r,className:"w-full sm:w-auto",children:h?"更新中...":"更新自定义 Token"})]})]}),l.jsxs("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3 sm:p-4",children:[l.jsx("h4",{className:"text-sm sm:text-base font-semibold text-yellow-900 dark:text-yellow-200 mb-2",children:"安全提示"}),l.jsxs("ul",{className:"text-xs sm:text-sm text-yellow-800 dark:text-yellow-300 space-y-1 list-disc list-inside",children:[l.jsx("li",{children:"重新生成 Token 会创建系统随机生成的 64 位安全令牌"}),l.jsx("li",{children:"自定义 Token 必须满足所有安全要求才能使用"}),l.jsx("li",{children:"更新 Token 后,旧的 Token 将立即失效"}),l.jsx("li",{children:"请在安全的环境下查看和复制 Token"}),l.jsx("li",{children:"如果怀疑 Token 泄露,请立即重新生成或更新"}),l.jsx("li",{children:"建议使用系统生成的 Token 以获得最高安全性"})]})]})]})}function Hte(){const t=Ma(),{toast:e}=Gr(),[n,r]=b.useState(!1),[s,i]=b.useState(!1);if(s)throw new Error("这是一个手动触发的测试错误,用于验证错误边界组件是否正常工作。");const a=async()=>{r(!0);try{const o=localStorage.getItem("access-token"),c=await fetch("/api/webui/setup/reset",{method:"POST",headers:{Authorization:`Bearer ${o}`}}),h=await c.json();c.ok&&h.success?(e({title:"重置成功",description:"即将进入初次配置向导"}),setTimeout(()=>{t({to:"/setup"})},1e3)):e({title:"重置失败",description:h.message||"无法重置配置状态",variant:"destructive"})}catch(o){console.error("重置配置状态错误:",o),e({title:"重置失败",description:"连接服务器失败",variant:"destructive"})}finally{r(!1)}};return l.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[l.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[l.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"配置向导"}),l.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[l.jsx("div",{className:"space-y-2",children:l.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"重新进行初次配置向导,可以帮助您重新设置系统的基础配置。"})}),l.jsxs(wn,{children:[l.jsx(Lr,{asChild:!0,children:l.jsxs(fe,{variant:"outline",disabled:n,className:"gap-2",children:[l.jsx(MK,{className:ye("h-4 w-4",n&&"animate-spin")}),"重新进行初次配置"]})}),l.jsxs(un,{children:[l.jsxs(dn,{children:[l.jsx(fn,{children:"确认重新配置"}),l.jsx(mn,{children:"这将带您重新进入初次配置向导。您可以重新设置系统的基础配置项。确定要继续吗?"})]}),l.jsxs(hn,{children:[l.jsx(gn,{children:"取消"}),l.jsx(pn,{onClick:a,children:"确认重置"})]})]})]})]})]}),l.jsxs("div",{className:"rounded-lg border border-dashed border-yellow-500/50 bg-yellow-500/5 p-4 sm:p-6",children:[l.jsxs("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4 flex items-center gap-2",children:[l.jsx(ja,{className:"h-5 w-5 text-yellow-500"}),"开发者工具"]}),l.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[l.jsx("div",{className:"space-y-2",children:l.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"以下功能仅供开发调试使用,可能会导致页面崩溃或异常。"})}),l.jsxs(wn,{children:[l.jsx(Lr,{asChild:!0,children:l.jsxs(fe,{variant:"destructive",className:"gap-2",children:[l.jsx(ja,{className:"h-4 w-4"}),"触发测试错误"]})}),l.jsxs(un,{children:[l.jsxs(dn,{children:[l.jsx(fn,{children:"确认触发错误"}),l.jsx(mn,{children:"这将手动触发一个 React 错误,用于测试错误边界组件的显示效果。 页面将显示错误界面,您可以通过刷新页面或点击返回首页来恢复。"})]}),l.jsxs(hn,{children:[l.jsx(gn,{children:"取消"}),l.jsx(pn,{onClick:()=>i(!0),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"确认触发"})]})]})]})]})]})]})}function Vte(){return l.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[l.jsx("div",{className:"rounded-lg border-2 border-primary/30 bg-gradient-to-r from-primary/5 to-primary/10 p-4 sm:p-6",children:l.jsxs("div",{className:"flex items-start gap-3 sm:gap-4",children:[l.jsx("div",{className:"flex-shrink-0 rounded-lg bg-primary/10 p-2 sm:p-3",children:l.jsx("svg",{className:"h-6 w-6 sm:h-8 sm:w-8 text-primary",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:l.jsx("path",{fillRule:"evenodd",d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z",clipRule:"evenodd"})})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("h3",{className:"text-lg sm:text-xl font-bold text-foreground mb-2",children:"开源项目"}),l.jsx("p",{className:"text-sm sm:text-base text-muted-foreground mb-3",children:"本项目在 GitHub 开源,欢迎 Star ⭐ 支持!"}),l.jsxs("a",{href:"https://github.com/Mai-with-u/MaiBot-Dashboard",target:"_blank",rel:"noopener noreferrer",className:ye("inline-flex items-center gap-2 px-4 py-2 rounded-lg","bg-primary text-primary-foreground font-medium text-sm","hover:bg-primary/90 transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"),children:[l.jsx("svg",{className:"h-4 w-4",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:l.jsx("path",{fillRule:"evenodd",d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z",clipRule:"evenodd"})}),"前往 GitHub",l.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})]})]})]})}),l.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[l.jsxs("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:["关于 ",p6]}),l.jsxs("div",{className:"space-y-2 text-xs sm:text-sm text-muted-foreground",children:[l.jsxs("p",{children:["版本: ",m6]}),l.jsx("p",{children:"麦麦(MaiBot)的现代化 Web 管理界面"})]})]}),l.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[l.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"作者"}),l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{className:"space-y-1",children:[l.jsx("p",{className:"text-sm font-medium",children:"MaiBot 核心"}),l.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"Mai-with-u"})]}),l.jsxs("div",{className:"space-y-1",children:[l.jsx("p",{className:"text-sm font-medium",children:"WebUI"}),l.jsxs("p",{className:"text-xs sm:text-sm text-muted-foreground",children:["Mai-with-u ",l.jsx("a",{href:"https://github.com/DrSmoothl",target:"_blank",rel:"noopener noreferrer",className:"text-primary underline",children:"@MotricSeven"})]})]})]})]}),l.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[l.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"技术栈"}),l.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 text-xs sm:text-sm text-muted-foreground",children:[l.jsxs("div",{className:"space-y-1.5",children:[l.jsx("p",{className:"font-medium text-foreground",children:"前端框架"}),l.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[l.jsx("li",{children:"React 19.2.0"}),l.jsx("li",{children:"TypeScript 5.7.2"}),l.jsx("li",{children:"Vite 6.0.7"}),l.jsx("li",{children:"TanStack Router 1.94.2"})]})]}),l.jsxs("div",{className:"space-y-1.5",children:[l.jsx("p",{className:"font-medium text-foreground",children:"UI 组件"}),l.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[l.jsx("li",{children:"shadcn/ui"}),l.jsx("li",{children:"Radix UI"}),l.jsx("li",{children:"Tailwind CSS 3.4.17"}),l.jsx("li",{children:"Lucide Icons"})]})]}),l.jsxs("div",{className:"space-y-1.5",children:[l.jsx("p",{className:"font-medium text-foreground",children:"后端"}),l.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[l.jsx("li",{children:"Python 3.12+"}),l.jsx("li",{children:"FastAPI"}),l.jsx("li",{children:"Uvicorn"}),l.jsx("li",{children:"WebSocket"})]})]}),l.jsxs("div",{className:"space-y-1.5",children:[l.jsx("p",{className:"font-medium text-foreground",children:"构建工具"}),l.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[l.jsx("li",{children:"Bun / npm"}),l.jsx("li",{children:"ESLint 9.17.0"}),l.jsx("li",{children:"PostCSS"})]})]})]})]}),l.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[l.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"开源库感谢"}),l.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mb-3",children:"本项目使用了以下优秀的开源库,感谢他们的贡献:"}),l.jsx(on,{className:"h-[300px] sm:h-[400px]",children:l.jsxs("div",{className:"space-y-4 pr-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx("p",{className:"text-sm font-medium text-foreground",children:"UI 框架与组件"}),l.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[l.jsx(or,{name:"React",description:"用户界面构建库",license:"MIT"}),l.jsx(or,{name:"shadcn/ui",description:"优雅的 React 组件库",license:"MIT"}),l.jsx(or,{name:"Radix UI",description:"无样式的可访问组件库",license:"MIT"}),l.jsx(or,{name:"Tailwind CSS",description:"实用优先的 CSS 框架",license:"MIT"}),l.jsx(or,{name:"Lucide React",description:"精美的图标库",license:"ISC"})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("p",{className:"text-sm font-medium text-foreground",children:"路由与状态管理"}),l.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[l.jsx(or,{name:"TanStack Router",description:"类型安全的路由库",license:"MIT"}),l.jsx(or,{name:"Zustand",description:"轻量级状态管理",license:"MIT"})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("p",{className:"text-sm font-medium text-foreground",children:"表单处理"}),l.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[l.jsx(or,{name:"React Hook Form",description:"高性能表单库",license:"MIT"}),l.jsx(or,{name:"Zod",description:"TypeScript 优先的 schema 验证",license:"MIT"})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("p",{className:"text-sm font-medium text-foreground",children:"工具库"}),l.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[l.jsx(or,{name:"clsx",description:"条件 className 构建工具",license:"MIT"}),l.jsx(or,{name:"tailwind-merge",description:"Tailwind 类名合并工具",license:"MIT"}),l.jsx(or,{name:"class-variance-authority",description:"组件变体管理",license:"Apache-2.0"}),l.jsx(or,{name:"date-fns",description:"现代化日期处理库",license:"MIT"})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("p",{className:"text-sm font-medium text-foreground",children:"动画效果"}),l.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[l.jsx(or,{name:"Framer Motion",description:"React 动画库",license:"MIT"}),l.jsx(or,{name:"vaul",description:"抽屉组件动画",license:"MIT"})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("p",{className:"text-sm font-medium text-foreground",children:"后端框架"}),l.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[l.jsx(or,{name:"FastAPI",description:"现代化 Python Web 框架",license:"MIT"}),l.jsx(or,{name:"Uvicorn",description:"ASGI 服务器",license:"BSD-3-Clause"}),l.jsx(or,{name:"Pydantic",description:"数据验证库",license:"MIT"}),l.jsx(or,{name:"python-multipart",description:"文件上传支持",license:"Apache-2.0"})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("p",{className:"text-sm font-medium text-foreground",children:"开发工具"}),l.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[l.jsx(or,{name:"TypeScript",description:"JavaScript 的超集",license:"Apache-2.0"}),l.jsx(or,{name:"Vite",description:"下一代前端构建工具",license:"MIT"}),l.jsx(or,{name:"ESLint",description:"JavaScript 代码检查工具",license:"MIT"}),l.jsx(or,{name:"PostCSS",description:"CSS 转换工具",license:"MIT"})]})]})]})})]}),l.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[l.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"开源许可"}),l.jsxs("div",{className:"space-y-3",children:[l.jsx("div",{className:"rounded-lg bg-primary/5 border border-primary/20 p-3 sm:p-4",children:l.jsxs("div",{className:"flex items-start gap-2 sm:gap-3",children:[l.jsx("div",{className:"flex-shrink-0 mt-0.5",children:l.jsx("div",{className:"rounded-md bg-primary/10 px-2 py-1",children:l.jsx("span",{className:"text-xs sm:text-sm font-bold text-primary",children:"GPLv3"})})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("p",{className:"text-sm sm:text-base font-semibold text-foreground mb-1",children:"MaiBot WebUI"}),l.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"本项目采用 GNU General Public License v3.0 开源许可证。 您可以自由地使用、修改和分发本软件,但必须保持相同的开源许可。"})]})]})}),l.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"本项目依赖的所有开源库均遵循各自的开源许可证(MIT、Apache-2.0、BSD 等)。 感谢所有开源贡献者的无私奉献。"})]})]})]})}function or({name:t,description:e,license:n}){return l.jsxs("div",{className:"flex items-start justify-between gap-2 rounded-lg border bg-muted/30 p-2.5 sm:p-3",children:[l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("p",{className:"font-medium text-foreground truncate",children:t}),l.jsx("p",{className:"text-muted-foreground text-xs mt-0.5",children:e})]}),l.jsx("span",{className:"inline-flex items-center rounded-full bg-primary/10 px-2 py-0.5 text-[10px] font-medium text-primary flex-shrink-0",children:n})]})}function cw({value:t,current:e,onChange:n,label:r,description:s}){const i=e===t;return l.jsxs("button",{onClick:()=>n(t),className:ye("relative rounded-lg border-2 p-3 sm:p-4 text-left transition-all","hover:border-primary/50 hover:bg-accent/50",i?"border-primary bg-accent":"border-border"),children:[i&&l.jsx("div",{className:"absolute top-2 right-2 sm:top-3 sm:right-3 h-2 w-2 rounded-full bg-primary"}),l.jsxs("div",{className:"space-y-1",children:[l.jsx("div",{className:"text-sm sm:text-base font-medium",children:r}),l.jsx("div",{className:"text-[10px] sm:text-xs text-muted-foreground",children:s})]}),l.jsxs("div",{className:"mt-2 sm:mt-3 flex gap-1",children:[t==="light"&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-200"}),l.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-300"}),l.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-400"})]}),t==="dark"&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-700"}),l.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-800"}),l.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-900"})]}),t==="system"&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-200 to-slate-700"}),l.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-300 to-slate-800"}),l.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-400 to-slate-900"})]})]})]})}function Ui({value:t,current:e,onChange:n,label:r,colorClass:s}){const i=e===t;return l.jsxs("button",{onClick:()=>n(t),className:ye("relative rounded-lg border-2 p-2 sm:p-3 text-left transition-all","hover:border-primary/50 hover:bg-accent/50",i?"border-primary bg-accent":"border-border"),children:[i&&l.jsx("div",{className:"absolute top-1.5 right-1.5 sm:top-2 sm:right-2 h-1.5 w-1.5 sm:h-2 sm:w-2 rounded-full bg-primary"}),l.jsxs("div",{className:"flex flex-col items-center gap-1.5 sm:gap-2",children:[l.jsx("div",{className:ye("h-8 w-8 sm:h-10 sm:w-10 rounded-full",s)}),l.jsx("div",{className:"text-[10px] sm:text-xs font-medium text-center",children:r})]})]})}class Ute{grad3;p;perm;constructor(e=0){this.grad3=[[1,1,0],[-1,1,0],[1,-1,0],[-1,-1,0],[1,0,1],[-1,0,1],[1,0,-1],[-1,0,-1],[0,1,1],[0,-1,1],[0,1,-1],[0,-1,-1]],this.p=[];for(let n=0;n<256;n++)this.p[n]=Math.floor(Math.random()*256);this.perm=[];for(let n=0;n<512;n++)this.perm[n]=this.p[n&255]}dot(e,n,r){return e[0]*n+e[1]*r}mix(e,n,r){return(1-r)*e+r*n}fade(e){return e*e*e*(e*(e*6-15)+10)}perlin2(e,n){const r=Math.floor(e)&255,s=Math.floor(n)&255;e-=Math.floor(e),n-=Math.floor(n);const i=this.fade(e),a=this.fade(n),o=this.perm[r]+s,c=this.perm[o],h=this.perm[o+1],f=this.perm[r+1]+s,m=this.perm[f],g=this.perm[f+1];return this.mix(this.mix(this.dot(this.grad3[c%12],e,n),this.dot(this.grad3[m%12],e-1,n),i),this.mix(this.dot(this.grad3[h%12],e,n-1),this.dot(this.grad3[g%12],e-1,n-1),i),a)}}function Wte(){const t=b.useRef(null),e=b.useRef(null),n=b.useRef(void 0),r=b.useRef({mouse:{x:-10,y:0,lx:0,ly:0,sx:0,sy:0,v:0,vs:0,a:0,set:!1},lines:[],paths:[],noise:new Ute(Math.random()),bounding:null});return b.useEffect(()=>{const s=e.current,i=t.current;if(!s||!i)return;const a=r.current,o=()=>{const w=s.getBoundingClientRect();a.bounding=w,i.style.width=`${w.width}px`,i.style.height=`${w.height}px`},c=()=>{if(!a.bounding)return;const{width:w,height:S}=a.bounding;a.lines=[],a.paths.forEach(L=>L.remove()),a.paths=[];const k=10,N=32,C=w+200,T=S+30,_=Math.ceil(C/k),E=Math.ceil(T/N),M=(w-k*_)/2,q=(S-N*E)/2;for(let L=0;L<=_;L++){const I=[];for(let V=0;V<=E;V++){const ee={x:M+k*L,y:q+N*V,wave:{x:0,y:0},cursor:{x:0,y:0,vx:0,vy:0}};I.push(ee)}const $=document.createElementNS("http://www.w3.org/2000/svg","path");i.appendChild($),a.paths.push($),a.lines.push(I)}},h=w=>{const{lines:S,mouse:k,noise:N}=a;S.forEach(C=>{C.forEach(T=>{const _=N.perlin2((T.x+w*.0125)*.002,(T.y+w*.005)*.0015)*12;T.wave.x=Math.cos(_)*32,T.wave.y=Math.sin(_)*16;const E=T.x-k.sx,M=T.y-k.sy,q=Math.hypot(E,M),L=Math.max(175,k.vs);if(q{const k={x:w.x+w.wave.x+(S?w.cursor.x:0),y:w.y+w.wave.y+(S?w.cursor.y:0)};return k.x=Math.round(k.x*10)/10,k.y=Math.round(k.y*10)/10,k},m=()=>{const{lines:w,paths:S}=a;w.forEach((k,N)=>{let C=f(k[0],!1),T=`M ${C.x} ${C.y}`;k.forEach((_,E)=>{const M=E===k.length-1;C=f(_,!M),T+=`L ${C.x} ${C.y}`}),S[N].setAttribute("d",T)})},g=w=>{const{mouse:S}=a;S.sx+=(S.x-S.sx)*.1,S.sy+=(S.y-S.sy)*.1;const k=S.x-S.lx,N=S.y-S.ly,C=Math.hypot(k,N);S.v=C,S.vs+=(C-S.vs)*.1,S.vs=Math.min(100,S.vs),S.lx=S.x,S.ly=S.y,S.a=Math.atan2(N,k),s&&(s.style.setProperty("--x",`${S.sx}px`),s.style.setProperty("--y",`${S.sy}px`)),h(w),m(),n.current=requestAnimationFrame(g)},x=w=>{if(!a.bounding)return;const{mouse:S}=a;S.x=w.pageX-a.bounding.left,S.y=w.pageY-a.bounding.top+window.scrollY,S.set||(S.sx=S.x,S.sy=S.y,S.lx=S.x,S.ly=S.y,S.set=!0)},y=()=>{o(),c()};return o(),c(),window.addEventListener("resize",y),window.addEventListener("mousemove",x),n.current=requestAnimationFrame(g),()=>{window.removeEventListener("resize",y),window.removeEventListener("mousemove",x),n.current&&cancelAnimationFrame(n.current)}},[]),l.jsxs("div",{ref:e,className:"waves-background",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",overflow:"hidden",pointerEvents:"none"},children:[l.jsx("div",{className:"waves-cursor",style:{position:"absolute",top:0,left:0,width:"0.5rem",height:"0.5rem",background:"hsl(var(--primary) / 0.3)",borderRadius:"50%",transform:"translate3d(calc(var(--x, -0.5rem) - 50%), calc(var(--y, 50%) - 50%), 0)",willChange:"transform",pointerEvents:"none"}}),l.jsx("svg",{ref:t,style:{display:"block",width:"100%",height:"100%"},children:l.jsx("style",{children:` +For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return b.useEffect(()=>{document.getElementById(t.current?.getAttribute("aria-describedby"))||console.warn(e)},[e,t]),null},Bte=GP,qte=XP,Fte=YP,aL=KP,lL=ZP,oL=rL,cL=iL,uL=eL,dL=nL;const Nn=Bte,Qr=qte,$te=Fte,hL=b.forwardRef(({className:t,...e},n)=>l.jsx(aL,{className:ve("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e,ref:n}));hL.displayName=aL.displayName;const gn=b.forwardRef(({className:t,...e},n)=>l.jsxs($te,{children:[l.jsx(hL,{}),l.jsx(lL,{ref:n,className:ve("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...e})]}));gn.displayName=lL.displayName;const xn=({className:t,...e})=>l.jsx("div",{className:ve("flex flex-col space-y-2 text-center sm:text-left",t),...e});xn.displayName="AlertDialogHeader";const vn=({className:t,...e})=>l.jsx("div",{className:ve("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});vn.displayName="AlertDialogFooter";const yn=b.forwardRef(({className:t,...e},n)=>l.jsx(uL,{ref:n,className:ve("text-lg font-semibold",t),...e}));yn.displayName=uL.displayName;const bn=b.forwardRef(({className:t,...e},n)=>l.jsx(dL,{ref:n,className:ve("text-sm text-muted-foreground",t),...e}));bn.displayName=dL.displayName;const wn=b.forwardRef(({className:t,...e},n)=>l.jsx(oL,{ref:n,className:ve(Hm(),t),...e}));wn.displayName=oL.displayName;const Sn=b.forwardRef(({className:t,...e},n)=>l.jsx(cL,{ref:n,className:ve(Hm({variant:"outline"}),"mt-2 sm:mt-0",t),...e}));Sn.displayName=cL.displayName;function Qte(){return l.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[l.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:l.jsxs("div",{children:[l.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"系统设置"}),l.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理您的应用偏好设置"})]})}),l.jsxs(sa,{defaultValue:"appearance",className:"w-full",children:[l.jsxs(Mi,{className:"grid w-full grid-cols-2 sm:grid-cols-4 gap-0.5 sm:gap-1 h-auto p-1",children:[l.jsxs(zt,{value:"appearance",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[l.jsx(sz,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),l.jsx("span",{children:"外观"})]}),l.jsxs(zt,{value:"security",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[l.jsx(MK,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),l.jsx("span",{children:"安全"})]}),l.jsxs(zt,{value:"other",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[l.jsx(bu,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),l.jsx("span",{children:"其他"})]}),l.jsxs(zt,{value:"about",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[l.jsx(ra,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),l.jsx("span",{children:"关于"})]})]}),l.jsxs(hn,{className:"h-[calc(100vh-240px)] sm:h-[calc(100vh-280px)] mt-4 sm:mt-6",children:[l.jsx(tn,{value:"appearance",className:"mt-0",children:l.jsx(Hte,{})}),l.jsx(tn,{value:"security",className:"mt-0",children:l.jsx(Vte,{})}),l.jsx(tn,{value:"other",className:"mt-0",children:l.jsx(Ute,{})}),l.jsx(tn,{value:"about",className:"mt-0",children:l.jsx(Wte,{})})]})]})]})}function w9(t){const e=document.documentElement,r={blue:{hsl:"221.2 83.2% 53.3%",darkHsl:"217.2 91.2% 59.8%",gradient:null},purple:{hsl:"271 91% 65%",darkHsl:"270 95% 75%",gradient:null},green:{hsl:"142 71% 45%",darkHsl:"142 76% 36%",gradient:null},orange:{hsl:"25 95% 53%",darkHsl:"20 90% 48%",gradient:null},pink:{hsl:"330 81% 60%",darkHsl:"330 85% 70%",gradient:null},red:{hsl:"0 84% 60%",darkHsl:"0 90% 70%",gradient:null},"gradient-sunset":{hsl:"15 95% 60%",darkHsl:"15 95% 65%",gradient:"linear-gradient(135deg, hsl(25 95% 53%) 0%, hsl(330 81% 60%) 100%)"},"gradient-ocean":{hsl:"200 90% 55%",darkHsl:"200 90% 60%",gradient:"linear-gradient(135deg, hsl(221.2 83.2% 53.3%) 0%, hsl(189 94% 43%) 100%)"},"gradient-forest":{hsl:"150 70% 45%",darkHsl:"150 75% 40%",gradient:"linear-gradient(135deg, hsl(142 71% 45%) 0%, hsl(158 64% 52%) 100%)"},"gradient-aurora":{hsl:"310 85% 65%",darkHsl:"310 90% 70%",gradient:"linear-gradient(135deg, hsl(271 91% 65%) 0%, hsl(330 81% 60%) 100%)"},"gradient-fire":{hsl:"15 95% 55%",darkHsl:"15 95% 60%",gradient:"linear-gradient(135deg, hsl(0 84% 60%) 0%, hsl(25 95% 53%) 100%)"},"gradient-twilight":{hsl:"250 90% 60%",darkHsl:"250 95% 65%",gradient:"linear-gradient(135deg, hsl(239 84% 67%) 0%, hsl(271 91% 65%) 100%)"}}[t];if(r)e.style.setProperty("--primary",r.hsl),r.gradient?(e.style.setProperty("--primary-gradient",r.gradient),e.classList.add("has-gradient")):(e.style.removeProperty("--primary-gradient"),e.classList.remove("has-gradient"));else if(t.startsWith("#")){const s=i=>{i=i.replace("#","");const a=parseInt(i.substring(0,2),16)/255,o=parseInt(i.substring(2,4),16)/255,c=parseInt(i.substring(4,6),16)/255,h=Math.max(a,o,c),f=Math.min(a,o,c);let m=0,g=0;const x=(h+f)/2;if(h!==f){const y=h-f;switch(g=x>.5?y/(2-h-f):y/(h+f),h){case a:m=((o-c)/y+(olocalStorage.getItem("accent-color")||"blue");b.useEffect(()=>{const h=localStorage.getItem("accent-color")||"blue";w9(h)},[]);const c=h=>{o(h),localStorage.setItem("accent-color",h),w9(h)};return l.jsxs("div",{className:"space-y-6 sm:space-y-8",children:[l.jsxs("div",{children:[l.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"主题模式"}),l.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3 sm:gap-4",children:[l.jsx(pw,{value:"light",current:t,onChange:e,label:"浅色",description:"始终使用浅色主题"}),l.jsx(pw,{value:"dark",current:t,onChange:e,label:"深色",description:"始终使用深色主题"}),l.jsx(pw,{value:"system",current:t,onChange:e,label:"跟随系统",description:"根据系统设置自动切换"})]})]}),l.jsxs("div",{children:[l.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"主题色"}),l.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[l.jsxs("div",{children:[l.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"单色"}),l.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-6 gap-2 sm:gap-3",children:[l.jsx(Wi,{value:"blue",current:a,onChange:c,label:"蓝色",colorClass:"bg-blue-500"}),l.jsx(Wi,{value:"purple",current:a,onChange:c,label:"紫色",colorClass:"bg-purple-500"}),l.jsx(Wi,{value:"green",current:a,onChange:c,label:"绿色",colorClass:"bg-green-500"}),l.jsx(Wi,{value:"orange",current:a,onChange:c,label:"橙色",colorClass:"bg-orange-500"}),l.jsx(Wi,{value:"pink",current:a,onChange:c,label:"粉色",colorClass:"bg-pink-500"}),l.jsx(Wi,{value:"red",current:a,onChange:c,label:"红色",colorClass:"bg-red-500"})]})]}),l.jsxs("div",{children:[l.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"渐变色"}),l.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-6 gap-2 sm:gap-3",children:[l.jsx(Wi,{value:"gradient-sunset",current:a,onChange:c,label:"日落",colorClass:"bg-gradient-to-r from-orange-500 to-pink-500"}),l.jsx(Wi,{value:"gradient-ocean",current:a,onChange:c,label:"海洋",colorClass:"bg-gradient-to-r from-blue-500 to-cyan-500"}),l.jsx(Wi,{value:"gradient-forest",current:a,onChange:c,label:"森林",colorClass:"bg-gradient-to-r from-green-500 to-emerald-500"}),l.jsx(Wi,{value:"gradient-aurora",current:a,onChange:c,label:"极光",colorClass:"bg-gradient-to-r from-purple-500 to-pink-500"}),l.jsx(Wi,{value:"gradient-fire",current:a,onChange:c,label:"烈焰",colorClass:"bg-gradient-to-r from-red-500 to-orange-500"}),l.jsx(Wi,{value:"gradient-twilight",current:a,onChange:c,label:"暮光",colorClass:"bg-gradient-to-r from-indigo-500 to-purple-500"})]})]}),l.jsxs("div",{children:[l.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"自定义颜色"}),l.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 sm:gap-4",children:[l.jsx("div",{className:"flex-1",children:l.jsx("input",{type:"color",value:a.startsWith("#")?a:"#3b82f6",onChange:h=>c(h.target.value),className:"h-10 sm:h-12 w-full rounded-lg border-2 border-border cursor-pointer",title:"选择自定义颜色"})}),l.jsx("div",{className:"flex-1",children:l.jsx(Pe,{type:"text",value:a,onChange:h=>c(h.target.value),placeholder:"#3b82f6",className:"font-mono text-sm"})})]}),l.jsx("p",{className:"text-[10px] sm:text-xs text-muted-foreground mt-2",children:"点击色块选择颜色,或手动输入 HEX 颜色代码"})]})]})]}),l.jsxs("div",{children:[l.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"动画效果"}),l.jsxs("div",{className:"space-y-2 sm:space-y-3",children:[l.jsx("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"space-y-0.5 flex-1",children:[l.jsx(ue,{htmlFor:"animations",className:"text-base font-medium cursor-pointer",children:"启用动画效果"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭后将禁用所有过渡动画和特效,提升性能"})]}),l.jsx(Pt,{id:"animations",checked:n,onCheckedChange:r})]})}),l.jsx("div",{className:"rounded-lg border bg-card p-4",children:l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"space-y-0.5 flex-1",children:[l.jsx(ue,{htmlFor:"waves-background",className:"text-base font-medium cursor-pointer",children:"登录页波浪背景"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭后登录页将使用纯色背景,适合低性能设备"})]}),l.jsx(Pt,{id:"waves-background",checked:s,onCheckedChange:i})]})})]})]})]})}function Vte(){const t=Da(),[e,n]=b.useState(""),[r,s]=b.useState(""),[i,a]=b.useState(!1),[o,c]=b.useState(!1),[h,f]=b.useState(!1),[m,g]=b.useState(!1),[x,y]=b.useState(!1),[w,S]=b.useState(!1),[k,N]=b.useState(""),[C,T]=b.useState(!1),{toast:_}=ts(),E=b.useMemo(()=>jte(r),[r]),M=()=>localStorage.getItem("access-token")||"",L=async z=>{try{await navigator.clipboard.writeText(z),y(!0),_({title:"复制成功",description:"Token 已复制到剪贴板"}),setTimeout(()=>y(!1),2e3)}catch{_({title:"复制失败",description:"请手动复制 Token",variant:"destructive"})}},P=async()=>{if(!r.trim()){_({title:"输入错误",description:"请输入新的 Token",variant:"destructive"});return}if(!E.isValid){const z=E.rules.filter(H=>!H.passed).map(H=>H.label).join(", ");_({title:"格式错误",description:`Token 不符合要求: ${z}`,variant:"destructive"});return}f(!0);try{const z=M(),H=await fetch("/api/webui/auth/update",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${z}`},body:JSON.stringify({new_token:r.trim()})}),B=await H.json();H.ok&&B.success?(localStorage.setItem("access-token",r.trim()),s(""),e&&n(r.trim()),_({title:"更新成功",description:"Access Token 已更新,即将跳转到登录页"}),setTimeout(()=>{localStorage.removeItem("access-token"),t({to:"/auth"})},1500)):_({title:"更新失败",description:B.message||"无法更新 Token",variant:"destructive"})}catch(z){console.error("更新 Token 错误:",z),_({title:"更新失败",description:"连接服务器失败",variant:"destructive"})}finally{f(!1)}},I=async()=>{g(!0);try{const z=M(),H=await fetch("/api/webui/auth/regenerate",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${z}`}}),B=await H.json();H.ok&&B.success?(localStorage.setItem("access-token",B.token),n(B.token),N(B.token),S(!0),T(!1),_({title:"生成成功",description:"新的 Access Token 已生成,请及时保存"})):_({title:"生成失败",description:B.message||"无法生成新 Token",variant:"destructive"})}catch(z){console.error("生成 Token 错误:",z),_({title:"生成失败",description:"连接服务器失败",variant:"destructive"})}finally{g(!1)}},Q=async()=>{try{await navigator.clipboard.writeText(k),T(!0),_({title:"复制成功",description:"Token 已复制到剪贴板"})}catch{_({title:"复制失败",description:"请手动复制 Token",variant:"destructive"})}},U=()=>{S(!1),setTimeout(()=>{N(""),T(!1)},300),setTimeout(()=>{localStorage.removeItem("access-token"),t({to:"/auth"})},500)},ee=z=>{z||U()};return l.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[l.jsx(xr,{open:w,onOpenChange:ee,children:l.jsxs(lr,{className:"sm:max-w-md",children:[l.jsxs(or,{children:[l.jsxs(cr,{className:"flex items-center gap-2",children:[l.jsx(Oa,{className:"h-5 w-5 text-yellow-500"}),"新的 Access Token"]}),l.jsx(Hr,{children:"这是您的新 Token,请立即保存。关闭此窗口后将跳转到登录页面。"})]}),l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"rounded-lg border-2 border-primary/20 bg-primary/5 p-4",children:[l.jsx(ue,{className:"text-xs text-muted-foreground mb-2 block",children:"您的新 Token (64位安全令牌)"}),l.jsx("div",{className:"font-mono text-sm break-all select-all bg-background p-3 rounded border",children:k})]}),l.jsx("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3",children:l.jsxs("div",{className:"flex gap-2",children:[l.jsx(Oa,{className:"h-4 w-4 text-yellow-600 dark:text-yellow-500 flex-shrink-0 mt-0.5"}),l.jsxs("div",{className:"text-sm text-yellow-800 dark:text-yellow-300 space-y-1",children:[l.jsx("p",{className:"font-semibold",children:"重要提示"}),l.jsxs("ul",{className:"list-disc list-inside space-y-0.5 text-xs",children:[l.jsx("li",{children:"此 Token 仅显示一次,关闭后无法再查看"}),l.jsx("li",{children:"请立即复制并保存到安全的位置"}),l.jsx("li",{children:"关闭窗口后将自动跳转到登录页面"}),l.jsx("li",{children:"请使用新 Token 重新登录系统"})]})]})]})})]}),l.jsxs(as,{className:"gap-2 sm:gap-0",children:[l.jsx(de,{variant:"outline",onClick:Q,className:"gap-2",children:C?l.jsxs(l.Fragment,{children:[l.jsx(ol,{className:"h-4 w-4 text-green-500"}),"已复制"]}):l.jsxs(l.Fragment,{children:[l.jsx(O1,{className:"h-4 w-4"}),"复制 Token"]})}),l.jsx(de,{onClick:U,children:"我已保存,关闭"})]})]})}),l.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[l.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"当前 Access Token"}),l.jsx("div",{className:"space-y-3 sm:space-y-4",children:l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{htmlFor:"current-token",className:"text-sm",children:"您的访问令牌"}),l.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[l.jsxs("div",{className:"relative flex-1",children:[l.jsx(Pe,{id:"current-token",type:i?"text":"password",value:e||M(),readOnly:!0,className:"pr-10 font-mono text-sm",placeholder:"点击查看按钮显示 Token"}),l.jsx("button",{onClick:()=>{e||n(M()),a(!i)},className:"absolute right-2 top-1/2 -translate-y-1/2 p-1.5 hover:bg-accent rounded",title:i?"隐藏":"显示",children:i?l.jsx(N1,{className:"h-4 w-4 text-muted-foreground"}):l.jsx(oa,{className:"h-4 w-4 text-muted-foreground"})})]}),l.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[l.jsx(de,{variant:"outline",size:"icon",onClick:()=>L(M()),title:"复制到剪贴板",className:"flex-shrink-0",children:x?l.jsx(ol,{className:"h-4 w-4 text-green-500"}):l.jsx(O1,{className:"h-4 w-4"})}),l.jsxs(Nn,{children:[l.jsx(Qr,{asChild:!0,children:l.jsxs(de,{variant:"outline",disabled:m,className:"gap-2 flex-1 sm:flex-none",children:[l.jsx(Ls,{className:ve("h-4 w-4",m&&"animate-spin")}),l.jsx("span",{className:"hidden sm:inline",children:"重新生成"}),l.jsx("span",{className:"sm:hidden",children:"生成"})]})}),l.jsxs(gn,{children:[l.jsxs(xn,{children:[l.jsx(yn,{children:"确认重新生成 Token"}),l.jsx(bn,{children:"这将生成一个新的 64 位安全令牌,并使当前 Token 立即失效。 您需要使用新 Token 重新登录系统。此操作不可撤销,确定要继续吗?"})]}),l.jsxs(vn,{children:[l.jsx(Sn,{children:"取消"}),l.jsx(wn,{onClick:I,children:"确认生成"})]})]})]})]})]}),l.jsx("p",{className:"text-[10px] sm:text-xs text-muted-foreground",children:"请妥善保管您的 Access Token,不要泄露给他人"})]})})]}),l.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[l.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"自定义 Access Token"}),l.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{htmlFor:"new-token",className:"text-sm",children:"新的访问令牌"}),l.jsxs("div",{className:"relative",children:[l.jsx(Pe,{id:"new-token",type:o?"text":"password",value:r,onChange:z=>s(z.target.value),className:"pr-10 font-mono text-sm",placeholder:"输入自定义 Token"}),l.jsx("button",{onClick:()=>c(!o),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1.5 hover:bg-accent rounded",title:o?"隐藏":"显示",children:o?l.jsx(N1,{className:"h-4 w-4 text-muted-foreground"}):l.jsx(oa,{className:"h-4 w-4 text-muted-foreground"})})]}),r&&l.jsxs("div",{className:"mt-3 space-y-2 p-3 rounded-lg bg-muted/50",children:[l.jsx("p",{className:"text-sm font-medium text-foreground",children:"Token 安全要求:"}),l.jsx("div",{className:"space-y-1.5",children:E.rules.map(z=>l.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[z.passed?l.jsx(xc,{className:"h-4 w-4 text-green-500 flex-shrink-0"}):l.jsx(AK,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),l.jsx("span",{className:ve(z.passed?"text-green-600 dark:text-green-400":"text-muted-foreground"),children:z.label})]},z.id))}),E.isValid&&l.jsx("div",{className:"mt-2 pt-2 border-t border-border",children:l.jsxs("div",{className:"flex items-center gap-2 text-sm text-green-600 dark:text-green-400",children:[l.jsx(ol,{className:"h-4 w-4"}),l.jsx("span",{className:"font-medium",children:"Token 格式正确,可以使用"})]})})]})]}),l.jsx(de,{onClick:P,disabled:h||!E.isValid||!r,className:"w-full sm:w-auto",children:h?"更新中...":"更新自定义 Token"})]})]}),l.jsxs("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3 sm:p-4",children:[l.jsx("h4",{className:"text-sm sm:text-base font-semibold text-yellow-900 dark:text-yellow-200 mb-2",children:"安全提示"}),l.jsxs("ul",{className:"text-xs sm:text-sm text-yellow-800 dark:text-yellow-300 space-y-1 list-disc list-inside",children:[l.jsx("li",{children:"重新生成 Token 会创建系统随机生成的 64 位安全令牌"}),l.jsx("li",{children:"自定义 Token 必须满足所有安全要求才能使用"}),l.jsx("li",{children:"更新 Token 后,旧的 Token 将立即失效"}),l.jsx("li",{children:"请在安全的环境下查看和复制 Token"}),l.jsx("li",{children:"如果怀疑 Token 泄露,请立即重新生成或更新"}),l.jsx("li",{children:"建议使用系统生成的 Token 以获得最高安全性"})]})]})]})}function Ute(){const t=Da(),{toast:e}=ts(),[n,r]=b.useState(!1),[s,i]=b.useState(!1);if(s)throw new Error("这是一个手动触发的测试错误,用于验证错误边界组件是否正常工作。");const a=async()=>{r(!0);try{const o=localStorage.getItem("access-token"),c=await fetch("/api/webui/setup/reset",{method:"POST",headers:{Authorization:`Bearer ${o}`}}),h=await c.json();c.ok&&h.success?(e({title:"重置成功",description:"即将进入初次配置向导"}),setTimeout(()=>{t({to:"/setup"})},1e3)):e({title:"重置失败",description:h.message||"无法重置配置状态",variant:"destructive"})}catch(o){console.error("重置配置状态错误:",o),e({title:"重置失败",description:"连接服务器失败",variant:"destructive"})}finally{r(!1)}};return l.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[l.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[l.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"配置向导"}),l.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[l.jsx("div",{className:"space-y-2",children:l.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"重新进行初次配置向导,可以帮助您重新设置系统的基础配置。"})}),l.jsxs(Nn,{children:[l.jsx(Qr,{asChild:!0,children:l.jsxs(de,{variant:"outline",disabled:n,className:"gap-2",children:[l.jsx(RK,{className:ve("h-4 w-4",n&&"animate-spin")}),"重新进行初次配置"]})}),l.jsxs(gn,{children:[l.jsxs(xn,{children:[l.jsx(yn,{children:"确认重新配置"}),l.jsx(bn,{children:"这将带您重新进入初次配置向导。您可以重新设置系统的基础配置项。确定要继续吗?"})]}),l.jsxs(vn,{children:[l.jsx(Sn,{children:"取消"}),l.jsx(wn,{onClick:a,children:"确认重置"})]})]})]})]})]}),l.jsxs("div",{className:"rounded-lg border border-dashed border-yellow-500/50 bg-yellow-500/5 p-4 sm:p-6",children:[l.jsxs("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4 flex items-center gap-2",children:[l.jsx(Oa,{className:"h-5 w-5 text-yellow-500"}),"开发者工具"]}),l.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[l.jsx("div",{className:"space-y-2",children:l.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"以下功能仅供开发调试使用,可能会导致页面崩溃或异常。"})}),l.jsxs(Nn,{children:[l.jsx(Qr,{asChild:!0,children:l.jsxs(de,{variant:"destructive",className:"gap-2",children:[l.jsx(Oa,{className:"h-4 w-4"}),"触发测试错误"]})}),l.jsxs(gn,{children:[l.jsxs(xn,{children:[l.jsx(yn,{children:"确认触发错误"}),l.jsx(bn,{children:"这将手动触发一个 React 错误,用于测试错误边界组件的显示效果。 页面将显示错误界面,您可以通过刷新页面或点击返回首页来恢复。"})]}),l.jsxs(vn,{children:[l.jsx(Sn,{children:"取消"}),l.jsx(wn,{onClick:()=>i(!0),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"确认触发"})]})]})]})]})]})]})}function Wte(){return l.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[l.jsx("div",{className:"rounded-lg border-2 border-primary/30 bg-gradient-to-r from-primary/5 to-primary/10 p-4 sm:p-6",children:l.jsxs("div",{className:"flex items-start gap-3 sm:gap-4",children:[l.jsx("div",{className:"flex-shrink-0 rounded-lg bg-primary/10 p-2 sm:p-3",children:l.jsx("svg",{className:"h-6 w-6 sm:h-8 sm:w-8 text-primary",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:l.jsx("path",{fillRule:"evenodd",d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z",clipRule:"evenodd"})})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("h3",{className:"text-lg sm:text-xl font-bold text-foreground mb-2",children:"开源项目"}),l.jsx("p",{className:"text-sm sm:text-base text-muted-foreground mb-3",children:"本项目在 GitHub 开源,欢迎 Star ⭐ 支持!"}),l.jsxs("a",{href:"https://github.com/Mai-with-u/MaiBot-Dashboard",target:"_blank",rel:"noopener noreferrer",className:ve("inline-flex items-center gap-2 px-4 py-2 rounded-lg","bg-primary text-primary-foreground font-medium text-sm","hover:bg-primary/90 transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"),children:[l.jsx("svg",{className:"h-4 w-4",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:l.jsx("path",{fillRule:"evenodd",d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z",clipRule:"evenodd"})}),"前往 GitHub",l.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})]})]})]})}),l.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[l.jsxs("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:["关于 ",S6]}),l.jsxs("div",{className:"space-y-2 text-xs sm:text-sm text-muted-foreground",children:[l.jsxs("p",{children:["版本: ",w6]}),l.jsx("p",{children:"麦麦(MaiBot)的现代化 Web 管理界面"})]})]}),l.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[l.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"作者"}),l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{className:"space-y-1",children:[l.jsx("p",{className:"text-sm font-medium",children:"MaiBot 核心"}),l.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"Mai-with-u"})]}),l.jsxs("div",{className:"space-y-1",children:[l.jsx("p",{className:"text-sm font-medium",children:"WebUI"}),l.jsxs("p",{className:"text-xs sm:text-sm text-muted-foreground",children:["Mai-with-u ",l.jsx("a",{href:"https://github.com/DrSmoothl",target:"_blank",rel:"noopener noreferrer",className:"text-primary underline",children:"@MotricSeven"})]})]})]})]}),l.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[l.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"技术栈"}),l.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 text-xs sm:text-sm text-muted-foreground",children:[l.jsxs("div",{className:"space-y-1.5",children:[l.jsx("p",{className:"font-medium text-foreground",children:"前端框架"}),l.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[l.jsx("li",{children:"React 19.2.0"}),l.jsx("li",{children:"TypeScript 5.7.2"}),l.jsx("li",{children:"Vite 6.0.7"}),l.jsx("li",{children:"TanStack Router 1.94.2"})]})]}),l.jsxs("div",{className:"space-y-1.5",children:[l.jsx("p",{className:"font-medium text-foreground",children:"UI 组件"}),l.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[l.jsx("li",{children:"shadcn/ui"}),l.jsx("li",{children:"Radix UI"}),l.jsx("li",{children:"Tailwind CSS 3.4.17"}),l.jsx("li",{children:"Lucide Icons"})]})]}),l.jsxs("div",{className:"space-y-1.5",children:[l.jsx("p",{className:"font-medium text-foreground",children:"后端"}),l.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[l.jsx("li",{children:"Python 3.12+"}),l.jsx("li",{children:"FastAPI"}),l.jsx("li",{children:"Uvicorn"}),l.jsx("li",{children:"WebSocket"})]})]}),l.jsxs("div",{className:"space-y-1.5",children:[l.jsx("p",{className:"font-medium text-foreground",children:"构建工具"}),l.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[l.jsx("li",{children:"Bun / npm"}),l.jsx("li",{children:"ESLint 9.17.0"}),l.jsx("li",{children:"PostCSS"})]})]})]})]}),l.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[l.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"开源库感谢"}),l.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mb-3",children:"本项目使用了以下优秀的开源库,感谢他们的贡献:"}),l.jsx(hn,{className:"h-[300px] sm:h-[400px]",children:l.jsxs("div",{className:"space-y-4 pr-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx("p",{className:"text-sm font-medium text-foreground",children:"UI 框架与组件"}),l.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[l.jsx(hr,{name:"React",description:"用户界面构建库",license:"MIT"}),l.jsx(hr,{name:"shadcn/ui",description:"优雅的 React 组件库",license:"MIT"}),l.jsx(hr,{name:"Radix UI",description:"无样式的可访问组件库",license:"MIT"}),l.jsx(hr,{name:"Tailwind CSS",description:"实用优先的 CSS 框架",license:"MIT"}),l.jsx(hr,{name:"Lucide React",description:"精美的图标库",license:"ISC"})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("p",{className:"text-sm font-medium text-foreground",children:"路由与状态管理"}),l.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[l.jsx(hr,{name:"TanStack Router",description:"类型安全的路由库",license:"MIT"}),l.jsx(hr,{name:"Zustand",description:"轻量级状态管理",license:"MIT"})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("p",{className:"text-sm font-medium text-foreground",children:"表单处理"}),l.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[l.jsx(hr,{name:"React Hook Form",description:"高性能表单库",license:"MIT"}),l.jsx(hr,{name:"Zod",description:"TypeScript 优先的 schema 验证",license:"MIT"})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("p",{className:"text-sm font-medium text-foreground",children:"工具库"}),l.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[l.jsx(hr,{name:"clsx",description:"条件 className 构建工具",license:"MIT"}),l.jsx(hr,{name:"tailwind-merge",description:"Tailwind 类名合并工具",license:"MIT"}),l.jsx(hr,{name:"class-variance-authority",description:"组件变体管理",license:"Apache-2.0"}),l.jsx(hr,{name:"date-fns",description:"现代化日期处理库",license:"MIT"})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("p",{className:"text-sm font-medium text-foreground",children:"动画效果"}),l.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[l.jsx(hr,{name:"Framer Motion",description:"React 动画库",license:"MIT"}),l.jsx(hr,{name:"vaul",description:"抽屉组件动画",license:"MIT"})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("p",{className:"text-sm font-medium text-foreground",children:"后端框架"}),l.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[l.jsx(hr,{name:"FastAPI",description:"现代化 Python Web 框架",license:"MIT"}),l.jsx(hr,{name:"Uvicorn",description:"ASGI 服务器",license:"BSD-3-Clause"}),l.jsx(hr,{name:"Pydantic",description:"数据验证库",license:"MIT"}),l.jsx(hr,{name:"python-multipart",description:"文件上传支持",license:"Apache-2.0"})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("p",{className:"text-sm font-medium text-foreground",children:"开发工具"}),l.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[l.jsx(hr,{name:"TypeScript",description:"JavaScript 的超集",license:"Apache-2.0"}),l.jsx(hr,{name:"Vite",description:"下一代前端构建工具",license:"MIT"}),l.jsx(hr,{name:"ESLint",description:"JavaScript 代码检查工具",license:"MIT"}),l.jsx(hr,{name:"PostCSS",description:"CSS 转换工具",license:"MIT"})]})]})]})})]}),l.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[l.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"开源许可"}),l.jsxs("div",{className:"space-y-3",children:[l.jsx("div",{className:"rounded-lg bg-primary/5 border border-primary/20 p-3 sm:p-4",children:l.jsxs("div",{className:"flex items-start gap-2 sm:gap-3",children:[l.jsx("div",{className:"flex-shrink-0 mt-0.5",children:l.jsx("div",{className:"rounded-md bg-primary/10 px-2 py-1",children:l.jsx("span",{className:"text-xs sm:text-sm font-bold text-primary",children:"GPLv3"})})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("p",{className:"text-sm sm:text-base font-semibold text-foreground mb-1",children:"MaiBot WebUI"}),l.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"本项目采用 GNU General Public License v3.0 开源许可证。 您可以自由地使用、修改和分发本软件,但必须保持相同的开源许可。"})]})]})}),l.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"本项目依赖的所有开源库均遵循各自的开源许可证(MIT、Apache-2.0、BSD 等)。 感谢所有开源贡献者的无私奉献。"})]})]})]})}function hr({name:t,description:e,license:n}){return l.jsxs("div",{className:"flex items-start justify-between gap-2 rounded-lg border bg-muted/30 p-2.5 sm:p-3",children:[l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("p",{className:"font-medium text-foreground truncate",children:t}),l.jsx("p",{className:"text-muted-foreground text-xs mt-0.5",children:e})]}),l.jsx("span",{className:"inline-flex items-center rounded-full bg-primary/10 px-2 py-0.5 text-[10px] font-medium text-primary flex-shrink-0",children:n})]})}function pw({value:t,current:e,onChange:n,label:r,description:s}){const i=e===t;return l.jsxs("button",{onClick:()=>n(t),className:ve("relative rounded-lg border-2 p-3 sm:p-4 text-left transition-all","hover:border-primary/50 hover:bg-accent/50",i?"border-primary bg-accent":"border-border"),children:[i&&l.jsx("div",{className:"absolute top-2 right-2 sm:top-3 sm:right-3 h-2 w-2 rounded-full bg-primary"}),l.jsxs("div",{className:"space-y-1",children:[l.jsx("div",{className:"text-sm sm:text-base font-medium",children:r}),l.jsx("div",{className:"text-[10px] sm:text-xs text-muted-foreground",children:s})]}),l.jsxs("div",{className:"mt-2 sm:mt-3 flex gap-1",children:[t==="light"&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-200"}),l.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-300"}),l.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-400"})]}),t==="dark"&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-700"}),l.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-800"}),l.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-900"})]}),t==="system"&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-200 to-slate-700"}),l.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-300 to-slate-800"}),l.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-400 to-slate-900"})]})]})]})}function Wi({value:t,current:e,onChange:n,label:r,colorClass:s}){const i=e===t;return l.jsxs("button",{onClick:()=>n(t),className:ve("relative rounded-lg border-2 p-2 sm:p-3 text-left transition-all","hover:border-primary/50 hover:bg-accent/50",i?"border-primary bg-accent":"border-border"),children:[i&&l.jsx("div",{className:"absolute top-1.5 right-1.5 sm:top-2 sm:right-2 h-1.5 w-1.5 sm:h-2 sm:w-2 rounded-full bg-primary"}),l.jsxs("div",{className:"flex flex-col items-center gap-1.5 sm:gap-2",children:[l.jsx("div",{className:ve("h-8 w-8 sm:h-10 sm:w-10 rounded-full",s)}),l.jsx("div",{className:"text-[10px] sm:text-xs font-medium text-center",children:r})]})]})}class Gte{grad3;p;perm;constructor(e=0){this.grad3=[[1,1,0],[-1,1,0],[1,-1,0],[-1,-1,0],[1,0,1],[-1,0,1],[1,0,-1],[-1,0,-1],[0,1,1],[0,-1,1],[0,1,-1],[0,-1,-1]],this.p=[];for(let n=0;n<256;n++)this.p[n]=Math.floor(Math.random()*256);this.perm=[];for(let n=0;n<512;n++)this.perm[n]=this.p[n&255]}dot(e,n,r){return e[0]*n+e[1]*r}mix(e,n,r){return(1-r)*e+r*n}fade(e){return e*e*e*(e*(e*6-15)+10)}perlin2(e,n){const r=Math.floor(e)&255,s=Math.floor(n)&255;e-=Math.floor(e),n-=Math.floor(n);const i=this.fade(e),a=this.fade(n),o=this.perm[r]+s,c=this.perm[o],h=this.perm[o+1],f=this.perm[r+1]+s,m=this.perm[f],g=this.perm[f+1];return this.mix(this.mix(this.dot(this.grad3[c%12],e,n),this.dot(this.grad3[m%12],e-1,n),i),this.mix(this.dot(this.grad3[h%12],e,n-1),this.dot(this.grad3[g%12],e-1,n-1),i),a)}}function Xte(){const t=b.useRef(null),e=b.useRef(null),n=b.useRef(void 0),r=b.useRef({mouse:{x:-10,y:0,lx:0,ly:0,sx:0,sy:0,v:0,vs:0,a:0,set:!1},lines:[],paths:[],noise:new Gte(Math.random()),bounding:null});return b.useEffect(()=>{const s=e.current,i=t.current;if(!s||!i)return;const a=r.current,o=()=>{const w=s.getBoundingClientRect();a.bounding=w,i.style.width=`${w.width}px`,i.style.height=`${w.height}px`},c=()=>{if(!a.bounding)return;const{width:w,height:S}=a.bounding;a.lines=[],a.paths.forEach(P=>P.remove()),a.paths=[];const k=10,N=32,C=w+200,T=S+30,_=Math.ceil(C/k),E=Math.ceil(T/N),M=(w-k*_)/2,L=(S-N*E)/2;for(let P=0;P<=_;P++){const I=[];for(let U=0;U<=E;U++){const ee={x:M+k*P,y:L+N*U,wave:{x:0,y:0},cursor:{x:0,y:0,vx:0,vy:0}};I.push(ee)}const Q=document.createElementNS("http://www.w3.org/2000/svg","path");i.appendChild(Q),a.paths.push(Q),a.lines.push(I)}},h=w=>{const{lines:S,mouse:k,noise:N}=a;S.forEach(C=>{C.forEach(T=>{const _=N.perlin2((T.x+w*.0125)*.002,(T.y+w*.005)*.0015)*12;T.wave.x=Math.cos(_)*32,T.wave.y=Math.sin(_)*16;const E=T.x-k.sx,M=T.y-k.sy,L=Math.hypot(E,M),P=Math.max(175,k.vs);if(L{const k={x:w.x+w.wave.x+(S?w.cursor.x:0),y:w.y+w.wave.y+(S?w.cursor.y:0)};return k.x=Math.round(k.x*10)/10,k.y=Math.round(k.y*10)/10,k},m=()=>{const{lines:w,paths:S}=a;w.forEach((k,N)=>{let C=f(k[0],!1),T=`M ${C.x} ${C.y}`;k.forEach((_,E)=>{const M=E===k.length-1;C=f(_,!M),T+=`L ${C.x} ${C.y}`}),S[N].setAttribute("d",T)})},g=w=>{const{mouse:S}=a;S.sx+=(S.x-S.sx)*.1,S.sy+=(S.y-S.sy)*.1;const k=S.x-S.lx,N=S.y-S.ly,C=Math.hypot(k,N);S.v=C,S.vs+=(C-S.vs)*.1,S.vs=Math.min(100,S.vs),S.lx=S.x,S.ly=S.y,S.a=Math.atan2(N,k),s&&(s.style.setProperty("--x",`${S.sx}px`),s.style.setProperty("--y",`${S.sy}px`)),h(w),m(),n.current=requestAnimationFrame(g)},x=w=>{if(!a.bounding)return;const{mouse:S}=a;S.x=w.pageX-a.bounding.left,S.y=w.pageY-a.bounding.top+window.scrollY,S.set||(S.sx=S.x,S.sy=S.y,S.lx=S.x,S.ly=S.y,S.set=!0)},y=()=>{o(),c()};return o(),c(),window.addEventListener("resize",y),window.addEventListener("mousemove",x),n.current=requestAnimationFrame(g),()=>{window.removeEventListener("resize",y),window.removeEventListener("mousemove",x),n.current&&cancelAnimationFrame(n.current)}},[]),l.jsxs("div",{ref:e,className:"waves-background",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",overflow:"hidden",pointerEvents:"none"},children:[l.jsx("div",{className:"waves-cursor",style:{position:"absolute",top:0,left:0,width:"0.5rem",height:"0.5rem",background:"hsl(var(--primary) / 0.3)",borderRadius:"50%",transform:"translate3d(calc(var(--x, -0.5rem) - 50%), calc(var(--y, 50%) - 50%), 0)",willChange:"transform",pointerEvents:"none"}}),l.jsx("svg",{ref:t,style:{display:"block",width:"100%",height:"100%"},children:l.jsx("style",{children:` path { fill: none; stroke: hsl(var(--primary) / 0.20); stroke-width: 1px; } - `})})]})}function Gte(){const t=Ma();b.useEffect(()=>{localStorage.getItem("access-token")||t({to:"/auth"})},[t])}function dL(){return!!localStorage.getItem("access-token")}function Xte(){const[t,e]=b.useState(""),[n,r]=b.useState(!1),[s,i]=b.useState(""),a=Ma(),{enableWavesBackground:o,setEnableWavesBackground:c}=LP(),{theme:h,setTheme:f}=f6();b.useEffect(()=>{dL()&&a({to:"/"})},[a]);const g=h==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":h,x=()=>{f(g==="dark"?"light":"dark")},y=async w=>{if(w.preventDefault(),i(""),!t.trim()){i("请输入 Access Token");return}r(!0);try{const S=await fetch("/api/webui/auth/verify",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:t.trim()})}),k=await S.json();if(S.ok&&k.valid){localStorage.setItem("access-token",t.trim());const N=await fetch("/api/webui/setup/status",{method:"GET",headers:{Authorization:`Bearer ${t.trim()}`}}),C=await N.json();N.ok&&C.is_first_setup?a({to:"/setup"}):a({to:"/"})}else i(k.message||"Token 验证失败,请检查后重试")}catch(S){console.error("Token 验证错误:",S),i("连接服务器失败,请检查网络连接")}finally{r(!1)}};return l.jsxs("div",{className:"relative flex min-h-screen items-center justify-center overflow-hidden bg-background p-4",children:[o&&l.jsx(Wte,{}),l.jsxs(Tt,{className:"relative z-10 w-full max-w-md shadow-2xl backdrop-blur-xl bg-card/80 border-border/50",children:[l.jsx("button",{onClick:x,className:"absolute right-4 top-4 rounded-lg p-2 hover:bg-accent transition-colors z-10 text-foreground",title:g==="dark"?"切换到浅色模式":"切换到深色模式",children:g==="dark"?l.jsx(T3,{className:"h-5 w-5",strokeWidth:2.5,fill:"none"}):l.jsx(E3,{className:"h-5 w-5",strokeWidth:2.5,fill:"none"})}),l.jsxs(vn,{className:"space-y-4 text-center",children:[l.jsx("div",{className:"mx-auto flex h-16 w-16 items-center justify-center rounded-2xl bg-primary/10",children:l.jsx(PC,{className:"h-8 w-8 text-primary",strokeWidth:2,fill:"none"})}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(yn,{className:"text-2xl font-bold",children:"欢迎使用 MaiBot"}),l.jsx(zr,{className:"text-base",children:"请输入您的 Access Token 以继续访问系统"})]})]}),l.jsx(En,{children:l.jsxs("form",{onSubmit:y,className:"space-y-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(de,{htmlFor:"token",className:"text-sm font-medium",children:"Access Token"}),l.jsxs("div",{className:"relative",children:[l.jsx(nz,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground",strokeWidth:2,fill:"none"}),l.jsx(Pe,{id:"token",type:"password",placeholder:"请输入您的 Access Token",value:t,onChange:w=>e(w.target.value),className:ye("pl-10",s&&"border-red-500 focus-visible:ring-red-500"),disabled:n,autoFocus:!0,autoComplete:"off"})]})]}),s&&l.jsxs("div",{className:"flex items-center gap-2 rounded-md bg-red-50 p-3 text-sm text-red-600 dark:bg-red-950/50 dark:text-red-400",children:[l.jsx(ju,{className:"h-4 w-4 flex-shrink-0",strokeWidth:2,fill:"none"}),l.jsx("span",{children:s})]}),l.jsx(fe,{type:"submit",className:"w-full",disabled:n,children:n?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}),"验证中..."]}):"验证并进入"}),l.jsxs(fr,{children:[l.jsx(Bh,{asChild:!0,children:l.jsxs("button",{className:"w-full text-center text-sm text-primary hover:text-primary/80 transition-colors underline-offset-4 hover:underline flex items-center justify-center gap-1",children:[l.jsx(Av,{className:"h-4 w-4",strokeWidth:2,fill:"none"}),"我没有 Token,我该去哪里获得 Token?"]})}),l.jsxs(rr,{className:"sm:max-w-md",children:[l.jsxs(sr,{children:[l.jsxs(ir,{className:"flex items-center gap-2",children:[l.jsx(PC,{className:"h-5 w-5 text-primary",strokeWidth:2,fill:"none"}),"如何获取 Access Token"]}),l.jsx(Ir,{children:"Access Token 是访问 MaiBot WebUI 的唯一凭证,请按以下方式获取"})]}),l.jsxs("div",{className:"space-y-4",children:[l.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx(AK,{className:"h-5 w-5 text-primary flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),l.jsxs("div",{className:"flex-1 space-y-2",children:[l.jsx("h4",{className:"font-semibold text-sm",children:"方式一:查看启动日志"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"在 MaiBot 启动时,控制台会显示 WebUI Access Token。"}),l.jsxs("div",{className:"rounded bg-background p-2 font-mono text-xs",children:[l.jsx("p",{className:"text-muted-foreground",children:"🔑 WebUI Access Token: abc123..."}),l.jsx("p",{className:"text-muted-foreground",children:"💡 请使用此 Token 登录 WebUI"})]})]})]})}),l.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx(io,{className:"h-5 w-5 text-primary flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),l.jsxs("div",{className:"flex-1 space-y-2",children:[l.jsx("h4",{className:"font-semibold text-sm",children:"方式二:查看配置文件"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"Token 保存在项目根目录的配置文件中:"}),l.jsx("div",{className:"rounded bg-background p-2 font-mono text-xs break-all",children:l.jsx("code",{className:"text-primary",children:"data/webui.json"})}),l.jsxs("p",{className:"text-xs text-muted-foreground",children:["打开此文件,复制 ",l.jsx("code",{className:"px-1 py-0.5 bg-background rounded",children:"access_token"})," 字段的值"]})]})]})}),l.jsx("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3",children:l.jsxs("div",{className:"flex gap-2",children:[l.jsx(ju,{className:"h-4 w-4 text-yellow-600 dark:text-yellow-500 flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),l.jsxs("div",{className:"text-sm text-yellow-800 dark:text-yellow-300 space-y-1",children:[l.jsx("p",{className:"font-semibold",children:"安全提示"}),l.jsxs("ul",{className:"list-disc list-inside space-y-0.5 text-xs",children:[l.jsx("li",{children:"请妥善保管您的 Token,不要泄露给他人"}),l.jsx("li",{children:"如需重置 Token,请在登录后前往系统设置"})]})]})]})})]})]})]}),l.jsxs(wn,{children:[l.jsx(Lr,{asChild:!0,children:l.jsxs("button",{className:"w-full text-center text-sm text-muted-foreground hover:text-foreground transition-colors underline-offset-4 hover:underline flex items-center justify-center gap-1",children:[l.jsx(C3,{className:"h-4 w-4",strokeWidth:2,fill:"none"}),"我觉得这个界面很卡怎么办?"]})}),l.jsxs(un,{children:[l.jsxs(dn,{children:[l.jsxs(fn,{className:"flex items-center gap-2",children:[l.jsx(C3,{className:"h-5 w-5 text-primary",strokeWidth:2,fill:"none"}),"关闭背景动画"]}),l.jsx(mn,{children:"背景动画可能会在低性能设备上造成卡顿。关闭动画可以显著提升界面流畅度。"})]}),l.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:l.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭动画后,背景将变为纯色,但不影响任何功能的使用。您可以随时在系统设置中重新开启动画。"})}),l.jsxs(hn,{children:[l.jsx(gn,{children:"取消"}),l.jsx(pn,{onClick:()=>c(!1),children:"关闭动画"})]})]})]})]})})]}),l.jsx("div",{className:"absolute bottom-4 left-0 right-0 text-center text-xs text-muted-foreground",children:l.jsx("p",{children:kte})})]})}const dr=b.forwardRef(({className:t,...e},n)=>l.jsx("textarea",{className:ye("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),ref:n,...e}));dr.displayName="Textarea";var Yte=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Kte=Yte.reduce((t,e)=>{const n=Vk(`Primitive.${e}`),r=b.forwardRef((s,i)=>{const{asChild:a,...o}=s,c=a?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(c,{...o,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),Zte="Separator",w9="horizontal",Jte=["horizontal","vertical"],hL=b.forwardRef((t,e)=>{const{decorative:n,orientation:r=w9,...s}=t,i=ene(r)?r:w9,o=n?{role:"none"}:{"aria-orientation":i==="vertical"?i:void 0,role:"separator"};return l.jsx(Kte.div,{"data-orientation":i,...o,...s,ref:e})});hL.displayName=Zte;function ene(t){return Jte.includes(t)}var fL=hL;const Hm=b.forwardRef(({className:t,orientation:e="horizontal",decorative:n=!0,...r},s)=>l.jsx(fL,{ref:s,decorative:n,orientation:e,className:ye("shrink-0 bg-border",e==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",t),...r}));Hm.displayName=fL.displayName;const tne=Ih("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function In({className:t,variant:e,...n}){return l.jsx("div",{className:ye(tne({variant:e}),t),...n})}function nne({config:t,onChange:e}){const n=s=>{s.trim()&&!t.alias_names.includes(s.trim())&&e({...t,alias_names:[...t.alias_names,s.trim()]})},r=s=>{e({...t,alias_names:t.alias_names.filter((i,a)=>a!==s)})};return l.jsxs("div",{className:"space-y-6",children:[l.jsxs("div",{className:"space-y-3",children:[l.jsx(de,{htmlFor:"qq_account",children:"QQ账号 *"}),l.jsx(Pe,{id:"qq_account",type:"number",placeholder:"请输入机器人的QQ账号",value:t.qq_account||"",onChange:s=>e({...t,qq_account:Number(s.target.value)})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人登录使用的QQ账号"})]}),l.jsxs("div",{className:"space-y-3",children:[l.jsx(de,{htmlFor:"nickname",children:"昵称 *"}),l.jsx(Pe,{id:"nickname",placeholder:"请输入机器人的昵称",value:t.nickname,onChange:s=>e({...t,nickname:s.target.value})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人的主要称呼名称"})]}),l.jsxs("div",{className:"space-y-3",children:[l.jsx(de,{children:"别名"}),l.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:t.alias_names.map((s,i)=>l.jsxs(In,{variant:"secondary",className:"gap-1",children:[s,l.jsx("button",{type:"button",onClick:()=>r(i),className:"ml-1 hover:text-destructive",children:l.jsx(R0,{className:"h-3 w-3"})})]},i))}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx(Pe,{id:"alias_input",placeholder:"输入别名后按回车添加",onKeyPress:s=>{s.key==="Enter"&&(n(s.target.value),s.target.value="")}}),l.jsx(fe,{type:"button",variant:"outline",onClick:()=>{const s=document.getElementById("alias_input");s&&(n(s.value),s.value="")},children:"添加"})]}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人的其他称呼,可以添加多个"})]})]})}function rne({config:t,onChange:e}){return l.jsxs("div",{className:"space-y-6",children:[l.jsxs("div",{className:"space-y-3",children:[l.jsx(de,{htmlFor:"personality",children:"人格特征 *"}),l.jsx(dr,{id:"personality",placeholder:"描述机器人的人格特质和身份特征(建议120字以内)",value:t.personality,onChange:n=>e({...t,personality:n.target.value}),rows:3}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"例如:是一个女大学生,现在在读大二,会刷贴吧"})]}),l.jsxs("div",{className:"space-y-3",children:[l.jsx(de,{htmlFor:"reply_style",children:"表达风格 *"}),l.jsx(dr,{id:"reply_style",placeholder:"描述机器人说话的表达风格、表达习惯",value:t.reply_style,onChange:n=>e({...t,reply_style:n.target.value}),rows:3}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"例如:回复平淡一些,简短一些,说中文,参考贴吧、知乎和微博的回复风格"})]}),l.jsxs("div",{className:"space-y-3",children:[l.jsx(de,{htmlFor:"interest",children:"兴趣 *"}),l.jsx(dr,{id:"interest",placeholder:"描述机器人感兴趣的话题",value:t.interest,onChange:n=>e({...t,interest:n.target.value}),rows:2}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"会影响机器人对什么话题进行回复"})]}),l.jsx(Hm,{}),l.jsxs("div",{className:"space-y-3",children:[l.jsx(de,{htmlFor:"plan_style",children:"群聊说话规则 *"}),l.jsx(dr,{id:"plan_style",placeholder:"机器人在群聊中的行为风格和规则",value:t.plan_style,onChange:n=>e({...t,plan_style:n.target.value}),rows:4}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"定义机器人在群聊中如何行动,例如回复频率、条件等"})]}),l.jsxs("div",{className:"space-y-3",children:[l.jsx(de,{htmlFor:"private_plan_style",children:"私聊说话规则 *"}),l.jsx(dr,{id:"private_plan_style",placeholder:"机器人在私聊中的行为风格和规则",value:t.private_plan_style,onChange:n=>e({...t,private_plan_style:n.target.value}),rows:3}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"定义机器人在私聊中的行为方式"})]})]})}function sne({config:t,onChange:e}){return l.jsxs("div",{className:"space-y-6",children:[l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx(de,{htmlFor:"emoji_chance",children:"表情包激活概率"}),l.jsxs("span",{className:"text-sm text-muted-foreground",children:[(t.emoji_chance*100).toFixed(0),"%"]})]}),l.jsx(Pe,{id:"emoji_chance",type:"range",min:"0",max:"1",step:"0.1",value:t.emoji_chance,onChange:n=>e({...t,emoji_chance:Number(n.target.value)})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人发送表情包的概率"})]}),l.jsxs("div",{className:"space-y-3",children:[l.jsx(de,{htmlFor:"max_reg_num",children:"最大表情包数量"}),l.jsx(Pe,{id:"max_reg_num",type:"number",min:"1",max:"200",value:t.max_reg_num,onChange:n=>e({...t,max_reg_num:Number(n.target.value)})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人最多保存的表情包数量"})]}),l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"space-y-1",children:[l.jsx(de,{htmlFor:"do_replace",children:"达到最大数量时替换"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"开启后会删除旧表情包,关闭则不再收集新表情包"})]}),l.jsx(_t,{id:"do_replace",checked:t.do_replace,onCheckedChange:n=>e({...t,do_replace:n})})]}),l.jsxs("div",{className:"space-y-3",children:[l.jsx(de,{htmlFor:"check_interval",children:"检查间隔(分钟)"}),l.jsx(Pe,{id:"check_interval",type:"number",min:"1",max:"120",value:t.check_interval,onChange:n=>e({...t,check_interval:Number(n.target.value)})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"检查表情包注册、破损、删除的时间间隔"})]}),l.jsx(Hm,{}),l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"space-y-1",children:[l.jsx(de,{htmlFor:"steal_emoji",children:"偷取表情包"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人将一些表情包据为己有"})]}),l.jsx(_t,{id:"steal_emoji",checked:t.steal_emoji,onCheckedChange:n=>e({...t,steal_emoji:n})})]}),l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"space-y-1",children:[l.jsx(de,{htmlFor:"content_filtration",children:"启用表情包过滤"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"只保存符合要求的表情包"})]}),l.jsx(_t,{id:"content_filtration",checked:t.content_filtration,onCheckedChange:n=>e({...t,content_filtration:n})})]}),t.content_filtration&&l.jsxs("div",{className:"space-y-3",children:[l.jsx(de,{htmlFor:"filtration_prompt",children:"过滤要求"}),l.jsx(Pe,{id:"filtration_prompt",placeholder:"例如:符合公序良俗",value:t.filtration_prompt,onChange:n=>e({...t,filtration_prompt:n.target.value})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"描述表情包应该符合的要求"})]})]})}function ine({config:t,onChange:e}){return l.jsxs("div",{className:"space-y-6",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"space-y-1",children:[l.jsx(de,{htmlFor:"enable_tool",children:"启用工具系统"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人使用各种工具增强功能"})]}),l.jsx(_t,{id:"enable_tool",checked:t.enable_tool,onCheckedChange:n=>e({...t,enable_tool:n})})]}),l.jsx(Hm,{}),l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"space-y-1",children:[l.jsx(de,{htmlFor:"enable_mood",children:"启用情绪系统"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"让机器人具有情绪变化能力"})]}),l.jsx(_t,{id:"enable_mood",checked:t.enable_mood,onCheckedChange:n=>e({...t,enable_mood:n})})]}),t.enable_mood&&l.jsxs("div",{className:"ml-6 space-y-6 border-l-2 border-primary/20 pl-6",children:[l.jsxs("div",{className:"space-y-3",children:[l.jsx(de,{htmlFor:"mood_update_threshold",children:"情绪更新阈值"}),l.jsx(Pe,{id:"mood_update_threshold",type:"number",min:"0.1",max:"10",step:"0.1",value:t.mood_update_threshold||1,onChange:n=>e({...t,mood_update_threshold:Number(n.target.value)})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"值越高,情绪更新越慢"})]}),l.jsxs("div",{className:"space-y-3",children:[l.jsx(de,{htmlFor:"emotion_style",children:"情感特征"}),l.jsx(dr,{id:"emotion_style",placeholder:"描述情绪的变化情况,例如:情绪较为稳定,但遭遇特定事件时起伏较大",value:t.emotion_style||"",onChange:n=>e({...t,emotion_style:n.target.value}),rows:2}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"影响机器人的情绪变化方式"})]})]}),l.jsx(Hm,{}),l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"space-y-1",children:[l.jsx(de,{htmlFor:"all_global",children:"启用全局黑话模式"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人学习和使用群组黑话"})]}),l.jsx(_t,{id:"all_global",checked:t.all_global,onCheckedChange:n=>e({...t,all_global:n})})]})]})}function ane({config:t,onChange:e}){const[n,r]=b.useState(!1);return l.jsxs("div",{className:"space-y-6",children:[l.jsx("div",{className:"rounded-lg bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-4",children:l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx("div",{className:"mt-0.5",children:l.jsx("svg",{className:"h-5 w-5 text-blue-600 dark:text-blue-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),l.jsxs("div",{className:"flex-1 text-sm",children:[l.jsx("p",{className:"font-medium text-blue-900 dark:text-blue-100 mb-1",children:"关于硅基流动 (SiliconFlow)"}),l.jsx("p",{className:"text-blue-700 dark:text-blue-300 mb-2",children:"硅基流动提供了完整的模型覆盖,包括 DeepSeek V3、Qwen、视觉模型、语音识别和嵌入模型。 只需一个 API Key 即可使用麦麦的所有功能!"}),l.jsxs("a",{href:"https://cloud.siliconflow.cn",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-blue-600 dark:text-blue-400 hover:underline font-medium",children:["前往硅基流动获取 API Key",l.jsx(Kd,{className:"h-3 w-3"})]})]})]})}),l.jsxs("div",{className:"space-y-3",children:[l.jsx(de,{htmlFor:"siliconflow_api_key",children:"SiliconFlow API Key *"}),l.jsxs("div",{className:"relative",children:[l.jsx(Pe,{id:"siliconflow_api_key",type:n?"text":"password",placeholder:"sk-...",value:t.api_key,onChange:s=>e({api_key:s.target.value}),className:"font-mono pr-10"}),l.jsx(fe,{type:"button",variant:"ghost",size:"sm",className:"absolute right-0 top-0 h-full px-3 hover:bg-transparent",onClick:()=>r(!n),children:n?l.jsx(O1,{className:"h-4 w-4 text-muted-foreground"}):l.jsx(aa,{className:"h-4 w-4 text-muted-foreground"})})]}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"请输入您的硅基流动 API 密钥。获取后,麦麦将自动配置所有必需的模型。"})]}),l.jsxs("div",{className:"rounded-lg bg-muted/50 p-4 text-sm space-y-2",children:[l.jsx("p",{className:"font-medium",children:"将自动配置以下模型:"}),l.jsxs("ul",{className:"list-disc list-inside space-y-1 text-muted-foreground ml-2",children:[l.jsx("li",{children:"DeepSeek V3 - 主要对话和工具模型"}),l.jsx("li",{children:"Qwen3 30B - 高频小任务和工具调用"}),l.jsx("li",{children:"Qwen3 VL 30B - 图像识别"}),l.jsx("li",{children:"SenseVoice - 语音识别"}),l.jsx("li",{children:"BGE-M3 - 文本嵌入"}),l.jsx("li",{children:"知识库相关模型 (LPMM)"})]})]}),l.jsx("div",{className:"rounded-lg border border-amber-200 dark:border-amber-800 bg-amber-50 dark:bg-amber-950/30 p-4",children:l.jsxs("p",{className:"text-sm text-amber-900 dark:text-amber-100",children:[l.jsx("span",{className:"font-medium",children:"💡 提示:"}),'完成向导后,您可以在"系统设置 → 模型配置"中添加更多 API 提供商和模型。']})})]})}async function mt(t,e){const n=await fetch(t,e);if(n.status===401)throw localStorage.removeItem("access-token"),window.location.href="/auth",new Error("认证失败,请重新登录");return n}function Nt(){return{"Content-Type":"application/json",Authorization:`Bearer ${localStorage.getItem("access-token")}`}}async function lne(){const t=await mt("/api/webui/config/bot",{method:"GET",headers:Nt()});if(!t.ok)throw new Error("读取Bot配置失败");const n=(await t.json()).config.bot||{};return{qq_account:n.qq_account||0,nickname:n.nickname||"",alias_names:n.alias_names||[]}}async function one(){const t=await mt("/api/webui/config/bot",{method:"GET",headers:Nt()});if(!t.ok)throw new Error("读取人格配置失败");const n=(await t.json()).config.personality||{};return{personality:n.personality||"",reply_style:n.reply_style||"",interest:n.interest||"",plan_style:n.plan_style||"",private_plan_style:n.private_plan_style||""}}async function cne(){const t=await mt("/api/webui/config/bot",{method:"GET",headers:Nt()});if(!t.ok)throw new Error("读取表情包配置失败");const n=(await t.json()).config.emoji||{};return{emoji_chance:n.emoji_chance??.4,max_reg_num:n.max_reg_num??40,do_replace:n.do_replace??!0,check_interval:n.check_interval??10,steal_emoji:n.steal_emoji??!0,content_filtration:n.content_filtration??!1,filtration_prompt:n.filtration_prompt||""}}async function une(){const t=await mt("/api/webui/config/bot",{method:"GET",headers:Nt()});if(!t.ok)throw new Error("读取其他配置失败");const n=(await t.json()).config,r=n.tool||{},s=n.mood||{},i=n.jargon||{};return{enable_tool:r.enable_tool??!0,enable_mood:s.enable_mood??!1,mood_update_threshold:s.mood_update_threshold,emotion_style:s.emotion_style,all_global:i.all_global??!0}}async function dne(){const t=await mt("/api/webui/config/model",{method:"GET",headers:Nt()});if(!t.ok)throw new Error("读取模型配置失败");return{api_key:((await t.json()).config.api_providers||[]).find(i=>i.name==="SiliconFlow")?.api_key||""}}async function hne(t){const e=await mt("/api/webui/config/bot/section/bot",{method:"POST",headers:Nt(),body:JSON.stringify(t)});if(!e.ok){const n=await e.json();throw new Error(n.detail||"保存Bot基础配置失败")}return await e.json()}async function fne(t){const e=await mt("/api/webui/config/bot/section/personality",{method:"POST",headers:Nt(),body:JSON.stringify(t)});if(!e.ok){const n=await e.json();throw new Error(n.detail||"保存人格配置失败")}return await e.json()}async function mne(t){const e=await mt("/api/webui/config/bot/section/emoji",{method:"POST",headers:Nt(),body:JSON.stringify(t)});if(!e.ok){const n=await e.json();throw new Error(n.detail||"保存表情包配置失败")}return await e.json()}async function pne(t){const e=[];e.push(mt("/api/webui/config/bot/section/tool",{method:"POST",headers:Nt(),body:JSON.stringify({enable_tool:t.enable_tool})})),e.push(mt("/api/webui/config/bot/section/jargon",{method:"POST",headers:Nt(),body:JSON.stringify({all_global:t.all_global})}));const n={enable_mood:t.enable_mood};t.enable_mood&&(n.mood_update_threshold=t.mood_update_threshold||1,n.emotion_style=t.emotion_style||""),e.push(mt("/api/webui/config/bot/section/mood",{method:"POST",headers:Nt(),body:JSON.stringify(n)}));const r=await Promise.all(e);for(const s of r)if(!s.ok){const i=await s.json();throw new Error(i.detail||"保存其他配置失败")}return{success:!0}}async function gne(t){const e=await mt("/api/webui/config/model",{method:"GET",headers:Nt()});if(!e.ok)throw new Error("读取模型配置失败");const r=(await e.json()).config,s=r.api_providers||[],i=s.findIndex(c=>c.name==="SiliconFlow");i>=0?s[i]={...s[i],api_key:t.api_key}:s.push({name:"SiliconFlow",base_url:"https://api.siliconflow.cn/v1",api_key:t.api_key,client_type:"openai",max_retry:3,timeout:120,retry_interval:5});const a={...r,api_providers:s},o=await mt("/api/webui/config/model",{method:"POST",headers:Nt(),body:JSON.stringify(a)});if(!o.ok){const c=await o.json();throw new Error(c.detail||"保存模型配置失败")}return await o.json()}async function S9(){const t=localStorage.getItem("access-token"),e=await mt("/api/webui/setup/complete",{method:"POST",headers:{Authorization:`Bearer ${t}`}});if(!e.ok){const n=await e.json();throw new Error(n.message||"标记配置完成失败")}return await e.json()}async function Hv(){const t=await mt("/api/webui/system/restart",{method:"POST",headers:Nt()});if(!t.ok){const e=await t.json();throw new Error(e.detail||"重启失败")}return await t.json()}async function xne(){const t=await mt("/api/webui/system/status",{method:"GET",headers:Nt()});if(!t.ok){const e=await t.json();throw new Error(e.detail||"获取状态失败")}return await t.json()}function vne(){const t=Ma(),{toast:e}=Gr(),[n,r]=b.useState(0),[s,i]=b.useState(!1),[a,o]=b.useState(!1),[c,h]=b.useState(!0),[f,m]=b.useState({qq_account:0,nickname:"",alias_names:[]}),[g,x]=b.useState({personality:"是一个女大学生,现在在读大二,会刷贴吧。",reply_style:"请回复的平淡一些,简短一些,说中文,不要刻意突出自身学科背景。可以参考贴吧,知乎和微博的回复风格。",interest:"对技术相关话题,游戏和动漫相关话题感兴趣,也对日常话题感兴趣,不喜欢太过沉重严肃的话题",plan_style:`1.思考**所有**的可用的action中的**每个动作**是否符合当下条件,如果动作使用条件符合聊天内容就使用 + `})})]})}function Yte(){const t=Da();b.useEffect(()=>{localStorage.getItem("access-token")||t({to:"/auth"})},[t])}function fL(){return!!localStorage.getItem("access-token")}function Kte(){const[t,e]=b.useState(""),[n,r]=b.useState(!1),[s,i]=b.useState(""),a=Da(),{enableWavesBackground:o,setEnableWavesBackground:c}=BP(),{theme:h,setTheme:f}=b6();b.useEffect(()=>{fL()&&a({to:"/"})},[a]);const g=h==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":h,x=()=>{f(g==="dark"?"light":"dark")},y=async w=>{if(w.preventDefault(),i(""),!t.trim()){i("请输入 Access Token");return}r(!0);try{const S=await fetch("/api/webui/auth/verify",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:t.trim()})}),k=await S.json();if(S.ok&&k.valid){localStorage.setItem("access-token",t.trim());const N=await fetch("/api/webui/setup/status",{method:"GET",headers:{Authorization:`Bearer ${t.trim()}`}}),C=await N.json();N.ok&&C.is_first_setup?a({to:"/setup"}):a({to:"/"})}else i(k.message||"Token 验证失败,请检查后重试")}catch(S){console.error("Token 验证错误:",S),i("连接服务器失败,请检查网络连接")}finally{r(!1)}};return l.jsxs("div",{className:"relative flex min-h-screen items-center justify-center overflow-hidden bg-background p-4",children:[o&&l.jsx(Xte,{}),l.jsxs(Dt,{className:"relative z-10 w-full max-w-md shadow-2xl backdrop-blur-xl bg-card/80 border-border/50",children:[l.jsx("button",{onClick:x,className:"absolute right-4 top-4 rounded-lg p-2 hover:bg-accent transition-colors z-10 text-foreground",title:g==="dark"?"切换到浅色模式":"切换到深色模式",children:g==="dark"?l.jsx(D3,{className:"h-5 w-5",strokeWidth:2.5,fill:"none"}):l.jsx(z3,{className:"h-5 w-5",strokeWidth:2.5,fill:"none"})}),l.jsxs(kn,{className:"space-y-4 text-center",children:[l.jsx("div",{className:"mx-auto flex h-16 w-16 items-center justify-center rounded-2xl bg-primary/10",children:l.jsx(LC,{className:"h-8 w-8 text-primary",strokeWidth:2,fill:"none"})}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(jn,{className:"text-2xl font-bold",children:"欢迎使用 MaiBot"}),l.jsx(Fr,{className:"text-base",children:"请输入您的 Access Token 以继续访问系统"})]})]}),l.jsx(Dn,{children:l.jsxs("form",{onSubmit:y,className:"space-y-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{htmlFor:"token",className:"text-sm font-medium",children:"Access Token"}),l.jsxs("div",{className:"relative",children:[l.jsx(iz,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground",strokeWidth:2,fill:"none"}),l.jsx(Pe,{id:"token",type:"password",placeholder:"请输入您的 Access Token",value:t,onChange:w=>e(w.target.value),className:ve("pl-10",s&&"border-red-500 focus-visible:ring-red-500"),disabled:n,autoFocus:!0,autoComplete:"off"})]})]}),s&&l.jsxs("div",{className:"flex items-center gap-2 rounded-md bg-red-50 p-3 text-sm text-red-600 dark:bg-red-950/50 dark:text-red-400",children:[l.jsx(Cu,{className:"h-4 w-4 flex-shrink-0",strokeWidth:2,fill:"none"}),l.jsx("span",{children:s})]}),l.jsx(de,{type:"submit",className:"w-full",disabled:n,children:n?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}),"验证中..."]}):"验证并进入"}),l.jsxs(xr,{children:[l.jsx(Bh,{asChild:!0,children:l.jsxs("button",{className:"w-full text-center text-sm text-primary hover:text-primary/80 transition-colors underline-offset-4 hover:underline flex items-center justify-center gap-1",children:[l.jsx(Dv,{className:"h-4 w-4",strokeWidth:2,fill:"none"}),"我没有 Token,我该去哪里获得 Token?"]})}),l.jsxs(lr,{className:"sm:max-w-md",children:[l.jsxs(or,{children:[l.jsxs(cr,{className:"flex items-center gap-2",children:[l.jsx(LC,{className:"h-5 w-5 text-primary",strokeWidth:2,fill:"none"}),"如何获取 Access Token"]}),l.jsx(Hr,{children:"Access Token 是访问 MaiBot WebUI 的唯一凭证,请按以下方式获取"})]}),l.jsxs("div",{className:"space-y-4",children:[l.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx(DK,{className:"h-5 w-5 text-primary flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),l.jsxs("div",{className:"flex-1 space-y-2",children:[l.jsx("h4",{className:"font-semibold text-sm",children:"方式一:查看启动日志"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"在 MaiBot 启动时,控制台会显示 WebUI Access Token。"}),l.jsxs("div",{className:"rounded bg-background p-2 font-mono text-xs",children:[l.jsx("p",{className:"text-muted-foreground",children:"🔑 WebUI Access Token: abc123..."}),l.jsx("p",{className:"text-muted-foreground",children:"💡 请使用此 Token 登录 WebUI"})]})]})]})}),l.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx(lo,{className:"h-5 w-5 text-primary flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),l.jsxs("div",{className:"flex-1 space-y-2",children:[l.jsx("h4",{className:"font-semibold text-sm",children:"方式二:查看配置文件"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"Token 保存在项目根目录的配置文件中:"}),l.jsx("div",{className:"rounded bg-background p-2 font-mono text-xs break-all",children:l.jsx("code",{className:"text-primary",children:"data/webui.json"})}),l.jsxs("p",{className:"text-xs text-muted-foreground",children:["打开此文件,复制 ",l.jsx("code",{className:"px-1 py-0.5 bg-background rounded",children:"access_token"})," 字段的值"]})]})]})}),l.jsx("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3",children:l.jsxs("div",{className:"flex gap-2",children:[l.jsx(Cu,{className:"h-4 w-4 text-yellow-600 dark:text-yellow-500 flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),l.jsxs("div",{className:"text-sm text-yellow-800 dark:text-yellow-300 space-y-1",children:[l.jsx("p",{className:"font-semibold",children:"安全提示"}),l.jsxs("ul",{className:"list-disc list-inside space-y-0.5 text-xs",children:[l.jsx("li",{children:"请妥善保管您的 Token,不要泄露给他人"}),l.jsx("li",{children:"如需重置 Token,请在登录后前往系统设置"})]})]})]})})]})]})]}),l.jsxs(Nn,{children:[l.jsx(Qr,{asChild:!0,children:l.jsxs("button",{className:"w-full text-center text-sm text-muted-foreground hover:text-foreground transition-colors underline-offset-4 hover:underline flex items-center justify-center gap-1",children:[l.jsx(R3,{className:"h-4 w-4",strokeWidth:2,fill:"none"}),"我觉得这个界面很卡怎么办?"]})}),l.jsxs(gn,{children:[l.jsxs(xn,{children:[l.jsxs(yn,{className:"flex items-center gap-2",children:[l.jsx(R3,{className:"h-5 w-5 text-primary",strokeWidth:2,fill:"none"}),"关闭背景动画"]}),l.jsx(bn,{children:"背景动画可能会在低性能设备上造成卡顿。关闭动画可以显著提升界面流畅度。"})]}),l.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:l.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭动画后,背景将变为纯色,但不影响任何功能的使用。您可以随时在系统设置中重新开启动画。"})}),l.jsxs(vn,{children:[l.jsx(Sn,{children:"取消"}),l.jsx(wn,{onClick:()=>c(!1),children:"关闭动画"})]})]})]})]})})]}),l.jsx("div",{className:"absolute bottom-4 left-0 right-0 text-center text-xs text-muted-foreground",children:l.jsx("p",{children:Ote})})]})}const pr=b.forwardRef(({className:t,...e},n)=>l.jsx("textarea",{className:ve("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),ref:n,...e}));pr.displayName="Textarea";var Zte=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Jte=Zte.reduce((t,e)=>{const n=Kk(`Primitive.${e}`),r=b.forwardRef((s,i)=>{const{asChild:a,...o}=s,c=a?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(c,{...o,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),ene="Separator",S9="horizontal",tne=["horizontal","vertical"],mL=b.forwardRef((t,e)=>{const{decorative:n,orientation:r=S9,...s}=t,i=nne(r)?r:S9,o=n?{role:"none"}:{"aria-orientation":i==="vertical"?i:void 0,role:"separator"};return l.jsx(Jte.div,{"data-orientation":i,...o,...s,ref:e})});mL.displayName=ene;function nne(t){return tne.includes(t)}var pL=mL;const Vm=b.forwardRef(({className:t,orientation:e="horizontal",decorative:n=!0,...r},s)=>l.jsx(pL,{ref:s,decorative:n,orientation:e,className:ve("shrink-0 bg-border",e==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",t),...r}));Vm.displayName=pL.displayName;const rne=Ih("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function In({className:t,variant:e,...n}){return l.jsx("div",{className:ve(rne({variant:e}),t),...n})}function sne({config:t,onChange:e}){const n=s=>{s.trim()&&!t.alias_names.includes(s.trim())&&e({...t,alias_names:[...t.alias_names,s.trim()]})},r=s=>{e({...t,alias_names:t.alias_names.filter((i,a)=>a!==s)})};return l.jsxs("div",{className:"space-y-6",children:[l.jsxs("div",{className:"space-y-3",children:[l.jsx(ue,{htmlFor:"qq_account",children:"QQ账号 *"}),l.jsx(Pe,{id:"qq_account",type:"number",placeholder:"请输入机器人的QQ账号",value:t.qq_account||"",onChange:s=>e({...t,qq_account:Number(s.target.value)})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人登录使用的QQ账号"})]}),l.jsxs("div",{className:"space-y-3",children:[l.jsx(ue,{htmlFor:"nickname",children:"昵称 *"}),l.jsx(Pe,{id:"nickname",placeholder:"请输入机器人的昵称",value:t.nickname,onChange:s=>e({...t,nickname:s.target.value})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人的主要称呼名称"})]}),l.jsxs("div",{className:"space-y-3",children:[l.jsx(ue,{children:"别名"}),l.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:t.alias_names.map((s,i)=>l.jsxs(In,{variant:"secondary",className:"gap-1",children:[s,l.jsx("button",{type:"button",onClick:()=>r(i),className:"ml-1 hover:text-destructive",children:l.jsx(P0,{className:"h-3 w-3"})})]},i))}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx(Pe,{id:"alias_input",placeholder:"输入别名后按回车添加",onKeyPress:s=>{s.key==="Enter"&&(n(s.target.value),s.target.value="")}}),l.jsx(de,{type:"button",variant:"outline",onClick:()=>{const s=document.getElementById("alias_input");s&&(n(s.value),s.value="")},children:"添加"})]}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人的其他称呼,可以添加多个"})]})]})}function ine({config:t,onChange:e}){return l.jsxs("div",{className:"space-y-6",children:[l.jsxs("div",{className:"space-y-3",children:[l.jsx(ue,{htmlFor:"personality",children:"人格特征 *"}),l.jsx(pr,{id:"personality",placeholder:"描述机器人的人格特质和身份特征(建议120字以内)",value:t.personality,onChange:n=>e({...t,personality:n.target.value}),rows:3}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"例如:是一个女大学生,现在在读大二,会刷贴吧"})]}),l.jsxs("div",{className:"space-y-3",children:[l.jsx(ue,{htmlFor:"reply_style",children:"表达风格 *"}),l.jsx(pr,{id:"reply_style",placeholder:"描述机器人说话的表达风格、表达习惯",value:t.reply_style,onChange:n=>e({...t,reply_style:n.target.value}),rows:3}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"例如:回复平淡一些,简短一些,说中文,参考贴吧、知乎和微博的回复风格"})]}),l.jsxs("div",{className:"space-y-3",children:[l.jsx(ue,{htmlFor:"interest",children:"兴趣 *"}),l.jsx(pr,{id:"interest",placeholder:"描述机器人感兴趣的话题",value:t.interest,onChange:n=>e({...t,interest:n.target.value}),rows:2}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"会影响机器人对什么话题进行回复"})]}),l.jsx(Vm,{}),l.jsxs("div",{className:"space-y-3",children:[l.jsx(ue,{htmlFor:"plan_style",children:"群聊说话规则 *"}),l.jsx(pr,{id:"plan_style",placeholder:"机器人在群聊中的行为风格和规则",value:t.plan_style,onChange:n=>e({...t,plan_style:n.target.value}),rows:4}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"定义机器人在群聊中如何行动,例如回复频率、条件等"})]}),l.jsxs("div",{className:"space-y-3",children:[l.jsx(ue,{htmlFor:"private_plan_style",children:"私聊说话规则 *"}),l.jsx(pr,{id:"private_plan_style",placeholder:"机器人在私聊中的行为风格和规则",value:t.private_plan_style,onChange:n=>e({...t,private_plan_style:n.target.value}),rows:3}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"定义机器人在私聊中的行为方式"})]})]})}function ane({config:t,onChange:e}){return l.jsxs("div",{className:"space-y-6",children:[l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx(ue,{htmlFor:"emoji_chance",children:"表情包激活概率"}),l.jsxs("span",{className:"text-sm text-muted-foreground",children:[(t.emoji_chance*100).toFixed(0),"%"]})]}),l.jsx(Pe,{id:"emoji_chance",type:"range",min:"0",max:"1",step:"0.1",value:t.emoji_chance,onChange:n=>e({...t,emoji_chance:Number(n.target.value)})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人发送表情包的概率"})]}),l.jsxs("div",{className:"space-y-3",children:[l.jsx(ue,{htmlFor:"max_reg_num",children:"最大表情包数量"}),l.jsx(Pe,{id:"max_reg_num",type:"number",min:"1",max:"200",value:t.max_reg_num,onChange:n=>e({...t,max_reg_num:Number(n.target.value)})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人最多保存的表情包数量"})]}),l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"space-y-1",children:[l.jsx(ue,{htmlFor:"do_replace",children:"达到最大数量时替换"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"开启后会删除旧表情包,关闭则不再收集新表情包"})]}),l.jsx(Pt,{id:"do_replace",checked:t.do_replace,onCheckedChange:n=>e({...t,do_replace:n})})]}),l.jsxs("div",{className:"space-y-3",children:[l.jsx(ue,{htmlFor:"check_interval",children:"检查间隔(分钟)"}),l.jsx(Pe,{id:"check_interval",type:"number",min:"1",max:"120",value:t.check_interval,onChange:n=>e({...t,check_interval:Number(n.target.value)})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"检查表情包注册、破损、删除的时间间隔"})]}),l.jsx(Vm,{}),l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"space-y-1",children:[l.jsx(ue,{htmlFor:"steal_emoji",children:"偷取表情包"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人将一些表情包据为己有"})]}),l.jsx(Pt,{id:"steal_emoji",checked:t.steal_emoji,onCheckedChange:n=>e({...t,steal_emoji:n})})]}),l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"space-y-1",children:[l.jsx(ue,{htmlFor:"content_filtration",children:"启用表情包过滤"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"只保存符合要求的表情包"})]}),l.jsx(Pt,{id:"content_filtration",checked:t.content_filtration,onCheckedChange:n=>e({...t,content_filtration:n})})]}),t.content_filtration&&l.jsxs("div",{className:"space-y-3",children:[l.jsx(ue,{htmlFor:"filtration_prompt",children:"过滤要求"}),l.jsx(Pe,{id:"filtration_prompt",placeholder:"例如:符合公序良俗",value:t.filtration_prompt,onChange:n=>e({...t,filtration_prompt:n.target.value})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"描述表情包应该符合的要求"})]})]})}function lne({config:t,onChange:e}){return l.jsxs("div",{className:"space-y-6",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"space-y-1",children:[l.jsx(ue,{htmlFor:"enable_tool",children:"启用工具系统"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人使用各种工具增强功能"})]}),l.jsx(Pt,{id:"enable_tool",checked:t.enable_tool,onCheckedChange:n=>e({...t,enable_tool:n})})]}),l.jsx(Vm,{}),l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"space-y-1",children:[l.jsx(ue,{htmlFor:"enable_mood",children:"启用情绪系统"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"让机器人具有情绪变化能力"})]}),l.jsx(Pt,{id:"enable_mood",checked:t.enable_mood,onCheckedChange:n=>e({...t,enable_mood:n})})]}),t.enable_mood&&l.jsxs("div",{className:"ml-6 space-y-6 border-l-2 border-primary/20 pl-6",children:[l.jsxs("div",{className:"space-y-3",children:[l.jsx(ue,{htmlFor:"mood_update_threshold",children:"情绪更新阈值"}),l.jsx(Pe,{id:"mood_update_threshold",type:"number",min:"0.1",max:"10",step:"0.1",value:t.mood_update_threshold||1,onChange:n=>e({...t,mood_update_threshold:Number(n.target.value)})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"值越高,情绪更新越慢"})]}),l.jsxs("div",{className:"space-y-3",children:[l.jsx(ue,{htmlFor:"emotion_style",children:"情感特征"}),l.jsx(pr,{id:"emotion_style",placeholder:"描述情绪的变化情况,例如:情绪较为稳定,但遭遇特定事件时起伏较大",value:t.emotion_style||"",onChange:n=>e({...t,emotion_style:n.target.value}),rows:2}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"影响机器人的情绪变化方式"})]})]}),l.jsx(Vm,{}),l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"space-y-1",children:[l.jsx(ue,{htmlFor:"all_global",children:"启用全局黑话模式"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人学习和使用群组黑话"})]}),l.jsx(Pt,{id:"all_global",checked:t.all_global,onCheckedChange:n=>e({...t,all_global:n})})]})]})}function one({config:t,onChange:e}){const[n,r]=b.useState(!1);return l.jsxs("div",{className:"space-y-6",children:[l.jsx("div",{className:"rounded-lg bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-4",children:l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx("div",{className:"mt-0.5",children:l.jsx("svg",{className:"h-5 w-5 text-blue-600 dark:text-blue-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),l.jsxs("div",{className:"flex-1 text-sm",children:[l.jsx("p",{className:"font-medium text-blue-900 dark:text-blue-100 mb-1",children:"关于硅基流动 (SiliconFlow)"}),l.jsx("p",{className:"text-blue-700 dark:text-blue-300 mb-2",children:"硅基流动提供了完整的模型覆盖,包括 DeepSeek V3、Qwen、视觉模型、语音识别和嵌入模型。 只需一个 API Key 即可使用麦麦的所有功能!"}),l.jsxs("a",{href:"https://cloud.siliconflow.cn",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-blue-600 dark:text-blue-400 hover:underline font-medium",children:["前往硅基流动获取 API Key",l.jsx(Jd,{className:"h-3 w-3"})]})]})]})}),l.jsxs("div",{className:"space-y-3",children:[l.jsx(ue,{htmlFor:"siliconflow_api_key",children:"SiliconFlow API Key *"}),l.jsxs("div",{className:"relative",children:[l.jsx(Pe,{id:"siliconflow_api_key",type:n?"text":"password",placeholder:"sk-...",value:t.api_key,onChange:s=>e({api_key:s.target.value}),className:"font-mono pr-10"}),l.jsx(de,{type:"button",variant:"ghost",size:"sm",className:"absolute right-0 top-0 h-full px-3 hover:bg-transparent",onClick:()=>r(!n),children:n?l.jsx(N1,{className:"h-4 w-4 text-muted-foreground"}):l.jsx(oa,{className:"h-4 w-4 text-muted-foreground"})})]}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"请输入您的硅基流动 API 密钥。获取后,麦麦将自动配置所有必需的模型。"})]}),l.jsxs("div",{className:"rounded-lg bg-muted/50 p-4 text-sm space-y-2",children:[l.jsx("p",{className:"font-medium",children:"将自动配置以下模型:"}),l.jsxs("ul",{className:"list-disc list-inside space-y-1 text-muted-foreground ml-2",children:[l.jsx("li",{children:"DeepSeek V3 - 主要对话和工具模型"}),l.jsx("li",{children:"Qwen3 30B - 高频小任务和工具调用"}),l.jsx("li",{children:"Qwen3 VL 30B - 图像识别"}),l.jsx("li",{children:"SenseVoice - 语音识别"}),l.jsx("li",{children:"BGE-M3 - 文本嵌入"}),l.jsx("li",{children:"知识库相关模型 (LPMM)"})]})]}),l.jsx("div",{className:"rounded-lg border border-amber-200 dark:border-amber-800 bg-amber-50 dark:bg-amber-950/30 p-4",children:l.jsxs("p",{className:"text-sm text-amber-900 dark:text-amber-100",children:[l.jsx("span",{className:"font-medium",children:"💡 提示:"}),'完成向导后,您可以在"系统设置 → 模型配置"中添加更多 API 提供商和模型。']})})]})}async function pt(t,e){const n=await fetch(t,e);if(n.status===401)throw localStorage.removeItem("access-token"),window.location.href="/auth",new Error("认证失败,请重新登录");return n}function Ct(){return{"Content-Type":"application/json",Authorization:`Bearer ${localStorage.getItem("access-token")}`}}async function cne(){const t=await pt("/api/webui/config/bot",{method:"GET",headers:Ct()});if(!t.ok)throw new Error("读取Bot配置失败");const n=(await t.json()).config.bot||{};return{qq_account:n.qq_account||0,nickname:n.nickname||"",alias_names:n.alias_names||[]}}async function une(){const t=await pt("/api/webui/config/bot",{method:"GET",headers:Ct()});if(!t.ok)throw new Error("读取人格配置失败");const n=(await t.json()).config.personality||{};return{personality:n.personality||"",reply_style:n.reply_style||"",interest:n.interest||"",plan_style:n.plan_style||"",private_plan_style:n.private_plan_style||""}}async function dne(){const t=await pt("/api/webui/config/bot",{method:"GET",headers:Ct()});if(!t.ok)throw new Error("读取表情包配置失败");const n=(await t.json()).config.emoji||{};return{emoji_chance:n.emoji_chance??.4,max_reg_num:n.max_reg_num??40,do_replace:n.do_replace??!0,check_interval:n.check_interval??10,steal_emoji:n.steal_emoji??!0,content_filtration:n.content_filtration??!1,filtration_prompt:n.filtration_prompt||""}}async function hne(){const t=await pt("/api/webui/config/bot",{method:"GET",headers:Ct()});if(!t.ok)throw new Error("读取其他配置失败");const n=(await t.json()).config,r=n.tool||{},s=n.mood||{},i=n.jargon||{};return{enable_tool:r.enable_tool??!0,enable_mood:s.enable_mood??!1,mood_update_threshold:s.mood_update_threshold,emotion_style:s.emotion_style,all_global:i.all_global??!0}}async function fne(){const t=await pt("/api/webui/config/model",{method:"GET",headers:Ct()});if(!t.ok)throw new Error("读取模型配置失败");return{api_key:((await t.json()).config.api_providers||[]).find(i=>i.name==="SiliconFlow")?.api_key||""}}async function mne(t){const e=await pt("/api/webui/config/bot/section/bot",{method:"POST",headers:Ct(),body:JSON.stringify(t)});if(!e.ok){const n=await e.json();throw new Error(n.detail||"保存Bot基础配置失败")}return await e.json()}async function pne(t){const e=await pt("/api/webui/config/bot/section/personality",{method:"POST",headers:Ct(),body:JSON.stringify(t)});if(!e.ok){const n=await e.json();throw new Error(n.detail||"保存人格配置失败")}return await e.json()}async function gne(t){const e=await pt("/api/webui/config/bot/section/emoji",{method:"POST",headers:Ct(),body:JSON.stringify(t)});if(!e.ok){const n=await e.json();throw new Error(n.detail||"保存表情包配置失败")}return await e.json()}async function xne(t){const e=[];e.push(pt("/api/webui/config/bot/section/tool",{method:"POST",headers:Ct(),body:JSON.stringify({enable_tool:t.enable_tool})})),e.push(pt("/api/webui/config/bot/section/jargon",{method:"POST",headers:Ct(),body:JSON.stringify({all_global:t.all_global})}));const n={enable_mood:t.enable_mood};t.enable_mood&&(n.mood_update_threshold=t.mood_update_threshold||1,n.emotion_style=t.emotion_style||""),e.push(pt("/api/webui/config/bot/section/mood",{method:"POST",headers:Ct(),body:JSON.stringify(n)}));const r=await Promise.all(e);for(const s of r)if(!s.ok){const i=await s.json();throw new Error(i.detail||"保存其他配置失败")}return{success:!0}}async function vne(t){const e=await pt("/api/webui/config/model",{method:"GET",headers:Ct()});if(!e.ok)throw new Error("读取模型配置失败");const r=(await e.json()).config,s=r.api_providers||[],i=s.findIndex(c=>c.name==="SiliconFlow");i>=0?s[i]={...s[i],api_key:t.api_key}:s.push({name:"SiliconFlow",base_url:"https://api.siliconflow.cn/v1",api_key:t.api_key,client_type:"openai",max_retry:3,timeout:120,retry_interval:5});const a={...r,api_providers:s},o=await pt("/api/webui/config/model",{method:"POST",headers:Ct(),body:JSON.stringify(a)});if(!o.ok){const c=await o.json();throw new Error(c.detail||"保存模型配置失败")}return await o.json()}async function k9(){const t=localStorage.getItem("access-token"),e=await pt("/api/webui/setup/complete",{method:"POST",headers:{Authorization:`Bearer ${t}`}});if(!e.ok){const n=await e.json();throw new Error(n.message||"标记配置完成失败")}return await e.json()}async function Uv(){const t=await pt("/api/webui/system/restart",{method:"POST",headers:Ct()});if(!t.ok){const e=await t.json();throw new Error(e.detail||"重启失败")}return await t.json()}async function yne(){const t=await pt("/api/webui/system/status",{method:"GET",headers:Ct()});if(!t.ok){const e=await t.json();throw new Error(e.detail||"获取状态失败")}return await t.json()}function bne(){const t=Da(),{toast:e}=ts(),[n,r]=b.useState(0),[s,i]=b.useState(!1),[a,o]=b.useState(!1),[c,h]=b.useState(!0),[f,m]=b.useState({qq_account:0,nickname:"",alias_names:[]}),[g,x]=b.useState({personality:"是一个女大学生,现在在读大二,会刷贴吧。",reply_style:"请回复的平淡一些,简短一些,说中文,不要刻意突出自身学科背景。可以参考贴吧,知乎和微博的回复风格。",interest:"对技术相关话题,游戏和动漫相关话题感兴趣,也对日常话题感兴趣,不喜欢太过沉重严肃的话题",plan_style:`1.思考**所有**的可用的action中的**每个动作**是否符合当下条件,如果动作使用条件符合聊天内容就使用 2.如果相同的内容已经被执行,请不要重复执行 3.请控制你的发言频率,不要太过频繁的发言 4.如果有人对你感到厌烦,请减少回复 5.如果有人对你进行攻击,或者情绪激动,请你以合适的方法应对`,private_plan_style:`1.思考**所有**的可用的action中的**每个动作**是否符合当下条件,如果动作使用条件符合聊天内容就使用 2.如果相同的内容已经被执行,请不要重复执行 -3.某句话如果已经被回复过,不要重复回复`}),[y,w]=b.useState({emoji_chance:.4,max_reg_num:40,do_replace:!0,check_interval:10,steal_emoji:!0,content_filtration:!1,filtration_prompt:"符合公序良俗"}),[S,k]=b.useState({enable_tool:!0,enable_mood:!1,mood_update_threshold:1,emotion_style:"情绪较为稳定,但遇遇特定事件的时候起伏较大",all_global:!0}),[N,C]=b.useState({api_key:""}),[T,_]=b.useState(!1),[E,M]=b.useState(""),q=[{id:"bot-basic",title:"Bot基础",description:"配置机器人的基本信息",icon:DK},{id:"personality",title:"人格配置",description:"定义机器人的性格和说话风格",icon:rz},{id:"emoji",title:"表情包",description:"配置表情包相关设置",icon:Jk},{id:"other",title:"其他设置",description:"工具、情绪系统等配置",icon:yu},{id:"siliconflow",title:"API配置",description:"配置硅基流动API密钥",icon:nz}],L=(n+1)/q.length*100;b.useEffect(()=>{(async()=>{try{h(!0);const[W,J,X,R,se]=await Promise.all([lne(),one(),cne(),une(),dne()]);m(W),x(J),w(X),k(R),C(se)}catch(W){e({title:"加载配置失败",description:W instanceof Error?W.message:"无法加载现有配置,将使用默认值",variant:"destructive"})}finally{h(!1)}})()},[e]);const I=async()=>{o(!0);try{switch(n){case 0:await hne(f);break;case 1:await fne(g);break;case 2:await mne(y);break;case 3:await pne(S);break;case 4:await gne(N);break}return e({title:"保存成功",description:`${q[n].title}配置已保存`}),!0}catch(P){return e({title:"保存失败",description:P instanceof Error?P.message:"未知错误",variant:"destructive"}),!1}finally{o(!1)}},$=async()=>{await I()&&n{n>0&&r(n-1)},ee=async()=>{i(!0),_(!0);try{if(M("正在保存API配置..."),!await I()){i(!1),_(!1);return}M("正在完成初始化..."),await S9(),M("正在重启麦麦..."),await Hv(),e({title:"配置完成",description:"麦麦正在重启以应用新配置..."}),M("等待麦麦重启完成...");const W=60;let J=0,X=!1;for(;JsetTimeout(R,1e3));try{(await xne()).running&&(X=!0,M("重启成功!正在跳转..."))}catch{J++}}if(!X)throw new Error("重启超时,请手动检查麦麦状态");setTimeout(()=>{t({to:"/"})},1e3)}catch(P){_(!1),e({title:"配置失败",description:P instanceof Error?P.message:"未知错误",variant:"destructive"})}finally{i(!1)}},z=async()=>{try{await S9(),t({to:"/"})}catch(P){e({title:"跳过失败",description:P instanceof Error?P.message:"未知错误",variant:"destructive"})}},H=()=>{switch(n){case 0:return l.jsx(nne,{config:f,onChange:m});case 1:return l.jsx(rne,{config:g,onChange:x});case 2:return l.jsx(sne,{config:y,onChange:w});case 3:return l.jsx(ine,{config:S,onChange:k});case 4:return l.jsx(ane,{config:N,onChange:C});default:return null}};return l.jsxs("div",{className:"relative flex min-h-screen flex-col items-center justify-center overflow-hidden bg-gradient-to-br from-primary/5 via-background to-secondary/5 p-4 md:p-6",children:[T&&l.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm",children:l.jsxs("div",{className:"mx-auto flex max-w-md flex-col items-center space-y-6 rounded-lg border bg-card p-8 text-center shadow-lg",children:[l.jsx("div",{className:"flex h-20 w-20 items-center justify-center rounded-full bg-primary/10",children:l.jsx(hh,{className:"h-10 w-10 animate-spin text-primary"})}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("h2",{className:"text-2xl font-bold",children:"正在重启麦麦"}),l.jsx("p",{className:"text-muted-foreground",children:E})]}),l.jsx("div",{className:"w-full",children:l.jsx("div",{className:"h-2 w-full overflow-hidden rounded-full bg-secondary",children:l.jsx("div",{className:"h-full w-full animate-pulse bg-primary",style:{animation:"pulse 1.5s cubic-bezier(0.4, 0, 0.6, 1) infinite"}})})}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"请稍候,这可能需要一分钟..."})]})}),l.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[l.jsx("div",{className:"absolute left-1/4 top-1/4 h-64 w-64 md:h-96 md:w-96 rounded-full bg-primary/5 blur-3xl"}),l.jsx("div",{className:"absolute right-1/4 bottom-1/4 h-64 w-64 md:h-96 md:w-96 rounded-full bg-secondary/5 blur-3xl"})]}),c?l.jsxs("div",{className:"relative z-10 text-center",children:[l.jsx("div",{className:"mx-auto mb-4 flex h-16 w-16 items-center justify-center",children:l.jsx("div",{className:"h-12 w-12 animate-spin rounded-full border-4 border-primary border-t-transparent"})}),l.jsx("p",{className:"text-lg font-medium",children:"加载配置中..."}),l.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:"正在读取现有配置"})]}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"relative z-10 w-full max-w-4xl",children:[l.jsxs("div",{className:"mb-6 md:mb-8 text-center",children:[l.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 md:h-16 md:w-16 items-center justify-center rounded-2xl bg-primary/10",children:l.jsx(RK,{className:"h-6 w-6 md:h-8 md:w-8 text-primary",strokeWidth:2,fill:"none"})}),l.jsx("h1",{className:"mb-2 text-2xl md:text-3xl font-bold",children:"首次配置向导"}),l.jsxs("p",{className:"text-sm md:text-base text-muted-foreground",children:["让我们一起完成 ",p6," 的初始配置"]})]}),l.jsxs("div",{className:"mb-6 md:mb-8",children:[l.jsxs("div",{className:"mb-2 flex items-center justify-between text-xs md:text-sm",children:[l.jsxs("span",{className:"text-muted-foreground",children:["步骤 ",n+1," / ",q.length]}),l.jsxs("span",{className:"font-medium text-primary",children:[Math.round(L),"%"]})]}),l.jsx(F0,{value:L,className:"h-2"})]}),l.jsx("div",{className:"mb-6 md:mb-8 flex justify-between",children:q.map((P,W)=>{const J=P.icon;return l.jsxs("div",{className:ye("flex flex-1 flex-col items-center gap-1 md:gap-2",Wt({to:"/"}),className:"gap-2 w-full sm:w-auto",children:[l.jsx(qm,{className:"h-4 w-4"}),"返回首页"]}),l.jsxs(fe,{size:"lg",variant:"outline",onClick:()=>window.history.back(),className:"gap-2 w-full sm:w-auto",children:[l.jsx(sz,{className:"h-4 w-4"}),"返回上一页"]})]}),l.jsx("div",{className:"mt-12 pt-8 border-t border-border",children:l.jsx("p",{className:"text-sm text-muted-foreground",children:"如果您认为这是一个错误,请联系系统管理员"})})]})})}var pL=["PageUp","PageDown"],gL=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],xL={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},qh="Slider",[q3,yne,bne]=jv(qh),[vL]=ua(qh,[bne]),[wne,Vv]=vL(qh),yL=b.forwardRef((t,e)=>{const{name:n,min:r=0,max:s=100,step:i=1,orientation:a="horizontal",disabled:o=!1,minStepsBetweenThumbs:c=0,defaultValue:h=[r],value:f,onValueChange:m=()=>{},onValueCommit:g=()=>{},inverted:x=!1,form:y,...w}=t,S=b.useRef(new Set),k=b.useRef(0),C=a==="horizontal"?Sne:kne,[T=[],_]=wo({prop:f,defaultProp:h,onChange:$=>{[...S.current][k.current]?.focus(),m($)}}),E=b.useRef(T);function M($){const V=Tne(T,$);I($,V)}function q($){I($,k.current)}function L(){const $=E.current[k.current];T[k.current]!==$&&g(T)}function I($,V,{commit:ee}={commit:!1}){const z=Ane(i),H=Rne(Math.round(($-r)/i)*i+r,z),P=Hk(H,[r,s]);_((W=[])=>{const J=Nne(W,P,V);if(Mne(J,c*i)){k.current=J.indexOf(P);const X=String(J)!==String(W);return X&&ee&&g(J),X?J:W}else return W})}return l.jsx(wne,{scope:t.__scopeSlider,name:n,disabled:o,min:r,max:s,valueIndexToChangeRef:k,thumbs:S.current,values:T,orientation:a,form:y,children:l.jsx(q3.Provider,{scope:t.__scopeSlider,children:l.jsx(q3.Slot,{scope:t.__scopeSlider,children:l.jsx(C,{"aria-disabled":o,"data-disabled":o?"":void 0,...w,ref:e,onPointerDown:Ze(w.onPointerDown,()=>{o||(E.current=T)}),min:r,max:s,inverted:x,onSlideStart:o?void 0:M,onSlideMove:o?void 0:q,onSlideEnd:o?void 0:L,onHomeKeyDown:()=>!o&&I(r,0,{commit:!0}),onEndKeyDown:()=>!o&&I(s,T.length-1,{commit:!0}),onStepKeyDown:({event:$,direction:V})=>{if(!o){const H=pL.includes($.key)||$.shiftKey&&gL.includes($.key)?10:1,P=k.current,W=T[P],J=i*H*V;I(W+J,P,{commit:!0})}}})})})})});yL.displayName=qh;var[bL,wL]=vL(qh,{startEdge:"left",endEdge:"right",size:"width",direction:1}),Sne=b.forwardRef((t,e)=>{const{min:n,max:r,dir:s,inverted:i,onSlideStart:a,onSlideMove:o,onSlideEnd:c,onStepKeyDown:h,...f}=t,[m,g]=b.useState(null),x=Dn(e,C=>g(C)),y=b.useRef(void 0),w=M0(s),S=w==="ltr",k=S&&!i||!S&&i;function N(C){const T=y.current||m.getBoundingClientRect(),_=[0,T.width],M=x6(_,k?[n,r]:[r,n]);return y.current=T,M(C-T.left)}return l.jsx(bL,{scope:t.__scopeSlider,startEdge:k?"left":"right",endEdge:k?"right":"left",direction:k?1:-1,size:"width",children:l.jsx(SL,{dir:w,"data-orientation":"horizontal",...f,ref:x,style:{...f.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:C=>{const T=N(C.clientX);a?.(T)},onSlideMove:C=>{const T=N(C.clientX);o?.(T)},onSlideEnd:()=>{y.current=void 0,c?.()},onStepKeyDown:C=>{const _=xL[k?"from-left":"from-right"].includes(C.key);h?.({event:C,direction:_?-1:1})}})})}),kne=b.forwardRef((t,e)=>{const{min:n,max:r,inverted:s,onSlideStart:i,onSlideMove:a,onSlideEnd:o,onStepKeyDown:c,...h}=t,f=b.useRef(null),m=Dn(e,f),g=b.useRef(void 0),x=!s;function y(w){const S=g.current||f.current.getBoundingClientRect(),k=[0,S.height],C=x6(k,x?[r,n]:[n,r]);return g.current=S,C(w-S.top)}return l.jsx(bL,{scope:t.__scopeSlider,startEdge:x?"bottom":"top",endEdge:x?"top":"bottom",size:"height",direction:x?1:-1,children:l.jsx(SL,{"data-orientation":"vertical",...h,ref:m,style:{...h.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:w=>{const S=y(w.clientY);i?.(S)},onSlideMove:w=>{const S=y(w.clientY);a?.(S)},onSlideEnd:()=>{g.current=void 0,o?.()},onStepKeyDown:w=>{const k=xL[x?"from-bottom":"from-top"].includes(w.key);c?.({event:w,direction:k?-1:1})}})})}),SL=b.forwardRef((t,e)=>{const{__scopeSlider:n,onSlideStart:r,onSlideMove:s,onSlideEnd:i,onHomeKeyDown:a,onEndKeyDown:o,onStepKeyDown:c,...h}=t,f=Vv(qh,n);return l.jsx(nn.span,{...h,ref:e,onKeyDown:Ze(t.onKeyDown,m=>{m.key==="Home"?(a(m),m.preventDefault()):m.key==="End"?(o(m),m.preventDefault()):pL.concat(gL).includes(m.key)&&(c(m),m.preventDefault())}),onPointerDown:Ze(t.onPointerDown,m=>{const g=m.target;g.setPointerCapture(m.pointerId),m.preventDefault(),f.thumbs.has(g)?g.focus():r(m)}),onPointerMove:Ze(t.onPointerMove,m=>{m.target.hasPointerCapture(m.pointerId)&&s(m)}),onPointerUp:Ze(t.onPointerUp,m=>{const g=m.target;g.hasPointerCapture(m.pointerId)&&(g.releasePointerCapture(m.pointerId),i(m))})})}),kL="SliderTrack",OL=b.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,s=Vv(kL,n);return l.jsx(nn.span,{"data-disabled":s.disabled?"":void 0,"data-orientation":s.orientation,...r,ref:e})});OL.displayName=kL;var F3="SliderRange",jL=b.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,s=Vv(F3,n),i=wL(F3,n),a=b.useRef(null),o=Dn(e,a),c=s.values.length,h=s.values.map(g=>TL(g,s.min,s.max)),f=c>1?Math.min(...h):0,m=100-Math.max(...h);return l.jsx(nn.span,{"data-orientation":s.orientation,"data-disabled":s.disabled?"":void 0,...r,ref:o,style:{...t.style,[i.startEdge]:f+"%",[i.endEdge]:m+"%"}})});jL.displayName=F3;var $3="SliderThumb",NL=b.forwardRef((t,e)=>{const n=yne(t.__scopeSlider),[r,s]=b.useState(null),i=Dn(e,o=>s(o)),a=b.useMemo(()=>r?n().findIndex(o=>o.ref.current===r):-1,[n,r]);return l.jsx(One,{...t,ref:i,index:a})}),One=b.forwardRef((t,e)=>{const{__scopeSlider:n,index:r,name:s,...i}=t,a=Vv($3,n),o=wL($3,n),[c,h]=b.useState(null),f=Dn(e,N=>h(N)),m=c?a.form||!!c.closest("form"):!0,g=LD(c),x=a.values[r],y=x===void 0?0:TL(x,a.min,a.max),w=Cne(r,a.values.length),S=g?.[o.size],k=S?Ene(S,y,o.direction):0;return b.useEffect(()=>{if(c)return a.thumbs.add(c),()=>{a.thumbs.delete(c)}},[c,a.thumbs]),l.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[o.startEdge]:`calc(${y}% + ${k}px)`},children:[l.jsx(q3.ItemSlot,{scope:t.__scopeSlider,children:l.jsx(nn.span,{role:"slider","aria-label":t["aria-label"]||w,"aria-valuemin":a.min,"aria-valuenow":x,"aria-valuemax":a.max,"aria-orientation":a.orientation,"data-orientation":a.orientation,"data-disabled":a.disabled?"":void 0,tabIndex:a.disabled?void 0:0,...i,ref:f,style:x===void 0?{display:"none"}:t.style,onFocus:Ze(t.onFocus,()=>{a.valueIndexToChangeRef.current=r})})}),m&&l.jsx(CL,{name:s??(a.name?a.name+(a.values.length>1?"[]":""):void 0),form:a.form,value:x},r)]})});NL.displayName=$3;var jne="RadioBubbleInput",CL=b.forwardRef(({__scopeSlider:t,value:e,...n},r)=>{const s=b.useRef(null),i=Dn(s,r),a=PD(e);return b.useEffect(()=>{const o=s.current;if(!o)return;const c=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(c,"value").set;if(a!==e&&f){const m=new Event("input",{bubbles:!0});f.call(o,e),o.dispatchEvent(m)}},[a,e]),l.jsx(nn.input,{style:{display:"none"},...n,ref:i,defaultValue:e})});CL.displayName=jne;function Nne(t=[],e,n){const r=[...t];return r[n]=e,r.sort((s,i)=>s-i)}function TL(t,e,n){const i=100/(n-e)*(t-e);return Hk(i,[0,100])}function Cne(t,e){return e>2?`Value ${t+1} of ${e}`:e===2?["Minimum","Maximum"][t]:void 0}function Tne(t,e){if(t.length===1)return 0;const n=t.map(s=>Math.abs(s-e)),r=Math.min(...n);return n.indexOf(r)}function Ene(t,e,n){const r=t/2,i=x6([0,50],[0,r]);return(r-i(e)*n)*n}function _ne(t){return t.slice(0,-1).map((e,n)=>t[n+1]-e)}function Mne(t,e){if(e>0){const n=_ne(t);return Math.min(...n)>=e}return!0}function x6(t,e){return n=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const r=(e[1]-e[0])/(t[1]-t[0]);return e[0]+r*(n-t[0])}}function Ane(t){return(String(t).split(".")[1]||"").length}function Rne(t,e){const n=Math.pow(10,e);return Math.round(t*n)/n}var EL=yL,Dne=OL,zne=jL,Pne=NL;const $0=b.forwardRef(({className:t,...e},n)=>l.jsxs(EL,{ref:n,className:ye("relative flex w-full touch-none select-none items-center",t),...e,children:[l.jsx(Dne,{className:"relative h-1.5 w-full grow overflow-hidden rounded-full bg-primary/20",children:l.jsx(zne,{className:"absolute h-full bg-primary"})}),l.jsx(Pne,{className:"block h-4 w-4 rounded-full border border-primary/50 bg-background shadow transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50"})]}));$0.displayName=EL.displayName;const zt=bK,Pt=wK,At=b.forwardRef(({className:t,children:e,...n},r)=>l.jsxs(FD,{ref:r,className:ye("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...n,children:[e,l.jsx(pK,{asChild:!0,children:l.jsx(Nu,{className:"h-4 w-4 opacity-50"})})]}));At.displayName=FD.displayName;const _L=b.forwardRef(({className:t,...e},n)=>l.jsx($D,{ref:n,className:ye("flex cursor-default items-center justify-center py-1",t),...e,children:l.jsx(Fm,{className:"h-4 w-4"})}));_L.displayName=$D.displayName;const ML=b.forwardRef(({className:t,...e},n)=>l.jsx(QD,{ref:n,className:ye("flex cursor-default items-center justify-center py-1",t),...e,children:l.jsx(Nu,{className:"h-4 w-4"})}));ML.displayName=QD.displayName;const Rt=b.forwardRef(({className:t,children:e,position:n="popper",...r},s)=>l.jsx(gK,{children:l.jsxs(HD,{ref:s,className:ye("relative z-[100] max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-hidden rounded-md border border-border bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100 shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-select-content-transform-origin]",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:n,...r,children:[l.jsx(_L,{}),l.jsx(xK,{className:ye("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:e}),l.jsx(ML,{})]})}));Rt.displayName=HD.displayName;const Lne=b.forwardRef(({className:t,...e},n)=>l.jsx(VD,{ref:n,className:ye("px-2 py-1.5 text-sm font-semibold",t),...e}));Lne.displayName=VD.displayName;const ze=b.forwardRef(({className:t,children:e,...n},r)=>l.jsxs(UD,{ref:r,className:ye("relative flex w-full cursor-default select-none items-center rounded-sm py-2 pl-2 pr-8 text-sm outline-none bg-white dark:bg-gray-900 hover:bg-gray-100 dark:hover:bg-gray-800 focus:bg-gray-100 dark:focus:bg-gray-800 data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...n,children:[l.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:l.jsx(vK,{children:l.jsx(so,{className:"h-4 w-4"})})}),l.jsx(yK,{children:e})]}));ze.displayName=UD.displayName;const Ine=b.forwardRef(({className:t,...e},n)=>l.jsx(WD,{ref:n,className:ye("-mx-1 my-1 h-px bg-muted",t),...e}));Ine.displayName=WD.displayName;function Bne(t){const e=qne(t),n=b.forwardRef((r,s)=>{const{children:i,...a}=r,o=b.Children.toArray(i),c=o.find($ne);if(c){const h=c.props.children,f=o.map(m=>m===c?b.Children.count(h)>1?b.Children.only(null):b.isValidElement(h)?h.props.children:null:m);return l.jsx(e,{...a,ref:s,children:b.isValidElement(h)?b.cloneElement(h,void 0,f):null})}return l.jsx(e,{...a,ref:s,children:i})});return n.displayName=`${t}.Slot`,n}function qne(t){const e=b.forwardRef((n,r)=>{const{children:s,...i}=n;if(b.isValidElement(s)){const a=Hne(s),o=Qne(i,s.props);return s.type!==b.Fragment&&(o.ref=r?gc(r,a):a),b.cloneElement(s,o)}return b.Children.count(s)>1?b.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var Fne=Symbol("radix.slottable");function $ne(t){return b.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===Fne}function Qne(t,e){const n={...e};for(const r in e){const s=t[r],i=e[r];/^on[A-Z]/.test(r)?s&&i?n[r]=(...o)=>{const c=i(...o);return s(...o),c}:s&&(n[r]=s):r==="style"?n[r]={...s,...i}:r==="className"&&(n[r]=[s,i].filter(Boolean).join(" "))}return{...t,...n}}function Hne(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var Uv="Popover",[AL]=ua(Uv,[Rh]),Q0=Rh(),[Vne,Ec]=AL(Uv),RL=t=>{const{__scopePopover:e,children:n,open:r,defaultOpen:s,onOpenChange:i,modal:a=!1}=t,o=Q0(e),c=b.useRef(null),[h,f]=b.useState(!1),[m,g]=wo({prop:r,defaultProp:s??!1,onChange:i,caller:Uv});return l.jsx(_v,{...o,children:l.jsx(Vne,{scope:e,contentId:Ei(),triggerRef:c,open:m,onOpenChange:g,onOpenToggle:b.useCallback(()=>g(x=>!x),[g]),hasCustomAnchor:h,onCustomAnchorAdd:b.useCallback(()=>f(!0),[]),onCustomAnchorRemove:b.useCallback(()=>f(!1),[]),modal:a,children:n})})};RL.displayName=Uv;var DL="PopoverAnchor",Une=b.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=Ec(DL,n),i=Q0(n),{onCustomAnchorAdd:a,onCustomAnchorRemove:o}=s;return b.useEffect(()=>(a(),()=>o()),[a,o]),l.jsx(Mv,{...i,...r,ref:e})});Une.displayName=DL;var zL="PopoverTrigger",PL=b.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=Ec(zL,n),i=Q0(n),a=Dn(e,s.triggerRef),o=l.jsx(nn.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":FL(s.open),...r,ref:a,onClick:Ze(t.onClick,s.onOpenToggle)});return s.hasCustomAnchor?o:l.jsx(Mv,{asChild:!0,...i,children:o})});PL.displayName=zL;var v6="PopoverPortal",[Wne,Gne]=AL(v6,{forceMount:void 0}),LL=t=>{const{__scopePopover:e,forceMount:n,children:r,container:s}=t,i=Ec(v6,e);return l.jsx(Wne,{scope:e,forceMount:n,children:l.jsx(Ps,{present:n||i.open,children:l.jsx(Ev,{asChild:!0,container:s,children:r})})})};LL.displayName=v6;var xh="PopoverContent",IL=b.forwardRef((t,e)=>{const n=Gne(xh,t.__scopePopover),{forceMount:r=n.forceMount,...s}=t,i=Ec(xh,t.__scopePopover);return l.jsx(Ps,{present:r||i.open,children:i.modal?l.jsx(Yne,{...s,ref:e}):l.jsx(Kne,{...s,ref:e})})});IL.displayName=xh;var Xne=Bne("PopoverContent.RemoveScroll"),Yne=b.forwardRef((t,e)=>{const n=Ec(xh,t.__scopePopover),r=b.useRef(null),s=Dn(e,r),i=b.useRef(!1);return b.useEffect(()=>{const a=r.current;if(a)return GD(a)},[]),l.jsx(XD,{as:Xne,allowPinchZoom:!0,children:l.jsx(BL,{...t,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ze(t.onCloseAutoFocus,a=>{a.preventDefault(),i.current||n.triggerRef.current?.focus()}),onPointerDownOutside:Ze(t.onPointerDownOutside,a=>{const o=a.detail.originalEvent,c=o.button===0&&o.ctrlKey===!0,h=o.button===2||c;i.current=h},{checkForDefaultPrevented:!1}),onFocusOutside:Ze(t.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1})})})}),Kne=b.forwardRef((t,e)=>{const n=Ec(xh,t.__scopePopover),r=b.useRef(!1),s=b.useRef(!1);return l.jsx(BL,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{t.onCloseAutoFocus?.(i),i.defaultPrevented||(r.current||n.triggerRef.current?.focus(),i.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:i=>{t.onInteractOutside?.(i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const a=i.target;n.triggerRef.current?.contains(a)&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&s.current&&i.preventDefault()}})}),BL=b.forwardRef((t,e)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:i,disableOutsidePointerEvents:a,onEscapeKeyDown:o,onPointerDownOutside:c,onFocusOutside:h,onInteractOutside:f,...m}=t,g=Ec(xh,n),x=Q0(n);return YD(),l.jsx(KD,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:i,children:l.jsx(Yk,{asChild:!0,disableOutsidePointerEvents:a,onInteractOutside:f,onEscapeKeyDown:o,onPointerDownOutside:c,onFocusOutside:h,onDismiss:()=>g.onOpenChange(!1),children:l.jsx(Kk,{"data-state":FL(g.open),role:"dialog",id:g.contentId,...x,...m,ref:e,style:{...m.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)"}})})})}),qL="PopoverClose",Zne=b.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=Ec(qL,n);return l.jsx(nn.button,{type:"button",...r,ref:e,onClick:Ze(t.onClick,()=>s.onOpenChange(!1))})});Zne.displayName=qL;var Jne="PopoverArrow",ere=b.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=Q0(n);return l.jsx(Zk,{...s,...r,ref:e})});ere.displayName=Jne;function FL(t){return t?"open":"closed"}var tre=RL,nre=PL,rre=LL,$L=IL;const uo=tre,ho=nre,ol=b.forwardRef(({className:t,align:e="center",sideOffset:n=4,...r},s)=>l.jsx(rre,{children:l.jsx($L,{ref:s,align:e,sideOffset:n,className:ye("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none 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 origin-[--radix-popover-content-transform-origin]",t),...r})}));ol.displayName=$L.displayName;const _c="/api/webui/config";async function k9(){const e=await(await mt(`${_c}/bot`)).json();if(!e.success)throw new Error("获取配置数据失败");return e.config}async function Jd(){const e=await(await mt(`${_c}/model`)).json();if(!e.success)throw new Error("获取模型配置数据失败");return e.config}async function O9(t){const n=await(await mt(`${_c}/bot`,{method:"POST",headers:Nt(),body:JSON.stringify(t)})).json();if(!n.success)throw new Error(n.message||"保存配置失败")}async function sre(){const e=await(await mt(`${_c}/bot/raw`)).json();if(!e.success)throw new Error("获取配置源代码失败");return e.content}async function ire(t){const n=await(await mt(`${_c}/bot/raw`,{method:"POST",headers:Nt(),body:JSON.stringify({raw_content:t})})).json();if(!n.success)throw new Error(n.message||"保存配置失败")}async function M1(t){const n=await(await mt(`${_c}/model`,{method:"POST",headers:Nt(),body:JSON.stringify(t)})).json();if(!n.success)throw new Error(n.message||"保存配置失败")}async function are(t,e){const r=await(await mt(`${_c}/bot/section/${t}`,{method:"POST",headers:Nt(),body:JSON.stringify(e)})).json();if(!r.success)throw new Error(r.message||`保存配置节 ${t} 失败`)}async function Q3(t,e){const r=await(await mt(`${_c}/model/section/${t}`,{method:"POST",headers:Nt(),body:JSON.stringify(e)})).json();if(!r.success)throw new Error(r.message||`保存配置节 ${t} 失败`)}const lre=Ih("relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),il=b.forwardRef(({className:t,variant:e,...n},r)=>l.jsx("div",{ref:r,role:"alert",className:ye(lre({variant:e}),t),...n}));il.displayName="Alert";const ore=b.forwardRef(({className:t,...e},n)=>l.jsx("h5",{ref:n,className:ye("mb-1 font-medium leading-none tracking-tight",t),...e}));ore.displayName="AlertTitle";const al=b.forwardRef(({className:t,...e},n)=>l.jsx("div",{ref:n,className:ye("text-sm [&_p]:leading-relaxed",t),...e}));al.displayName="AlertDescription";function y6({onRestartComplete:t,onRestartFailed:e}){const[n,r]=b.useState(0),[s,i]=b.useState("restarting"),[a,o]=b.useState(0),[c,h]=b.useState(0);b.useEffect(()=>{const g=setInterval(()=>{r(w=>w>=90?w:w+1)},200),x=setInterval(()=>{o(w=>w+1)},1e3),y=setTimeout(()=>{i("checking"),f()},3e3);return()=>{clearInterval(g),clearInterval(x),clearTimeout(y)}},[]);const f=()=>{const x=async()=>{try{if(h(w=>w+1),(await fetch("/api/webui/system/status",{method:"GET",headers:{"Content-Type":"application/json"},signal:AbortSignal.timeout(3e3)})).ok)r(100),i("success"),setTimeout(()=>{t?.()},1500);else throw new Error("Status check failed")}catch{c<60?setTimeout(x,2e3):(i("failed"),e?.())}};x()},m=g=>{const x=Math.floor(g/60),y=g%60;return`${x}:${y.toString().padStart(2,"0")}`};return l.jsx("div",{className:"fixed inset-0 bg-background/95 backdrop-blur-sm z-50 flex items-center justify-center",children:l.jsxs("div",{className:"max-w-md w-full mx-4 space-y-8",children:[l.jsxs("div",{className:"flex flex-col items-center space-y-4",children:[s==="restarting"&&l.jsxs(l.Fragment,{children:[l.jsx(hh,{className:"h-16 w-16 text-primary animate-spin"}),l.jsx("h2",{className:"text-2xl font-bold",children:"正在重启麦麦"}),l.jsx("p",{className:"text-muted-foreground text-center",children:"请稍候,麦麦正在重启中..."})]}),s==="checking"&&l.jsxs(l.Fragment,{children:[l.jsx(hh,{className:"h-16 w-16 text-primary animate-spin"}),l.jsx("h2",{className:"text-2xl font-bold",children:"检查服务状态"}),l.jsxs("p",{className:"text-muted-foreground text-center",children:["等待服务恢复... (尝试 ",c,"/60)"]})]}),s==="success"&&l.jsxs(l.Fragment,{children:[l.jsx(xc,{className:"h-16 w-16 text-green-500"}),l.jsx("h2",{className:"text-2xl font-bold",children:"重启成功"}),l.jsx("p",{className:"text-muted-foreground text-center",children:"正在跳转到登录页面..."})]}),s==="failed"&&l.jsxs(l.Fragment,{children:[l.jsx(ju,{className:"h-16 w-16 text-destructive"}),l.jsx("h2",{className:"text-2xl font-bold",children:"重启超时"}),l.jsx("p",{className:"text-muted-foreground text-center",children:"服务未能在预期时间内恢复,请手动检查或刷新页面"})]})]}),s!=="failed"&&l.jsxs("div",{className:"space-y-2",children:[l.jsx(F0,{value:n,className:"h-2"}),l.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground",children:[l.jsxs("span",{children:[n,"%"]}),l.jsxs("span",{children:["已用时: ",m(a)]})]})]}),l.jsx("div",{className:"bg-muted/50 rounded-lg p-4 space-y-2",children:l.jsxs("p",{className:"text-sm text-muted-foreground",children:[s==="restarting"&&"🔄 配置已保存,正在重启主程序...",s==="checking"&&"⏳ 正在等待服务恢复,请勿关闭页面...",s==="success"&&"✅ 配置已生效,服务运行正常",s==="failed"&&"⚠️ 如果长时间无响应,请尝试手动重启"]})}),l.jsx("div",{className:"bg-yellow-500/10 border border-yellow-500/50 rounded-lg p-4",children:l.jsxs("p",{className:"text-sm text-yellow-900 dark:text-yellow-100",children:[l.jsx("strong",{children:"⚠️ 重要提示:"})," 由于技术原因,使用重启功能后,将无法再使用 ",l.jsx("code",{className:"px-1 py-0.5 bg-yellow-200 dark:bg-yellow-900 rounded",children:"Ctrl+C"})," 结束程序。如需结束程序,请使用脚本目录下的进程管理脚本。"]})}),s==="failed"&&l.jsxs("div",{className:"flex gap-2",children:[l.jsx("button",{onClick:()=>window.location.reload(),className:"flex-1 px-4 py-2 bg-primary text-primary-foreground rounded-md hover:bg-primary/90",children:"刷新页面"}),l.jsx("button",{onClick:()=>{i("checking"),h(0),f()},className:"flex-1 px-4 py-2 bg-secondary text-secondary-foreground rounded-md hover:bg-secondary/90",children:"重试检测"})]})]})})}let H3=[],QL=[];(()=>{let t="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,n=0;e>1;if(t=QL[r])e=r+1;else return!0;if(e==n)return!1}}function j9(t){return t>=127462&&t<=127487}const N9=8205;function ure(t,e,n=!0,r=!0){return(n?HL:dre)(t,e,r)}function HL(t,e,n){if(e==t.length)return e;e&&VL(t.charCodeAt(e))&&UL(t.charCodeAt(e-1))&&e--;let r=uw(t,e);for(e+=C9(r);e=0&&j9(uw(t,a));)i++,a-=2;if(i%2==0)break;e+=2}else break}return e}function dre(t,e,n){for(;e>0;){let r=HL(t,e-2,n);if(r=56320&&t<57344}function UL(t){return t>=55296&&t<56320}function C9(t){return t<65536?1:2}class cn{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,n,r){[e,n]=vh(this,e,n);let s=[];return this.decompose(0,e,s,2),r.length&&r.decompose(0,r.length,s,3),this.decompose(n,this.length,s,1),e1.from(s,this.length-(n-e)+r.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,n=this.length){[e,n]=vh(this,e,n);let r=[];return this.decompose(e,n,r,0),e1.from(r,n-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let n=this.scanIdentical(e,1),r=this.length-this.scanIdentical(e,-1),s=new Nm(this),i=new Nm(e);for(let a=n,o=n;;){if(s.next(a),i.next(a),a=0,s.lineBreak!=i.lineBreak||s.done!=i.done||s.value!=i.value)return!1;if(o+=s.value.length,s.done||o>=r)return!0}}iter(e=1){return new Nm(this,e)}iterRange(e,n=this.length){return new WL(this,e,n)}iterLines(e,n){let r;if(e==null)r=this.iter();else{n==null&&(n=this.lines+1);let s=this.line(e).from;r=this.iterRange(s,Math.max(s,n==this.lines+1?this.length:n<=1?0:this.line(n-1).to))}return new GL(r)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?cn.empty:e.length<=32?new Or(e):e1.from(Or.split(e,[]))}}class Or extends cn{constructor(e,n=hre(e)){super(),this.text=e,this.length=n}get lines(){return this.text.length}get children(){return null}lineInner(e,n,r,s){for(let i=0;;i++){let a=this.text[i],o=s+a.length;if((n?r:o)>=e)return new fre(s,o,r,a);s=o+1,r++}}decompose(e,n,r,s){let i=e<=0&&n>=this.length?this:new Or(T9(this.text,e,n),Math.min(n,this.length)-Math.max(0,e));if(s&1){let a=r.pop(),o=t1(i.text,a.text.slice(),0,i.length);if(o.length<=32)r.push(new Or(o,a.length+i.length));else{let c=o.length>>1;r.push(new Or(o.slice(0,c)),new Or(o.slice(c)))}}else r.push(i)}replace(e,n,r){if(!(r instanceof Or))return super.replace(e,n,r);[e,n]=vh(this,e,n);let s=t1(this.text,t1(r.text,T9(this.text,0,e)),n),i=this.length+r.length-(n-e);return s.length<=32?new Or(s,i):e1.from(Or.split(s,[]),i)}sliceString(e,n=this.length,r=` -`){[e,n]=vh(this,e,n);let s="";for(let i=0,a=0;i<=n&&ae&&a&&(s+=r),ei&&(s+=o.slice(Math.max(0,e-i),n-i)),i=c+1}return s}flatten(e){for(let n of this.text)e.push(n)}scanIdentical(){return 0}static split(e,n){let r=[],s=-1;for(let i of e)r.push(i),s+=i.length+1,r.length==32&&(n.push(new Or(r,s)),r=[],s=-1);return s>-1&&n.push(new Or(r,s)),n}}let e1=class Id extends cn{constructor(e,n){super(),this.children=e,this.length=n,this.lines=0;for(let r of e)this.lines+=r.lines}lineInner(e,n,r,s){for(let i=0;;i++){let a=this.children[i],o=s+a.length,c=r+a.lines-1;if((n?c:o)>=e)return a.lineInner(e,n,r,s);s=o+1,r=c+1}}decompose(e,n,r,s){for(let i=0,a=0;a<=n&&i=a){let h=s&((a<=e?1:0)|(c>=n?2:0));a>=e&&c<=n&&!h?r.push(o):o.decompose(e-a,n-a,r,h)}a=c+1}}replace(e,n,r){if([e,n]=vh(this,e,n),r.lines=i&&n<=o){let c=a.replace(e-i,n-i,r),h=this.lines-a.lines+c.lines;if(c.lines>4&&c.lines>h>>6){let f=this.children.slice();return f[s]=c,new Id(f,this.length-(n-e)+r.length)}return super.replace(i,o,c)}i=o+1}return super.replace(e,n,r)}sliceString(e,n=this.length,r=` -`){[e,n]=vh(this,e,n);let s="";for(let i=0,a=0;ie&&i&&(s+=r),ea&&(s+=o.sliceString(e-a,n-a,r)),a=c+1}return s}flatten(e){for(let n of this.children)n.flatten(e)}scanIdentical(e,n){if(!(e instanceof Id))return 0;let r=0,[s,i,a,o]=n>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;s+=n,i+=n){if(s==a||i==o)return r;let c=this.children[s],h=e.children[i];if(c!=h)return r+c.scanIdentical(h,n);r+=c.length+1}}static from(e,n=e.reduce((r,s)=>r+s.length+1,-1)){let r=0;for(let x of e)r+=x.lines;if(r<32){let x=[];for(let y of e)y.flatten(x);return new Or(x,n)}let s=Math.max(32,r>>5),i=s<<1,a=s>>1,o=[],c=0,h=-1,f=[];function m(x){let y;if(x.lines>i&&x instanceof Id)for(let w of x.children)m(w);else x.lines>a&&(c>a||!c)?(g(),o.push(x)):x instanceof Or&&c&&(y=f[f.length-1])instanceof Or&&x.lines+y.lines<=32?(c+=x.lines,h+=x.length+1,f[f.length-1]=new Or(y.text.concat(x.text),y.length+1+x.length)):(c+x.lines>s&&g(),c+=x.lines,h+=x.length+1,f.push(x))}function g(){c!=0&&(o.push(f.length==1?f[0]:Id.from(f,h)),h=-1,c=f.length=0)}for(let x of e)m(x);return g(),o.length==1?o[0]:new Id(o,n)}};cn.empty=new Or([""],0);function hre(t){let e=-1;for(let n of t)e+=n.length+1;return e}function t1(t,e,n=0,r=1e9){for(let s=0,i=0,a=!0;i=n&&(c>r&&(o=o.slice(0,r-s)),s0?1:(e instanceof Or?e.text.length:e.children.length)<<1]}nextInner(e,n){for(this.done=this.lineBreak=!1;;){let r=this.nodes.length-1,s=this.nodes[r],i=this.offsets[r],a=i>>1,o=s instanceof Or?s.text.length:s.children.length;if(a==(n>0?o:0)){if(r==0)return this.done=!0,this.value="",this;n>0&&this.offsets[r-1]++,this.nodes.pop(),this.offsets.pop()}else if((i&1)==(n>0?0:1)){if(this.offsets[r]+=n,e==0)return this.lineBreak=!0,this.value=` -`,this;e--}else if(s instanceof Or){let c=s.text[a+(n<0?-1:0)];if(this.offsets[r]+=n,c.length>Math.max(0,e))return this.value=e==0?c:n>0?c.slice(e):c.slice(0,c.length-e),this;e-=c.length}else{let c=s.children[a+(n<0?-1:0)];e>c.length?(e-=c.length,this.offsets[r]+=n):(n<0&&this.offsets[r]--,this.nodes.push(c),this.offsets.push(n>0?1:(c instanceof Or?c.text.length:c.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class WL{constructor(e,n,r){this.value="",this.done=!1,this.cursor=new Nm(e,n>r?-1:1),this.pos=n>r?e.length:0,this.from=Math.min(n,r),this.to=Math.max(n,r)}nextInner(e,n){if(n<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,n<0?this.pos-this.to:this.from-this.pos);let r=n<0?this.pos-this.from:this.to-this.pos;e>r&&(e=r),r-=e;let{value:s}=this.cursor.next(e);return this.pos+=(s.length+e)*n,this.value=s.length<=r?s:n<0?s.slice(s.length-r):s.slice(0,r),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class GL{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:n,lineBreak:r,value:s}=this.inner.next(e);return n&&this.afterBreak?(this.value="",this.afterBreak=!1):n?(this.done=!0,this.value=""):r?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=s,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(cn.prototype[Symbol.iterator]=function(){return this.iter()},Nm.prototype[Symbol.iterator]=WL.prototype[Symbol.iterator]=GL.prototype[Symbol.iterator]=function(){return this});class fre{constructor(e,n,r,s){this.from=e,this.to=n,this.number=r,this.text=s}get length(){return this.to-this.from}}function vh(t,e,n){return e=Math.max(0,Math.min(t.length,e)),[e,Math.max(e,Math.min(t.length,n))]}function ms(t,e,n=!0,r=!0){return ure(t,e,n,r)}function mre(t){return t>=56320&&t<57344}function pre(t){return t>=55296&&t<56320}function Ks(t,e){let n=t.charCodeAt(e);if(!pre(n)||e+1==t.length)return n;let r=t.charCodeAt(e+1);return mre(r)?(n-55296<<10)+(r-56320)+65536:n}function b6(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10)+55296,(t&1023)+56320))}function Xa(t){return t<65536?1:2}const V3=/\r\n?|\n/;var fs=(function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t})(fs||(fs={}));class ll{constructor(e){this.sections=e}get length(){let e=0;for(let n=0;ne)return i+(e-s);i+=o}else{if(r!=fs.Simple&&h>=e&&(r==fs.TrackDel&&se||r==fs.TrackBefore&&se))return null;if(h>e||h==e&&n<0&&!o)return e==s||n<0?i:i+c;i+=c}s=h}if(e>s)throw new RangeError(`Position ${e} is out of range for changeset of length ${s}`);return i}touchesRange(e,n=e){for(let r=0,s=0;r=0&&s<=n&&o>=e)return sn?"cover":!0;s=o}return!1}toString(){let e="";for(let n=0;n=0?":"+s:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(n=>typeof n!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new ll(e)}static create(e){return new ll(e)}}class Hr extends ll{constructor(e,n){super(e),this.inserted=n}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return U3(this,(n,r,s,i,a)=>e=e.replace(s,s+(r-n),a),!1),e}mapDesc(e,n=!1){return W3(this,e,n,!0)}invert(e){let n=this.sections.slice(),r=[];for(let s=0,i=0;s=0){n[s]=o,n[s+1]=a;let c=s>>1;for(;r.length0&&dc(r,n,i.text),i.forward(f),o+=f}let h=e[a++];for(;o>1].toJSON()))}return e}static of(e,n,r){let s=[],i=[],a=0,o=null;function c(f=!1){if(!f&&!s.length)return;ag||m<0||g>n)throw new RangeError(`Invalid change range ${m} to ${g} (in doc of length ${n})`);let y=x?typeof x=="string"?cn.of(x.split(r||V3)):x:cn.empty,w=y.length;if(m==g&&w==0)return;ma&&ys(s,m-a,-1),ys(s,g-m,w),dc(i,s,y),a=g}}return h(e),c(!o),o}static empty(e){return new Hr(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let n=[],r=[];for(let s=0;so&&typeof a!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(i.length==1)n.push(i[0],0);else{for(;r.length=0&&n<=0&&n==t[s+1]?t[s]+=e:s>=0&&e==0&&t[s]==0?t[s+1]+=n:r?(t[s]+=e,t[s+1]+=n):t.push(e,n)}function dc(t,e,n){if(n.length==0)return;let r=e.length-2>>1;if(r>1])),!(n||a==t.sections.length||t.sections[a+1]<0);)o=t.sections[a++],c=t.sections[a++];e(s,h,i,f,m),s=h,i=f}}}function W3(t,e,n,r=!1){let s=[],i=r?[]:null,a=new Vm(t),o=new Vm(e);for(let c=-1;;){if(a.done&&o.len||o.done&&a.len)throw new Error("Mismatched change set lengths");if(a.ins==-1&&o.ins==-1){let h=Math.min(a.len,o.len);ys(s,h,-1),a.forward(h),o.forward(h)}else if(o.ins>=0&&(a.ins<0||c==a.i||a.off==0&&(o.len=0&&c=0){let h=0,f=a.len;for(;f;)if(o.ins==-1){let m=Math.min(f,o.len);h+=m,f-=m,o.forward(m)}else if(o.ins==0&&o.lenc||a.ins>=0&&a.len>c)&&(o||r.length>h),i.forward2(c),a.forward(c)}}}}class Vm{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i>1;return n>=e.length?cn.empty:e[n]}textBit(e){let{inserted:n}=this.set,r=this.i-2>>1;return r>=n.length&&!e?cn.empty:n[r].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class mu{constructor(e,n,r){this.from=e,this.to=n,this.flags=r}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,n=-1){let r,s;return this.empty?r=s=e.mapPos(this.from,n):(r=e.mapPos(this.from,1),s=e.mapPos(this.to,-1)),r==this.from&&s==this.to?this:new mu(r,s,this.flags)}extend(e,n=e){if(e<=this.anchor&&n>=this.anchor)return Ae.range(e,n);let r=Math.abs(e-this.anchor)>Math.abs(n-this.anchor)?e:n;return Ae.range(this.anchor,r)}eq(e,n=!1){return this.anchor==e.anchor&&this.head==e.head&&(!n||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return Ae.range(e.anchor,e.head)}static create(e,n,r){return new mu(e,n,r)}}class Ae{constructor(e,n){this.ranges=e,this.mainIndex=n}map(e,n=-1){return e.empty?this:Ae.create(this.ranges.map(r=>r.map(e,n)),this.mainIndex)}eq(e,n=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let r=0;re.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new Ae(e.ranges.map(n=>mu.fromJSON(n)),e.main)}static single(e,n=e){return new Ae([Ae.range(e,n)],0)}static create(e,n=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let r=0,s=0;se?8:0)|i)}static normalized(e,n=0){let r=e[n];e.sort((s,i)=>s.from-i.from),n=e.indexOf(r);for(let s=1;si.head?Ae.range(c,o):Ae.range(o,c))}}return new Ae(e,n)}}function YL(t,e){for(let n of t.ranges)if(n.to>e)throw new RangeError("Selection points outside of document")}let w6=0;class et{constructor(e,n,r,s,i){this.combine=e,this.compareInput=n,this.compare=r,this.isStatic=s,this.id=w6++,this.default=e([]),this.extensions=typeof i=="function"?i(this):i}get reader(){return this}static define(e={}){return new et(e.combine||(n=>n),e.compareInput||((n,r)=>n===r),e.compare||(e.combine?(n,r)=>n===r:S6),!!e.static,e.enables)}of(e){return new n1([],this,0,e)}compute(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new n1(e,this,1,n)}computeN(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new n1(e,this,2,n)}from(e,n){return n||(n=r=>r),this.compute([e],r=>n(r.field(e)))}}function S6(t,e){return t==e||t.length==e.length&&t.every((n,r)=>n===e[r])}class n1{constructor(e,n,r,s){this.dependencies=e,this.facet=n,this.type=r,this.value=s,this.id=w6++}dynamicSlot(e){var n;let r=this.value,s=this.facet.compareInput,i=this.id,a=e[i]>>1,o=this.type==2,c=!1,h=!1,f=[];for(let m of this.dependencies)m=="doc"?c=!0:m=="selection"?h=!0:(((n=e[m.id])!==null&&n!==void 0?n:1)&1)==0&&f.push(e[m.id]);return{create(m){return m.values[a]=r(m),1},update(m,g){if(c&&g.docChanged||h&&(g.docChanged||g.selection)||G3(m,f)){let x=r(m);if(o?!E9(x,m.values[a],s):!s(x,m.values[a]))return m.values[a]=x,1}return 0},reconfigure:(m,g)=>{let x,y=g.config.address[i];if(y!=null){let w=R1(g,y);if(this.dependencies.every(S=>S instanceof et?g.facet(S)===m.facet(S):S instanceof is?g.field(S,!1)==m.field(S,!1):!0)||(o?E9(x=r(m),w,s):s(x=r(m),w)))return m.values[a]=w,0}else x=r(m);return m.values[a]=x,1}}}}function E9(t,e,n){if(t.length!=e.length)return!1;for(let r=0;rt[c.id]),s=n.map(c=>c.type),i=r.filter(c=>!(c&1)),a=t[e.id]>>1;function o(c){let h=[];for(let f=0;fr===s),e);return e.provide&&(n.provides=e.provide(n)),n}create(e){let n=e.facet(Gg).find(r=>r.field==this);return(n?.create||this.createF)(e)}slot(e){let n=e[this.id]>>1;return{create:r=>(r.values[n]=this.create(r),1),update:(r,s)=>{let i=r.values[n],a=this.updateF(i,s);return this.compareF(i,a)?0:(r.values[n]=a,1)},reconfigure:(r,s)=>{let i=r.facet(Gg),a=s.facet(Gg),o;return(o=i.find(c=>c.field==this))&&o!=a.find(c=>c.field==this)?(r.values[n]=o.create(r),1):s.config.address[this.id]!=null?(r.values[n]=s.field(this),0):(r.values[n]=this.create(r),1)}}}init(e){return[this,Gg.of({field:this,create:e})]}get extension(){return this}}const uu={lowest:4,low:3,default:2,high:1,highest:0};function Zf(t){return e=>new KL(e,t)}const Mc={highest:Zf(uu.highest),high:Zf(uu.high),default:Zf(uu.default),low:Zf(uu.low),lowest:Zf(uu.lowest)};class KL{constructor(e,n){this.inner=e,this.prec=n}}class Wv{of(e){return new X3(this,e)}reconfigure(e){return Wv.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class X3{constructor(e,n){this.compartment=e,this.inner=n}}class A1{constructor(e,n,r,s,i,a){for(this.base=e,this.compartments=n,this.dynamicSlots=r,this.address=s,this.staticValues=i,this.facets=a,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(e,n,r){let s=[],i=Object.create(null),a=new Map;for(let g of xre(e,n,a))g instanceof is?s.push(g):(i[g.facet.id]||(i[g.facet.id]=[])).push(g);let o=Object.create(null),c=[],h=[];for(let g of s)o[g.id]=h.length<<1,h.push(x=>g.slot(x));let f=r?.config.facets;for(let g in i){let x=i[g],y=x[0].facet,w=f&&f[g]||[];if(x.every(S=>S.type==0))if(o[y.id]=c.length<<1|1,S6(w,x))c.push(r.facet(y));else{let S=y.combine(x.map(k=>k.value));c.push(r&&y.compare(S,r.facet(y))?r.facet(y):S)}else{for(let S of x)S.type==0?(o[S.id]=c.length<<1|1,c.push(S.value)):(o[S.id]=h.length<<1,h.push(k=>S.dynamicSlot(k)));o[y.id]=h.length<<1,h.push(S=>gre(S,y,x))}}let m=h.map(g=>g(o));return new A1(e,a,m,o,c,i)}}function xre(t,e,n){let r=[[],[],[],[],[]],s=new Map;function i(a,o){let c=s.get(a);if(c!=null){if(c<=o)return;let h=r[c].indexOf(a);h>-1&&r[c].splice(h,1),a instanceof X3&&n.delete(a.compartment)}if(s.set(a,o),Array.isArray(a))for(let h of a)i(h,o);else if(a instanceof X3){if(n.has(a.compartment))throw new RangeError("Duplicate use of compartment in extensions");let h=e.get(a.compartment)||a.inner;n.set(a.compartment,h),i(h,o)}else if(a instanceof KL)i(a.inner,a.prec);else if(a instanceof is)r[o].push(a),a.provides&&i(a.provides,o);else if(a instanceof n1)r[o].push(a),a.facet.extensions&&i(a.facet.extensions,uu.default);else{let h=a.extension;if(!h)throw new Error(`Unrecognized extension value in extension set (${a}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);i(h,o)}}return i(t,uu.default),r.reduce((a,o)=>a.concat(o))}function Cm(t,e){if(e&1)return 2;let n=e>>1,r=t.status[n];if(r==4)throw new Error("Cyclic dependency between fields and/or facets");if(r&2)return r;t.status[n]=4;let s=t.computeSlot(t,t.config.dynamicSlots[n]);return t.status[n]=2|s}function R1(t,e){return e&1?t.config.staticValues[e>>1]:t.values[e>>1]}const ZL=et.define(),Y3=et.define({combine:t=>t.some(e=>e),static:!0}),JL=et.define({combine:t=>t.length?t[0]:void 0,static:!0}),eI=et.define(),tI=et.define(),nI=et.define(),rI=et.define({combine:t=>t.length?t[0]:!1});class hl{constructor(e,n){this.type=e,this.value=n}static define(){return new vre}}class vre{of(e){return new hl(this,e)}}class yre{constructor(e){this.map=e}of(e){return new Mt(this,e)}}class Mt{constructor(e,n){this.type=e,this.value=n}map(e){let n=this.type.map(this.value,e);return n===void 0?void 0:n==this.value?this:new Mt(this.type,n)}is(e){return this.type==e}static define(e={}){return new yre(e.map||(n=>n))}static mapEffects(e,n){if(!e.length)return e;let r=[];for(let s of e){let i=s.map(n);i&&r.push(i)}return r}}Mt.reconfigure=Mt.define();Mt.appendConfig=Mt.define();class Pr{constructor(e,n,r,s,i,a){this.startState=e,this.changes=n,this.selection=r,this.effects=s,this.annotations=i,this.scrollIntoView=a,this._doc=null,this._state=null,r&&YL(r,n.newLength),i.some(o=>o.type==Pr.time)||(this.annotations=i.concat(Pr.time.of(Date.now())))}static create(e,n,r,s,i,a){return new Pr(e,n,r,s,i,a)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let n of this.annotations)if(n.type==e)return n.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let n=this.annotation(Pr.userEvent);return!!(n&&(n==e||n.length>e.length&&n.slice(0,e.length)==e&&n[e.length]=="."))}}Pr.time=hl.define();Pr.userEvent=hl.define();Pr.addToHistory=hl.define();Pr.remote=hl.define();function bre(t,e){let n=[];for(let r=0,s=0;;){let i,a;if(r=t[r]))i=t[r++],a=t[r++];else if(s=0;s--){let i=r[s](t);i instanceof Pr?t=i:Array.isArray(i)&&i.length==1&&i[0]instanceof Pr?t=i[0]:t=iI(e,eh(i),!1)}return t}function Sre(t){let e=t.startState,n=e.facet(nI),r=t;for(let s=n.length-1;s>=0;s--){let i=n[s](t);i&&Object.keys(i).length&&(r=sI(r,K3(e,i,t.changes.newLength),!0))}return r==t?t:Pr.create(e,t.changes,t.selection,r.effects,r.annotations,r.scrollIntoView)}const kre=[];function eh(t){return t==null?kre:Array.isArray(t)?t:[t]}var nr=(function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t})(nr||(nr={}));const Ore=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Z3;try{Z3=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function jre(t){if(Z3)return Z3.test(t);for(let e=0;e"€"&&(n.toUpperCase()!=n.toLowerCase()||Ore.test(n)))return!0}return!1}function Nre(t){return e=>{if(!/\S/.test(e))return nr.Space;if(jre(e))return nr.Word;for(let n=0;n-1)return nr.Word;return nr.Other}}class an{constructor(e,n,r,s,i,a){this.config=e,this.doc=n,this.selection=r,this.values=s,this.status=e.statusTemplate.slice(),this.computeSlot=i,a&&(a._state=this);for(let o=0;os.set(h,c)),n=null),s.set(o.value.compartment,o.value.extension)):o.is(Mt.reconfigure)?(n=null,r=o.value):o.is(Mt.appendConfig)&&(n=null,r=eh(r).concat(o.value));let i;n?i=e.startState.values.slice():(n=A1.resolve(r,s,this),i=new an(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(c,h)=>h.reconfigure(c,this),null).values);let a=e.startState.facet(Y3)?e.newSelection:e.newSelection.asSingle();new an(n,e.newDoc,a,i,(o,c)=>c.update(o,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:e},range:Ae.cursor(n.from+e.length)}))}changeByRange(e){let n=this.selection,r=e(n.ranges[0]),s=this.changes(r.changes),i=[r.range],a=eh(r.effects);for(let o=1;oa.spec.fromJSON(o,c)))}}return an.create({doc:e.doc,selection:Ae.fromJSON(e.selection),extensions:n.extensions?s.concat([n.extensions]):s})}static create(e={}){let n=A1.resolve(e.extensions||[],new Map),r=e.doc instanceof cn?e.doc:cn.of((e.doc||"").split(n.staticFacet(an.lineSeparator)||V3)),s=e.selection?e.selection instanceof Ae?e.selection:Ae.single(e.selection.anchor,e.selection.head):Ae.single(0);return YL(s,r.length),n.staticFacet(Y3)||(s=s.asSingle()),new an(n,r,s,n.dynamicSlots.map(()=>null),(i,a)=>a.create(i),null)}get tabSize(){return this.facet(an.tabSize)}get lineBreak(){return this.facet(an.lineSeparator)||` -`}get readOnly(){return this.facet(rI)}phrase(e,...n){for(let r of this.facet(an.phrases))if(Object.prototype.hasOwnProperty.call(r,e)){e=r[e];break}return n.length&&(e=e.replace(/\$(\$|\d*)/g,(r,s)=>{if(s=="$")return"$";let i=+(s||1);return!i||i>n.length?r:n[i-1]})),e}languageDataAt(e,n,r=-1){let s=[];for(let i of this.facet(ZL))for(let a of i(this,n,r))Object.prototype.hasOwnProperty.call(a,e)&&s.push(a[e]);return s}charCategorizer(e){return Nre(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:n,from:r,length:s}=this.doc.lineAt(e),i=this.charCategorizer(e),a=e-r,o=e-r;for(;a>0;){let c=ms(n,a,!1);if(i(n.slice(c,a))!=nr.Word)break;a=c}for(;ot.length?t[0]:4});an.lineSeparator=JL;an.readOnly=rI;an.phrases=et.define({compare(t,e){let n=Object.keys(t),r=Object.keys(e);return n.length==r.length&&n.every(s=>t[s]==e[s])}});an.languageData=ZL;an.changeFilter=eI;an.transactionFilter=tI;an.transactionExtender=nI;Wv.reconfigure=Mt.define();function fl(t,e,n={}){let r={};for(let s of t)for(let i of Object.keys(s)){let a=s[i],o=r[i];if(o===void 0)r[i]=a;else if(!(o===a||a===void 0))if(Object.hasOwnProperty.call(n,i))r[i]=n[i](o,a);else throw new Error("Config merge conflict for field "+i)}for(let s in e)r[s]===void 0&&(r[s]=e[s]);return r}class Tu{eq(e){return this==e}range(e,n=e){return J3.create(e,n,this)}}Tu.prototype.startSide=Tu.prototype.endSide=0;Tu.prototype.point=!1;Tu.prototype.mapMode=fs.TrackDel;let J3=class aI{constructor(e,n,r){this.from=e,this.to=n,this.value=r}static create(e,n,r){return new aI(e,n,r)}};function eS(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}class k6{constructor(e,n,r,s){this.from=e,this.to=n,this.value=r,this.maxPoint=s}get length(){return this.to[this.to.length-1]}findIndex(e,n,r,s=0){let i=r?this.to:this.from;for(let a=s,o=i.length;;){if(a==o)return a;let c=a+o>>1,h=i[c]-e||(r?this.value[c].endSide:this.value[c].startSide)-n;if(c==a)return h>=0?a:o;h>=0?o=c:a=c+1}}between(e,n,r,s){for(let i=this.findIndex(n,-1e9,!0),a=this.findIndex(r,1e9,!1,i);ix||g==x&&h.startSide>0&&h.endSide<=0)continue;(x-g||h.endSide-h.startSide)<0||(a<0&&(a=g),h.point&&(o=Math.max(o,x-g)),r.push(h),s.push(g-a),i.push(x-a))}return{mapped:r.length?new k6(s,i,r,o):null,pos:a}}}class bn{constructor(e,n,r,s){this.chunkPos=e,this.chunk=n,this.nextLayer=r,this.maxPoint=s}static create(e,n,r,s){return new bn(e,n,r,s)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let n of this.chunk)e+=n.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:n=[],sort:r=!1,filterFrom:s=0,filterTo:i=this.length}=e,a=e.filter;if(n.length==0&&!a)return this;if(r&&(n=n.slice().sort(eS)),this.isEmpty)return n.length?bn.of(n):this;let o=new lI(this,null,-1).goto(0),c=0,h=[],f=new fo;for(;o.value||c=0){let m=n[c++];f.addInner(m.from,m.to,m.value)||h.push(m)}else o.rangeIndex==1&&o.chunkIndexthis.chunkEnd(o.chunkIndex)||io.to||i=i&&e<=i+a.length&&a.between(i,e-i,n-i,r)===!1)return}this.nextLayer.between(e,n,r)}}iter(e=0){return Um.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,n=0){return Um.from(e).goto(n)}static compare(e,n,r,s,i=-1){let a=e.filter(m=>m.maxPoint>0||!m.isEmpty&&m.maxPoint>=i),o=n.filter(m=>m.maxPoint>0||!m.isEmpty&&m.maxPoint>=i),c=_9(a,o,r),h=new Jf(a,c,i),f=new Jf(o,c,i);r.iterGaps((m,g,x)=>M9(h,m,f,g,x,s)),r.empty&&r.length==0&&M9(h,0,f,0,0,s)}static eq(e,n,r=0,s){s==null&&(s=999999999);let i=e.filter(f=>!f.isEmpty&&n.indexOf(f)<0),a=n.filter(f=>!f.isEmpty&&e.indexOf(f)<0);if(i.length!=a.length)return!1;if(!i.length)return!0;let o=_9(i,a),c=new Jf(i,o,0).goto(r),h=new Jf(a,o,0).goto(r);for(;;){if(c.to!=h.to||!tS(c.active,h.active)||c.point&&(!h.point||!c.point.eq(h.point)))return!1;if(c.to>s)return!0;c.next(),h.next()}}static spans(e,n,r,s,i=-1){let a=new Jf(e,null,i).goto(n),o=n,c=a.openStart;for(;;){let h=Math.min(a.to,r);if(a.point){let f=a.activeForPoint(a.to),m=a.pointFromo&&(s.span(o,h,a.active,c),c=a.openEnd(h));if(a.to>r)return c+(a.point&&a.to>r?1:0);o=a.to,a.next()}}static of(e,n=!1){let r=new fo;for(let s of e instanceof J3?[e]:n?Cre(e):e)r.add(s.from,s.to,s.value);return r.finish()}static join(e){if(!e.length)return bn.empty;let n=e[e.length-1];for(let r=e.length-2;r>=0;r--)for(let s=e[r];s!=bn.empty;s=s.nextLayer)n=new bn(s.chunkPos,s.chunk,n,Math.max(s.maxPoint,n.maxPoint));return n}}bn.empty=new bn([],[],null,-1);function Cre(t){if(t.length>1)for(let e=t[0],n=1;n0)return t.slice().sort(eS);e=r}return t}bn.empty.nextLayer=bn.empty;class fo{finishChunk(e){this.chunks.push(new k6(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,n,r){this.addInner(e,n,r)||(this.nextLayer||(this.nextLayer=new fo)).add(e,n,r)}addInner(e,n,r){let s=e-this.lastTo||r.startSide-this.last.endSide;if(s<=0&&(e-this.lastFrom||r.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return s<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(n-this.chunkStart),this.last=r,this.lastFrom=e,this.lastTo=n,this.value.push(r),r.point&&(this.maxPoint=Math.max(this.maxPoint,n-e)),!0)}addChunk(e,n){if((e-this.lastTo||n.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,n.maxPoint),this.chunks.push(n),this.chunkPos.push(e);let r=n.value.length-1;return this.last=n.value[r],this.lastFrom=n.from[r]+e,this.lastTo=n.to[r]+e,!0}finish(){return this.finishInner(bn.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let n=bn.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,n}}function _9(t,e,n){let r=new Map;for(let i of t)for(let a=0;a=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex=r&&s.push(new lI(a,n,r,i));return s.length==1?s[0]:new Um(s)}get startSide(){return this.value?this.value.startSide:0}goto(e,n=-1e9){for(let r of this.heap)r.goto(e,n);for(let r=this.heap.length>>1;r>=0;r--)dw(this.heap,r);return this.next(),this}forward(e,n){for(let r of this.heap)r.forward(e,n);for(let r=this.heap.length>>1;r>=0;r--)dw(this.heap,r);(this.to-e||this.value.endSide-n)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),dw(this.heap,0)}}}function dw(t,e){for(let n=t[e];;){let r=(e<<1)+1;if(r>=t.length)break;let s=t[r];if(r+1=0&&(s=t[r+1],r++),n.compare(s)<0)break;t[r]=n,t[e]=s,e=r}}class Jf{constructor(e,n,r){this.minPoint=r,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=Um.from(e,n,r)}goto(e,n=-1e9){return this.cursor.goto(e,n),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=n,this.openStart=-1,this.next(),this}forward(e,n){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-n)<0;)this.removeActive(this.minActive);this.cursor.forward(e,n)}removeActive(e){Xg(this.active,e),Xg(this.activeTo,e),Xg(this.activeRank,e),this.minActive=A9(this.active,this.activeTo)}addActive(e){let n=0,{value:r,to:s,rank:i}=this.cursor;for(;n0;)n++;Yg(this.active,n,r),Yg(this.activeTo,n,s),Yg(this.activeRank,n,i),e&&Yg(e,n,this.cursor.from),this.minActive=A9(this.active,this.activeTo)}next(){let e=this.to,n=this.point;this.point=null;let r=this.openStart<0?[]:null;for(;;){let s=this.minActive;if(s>-1&&(this.activeTo[s]-this.cursor.from||this.active[s].endSide-this.cursor.startSide)<0){if(this.activeTo[s]>e){this.to=this.activeTo[s],this.endSide=this.active[s].endSide;break}this.removeActive(s),r&&Xg(r,s)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let i=this.cursor.value;if(!i.point)this.addActive(r),this.cursor.next();else if(n&&this.cursor.to==this.to&&this.cursor.from=0&&r[s]=0&&!(this.activeRank[r]e||this.activeTo[r]==e&&this.active[r].endSide>=this.point.endSide)&&n.push(this.active[r]);return n.reverse()}openEnd(e){let n=0;for(let r=this.activeTo.length-1;r>=0&&this.activeTo[r]>e;r--)n++;return n}}function M9(t,e,n,r,s,i){t.goto(e),n.goto(r);let a=r+s,o=r,c=r-e;for(;;){let h=t.to+c-n.to,f=h||t.endSide-n.endSide,m=f<0?t.to+c:n.to,g=Math.min(m,a);if(t.point||n.point?t.point&&n.point&&(t.point==n.point||t.point.eq(n.point))&&tS(t.activeForPoint(t.to),n.activeForPoint(n.to))||i.comparePoint(o,g,t.point,n.point):g>o&&!tS(t.active,n.active)&&i.compareRange(o,g,t.active,n.active),m>a)break;(h||t.openEnd!=n.openEnd)&&i.boundChange&&i.boundChange(m),o=m,f<=0&&t.next(),f>=0&&n.next()}}function tS(t,e){if(t.length!=e.length)return!1;for(let n=0;n=e;r--)t[r+1]=t[r];t[e]=n}function A9(t,e){let n=-1,r=1e9;for(let s=0;s=e)return s;if(s==t.length)break;i+=t.charCodeAt(s)==9?n-i%n:1,s=ms(t,s)}return r===!0?-1:t.length}const rS="ͼ",R9=typeof Symbol>"u"?"__"+rS:Symbol.for(rS),sS=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),D9=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class vc{constructor(e,n){this.rules=[];let{finish:r}=n||{};function s(a){return/^@/.test(a)?[a]:a.split(/,\s*/)}function i(a,o,c,h){let f=[],m=/^@(\w+)\b/.exec(a[0]),g=m&&m[1]=="keyframes";if(m&&o==null)return c.push(a[0]+";");for(let x in o){let y=o[x];if(/&/.test(x))i(x.split(/,\s*/).map(w=>a.map(S=>w.replace(/&/,S))).reduce((w,S)=>w.concat(S)),y,c);else if(y&&typeof y=="object"){if(!m)throw new RangeError("The value of a property ("+x+") should be a primitive value.");i(s(x),y,f,g)}else y!=null&&f.push(x.replace(/_.*/,"").replace(/[A-Z]/g,w=>"-"+w.toLowerCase())+": "+y+";")}(f.length||g)&&c.push((r&&!m&&!h?a.map(r):a).join(", ")+" {"+f.join(" ")+"}")}for(let a in e)i(s(a),e[a],this.rules)}getRules(){return this.rules.join(` -`)}static newName(){let e=D9[R9]||1;return D9[R9]=e+1,rS+e.toString(36)}static mount(e,n,r){let s=e[sS],i=r&&r.nonce;s?i&&s.setNonce(i):s=new Tre(e,i),s.mount(Array.isArray(n)?n:[n],e)}}let z9=new Map;class Tre{constructor(e,n){let r=e.ownerDocument||e,s=r.defaultView;if(!e.head&&e.adoptedStyleSheets&&s.CSSStyleSheet){let i=z9.get(r);if(i)return e[sS]=i;this.sheet=new s.CSSStyleSheet,z9.set(r,this)}else this.styleTag=r.createElement("style"),n&&this.styleTag.setAttribute("nonce",n);this.modules=[],e[sS]=this}mount(e,n){let r=this.sheet,s=0,i=0;for(let a=0;a-1&&(this.modules.splice(c,1),i--,c=-1),c==-1){if(this.modules.splice(i++,0,o),r)for(let h=0;h",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Ere=typeof navigator<"u"&&/Mac/.test(navigator.platform),_re=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var hs=0;hs<10;hs++)yc[48+hs]=yc[96+hs]=String(hs);for(var hs=1;hs<=24;hs++)yc[hs+111]="F"+hs;for(var hs=65;hs<=90;hs++)yc[hs]=String.fromCharCode(hs+32),Wm[hs]=String.fromCharCode(hs);for(var hw in yc)Wm.hasOwnProperty(hw)||(Wm[hw]=yc[hw]);function Mre(t){var e=Ere&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||_re&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?Wm:yc)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}function $n(){var t=arguments[0];typeof t=="string"&&(t=document.createElement(t));var e=1,n=arguments[1];if(n&&typeof n=="object"&&n.nodeType==null&&!Array.isArray(n)){for(var r in n)if(Object.prototype.hasOwnProperty.call(n,r)){var s=n[r];typeof s=="string"?t.setAttribute(r,s):s!=null&&(t[r]=s)}e++}for(;e2);var Ye={mac:L9||/Mac/.test(_s.platform),windows:/Win/.test(_s.platform),linux:/Linux|X11/.test(_s.platform),ie:Gv,ie_version:cI?iS.documentMode||6:lS?+lS[1]:aS?+aS[1]:0,gecko:P9,gecko_version:P9?+(/Firefox\/(\d+)/.exec(_s.userAgent)||[0,0])[1]:0,chrome:!!fw,chrome_version:fw?+fw[1]:0,ios:L9,android:/Android\b/.test(_s.userAgent),webkit_version:Are?+(/\bAppleWebKit\/(\d+)/.exec(_s.userAgent)||[0,0])[1]:0,safari:oS,safari_version:oS?+(/\bVersion\/(\d+(\.\d+)?)/.exec(_s.userAgent)||[0,0])[1]:0,tabSize:iS.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function Gm(t){let e;return t.nodeType==11?e=t.getSelection?t:t.ownerDocument:e=t,e.getSelection()}function cS(t,e){return e?t==e||t.contains(e.nodeType!=1?e.parentNode:e):!1}function r1(t,e){if(!e.anchorNode)return!1;try{return cS(t,e.anchorNode)}catch{return!1}}function yh(t){return t.nodeType==3?_u(t,0,t.nodeValue.length).getClientRects():t.nodeType==1?t.getClientRects():[]}function Tm(t,e,n,r){return n?I9(t,e,n,r,-1)||I9(t,e,n,r,1):!1}function Eu(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e}function D1(t){return t.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}function I9(t,e,n,r,s){for(;;){if(t==n&&e==r)return!0;if(e==(s<0?0:cl(t))){if(t.nodeName=="DIV")return!1;let i=t.parentNode;if(!i||i.nodeType!=1)return!1;e=Eu(t)+(s<0?0:1),t=i}else if(t.nodeType==1){if(t=t.childNodes[e+(s<0?-1:0)],t.nodeType==1&&t.contentEditable=="false")return!1;e=s<0?cl(t):0}else return!1}}function cl(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function H0(t,e){let n=e?t.left:t.right;return{left:n,right:n,top:t.top,bottom:t.bottom}}function Rre(t){let e=t.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}function uI(t,e){let n=e.width/t.offsetWidth,r=e.height/t.offsetHeight;return(n>.995&&n<1.005||!isFinite(n)||Math.abs(e.width-t.offsetWidth)<1)&&(n=1),(r>.995&&r<1.005||!isFinite(r)||Math.abs(e.height-t.offsetHeight)<1)&&(r=1),{scaleX:n,scaleY:r}}function Dre(t,e,n,r,s,i,a,o){let c=t.ownerDocument,h=c.defaultView||window;for(let f=t,m=!1;f&&!m;)if(f.nodeType==1){let g,x=f==c.body,y=1,w=1;if(x)g=Rre(h);else{if(/^(fixed|sticky)$/.test(getComputedStyle(f).position)&&(m=!0),f.scrollHeight<=f.clientHeight&&f.scrollWidth<=f.clientWidth){f=f.assignedSlot||f.parentNode;continue}let N=f.getBoundingClientRect();({scaleX:y,scaleY:w}=uI(f,N)),g={left:N.left,right:N.left+f.clientWidth*y,top:N.top,bottom:N.top+f.clientHeight*w}}let S=0,k=0;if(s=="nearest")e.top0&&e.bottom>g.bottom+k&&(k=e.bottom-g.bottom+a)):e.bottom>g.bottom&&(k=e.bottom-g.bottom+a,n<0&&e.top-k0&&e.right>g.right+S&&(S=e.right-g.right+i)):e.right>g.right&&(S=e.right-g.right+i,n<0&&e.leftg.bottom||e.leftg.right)&&(e={left:Math.max(e.left,g.left),right:Math.min(e.right,g.right),top:Math.max(e.top,g.top),bottom:Math.min(e.bottom,g.bottom)}),f=f.assignedSlot||f.parentNode}else if(f.nodeType==11)f=f.host;else break}function zre(t){let e=t.ownerDocument,n,r;for(let s=t.parentNode;s&&!(s==e.body||n&&r);)if(s.nodeType==1)!r&&s.scrollHeight>s.clientHeight&&(r=s),!n&&s.scrollWidth>s.clientWidth&&(n=s),s=s.assignedSlot||s.parentNode;else if(s.nodeType==11)s=s.host;else break;return{x:n,y:r}}class Pre{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:n,focusNode:r}=e;this.set(n,Math.min(e.anchorOffset,n?cl(n):0),r,Math.min(e.focusOffset,r?cl(r):0))}set(e,n,r,s){this.anchorNode=e,this.anchorOffset=n,this.focusNode=r,this.focusOffset=s}}let lu=null;Ye.safari&&Ye.safari_version>=26&&(lu=!1);function dI(t){if(t.setActive)return t.setActive();if(lu)return t.focus(lu);let e=[];for(let n=t;n&&(e.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(t.focus(lu==null?{get preventScroll(){return lu={preventScroll:!0},!0}}:void 0),!lu){lu=!1;for(let n=0;nMath.max(1,t.scrollHeight-t.clientHeight-4)}function mI(t,e){for(let n=t,r=e;;){if(n.nodeType==3&&r>0)return{node:n,offset:r};if(n.nodeType==1&&r>0){if(n.contentEditable=="false")return null;n=n.childNodes[r-1],r=cl(n)}else if(n.parentNode&&!D1(n))r=Eu(n),n=n.parentNode;else return null}}function pI(t,e){for(let n=t,r=e;;){if(n.nodeType==3&&rn)return m.domBoundsAround(e,n,h);if(g>=e&&s==-1&&(s=c,i=h),h>n&&m.dom.parentNode==this.dom){a=c,o=f;break}f=g,h=g+m.breakAfter}return{from:i,to:o<0?r+this.length:o,startDOM:(s?this.children[s-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:a=0?this.children[a].dom:null}}markDirty(e=!1){this.flags|=2,this.markParentsDirty(e)}markParentsDirty(e){for(let n=this.parent;n;n=n.parent){if(e&&(n.flags|=2),n.flags&1)return;n.flags|=1,e=!1}}setParent(e){this.parent!=e&&(this.parent=e,this.flags&7&&this.markParentsDirty(!0))}setDOM(e){this.dom!=e&&(this.dom&&(this.dom.cmView=null),this.dom=e,e.cmView=this)}get rootView(){for(let e=this;;){let n=e.parent;if(!n)return e;e=n}}replaceChildren(e,n,r=O6){this.markDirty();for(let s=e;sthis.pos||e==this.pos&&(n>0||this.i==0||this.children[this.i-1].breakAfter))return this.off=e-this.pos,this;let r=this.children[--this.i];this.pos-=r.length+r.breakAfter}}}function xI(t,e,n,r,s,i,a,o,c){let{children:h}=t,f=h.length?h[e]:null,m=i.length?i[i.length-1]:null,g=m?m.breakAfter:a;if(!(e==r&&f&&!a&&!g&&i.length<2&&f.merge(n,s,i.length?m:null,n==0,o,c))){if(r0&&(!a&&i.length&&f.merge(n,f.length,i[0],!1,o,0)?f.breakAfter=i.shift().breakAfter:(nBre||r.flags&8)?!1:(this.text=this.text.slice(0,e)+(r?r.text:"")+this.text.slice(n),this.markDirty(),!0)}split(e){let n=new Ca(this.text.slice(e));return this.text=this.text.slice(0,e),this.markDirty(),n.flags|=this.flags&8,n}localPosFromDOM(e,n){return e==this.dom?n:n?this.text.length:0}domAtPos(e){return new Ss(this.dom,e)}domBoundsAround(e,n,r){return{from:r,to:r+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(e,n){return qre(this.dom,e,n)}}class mo extends Bn{constructor(e,n=[],r=0){super(),this.mark=e,this.children=n,this.length=r;for(let s of n)s.setParent(this)}setAttrs(e){if(hI(e),this.mark.class&&(e.className=this.mark.class),this.mark.attrs)for(let n in this.mark.attrs)e.setAttribute(n,this.mark.attrs[n]);return e}canReuseDOM(e){return super.canReuseDOM(e)&&!((this.flags|e.flags)&8)}reuseDOM(e){e.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(e),this.flags|=6)}sync(e,n){this.dom?this.flags&4&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(e,n)}merge(e,n,r,s,i,a){return r&&(!(r instanceof mo&&r.mark.eq(this.mark))||e&&i<=0||ne&&n.push(r=e&&(s=i),r=c,i++}let a=this.length-e;return this.length=e,s>-1&&(this.children.length=s,this.markDirty()),new mo(this.mark,n,a)}domAtPos(e){return yI(this,e)}coordsAt(e,n){return wI(this,e,n)}}function qre(t,e,n){let r=t.nodeValue.length;e>r&&(e=r);let s=e,i=e,a=0;e==0&&n<0||e==r&&n>=0?Ye.chrome||Ye.gecko||(e?(s--,a=1):i=0)?0:o.length-1];return Ye.safari&&!a&&c.width==0&&(c=Array.prototype.find.call(o,h=>h.width)||c),a?H0(c,a<0):c||null}class eo extends Bn{static create(e,n,r){return new eo(e,n,r)}constructor(e,n,r){super(),this.widget=e,this.length=n,this.side=r,this.prevWidget=null}split(e){let n=eo.create(this.widget,this.length-e,this.side);return this.length-=e,n}sync(e){(!this.dom||!this.widget.updateDOM(this.dom,e))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.widget.editable||(this.dom.contentEditable="false"))}getSide(){return this.side}merge(e,n,r,s,i,a){return r&&(!(r instanceof eo)||!this.widget.compare(r.widget)||e>0&&i<=0||n0)?Ss.before(this.dom):Ss.after(this.dom,e==this.length)}domBoundsAround(){return null}coordsAt(e,n){let r=this.widget.coordsAt(this.dom,e,n);if(r)return r;let s=this.dom.getClientRects(),i=null;if(!s.length)return null;let a=this.side?this.side<0:e>0;for(let o=a?s.length-1:0;i=s[o],!(e>0?o==0:o==s.length-1||i.top0?Ss.before(this.dom):Ss.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(e){return this.dom.getBoundingClientRect()}get overrideDOMText(){return cn.empty}get isHidden(){return!0}}Ca.prototype.children=eo.prototype.children=bh.prototype.children=O6;function yI(t,e){let n=t.dom,{children:r}=t,s=0;for(let i=0;si&&e0;i--){let a=r[i-1];if(a.dom.parentNode==n)return a.domAtPos(a.length)}for(let i=s;i0&&e instanceof mo&&s.length&&(r=s[s.length-1])instanceof mo&&r.mark.eq(e.mark)?bI(r,e.children[0],n-1):(s.push(e),e.setParent(t)),t.length+=e.length}function wI(t,e,n){let r=null,s=-1,i=null,a=-1;function o(h,f){for(let m=0,g=0;m=f&&(x.children.length?o(x,f-g):(!i||i.isHidden&&(n>0||$re(i,x)))&&(y>f||g==y&&x.getSide()>0)?(i=x,a=f-g):(g-1?1:0)!=s.length-(n&&s.indexOf(n)>-1?1:0))return!1;for(let i of r)if(i!=n&&(s.indexOf(i)==-1||t[i]!==e[i]))return!1;return!0}function dS(t,e,n){let r=!1;if(e)for(let s in e)n&&s in n||(r=!0,s=="style"?t.style.cssText="":t.removeAttribute(s));if(n)for(let s in n)e&&e[s]==n[s]||(r=!0,s=="style"?t.style.cssText=n[s]:t.setAttribute(s,n[s]));return r}function Qre(t){let e=Object.create(null);for(let n=0;n0?3e8:-4e8:n>0?1e8:-1e8,new bc(e,n,n,r,e.widget||null,!1)}static replace(e){let n=!!e.block,r,s;if(e.isBlockGap)r=-5e8,s=4e8;else{let{start:i,end:a}=SI(e,n);r=(i?n?-3e8:-1:5e8)-1,s=(a?n?2e8:1:-6e8)+1}return new bc(e,r,s,n,e.widget||null,!0)}static line(e){return new U0(e)}static set(e,n=!1){return bn.of(e,n)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}ft.none=bn.empty;class V0 extends ft{constructor(e){let{start:n,end:r}=SI(e);super(n?-1:5e8,r?1:-6e8,null,e),this.tagName=e.tagName||"span",this.class=e.class||"",this.attrs=e.attributes||null}eq(e){var n,r;return this==e||e instanceof V0&&this.tagName==e.tagName&&(this.class||((n=this.attrs)===null||n===void 0?void 0:n.class))==(e.class||((r=e.attrs)===null||r===void 0?void 0:r.class))&&z1(this.attrs,e.attrs,"class")}range(e,n=e){if(e>=n)throw new RangeError("Mark decorations may not be empty");return super.range(e,n)}}V0.prototype.point=!1;class U0 extends ft{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof U0&&this.spec.class==e.spec.class&&z1(this.spec.attributes,e.spec.attributes)}range(e,n=e){if(n!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,n)}}U0.prototype.mapMode=fs.TrackBefore;U0.prototype.point=!0;class bc extends ft{constructor(e,n,r,s,i,a){super(n,r,i,e),this.block=s,this.isReplace=a,this.mapMode=s?n<=0?fs.TrackBefore:fs.TrackAfter:fs.TrackDel}get type(){return this.startSide!=this.endSide?Rs.WidgetRange:this.startSide<=0?Rs.WidgetBefore:Rs.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof bc&&Hre(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,n=e){if(this.isReplace&&(e>n||e==n&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&n!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,n)}}bc.prototype.point=!0;function SI(t,e=!1){let{inclusiveStart:n,inclusiveEnd:r}=t;return n==null&&(n=t.inclusive),r==null&&(r=t.inclusive),{start:n??e,end:r??e}}function Hre(t,e){return t==e||!!(t&&e&&t.compare(e))}function s1(t,e,n,r=0){let s=n.length-1;s>=0&&n[s]+r>=t?n[s]=Math.max(n[s],e):n.push(t,e)}class Dr extends Bn{constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(e,n,r,s,i,a){if(r){if(!(r instanceof Dr))return!1;this.dom||r.transferDOM(this)}return s&&this.setDeco(r?r.attrs:null),vI(this,e,n,r?r.children.slice():[],i,a),!0}split(e){let n=new Dr;if(n.breakAfter=this.breakAfter,this.length==0)return n;let{i:r,off:s}=this.childPos(e);s&&(n.append(this.children[r].split(s),0),this.children[r].merge(s,this.children[r].length,null,!1,0,0),r++);for(let i=r;i0&&this.children[r-1].length==0;)this.children[--r].destroy();return this.children.length=r,this.markDirty(),this.length=e,n}transferDOM(e){this.dom&&(this.markDirty(),e.setDOM(this.dom),e.prevAttrs=this.prevAttrs===void 0?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(e){z1(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,n){bI(this,e,n)}addLineDeco(e){let n=e.spec.attributes,r=e.spec.class;n&&(this.attrs=uS(n,this.attrs||{})),r&&(this.attrs=uS({class:r},this.attrs||{}))}domAtPos(e){return yI(this,e)}reuseDOM(e){e.nodeName=="DIV"&&(this.setDOM(e),this.flags|=6)}sync(e,n){var r;this.dom?this.flags&4&&(hI(this.dom),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0):(this.setDOM(document.createElement("div")),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0),this.prevAttrs!==void 0&&(dS(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(e,n);let s=this.dom.lastChild;for(;s&&Bn.get(s)instanceof mo;)s=s.lastChild;if(!s||!this.length||s.nodeName!="BR"&&((r=Bn.get(s))===null||r===void 0?void 0:r.isEditable)==!1&&(!Ye.ios||!this.children.some(i=>i instanceof Ca))){let i=document.createElement("BR");i.cmIgnore=!0,this.dom.appendChild(i)}}measureTextSize(){if(this.children.length==0||this.length>20)return null;let e=0,n;for(let r of this.children){if(!(r instanceof Ca)||/[^ -~]/.test(r.text))return null;let s=yh(r.dom);if(s.length!=1)return null;e+=s[0].width,n=s[0].height}return e?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:e/this.length,textHeight:n}:null}coordsAt(e,n){let r=wI(this,e,n);if(!this.children.length&&r&&this.parent){let{heightOracle:s}=this.parent.view.viewState,i=r.bottom-r.top;if(Math.abs(i-s.lineHeight)<2&&s.textHeight=n){if(i instanceof Dr)return i;if(a>n)break}s=a+i.breakAfter}return null}}class ao extends Bn{constructor(e,n,r){super(),this.widget=e,this.length=n,this.deco=r,this.breakAfter=0,this.prevWidget=null}merge(e,n,r,s,i,a){return r&&(!(r instanceof ao)||!this.widget.compare(r.widget)||e>0&&i<=0||n0}}class hS extends ml{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}class Em{constructor(e,n,r,s){this.doc=e,this.pos=n,this.end=r,this.disallowBlockEffectsFor=s,this.content=[],this.curLine=null,this.breakAtStart=0,this.pendingBuffer=0,this.bufferMarks=[],this.atCursorPos=!0,this.openStart=-1,this.openEnd=-1,this.text="",this.textOff=0,this.cursor=e.iter(),this.skip=n}posCovered(){if(this.content.length==0)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;let e=this.content[this.content.length-1];return!(e.breakAfter||e instanceof ao&&e.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new Dr),this.atCursorPos=!0),this.curLine}flushBuffer(e=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(Kg(new bh(-1),e),e.length),this.pendingBuffer=0)}addBlockWidget(e){this.flushBuffer(),this.curLine=null,this.content.push(e)}finish(e){this.pendingBuffer&&e<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,!this.posCovered()&&!(e&&this.content.length&&this.content[this.content.length-1]instanceof ao)&&this.getLine()}buildText(e,n,r){for(;e>0;){if(this.textOff==this.text.length){let{value:a,lineBreak:o,done:c}=this.cursor.next(this.skip);if(this.skip=0,c)throw new Error("Ran out of text content when drawing inline views");if(o){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.flushBuffer(),this.curLine=null,this.atCursorPos=!0,e--;continue}else this.text=a,this.textOff=0}let s=Math.min(this.text.length-this.textOff,e),i=Math.min(s,512);this.flushBuffer(n.slice(n.length-r)),this.getLine().append(Kg(new Ca(this.text.slice(this.textOff,this.textOff+i)),n),r),this.atCursorPos=!0,this.textOff+=i,e-=i,r=s<=i?0:n.length}}span(e,n,r,s){this.buildText(n-e,r,s),this.pos=n,this.openStart<0&&(this.openStart=s)}point(e,n,r,s,i,a){if(this.disallowBlockEffectsFor[a]&&r instanceof bc){if(r.block)throw new RangeError("Block decorations may not be specified via plugins");if(n>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let o=n-e;if(r instanceof bc)if(r.block)r.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new ao(r.widget||wh.block,o,r));else{let c=eo.create(r.widget||wh.inline,o,o?0:r.startSide),h=this.atCursorPos&&!c.isEditable&&i<=s.length&&(e0),f=!c.isEditable&&(es.length||r.startSide<=0),m=this.getLine();this.pendingBuffer==2&&!h&&!c.isEditable&&(this.pendingBuffer=0),this.flushBuffer(s),h&&(m.append(Kg(new bh(1),s),i),i=s.length+Math.max(0,i-s.length)),m.append(Kg(c,s),i),this.atCursorPos=f,this.pendingBuffer=f?es.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=s.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(r);o&&(this.textOff+o<=this.text.length?this.textOff+=o:(this.skip+=o-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=n),this.openStart<0&&(this.openStart=i)}static build(e,n,r,s,i){let a=new Em(e,n,r,i);return a.openEnd=bn.spans(s,n,r,a),a.openStart<0&&(a.openStart=a.openEnd),a.finish(a.openEnd),a}}function Kg(t,e){for(let n of e)t=new mo(n,[t],t.length);return t}class wh extends ml{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}wh.inline=new wh("span");wh.block=new wh("div");var Jn=(function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t})(Jn||(Jn={}));const Mu=Jn.LTR,j6=Jn.RTL;function kI(t){let e=[];for(let n=0;n=n){if(o.level==r)return a;(i<0||(s!=0?s<0?o.fromn:e[i].level>o.level))&&(i=a)}}if(i<0)throw new RangeError("Index out of range");return i}}function jI(t,e){if(t.length!=e.length)return!1;for(let n=0;n=0;w-=3)if($a[w+1]==-x){let S=$a[w+2],k=S&2?s:S&4?S&1?i:s:0;k&&(Qn[m]=Qn[$a[w]]=k),o=w;break}}else{if($a.length==189)break;$a[o++]=m,$a[o++]=g,$a[o++]=c}else if((y=Qn[m])==2||y==1){let w=y==s;c=w?0:1;for(let S=o-3;S>=0;S-=3){let k=$a[S+2];if(k&2)break;if(w)$a[S+2]|=2;else{if(k&4)break;$a[S+2]|=4}}}}}function Yre(t,e,n,r){for(let s=0,i=r;s<=n.length;s++){let a=s?n[s-1].to:t,o=sc;)y==S&&(y=n[--w].from,S=w?n[w-1].to:t),Qn[--y]=x;c=f}else i=h,c++}}}function mS(t,e,n,r,s,i,a){let o=r%2?2:1;if(r%2==s%2)for(let c=e,h=0;cc&&a.push(new hc(c,w.from,x));let S=w.direction==Mu!=!(x%2);pS(t,S?r+1:r,s,w.inner,w.from,w.to,a),c=w.to}y=w.to}else{if(y==n||(f?Qn[y]!=o:Qn[y]==o))break;y++}g?mS(t,c,y,r+1,s,g,a):ce;){let f=!0,m=!1;if(!h||c>i[h-1].to){let w=Qn[c-1];w!=o&&(f=!1,m=w==16)}let g=!f&&o==1?[]:null,x=f?r:r+1,y=c;e:for(;;)if(h&&y==i[h-1].to){if(m)break e;let w=i[--h];if(!f)for(let S=w.from,k=h;;){if(S==e)break e;if(k&&i[k-1].to==S)S=i[--k].from;else{if(Qn[S-1]==o)break e;break}}if(g)g.push(w);else{w.toQn.length;)Qn[Qn.length]=256;let r=[],s=e==Mu?0:1;return pS(t,s,s,n,0,t.length,r),r}function NI(t){return[new hc(0,t,0)]}let CI="";function Zre(t,e,n,r,s){var i;let a=r.head-t.from,o=hc.find(e,a,(i=r.bidiLevel)!==null&&i!==void 0?i:-1,r.assoc),c=e[o],h=c.side(s,n);if(a==h){let g=o+=s?1:-1;if(g<0||g>=e.length)return null;c=e[o=g],a=c.side(!s,n),h=c.side(s,n)}let f=ms(t.text,a,c.forward(s,n));(fc.to)&&(f=h),CI=t.text.slice(Math.min(a,f),Math.max(a,f));let m=o==(s?e.length-1:0)?null:e[o+(s?1:-1)];return m&&f==h&&m.level+(s?0:1)t.some(e=>e)}),zI=et.define({combine:t=>t.some(e=>e)}),PI=et.define();class nh{constructor(e,n="nearest",r="nearest",s=5,i=5,a=!1){this.range=e,this.y=n,this.x=r,this.yMargin=s,this.xMargin=i,this.isSnapshot=a}map(e){return e.empty?this:new nh(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new nh(Ae.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const Zg=Mt.define({map:(t,e)=>t.map(e)}),LI=Mt.define();function Js(t,e,n){let r=t.facet(MI);r.length?r[0](e):window.onerror&&window.onerror(String(e),n,void 0,void 0,e)||(n?console.error(n+":",e):console.error(e))}const Jl=et.define({combine:t=>t.length?t[0]:!0});let ese=0;const Ud=et.define({combine(t){return t.filter((e,n)=>{for(let r=0;r{let c=[];return a&&c.push(Xm.of(h=>{let f=h.plugin(o);return f?a(f):ft.none})),i&&c.push(i(o)),c})}static fromClass(e,n){return Nr.define((r,s)=>new e(r,s),n)}}class mw{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(e){if(this.value){if(this.mustUpdate){let n=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(n)}catch(r){if(Js(n.state,r,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(n){Js(e.state,n,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var n;if(!((n=this.value)===null||n===void 0)&&n.destroy)try{this.value.destroy()}catch(r){Js(e.state,r,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const II=et.define(),T6=et.define(),Xm=et.define(),BI=et.define(),W0=et.define(),qI=et.define();function $9(t,e){let n=t.state.facet(qI);if(!n.length)return n;let r=n.map(i=>i instanceof Function?i(t):i),s=[];return bn.spans(r,e.from,e.to,{point(){},span(i,a,o,c){let h=i-e.from,f=a-e.from,m=s;for(let g=o.length-1;g>=0;g--,c--){let x=o[g].spec.bidiIsolate,y;if(x==null&&(x=Jre(e.text,h,f)),c>0&&m.length&&(y=m[m.length-1]).to==h&&y.direction==x)y.to=f,m=y.inner;else{let w={from:h,to:f,direction:x,inner:[]};m.push(w),m=w.inner}}}}),s}const FI=et.define();function E6(t){let e=0,n=0,r=0,s=0;for(let i of t.state.facet(FI)){let a=i(t);a&&(a.left!=null&&(e=Math.max(e,a.left)),a.right!=null&&(n=Math.max(n,a.right)),a.top!=null&&(r=Math.max(r,a.top)),a.bottom!=null&&(s=Math.max(s,a.bottom)))}return{left:e,right:n,top:r,bottom:s}}const mm=et.define();class ra{constructor(e,n,r,s){this.fromA=e,this.toA=n,this.fromB=r,this.toB=s}join(e){return new ra(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let n=e.length,r=this;for(;n>0;n--){let s=e[n-1];if(!(s.fromA>r.toA)){if(s.toAf)break;i+=2}if(!c)return r;new ra(c.fromA,c.toA,c.fromB,c.toB).addToSet(r),a=c.toA,o=c.toB}}}class P1{constructor(e,n,r){this.view=e,this.state=n,this.transactions=r,this.flags=0,this.startState=e.state,this.changes=Hr.empty(this.startState.doc.length);for(let i of r)this.changes=this.changes.compose(i.changes);let s=[];this.changes.iterChangedRanges((i,a,o,c)=>s.push(new ra(i,a,o,c))),this.changedRanges=s}static create(e,n,r){return new P1(e,n,r)}get viewportChanged(){return(this.flags&4)>0}get viewportMoved(){return(this.flags&8)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&18)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}class Q9 extends Bn{get length(){return this.view.state.doc.length}constructor(e){super(),this.view=e,this.decorations=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.markedForComposition=new Set,this.editContextFormatting=ft.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(e.contentDOM),this.children=[new Dr],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new ra(0,0,0,e.state.doc.length)],0,null)}update(e){var n;let r=e.changedRanges;this.minWidth>0&&r.length&&(r.every(({fromA:h,toA:f})=>fthis.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let s=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((n=this.domChanged)===null||n===void 0)&&n.newSel?s=this.domChanged.newSel.head:!lse(e.changes,this.hasComposition)&&!e.selectionSet&&(s=e.state.selection.main.head));let i=s>-1?nse(this.view,e.changes,s):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:h,to:f}=this.hasComposition;r=new ra(h,f,e.changes.mapPos(h,-1),e.changes.mapPos(f,1)).addToSet(r.slice())}this.hasComposition=i?{from:i.range.fromB,to:i.range.toB}:null,(Ye.ie||Ye.chrome)&&!i&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let a=this.decorations,o=this.updateDeco(),c=ise(a,o,e.changes);return r=ra.extendWithRanges(r,c),!(this.flags&7)&&r.length==0?!1:(this.updateInner(r,e.startState.doc.length,i),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,n,r){this.view.viewState.mustMeasureContent=!0,this.updateChildren(e,n,r);let{observer:s}=this.view;s.ignore(()=>{this.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let a=Ye.chrome||Ye.ios?{node:s.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,a),this.flags&=-8,a&&(a.written||s.selectionRange.focusNode!=a.node)&&(this.forceSelection=!0),this.dom.style.height=""}),this.markedForComposition.forEach(a=>a.flags&=-9);let i=[];if(this.view.viewport.from||this.view.viewport.to=0?s[a]:null;if(!o)break;let{fromA:c,toA:h,fromB:f,toB:m}=o,g,x,y,w;if(r&&r.range.fromBf){let T=Em.build(this.view.state.doc,f,r.range.fromB,this.decorations,this.dynamicDecorationMap),_=Em.build(this.view.state.doc,r.range.toB,m,this.decorations,this.dynamicDecorationMap);x=T.breakAtStart,y=T.openStart,w=_.openEnd;let E=this.compositionView(r);_.breakAtStart?E.breakAfter=1:_.content.length&&E.merge(E.length,E.length,_.content[0],!1,_.openStart,0)&&(E.breakAfter=_.content[0].breakAfter,_.content.shift()),T.content.length&&E.merge(0,0,T.content[T.content.length-1],!0,0,T.openEnd)&&T.content.pop(),g=T.content.concat(E).concat(_.content)}else({content:g,breakAtStart:x,openStart:y,openEnd:w}=Em.build(this.view.state.doc,f,m,this.decorations,this.dynamicDecorationMap));let{i:S,off:k}=i.findPos(h,1),{i:N,off:C}=i.findPos(c,-1);xI(this,N,C,S,k,g,x,y,w)}r&&this.fixCompositionDOM(r)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let n of e.transactions)for(let r of n.effects)r.is(LI)&&(this.editContextFormatting=r.value)}compositionView(e){let n=new Ca(e.text.nodeValue);n.flags|=8;for(let{deco:s}of e.marks)n=new mo(s,[n],n.length);let r=new Dr;return r.append(n,0),r}fixCompositionDOM(e){let n=(i,a)=>{a.flags|=8|(a.children.some(c=>c.flags&7)?1:0),this.markedForComposition.add(a);let o=Bn.get(i);o&&o!=a&&(o.dom=null),a.setDOM(i)},r=this.childPos(e.range.fromB,1),s=this.children[r.i];n(e.line,s);for(let i=e.marks.length-1;i>=-1;i--)r=s.childPos(r.off,1),s=s.children[r.i],n(i>=0?e.marks[i].node:e.text,s)}updateSelection(e=!1,n=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let r=this.view.root.activeElement,s=r==this.dom,i=!s&&!(this.view.state.facet(Jl)||this.dom.tabIndex>-1)&&r1(this.dom,this.view.observer.selectionRange)&&!(r&&this.dom.contains(r));if(!(s||n||i))return;let a=this.forceSelection;this.forceSelection=!1;let o=this.view.state.selection.main,c=this.moveToLine(this.domAtPos(o.anchor)),h=o.empty?c:this.moveToLine(this.domAtPos(o.head));if(Ye.gecko&&o.empty&&!this.hasComposition&&tse(c)){let m=document.createTextNode("");this.view.observer.ignore(()=>c.node.insertBefore(m,c.node.childNodes[c.offset]||null)),c=h=new Ss(m,0),a=!0}let f=this.view.observer.selectionRange;(a||!f.focusNode||(!Tm(c.node,c.offset,f.anchorNode,f.anchorOffset)||!Tm(h.node,h.offset,f.focusNode,f.focusOffset))&&!this.suppressWidgetCursorChange(f,o))&&(this.view.observer.ignore(()=>{Ye.android&&Ye.chrome&&this.dom.contains(f.focusNode)&&ase(f.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let m=Gm(this.view.root);if(m)if(o.empty){if(Ye.gecko){let g=rse(c.node,c.offset);if(g&&g!=3){let x=(g==1?mI:pI)(c.node,c.offset);x&&(c=new Ss(x.node,x.offset))}}m.collapse(c.node,c.offset),o.bidiLevel!=null&&m.caretBidiLevel!==void 0&&(m.caretBidiLevel=o.bidiLevel)}else if(m.extend){m.collapse(c.node,c.offset);try{m.extend(h.node,h.offset)}catch{}}else{let g=document.createRange();o.anchor>o.head&&([c,h]=[h,c]),g.setEnd(h.node,h.offset),g.setStart(c.node,c.offset),m.removeAllRanges(),m.addRange(g)}i&&this.view.root.activeElement==this.dom&&(this.dom.blur(),r&&r.focus())}),this.view.observer.setSelectionRange(c,h)),this.impreciseAnchor=c.precise?null:new Ss(f.anchorNode,f.anchorOffset),this.impreciseHead=h.precise?null:new Ss(f.focusNode,f.focusOffset)}suppressWidgetCursorChange(e,n){return this.hasComposition&&n.empty&&Tm(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==n.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,n=e.state.selection.main,r=Gm(e.root),{anchorNode:s,anchorOffset:i}=e.observer.selectionRange;if(!r||!n.empty||!n.assoc||!r.modify)return;let a=Dr.find(this,n.head);if(!a)return;let o=a.posAtStart;if(n.head==o||n.head==o+a.length)return;let c=this.coordsAt(n.head,-1),h=this.coordsAt(n.head,1);if(!c||!h||c.bottom>h.top)return;let f=this.domAtPos(n.head+n.assoc);r.collapse(f.node,f.offset),r.modify("move",n.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let m=e.observer.selectionRange;e.docView.posFromDOM(m.anchorNode,m.anchorOffset)!=n.from&&r.collapse(s,i)}moveToLine(e){let n=this.dom,r;if(e.node!=n)return e;for(let s=e.offset;!r&&s=0;s--){let i=Bn.get(n.childNodes[s]);i instanceof Dr&&(r=i.domAtPos(i.length))}return r?new Ss(r.node,r.offset,!0):e}nearest(e){for(let n=e;n;){let r=Bn.get(n);if(r&&r.rootView==this)return r;n=n.parentNode}return null}posFromDOM(e,n){let r=this.nearest(e);if(!r)throw new RangeError("Trying to find position for a DOM position outside of the document");return r.localPosFromDOM(e,n)+r.posAtStart}domAtPos(e){let{i:n,off:r}=this.childCursor().findPos(e,-1);for(;n=0;a--){let o=this.children[a],c=i-o.breakAfter,h=c-o.length;if(ce||o.covers(1))&&(!r||o instanceof Dr&&!(r instanceof Dr&&n>=0)))r=o,s=h;else if(r&&h==e&&c==e&&o instanceof ao&&Math.abs(n)<2){if(o.deco.startSide<0)break;a&&(r=null)}i=h}return r?r.coordsAt(e-s,n):null}coordsForChar(e){let{i:n,off:r}=this.childPos(e,1),s=this.children[n];if(!(s instanceof Dr))return null;for(;s.children.length;){let{i:o,off:c}=s.childPos(r,1);for(;;o++){if(o==s.children.length)return null;if((s=s.children[o]).length)break}r=c}if(!(s instanceof Ca))return null;let i=ms(s.text,r);if(i==r)return null;let a=_u(s.dom,r,i).getClientRects();for(let o=0;oMath.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,o=-1,c=this.view.textDirection==Jn.LTR;for(let h=0,f=0;fs)break;if(h>=r){let x=m.dom.getBoundingClientRect();if(n.push(x.height),a){let y=m.dom.lastChild,w=y?yh(y):[];if(w.length){let S=w[w.length-1],k=c?S.right-x.left:x.right-S.left;k>o&&(o=k,this.minWidth=i,this.minWidthFrom=h,this.minWidthTo=g)}}}h=g+m.breakAfter}return n}textDirectionAt(e){let{i:n}=this.childPos(e,1);return getComputedStyle(this.children[n].dom).direction=="rtl"?Jn.RTL:Jn.LTR}measureTextSize(){for(let i of this.children)if(i instanceof Dr){let a=i.measureTextSize();if(a)return a}let e=document.createElement("div"),n,r,s;return e.className="cm-line",e.style.width="99999px",e.style.position="absolute",e.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.dom.appendChild(e);let i=yh(e.firstChild)[0];n=e.getBoundingClientRect().height,r=i?i.width/27:7,s=i?i.height:n,e.remove()}),{lineHeight:n,charWidth:r,textHeight:s}}childCursor(e=this.length){let n=this.children.length;return n&&(e-=this.children[--n].length),new gI(this.children,e,n)}computeBlockGapDeco(){let e=[],n=this.view.viewState;for(let r=0,s=0;;s++){let i=s==n.viewports.length?null:n.viewports[s],a=i?i.from-1:this.length;if(a>r){let o=(n.lineBlockAt(a).bottom-n.lineBlockAt(r).top)/this.view.scaleY;e.push(ft.replace({widget:new hS(o),block:!0,inclusive:!0,isBlockGap:!0}).range(r,a))}if(!i)break;r=i.to+1}return ft.set(e)}updateDeco(){let e=1,n=this.view.state.facet(Xm).map(i=>(this.dynamicDecorationMap[e++]=typeof i=="function")?i(this.view):i),r=!1,s=this.view.state.facet(BI).map((i,a)=>{let o=typeof i=="function";return o&&(r=!0),o?i(this.view):i});for(s.length&&(this.dynamicDecorationMap[e++]=r,n.push(bn.join(s))),this.decorations=[this.editContextFormatting,...n,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];en.anchor?-1:1),s;if(!r)return;!n.empty&&(s=this.coordsAt(n.anchor,n.anchor>n.head?-1:1))&&(r={left:Math.min(r.left,s.left),top:Math.min(r.top,s.top),right:Math.max(r.right,s.right),bottom:Math.max(r.bottom,s.bottom)});let i=E6(this.view),a={left:r.left-i.left,top:r.top-i.top,right:r.right+i.right,bottom:r.bottom+i.bottom},{offsetWidth:o,offsetHeight:c}=this.view.scrollDOM;Dre(this.view.scrollDOM,a,n.heads instanceof eo||s.children.some(r);return r(this.children[n])}}function tse(t){return t.node.nodeType==1&&t.node.firstChild&&(t.offset==0||t.node.childNodes[t.offset-1].contentEditable=="false")&&(t.offset==t.node.childNodes.length||t.node.childNodes[t.offset].contentEditable=="false")}function $I(t,e){let n=t.observer.selectionRange;if(!n.focusNode)return null;let r=mI(n.focusNode,n.focusOffset),s=pI(n.focusNode,n.focusOffset),i=r||s;if(s&&r&&s.node!=r.node){let o=Bn.get(s.node);if(!o||o instanceof Ca&&o.text!=s.node.nodeValue)i=s;else if(t.docView.lastCompositionAfterCursor){let c=Bn.get(r.node);!c||c instanceof Ca&&c.text!=r.node.nodeValue||(i=s)}}if(t.docView.lastCompositionAfterCursor=i!=r,!i)return null;let a=e-i.offset;return{from:a,to:a+i.node.nodeValue.length,node:i.node}}function nse(t,e,n){let r=$I(t,n);if(!r)return null;let{node:s,from:i,to:a}=r,o=s.nodeValue;if(/[\n\r]/.test(o)||t.state.doc.sliceString(r.from,r.to)!=o)return null;let c=e.invertedDesc,h=new ra(c.mapPos(i),c.mapPos(a),i,a),f=[];for(let m=s.parentNode;;m=m.parentNode){let g=Bn.get(m);if(g instanceof mo)f.push({node:m,deco:g.mark});else{if(g instanceof Dr||m.nodeName=="DIV"&&m.parentNode==t.contentDOM)return{range:h,text:s,marks:f,line:m};if(m!=t.contentDOM)f.push({node:m,deco:new V0({inclusive:!0,attributes:Qre(m),tagName:m.tagName.toLowerCase()})});else return null}}}function rse(t,e){return t.nodeType!=1?0:(e&&t.childNodes[e-1].contentEditable=="false"?1:0)|(e{re.from&&(n=!0)}),n}function ose(t,e,n=1){let r=t.charCategorizer(e),s=t.doc.lineAt(e),i=e-s.from;if(s.length==0)return Ae.cursor(e);i==0?n=1:i==s.length&&(n=-1);let a=i,o=i;n<0?a=ms(s.text,i,!1):o=ms(s.text,i);let c=r(s.text.slice(a,o));for(;a>0;){let h=ms(s.text,a,!1);if(r(s.text.slice(h,a))!=c)break;a=h}for(;ot?e.left-t:Math.max(0,t-e.right)}function use(t,e){return e.top>t?e.top-t:Math.max(0,t-e.bottom)}function pw(t,e){return t.tope.top+1}function H9(t,e){return et.bottom?{top:t.top,left:t.left,right:t.right,bottom:e}:t}function xS(t,e,n){let r,s,i,a,o=!1,c,h,f,m;for(let y=t.firstChild;y;y=y.nextSibling){let w=yh(y);for(let S=0;SC||a==C&&i>N)&&(r=y,s=k,i=N,a=C,o=N?e0:Sk.bottom&&(!f||f.bottomk.top)&&(h=y,m=k):f&&pw(f,k)?f=V9(f,k.bottom):m&&pw(m,k)&&(m=H9(m,k.top))}}if(f&&f.bottom>=n?(r=c,s=f):m&&m.top<=n&&(r=h,s=m),!r)return{node:t,offset:0};let g=Math.max(s.left,Math.min(s.right,e));if(r.nodeType==3)return U9(r,g,n);if(o&&r.contentEditable!="false")return xS(r,g,n);let x=Array.prototype.indexOf.call(t.childNodes,r)+(e>=(s.left+s.right)/2?1:0);return{node:t,offset:x}}function U9(t,e,n){let r=t.nodeValue.length,s=-1,i=1e9,a=0;for(let o=0;on?f.top-n:n-f.bottom)-1;if(f.left-1<=e&&f.right+1>=e&&m=(f.left+f.right)/2,x=g;if(Ye.chrome||Ye.gecko){let y=_u(t,o).getBoundingClientRect();Math.abs(y.left-f.right)<.1&&(x=!g)}if(m<=0)return{node:t,offset:o+(x?1:0)};s=o+(x?1:0),i=m}}}return{node:t,offset:s>-1?s:a>0?t.nodeValue.length:0}}function QI(t,e,n,r=-1){var s,i;let a=t.contentDOM.getBoundingClientRect(),o=a.top+t.viewState.paddingTop,c,{docHeight:h}=t.viewState,{x:f,y:m}=e,g=m-o;if(g<0)return 0;if(g>h)return t.state.doc.length;for(let T=t.viewState.heightOracle.textHeight/2,_=!1;c=t.elementAtHeight(g),c.type!=Rs.Text;)for(;g=r>0?c.bottom+T:c.top-T,!(g>=0&&g<=h);){if(_)return n?null:0;_=!0,r=-r}m=o+g;let x=c.from;if(xt.viewport.to)return t.viewport.to==t.state.doc.length?t.state.doc.length:n?null:W9(t,a,c,f,m);let y=t.dom.ownerDocument,w=t.root.elementFromPoint?t.root:y,S=w.elementFromPoint(f,m);S&&!t.contentDOM.contains(S)&&(S=null),S||(f=Math.max(a.left+1,Math.min(a.right-1,f)),S=w.elementFromPoint(f,m),S&&!t.contentDOM.contains(S)&&(S=null));let k,N=-1;if(S&&((s=t.docView.nearest(S))===null||s===void 0?void 0:s.isEditable)!=!1){if(y.caretPositionFromPoint){let T=y.caretPositionFromPoint(f,m);T&&({offsetNode:k,offset:N}=T)}else if(y.caretRangeFromPoint){let T=y.caretRangeFromPoint(f,m);T&&({startContainer:k,startOffset:N}=T)}k&&(!t.contentDOM.contains(k)||Ye.safari&&dse(k,N,f)||Ye.chrome&&hse(k,N,f))&&(k=void 0),k&&(N=Math.min(cl(k),N))}if(!k||!t.docView.dom.contains(k)){let T=Dr.find(t.docView,x);if(!T)return g>c.top+c.height/2?c.to:c.from;({node:k,offset:N}=xS(T.dom,f,m))}let C=t.docView.nearest(k);if(!C)return null;if(C.isWidget&&((i=C.dom)===null||i===void 0?void 0:i.nodeType)==1){let T=C.dom.getBoundingClientRect();return e.yt.defaultLineHeight*1.5){let o=t.viewState.heightOracle.textHeight,c=Math.floor((s-n.top-(t.defaultLineHeight-o)*.5)/o);i+=c*t.viewState.heightOracle.lineLength}let a=t.state.sliceDoc(n.from,n.to);return n.from+nS(a,i,t.state.tabSize)}function HI(t,e,n){let r,s=t;if(t.nodeType!=3||e!=(r=t.nodeValue.length))return!1;for(;;){let i=s.nextSibling;if(i){if(i.nodeName=="BR")break;return!1}else{let a=s.parentNode;if(!a||a.nodeName=="DIV")break;s=a}}return _u(t,r-1,r).getBoundingClientRect().right>n}function dse(t,e,n){return HI(t,e,n)}function hse(t,e,n){if(e!=0)return HI(t,e,n);for(let s=t;;){let i=s.parentNode;if(!i||i.nodeType!=1||i.firstChild!=s)return!1;if(i.classList.contains("cm-line"))break;s=i}let r=t.nodeType==1?t.getBoundingClientRect():_u(t,0,Math.max(t.nodeValue.length,1)).getBoundingClientRect();return n-r.left>5}function vS(t,e,n){let r=t.lineBlockAt(e);if(Array.isArray(r.type)){let s;for(let i of r.type){if(i.from>e)break;if(!(i.toe)return i;(!s||i.type==Rs.Text&&(s.type!=i.type||(n<0?i.frome)))&&(s=i)}}return s||r}return r}function fse(t,e,n,r){let s=vS(t,e.head,e.assoc||-1),i=!r||s.type!=Rs.Text||!(t.lineWrapping||s.widgetLineBreaks)?null:t.coordsAtPos(e.assoc<0&&e.head>s.from?e.head-1:e.head);if(i){let a=t.dom.getBoundingClientRect(),o=t.textDirectionAt(s.from),c=t.posAtCoords({x:n==(o==Jn.LTR)?a.right-1:a.left+1,y:(i.top+i.bottom)/2});if(c!=null)return Ae.cursor(c,n?-1:1)}return Ae.cursor(n?s.to:s.from,n?-1:1)}function G9(t,e,n,r){let s=t.state.doc.lineAt(e.head),i=t.bidiSpans(s),a=t.textDirectionAt(s.from);for(let o=e,c=null;;){let h=Zre(s,i,a,o,n),f=CI;if(!h){if(s.number==(n?t.state.doc.lines:1))return o;f=` -`,s=t.state.doc.line(s.number+(n?1:-1)),i=t.bidiSpans(s),h=t.visualLineSide(s,!n)}if(c){if(!c(f))return o}else{if(!r)return h;c=r(f)}o=h}}function mse(t,e,n){let r=t.state.charCategorizer(e),s=r(n);return i=>{let a=r(i);return s==nr.Space&&(s=a),s==a}}function pse(t,e,n,r){let s=e.head,i=n?1:-1;if(s==(n?t.state.doc.length:0))return Ae.cursor(s,e.assoc);let a=e.goalColumn,o,c=t.contentDOM.getBoundingClientRect(),h=t.coordsAtPos(s,e.assoc||-1),f=t.documentTop;if(h)a==null&&(a=h.left-c.left),o=i<0?h.top:h.bottom;else{let x=t.viewState.lineBlockAt(s);a==null&&(a=Math.min(c.right-c.left,t.defaultCharacterWidth*(s-x.from))),o=(i<0?x.top:x.bottom)+f}let m=c.left+a,g=r??t.viewState.heightOracle.textHeight>>1;for(let x=0;;x+=10){let y=o+(g+x)*i,w=QI(t,{x:m,y},!1,i);if(yc.bottom||(i<0?ws)){let S=t.docView.coordsForChar(w),k=!S||y{if(e>i&&es(t)),n.from,e.head>n.from?-1:1);return r==n.from?n:Ae.cursor(r,ri)&&!vse(a,n)&&this.lineBreak(),s=a}return this.findPointBefore(r,n),this}readTextNode(e){let n=e.nodeValue;for(let r of this.points)r.node==e&&(r.pos=this.text.length+Math.min(r.offset,n.length));for(let r=0,s=this.lineSeparator?null:/\r\n?|\n/g;;){let i=-1,a=1,o;if(this.lineSeparator?(i=n.indexOf(this.lineSeparator,r),a=this.lineSeparator.length):(o=s.exec(n))&&(i=o.index,a=o[0].length),this.append(n.slice(r,i<0?n.length:i)),i<0)break;if(this.lineBreak(),a>1)for(let c of this.points)c.node==e&&c.pos>this.text.length&&(c.pos-=a-1);r=i+a}}readNode(e){if(e.cmIgnore)return;let n=Bn.get(e),r=n&&n.overrideDOMText;if(r!=null){this.findPointInside(e,r.length);for(let s=r.iter();!s.next().done;)s.lineBreak?this.lineBreak():this.append(s.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,n){for(let r of this.points)r.node==e&&e.childNodes[r.offset]==n&&(r.pos=this.text.length)}findPointInside(e,n){for(let r of this.points)(e.nodeType==3?r.node==e:e.contains(r.node))&&(r.pos=this.text.length+(xse(e,r.node,r.offset)?n:0))}}function xse(t,e,n){for(;;){if(!e||n-1;let{impreciseHead:i,impreciseAnchor:a}=e.docView;if(e.state.readOnly&&n>-1)this.newSel=null;else if(n>-1&&(this.bounds=e.docView.domBoundsAround(n,r,0))){let o=i||a?[]:wse(e),c=new gse(o,e.state);c.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=c.text,this.newSel=Sse(o,this.bounds.from)}else{let o=e.observer.selectionRange,c=i&&i.node==o.focusNode&&i.offset==o.focusOffset||!cS(e.contentDOM,o.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(o.focusNode,o.focusOffset),h=a&&a.node==o.anchorNode&&a.offset==o.anchorOffset||!cS(e.contentDOM,o.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(o.anchorNode,o.anchorOffset),f=e.viewport;if((Ye.ios||Ye.chrome)&&e.state.selection.main.empty&&c!=h&&(f.from>0||f.to-1&&e.state.selection.ranges.length>1?this.newSel=e.state.selection.replaceRange(Ae.range(h,c)):this.newSel=Ae.single(h,c)}}}function UI(t,e){let n,{newSel:r}=e,s=t.state.selection.main,i=t.inputState.lastKeyTime>Date.now()-100?t.inputState.lastKeyCode:-1;if(e.bounds){let{from:a,to:o}=e.bounds,c=s.from,h=null;(i===8||Ye.android&&e.text.length=s.from&&n.to<=s.to&&(n.from!=s.from||n.to!=s.to)&&s.to-s.from-(n.to-n.from)<=4?n={from:s.from,to:s.to,insert:t.state.doc.slice(s.from,n.from).append(n.insert).append(t.state.doc.slice(n.to,s.to))}:t.state.doc.lineAt(s.from).toDate.now()-50?n={from:s.from,to:s.to,insert:t.state.toText(t.inputState.insertingText)}:Ye.chrome&&n&&n.from==n.to&&n.from==s.head&&n.insert.toString()==` - `&&t.lineWrapping&&(r&&(r=Ae.single(r.main.anchor-1,r.main.head-1)),n={from:s.from,to:s.to,insert:cn.of([" "])}),n)return _6(t,n,r,i);if(r&&!r.main.eq(s)){let a=!1,o="select";return t.inputState.lastSelectionTime>Date.now()-50&&(t.inputState.lastSelectionOrigin=="select"&&(a=!0),o=t.inputState.lastSelectionOrigin,o=="select.pointer"&&(r=VI(t.state.facet(W0).map(c=>c(t)),r))),t.dispatch({selection:r,scrollIntoView:a,userEvent:o}),!0}else return!1}function _6(t,e,n,r=-1){if(Ye.ios&&t.inputState.flushIOSKey(e))return!0;let s=t.state.selection.main;if(Ye.android&&(e.to==s.to&&(e.from==s.from||e.from==s.from-1&&t.state.sliceDoc(e.from,s.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&th(t.contentDOM,"Enter",13)||(e.from==s.from-1&&e.to==s.to&&e.insert.length==0||r==8&&e.insert.lengths.head)&&th(t.contentDOM,"Backspace",8)||e.from==s.from&&e.to==s.to+1&&e.insert.length==0&&th(t.contentDOM,"Delete",46)))return!0;let i=e.insert.toString();t.inputState.composing>=0&&t.inputState.composing++;let a,o=()=>a||(a=bse(t,e,n));return t.state.facet(AI).some(c=>c(t,e.from,e.to,i,o))||t.dispatch(o()),!0}function bse(t,e,n){let r,s=t.state,i=s.selection.main,a=-1;if(e.from==e.to&&e.fromi.to){let c=e.fromm(t)),h,c);e.from==f&&(a=f)}if(a>-1)r={changes:e,selection:Ae.cursor(e.from+e.insert.length,-1)};else if(e.from>=i.from&&e.to<=i.to&&e.to-e.from>=(i.to-i.from)/3&&(!n||n.main.empty&&n.main.from==e.from+e.insert.length)&&t.inputState.composing<0){let c=i.frome.to?s.sliceDoc(e.to,i.to):"";r=s.replaceSelection(t.state.toText(c+e.insert.sliceString(0,void 0,t.state.lineBreak)+h))}else{let c=s.changes(e),h=n&&n.main.to<=c.newLength?n.main:void 0;if(s.selection.ranges.length>1&&(t.inputState.composing>=0||t.inputState.compositionPendingChange)&&e.to<=i.to+10&&e.to>=i.to-10){let f=t.state.sliceDoc(e.from,e.to),m,g=n&&$I(t,n.main.head);if(g){let y=e.insert.length-(e.to-e.from);m={from:g.from,to:g.to-y}}else m=t.state.doc.lineAt(i.head);let x=i.to-e.to;r=s.changeByRange(y=>{if(y.from==i.from&&y.to==i.to)return{changes:c,range:h||y.map(c)};let w=y.to-x,S=w-f.length;if(t.state.sliceDoc(S,w)!=f||w>=m.from&&S<=m.to)return{range:y};let k=s.changes({from:S,to:w,insert:e.insert}),N=y.to-i.to;return{changes:k,range:h?Ae.range(Math.max(0,h.anchor+N),Math.max(0,h.head+N)):y.map(k)}})}else r={changes:c,selection:h&&s.selection.replaceRange(h)}}let o="input.type";return(t.composing||t.inputState.compositionPendingChange&&t.inputState.compositionEndedAt>Date.now()-50)&&(t.inputState.compositionPendingChange=!1,o+=".compose",t.inputState.compositionFirstChange&&(o+=".start",t.inputState.compositionFirstChange=!1)),s.update(r,{userEvent:o,scrollIntoView:!0})}function WI(t,e,n,r){let s=Math.min(t.length,e.length),i=0;for(;i0&&o>0&&t.charCodeAt(a-1)==e.charCodeAt(o-1);)a--,o--;if(r=="end"){let c=Math.max(0,i-Math.min(a,o));n-=a+c-i}if(a=a?i-n:0;i-=c,o=i+(o-a),a=i}else if(o=o?i-n:0;i-=c,a=i+(a-o),o=i}return{from:i,toA:a,toB:o}}function wse(t){let e=[];if(t.root.activeElement!=t.contentDOM)return e;let{anchorNode:n,anchorOffset:r,focusNode:s,focusOffset:i}=t.observer.selectionRange;return n&&(e.push(new X9(n,r)),(s!=n||i!=r)&&e.push(new X9(s,i))),e}function Sse(t,e){if(t.length==0)return null;let n=t[0].pos,r=t.length==2?t[1].pos:n;return n>-1&&r>-1?Ae.single(n+e,r+e):null}class kse{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,Ye.safari&&e.contentDOM.addEventListener("input",()=>null),Ye.gecko&&Bse(e.contentDOM.ownerDocument)}handleEvent(e){!Mse(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e))}runHandlers(e,n){let r=this.handlers[e];if(r){for(let s of r.observers)s(this.view,n);for(let s of r.handlers){if(n.defaultPrevented)break;if(s(this.view,n)){n.preventDefault();break}}}}ensureHandlers(e){let n=Ose(e),r=this.handlers,s=this.view.contentDOM;for(let i in n)if(i!="scroll"){let a=!n[i].handlers.length,o=r[i];o&&a!=!o.handlers.length&&(s.removeEventListener(i,this.handleEvent),o=null),o||s.addEventListener(i,this.handleEvent,{passive:a})}for(let i in r)i!="scroll"&&!n[i]&&s.removeEventListener(i,this.handleEvent);this.handlers=n}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&XI.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),Ye.android&&Ye.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let n;return Ye.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((n=GI.find(r=>r.keyCode==e.keyCode))&&!e.ctrlKey||jse.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(this.pendingIOSKey=n||e,setTimeout(()=>this.flushIOSKey(),250),!0):(e.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(e){let n=this.pendingIOSKey;return!n||n.key=="Enter"&&e&&e.from0?!0:Ye.safari&&!Ye.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function Y9(t,e){return(n,r)=>{try{return e.call(t,r,n)}catch(s){Js(n.state,s)}}}function Ose(t){let e=Object.create(null);function n(r){return e[r]||(e[r]={observers:[],handlers:[]})}for(let r of t){let s=r.spec,i=s&&s.plugin.domEventHandlers,a=s&&s.plugin.domEventObservers;if(i)for(let o in i){let c=i[o];c&&n(o).handlers.push(Y9(r.value,c))}if(a)for(let o in a){let c=a[o];c&&n(o).observers.push(Y9(r.value,c))}}for(let r in Ta)n(r).handlers.push(Ta[r]);for(let r in la)n(r).observers.push(la[r]);return e}const GI=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],jse="dthko",XI=[16,17,18,20,91,92,224,225],Jg=6;function ex(t){return Math.max(0,t)*.7+8}function Nse(t,e){return Math.max(Math.abs(t.clientX-e.clientX),Math.abs(t.clientY-e.clientY))}class Cse{constructor(e,n,r,s){this.view=e,this.startEvent=n,this.style=r,this.mustSelect=s,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=n,this.scrollParents=zre(e.contentDOM),this.atoms=e.state.facet(W0).map(a=>a(e));let i=e.contentDOM.ownerDocument;i.addEventListener("mousemove",this.move=this.move.bind(this)),i.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=n.shiftKey,this.multiple=e.state.facet(an.allowMultipleSelections)&&Tse(e,n),this.dragging=_se(e,n)&&ZI(n)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&Nse(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let n=0,r=0,s=0,i=0,a=this.view.win.innerWidth,o=this.view.win.innerHeight;this.scrollParents.x&&({left:s,right:a}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:i,bottom:o}=this.scrollParents.y.getBoundingClientRect());let c=E6(this.view);e.clientX-c.left<=s+Jg?n=-ex(s-e.clientX):e.clientX+c.right>=a-Jg&&(n=ex(e.clientX-a)),e.clientY-c.top<=i+Jg?r=-ex(i-e.clientY):e.clientY+c.bottom>=o-Jg&&(r=ex(e.clientY-o)),this.setScrollSpeed(n,r)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,n){this.scrollSpeed={x:e,y:n},e||n?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:n}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),n&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=n,n=0),(e||n)&&this.view.win.scrollBy(e,n),this.dragging===!1&&this.select(this.lastEvent)}select(e){let{view:n}=this,r=VI(this.atoms,this.style.get(e,this.extend,this.multiple));(this.mustSelect||!r.eq(n.state.selection,this.dragging===!1))&&this.view.dispatch({selection:r,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(n=>n.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function Tse(t,e){let n=t.state.facet(TI);return n.length?n[0](e):Ye.mac?e.metaKey:e.ctrlKey}function Ese(t,e){let n=t.state.facet(EI);return n.length?n[0](e):Ye.mac?!e.altKey:!e.ctrlKey}function _se(t,e){let{main:n}=t.state.selection;if(n.empty)return!1;let r=Gm(t.root);if(!r||r.rangeCount==0)return!0;let s=r.getRangeAt(0).getClientRects();for(let i=0;i=e.clientX&&a.top<=e.clientY&&a.bottom>=e.clientY)return!0}return!1}function Mse(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target,r;n!=t.contentDOM;n=n.parentNode)if(!n||n.nodeType==11||(r=Bn.get(n))&&r.ignoreEvent(e))return!1;return!0}const Ta=Object.create(null),la=Object.create(null),YI=Ye.ie&&Ye.ie_version<15||Ye.ios&&Ye.webkit_version<604;function Ase(t){let e=t.dom.parentNode;if(!e)return;let n=e.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus(),setTimeout(()=>{t.focus(),n.remove(),KI(t,n.value)},50)}function Xv(t,e,n){for(let r of t.facet(e))n=r(n,t);return n}function KI(t,e){e=Xv(t.state,N6,e);let{state:n}=t,r,s=1,i=n.toText(e),a=i.lines==n.selection.ranges.length;if(yS!=null&&n.selection.ranges.every(c=>c.empty)&&yS==i.toString()){let c=-1;r=n.changeByRange(h=>{let f=n.doc.lineAt(h.from);if(f.from==c)return{range:h};c=f.from;let m=n.toText((a?i.line(s++).text:e)+n.lineBreak);return{changes:{from:f.from,insert:m},range:Ae.cursor(h.from+m.length)}})}else a?r=n.changeByRange(c=>{let h=i.line(s++);return{changes:{from:c.from,to:c.to,insert:h.text},range:Ae.cursor(c.from+h.length)}}):r=n.replaceSelection(i);t.dispatch(r,{userEvent:"input.paste",scrollIntoView:!0})}la.scroll=t=>{t.inputState.lastScrollTop=t.scrollDOM.scrollTop,t.inputState.lastScrollLeft=t.scrollDOM.scrollLeft};Ta.keydown=(t,e)=>(t.inputState.setSelectionOrigin("select"),e.keyCode==27&&t.inputState.tabFocusMode!=0&&(t.inputState.tabFocusMode=Date.now()+2e3),!1);la.touchstart=(t,e)=>{t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")};la.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")};Ta.mousedown=(t,e)=>{if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return!1;let n=null;for(let r of t.state.facet(_I))if(n=r(t,e),n)break;if(!n&&e.button==0&&(n=zse(t,e)),n){let r=!t.hasFocus;t.inputState.startMouseSelection(new Cse(t,e,n,r)),r&&t.observer.ignore(()=>{dI(t.contentDOM);let i=t.root.activeElement;i&&!i.contains(t.contentDOM)&&i.blur()});let s=t.inputState.mouseSelection;if(s)return s.start(e),s.dragging===!1}else t.inputState.setSelectionOrigin("select.pointer");return!1};function K9(t,e,n,r){if(r==1)return Ae.cursor(e,n);if(r==2)return ose(t.state,e,n);{let s=Dr.find(t.docView,e),i=t.state.doc.lineAt(s?s.posAtEnd:e),a=s?s.posAtStart:i.from,o=s?s.posAtEnd:i.to;return oe>=n.top&&e<=n.bottom&&t>=n.left&&t<=n.right;function Rse(t,e,n,r){let s=Dr.find(t.docView,e);if(!s)return 1;let i=e-s.posAtStart;if(i==0)return 1;if(i==s.length)return-1;let a=s.coordsAt(i,-1);if(a&&Z9(n,r,a))return-1;let o=s.coordsAt(i,1);return o&&Z9(n,r,o)?1:a&&a.bottom>=r?-1:1}function J9(t,e){let n=t.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:n,bias:Rse(t,n,e.clientX,e.clientY)}}const Dse=Ye.ie&&Ye.ie_version<=11;let eT=null,tT=0,nT=0;function ZI(t){if(!Dse)return t.detail;let e=eT,n=nT;return eT=t,nT=Date.now(),tT=!e||n>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(tT+1)%3:1}function zse(t,e){let n=J9(t,e),r=ZI(e),s=t.state.selection;return{update(i){i.docChanged&&(n.pos=i.changes.mapPos(n.pos),s=s.map(i.changes))},get(i,a,o){let c=J9(t,i),h,f=K9(t,c.pos,c.bias,r);if(n.pos!=c.pos&&!a){let m=K9(t,n.pos,n.bias,r),g=Math.min(m.from,f.from),x=Math.max(m.to,f.to);f=g1&&(h=Pse(s,c.pos))?h:o?s.addRange(f):Ae.create([f])}}}function Pse(t,e){for(let n=0;n=e)return Ae.create(t.ranges.slice(0,n).concat(t.ranges.slice(n+1)),t.mainIndex==n?0:t.mainIndex-(t.mainIndex>n?1:0))}return null}Ta.dragstart=(t,e)=>{let{selection:{main:n}}=t.state;if(e.target.draggable){let s=t.docView.nearest(e.target);if(s&&s.isWidget){let i=s.posAtStart,a=i+s.length;(i>=n.to||a<=n.from)&&(n=Ae.range(i,a))}}let{inputState:r}=t;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=n,e.dataTransfer&&(e.dataTransfer.setData("Text",Xv(t.state,C6,t.state.sliceDoc(n.from,n.to))),e.dataTransfer.effectAllowed="copyMove"),!1};Ta.dragend=t=>(t.inputState.draggedContent=null,!1);function rT(t,e,n,r){if(n=Xv(t.state,N6,n),!n)return;let s=t.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:i}=t.inputState,a=r&&i&&Ese(t,e)?{from:i.from,to:i.to}:null,o={from:s,insert:n},c=t.state.changes(a?[a,o]:o);t.focus(),t.dispatch({changes:c,selection:{anchor:c.mapPos(s,-1),head:c.mapPos(s,1)},userEvent:a?"move.drop":"input.drop"}),t.inputState.draggedContent=null}Ta.drop=(t,e)=>{if(!e.dataTransfer)return!1;if(t.state.readOnly)return!0;let n=e.dataTransfer.files;if(n&&n.length){let r=Array(n.length),s=0,i=()=>{++s==n.length&&rT(t,e,r.filter(a=>a!=null).join(t.state.lineBreak),!1)};for(let a=0;a{/[\x00-\x08\x0e-\x1f]{2}/.test(o.result)||(r[a]=o.result),i()},o.readAsText(n[a])}return!0}else{let r=e.dataTransfer.getData("Text");if(r)return rT(t,e,r,!0),!0}return!1};Ta.paste=(t,e)=>{if(t.state.readOnly)return!0;t.observer.flush();let n=YI?null:e.clipboardData;return n?(KI(t,n.getData("text/plain")||n.getData("text/uri-list")),!0):(Ase(t),!1)};function Lse(t,e){let n=t.dom.parentNode;if(!n)return;let r=n.appendChild(document.createElement("textarea"));r.style.cssText="position: fixed; left: -10000px; top: 10px",r.value=e,r.focus(),r.selectionEnd=e.length,r.selectionStart=0,setTimeout(()=>{r.remove(),t.focus()},50)}function Ise(t){let e=[],n=[],r=!1;for(let s of t.selection.ranges)s.empty||(e.push(t.sliceDoc(s.from,s.to)),n.push(s));if(!e.length){let s=-1;for(let{from:i}of t.selection.ranges){let a=t.doc.lineAt(i);a.number>s&&(e.push(a.text),n.push({from:a.from,to:Math.min(t.doc.length,a.to+1)})),s=a.number}r=!0}return{text:Xv(t,C6,e.join(t.lineBreak)),ranges:n,linewise:r}}let yS=null;Ta.copy=Ta.cut=(t,e)=>{let{text:n,ranges:r,linewise:s}=Ise(t.state);if(!n&&!s)return!1;yS=s?n:null,e.type=="cut"&&!t.state.readOnly&&t.dispatch({changes:r,scrollIntoView:!0,userEvent:"delete.cut"});let i=YI?null:e.clipboardData;return i?(i.clearData(),i.setData("text/plain",n),!0):(Lse(t,n),!1)};const JI=hl.define();function eB(t,e){let n=[];for(let r of t.facet(RI)){let s=r(t,e);s&&n.push(s)}return n.length?t.update({effects:n,annotations:JI.of(!0)}):null}function tB(t){setTimeout(()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let n=eB(t.state,e);n?t.dispatch(n):t.update([])}},10)}la.focus=t=>{t.inputState.lastFocusTime=Date.now(),!t.scrollDOM.scrollTop&&(t.inputState.lastScrollTop||t.inputState.lastScrollLeft)&&(t.scrollDOM.scrollTop=t.inputState.lastScrollTop,t.scrollDOM.scrollLeft=t.inputState.lastScrollLeft),tB(t)};la.blur=t=>{t.observer.clearSelectionRange(),tB(t)};la.compositionstart=la.compositionupdate=t=>{t.observer.editContext||(t.inputState.compositionFirstChange==null&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0))};la.compositionend=t=>{t.observer.editContext||(t.inputState.composing=-1,t.inputState.compositionEndedAt=Date.now(),t.inputState.compositionPendingKey=!0,t.inputState.compositionPendingChange=t.observer.pendingRecords().length>0,t.inputState.compositionFirstChange=null,Ye.chrome&&Ye.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then(()=>t.observer.flush()):setTimeout(()=>{t.inputState.composing<0&&t.docView.hasComposition&&t.update([])},50))};la.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()};Ta.beforeinput=(t,e)=>{var n,r;if((e.inputType=="insertText"||e.inputType=="insertCompositionText")&&(t.inputState.insertingText=e.data,t.inputState.insertingTextAt=Date.now()),e.inputType=="insertReplacementText"&&t.observer.editContext){let i=(n=e.dataTransfer)===null||n===void 0?void 0:n.getData("text/plain"),a=e.getTargetRanges();if(i&&a.length){let o=a[0],c=t.posAtDOM(o.startContainer,o.startOffset),h=t.posAtDOM(o.endContainer,o.endOffset);return _6(t,{from:c,to:h,insert:t.state.toText(i)},null),!0}}let s;if(Ye.chrome&&Ye.android&&(s=GI.find(i=>i.inputType==e.inputType))&&(t.observer.delayAndroidKey(s.key,s.keyCode),s.key=="Backspace"||s.key=="Delete")){let i=((r=window.visualViewport)===null||r===void 0?void 0:r.height)||0;setTimeout(()=>{var a;(((a=window.visualViewport)===null||a===void 0?void 0:a.height)||0)>i+10&&t.hasFocus&&(t.contentDOM.blur(),t.focus())},100)}return Ye.ios&&e.inputType=="deleteContentForward"&&t.observer.flushSoon(),Ye.safari&&e.inputType=="insertText"&&t.inputState.composing>=0&&setTimeout(()=>la.compositionend(t,e),20),!1};const sT=new Set;function Bse(t){sT.has(t)||(sT.add(t),t.addEventListener("copy",()=>{}),t.addEventListener("cut",()=>{}))}const iT=["pre-wrap","normal","pre-line","break-spaces"];let Sh=!1;function aT(){Sh=!1}class qse{constructor(e){this.lineWrapping=e,this.doc=cn.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,n){let r=this.doc.lineAt(n).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(r+=Math.max(0,Math.ceil((n-e-r*this.lineLength*.5)/this.lineLength))),this.lineHeight*r}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return iT.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let n=!1;for(let r=0;r-1,c=Math.round(n)!=Math.round(this.lineHeight)||this.lineWrapping!=o;if(this.lineWrapping=o,this.lineHeight=n,this.charWidth=r,this.textHeight=s,this.lineLength=i,c){this.heightSamples={};for(let h=0;h0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>i1&&(Sh=!0),this.height=e)}replace(e,n,r){return Ds.of(r)}decomposeLeft(e,n){n.push(this)}decomposeRight(e,n){n.push(this)}applyChanges(e,n,r,s){let i=this,a=r.doc;for(let o=s.length-1;o>=0;o--){let{fromA:c,toA:h,fromB:f,toB:m}=s[o],g=i.lineAt(c,Zn.ByPosNoHeight,r.setDoc(n),0,0),x=g.to>=h?g:i.lineAt(h,Zn.ByPosNoHeight,r,0,0);for(m+=x.to-h,h=x.to;o>0&&g.from<=s[o-1].toA;)c=s[o-1].fromA,f=s[o-1].fromB,o--,ci*2){let o=e[n-1];o.break?e.splice(--n,1,o.left,null,o.right):e.splice(--n,1,o.left,o.right),r+=1+o.break,s-=o.size}else if(i>s*2){let o=e[r];o.break?e.splice(r,1,o.left,null,o.right):e.splice(r,1,o.left,o.right),r+=2+o.break,i-=o.size}else break;else if(s=i&&a(this.blockAt(0,r,s,i))}updateHeight(e,n=0,r=!1,s){return s&&s.from<=n&&s.more&&this.setHeight(s.heights[s.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class ji extends nB{constructor(e,n){super(e,n,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,n,r,s){return new Ya(s,this.length,r,this.height,this.breaks)}replace(e,n,r){let s=r[0];return r.length==1&&(s instanceof ji||s instanceof ds&&s.flags&4)&&Math.abs(this.length-s.length)<10?(s instanceof ds?s=new ji(s.length,this.height):s.height=this.height,this.outdated||(s.outdated=!1),s):Ds.of(r)}updateHeight(e,n=0,r=!1,s){return s&&s.from<=n&&s.more?this.setHeight(s.heights[s.index++]):(r||this.outdated)&&this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class ds extends Ds{constructor(e){super(e,0)}heightMetrics(e,n){let r=e.doc.lineAt(n).number,s=e.doc.lineAt(n+this.length).number,i=s-r+1,a,o=0;if(e.lineWrapping){let c=Math.min(this.height,e.lineHeight*i);a=c/i,this.length>i+1&&(o=(this.height-c)/(this.length-i-1))}else a=this.height/i;return{firstLine:r,lastLine:s,perLine:a,perChar:o}}blockAt(e,n,r,s){let{firstLine:i,lastLine:a,perLine:o,perChar:c}=this.heightMetrics(n,s);if(n.lineWrapping){let h=s+(e0){let i=r[r.length-1];i instanceof ds?r[r.length-1]=new ds(i.length+s):r.push(null,new ds(s-1))}if(e>0){let i=r[0];i instanceof ds?r[0]=new ds(e+i.length):r.unshift(new ds(e-1),null)}return Ds.of(r)}decomposeLeft(e,n){n.push(new ds(e-1),null)}decomposeRight(e,n){n.push(null,new ds(this.length-e-1))}updateHeight(e,n=0,r=!1,s){let i=n+this.length;if(s&&s.from<=n+this.length&&s.more){let a=[],o=Math.max(n,s.from),c=-1;for(s.from>n&&a.push(new ds(s.from-n-1).updateHeight(e,n));o<=i&&s.more;){let f=e.doc.lineAt(o).length;a.length&&a.push(null);let m=s.heights[s.index++];c==-1?c=m:Math.abs(m-c)>=i1&&(c=-2);let g=new ji(f,m);g.outdated=!1,a.push(g),o+=f+1}o<=i&&a.push(null,new ds(i-o).updateHeight(e,o));let h=Ds.of(a);return(c<0||Math.abs(h.height-this.height)>=i1||Math.abs(c-this.heightMetrics(e,n).perLine)>=i1)&&(Sh=!0),L1(this,h)}else(r||this.outdated)&&(this.setHeight(e.heightForGap(n,n+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class $se extends Ds{constructor(e,n,r){super(e.length+n+r.length,e.height+r.height,n|(e.outdated||r.outdated?2:0)),this.left=e,this.right=r,this.size=e.size+r.size}get break(){return this.flags&1}blockAt(e,n,r,s){let i=r+this.left.height;return eo))return h;let f=n==Zn.ByPosNoHeight?Zn.ByPosNoHeight:Zn.ByPos;return c?h.join(this.right.lineAt(o,f,r,a,o)):this.left.lineAt(o,f,r,s,i).join(h)}forEachLine(e,n,r,s,i,a){let o=s+this.left.height,c=i+this.left.length+this.break;if(this.break)e=c&&this.right.forEachLine(e,n,r,o,c,a);else{let h=this.lineAt(c,Zn.ByPos,r,s,i);e=e&&h.from<=n&&a(h),n>h.to&&this.right.forEachLine(h.to+1,n,r,o,c,a)}}replace(e,n,r){let s=this.left.length+this.break;if(nthis.left.length)return this.balanced(this.left,this.right.replace(e-s,n-s,r));let i=[];e>0&&this.decomposeLeft(e,i);let a=i.length;for(let o of r)i.push(o);if(e>0&&lT(i,a-1),n=r&&n.push(null)),e>r&&this.right.decomposeLeft(e-r,n)}decomposeRight(e,n){let r=this.left.length,s=r+this.break;if(e>=s)return this.right.decomposeRight(e-s,n);e2*n.size||n.size>2*e.size?Ds.of(this.break?[e,null,n]:[e,n]):(this.left=L1(this.left,e),this.right=L1(this.right,n),this.setHeight(e.height+n.height),this.outdated=e.outdated||n.outdated,this.size=e.size+n.size,this.length=e.length+this.break+n.length,this)}updateHeight(e,n=0,r=!1,s){let{left:i,right:a}=this,o=n+i.length+this.break,c=null;return s&&s.from<=n+i.length&&s.more?c=i=i.updateHeight(e,n,r,s):i.updateHeight(e,n,r),s&&s.from<=o+a.length&&s.more?c=a=a.updateHeight(e,o,r,s):a.updateHeight(e,o,r),c?this.balanced(i,a):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function lT(t,e){let n,r;t[e]==null&&(n=t[e-1])instanceof ds&&(r=t[e+1])instanceof ds&&t.splice(e-1,3,new ds(n.length+1+r.length))}const Qse=5;class M6{constructor(e,n){this.pos=e,this.oracle=n,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,n){if(this.lineStart>-1){let r=Math.min(n,this.lineEnd),s=this.nodes[this.nodes.length-1];s instanceof ji?s.length+=r-this.pos:(r>this.pos||!this.isCovered)&&this.nodes.push(new ji(r-this.pos,-1)),this.writtenTo=r,n>r&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=n}point(e,n,r){if(e=Qse)&&this.addLineDeco(s,i,a)}else n>e&&this.span(e,n);this.lineEnd>-1&&this.lineEnd-1)return;let{from:e,to:n}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=n,this.writtenToe&&this.nodes.push(new ji(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,n){let r=new ds(n-e);return this.oracle.doc.lineAt(e).to==n&&(r.flags|=4),r}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof ji)return e;let n=new ji(0,-1);return this.nodes.push(n),n}addBlock(e){this.enterLine();let n=e.deco;n&&n.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,n&&n.endSide>0&&(this.covering=e)}addLineDeco(e,n,r){let s=this.ensureLine();s.length+=r,s.collapsed+=r,s.widgetHeight=Math.max(s.widgetHeight,e),s.breaks+=n,this.writtenTo=this.pos=this.pos+r}finish(e){let n=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(n instanceof ji)&&!this.isCovered?this.nodes.push(new ji(0,-1)):(this.writtenTof.clientHeight||f.scrollWidth>f.clientWidth)&&m.overflow!="visible"){let g=f.getBoundingClientRect();i=Math.max(i,g.left),a=Math.min(a,g.right),o=Math.max(o,g.top),c=Math.min(h==t.parentNode?s.innerHeight:c,g.bottom)}h=m.position=="absolute"||m.position=="fixed"?f.offsetParent:f.parentNode}else if(h.nodeType==11)h=h.host;else break;return{left:i-n.left,right:Math.max(i,a)-n.left,top:o-(n.top+e),bottom:Math.max(o,c)-(n.top+e)}}function Wse(t){let e=t.getBoundingClientRect(),n=t.ownerDocument.defaultView||window;return e.left0&&e.top0}function Gse(t,e){let n=t.getBoundingClientRect();return{left:0,right:n.right-n.left,top:e,bottom:n.bottom-(n.top+e)}}class xw{constructor(e,n,r,s){this.from=e,this.to=n,this.size=r,this.displaySize=s}static same(e,n){if(e.length!=n.length)return!1;for(let r=0;rtypeof r!="function"&&r.class=="cm-lineWrapping");this.heightOracle=new qse(n),this.stateDeco=e.facet(Xm).filter(r=>typeof r!="function"),this.heightMap=Ds.empty().applyChanges(this.stateDeco,cn.empty,this.heightOracle.setDoc(e.doc),[new ra(0,0,0,e.doc.length)]);for(let r=0;r<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());r++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=ft.set(this.lineGaps.map(r=>r.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:n}=this.state.selection;for(let r=0;r<=1;r++){let s=r?n.head:n.anchor;if(!e.some(({from:i,to:a})=>s>=i&&s<=a)){let{from:i,to:a}=this.lineBlockAt(s);e.push(new tx(i,a))}}return this.viewports=e.sort((r,s)=>r.from-s.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?cT:new A6(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(gm(e,this.scaler))})}update(e,n=null){this.state=e.state;let r=this.stateDeco;this.stateDeco=this.state.facet(Xm).filter(f=>typeof f!="function");let s=e.changedRanges,i=ra.extendWithRanges(s,Hse(r,this.stateDeco,e?e.changes:Hr.empty(this.state.doc.length))),a=this.heightMap.height,o=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);aT(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),i),(this.heightMap.height!=a||Sh)&&(e.flags|=2),o?(this.scrollAnchorPos=e.changes.mapPos(o.from,-1),this.scrollAnchorHeight=o.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=a);let c=i.length?this.mapViewport(this.viewport,e.changes):this.viewport;(n&&(n.range.headc.to)||!this.viewportIsAppropriate(c))&&(c=this.getViewport(0,n));let h=c.from!=this.viewport.from||c.to!=this.viewport.to;this.viewport=c,e.flags|=this.updateForViewport(),(h||!e.changes.empty||e.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(e.changes),n&&(this.scrollTarget=n),!this.mustEnforceCursorAssoc&&e.selectionSet&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(zI)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let n=e.contentDOM,r=window.getComputedStyle(n),s=this.heightOracle,i=r.whiteSpace;this.defaultTextDirection=r.direction=="rtl"?Jn.RTL:Jn.LTR;let a=this.heightOracle.mustRefreshForWrapping(i),o=n.getBoundingClientRect(),c=a||this.mustMeasureContent||this.contentDOMHeight!=o.height;this.contentDOMHeight=o.height,this.mustMeasureContent=!1;let h=0,f=0;if(o.width&&o.height){let{scaleX:T,scaleY:_}=uI(n,o);(T>.005&&Math.abs(this.scaleX-T)>.005||_>.005&&Math.abs(this.scaleY-_)>.005)&&(this.scaleX=T,this.scaleY=_,h|=16,a=c=!0)}let m=(parseInt(r.paddingTop)||0)*this.scaleY,g=(parseInt(r.paddingBottom)||0)*this.scaleY;(this.paddingTop!=m||this.paddingBottom!=g)&&(this.paddingTop=m,this.paddingBottom=g,h|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(s.lineWrapping&&(c=!0),this.editorWidth=e.scrollDOM.clientWidth,h|=16);let x=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=x&&(this.scrollAnchorHeight=-1,this.scrollTop=x),this.scrolledToBottom=fI(e.scrollDOM);let y=(this.printing?Gse:Use)(n,this.paddingTop),w=y.top-this.pixelViewport.top,S=y.bottom-this.pixelViewport.bottom;this.pixelViewport=y;let k=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(k!=this.inView&&(this.inView=k,k&&(c=!0)),!this.inView&&!this.scrollTarget&&!Wse(e.dom))return 0;let N=o.width;if((this.contentDOMWidth!=N||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=o.width,this.editorHeight=e.scrollDOM.clientHeight,h|=16),c){let T=e.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(T)&&(a=!0),a||s.lineWrapping&&Math.abs(N-this.contentDOMWidth)>s.charWidth){let{lineHeight:_,charWidth:E,textHeight:M}=e.docView.measureTextSize();a=_>0&&s.refresh(i,_,E,M,Math.max(5,N/E),T),a&&(e.docView.minWidth=0,h|=16)}w>0&&S>0?f=Math.max(w,S):w<0&&S<0&&(f=Math.min(w,S)),aT();for(let _ of this.viewports){let E=_.from==this.viewport.from?T:e.docView.measureVisibleLineHeights(_);this.heightMap=(a?Ds.empty().applyChanges(this.stateDeco,cn.empty,this.heightOracle,[new ra(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(s,0,a,new Fse(_.from,E))}Sh&&(h|=2)}let C=!this.viewportIsAppropriate(this.viewport,f)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return C&&(h&2&&(h|=this.updateScaler()),this.viewport=this.getViewport(f,this.scrollTarget),h|=this.updateForViewport()),(h&2||C)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(a?[]:this.lineGaps,e)),h|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),h}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,n){let r=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),s=this.heightMap,i=this.heightOracle,{visibleTop:a,visibleBottom:o}=this,c=new tx(s.lineAt(a-r*1e3,Zn.ByHeight,i,0,0).from,s.lineAt(o+(1-r)*1e3,Zn.ByHeight,i,0,0).to);if(n){let{head:h}=n.range;if(hc.to){let f=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),m=s.lineAt(h,Zn.ByPos,i,0,0),g;n.y=="center"?g=(m.top+m.bottom)/2-f/2:n.y=="start"||n.y=="nearest"&&h=o+Math.max(10,Math.min(r,250)))&&s>a-2*1e3&&i>1,a=s<<1;if(this.defaultTextDirection!=Jn.LTR&&!r)return[];let o=[],c=(f,m,g,x)=>{if(m-ff&&kk.from>=g.from&&k.to<=g.to&&Math.abs(k.from-f)k.fromN));if(!S){if(mC.from<=m&&C.to>=m)){let C=n.moveToLineBoundary(Ae.cursor(m),!1,!0).head;C>f&&(m=C)}let k=this.gapSize(g,f,m,x),N=r||k<2e6?k:2e6;S=new xw(f,m,k,N)}o.push(S)},h=f=>{if(f.length2e6)for(let E of e)E.from>=f.from&&E.fromf.from&&c(f.from,x,f,m),yn.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let n=this.stateDeco;this.lineGaps.length&&(n=n.concat(this.lineGapDeco));let r=[];bn.spans(n,this.viewport.from,this.viewport.to,{span(i,a){r.push({from:i,to:a})},point(){}},20);let s=0;if(r.length!=this.visibleRanges.length)s=12;else for(let i=0;i=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(n=>n.from<=e&&n.to>=e)||gm(this.heightMap.lineAt(e,Zn.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(n=>n.top<=e&&n.bottom>=e)||gm(this.heightMap.lineAt(this.scaler.fromDOM(e),Zn.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let n=this.lineBlockAtHeight(e+8);return n.from>=this.viewport.from||this.viewportLines[0].top-e>200?n:this.viewportLines[0]}elementAtHeight(e){return gm(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}let tx=class{constructor(e,n){this.from=e,this.to=n}};function Yse(t,e,n){let r=[],s=t,i=0;return bn.spans(n,t,e,{span(){},point(a,o){a>s&&(r.push({from:s,to:a}),i+=a-s),s=o}},20),s=1)return e[e.length-1].to;let r=Math.floor(t*n);for(let s=0;;s++){let{from:i,to:a}=e[s],o=a-i;if(r<=o)return i+r;r-=o}}function rx(t,e){let n=0;for(let{from:r,to:s}of t.ranges){if(e<=s){n+=e-r;break}n+=s-r}return n/t.total}function Kse(t,e){for(let n of t)if(e(n))return n}const cT={toDOM(t){return t},fromDOM(t){return t},scale:1,eq(t){return t==this}};class A6{constructor(e,n,r){let s=0,i=0,a=0;this.viewports=r.map(({from:o,to:c})=>{let h=n.lineAt(o,Zn.ByPos,e,0,0).top,f=n.lineAt(c,Zn.ByPos,e,0,0).bottom;return s+=f-h,{from:o,to:c,top:h,bottom:f,domTop:0,domBottom:0}}),this.scale=(7e6-s)/(n.height-s);for(let o of this.viewports)o.domTop=a+(o.top-i)*this.scale,a=o.domBottom=o.domTop+(o.bottom-o.top),i=o.bottom}toDOM(e){for(let n=0,r=0,s=0;;n++){let i=nn.from==e.viewports[r].from&&n.to==e.viewports[r].to):!1}}function gm(t,e){if(e.scale==1)return t;let n=e.toDOM(t.top),r=e.toDOM(t.bottom);return new Ya(t.from,t.length,n,r-n,Array.isArray(t._content)?t._content.map(s=>gm(s,e)):t._content)}const sx=et.define({combine:t=>t.join(" ")}),bS=et.define({combine:t=>t.indexOf(!0)>-1}),wS=vc.newName(),rB=vc.newName(),sB=vc.newName(),iB={"&light":"."+rB,"&dark":"."+sB};function SS(t,e,n){return new vc(e,{finish(r){return/&/.test(r)?r.replace(/&\w*/,s=>{if(s=="&")return t;if(!n||!n[s])throw new RangeError(`Unsupported selector: ${s}`);return n[s]}):t+" "+r}})}const Zse=SS("."+wS,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},iB),Jse={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},vw=Ye.ie&&Ye.ie_version<=11;class eie{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new Pre,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(n=>{for(let r of n)this.queue.push(r);(Ye.ie&&Ye.ie_version<=11||Ye.ios&&e.composing)&&n.some(r=>r.type=="childList"&&r.removedNodes.length||r.type=="characterData"&&r.oldValue.length>r.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&Ye.android&&e.constructor.EDIT_CONTEXT!==!1&&!(Ye.chrome&&Ye.chrome_version<126)&&(this.editContext=new nie(e),e.state.facet(Jl)&&(e.contentDOM.editContext=this.editContext.editContext)),vw&&(this.onCharData=n=>{this.queue.push({target:n.target,type:"characterData",oldValue:n.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var n;((n=this.view.docView)===null||n===void 0?void 0:n.lastUpdate){this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),n.length>0&&n[n.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(n=>{n.length>0&&n[n.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){(e.type=="change"||!e.type)&&!e.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((n,r)=>n!=e[r]))){this.gapIntersection.disconnect();for(let n of e)this.gapIntersection.observe(n);this.gaps=e}}onSelectionChange(e){let n=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:r}=this,s=this.selectionRange;if(r.state.facet(Jl)?r.root.activeElement!=this.dom:!r1(this.dom,s))return;let i=s.anchorNode&&r.docView.nearest(s.anchorNode);if(i&&i.ignoreEvent(e)){n||(this.selectionChanged=!1);return}(Ye.ie&&Ye.ie_version<=11||Ye.android&&Ye.chrome)&&!r.state.selection.main.empty&&s.focusNode&&Tm(s.focusNode,s.focusOffset,s.anchorNode,s.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,n=Gm(e.root);if(!n)return!1;let r=Ye.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&tie(this.view,n)||n;if(!r||this.selectionRange.eq(r))return!1;let s=r1(this.dom,r);return s&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime{let i=this.delayedAndroidKey;i&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=i.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&i.force&&th(this.dom,i.key,i.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(s)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:n,force:this.lastChange{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let n=-1,r=-1,s=!1;for(let i of e){let a=this.readMutation(i);a&&(a.typeOver&&(s=!0),n==-1?{from:n,to:r}=a:(n=Math.min(a.from,n),r=Math.max(a.to,r)))}return{from:n,to:r,typeOver:s}}readChange(){let{from:e,to:n,typeOver:r}=this.processRecords(),s=this.selectionChanged&&r1(this.dom,this.selectionRange);if(e<0&&!s)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let i=new yse(this.view,e,n,r);return this.view.docView.domChanged={newSel:i.newSel?i.newSel.main:null},i}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let n=this.readChange();if(!n)return this.view.requestMeasure(),!1;let r=this.view.state,s=UI(this.view,n);return this.view.state==r&&(n.domChanged||n.newSel&&!n.newSel.main.eq(this.view.state.selection.main))&&this.view.update([]),s}readMutation(e){let n=this.view.docView.nearest(e.target);if(!n||n.ignoreMutation(e))return null;if(n.markDirty(e.type=="attributes"),e.type=="attributes"&&(n.flags|=4),e.type=="childList"){let r=uT(n,e.previousSibling||e.target.previousSibling,-1),s=uT(n,e.nextSibling||e.target.nextSibling,1);return{from:r?n.posAfter(r):n.posAtStart,to:s?n.posBefore(s):n.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(Jl)!=e.state.facet(Jl)&&(e.view.contentDOM.editContext=e.state.facet(Jl)?this.editContext.editContext:null))}destroy(){var e,n,r;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(n=this.gapIntersection)===null||n===void 0||n.disconnect(),(r=this.resizeScroll)===null||r===void 0||r.disconnect();for(let s of this.scrollTargets)s.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function uT(t,e,n){for(;e;){let r=Bn.get(e);if(r&&r.parent==t)return r;let s=e.parentNode;e=s!=t.dom?s:n>0?e.nextSibling:e.previousSibling}return null}function dT(t,e){let n=e.startContainer,r=e.startOffset,s=e.endContainer,i=e.endOffset,a=t.docView.domAtPos(t.state.selection.main.anchor);return Tm(a.node,a.offset,s,i)&&([n,r,s,i]=[s,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:s,focusOffset:i}}function tie(t,e){if(e.getComposedRanges){let s=e.getComposedRanges(t.root)[0];if(s)return dT(t,s)}let n=null;function r(s){s.preventDefault(),s.stopImmediatePropagation(),n=s.getTargetRanges()[0]}return t.contentDOM.addEventListener("beforeinput",r,!0),t.dom.ownerDocument.execCommand("indent"),t.contentDOM.removeEventListener("beforeinput",r,!0),n?dT(t,n):null}class nie{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let n=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=r=>{let s=e.state.selection.main,{anchor:i,head:a}=s,o=this.toEditorPos(r.updateRangeStart),c=this.toEditorPos(r.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:r.updateRangeStart,editorBase:o,drifted:!1});let h=c-o>r.text.length;o==this.from&&ithis.to&&(c=i);let f=WI(e.state.sliceDoc(o,c),r.text,(h?s.from:s.to)-o,h?"end":null);if(!f){let g=Ae.single(this.toEditorPos(r.selectionStart),this.toEditorPos(r.selectionEnd));g.main.eq(s)||e.dispatch({selection:g,userEvent:"select"});return}let m={from:f.from+o,to:f.toA+o,insert:cn.of(r.text.slice(f.from,f.toB).split(` -`))};if((Ye.mac||Ye.android)&&m.from==a-1&&/^\. ?$/.test(r.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(m={from:o,to:c,insert:cn.of([r.text.replace("."," ")])}),this.pendingContextChange=m,!e.state.readOnly){let g=this.to-this.from+(m.to-m.from+m.insert.length);_6(e,m,Ae.single(this.toEditorPos(r.selectionStart,g),this.toEditorPos(r.selectionEnd,g)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),m.from=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(n.text.slice(Math.max(0,r.updateRangeStart-1),Math.min(n.text.length,r.updateRangeStart+1)))&&this.handlers.compositionend(r)},this.handlers.characterboundsupdate=r=>{let s=[],i=null;for(let a=this.toEditorPos(r.rangeStart),o=this.toEditorPos(r.rangeEnd);a{let s=[];for(let i of r.getTextFormats()){let a=i.underlineStyle,o=i.underlineThickness;if(!/none/i.test(a)&&!/none/i.test(o)){let c=this.toEditorPos(i.rangeStart),h=this.toEditorPos(i.rangeEnd);if(c{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:r}=this.composing;this.composing=null,r&&this.reset(e.state)}};for(let r in this.handlers)n.addEventListener(r,this.handlers[r]);this.measureReq={read:r=>{this.editContext.updateControlBounds(r.contentDOM.getBoundingClientRect());let s=Gm(r.root);s&&s.rangeCount&&this.editContext.updateSelectionBounds(s.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let n=0,r=!1,s=this.pendingContextChange;return e.changes.iterChanges((i,a,o,c,h)=>{if(r)return;let f=h.length-(a-i);if(s&&a>=s.to)if(s.from==i&&s.to==a&&s.insert.eq(h)){s=this.pendingContextChange=null,n+=f,this.to+=f;return}else s=null,this.revertPending(e.state);if(i+=n,a+=n,a<=this.from)this.from+=f,this.to+=f;else if(ithis.to||this.to-this.from+h.length>3e4){r=!0;return}this.editContext.updateText(this.toContextPos(i),this.toContextPos(a),h.toString()),this.to+=f}n+=f}),s&&!r&&this.revertPending(e.state),!r}update(e){let n=this.pendingContextChange,r=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(r.from,r.to)&&e.transactions.some(s=>!s.isUserEvent("input.type")&&s.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||n)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:n}=e.selection.main;this.from=Math.max(0,n-1e4),this.to=Math.min(e.doc.length,n+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let n=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(n.from),this.toContextPos(n.from+n.insert.length),e.doc.sliceString(n.from,n.to))}setSelection(e){let{main:n}=e.selection,r=this.toContextPos(Math.max(this.from,Math.min(this.to,n.anchor))),s=this.toContextPos(n.head);(this.editContext.selectionStart!=r||this.editContext.selectionEnd!=s)&&this.editContext.updateSelection(r,s)}rangeIsValid(e){let{head:n}=e.selection.main;return!(this.from>0&&n-this.from<500||this.to1e4*3)}toEditorPos(e,n=this.to-this.from){e=Math.min(e,n);let r=this.composing;return r&&r.drifted?r.editorBase+(e-r.contextBase):e+this.from}toContextPos(e){let n=this.composing;return n&&n.drifted?n.contextBase+(e-n.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class We{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var n;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:r}=e;this.dispatchTransactions=e.dispatchTransactions||r&&(s=>s.forEach(i=>r(i,this)))||(s=>this.update(s)),this.dispatch=this.dispatch.bind(this),this._root=e.root||Lre(e.parent)||document,this.viewState=new oT(e.state||an.create(e)),e.scrollTo&&e.scrollTo.is(Zg)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Ud).map(s=>new mw(s));for(let s of this.plugins)s.update(this);this.observer=new eie(this),this.inputState=new kse(this),this.inputState.ensureHandlers(this.plugins),this.docView=new Q9(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((n=document.fonts)===null||n===void 0)&&n.ready&&document.fonts.ready.then(()=>this.requestMeasure())}dispatch(...e){let n=e.length==1&&e[0]instanceof Pr?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(n,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let n=!1,r=!1,s,i=this.state;for(let g of e){if(g.startState!=i)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");i=g.state}if(this.destroyed){this.viewState.state=i;return}let a=this.hasFocus,o=0,c=null;e.some(g=>g.annotation(JI))?(this.inputState.notifiedFocused=a,o=1):a!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=a,c=eB(i,a),c||(o=1));let h=this.observer.delayedAndroidKey,f=null;if(h?(this.observer.clearDelayedAndroidKey(),f=this.observer.readChange(),(f&&!this.state.doc.eq(i.doc)||!this.state.selection.eq(i.selection))&&(f=null)):this.observer.clear(),i.facet(an.phrases)!=this.state.facet(an.phrases))return this.setState(i);s=P1.create(this,i,e),s.flags|=o;let m=this.viewState.scrollTarget;try{this.updateState=2;for(let g of e){if(m&&(m=m.map(g.changes)),g.scrollIntoView){let{main:x}=g.state.selection;m=new nh(x.empty?x:Ae.cursor(x.head,x.head>x.anchor?-1:1))}for(let x of g.effects)x.is(Zg)&&(m=x.value.clip(this.state))}this.viewState.update(s,m),this.bidiCache=I1.update(this.bidiCache,s.changes),s.empty||(this.updatePlugins(s),this.inputState.update(s)),n=this.docView.update(s),this.state.facet(mm)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(n,e.some(g=>g.isUserEvent("select.pointer")))}finally{this.updateState=0}if(s.startState.facet(sx)!=s.state.facet(sx)&&(this.viewState.mustMeasureContent=!0),(n||r||m||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!s.empty)for(let g of this.state.facet(gS))try{g(s)}catch(x){Js(this.state,x,"update listener")}(c||f)&&Promise.resolve().then(()=>{c&&this.state==c.startState&&this.dispatch(c),f&&!UI(this,f)&&h.force&&th(this.contentDOM,h.key,h.keyCode)})}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let n=this.hasFocus;try{for(let r of this.plugins)r.destroy(this);this.viewState=new oT(e),this.plugins=e.facet(Ud).map(r=>new mw(r)),this.pluginMap.clear();for(let r of this.plugins)r.update(this);this.docView.destroy(),this.docView=new Q9(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}n&&this.focus(),this.requestMeasure()}updatePlugins(e){let n=e.startState.facet(Ud),r=e.state.facet(Ud);if(n!=r){let s=[];for(let i of r){let a=n.indexOf(i);if(a<0)s.push(new mw(i));else{let o=this.plugins[a];o.mustUpdate=e,s.push(o)}}for(let i of this.plugins)i.mustUpdate!=e&&i.destroy(this);this.plugins=s,this.pluginMap.clear()}else for(let s of this.plugins)s.mustUpdate=e;for(let s=0;s-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let n=null,r=this.scrollDOM,s=r.scrollTop*this.scaleY,{scrollAnchorPos:i,scrollAnchorHeight:a}=this.viewState;Math.abs(s-this.viewState.scrollTop)>1&&(a=-1),this.viewState.scrollAnchorHeight=-1;try{for(let o=0;;o++){if(a<0)if(fI(r))i=-1,a=this.viewState.heightMap.height;else{let x=this.viewState.scrollAnchorAt(s);i=x.from,a=x.top}this.updateState=1;let c=this.viewState.measure(this);if(!c&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(o>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let h=[];c&4||([this.measureRequests,h]=[h,this.measureRequests]);let f=h.map(x=>{try{return x.read(this)}catch(y){return Js(this.state,y),hT}}),m=P1.create(this,this.state,[]),g=!1;m.flags|=c,n?n.flags|=c:n=m,this.updateState=2,m.empty||(this.updatePlugins(m),this.inputState.update(m),this.updateAttrs(),g=this.docView.update(m),g&&this.docViewUpdate());for(let x=0;x1||y<-1){s=s+y,r.scrollTop=s/this.scaleY,a=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(n&&!n.empty)for(let o of this.state.facet(gS))o(n)}get themeClasses(){return wS+" "+(this.state.facet(bS)?sB:rB)+" "+this.state.facet(sx)}updateAttrs(){let e=fT(this,II,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),n={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(Jl)?"true":"false",class:"cm-content",style:`${Ye.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(n["aria-readonly"]="true"),fT(this,T6,n);let r=this.observer.ignore(()=>{let s=dS(this.contentDOM,this.contentAttrs,n),i=dS(this.dom,this.editorAttrs,e);return s||i});return this.editorAttrs=e,this.contentAttrs=n,r}showAnnouncements(e){let n=!0;for(let r of e)for(let s of r.effects)if(s.is(We.announce)){n&&(this.announceDOM.textContent=""),n=!1;let i=this.announceDOM.appendChild(document.createElement("div"));i.textContent=s.value}}mountStyles(){this.styleModules=this.state.facet(mm);let e=this.state.facet(We.cspNonce);vc.mount(this.root,this.styleModules.concat(Zse).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let n=0;nr.plugin==e)||null),n&&n.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,n,r){return gw(this,e,G9(this,e,n,r))}moveByGroup(e,n){return gw(this,e,G9(this,e,n,r=>mse(this,e.head,r)))}visualLineSide(e,n){let r=this.bidiSpans(e),s=this.textDirectionAt(e.from),i=r[n?r.length-1:0];return Ae.cursor(i.side(n,s)+e.from,i.forward(!n,s)?1:-1)}moveToLineBoundary(e,n,r=!0){return fse(this,e,n,r)}moveVertically(e,n,r){return gw(this,e,pse(this,e,n,r))}domAtPos(e){return this.docView.domAtPos(e)}posAtDOM(e,n=0){return this.docView.posFromDOM(e,n)}posAtCoords(e,n=!0){return this.readMeasured(),QI(this,e,n)}coordsAtPos(e,n=1){this.readMeasured();let r=this.docView.coordsAt(e,n);if(!r||r.left==r.right)return r;let s=this.state.doc.lineAt(e),i=this.bidiSpans(s),a=i[hc.find(i,e-s.from,-1,n)];return H0(r,a.dir==Jn.LTR==n>0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(DI)||ethis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>rie)return NI(e.length);let n=this.textDirectionAt(e.from),r;for(let i of this.bidiCache)if(i.from==e.from&&i.dir==n&&(i.fresh||jI(i.isolates,r=$9(this,e))))return i.order;r||(r=$9(this,e));let s=Kre(e.text,n,r);return this.bidiCache.push(new I1(e.from,e.to,n,r,!0,s)),s}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||Ye.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{dI(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,n={}){return Zg.of(new nh(typeof e=="number"?Ae.cursor(e):e,n.y,n.x,n.yMargin,n.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:n}=this.scrollDOM,r=this.viewState.scrollAnchorAt(e);return Zg.of(new nh(Ae.cursor(r.from),"start","start",r.top-e,n,!0))}setTabFocusMode(e){e==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof e=="boolean"?this.inputState.tabFocusMode=e?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return Nr.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return Nr.define(()=>({}),{eventObservers:e})}static theme(e,n){let r=vc.newName(),s=[sx.of(r),mm.of(SS(`.${r}`,e))];return n&&n.dark&&s.push(bS.of(!0)),s}static baseTheme(e){return Mc.lowest(mm.of(SS("."+wS,e,iB)))}static findFromDOM(e){var n;let r=e.querySelector(".cm-content"),s=r&&Bn.get(r)||Bn.get(e);return((n=s?.rootView)===null||n===void 0?void 0:n.view)||null}}We.styleModule=mm;We.inputHandler=AI;We.clipboardInputFilter=N6;We.clipboardOutputFilter=C6;We.scrollHandler=PI;We.focusChangeEffect=RI;We.perLineTextDirection=DI;We.exceptionSink=MI;We.updateListener=gS;We.editable=Jl;We.mouseSelectionStyle=_I;We.dragMovesSelection=EI;We.clickAddsSelectionRange=TI;We.decorations=Xm;We.outerDecorations=BI;We.atomicRanges=W0;We.bidiIsolatedRanges=qI;We.scrollMargins=FI;We.darkTheme=bS;We.cspNonce=et.define({combine:t=>t.length?t[0]:""});We.contentAttributes=T6;We.editorAttributes=II;We.lineWrapping=We.contentAttributes.of({class:"cm-lineWrapping"});We.announce=Mt.define();const rie=4096,hT={};class I1{constructor(e,n,r,s,i,a){this.from=e,this.to=n,this.dir=r,this.isolates=s,this.fresh=i,this.order=a}static update(e,n){if(n.empty&&!e.some(i=>i.fresh))return e;let r=[],s=e.length?e[e.length-1].dir:Jn.LTR;for(let i=Math.max(0,e.length-10);i=0;s--){let i=r[s],a=typeof i=="function"?i(t):i;a&&uS(a,n)}return n}const sie=Ye.mac?"mac":Ye.windows?"win":Ye.linux?"linux":"key";function iie(t,e){const n=t.split(/-(?!$)/);let r=n[n.length-1];r=="Space"&&(r=" ");let s,i,a,o;for(let c=0;cr.concat(s),[]))),n}function lie(t,e,n){return lB(aB(t.state),e,t,n)}let cc=null;const oie=4e3;function cie(t,e=sie){let n=Object.create(null),r=Object.create(null),s=(a,o)=>{let c=r[a];if(c==null)r[a]=o;else if(c!=o)throw new Error("Key binding "+a+" is used both as a regular binding and as a multi-stroke prefix")},i=(a,o,c,h,f)=>{var m,g;let x=n[a]||(n[a]=Object.create(null)),y=o.split(/ (?!$)/).map(k=>iie(k,e));for(let k=1;k{let T=cc={view:C,prefix:N,scope:a};return setTimeout(()=>{cc==T&&(cc=null)},oie),!0}]})}let w=y.join(" ");s(w,!1);let S=x[w]||(x[w]={preventDefault:!1,stopPropagation:!1,run:((g=(m=x._any)===null||m===void 0?void 0:m.run)===null||g===void 0?void 0:g.slice())||[]});c&&S.run.push(c),h&&(S.preventDefault=!0),f&&(S.stopPropagation=!0)};for(let a of t){let o=a.scope?a.scope.split(" "):["editor"];if(a.any)for(let h of o){let f=n[h]||(n[h]=Object.create(null));f._any||(f._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:m}=a;for(let g in f)f[g].run.push(x=>m(x,kS))}let c=a[e]||a.key;if(c)for(let h of o)i(h,c,a.run,a.preventDefault,a.stopPropagation),a.shift&&i(h,"Shift-"+c,a.shift,a.preventDefault,a.stopPropagation)}return n}let kS=null;function lB(t,e,n,r){kS=e;let s=Mre(e),i=Ks(s,0),a=Xa(i)==s.length&&s!=" ",o="",c=!1,h=!1,f=!1;cc&&cc.view==n&&cc.scope==r&&(o=cc.prefix+" ",XI.indexOf(e.keyCode)<0&&(h=!0,cc=null));let m=new Set,g=S=>{if(S){for(let k of S.run)if(!m.has(k)&&(m.add(k),k(n)))return S.stopPropagation&&(f=!0),!0;S.preventDefault&&(S.stopPropagation&&(f=!0),h=!0)}return!1},x=t[r],y,w;return x&&(g(x[o+ix(s,e,!a)])?c=!0:a&&(e.altKey||e.metaKey||e.ctrlKey)&&!(Ye.windows&&e.ctrlKey&&e.altKey)&&!(Ye.mac&&e.altKey&&!(e.ctrlKey||e.metaKey))&&(y=yc[e.keyCode])&&y!=s?(g(x[o+ix(y,e,!0)])||e.shiftKey&&(w=Wm[e.keyCode])!=s&&w!=y&&g(x[o+ix(w,e,!1)]))&&(c=!0):a&&e.shiftKey&&g(x[o+ix(s,e,!0)])&&(c=!0),!c&&g(x._any)&&(c=!0)),h&&(c=!0),c&&f&&e.stopPropagation(),kS=null,c}class X0{constructor(e,n,r,s,i){this.className=e,this.left=n,this.top=r,this.width=s,this.height=i}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,n){return n.className!=this.className?!1:(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",this.width!=null&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,n,r){if(r.empty){let s=e.coordsAtPos(r.head,r.assoc||1);if(!s)return[];let i=oB(e);return[new X0(n,s.left-i.left,s.top-i.top,null,s.bottom-s.top)]}else return uie(e,n,r)}}function oB(t){let e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==Jn.LTR?e.left:e.right-t.scrollDOM.clientWidth*t.scaleX)-t.scrollDOM.scrollLeft*t.scaleX,top:e.top-t.scrollDOM.scrollTop*t.scaleY}}function pT(t,e,n,r){let s=t.coordsAtPos(e,n*2);if(!s)return r;let i=t.dom.getBoundingClientRect(),a=(s.top+s.bottom)/2,o=t.posAtCoords({x:i.left+1,y:a}),c=t.posAtCoords({x:i.right-1,y:a});return o==null||c==null?r:{from:Math.max(r.from,Math.min(o,c)),to:Math.min(r.to,Math.max(o,c))}}function uie(t,e,n){if(n.to<=t.viewport.from||n.from>=t.viewport.to)return[];let r=Math.max(n.from,t.viewport.from),s=Math.min(n.to,t.viewport.to),i=t.textDirection==Jn.LTR,a=t.contentDOM,o=a.getBoundingClientRect(),c=oB(t),h=a.querySelector(".cm-line"),f=h&&window.getComputedStyle(h),m=o.left+(f?parseInt(f.paddingLeft)+Math.min(0,parseInt(f.textIndent)):0),g=o.right-(f?parseInt(f.paddingRight):0),x=vS(t,r,1),y=vS(t,s,-1),w=x.type==Rs.Text?x:null,S=y.type==Rs.Text?y:null;if(w&&(t.lineWrapping||x.widgetLineBreaks)&&(w=pT(t,r,1,w)),S&&(t.lineWrapping||y.widgetLineBreaks)&&(S=pT(t,s,-1,S)),w&&S&&w.from==S.from&&w.to==S.to)return N(C(n.from,n.to,w));{let _=w?C(n.from,null,w):T(x,!1),E=S?C(null,n.to,S):T(y,!0),M=[];return(w||x).to<(S||y).from-(w&&S?1:0)||x.widgetLineBreaks>1&&_.bottom+t.defaultLineHeight/2V&&z.from=P)break;R>H&&$(Math.max(X,H),_==null&&X<=V,Math.min(R,P),E==null&&R>=ee,J.dir)}if(H=W.to+1,H>=P)break}return I.length==0&&$(V,_==null,ee,E==null,t.textDirection),{top:q,bottom:L,horizontal:I}}function T(_,E){let M=o.top+(E?_.top:_.bottom);return{top:M,bottom:M,horizontal:[]}}}function die(t,e){return t.constructor==e.constructor&&t.eq(e)}class hie{constructor(e,n){this.view=e,this.layer=n,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),n.above&&this.dom.classList.add("cm-layer-above"),n.class&&this.dom.classList.add(n.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),n.mount&&n.mount(this.dom,e)}update(e){e.startState.facet(a1)!=e.state.facet(a1)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}docViewUpdate(e){this.layer.updateOnDocViewUpdate!==!1&&e.requestMeasure(this.measureReq)}setOrder(e){let n=0,r=e.facet(a1);for(;n!die(n,this.drawn[r]))){let n=this.dom.firstChild,r=0;for(let s of e)s.update&&n&&s.constructor&&this.drawn[r].constructor&&s.update(n,this.drawn[r])?(n=n.nextSibling,r++):this.dom.insertBefore(s.draw(),n);for(;n;){let s=n.nextSibling;n.remove(),n=s}this.drawn=e,Ye.safari&&Ye.safari_version>=26&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const a1=et.define();function cB(t){return[Nr.define(e=>new hie(e,t)),a1.of(t)]}const Ym=et.define({combine(t){return fl(t,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,n)=>Math.min(e,n),drawRangeCursor:(e,n)=>e||n})}});function fie(t={}){return[Ym.of(t),mie,pie,gie,zI.of(!0)]}function uB(t){return t.startState.facet(Ym)!=t.state.facet(Ym)}const mie=cB({above:!0,markers(t){let{state:e}=t,n=e.facet(Ym),r=[];for(let s of e.selection.ranges){let i=s==e.selection.main;if(s.empty||n.drawRangeCursor){let a=i?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",o=s.empty?s:Ae.cursor(s.head,s.head>s.anchor?-1:1);for(let c of X0.forRange(t,a,o))r.push(c)}}return r},update(t,e){t.transactions.some(r=>r.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let n=uB(t);return n&&gT(t.state,e),t.docChanged||t.selectionSet||n},mount(t,e){gT(e.state,t)},class:"cm-cursorLayer"});function gT(t,e){e.style.animationDuration=t.facet(Ym).cursorBlinkRate+"ms"}const pie=cB({above:!1,markers(t){return t.state.selection.ranges.map(e=>e.empty?[]:X0.forRange(t,"cm-selectionBackground",e)).reduce((e,n)=>e.concat(n))},update(t,e){return t.docChanged||t.selectionSet||t.viewportChanged||uB(t)},class:"cm-selectionLayer"}),gie=Mc.highest(We.theme({".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}})),dB=Mt.define({map(t,e){return t==null?null:e.mapPos(t)}}),xm=is.define({create(){return null},update(t,e){return t!=null&&(t=e.changes.mapPos(t)),e.effects.reduce((n,r)=>r.is(dB)?r.value:n,t)}}),xie=Nr.fromClass(class{constructor(t){this.view=t,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(t){var e;let n=t.state.field(xm);n==null?this.cursor!=null&&((e=this.cursor)===null||e===void 0||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(t.startState.field(xm)!=n||t.docChanged||t.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:t}=this,e=t.state.field(xm),n=e!=null&&t.coordsAtPos(e);if(!n)return null;let r=t.scrollDOM.getBoundingClientRect();return{left:n.left-r.left+t.scrollDOM.scrollLeft*t.scaleX,top:n.top-r.top+t.scrollDOM.scrollTop*t.scaleY,height:n.bottom-n.top}}drawCursor(t){if(this.cursor){let{scaleX:e,scaleY:n}=this.view;t?(this.cursor.style.left=t.left/e+"px",this.cursor.style.top=t.top/n+"px",this.cursor.style.height=t.height/n+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(t){this.view.state.field(xm)!=t&&this.view.dispatch({effects:dB.of(t)})}},{eventObservers:{dragover(t){this.setDropPos(this.view.posAtCoords({x:t.clientX,y:t.clientY}))},dragleave(t){(t.target==this.view.contentDOM||!this.view.contentDOM.contains(t.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function vie(){return[xm,xie]}function xT(t,e,n,r,s){e.lastIndex=0;for(let i=t.iterRange(n,r),a=n,o;!i.next().done;a+=i.value.length)if(!i.lineBreak)for(;o=e.exec(i.value);)s(a+o.index,o)}function yie(t,e){let n=t.visibleRanges;if(n.length==1&&n[0].from==t.viewport.from&&n[0].to==t.viewport.to)return n;let r=[];for(let{from:s,to:i}of n)s=Math.max(t.state.doc.lineAt(s).from,s-e),i=Math.min(t.state.doc.lineAt(i).to,i+e),r.length&&r[r.length-1].to>=s?r[r.length-1].to=i:r.push({from:s,to:i});return r}class bie{constructor(e){const{regexp:n,decoration:r,decorate:s,boundary:i,maxLength:a=1e3}=e;if(!n.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=n,s)this.addMatch=(o,c,h,f)=>s(f,h,h+o[0].length,o,c);else if(typeof r=="function")this.addMatch=(o,c,h,f)=>{let m=r(o,c,h);m&&f(h,h+o[0].length,m)};else if(r)this.addMatch=(o,c,h,f)=>f(h,h+o[0].length,r);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=i,this.maxLength=a}createDeco(e){let n=new fo,r=n.add.bind(n);for(let{from:s,to:i}of yie(e,this.maxLength))xT(e.state.doc,this.regexp,s,i,(a,o)=>this.addMatch(o,e,a,r));return n.finish()}updateDeco(e,n){let r=1e9,s=-1;return e.docChanged&&e.changes.iterChanges((i,a,o,c)=>{c>=e.view.viewport.from&&o<=e.view.viewport.to&&(r=Math.min(o,r),s=Math.max(c,s))}),e.viewportMoved||s-r>1e3?this.createDeco(e.view):s>-1?this.updateRange(e.view,n.map(e.changes),r,s):n}updateRange(e,n,r,s){for(let i of e.visibleRanges){let a=Math.max(i.from,r),o=Math.min(i.to,s);if(o>=a){let c=e.state.doc.lineAt(a),h=c.toc.from;a--)if(this.boundary.test(c.text[a-1-c.from])){f=a;break}for(;og.push(k.range(w,S));if(c==h)for(this.regexp.lastIndex=f-c.from;(x=this.regexp.exec(c.text))&&x.indexthis.addMatch(S,e,w,y));n=n.update({filterFrom:f,filterTo:m,filter:(w,S)=>wm,add:g})}}return n}}const OS=/x/.unicode!=null?"gu":"g",wie=new RegExp(`[\0-\b ---Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF-]`,OS),Sie={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let yw=null;function kie(){var t;if(yw==null&&typeof document<"u"&&document.body){let e=document.body.style;yw=((t=e.tabSize)!==null&&t!==void 0?t:e.MozTabSize)!=null}return yw||!1}const l1=et.define({combine(t){let e=fl(t,{render:null,specialChars:wie,addSpecialChars:null});return(e.replaceTabs=!kie())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,OS)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,OS)),e}});function Oie(t={}){return[l1.of(t),jie()]}let vT=null;function jie(){return vT||(vT=Nr.fromClass(class{constructor(t){this.view=t,this.decorations=ft.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(l1)),this.decorations=this.decorator.createDeco(t)}makeDecorator(t){return new bie({regexp:t.specialChars,decoration:(e,n,r)=>{let{doc:s}=n.state,i=Ks(e[0],0);if(i==9){let a=s.lineAt(r),o=n.state.tabSize,c=Fh(a.text,o,r-a.from);return ft.replace({widget:new Eie((o-c%o)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[i]||(this.decorationCache[i]=ft.replace({widget:new Tie(t,i)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(l1);t.startState.facet(l1)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(t.view)):this.decorations=this.decorator.updateDeco(t,this.decorations)}},{decorations:t=>t.decorations}))}const Nie="•";function Cie(t){return t>=32?Nie:t==10?"␤":String.fromCharCode(9216+t)}class Tie extends ml{constructor(e,n){super(),this.options=e,this.code=n}eq(e){return e.code==this.code}toDOM(e){let n=Cie(this.code),r=e.state.phrase("Control character")+" "+(Sie[this.code]||"0x"+this.code.toString(16)),s=this.options.render&&this.options.render(this.code,r,n);if(s)return s;let i=document.createElement("span");return i.textContent=n,i.title=r,i.setAttribute("aria-label",r),i.className="cm-specialChar",i}ignoreEvent(){return!1}}class Eie extends ml{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent=" ",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}}function _ie(){return Aie}const Mie=ft.line({class:"cm-activeLine"}),Aie=Nr.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.docChanged||t.selectionSet)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=-1,n=[];for(let r of t.state.selection.ranges){let s=t.lineBlockAt(r.head);s.from>e&&(n.push(Mie.range(s.from)),e=s.from)}return ft.set(n)}},{decorations:t=>t.decorations});class Rie extends ml{constructor(e){super(),this.content=e}toDOM(e){let n=document.createElement("span");return n.className="cm-placeholder",n.style.pointerEvents="none",n.appendChild(typeof this.content=="string"?document.createTextNode(this.content):typeof this.content=="function"?this.content(e):this.content.cloneNode(!0)),n.setAttribute("aria-hidden","true"),n}coordsAt(e){let n=e.firstChild?yh(e.firstChild):[];if(!n.length)return null;let r=window.getComputedStyle(e.parentNode),s=H0(n[0],r.direction!="rtl"),i=parseInt(r.lineHeight);return s.bottom-s.top>i*1.5?{left:s.left,right:s.right,top:s.top,bottom:s.top+i}:s}ignoreEvent(){return!1}}function Die(t){let e=Nr.fromClass(class{constructor(n){this.view=n,this.placeholder=t?ft.set([ft.widget({widget:new Rie(t),side:1}).range(0)]):ft.none}get decorations(){return this.view.state.doc.length?ft.none:this.placeholder}},{decorations:n=>n.decorations});return typeof t=="string"?[e,We.contentAttributes.of({"aria-placeholder":t})]:e}const jS=2e3;function zie(t,e,n){let r=Math.min(e.line,n.line),s=Math.max(e.line,n.line),i=[];if(e.off>jS||n.off>jS||e.col<0||n.col<0){let a=Math.min(e.off,n.off),o=Math.max(e.off,n.off);for(let c=r;c<=s;c++){let h=t.doc.line(c);h.length<=o&&i.push(Ae.range(h.from+a,h.to+o))}}else{let a=Math.min(e.col,n.col),o=Math.max(e.col,n.col);for(let c=r;c<=s;c++){let h=t.doc.line(c),f=nS(h.text,a,t.tabSize,!0);if(f<0)i.push(Ae.cursor(h.to));else{let m=nS(h.text,o,t.tabSize);i.push(Ae.range(h.from+f,h.from+m))}}}return i}function Pie(t,e){let n=t.coordsAtPos(t.viewport.from);return n?Math.round(Math.abs((n.left-e)/t.defaultCharacterWidth)):-1}function yT(t,e){let n=t.posAtCoords({x:e.clientX,y:e.clientY},!1),r=t.state.doc.lineAt(n),s=n-r.from,i=s>jS?-1:s==r.length?Pie(t,e.clientX):Fh(r.text,t.state.tabSize,n-r.from);return{line:r.number,col:i,off:s}}function Lie(t,e){let n=yT(t,e),r=t.state.selection;return n?{update(s){if(s.docChanged){let i=s.changes.mapPos(s.startState.doc.line(n.line).from),a=s.state.doc.lineAt(i);n={line:a.number,col:n.col,off:Math.min(n.off,a.length)},r=r.map(s.changes)}},get(s,i,a){let o=yT(t,s);if(!o)return r;let c=zie(t.state,n,o);return c.length?a?Ae.create(c.concat(r.ranges)):Ae.create(c):r}}:null}function Iie(t){let e=(n=>n.altKey&&n.button==0);return We.mouseSelectionStyle.of((n,r)=>e(r)?Lie(n,r):null)}const Bie={Alt:[18,t=>!!t.altKey],Control:[17,t=>!!t.ctrlKey],Shift:[16,t=>!!t.shiftKey],Meta:[91,t=>!!t.metaKey]},qie={style:"cursor: crosshair"};function Fie(t={}){let[e,n]=Bie[t.key||"Alt"],r=Nr.fromClass(class{constructor(s){this.view=s,this.isDown=!1}set(s){this.isDown!=s&&(this.isDown=s,this.view.update([]))}},{eventObservers:{keydown(s){this.set(s.keyCode==e||n(s))},keyup(s){(s.keyCode==e||!n(s))&&this.set(!1)},mousemove(s){this.set(n(s))}}});return[r,We.contentAttributes.of(s=>{var i;return!((i=s.plugin(r))===null||i===void 0)&&i.isDown?qie:null})]}const ax="-10000px";class hB{constructor(e,n,r,s){this.facet=n,this.createTooltipView=r,this.removeTooltipView=s,this.input=e.state.facet(n),this.tooltips=this.input.filter(a=>a);let i=null;this.tooltipViews=this.tooltips.map(a=>i=r(a,i))}update(e,n){var r;let s=e.state.facet(this.facet),i=s.filter(c=>c);if(s===this.input){for(let c of this.tooltipViews)c.update&&c.update(e);return!1}let a=[],o=n?[]:null;for(let c=0;cn[h]=c),n.length=o.length),this.input=s,this.tooltips=i,this.tooltipViews=a,!0}}function $ie(t){let e=t.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:e.clientHeight,right:e.clientWidth}}const bw=et.define({combine:t=>{var e,n,r;return{position:Ye.ios?"absolute":((e=t.find(s=>s.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((n=t.find(s=>s.parent))===null||n===void 0?void 0:n.parent)||null,tooltipSpace:((r=t.find(s=>s.tooltipSpace))===null||r===void 0?void 0:r.tooltipSpace)||$ie}}}),bT=new WeakMap,R6=Nr.fromClass(class{constructor(t){this.view=t,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=t.state.facet(bw);this.position=e.position,this.parent=e.parent,this.classes=t.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new hB(t,D6,(n,r)=>this.createTooltip(n,r),n=>{this.resizeObserver&&this.resizeObserver.unobserve(n.dom),n.dom.remove()}),this.above=this.manager.tooltips.map(n=>!!n.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(n=>{Date.now()>this.lastTransaction-50&&n.length>0&&n[n.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),t.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let t of this.manager.tooltipViews)this.intersectionObserver.observe(t.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(t){t.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(t,this.above);e&&this.observeIntersection();let n=e||t.geometryChanged,r=t.state.facet(bw);if(r.position!=this.position&&!this.madeAbsolute){this.position=r.position;for(let s of this.manager.tooltipViews)s.dom.style.position=this.position;n=!0}if(r.parent!=this.parent){this.parent&&this.container.remove(),this.parent=r.parent,this.createContainer();for(let s of this.manager.tooltipViews)this.container.appendChild(s.dom);n=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);n&&this.maybeMeasure()}createTooltip(t,e){let n=t.create(this.view),r=e?e.dom:null;if(n.dom.classList.add("cm-tooltip"),t.arrow&&!n.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let s=document.createElement("div");s.className="cm-tooltip-arrow",n.dom.appendChild(s)}return n.dom.style.position=this.position,n.dom.style.top=ax,n.dom.style.left="0px",this.container.insertBefore(n.dom,r),n.mount&&n.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(n.dom),n}destroy(){var t,e,n;this.view.win.removeEventListener("resize",this.measureSoon);for(let r of this.manager.tooltipViews)r.dom.remove(),(t=r.destroy)===null||t===void 0||t.call(r);this.parent&&this.container.remove(),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),(n=this.intersectionObserver)===null||n===void 0||n.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let t=1,e=1,n=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:i}=this.manager.tooltipViews[0];if(Ye.safari){let a=i.getBoundingClientRect();n=Math.abs(a.top+1e4)>1||Math.abs(a.left)>1}else n=!!i.offsetParent&&i.offsetParent!=this.container.ownerDocument.body}if(n||this.position=="absolute")if(this.parent){let i=this.parent.getBoundingClientRect();i.width&&i.height&&(t=i.width/this.parent.offsetWidth,e=i.height/this.parent.offsetHeight)}else({scaleX:t,scaleY:e}=this.view.viewState);let r=this.view.scrollDOM.getBoundingClientRect(),s=E6(this.view);return{visible:{left:r.left+s.left,top:r.top+s.top,right:r.right-s.right,bottom:r.bottom-s.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((i,a)=>{let o=this.manager.tooltipViews[a];return o.getCoords?o.getCoords(i.pos):this.view.coordsAtPos(i.pos)}),size:this.manager.tooltipViews.map(({dom:i})=>i.getBoundingClientRect()),space:this.view.state.facet(bw).tooltipSpace(this.view),scaleX:t,scaleY:e,makeAbsolute:n}}writeMeasure(t){var e;if(t.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let o of this.manager.tooltipViews)o.dom.style.position="absolute"}let{visible:n,space:r,scaleX:s,scaleY:i}=t,a=[];for(let o=0;o=Math.min(n.bottom,r.bottom)||m.rightMath.min(n.right,r.right)+.1)){f.style.top=ax;continue}let x=c.arrow?h.dom.querySelector(".cm-tooltip-arrow"):null,y=x?7:0,w=g.right-g.left,S=(e=bT.get(h))!==null&&e!==void 0?e:g.bottom-g.top,k=h.offset||Hie,N=this.view.textDirection==Jn.LTR,C=g.width>r.right-r.left?N?r.left:r.right-g.width:N?Math.max(r.left,Math.min(m.left-(x?14:0)+k.x,r.right-w)):Math.min(Math.max(r.left,m.left-w+(x?14:0)-k.x),r.right-w),T=this.above[o];!c.strictSide&&(T?m.top-S-y-k.yr.bottom)&&T==r.bottom-m.bottom>m.top-r.top&&(T=this.above[o]=!T);let _=(T?m.top-r.top:r.bottom-m.bottom)-y;if(_C&&q.topE&&(E=T?q.top-S-2-y:q.bottom+y+2);if(this.position=="absolute"?(f.style.top=(E-t.parent.top)/i+"px",wT(f,(C-t.parent.left)/s)):(f.style.top=E/i+"px",wT(f,C/s)),x){let q=m.left+(N?k.x:-k.x)-(C+14-7);x.style.left=q/s+"px"}h.overlap!==!0&&a.push({left:C,top:E,right:M,bottom:E+S}),f.classList.toggle("cm-tooltip-above",T),f.classList.toggle("cm-tooltip-below",!T),h.positioned&&h.positioned(t.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let t of this.manager.tooltipViews)t.dom.style.top=ax}},{eventObservers:{scroll(){this.maybeMeasure()}}});function wT(t,e){let n=parseInt(t.style.left,10);(isNaN(n)||Math.abs(e-n)>1)&&(t.style.left=e+"px")}const Qie=We.baseTheme({".cm-tooltip":{zIndex:500,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),Hie={x:0,y:0},D6=et.define({enables:[R6,Qie]}),B1=et.define({combine:t=>t.reduce((e,n)=>e.concat(n),[])});class Yv{static create(e){return new Yv(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new hB(e,B1,(n,r)=>this.createHostedView(n,r),n=>n.dom.remove())}createHostedView(e,n){let r=e.create(this.view);return r.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(r.dom,n?n.dom.nextSibling:this.dom.firstChild),this.mounted&&r.mount&&r.mount(this.view),r}mount(e){for(let n of this.manager.tooltipViews)n.mount&&n.mount(e);this.mounted=!0}positioned(e){for(let n of this.manager.tooltipViews)n.positioned&&n.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let n of this.manager.tooltipViews)(e=n.destroy)===null||e===void 0||e.call(n)}passProp(e){let n;for(let r of this.manager.tooltipViews){let s=r[e];if(s!==void 0){if(n===void 0)n=s;else if(n!==s)return}}return n}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const Vie=D6.compute([B1],t=>{let e=t.facet(B1);return e.length===0?null:{pos:Math.min(...e.map(n=>n.pos)),end:Math.max(...e.map(n=>{var r;return(r=n.end)!==null&&r!==void 0?r:n.pos})),create:Yv.create,above:e[0].above,arrow:e.some(n=>n.arrow)}});class Uie{constructor(e,n,r,s,i){this.view=e,this.source=n,this.field=r,this.setHover=s,this.hoverTime=i,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let e=Date.now()-this.lastMove.time;eo.bottom||n.xo.right+e.defaultCharacterWidth)return;let c=e.bidiSpans(e.state.doc.lineAt(s)).find(f=>f.from<=s&&f.to>=s),h=c&&c.dir==Jn.RTL?-1:1;i=n.x{this.pending==o&&(this.pending=null,c&&!(Array.isArray(c)&&!c.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(c)?c:[c])}))},c=>Js(e.state,c,"hover tooltip"))}else a&&!(Array.isArray(a)&&!a.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(a)?a:[a])})}get tooltip(){let e=this.view.plugin(R6),n=e?e.manager.tooltips.findIndex(r=>r.create==Yv.create):-1;return n>-1?e.manager.tooltipViews[n]:null}mousemove(e){var n,r;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:s,tooltip:i}=this;if(s.length&&i&&!Wie(i.dom,e)||this.pending){let{pos:a}=s[0]||this.pending,o=(r=(n=s[0])===null||n===void 0?void 0:n.end)!==null&&r!==void 0?r:a;(a==o?this.view.posAtCoords(this.lastMove)!=a:!Gie(this.view,a,o,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:n}=this;if(n.length){let{tooltip:r}=this;r&&r.dom.contains(e.relatedTarget)?this.watchTooltipLeave(r.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let n=r=>{e.removeEventListener("mouseleave",n),this.active.length&&!this.view.dom.contains(r.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",n)}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const lx=4;function Wie(t,e){let{left:n,right:r,top:s,bottom:i}=t.getBoundingClientRect(),a;if(a=t.querySelector(".cm-tooltip-arrow")){let o=a.getBoundingClientRect();s=Math.min(o.top,s),i=Math.max(o.bottom,i)}return e.clientX>=n-lx&&e.clientX<=r+lx&&e.clientY>=s-lx&&e.clientY<=i+lx}function Gie(t,e,n,r,s,i){let a=t.scrollDOM.getBoundingClientRect(),o=t.documentTop+t.documentPadding.top+t.contentHeight;if(a.left>r||a.rights||Math.min(a.bottom,o)=e&&c<=n}function Xie(t,e={}){let n=Mt.define(),r=is.define({create(){return[]},update(s,i){if(s.length&&(e.hideOnChange&&(i.docChanged||i.selection)?s=[]:e.hideOn&&(s=s.filter(a=>!e.hideOn(i,a))),i.docChanged)){let a=[];for(let o of s){let c=i.changes.mapPos(o.pos,-1,fs.TrackDel);if(c!=null){let h=Object.assign(Object.create(null),o);h.pos=c,h.end!=null&&(h.end=i.changes.mapPos(h.end)),a.push(h)}}s=a}for(let a of i.effects)a.is(n)&&(s=a.value),a.is(Yie)&&(s=[]);return s},provide:s=>B1.from(s)});return{active:r,extension:[r,Nr.define(s=>new Uie(s,t,r,n,e.hoverTime||300)),Vie]}}function fB(t,e){let n=t.plugin(R6);if(!n)return null;let r=n.manager.tooltips.indexOf(e);return r<0?null:n.manager.tooltipViews[r]}const Yie=Mt.define(),ST=et.define({combine(t){let e,n;for(let r of t)e=e||r.topContainer,n=n||r.bottomContainer;return{topContainer:e,bottomContainer:n}}});function Km(t,e){let n=t.plugin(mB),r=n?n.specs.indexOf(e):-1;return r>-1?n.panels[r]:null}const mB=Nr.fromClass(class{constructor(t){this.input=t.state.facet(Zm),this.specs=this.input.filter(n=>n),this.panels=this.specs.map(n=>n(t));let e=t.state.facet(ST);this.top=new ox(t,!0,e.topContainer),this.bottom=new ox(t,!1,e.bottomContainer),this.top.sync(this.panels.filter(n=>n.top)),this.bottom.sync(this.panels.filter(n=>!n.top));for(let n of this.panels)n.dom.classList.add("cm-panel"),n.mount&&n.mount()}update(t){let e=t.state.facet(ST);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new ox(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new ox(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=t.state.facet(Zm);if(n!=this.input){let r=n.filter(c=>c),s=[],i=[],a=[],o=[];for(let c of r){let h=this.specs.indexOf(c),f;h<0?(f=c(t.view),o.push(f)):(f=this.panels[h],f.update&&f.update(t)),s.push(f),(f.top?i:a).push(f)}this.specs=r,this.panels=s,this.top.sync(i),this.bottom.sync(a);for(let c of o)c.dom.classList.add("cm-panel"),c.mount&&c.mount()}else for(let r of this.panels)r.update&&r.update(t)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:t=>We.scrollMargins.of(e=>{let n=e.plugin(t);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})});class ox{constructor(e,n,r){this.view=e,this.top=n,this.container=r,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let n of this.panels)n.destroy&&e.indexOf(n)<0&&n.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let n=this.container||this.view.dom;n.insertBefore(this.dom,this.top?n.firstChild:null)}let e=this.dom.firstChild;for(let n of this.panels)if(n.dom.parentNode==this.dom){for(;e!=n.dom;)e=kT(e);e=e.nextSibling}else this.dom.insertBefore(n.dom,e);for(;e;)e=kT(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function kT(t){let e=t.nextSibling;return t.remove(),e}const Zm=et.define({enables:mB});class po extends Tu{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}po.prototype.elementClass="";po.prototype.toDOM=void 0;po.prototype.mapMode=fs.TrackBefore;po.prototype.startSide=po.prototype.endSide=-1;po.prototype.point=!0;const o1=et.define(),Kie=et.define(),Zie={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>bn.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},Mm=et.define();function Jie(t){return[pB(),Mm.of({...Zie,...t})]}const OT=et.define({combine:t=>t.some(e=>e)});function pB(t){return[eae]}const eae=Nr.fromClass(class{constructor(t){this.view=t,this.domAfter=null,this.prevViewport=t.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters cm-gutters-before",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=t.state.facet(Mm).map(e=>new NT(t,e)),this.fixed=!t.state.facet(OT);for(let e of this.gutters)e.config.side=="after"?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),t.scrollDOM.insertBefore(this.dom,t.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement("div"),this.domAfter.className="cm-gutters cm-gutters-after",this.domAfter.setAttribute("aria-hidden","true"),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.domAfter.style.position=this.fixed?"sticky":"",this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}update(t){if(this.updateGutters(t)){let e=this.prevViewport,n=t.view.viewport,r=Math.min(e.to,n.to)-Math.max(e.from,n.from);this.syncGutters(r<(n.to-n.from)*.8)}if(t.geometryChanged){let e=this.view.contentHeight/this.view.scaleY+"px";this.dom.style.minHeight=e,this.domAfter&&(this.domAfter.style.minHeight=e)}this.view.state.facet(OT)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=t.view.viewport}syncGutters(t){let e=this.dom.nextSibling;t&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let n=bn.iter(this.view.state.facet(o1),this.view.viewport.from),r=[],s=this.gutters.map(i=>new tae(i,this.view.viewport,-this.view.documentPadding.top));for(let i of this.view.viewportLineBlocks)if(r.length&&(r=[]),Array.isArray(i.type)){let a=!0;for(let o of i.type)if(o.type==Rs.Text&&a){NS(n,r,o.from);for(let c of s)c.line(this.view,o,r);a=!1}else if(o.widget)for(let c of s)c.widget(this.view,o)}else if(i.type==Rs.Text){NS(n,r,i.from);for(let a of s)a.line(this.view,i,r)}else if(i.widget)for(let a of s)a.widget(this.view,i);for(let i of s)i.finish();t&&(this.view.scrollDOM.insertBefore(this.dom,e),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(t){let e=t.startState.facet(Mm),n=t.state.facet(Mm),r=t.docChanged||t.heightChanged||t.viewportChanged||!bn.eq(t.startState.facet(o1),t.state.facet(o1),t.view.viewport.from,t.view.viewport.to);if(e==n)for(let s of this.gutters)s.update(t)&&(r=!0);else{r=!0;let s=[];for(let i of n){let a=e.indexOf(i);a<0?s.push(new NT(this.view,i)):(this.gutters[a].update(t),s.push(this.gutters[a]))}for(let i of this.gutters)i.dom.remove(),s.indexOf(i)<0&&i.destroy();for(let i of s)i.config.side=="after"?this.getDOMAfter().appendChild(i.dom):this.dom.appendChild(i.dom);this.gutters=s}return r}destroy(){for(let t of this.gutters)t.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:t=>We.scrollMargins.of(e=>{let n=e.plugin(t);if(!n||n.gutters.length==0||!n.fixed)return null;let r=n.dom.offsetWidth*e.scaleX,s=n.domAfter?n.domAfter.offsetWidth*e.scaleX:0;return e.textDirection==Jn.LTR?{left:r,right:s}:{right:r,left:s}})});function jT(t){return Array.isArray(t)?t:[t]}function NS(t,e,n){for(;t.value&&t.from<=n;)t.from==n&&e.push(t.value),t.next()}class tae{constructor(e,n,r){this.gutter=e,this.height=r,this.i=0,this.cursor=bn.iter(e.markers,n.from)}addElement(e,n,r){let{gutter:s}=this,i=(n.top-this.height)/e.scaleY,a=n.height/e.scaleY;if(this.i==s.elements.length){let o=new gB(e,a,i,r);s.elements.push(o),s.dom.appendChild(o.dom)}else s.elements[this.i].update(e,a,i,r);this.height=n.bottom,this.i++}line(e,n,r){let s=[];NS(this.cursor,s,n.from),r.length&&(s=s.concat(r));let i=this.gutter.config.lineMarker(e,n,s);i&&s.unshift(i);let a=this.gutter;s.length==0&&!a.config.renderEmptyElements||this.addElement(e,n,s)}widget(e,n){let r=this.gutter.config.widgetMarker(e,n.widget,n),s=r?[r]:null;for(let i of e.state.facet(Kie)){let a=i(e,n.widget,n);a&&(s||(s=[])).push(a)}s&&this.addElement(e,n,s)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let n=e.elements.pop();e.dom.removeChild(n.dom),n.destroy()}}}class NT{constructor(e,n){this.view=e,this.config=n,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let r in n.domEventHandlers)this.dom.addEventListener(r,s=>{let i=s.target,a;if(i!=this.dom&&this.dom.contains(i)){for(;i.parentNode!=this.dom;)i=i.parentNode;let c=i.getBoundingClientRect();a=(c.top+c.bottom)/2}else a=s.clientY;let o=e.lineBlockAtHeight(a-e.documentTop);n.domEventHandlers[r](e,o,s)&&s.preventDefault()});this.markers=jT(n.markers(e)),n.initialSpacer&&(this.spacer=new gB(e,0,0,[n.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let n=this.markers;if(this.markers=jT(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let s=this.config.updateSpacer(this.spacer.markers[0],e);s!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[s])}let r=e.view.viewport;return!bn.eq(this.markers,n,r.from,r.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class gB{constructor(e,n,r,s){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,n,r,s)}update(e,n,r,s){this.height!=n&&(this.height=n,this.dom.style.height=n+"px"),this.above!=r&&(this.dom.style.marginTop=(this.above=r)?r+"px":""),nae(this.markers,s)||this.setMarkers(e,s)}setMarkers(e,n){let r="cm-gutterElement",s=this.dom.firstChild;for(let i=0,a=0;;){let o=a,c=ii(o,c,h)||a(o,c,h):a}return r}})}});class ww extends po{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function Sw(t,e){return t.state.facet(Wd).formatNumber(e,t.state)}const iae=Mm.compute([Wd],t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(rae)},lineMarker(e,n,r){return r.some(s=>s.toDOM)?null:new ww(Sw(e,e.state.doc.lineAt(n.from).number))},widgetMarker:(e,n,r)=>{for(let s of e.state.facet(sae)){let i=s(e,n,r);if(i)return i}return null},lineMarkerChange:e=>e.startState.facet(Wd)!=e.state.facet(Wd),initialSpacer(e){return new ww(Sw(e,CT(e.state.doc.lines)))},updateSpacer(e,n){let r=Sw(n.view,CT(n.view.state.doc.lines));return r==e.number?e:new ww(r)},domEventHandlers:t.facet(Wd).domEventHandlers,side:"before"}));function aae(t={}){return[Wd.of(t),pB(),iae]}function CT(t){let e=9;for(;e{let e=[],n=-1;for(let r of t.selection.ranges){let s=t.doc.lineAt(r.head).from;s>n&&(n=s,e.push(lae.range(s)))}return bn.of(e)});function cae(){return oae}const xB=1024;let uae=0;class kw{constructor(e,n){this.from=e,this.to=n}}class Ht{constructor(e={}){this.id=uae++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=zs.match(e)),n=>{let r=e(n);return r===void 0?null:[this,r]}}}Ht.closedBy=new Ht({deserialize:t=>t.split(" ")});Ht.openedBy=new Ht({deserialize:t=>t.split(" ")});Ht.group=new Ht({deserialize:t=>t.split(" ")});Ht.isolate=new Ht({deserialize:t=>{if(t&&t!="rtl"&&t!="ltr"&&t!="auto")throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}});Ht.contextHash=new Ht({perNode:!0});Ht.lookAhead=new Ht({perNode:!0});Ht.mounted=new Ht({perNode:!0});class q1{constructor(e,n,r){this.tree=e,this.overlay=n,this.parser=r}static get(e){return e&&e.props&&e.props[Ht.mounted.id]}}const dae=Object.create(null);class zs{constructor(e,n,r,s=0){this.name=e,this.props=n,this.id=r,this.flags=s}static define(e){let n=e.props&&e.props.length?Object.create(null):dae,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),s=new zs(e.name||"",n,e.id,r);if(e.props){for(let i of e.props)if(Array.isArray(i)||(i=i(s)),i){if(i[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");n[i[0].id]=i[1]}}return s}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let n=this.prop(Ht.group);return n?n.indexOf(e)>-1:!1}return this.id==e}static match(e){let n=Object.create(null);for(let r in e)for(let s of r.split(" "))n[s]=e[r];return r=>{for(let s=r.prop(Ht.group),i=-1;i<(s?s.length:0);i++){let a=n[i<0?r.name:s[i]];if(a)return a}}}}zs.none=new zs("",Object.create(null),0,8);class Kv{constructor(e){this.types=e;for(let n=0;n0;for(let c=this.cursor(a|Ur.IncludeAnonymous);;){let h=!1;if(c.from<=i&&c.to>=s&&(!o&&c.type.isAnonymous||n(c)!==!1)){if(c.firstChild())continue;h=!0}for(;h&&r&&(o||!c.type.isAnonymous)&&r(c),!c.nextSibling();){if(!c.parent())return;h=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let n in this.props)e.push([+n,this.props[n]]);return e}balance(e={}){return this.children.length<=8?this:L6(zs.none,this.children,this.positions,0,this.children.length,0,this.length,(n,r,s)=>new Hn(this.type,n,r,s,this.propValues),e.makeTree||((n,r,s)=>new Hn(zs.none,n,r,s)))}static build(e){return pae(e)}}Hn.empty=new Hn(zs.none,[],[],0);class z6{constructor(e,n){this.buffer=e,this.index=n}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new z6(this.buffer,this.index)}}class wc{constructor(e,n,r){this.buffer=e,this.length=n,this.set=r}get type(){return zs.none}toString(){let e=[];for(let n=0;n0));c=a[c+3]);return o}slice(e,n,r){let s=this.buffer,i=new Uint16Array(n-e),a=0;for(let o=e,c=0;o=e&&ne;case 1:return n<=e&&r>e;case 2:return r>e;case 4:return!0}}function Jm(t,e,n,r){for(var s;t.from==t.to||(n<1?t.from>=e:t.from>e)||(n>-1?t.to<=e:t.to0?o.length:-1;e!=h;e+=n){let f=o[e],m=c[e]+a.from;if(vB(s,r,m,m+f.length)){if(f instanceof wc){if(i&Ur.ExcludeBuffers)continue;let g=f.findChild(0,f.buffer.length,n,r-m,s);if(g>-1)return new Ja(new hae(a,f,e,m),null,g)}else if(i&Ur.IncludeAnonymous||!f.type.isAnonymous||P6(f)){let g;if(!(i&Ur.IgnoreMounts)&&(g=q1.get(f))&&!g.overlay)return new si(g.tree,m,e,a);let x=new si(f,m,e,a);return i&Ur.IncludeAnonymous||!x.type.isAnonymous?x:x.nextChild(n<0?f.children.length-1:0,n,r,s)}}}if(i&Ur.IncludeAnonymous||!a.type.isAnonymous||(a.index>=0?e=a.index+n:e=n<0?-1:a._parent._tree.children.length,a=a._parent,!a))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}enter(e,n,r=0){let s;if(!(r&Ur.IgnoreOverlays)&&(s=q1.get(this._tree))&&s.overlay){let i=e-this.from;for(let{from:a,to:o}of s.overlay)if((n>0?a<=i:a=i:o>i))return new si(s.tree,s.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,n,r)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function ET(t,e,n,r){let s=t.cursor(),i=[];if(!s.firstChild())return i;if(n!=null){for(let a=!1;!a;)if(a=s.type.is(n),!s.nextSibling())return i}for(;;){if(r!=null&&s.type.is(r))return i;if(s.type.is(e)&&i.push(s.node),!s.nextSibling())return r==null?i:[]}}function CS(t,e,n=e.length-1){for(let r=t;n>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(e[n]&&e[n]!=r.name)return!1;n--}}return!0}class hae{constructor(e,n,r,s){this.parent=e,this.buffer=n,this.index=r,this.start=s}}class Ja extends yB{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,n,r){super(),this.context=e,this._parent=n,this.index=r,this.type=e.buffer.set.types[e.buffer.buffer[r]]}child(e,n,r){let{buffer:s}=this.context,i=s.findChild(this.index+4,s.buffer[this.index+3],e,n-this.context.start,r);return i<0?null:new Ja(this.context,this,i)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}enter(e,n,r=0){if(r&Ur.ExcludeBuffers)return null;let{buffer:s}=this.context,i=s.findChild(this.index+4,s.buffer[this.index+3],n>0?1:-1,e-this.context.start,n);return i<0?null:new Ja(this.context,this,i)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,n=e.buffer[this.index+3];return n<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new Ja(this.context,this._parent,n):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,n=this._parent?this._parent.index+4:0;return this.index==n?this.externalSibling(-1):new Ja(this.context,this._parent,e.findChild(n,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],n=[],{buffer:r}=this.context,s=this.index+4,i=r.buffer[this.index+3];if(i>s){let a=r.buffer[this.index+1];e.push(r.slice(s,i,a)),n.push(0)}return new Hn(this.type,e,n,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function bB(t){if(!t.length)return null;let e=0,n=t[0];for(let i=1;in.from||a.to=e){let o=new si(a.tree,a.overlay[0].from+i.from,-1,i);(s||(s=[r])).push(Jm(o,e,n,!1))}}return s?bB(s):r}class TS{get name(){return this.type.name}constructor(e,n=0){if(this.mode=n,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof si)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let r=e._parent;r;r=r._parent)this.stack.unshift(r.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,n){this.index=e;let{start:r,buffer:s}=this.buffer;return this.type=n||s.set.types[s.buffer[e]],this.from=r+s.buffer[e+1],this.to=r+s.buffer[e+2],!0}yield(e){return e?e instanceof si?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,n,r){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,n,r,this.mode));let{buffer:s}=this.buffer,i=s.findChild(this.index+4,s.buffer[this.index+3],e,n-this.buffer.start,r);return i<0?!1:(this.stack.push(this.index),this.yieldBuf(i))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,n,r=this.mode){return this.buffer?r&Ur.ExcludeBuffers?!1:this.enterChild(1,e,n):this.yield(this._tree.enter(e,n,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Ur.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&Ur.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:n}=this.buffer,r=this.stack.length-1;if(e<0){let s=r<0?0:this.stack[r]+4;if(this.index!=s)return this.yieldBuf(n.findChild(s,this.index,-1,0,4))}else{let s=n.buffer[this.index+3];if(s<(r<0?n.buffer.length:n.buffer[this.stack[r]+3]))return this.yieldBuf(s)}return r<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let n,r,{buffer:s}=this;if(s){if(e>0){if(this.index-1)for(let i=n+e,a=e<0?-1:r._tree.children.length;i!=a;i+=e){let o=r._tree.children[i];if(this.mode&Ur.IncludeAnonymous||o instanceof wc||!o.type.isAnonymous||P6(o))return!1}return!0}move(e,n){if(n&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,n=0){for(;(this.from==this.to||(n<1?this.from>=e:this.from>e)||(n>-1?this.to<=e:this.to=0;){for(let a=e;a;a=a._parent)if(a.index==s){if(s==this.index)return a;n=a,r=i+1;break e}s=this.stack[--i]}for(let s=r;s=0;i--){if(i<0)return CS(this._tree,e,s);let a=r[n.buffer[this.stack[i]]];if(!a.isAnonymous){if(e[s]&&e[s]!=a.name)return!1;s--}}return!0}}function P6(t){return t.children.some(e=>e instanceof wc||!e.type.isAnonymous||P6(e))}function pae(t){var e;let{buffer:n,nodeSet:r,maxBufferLength:s=xB,reused:i=[],minRepeatType:a=r.types.length}=t,o=Array.isArray(n)?new z6(n,n.length):n,c=r.types,h=0,f=0;function m(_,E,M,q,L,I){let{id:$,start:V,end:ee,size:z}=o,H=f,P=h;if(z<0)if(o.next(),z==-1){let se=i[$];M.push(se),q.push(V-_);return}else if(z==-3){h=$;return}else if(z==-4){f=$;return}else throw new RangeError(`Unrecognized record size: ${z}`);let W=c[$],J,X,R=V-_;if(ee-V<=s&&(X=S(o.pos-E,L))){let se=new Uint16Array(X.size-X.skip),G=o.pos-X.size,F=se.length;for(;o.pos>G;)F=k(X.start,se,F);J=new wc(se,ee-X.start,r),R=X.start-_}else{let se=o.pos-z;o.next();let G=[],F=[],U=$>=a?$:-1,te=0,ne=ee;for(;o.pos>se;)U>=0&&o.id==U&&o.size>=0?(o.end<=ne-s&&(y(G,F,V,te,o.end,ne,U,H,P),te=G.length,ne=o.end),o.next()):I>2500?g(V,se,G,F):m(V,se,G,F,U,I+1);if(U>=0&&te>0&&te-1&&te>0){let Y=x(W,P);J=L6(W,G,F,0,G.length,0,ee-V,Y,Y)}else J=w(W,G,F,ee-V,H-ee,P)}M.push(J),q.push(R)}function g(_,E,M,q){let L=[],I=0,$=-1;for(;o.pos>E;){let{id:V,start:ee,end:z,size:H}=o;if(H>4)o.next();else{if($>-1&&ee<$)break;$<0&&($=z-s),L.push(V,ee,z),I++,o.next()}}if(I){let V=new Uint16Array(I*4),ee=L[L.length-2];for(let z=L.length-3,H=0;z>=0;z-=3)V[H++]=L[z],V[H++]=L[z+1]-ee,V[H++]=L[z+2]-ee,V[H++]=H;M.push(new wc(V,L[2]-ee,r)),q.push(ee-_)}}function x(_,E){return(M,q,L)=>{let I=0,$=M.length-1,V,ee;if($>=0&&(V=M[$])instanceof Hn){if(!$&&V.type==_&&V.length==L)return V;(ee=V.prop(Ht.lookAhead))&&(I=q[$]+V.length+ee)}return w(_,M,q,L,I,E)}}function y(_,E,M,q,L,I,$,V,ee){let z=[],H=[];for(;_.length>q;)z.push(_.pop()),H.push(E.pop()+M-L);_.push(w(r.types[$],z,H,I-L,V-I,ee)),E.push(L-M)}function w(_,E,M,q,L,I,$){if(I){let V=[Ht.contextHash,I];$=$?[V].concat($):[V]}if(L>25){let V=[Ht.lookAhead,L];$=$?[V].concat($):[V]}return new Hn(_,E,M,q,$)}function S(_,E){let M=o.fork(),q=0,L=0,I=0,$=M.end-s,V={size:0,start:0,skip:0};e:for(let ee=M.pos-_;M.pos>ee;){let z=M.size;if(M.id==E&&z>=0){V.size=q,V.start=L,V.skip=I,I+=4,q+=4,M.next();continue}let H=M.pos-z;if(z<0||H=a?4:0,W=M.start;for(M.next();M.pos>H;){if(M.size<0)if(M.size==-3)P+=4;else break e;else M.id>=a&&(P+=4);M.next()}L=W,q+=z,I+=P}return(E<0||q==_)&&(V.size=q,V.start=L,V.skip=I),V.size>4?V:void 0}function k(_,E,M){let{id:q,start:L,end:I,size:$}=o;if(o.next(),$>=0&&q4){let ee=o.pos-($-4);for(;o.pos>ee;)M=k(_,E,M)}E[--M]=V,E[--M]=I-_,E[--M]=L-_,E[--M]=q}else $==-3?h=q:$==-4&&(f=q);return M}let N=[],C=[];for(;o.pos>0;)m(t.start||0,t.bufferStart||0,N,C,-1,0);let T=(e=t.length)!==null&&e!==void 0?e:N.length?C[0]+N[0].length:0;return new Hn(c[t.topID],N.reverse(),C.reverse(),T)}const _T=new WeakMap;function c1(t,e){if(!t.isAnonymous||e instanceof wc||e.type!=t)return 1;let n=_T.get(e);if(n==null){n=1;for(let r of e.children){if(r.type!=t||!(r instanceof Hn)){n=1;break}n+=c1(t,r)}_T.set(e,n)}return n}function L6(t,e,n,r,s,i,a,o,c){let h=0;for(let y=r;y=f)break;E+=M}if(C==T+1){if(E>f){let M=y[T];x(M.children,M.positions,0,M.children.length,w[T]+N);continue}m.push(y[T])}else{let M=w[C-1]+y[C-1].length-_;m.push(L6(t,y,w,T,C,_,M,null,c))}g.push(_+N-i)}}return x(e,n,r,s,0),(o||c)(m,g,a)}class gae{constructor(){this.map=new WeakMap}setBuffer(e,n,r){let s=this.map.get(e);s||this.map.set(e,s=new Map),s.set(n,r)}getBuffer(e,n){let r=this.map.get(e);return r&&r.get(n)}set(e,n){e instanceof Ja?this.setBuffer(e.context.buffer,e.index,n):e instanceof si&&this.map.set(e.tree,n)}get(e){return e instanceof Ja?this.getBuffer(e.context.buffer,e.index):e instanceof si?this.map.get(e.tree):void 0}cursorSet(e,n){e.buffer?this.setBuffer(e.buffer.buffer,e.index,n):this.map.set(e.tree,n)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class Su{constructor(e,n,r,s,i=!1,a=!1){this.from=e,this.to=n,this.tree=r,this.offset=s,this.open=(i?1:0)|(a?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,n=[],r=!1){let s=[new Su(0,e.length,e,0,!1,r)];for(let i of n)i.to>e.length&&s.push(i);return s}static applyChanges(e,n,r=128){if(!n.length)return e;let s=[],i=1,a=e.length?e[0]:null;for(let o=0,c=0,h=0;;o++){let f=o=r)for(;a&&a.from=g.from||m<=g.to||h){let x=Math.max(g.from,c)-h,y=Math.min(g.to,m)-h;g=x>=y?null:new Su(x,y,g.tree,g.offset+h,o>0,!!f)}if(g&&s.push(g),a.to>m)break;a=inew kw(s.from,s.to)):[new kw(0,0)]:[new kw(0,e.length)],this.createParse(e,n||[],r)}parse(e,n,r){let s=this.startParse(e,n,r);for(;;){let i=s.advance();if(i)return i}}};class xae{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,n){return this.string.slice(e,n)}}new Ht({perNode:!0});let vae=0;class Gi{constructor(e,n,r,s){this.name=e,this.set=n,this.base=r,this.modified=s,this.id=vae++}toString(){let{name:e}=this;for(let n of this.modified)n.name&&(e=`${n.name}(${e})`);return e}static define(e,n){let r=typeof e=="string"?e:"?";if(e instanceof Gi&&(n=e),n?.base)throw new Error("Can not derive from a modified tag");let s=new Gi(r,[],null,[]);if(s.set.push(s),n)for(let i of n.set)s.set.push(i);return s}static defineModifier(e){let n=new F1(e);return r=>r.modified.indexOf(n)>-1?r:F1.get(r.base||r,r.modified.concat(n).sort((s,i)=>s.id-i.id))}}let yae=0;class F1{constructor(e){this.name=e,this.instances=[],this.id=yae++}static get(e,n){if(!n.length)return e;let r=n[0].instances.find(o=>o.base==e&&bae(n,o.modified));if(r)return r;let s=[],i=new Gi(e.name,s,e,n);for(let o of n)o.instances.push(i);let a=wae(n);for(let o of e.set)if(!o.modified.length)for(let c of a)s.push(F1.get(o,c));return i}}function bae(t,e){return t.length==e.length&&t.every((n,r)=>n==e[r])}function wae(t){let e=[[]];for(let n=0;nr.length-n.length)}function B6(t){let e=Object.create(null);for(let n in t){let r=t[n];Array.isArray(r)||(r=[r]);for(let s of n.split(" "))if(s){let i=[],a=2,o=s;for(let m=0;;){if(o=="..."&&m>0&&m+3==s.length){a=1;break}let g=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(o);if(!g)throw new RangeError("Invalid path: "+s);if(i.push(g[0]=="*"?"":g[0][0]=='"'?JSON.parse(g[0]):g[0]),m+=g[0].length,m==s.length)break;let x=s[m++];if(m==s.length&&x=="!"){a=0;break}if(x!="/")throw new RangeError("Invalid path: "+s);o=s.slice(m)}let c=i.length-1,h=i[c];if(!h)throw new RangeError("Invalid path: "+s);let f=new e0(r,a,c>0?i.slice(0,c):null);e[h]=f.sort(e[h])}}return wB.add(e)}const wB=new Ht({combine(t,e){let n,r,s;for(;t||e;){if(!t||e&&t.depth>=e.depth?(s=e,e=e.next):(s=t,t=t.next),n&&n.mode==s.mode&&!s.context&&!n.context)continue;let i=new e0(s.tags,s.mode,s.context);n?n.next=i:r=i,n=i}return r}});class e0{constructor(e,n,r,s){this.tags=e,this.mode=n,this.context=r,this.next=s}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth{let a=s;for(let o of i)for(let c of o.set){let h=n[c.id];if(h){a=a?a+" "+h:h;break}}return a},scope:r}}function Sae(t,e){let n=null;for(let r of t){let s=r.style(e);s&&(n=n?n+" "+s:s)}return n}function kae(t,e,n,r=0,s=t.length){let i=new Oae(r,Array.isArray(e)?e:[e],n);i.highlightRange(t.cursor(),r,s,"",i.highlighters),i.flush(s)}class Oae{constructor(e,n,r){this.at=e,this.highlighters=n,this.span=r,this.class=""}startSpan(e,n){n!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=n)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,n,r,s,i){let{type:a,from:o,to:c}=e;if(o>=r||c<=n)return;a.isTop&&(i=this.highlighters.filter(x=>!x.scope||x.scope(a)));let h=s,f=jae(e)||e0.empty,m=Sae(i,f.tags);if(m&&(h&&(h+=" "),h+=m,f.mode==1&&(s+=(s?" ":"")+m)),this.startSpan(Math.max(n,o),h),f.opaque)return;let g=e.tree&&e.tree.prop(Ht.mounted);if(g&&g.overlay){let x=e.node.enter(g.overlay[0].from+o,1),y=this.highlighters.filter(S=>!S.scope||S.scope(g.tree.type)),w=e.firstChild();for(let S=0,k=o;;S++){let N=S=C||!e.nextSibling())););if(!N||C>r)break;k=N.to+o,k>n&&(this.highlightRange(x.cursor(),Math.max(n,N.from+o),Math.min(r,k),"",y),this.startSpan(Math.min(r,k),h))}w&&e.parent()}else if(e.firstChild()){g&&(s="");do if(!(e.to<=n)){if(e.from>=r)break;this.highlightRange(e,n,r,s,i),this.startSpan(Math.min(r,e.to),h)}while(e.nextSibling());e.parent()}}}function jae(t){let e=t.type.prop(wB);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}const Ue=Gi.define,ux=Ue(),ic=Ue(),MT=Ue(ic),AT=Ue(ic),ac=Ue(),dx=Ue(ac),Ow=Ue(ac),Va=Ue(),ru=Ue(Va),Qa=Ue(),Ha=Ue(),ES=Ue(),em=Ue(ES),hx=Ue(),ve={comment:ux,lineComment:Ue(ux),blockComment:Ue(ux),docComment:Ue(ux),name:ic,variableName:Ue(ic),typeName:MT,tagName:Ue(MT),propertyName:AT,attributeName:Ue(AT),className:Ue(ic),labelName:Ue(ic),namespace:Ue(ic),macroName:Ue(ic),literal:ac,string:dx,docString:Ue(dx),character:Ue(dx),attributeValue:Ue(dx),number:Ow,integer:Ue(Ow),float:Ue(Ow),bool:Ue(ac),regexp:Ue(ac),escape:Ue(ac),color:Ue(ac),url:Ue(ac),keyword:Qa,self:Ue(Qa),null:Ue(Qa),atom:Ue(Qa),unit:Ue(Qa),modifier:Ue(Qa),operatorKeyword:Ue(Qa),controlKeyword:Ue(Qa),definitionKeyword:Ue(Qa),moduleKeyword:Ue(Qa),operator:Ha,derefOperator:Ue(Ha),arithmeticOperator:Ue(Ha),logicOperator:Ue(Ha),bitwiseOperator:Ue(Ha),compareOperator:Ue(Ha),updateOperator:Ue(Ha),definitionOperator:Ue(Ha),typeOperator:Ue(Ha),controlOperator:Ue(Ha),punctuation:ES,separator:Ue(ES),bracket:em,angleBracket:Ue(em),squareBracket:Ue(em),paren:Ue(em),brace:Ue(em),content:Va,heading:ru,heading1:Ue(ru),heading2:Ue(ru),heading3:Ue(ru),heading4:Ue(ru),heading5:Ue(ru),heading6:Ue(ru),contentSeparator:Ue(Va),list:Ue(Va),quote:Ue(Va),emphasis:Ue(Va),strong:Ue(Va),link:Ue(Va),monospace:Ue(Va),strikethrough:Ue(Va),inserted:Ue(),deleted:Ue(),changed:Ue(),invalid:Ue(),meta:hx,documentMeta:Ue(hx),annotation:Ue(hx),processingInstruction:Ue(hx),definition:Gi.defineModifier("definition"),constant:Gi.defineModifier("constant"),function:Gi.defineModifier("function"),standard:Gi.defineModifier("standard"),local:Gi.defineModifier("local"),special:Gi.defineModifier("special")};for(let t in ve){let e=ve[t];e instanceof Gi&&(e.name=t)}SB([{tag:ve.link,class:"tok-link"},{tag:ve.heading,class:"tok-heading"},{tag:ve.emphasis,class:"tok-emphasis"},{tag:ve.strong,class:"tok-strong"},{tag:ve.keyword,class:"tok-keyword"},{tag:ve.atom,class:"tok-atom"},{tag:ve.bool,class:"tok-bool"},{tag:ve.url,class:"tok-url"},{tag:ve.labelName,class:"tok-labelName"},{tag:ve.inserted,class:"tok-inserted"},{tag:ve.deleted,class:"tok-deleted"},{tag:ve.literal,class:"tok-literal"},{tag:ve.string,class:"tok-string"},{tag:ve.number,class:"tok-number"},{tag:[ve.regexp,ve.escape,ve.special(ve.string)],class:"tok-string2"},{tag:ve.variableName,class:"tok-variableName"},{tag:ve.local(ve.variableName),class:"tok-variableName tok-local"},{tag:ve.definition(ve.variableName),class:"tok-variableName tok-definition"},{tag:ve.special(ve.variableName),class:"tok-variableName2"},{tag:ve.definition(ve.propertyName),class:"tok-propertyName tok-definition"},{tag:ve.typeName,class:"tok-typeName"},{tag:ve.namespace,class:"tok-namespace"},{tag:ve.className,class:"tok-className"},{tag:ve.macroName,class:"tok-macroName"},{tag:ve.propertyName,class:"tok-propertyName"},{tag:ve.operator,class:"tok-operator"},{tag:ve.comment,class:"tok-comment"},{tag:ve.meta,class:"tok-meta"},{tag:ve.invalid,class:"tok-invalid"},{tag:ve.punctuation,class:"tok-punctuation"}]);var jw;const pu=new Ht;function kB(t){return et.define({combine:t?e=>e.concat(t):void 0})}const Nae=new Ht;class Ki{constructor(e,n,r=[],s=""){this.data=e,this.name=s,an.prototype.hasOwnProperty("tree")||Object.defineProperty(an.prototype,"tree",{get(){return ns(this)}}),this.parser=n,this.extension=[Sc.of(this),an.languageData.of((i,a,o)=>{let c=RT(i,a,o),h=c.type.prop(pu);if(!h)return[];let f=i.facet(h),m=c.type.prop(Nae);if(m){let g=c.resolve(a-c.from,o);for(let x of m)if(x.test(g,i)){let y=i.facet(x.facet);return x.type=="replace"?y:y.concat(f)}}return f})].concat(r)}isActiveAt(e,n,r=-1){return RT(e,n,r).type.prop(pu)==this.data}findRegions(e){let n=e.facet(Sc);if(n?.data==this.data)return[{from:0,to:e.doc.length}];if(!n||!n.allowsNesting)return[];let r=[],s=(i,a)=>{if(i.prop(pu)==this.data){r.push({from:a,to:a+i.length});return}let o=i.prop(Ht.mounted);if(o){if(o.tree.prop(pu)==this.data){if(o.overlay)for(let c of o.overlay)r.push({from:c.from+a,to:c.to+a});else r.push({from:a,to:a+i.length});return}else if(o.overlay){let c=r.length;if(s(o.tree,o.overlay[0].from+a),r.length>c)return}}for(let c=0;cr.isTop?n:void 0)]}),e.name)}configure(e,n){return new t0(this.data,this.parser.configure(e),n||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function ns(t){let e=t.field(Ki.state,!1);return e?e.tree:Hn.empty}class Cae{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,n){let r=this.cursorPos-this.string.length;return e=this.cursorPos?this.doc.sliceString(e,n):this.string.slice(e-r,n-r)}}let tm=null;class kh{constructor(e,n,r=[],s,i,a,o,c){this.parser=e,this.state=n,this.fragments=r,this.tree=s,this.treeLen=i,this.viewport=a,this.skipped=o,this.scheduleOn=c,this.parse=null,this.tempSkipped=[]}static create(e,n,r){return new kh(e,n,[],Hn.empty,0,r,[],null)}startParse(){return this.parser.startParse(new Cae(this.state.doc),this.fragments)}work(e,n){return n!=null&&n>=this.state.doc.length&&(n=void 0),this.tree!=Hn.empty&&this.isDone(n??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var r;if(typeof e=="number"){let s=Date.now()+e;e=()=>Date.now()>s}for(this.parse||(this.parse=this.startParse()),n!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>n)&&n=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(n=this.parse.advance()););}),this.treeLen=e,this.tree=n,this.fragments=this.withoutTempSkipped(Su.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let n=tm;tm=this;try{return e()}finally{tm=n}}withoutTempSkipped(e){for(let n;n=this.tempSkipped.pop();)e=DT(e,n.from,n.to);return e}changes(e,n){let{fragments:r,tree:s,treeLen:i,viewport:a,skipped:o}=this;if(this.takeTree(),!e.empty){let c=[];if(e.iterChangedRanges((h,f,m,g)=>c.push({fromA:h,toA:f,fromB:m,toB:g})),r=Su.applyChanges(r,c),s=Hn.empty,i=0,a={from:e.mapPos(a.from,-1),to:e.mapPos(a.to,1)},this.skipped.length){o=[];for(let h of this.skipped){let f=e.mapPos(h.from,1),m=e.mapPos(h.to,-1);fe.from&&(this.fragments=DT(this.fragments,s,i),this.skipped.splice(r--,1))}return this.skipped.length>=n?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,n){this.skipped.push({from:e,to:n})}static getSkippingParser(e){return new class extends I6{createParse(n,r,s){let i=s[0].from,a=s[s.length-1].to;return{parsedPos:i,advance(){let c=tm;if(c){for(let h of s)c.tempSkipped.push(h);e&&(c.scheduleOn=c.scheduleOn?Promise.all([c.scheduleOn,e]):e)}return this.parsedPos=a,new Hn(zs.none,[],[],a-i)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let n=this.fragments;return this.treeLen>=e&&n.length&&n[0].from==0&&n[0].to>=e}static get(){return tm}}function DT(t,e,n){return Su.applyChanges(t,[{fromA:e,toA:n,fromB:e,toB:n}])}class Oh{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let n=this.context.changes(e.changes,e.state),r=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),n.viewport.to);return n.work(20,r)||n.takeTree(),new Oh(n)}static init(e){let n=Math.min(3e3,e.doc.length),r=kh.create(e.facet(Sc).parser,e,{from:0,to:n});return r.work(20,n)||r.takeTree(),new Oh(r)}}Ki.state=is.define({create:Oh.init,update(t,e){for(let n of e.effects)if(n.is(Ki.setState))return n.value;return e.startState.facet(Sc)!=e.state.facet(Sc)?Oh.init(e.state):t.apply(e)}});let OB=t=>{let e=setTimeout(()=>t(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(OB=t=>{let e=-1,n=setTimeout(()=>{e=requestIdleCallback(t,{timeout:400})},100);return()=>e<0?clearTimeout(n):cancelIdleCallback(e)});const Nw=typeof navigator<"u"&&(!((jw=navigator.scheduling)===null||jw===void 0)&&jw.isInputPending)?()=>navigator.scheduling.isInputPending():null,Tae=Nr.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let n=this.view.state.field(Ki.state).context;(n.updateViewport(e.view.viewport)||this.view.viewport.to>n.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(n)}scheduleWork(){if(this.working)return;let{state:e}=this.view,n=e.field(Ki.state);(n.tree!=n.context.tree||!n.context.isDone(e.doc.length))&&(this.working=OB(this.work))}work(e){this.working=null;let n=Date.now();if(this.chunkEnds+1e3,c=i.context.work(()=>Nw&&Nw()||Date.now()>a,s+(o?0:1e5));this.chunkBudget-=Date.now()-n,(c||this.chunkBudget<=0)&&(i.context.takeTree(),this.view.dispatch({effects:Ki.setState.of(new Oh(i.context))})),this.chunkBudget>0&&!(c&&!o)&&this.scheduleWork(),this.checkAsyncSchedule(i.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(n=>Js(this.view.state,n)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),Sc=et.define({combine(t){return t.length?t[0]:null},enables:t=>[Ki.state,Tae,We.contentAttributes.compute([t],e=>{let n=e.facet(t);return n&&n.name?{"data-language":n.name}:{}})]});class jB{constructor(e,n=[]){this.language=e,this.support=n,this.extension=[e,n]}}const Eae=et.define(),Y0=et.define({combine:t=>{if(!t.length)return" ";let e=t[0];if(!e||/\S/.test(e)||Array.from(e).some(n=>n!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(t[0]));return e}});function Au(t){let e=t.facet(Y0);return e.charCodeAt(0)==9?t.tabSize*e.length:e.length}function n0(t,e){let n="",r=t.tabSize,s=t.facet(Y0)[0];if(s==" "){for(;e>=r;)n+=" ",e-=r;s=" "}for(let i=0;i=e?_ae(t,n,e):null}class Zv{constructor(e,n={}){this.state=e,this.options=n,this.unit=Au(e)}lineAt(e,n=1){let r=this.state.doc.lineAt(e),{simulateBreak:s,simulateDoubleBreak:i}=this.options;return s!=null&&s>=r.from&&s<=r.to?i&&s==e?{text:"",from:e}:(n<0?s-1&&(i+=a-this.countColumn(r,r.search(/\S|$/))),i}countColumn(e,n=e.length){return Fh(e,this.state.tabSize,n)}lineIndent(e,n=1){let{text:r,from:s}=this.lineAt(e,n),i=this.options.overrideIndentation;if(i){let a=i(s);if(a>-1)return a}return this.countColumn(r,r.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const Jv=new Ht;function _ae(t,e,n){let r=e.resolveStack(n),s=e.resolveInner(n,-1).resolve(n,0).enterUnfinishedNodesBefore(n);if(s!=r.node){let i=[];for(let a=s;a&&!(a.fromr.node.to||a.from==r.node.from&&a.type==r.node.type);a=a.parent)i.push(a);for(let a=i.length-1;a>=0;a--)r={node:i[a],next:r}}return NB(r,t,n)}function NB(t,e,n){for(let r=t;r;r=r.next){let s=Aae(r.node);if(s)return s(F6.create(e,n,r))}return 0}function Mae(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}function Aae(t){let e=t.type.prop(Jv);if(e)return e;let n=t.firstChild,r;if(n&&(r=n.type.prop(Ht.closedBy))){let s=t.lastChild,i=s&&r.indexOf(s.name)>-1;return a=>CB(a,!0,1,void 0,i&&!Mae(a)?s.from:void 0)}return t.parent==null?Rae:null}function Rae(){return 0}class F6 extends Zv{constructor(e,n,r){super(e.state,e.options),this.base=e,this.pos=n,this.context=r}get node(){return this.context.node}static create(e,n,r){return new F6(e,n,r)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let n=this.state.doc.lineAt(e.from);for(;;){let r=e.resolve(n.from);for(;r.parent&&r.parent.from==r.from;)r=r.parent;if(Dae(r,e))break;n=this.state.doc.lineAt(r.from)}return this.lineIndent(n.from)}continue(){return NB(this.context.next,this.base,this.pos)}}function Dae(t,e){for(let n=e;n;n=n.parent)if(t==n)return!0;return!1}function zae(t){let e=t.node,n=e.childAfter(e.from),r=e.lastChild;if(!n)return null;let s=t.options.simulateBreak,i=t.state.doc.lineAt(n.from),a=s==null||s<=i.from?i.to:Math.min(i.to,s);for(let o=n.to;;){let c=e.childAfter(o);if(!c||c==r)return null;if(!c.type.isSkipped){if(c.from>=a)return null;let h=/^ */.exec(i.text.slice(n.to-i.from))[0].length;return{from:n.from,to:n.to+h}}o=c.to}}function Cw({closing:t,align:e=!0,units:n=1}){return r=>CB(r,e,n,t)}function CB(t,e,n,r,s){let i=t.textAfter,a=i.match(/^\s*/)[0].length,o=r&&i.slice(a,a+r.length)==r||s==t.pos+a,c=e?zae(t):null;return c?o?t.column(c.from):t.column(c.to):t.baseIndent+(o?0:t.unit*n)}function zT({except:t,units:e=1}={}){return n=>{let r=t&&t.test(n.textAfter);return n.baseIndent+(r?0:e*n.unit)}}const Pae=200;function Lae(){return an.transactionFilter.of(t=>{if(!t.docChanged||!t.isUserEvent("input.type")&&!t.isUserEvent("input.complete"))return t;let e=t.startState.languageDataAt("indentOnInput",t.startState.selection.main.head);if(!e.length)return t;let n=t.newDoc,{head:r}=t.newSelection.main,s=n.lineAt(r);if(r>s.from+Pae)return t;let i=n.sliceString(s.from,r);if(!e.some(h=>h.test(i)))return t;let{state:a}=t,o=-1,c=[];for(let{head:h}of a.selection.ranges){let f=a.doc.lineAt(h);if(f.from==o)continue;o=f.from;let m=q6(a,f.from);if(m==null)continue;let g=/^\s*/.exec(f.text)[0],x=n0(a,m);g!=x&&c.push({from:f.from,to:f.from+g.length,insert:x})}return c.length?[t,{changes:c,sequential:!0}]:t})}const Iae=et.define(),$6=new Ht;function TB(t){let e=t.firstChild,n=t.lastChild;return e&&e.ton)continue;if(i&&o.from=e&&h.to>n&&(i=h)}}return i}function qae(t){let e=t.lastChild;return e&&e.to==t.to&&e.type.isError}function $1(t,e,n){for(let r of t.facet(Iae)){let s=r(t,e,n);if(s)return s}return Bae(t,e,n)}function EB(t,e){let n=e.mapPos(t.from,1),r=e.mapPos(t.to,-1);return n>=r?void 0:{from:n,to:r}}const ey=Mt.define({map:EB}),K0=Mt.define({map:EB});function _B(t){let e=[];for(let{head:n}of t.state.selection.ranges)e.some(r=>r.from<=n&&r.to>=n)||e.push(t.lineBlockAt(n));return e}const Ru=is.define({create(){return ft.none},update(t,e){e.isUserEvent("delete")&&e.changes.iterChangedRanges((n,r)=>t=PT(t,n,r)),t=t.map(e.changes);for(let n of e.effects)if(n.is(ey)&&!Fae(t,n.value.from,n.value.to)){let{preparePlaceholder:r}=e.state.facet(RB),s=r?ft.replace({widget:new Gae(r(e.state,n.value))}):LT;t=t.update({add:[s.range(n.value.from,n.value.to)]})}else n.is(K0)&&(t=t.update({filter:(r,s)=>n.value.from!=r||n.value.to!=s,filterFrom:n.value.from,filterTo:n.value.to}));return e.selection&&(t=PT(t,e.selection.main.head)),t},provide:t=>We.decorations.from(t),toJSON(t,e){let n=[];return t.between(0,e.doc.length,(r,s)=>{n.push(r,s)}),n},fromJSON(t){if(!Array.isArray(t)||t.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let n=0;n{se&&(r=!0)}),r?t.update({filterFrom:e,filterTo:n,filter:(s,i)=>s>=n||i<=e}):t}function Q1(t,e,n){var r;let s=null;return(r=t.field(Ru,!1))===null||r===void 0||r.between(e,n,(i,a)=>{(!s||s.from>i)&&(s={from:i,to:a})}),s}function Fae(t,e,n){let r=!1;return t.between(e,e,(s,i)=>{s==e&&i==n&&(r=!0)}),r}function MB(t,e){return t.field(Ru,!1)?e:e.concat(Mt.appendConfig.of(DB()))}const $ae=t=>{for(let e of _B(t)){let n=$1(t.state,e.from,e.to);if(n)return t.dispatch({effects:MB(t.state,[ey.of(n),AB(t,n)])}),!0}return!1},Qae=t=>{if(!t.state.field(Ru,!1))return!1;let e=[];for(let n of _B(t)){let r=Q1(t.state,n.from,n.to);r&&e.push(K0.of(r),AB(t,r,!1))}return e.length&&t.dispatch({effects:e}),e.length>0};function AB(t,e,n=!0){let r=t.state.doc.lineAt(e.from).number,s=t.state.doc.lineAt(e.to).number;return We.announce.of(`${t.state.phrase(n?"Folded lines":"Unfolded lines")} ${r} ${t.state.phrase("to")} ${s}.`)}const Hae=t=>{let{state:e}=t,n=[];for(let r=0;r{let e=t.state.field(Ru,!1);if(!e||!e.size)return!1;let n=[];return e.between(0,t.state.doc.length,(r,s)=>{n.push(K0.of({from:r,to:s}))}),t.dispatch({effects:n}),!0},Uae=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:$ae},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:Qae},{key:"Ctrl-Alt-[",run:Hae},{key:"Ctrl-Alt-]",run:Vae}],Wae={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},RB=et.define({combine(t){return fl(t,Wae)}});function DB(t){return[Ru,Kae]}function zB(t,e){let{state:n}=t,r=n.facet(RB),s=a=>{let o=t.lineBlockAt(t.posAtDOM(a.target)),c=Q1(t.state,o.from,o.to);c&&t.dispatch({effects:K0.of(c)}),a.preventDefault()};if(r.placeholderDOM)return r.placeholderDOM(t,s,e);let i=document.createElement("span");return i.textContent=r.placeholderText,i.setAttribute("aria-label",n.phrase("folded code")),i.title=n.phrase("unfold"),i.className="cm-foldPlaceholder",i.onclick=s,i}const LT=ft.replace({widget:new class extends ml{toDOM(t){return zB(t,null)}}});class Gae extends ml{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return zB(e,this.value)}}const Xae={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class Tw extends po{constructor(e,n){super(),this.config=e,this.open=n}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let n=document.createElement("span");return n.textContent=this.open?this.config.openText:this.config.closedText,n.title=e.state.phrase(this.open?"Fold line":"Unfold line"),n}}function Yae(t={}){let e={...Xae,...t},n=new Tw(e,!0),r=new Tw(e,!1),s=Nr.fromClass(class{constructor(a){this.from=a.viewport.from,this.markers=this.buildMarkers(a)}update(a){(a.docChanged||a.viewportChanged||a.startState.facet(Sc)!=a.state.facet(Sc)||a.startState.field(Ru,!1)!=a.state.field(Ru,!1)||ns(a.startState)!=ns(a.state)||e.foldingChanged(a))&&(this.markers=this.buildMarkers(a.view))}buildMarkers(a){let o=new fo;for(let c of a.viewportLineBlocks){let h=Q1(a.state,c.from,c.to)?r:$1(a.state,c.from,c.to)?n:null;h&&o.add(c.from,c.from,h)}return o.finish()}}),{domEventHandlers:i}=e;return[s,Jie({class:"cm-foldGutter",markers(a){var o;return((o=a.plugin(s))===null||o===void 0?void 0:o.markers)||bn.empty},initialSpacer(){return new Tw(e,!1)},domEventHandlers:{...i,click:(a,o,c)=>{if(i.click&&i.click(a,o,c))return!0;let h=Q1(a.state,o.from,o.to);if(h)return a.dispatch({effects:K0.of(h)}),!0;let f=$1(a.state,o.from,o.to);return f?(a.dispatch({effects:ey.of(f)}),!0):!1}}}),DB()]}const Kae=We.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class Z0{constructor(e,n){this.specs=e;let r;function s(o){let c=vc.newName();return(r||(r=Object.create(null)))["."+c]=o,c}const i=typeof n.all=="string"?n.all:n.all?s(n.all):void 0,a=n.scope;this.scope=a instanceof Ki?o=>o.prop(pu)==a.data:a?o=>o==a:void 0,this.style=SB(e.map(o=>({tag:o.tag,class:o.class||s(Object.assign({},o,{tag:null}))})),{all:i}).style,this.module=r?new vc(r):null,this.themeType=n.themeType}static define(e,n){return new Z0(e,n||{})}}const _S=et.define(),PB=et.define({combine(t){return t.length?[t[0]]:null}});function Ew(t){let e=t.facet(_S);return e.length?e:t.facet(PB)}function LB(t,e){let n=[Jae],r;return t instanceof Z0&&(t.module&&n.push(We.styleModule.of(t.module)),r=t.themeType),e?.fallback?n.push(PB.of(t)):r?n.push(_S.computeN([We.darkTheme],s=>s.facet(We.darkTheme)==(r=="dark")?[t]:[])):n.push(_S.of(t)),n}class Zae{constructor(e){this.markCache=Object.create(null),this.tree=ns(e.state),this.decorations=this.buildDeco(e,Ew(e.state)),this.decoratedTo=e.viewport.to}update(e){let n=ns(e.state),r=Ew(e.state),s=r!=Ew(e.startState),{viewport:i}=e.view,a=e.changes.mapPos(this.decoratedTo,1);n.length=i.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=a):(n!=this.tree||e.viewportChanged||s)&&(this.tree=n,this.decorations=this.buildDeco(e.view,r),this.decoratedTo=i.to)}buildDeco(e,n){if(!n||!this.tree.length)return ft.none;let r=new fo;for(let{from:s,to:i}of e.visibleRanges)kae(this.tree,n,(a,o,c)=>{r.add(a,o,this.markCache[c]||(this.markCache[c]=ft.mark({class:c})))},s,i);return r.finish()}}const Jae=Mc.high(Nr.fromClass(Zae,{decorations:t=>t.decorations})),ele=Z0.define([{tag:ve.meta,color:"#404740"},{tag:ve.link,textDecoration:"underline"},{tag:ve.heading,textDecoration:"underline",fontWeight:"bold"},{tag:ve.emphasis,fontStyle:"italic"},{tag:ve.strong,fontWeight:"bold"},{tag:ve.strikethrough,textDecoration:"line-through"},{tag:ve.keyword,color:"#708"},{tag:[ve.atom,ve.bool,ve.url,ve.contentSeparator,ve.labelName],color:"#219"},{tag:[ve.literal,ve.inserted],color:"#164"},{tag:[ve.string,ve.deleted],color:"#a11"},{tag:[ve.regexp,ve.escape,ve.special(ve.string)],color:"#e40"},{tag:ve.definition(ve.variableName),color:"#00f"},{tag:ve.local(ve.variableName),color:"#30a"},{tag:[ve.typeName,ve.namespace],color:"#085"},{tag:ve.className,color:"#167"},{tag:[ve.special(ve.variableName),ve.macroName],color:"#256"},{tag:ve.definition(ve.propertyName),color:"#00c"},{tag:ve.comment,color:"#940"},{tag:ve.invalid,color:"#f00"}]),tle=We.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),IB=1e4,BB="()[]{}",qB=et.define({combine(t){return fl(t,{afterCursor:!0,brackets:BB,maxScanDistance:IB,renderMatch:sle})}}),nle=ft.mark({class:"cm-matchingBracket"}),rle=ft.mark({class:"cm-nonmatchingBracket"});function sle(t){let e=[],n=t.matched?nle:rle;return e.push(n.range(t.start.from,t.start.to)),t.end&&e.push(n.range(t.end.from,t.end.to)),e}const ile=is.define({create(){return ft.none},update(t,e){if(!e.docChanged&&!e.selection)return t;let n=[],r=e.state.facet(qB);for(let s of e.state.selection.ranges){if(!s.empty)continue;let i=el(e.state,s.head,-1,r)||s.head>0&&el(e.state,s.head-1,1,r)||r.afterCursor&&(el(e.state,s.head,1,r)||s.headWe.decorations.from(t)}),ale=[ile,tle];function lle(t={}){return[qB.of(t),ale]}const ole=new Ht;function MS(t,e,n){let r=t.prop(e<0?Ht.openedBy:Ht.closedBy);if(r)return r;if(t.name.length==1){let s=n.indexOf(t.name);if(s>-1&&s%2==(e<0?1:0))return[n[s+e]]}return null}function AS(t){let e=t.type.prop(ole);return e?e(t.node):t}function el(t,e,n,r={}){let s=r.maxScanDistance||IB,i=r.brackets||BB,a=ns(t),o=a.resolveInner(e,n);for(let c=o;c;c=c.parent){let h=MS(c.type,n,i);if(h&&c.from0?e>=f.from&&ef.from&&e<=f.to))return cle(t,e,n,c,f,h,i)}}return ule(t,e,n,a,o.type,s,i)}function cle(t,e,n,r,s,i,a){let o=r.parent,c={from:s.from,to:s.to},h=0,f=o?.cursor();if(f&&(n<0?f.childBefore(r.from):f.childAfter(r.to)))do if(n<0?f.to<=r.from:f.from>=r.to){if(h==0&&i.indexOf(f.type.name)>-1&&f.from0)return null;let h={from:n<0?e-1:e,to:n>0?e+1:e},f=t.doc.iterRange(e,n>0?t.doc.length:0),m=0;for(let g=0;!f.next().done&&g<=i;){let x=f.value;n<0&&(g+=x.length);let y=e+g*n;for(let w=n>0?0:x.length-1,S=n>0?x.length:-1;w!=S;w+=n){let k=a.indexOf(x[w]);if(!(k<0||r.resolveInner(y+w,1).type!=s))if(k%2==0==n>0)m++;else{if(m==1)return{start:h,end:{from:y+w,to:y+w+1},matched:k>>1==c>>1};m--}}n>0&&(g+=x.length)}return f.done?{start:h,matched:!1}:null}function IT(t,e,n,r=0,s=0){e==null&&(e=t.search(/[^\s\u00a0]/),e==-1&&(e=t.length));let i=s;for(let a=r;a=this.string.length}sol(){return this.pos==0}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.posn}eatSpace(){let e=this.pos;for(;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e}skipToEnd(){this.pos=this.string.length}skipTo(e){let n=this.string.indexOf(e,this.pos);if(n>-1)return this.pos=n,!0}backUp(e){this.pos-=e}column(){return this.lastColumnPosr?a.toLowerCase():a,i=this.string.substr(this.pos,e.length);return s(i)==s(e)?(n!==!1&&(this.pos+=e.length),!0):null}else{let s=this.string.slice(this.pos).match(e);return s&&s.index>0?null:(s&&n!==!1&&(this.pos+=s[0].length),s)}}current(){return this.string.slice(this.start,this.pos)}}function dle(t){return{name:t.name||"",token:t.token,blankLine:t.blankLine||(()=>{}),startState:t.startState||(()=>!0),copyState:t.copyState||hle,indent:t.indent||(()=>null),languageData:t.languageData||{},tokenTable:t.tokenTable||V6,mergeTokens:t.mergeTokens!==!1}}function hle(t){if(typeof t!="object")return t;let e={};for(let n in t){let r=t[n];e[n]=r instanceof Array?r.slice():r}return e}const BT=new WeakMap;class Q6 extends Ki{constructor(e){let n=kB(e.languageData),r=dle(e),s,i=new class extends I6{createParse(a,o,c){return new mle(s,a,o,c)}};super(n,i,[],e.name),this.topNode=xle(n,this),s=this,this.streamParser=r,this.stateAfter=new Ht({perNode:!0}),this.tokenTable=e.tokenTable?new VB(r.tokenTable):gle}static define(e){return new Q6(e)}getIndent(e){let n,{overrideIndentation:r}=e.options;r&&(n=BT.get(e.state),n!=null&&n1e4)return null;for(;i=r&&n+e.length<=s&&e.prop(t.stateAfter);if(i)return{state:t.streamParser.copyState(i),pos:n+e.length};for(let a=e.children.length-1;a>=0;a--){let o=e.children[a],c=n+e.positions[a],h=o instanceof Hn&&c=e.length)return e;!s&&n==0&&e.type==t.topNode&&(s=!0);for(let i=e.children.length-1;i>=0;i--){let a=e.positions[i],o=e.children[i],c;if(an&&H6(t,i.tree,0-i.offset,n,o),h;if(c&&c.pos<=r&&(h=$B(t,i.tree,n+i.offset,c.pos+i.offset,!1)))return{state:c.state,tree:h}}return{state:t.streamParser.startState(s?Au(s):4),tree:Hn.empty}}let mle=class{constructor(e,n,r,s){this.lang=e,this.input=n,this.fragments=r,this.ranges=s,this.stoppedAt=null,this.chunks=[],this.chunkPos=[],this.chunk=[],this.chunkReused=void 0,this.rangeIndex=0,this.to=s[s.length-1].to;let i=kh.get(),a=s[0].from,{state:o,tree:c}=fle(e,r,a,this.to,i?.state);this.state=o,this.parsedPos=this.chunkStart=a+c.length;for(let h=0;hh.from<=i.viewport.from&&h.to>=i.viewport.from)&&(this.state=this.lang.streamParser.startState(Au(i.state)),i.skipUntilInView(this.parsedPos,i.viewport.from),this.parsedPos=i.viewport.from),this.moveRangeIndex()}advance(){let e=kh.get(),n=this.stoppedAt==null?this.to:Math.min(this.to,this.stoppedAt),r=Math.min(n,this.chunkStart+512);for(e&&(r=Math.min(r,e.viewport.to));this.parsedPos=n?this.finish():e&&this.parsedPos>=e.viewport.to?(e.skipUntilInView(this.parsedPos,n),this.finish()):null}stopAt(e){this.stoppedAt=e}lineAfter(e){let n=this.input.chunk(e);if(this.input.lineChunks)n==` +3.某句话如果已经被回复过,不要重复回复`}),[y,w]=b.useState({emoji_chance:.4,max_reg_num:40,do_replace:!0,check_interval:10,steal_emoji:!0,content_filtration:!1,filtration_prompt:"符合公序良俗"}),[S,k]=b.useState({enable_tool:!0,enable_mood:!1,mood_update_threshold:1,emotion_style:"情绪较为稳定,但遇遇特定事件的时候起伏较大",all_global:!0}),[N,C]=b.useState({api_key:""}),[T,_]=b.useState(!1),[E,M]=b.useState(""),L=[{id:"bot-basic",title:"Bot基础",description:"配置机器人的基本信息",icon:PK},{id:"personality",title:"人格配置",description:"定义机器人的性格和说话风格",icon:az},{id:"emoji",title:"表情包",description:"配置表情包相关设置",icon:i6},{id:"other",title:"其他设置",description:"工具、情绪系统等配置",icon:bu},{id:"siliconflow",title:"API配置",description:"配置硅基流动API密钥",icon:iz}],P=(n+1)/L.length*100;b.useEffect(()=>{(async()=>{try{h(!0);const[X,J,G,R,se]=await Promise.all([cne(),une(),dne(),hne(),fne()]);m(X),x(J),w(G),k(R),C(se)}catch(X){e({title:"加载配置失败",description:X instanceof Error?X.message:"无法加载现有配置,将使用默认值",variant:"destructive"})}finally{h(!1)}})()},[e]);const I=async()=>{o(!0);try{switch(n){case 0:await mne(f);break;case 1:await pne(g);break;case 2:await gne(y);break;case 3:await xne(S);break;case 4:await vne(N);break}return e({title:"保存成功",description:`${L[n].title}配置已保存`}),!0}catch(B){return e({title:"保存失败",description:B instanceof Error?B.message:"未知错误",variant:"destructive"}),!1}finally{o(!1)}},Q=async()=>{await I()&&n{n>0&&r(n-1)},ee=async()=>{i(!0),_(!0);try{if(M("正在保存API配置..."),!await I()){i(!1),_(!1);return}M("正在完成初始化..."),await k9(),M("正在重启麦麦..."),await Uv(),e({title:"配置完成",description:"麦麦正在重启以应用新配置..."}),M("等待麦麦重启完成...");const X=60;let J=0,G=!1;for(;JsetTimeout(R,1e3));try{(await yne()).running&&(G=!0,M("重启成功!正在跳转..."))}catch{J++}}if(!G)throw new Error("重启超时,请手动检查麦麦状态");setTimeout(()=>{t({to:"/"})},1e3)}catch(B){_(!1),e({title:"配置失败",description:B instanceof Error?B.message:"未知错误",variant:"destructive"})}finally{i(!1)}},z=async()=>{try{await k9(),t({to:"/"})}catch(B){e({title:"跳过失败",description:B instanceof Error?B.message:"未知错误",variant:"destructive"})}},H=()=>{switch(n){case 0:return l.jsx(sne,{config:f,onChange:m});case 1:return l.jsx(ine,{config:g,onChange:x});case 2:return l.jsx(ane,{config:y,onChange:w});case 3:return l.jsx(lne,{config:S,onChange:k});case 4:return l.jsx(one,{config:N,onChange:C});default:return null}};return l.jsxs("div",{className:"relative flex min-h-screen flex-col items-center justify-center overflow-hidden bg-gradient-to-br from-primary/5 via-background to-secondary/5 p-4 md:p-6",children:[T&&l.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm",children:l.jsxs("div",{className:"mx-auto flex max-w-md flex-col items-center space-y-6 rounded-lg border bg-card p-8 text-center shadow-lg",children:[l.jsx("div",{className:"flex h-20 w-20 items-center justify-center rounded-full bg-primary/10",children:l.jsx(vc,{className:"h-10 w-10 animate-spin text-primary"})}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("h2",{className:"text-2xl font-bold",children:"正在重启麦麦"}),l.jsx("p",{className:"text-muted-foreground",children:E})]}),l.jsx("div",{className:"w-full",children:l.jsx("div",{className:"h-2 w-full overflow-hidden rounded-full bg-secondary",children:l.jsx("div",{className:"h-full w-full animate-pulse bg-primary",style:{animation:"pulse 1.5s cubic-bezier(0.4, 0, 0.6, 1) infinite"}})})}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"请稍候,这可能需要一分钟..."})]})}),l.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[l.jsx("div",{className:"absolute left-1/4 top-1/4 h-64 w-64 md:h-96 md:w-96 rounded-full bg-primary/5 blur-3xl"}),l.jsx("div",{className:"absolute right-1/4 bottom-1/4 h-64 w-64 md:h-96 md:w-96 rounded-full bg-secondary/5 blur-3xl"})]}),c?l.jsxs("div",{className:"relative z-10 text-center",children:[l.jsx("div",{className:"mx-auto mb-4 flex h-16 w-16 items-center justify-center",children:l.jsx("div",{className:"h-12 w-12 animate-spin rounded-full border-4 border-primary border-t-transparent"})}),l.jsx("p",{className:"text-lg font-medium",children:"加载配置中..."}),l.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:"正在读取现有配置"})]}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"relative z-10 w-full max-w-4xl",children:[l.jsxs("div",{className:"mb-6 md:mb-8 text-center",children:[l.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 md:h-16 md:w-16 items-center justify-center rounded-2xl bg-primary/10",children:l.jsx(zK,{className:"h-6 w-6 md:h-8 md:w-8 text-primary",strokeWidth:2,fill:"none"})}),l.jsx("h1",{className:"mb-2 text-2xl md:text-3xl font-bold",children:"首次配置向导"}),l.jsxs("p",{className:"text-sm md:text-base text-muted-foreground",children:["让我们一起完成 ",S6," 的初始配置"]})]}),l.jsxs("div",{className:"mb-6 md:mb-8",children:[l.jsxs("div",{className:"mb-2 flex items-center justify-between text-xs md:text-sm",children:[l.jsxs("span",{className:"text-muted-foreground",children:["步骤 ",n+1," / ",L.length]}),l.jsxs("span",{className:"font-medium text-primary",children:[Math.round(P),"%"]})]}),l.jsx(H0,{value:P,className:"h-2"})]}),l.jsx("div",{className:"mb-6 md:mb-8 flex justify-between",children:L.map((B,X)=>{const J=B.icon;return l.jsxs("div",{className:ve("flex flex-1 flex-col items-center gap-1 md:gap-2",Xt({to:"/"}),className:"gap-2 w-full sm:w-auto",children:[l.jsx(Fm,{className:"h-4 w-4"}),"返回首页"]}),l.jsxs(de,{size:"lg",variant:"outline",onClick:()=>window.history.back(),className:"gap-2 w-full sm:w-auto",children:[l.jsx(lz,{className:"h-4 w-4"}),"返回上一页"]})]}),l.jsx("div",{className:"mt-12 pt-8 border-t border-border",children:l.jsx("p",{className:"text-sm text-muted-foreground",children:"如果您认为这是一个错误,请联系系统管理员"})})]})})}var xL=["PageUp","PageDown"],vL=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],yL={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},qh="Slider",[U3,wne,Sne]=Cv(qh),[bL]=ha(qh,[Sne]),[kne,Wv]=bL(qh),wL=b.forwardRef((t,e)=>{const{name:n,min:r=0,max:s=100,step:i=1,orientation:a="horizontal",disabled:o=!1,minStepsBetweenThumbs:c=0,defaultValue:h=[r],value:f,onValueChange:m=()=>{},onValueCommit:g=()=>{},inverted:x=!1,form:y,...w}=t,S=b.useRef(new Set),k=b.useRef(0),C=a==="horizontal"?jne:One,[T=[],_]=wo({prop:f,defaultProp:h,onChange:Q=>{[...S.current][k.current]?.focus(),m(Q)}}),E=b.useRef(T);function M(Q){const U=_ne(T,Q);I(Q,U)}function L(Q){I(Q,k.current)}function P(){const Q=E.current[k.current];T[k.current]!==Q&&g(T)}function I(Q,U,{commit:ee}={commit:!1}){const z=Dne(i),H=zne(Math.round((Q-r)/i)*i+r,z),B=Yk(H,[r,s]);_((X=[])=>{const J=Tne(X,B,U);if(Rne(J,c*i)){k.current=J.indexOf(B);const G=String(J)!==String(X);return G&&ee&&g(J),G?J:X}else return X})}return l.jsx(kne,{scope:t.__scopeSlider,name:n,disabled:o,min:r,max:s,valueIndexToChangeRef:k,thumbs:S.current,values:T,orientation:a,form:y,children:l.jsx(U3.Provider,{scope:t.__scopeSlider,children:l.jsx(U3.Slot,{scope:t.__scopeSlider,children:l.jsx(C,{"aria-disabled":o,"data-disabled":o?"":void 0,...w,ref:e,onPointerDown:tt(w.onPointerDown,()=>{o||(E.current=T)}),min:r,max:s,inverted:x,onSlideStart:o?void 0:M,onSlideMove:o?void 0:L,onSlideEnd:o?void 0:P,onHomeKeyDown:()=>!o&&I(r,0,{commit:!0}),onEndKeyDown:()=>!o&&I(s,T.length-1,{commit:!0}),onStepKeyDown:({event:Q,direction:U})=>{if(!o){const H=xL.includes(Q.key)||Q.shiftKey&&vL.includes(Q.key)?10:1,B=k.current,X=T[B],J=i*H*U;I(X+J,B,{commit:!0})}}})})})})});wL.displayName=qh;var[SL,kL]=bL(qh,{startEdge:"left",endEdge:"right",size:"width",direction:1}),jne=b.forwardRef((t,e)=>{const{min:n,max:r,dir:s,inverted:i,onSlideStart:a,onSlideMove:o,onSlideEnd:c,onStepKeyDown:h,...f}=t,[m,g]=b.useState(null),x=Bn(e,C=>g(C)),y=b.useRef(void 0),w=D0(s),S=w==="ltr",k=S&&!i||!S&&i;function N(C){const T=y.current||m.getBoundingClientRect(),_=[0,T.width],M=j6(_,k?[n,r]:[r,n]);return y.current=T,M(C-T.left)}return l.jsx(SL,{scope:t.__scopeSlider,startEdge:k?"left":"right",endEdge:k?"right":"left",direction:k?1:-1,size:"width",children:l.jsx(jL,{dir:w,"data-orientation":"horizontal",...f,ref:x,style:{...f.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:C=>{const T=N(C.clientX);a?.(T)},onSlideMove:C=>{const T=N(C.clientX);o?.(T)},onSlideEnd:()=>{y.current=void 0,c?.()},onStepKeyDown:C=>{const _=yL[k?"from-left":"from-right"].includes(C.key);h?.({event:C,direction:_?-1:1})}})})}),One=b.forwardRef((t,e)=>{const{min:n,max:r,inverted:s,onSlideStart:i,onSlideMove:a,onSlideEnd:o,onStepKeyDown:c,...h}=t,f=b.useRef(null),m=Bn(e,f),g=b.useRef(void 0),x=!s;function y(w){const S=g.current||f.current.getBoundingClientRect(),k=[0,S.height],C=j6(k,x?[r,n]:[n,r]);return g.current=S,C(w-S.top)}return l.jsx(SL,{scope:t.__scopeSlider,startEdge:x?"bottom":"top",endEdge:x?"top":"bottom",size:"height",direction:x?1:-1,children:l.jsx(jL,{"data-orientation":"vertical",...h,ref:m,style:{...h.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:w=>{const S=y(w.clientY);i?.(S)},onSlideMove:w=>{const S=y(w.clientY);a?.(S)},onSlideEnd:()=>{g.current=void 0,o?.()},onStepKeyDown:w=>{const k=yL[x?"from-bottom":"from-top"].includes(w.key);c?.({event:w,direction:k?-1:1})}})})}),jL=b.forwardRef((t,e)=>{const{__scopeSlider:n,onSlideStart:r,onSlideMove:s,onSlideEnd:i,onHomeKeyDown:a,onEndKeyDown:o,onStepKeyDown:c,...h}=t,f=Wv(qh,n);return l.jsx(on.span,{...h,ref:e,onKeyDown:tt(t.onKeyDown,m=>{m.key==="Home"?(a(m),m.preventDefault()):m.key==="End"?(o(m),m.preventDefault()):xL.concat(vL).includes(m.key)&&(c(m),m.preventDefault())}),onPointerDown:tt(t.onPointerDown,m=>{const g=m.target;g.setPointerCapture(m.pointerId),m.preventDefault(),f.thumbs.has(g)?g.focus():r(m)}),onPointerMove:tt(t.onPointerMove,m=>{m.target.hasPointerCapture(m.pointerId)&&s(m)}),onPointerUp:tt(t.onPointerUp,m=>{const g=m.target;g.hasPointerCapture(m.pointerId)&&(g.releasePointerCapture(m.pointerId),i(m))})})}),OL="SliderTrack",NL=b.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,s=Wv(OL,n);return l.jsx(on.span,{"data-disabled":s.disabled?"":void 0,"data-orientation":s.orientation,...r,ref:e})});NL.displayName=OL;var W3="SliderRange",CL=b.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,s=Wv(W3,n),i=kL(W3,n),a=b.useRef(null),o=Bn(e,a),c=s.values.length,h=s.values.map(g=>_L(g,s.min,s.max)),f=c>1?Math.min(...h):0,m=100-Math.max(...h);return l.jsx(on.span,{"data-orientation":s.orientation,"data-disabled":s.disabled?"":void 0,...r,ref:o,style:{...t.style,[i.startEdge]:f+"%",[i.endEdge]:m+"%"}})});CL.displayName=W3;var G3="SliderThumb",TL=b.forwardRef((t,e)=>{const n=wne(t.__scopeSlider),[r,s]=b.useState(null),i=Bn(e,o=>s(o)),a=b.useMemo(()=>r?n().findIndex(o=>o.ref.current===r):-1,[n,r]);return l.jsx(Nne,{...t,ref:i,index:a})}),Nne=b.forwardRef((t,e)=>{const{__scopeSlider:n,index:r,name:s,...i}=t,a=Wv(G3,n),o=kL(G3,n),[c,h]=b.useState(null),f=Bn(e,N=>h(N)),m=c?a.form||!!c.closest("form"):!0,g=qD(c),x=a.values[r],y=x===void 0?0:_L(x,a.min,a.max),w=Ene(r,a.values.length),S=g?.[o.size],k=S?Mne(S,y,o.direction):0;return b.useEffect(()=>{if(c)return a.thumbs.add(c),()=>{a.thumbs.delete(c)}},[c,a.thumbs]),l.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[o.startEdge]:`calc(${y}% + ${k}px)`},children:[l.jsx(U3.ItemSlot,{scope:t.__scopeSlider,children:l.jsx(on.span,{role:"slider","aria-label":t["aria-label"]||w,"aria-valuemin":a.min,"aria-valuenow":x,"aria-valuemax":a.max,"aria-orientation":a.orientation,"data-orientation":a.orientation,"data-disabled":a.disabled?"":void 0,tabIndex:a.disabled?void 0:0,...i,ref:f,style:x===void 0?{display:"none"}:t.style,onFocus:tt(t.onFocus,()=>{a.valueIndexToChangeRef.current=r})})}),m&&l.jsx(EL,{name:s??(a.name?a.name+(a.values.length>1?"[]":""):void 0),form:a.form,value:x},r)]})});TL.displayName=G3;var Cne="RadioBubbleInput",EL=b.forwardRef(({__scopeSlider:t,value:e,...n},r)=>{const s=b.useRef(null),i=Bn(s,r),a=BD(e);return b.useEffect(()=>{const o=s.current;if(!o)return;const c=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(c,"value").set;if(a!==e&&f){const m=new Event("input",{bubbles:!0});f.call(o,e),o.dispatchEvent(m)}},[a,e]),l.jsx(on.input,{style:{display:"none"},...n,ref:i,defaultValue:e})});EL.displayName=Cne;function Tne(t=[],e,n){const r=[...t];return r[n]=e,r.sort((s,i)=>s-i)}function _L(t,e,n){const i=100/(n-e)*(t-e);return Yk(i,[0,100])}function Ene(t,e){return e>2?`Value ${t+1} of ${e}`:e===2?["Minimum","Maximum"][t]:void 0}function _ne(t,e){if(t.length===1)return 0;const n=t.map(s=>Math.abs(s-e)),r=Math.min(...n);return n.indexOf(r)}function Mne(t,e,n){const r=t/2,i=j6([0,50],[0,r]);return(r-i(e)*n)*n}function Ane(t){return t.slice(0,-1).map((e,n)=>t[n+1]-e)}function Rne(t,e){if(e>0){const n=Ane(t);return Math.min(...n)>=e}return!0}function j6(t,e){return n=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const r=(e[1]-e[0])/(t[1]-t[0]);return e[0]+r*(n-t[0])}}function Dne(t){return(String(t).split(".")[1]||"").length}function zne(t,e){const n=Math.pow(10,e);return Math.round(t*n)/n}var ML=wL,Pne=NL,Lne=CL,Ine=TL;const V0=b.forwardRef(({className:t,...e},n)=>l.jsxs(ML,{ref:n,className:ve("relative flex w-full touch-none select-none items-center",t),...e,children:[l.jsx(Pne,{className:"relative h-1.5 w-full grow overflow-hidden rounded-full bg-primary/20",children:l.jsx(Lne,{className:"absolute h-full bg-primary"})}),l.jsx(Ine,{className:"block h-4 w-4 rounded-full border border-primary/50 bg-background shadow transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50"})]}));V0.displayName=ML.displayName;const qt=SK,Ft=kK,It=b.forwardRef(({className:t,children:e,...n},r)=>l.jsxs(HD,{ref:r,className:ve("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...n,children:[e,l.jsx(xK,{asChild:!0,children:l.jsx(Tu,{className:"h-4 w-4 opacity-50"})})]}));It.displayName=HD.displayName;const AL=b.forwardRef(({className:t,...e},n)=>l.jsx(VD,{ref:n,className:ve("flex cursor-default items-center justify-center py-1",t),...e,children:l.jsx($m,{className:"h-4 w-4"})}));AL.displayName=VD.displayName;const RL=b.forwardRef(({className:t,...e},n)=>l.jsx(UD,{ref:n,className:ve("flex cursor-default items-center justify-center py-1",t),...e,children:l.jsx(Tu,{className:"h-4 w-4"})}));RL.displayName=UD.displayName;const Bt=b.forwardRef(({className:t,children:e,position:n="popper",...r},s)=>l.jsx(vK,{children:l.jsxs(WD,{ref:s,className:ve("relative z-[100] max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-hidden rounded-md border border-border bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100 shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-select-content-transform-origin]",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:n,...r,children:[l.jsx(AL,{}),l.jsx(yK,{className:ve("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:e}),l.jsx(RL,{})]})}));Bt.displayName=WD.displayName;const Bne=b.forwardRef(({className:t,...e},n)=>l.jsx(GD,{ref:n,className:ve("px-2 py-1.5 text-sm font-semibold",t),...e}));Bne.displayName=GD.displayName;const De=b.forwardRef(({className:t,children:e,...n},r)=>l.jsxs(XD,{ref:r,className:ve("relative flex w-full cursor-default select-none items-center rounded-sm py-2 pl-2 pr-8 text-sm outline-none bg-white dark:bg-gray-900 hover:bg-gray-100 dark:hover:bg-gray-800 focus:bg-gray-100 dark:focus:bg-gray-800 data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...n,children:[l.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:l.jsx(bK,{children:l.jsx(ol,{className:"h-4 w-4"})})}),l.jsx(wK,{children:e})]}));De.displayName=XD.displayName;const qne=b.forwardRef(({className:t,...e},n)=>l.jsx(YD,{ref:n,className:ve("-mx-1 my-1 h-px bg-muted",t),...e}));qne.displayName=YD.displayName;function Fne(t){const e=$ne(t),n=b.forwardRef((r,s)=>{const{children:i,...a}=r,o=b.Children.toArray(i),c=o.find(Hne);if(c){const h=c.props.children,f=o.map(m=>m===c?b.Children.count(h)>1?b.Children.only(null):b.isValidElement(h)?h.props.children:null:m);return l.jsx(e,{...a,ref:s,children:b.isValidElement(h)?b.cloneElement(h,void 0,f):null})}return l.jsx(e,{...a,ref:s,children:i})});return n.displayName=`${t}.Slot`,n}function $ne(t){const e=b.forwardRef((n,r)=>{const{children:s,...i}=n;if(b.isValidElement(s)){const a=Une(s),o=Vne(i,s.props);return s.type!==b.Fragment&&(o.ref=r?gc(r,a):a),b.cloneElement(s,o)}return b.Children.count(s)>1?b.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var Qne=Symbol("radix.slottable");function Hne(t){return b.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===Qne}function Vne(t,e){const n={...e};for(const r in e){const s=t[r],i=e[r];/^on[A-Z]/.test(r)?s&&i?n[r]=(...o)=>{const c=i(...o);return s(...o),c}:s&&(n[r]=s):r==="style"?n[r]={...s,...i}:r==="className"&&(n[r]=[s,i].filter(Boolean).join(" "))}return{...t,...n}}function Une(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var Gv="Popover",[DL]=ha(Gv,[Rh]),U0=Rh(),[Wne,_c]=DL(Gv),zL=t=>{const{__scopePopover:e,children:n,open:r,defaultOpen:s,onOpenChange:i,modal:a=!1}=t,o=U0(e),c=b.useRef(null),[h,f]=b.useState(!1),[m,g]=wo({prop:r,defaultProp:s??!1,onChange:i,caller:Gv});return l.jsx(Av,{...o,children:l.jsx(Wne,{scope:e,contentId:_i(),triggerRef:c,open:m,onOpenChange:g,onOpenToggle:b.useCallback(()=>g(x=>!x),[g]),hasCustomAnchor:h,onCustomAnchorAdd:b.useCallback(()=>f(!0),[]),onCustomAnchorRemove:b.useCallback(()=>f(!1),[]),modal:a,children:n})})};zL.displayName=Gv;var PL="PopoverAnchor",Gne=b.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=_c(PL,n),i=U0(n),{onCustomAnchorAdd:a,onCustomAnchorRemove:o}=s;return b.useEffect(()=>(a(),()=>o()),[a,o]),l.jsx(Rv,{...i,...r,ref:e})});Gne.displayName=PL;var LL="PopoverTrigger",IL=b.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=_c(LL,n),i=U0(n),a=Bn(e,s.triggerRef),o=l.jsx(on.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":QL(s.open),...r,ref:a,onClick:tt(t.onClick,s.onOpenToggle)});return s.hasCustomAnchor?o:l.jsx(Rv,{asChild:!0,...i,children:o})});IL.displayName=LL;var O6="PopoverPortal",[Xne,Yne]=DL(O6,{forceMount:void 0}),BL=t=>{const{__scopePopover:e,forceMount:n,children:r,container:s}=t,i=_c(O6,e);return l.jsx(Xne,{scope:e,forceMount:n,children:l.jsx(Fs,{present:n||i.open,children:l.jsx(Mv,{asChild:!0,container:s,children:r})})})};BL.displayName=O6;var xh="PopoverContent",qL=b.forwardRef((t,e)=>{const n=Yne(xh,t.__scopePopover),{forceMount:r=n.forceMount,...s}=t,i=_c(xh,t.__scopePopover);return l.jsx(Fs,{present:r||i.open,children:i.modal?l.jsx(Zne,{...s,ref:e}):l.jsx(Jne,{...s,ref:e})})});qL.displayName=xh;var Kne=Fne("PopoverContent.RemoveScroll"),Zne=b.forwardRef((t,e)=>{const n=_c(xh,t.__scopePopover),r=b.useRef(null),s=Bn(e,r),i=b.useRef(!1);return b.useEffect(()=>{const a=r.current;if(a)return KD(a)},[]),l.jsx(ZD,{as:Kne,allowPinchZoom:!0,children:l.jsx(FL,{...t,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:tt(t.onCloseAutoFocus,a=>{a.preventDefault(),i.current||n.triggerRef.current?.focus()}),onPointerDownOutside:tt(t.onPointerDownOutside,a=>{const o=a.detail.originalEvent,c=o.button===0&&o.ctrlKey===!0,h=o.button===2||c;i.current=h},{checkForDefaultPrevented:!1}),onFocusOutside:tt(t.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1})})})}),Jne=b.forwardRef((t,e)=>{const n=_c(xh,t.__scopePopover),r=b.useRef(!1),s=b.useRef(!1);return l.jsx(FL,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{t.onCloseAutoFocus?.(i),i.defaultPrevented||(r.current||n.triggerRef.current?.focus(),i.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:i=>{t.onInteractOutside?.(i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const a=i.target;n.triggerRef.current?.contains(a)&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&s.current&&i.preventDefault()}})}),FL=b.forwardRef((t,e)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:i,disableOutsidePointerEvents:a,onEscapeKeyDown:o,onPointerDownOutside:c,onFocusOutside:h,onInteractOutside:f,...m}=t,g=_c(xh,n),x=U0(n);return JD(),l.jsx(ez,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:i,children:l.jsx(n6,{asChild:!0,disableOutsidePointerEvents:a,onInteractOutside:f,onEscapeKeyDown:o,onPointerDownOutside:c,onFocusOutside:h,onDismiss:()=>g.onOpenChange(!1),children:l.jsx(r6,{"data-state":QL(g.open),role:"dialog",id:g.contentId,...x,...m,ref:e,style:{...m.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)"}})})})}),$L="PopoverClose",ere=b.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=_c($L,n);return l.jsx(on.button,{type:"button",...r,ref:e,onClick:tt(t.onClick,()=>s.onOpenChange(!1))})});ere.displayName=$L;var tre="PopoverArrow",nre=b.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=U0(n);return l.jsx(s6,{...s,...r,ref:e})});nre.displayName=tre;function QL(t){return t?"open":"closed"}var rre=zL,sre=IL,ire=BL,HL=qL;const ul=rre,dl=sre,Ea=b.forwardRef(({className:t,align:e="center",sideOffset:n=4,...r},s)=>l.jsx(ire,{children:l.jsx(HL,{ref:s,align:e,sideOffset:n,className:ve("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none 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 origin-[--radix-popover-content-transform-origin]",t),...r})}));Ea.displayName=HL.displayName;const Mc="/api/webui/config";async function j9(){const e=await(await pt(`${Mc}/bot`)).json();if(!e.success)throw new Error("获取配置数据失败");return e.config}async function th(){const e=await(await pt(`${Mc}/model`)).json();if(!e.success)throw new Error("获取模型配置数据失败");return e.config}async function O9(t){const n=await(await pt(`${Mc}/bot`,{method:"POST",headers:Ct(),body:JSON.stringify(t)})).json();if(!n.success)throw new Error(n.message||"保存配置失败")}async function are(){const e=await(await pt(`${Mc}/bot/raw`)).json();if(!e.success)throw new Error("获取配置源代码失败");return e.content}async function lre(t){const n=await(await pt(`${Mc}/bot/raw`,{method:"POST",headers:Ct(),body:JSON.stringify({raw_content:t})})).json();if(!n.success)throw new Error(n.message||"保存配置失败")}async function R1(t){const n=await(await pt(`${Mc}/model`,{method:"POST",headers:Ct(),body:JSON.stringify(t)})).json();if(!n.success)throw new Error(n.message||"保存配置失败")}async function ore(t,e){const r=await(await pt(`${Mc}/bot/section/${t}`,{method:"POST",headers:Ct(),body:JSON.stringify(e)})).json();if(!r.success)throw new Error(r.message||`保存配置节 ${t} 失败`)}async function X3(t,e){const r=await(await pt(`${Mc}/model/section/${t}`,{method:"POST",headers:Ct(),body:JSON.stringify(e)})).json();if(!r.success)throw new Error(r.message||`保存配置节 ${t} 失败`)}async function cre(t,e="openai",n="/models"){const r=new URLSearchParams({provider_name:t,parser:e,endpoint:n}),s=await pt(`/api/webui/models/list?${r}`);if(!s.ok){const a=await s.json().catch(()=>({}));throw new Error(a.detail||`获取模型列表失败 (${s.status})`)}const i=await s.json();if(!i.success)throw new Error("获取模型列表失败");return i.models}const ure=Ih("relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),Na=b.forwardRef(({className:t,variant:e,...n},r)=>l.jsx("div",{ref:r,role:"alert",className:ve(ure({variant:e}),t),...n}));Na.displayName="Alert";const dre=b.forwardRef(({className:t,...e},n)=>l.jsx("h5",{ref:n,className:ve("mb-1 font-medium leading-none tracking-tight",t),...e}));dre.displayName="AlertTitle";const Ca=b.forwardRef(({className:t,...e},n)=>l.jsx("div",{ref:n,className:ve("text-sm [&_p]:leading-relaxed",t),...e}));Ca.displayName="AlertDescription";function N6({onRestartComplete:t,onRestartFailed:e}){const[n,r]=b.useState(0),[s,i]=b.useState("restarting"),[a,o]=b.useState(0),[c,h]=b.useState(0);b.useEffect(()=>{const g=setInterval(()=>{r(w=>w>=90?w:w+1)},200),x=setInterval(()=>{o(w=>w+1)},1e3),y=setTimeout(()=>{i("checking"),f()},3e3);return()=>{clearInterval(g),clearInterval(x),clearTimeout(y)}},[]);const f=()=>{const x=async()=>{try{if(h(w=>w+1),(await fetch("/api/webui/system/status",{method:"GET",headers:{"Content-Type":"application/json"},signal:AbortSignal.timeout(3e3)})).ok)r(100),i("success"),setTimeout(()=>{t?.()},1500);else throw new Error("Status check failed")}catch{c<60?setTimeout(x,2e3):(i("failed"),e?.())}};x()},m=g=>{const x=Math.floor(g/60),y=g%60;return`${x}:${y.toString().padStart(2,"0")}`};return l.jsx("div",{className:"fixed inset-0 bg-background/95 backdrop-blur-sm z-50 flex items-center justify-center",children:l.jsxs("div",{className:"max-w-md w-full mx-4 space-y-8",children:[l.jsxs("div",{className:"flex flex-col items-center space-y-4",children:[s==="restarting"&&l.jsxs(l.Fragment,{children:[l.jsx(vc,{className:"h-16 w-16 text-primary animate-spin"}),l.jsx("h2",{className:"text-2xl font-bold",children:"正在重启麦麦"}),l.jsx("p",{className:"text-muted-foreground text-center",children:"请稍候,麦麦正在重启中..."})]}),s==="checking"&&l.jsxs(l.Fragment,{children:[l.jsx(vc,{className:"h-16 w-16 text-primary animate-spin"}),l.jsx("h2",{className:"text-2xl font-bold",children:"检查服务状态"}),l.jsxs("p",{className:"text-muted-foreground text-center",children:["等待服务恢复... (尝试 ",c,"/60)"]})]}),s==="success"&&l.jsxs(l.Fragment,{children:[l.jsx(xc,{className:"h-16 w-16 text-green-500"}),l.jsx("h2",{className:"text-2xl font-bold",children:"重启成功"}),l.jsx("p",{className:"text-muted-foreground text-center",children:"正在跳转到登录页面..."})]}),s==="failed"&&l.jsxs(l.Fragment,{children:[l.jsx(Cu,{className:"h-16 w-16 text-destructive"}),l.jsx("h2",{className:"text-2xl font-bold",children:"重启超时"}),l.jsx("p",{className:"text-muted-foreground text-center",children:"服务未能在预期时间内恢复,请手动检查或刷新页面"})]})]}),s!=="failed"&&l.jsxs("div",{className:"space-y-2",children:[l.jsx(H0,{value:n,className:"h-2"}),l.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground",children:[l.jsxs("span",{children:[n,"%"]}),l.jsxs("span",{children:["已用时: ",m(a)]})]})]}),l.jsx("div",{className:"bg-muted/50 rounded-lg p-4 space-y-2",children:l.jsxs("p",{className:"text-sm text-muted-foreground",children:[s==="restarting"&&"🔄 配置已保存,正在重启主程序...",s==="checking"&&"⏳ 正在等待服务恢复,请勿关闭页面...",s==="success"&&"✅ 配置已生效,服务运行正常",s==="failed"&&"⚠️ 如果长时间无响应,请尝试手动重启"]})}),l.jsx("div",{className:"bg-yellow-500/10 border border-yellow-500/50 rounded-lg p-4",children:l.jsxs("p",{className:"text-sm text-yellow-900 dark:text-yellow-100",children:[l.jsx("strong",{children:"⚠️ 重要提示:"})," 由于技术原因,使用重启功能后,将无法再使用 ",l.jsx("code",{className:"px-1 py-0.5 bg-yellow-200 dark:bg-yellow-900 rounded",children:"Ctrl+C"})," 结束程序。如需结束程序,请使用脚本目录下的进程管理脚本。"]})}),s==="failed"&&l.jsxs("div",{className:"flex gap-2",children:[l.jsx("button",{onClick:()=>window.location.reload(),className:"flex-1 px-4 py-2 bg-primary text-primary-foreground rounded-md hover:bg-primary/90",children:"刷新页面"}),l.jsx("button",{onClick:()=>{i("checking"),h(0),f()},className:"flex-1 px-4 py-2 bg-secondary text-secondary-foreground rounded-md hover:bg-secondary/90",children:"重试检测"})]})]})})}let Y3=[],VL=[];(()=>{let t="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,n=0;e>1;if(t=VL[r])e=r+1;else return!0;if(e==n)return!1}}function N9(t){return t>=127462&&t<=127487}const C9=8205;function fre(t,e,n=!0,r=!0){return(n?UL:mre)(t,e,r)}function UL(t,e,n){if(e==t.length)return e;e&&WL(t.charCodeAt(e))&&GL(t.charCodeAt(e-1))&&e--;let r=gw(t,e);for(e+=T9(r);e=0&&N9(gw(t,a));)i++,a-=2;if(i%2==0)break;e+=2}else break}return e}function mre(t,e,n){for(;e>0;){let r=UL(t,e-2,n);if(r=56320&&t<57344}function GL(t){return t>=55296&&t<56320}function T9(t){return t<65536?1:2}class pn{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,n,r){[e,n]=vh(this,e,n);let s=[];return this.decompose(0,e,s,2),r.length&&r.decompose(0,r.length,s,3),this.decompose(n,this.length,s,1),n1.from(s,this.length-(n-e)+r.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,n=this.length){[e,n]=vh(this,e,n);let r=[];return this.decompose(e,n,r,0),n1.from(r,n-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let n=this.scanIdentical(e,1),r=this.length-this.scanIdentical(e,-1),s=new Cm(this),i=new Cm(e);for(let a=n,o=n;;){if(s.next(a),i.next(a),a=0,s.lineBreak!=i.lineBreak||s.done!=i.done||s.value!=i.value)return!1;if(o+=s.value.length,s.done||o>=r)return!0}}iter(e=1){return new Cm(this,e)}iterRange(e,n=this.length){return new XL(this,e,n)}iterLines(e,n){let r;if(e==null)r=this.iter();else{n==null&&(n=this.lines+1);let s=this.line(e).from;r=this.iterRange(s,Math.max(s,n==this.lines+1?this.length:n<=1?0:this.line(n-1).to))}return new YL(r)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?pn.empty:e.length<=32?new Tr(e):n1.from(Tr.split(e,[]))}}class Tr extends pn{constructor(e,n=pre(e)){super(),this.text=e,this.length=n}get lines(){return this.text.length}get children(){return null}lineInner(e,n,r,s){for(let i=0;;i++){let a=this.text[i],o=s+a.length;if((n?r:o)>=e)return new gre(s,o,r,a);s=o+1,r++}}decompose(e,n,r,s){let i=e<=0&&n>=this.length?this:new Tr(E9(this.text,e,n),Math.min(n,this.length)-Math.max(0,e));if(s&1){let a=r.pop(),o=r1(i.text,a.text.slice(),0,i.length);if(o.length<=32)r.push(new Tr(o,a.length+i.length));else{let c=o.length>>1;r.push(new Tr(o.slice(0,c)),new Tr(o.slice(c)))}}else r.push(i)}replace(e,n,r){if(!(r instanceof Tr))return super.replace(e,n,r);[e,n]=vh(this,e,n);let s=r1(this.text,r1(r.text,E9(this.text,0,e)),n),i=this.length+r.length-(n-e);return s.length<=32?new Tr(s,i):n1.from(Tr.split(s,[]),i)}sliceString(e,n=this.length,r=` +`){[e,n]=vh(this,e,n);let s="";for(let i=0,a=0;i<=n&&ae&&a&&(s+=r),ei&&(s+=o.slice(Math.max(0,e-i),n-i)),i=c+1}return s}flatten(e){for(let n of this.text)e.push(n)}scanIdentical(){return 0}static split(e,n){let r=[],s=-1;for(let i of e)r.push(i),s+=i.length+1,r.length==32&&(n.push(new Tr(r,s)),r=[],s=-1);return s>-1&&n.push(new Tr(r,s)),n}}let n1=class qd extends pn{constructor(e,n){super(),this.children=e,this.length=n,this.lines=0;for(let r of e)this.lines+=r.lines}lineInner(e,n,r,s){for(let i=0;;i++){let a=this.children[i],o=s+a.length,c=r+a.lines-1;if((n?c:o)>=e)return a.lineInner(e,n,r,s);s=o+1,r=c+1}}decompose(e,n,r,s){for(let i=0,a=0;a<=n&&i=a){let h=s&((a<=e?1:0)|(c>=n?2:0));a>=e&&c<=n&&!h?r.push(o):o.decompose(e-a,n-a,r,h)}a=c+1}}replace(e,n,r){if([e,n]=vh(this,e,n),r.lines=i&&n<=o){let c=a.replace(e-i,n-i,r),h=this.lines-a.lines+c.lines;if(c.lines>4&&c.lines>h>>6){let f=this.children.slice();return f[s]=c,new qd(f,this.length-(n-e)+r.length)}return super.replace(i,o,c)}i=o+1}return super.replace(e,n,r)}sliceString(e,n=this.length,r=` +`){[e,n]=vh(this,e,n);let s="";for(let i=0,a=0;ie&&i&&(s+=r),ea&&(s+=o.sliceString(e-a,n-a,r)),a=c+1}return s}flatten(e){for(let n of this.children)n.flatten(e)}scanIdentical(e,n){if(!(e instanceof qd))return 0;let r=0,[s,i,a,o]=n>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;s+=n,i+=n){if(s==a||i==o)return r;let c=this.children[s],h=e.children[i];if(c!=h)return r+c.scanIdentical(h,n);r+=c.length+1}}static from(e,n=e.reduce((r,s)=>r+s.length+1,-1)){let r=0;for(let x of e)r+=x.lines;if(r<32){let x=[];for(let y of e)y.flatten(x);return new Tr(x,n)}let s=Math.max(32,r>>5),i=s<<1,a=s>>1,o=[],c=0,h=-1,f=[];function m(x){let y;if(x.lines>i&&x instanceof qd)for(let w of x.children)m(w);else x.lines>a&&(c>a||!c)?(g(),o.push(x)):x instanceof Tr&&c&&(y=f[f.length-1])instanceof Tr&&x.lines+y.lines<=32?(c+=x.lines,h+=x.length+1,f[f.length-1]=new Tr(y.text.concat(x.text),y.length+1+x.length)):(c+x.lines>s&&g(),c+=x.lines,h+=x.length+1,f.push(x))}function g(){c!=0&&(o.push(f.length==1?f[0]:qd.from(f,h)),h=-1,c=f.length=0)}for(let x of e)m(x);return g(),o.length==1?o[0]:new qd(o,n)}};pn.empty=new Tr([""],0);function pre(t){let e=-1;for(let n of t)e+=n.length+1;return e}function r1(t,e,n=0,r=1e9){for(let s=0,i=0,a=!0;i=n&&(c>r&&(o=o.slice(0,r-s)),s0?1:(e instanceof Tr?e.text.length:e.children.length)<<1]}nextInner(e,n){for(this.done=this.lineBreak=!1;;){let r=this.nodes.length-1,s=this.nodes[r],i=this.offsets[r],a=i>>1,o=s instanceof Tr?s.text.length:s.children.length;if(a==(n>0?o:0)){if(r==0)return this.done=!0,this.value="",this;n>0&&this.offsets[r-1]++,this.nodes.pop(),this.offsets.pop()}else if((i&1)==(n>0?0:1)){if(this.offsets[r]+=n,e==0)return this.lineBreak=!0,this.value=` +`,this;e--}else if(s instanceof Tr){let c=s.text[a+(n<0?-1:0)];if(this.offsets[r]+=n,c.length>Math.max(0,e))return this.value=e==0?c:n>0?c.slice(e):c.slice(0,c.length-e),this;e-=c.length}else{let c=s.children[a+(n<0?-1:0)];e>c.length?(e-=c.length,this.offsets[r]+=n):(n<0&&this.offsets[r]--,this.nodes.push(c),this.offsets.push(n>0?1:(c instanceof Tr?c.text.length:c.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class XL{constructor(e,n,r){this.value="",this.done=!1,this.cursor=new Cm(e,n>r?-1:1),this.pos=n>r?e.length:0,this.from=Math.min(n,r),this.to=Math.max(n,r)}nextInner(e,n){if(n<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,n<0?this.pos-this.to:this.from-this.pos);let r=n<0?this.pos-this.from:this.to-this.pos;e>r&&(e=r),r-=e;let{value:s}=this.cursor.next(e);return this.pos+=(s.length+e)*n,this.value=s.length<=r?s:n<0?s.slice(s.length-r):s.slice(0,r),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class YL{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:n,lineBreak:r,value:s}=this.inner.next(e);return n&&this.afterBreak?(this.value="",this.afterBreak=!1):n?(this.done=!0,this.value=""):r?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=s,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(pn.prototype[Symbol.iterator]=function(){return this.iter()},Cm.prototype[Symbol.iterator]=XL.prototype[Symbol.iterator]=YL.prototype[Symbol.iterator]=function(){return this});class gre{constructor(e,n,r,s){this.from=e,this.to=n,this.number=r,this.text=s}get length(){return this.to-this.from}}function vh(t,e,n){return e=Math.max(0,Math.min(t.length,e)),[e,Math.max(e,Math.min(t.length,n))]}function ys(t,e,n=!0,r=!0){return fre(t,e,n,r)}function xre(t){return t>=56320&&t<57344}function vre(t){return t>=55296&&t<56320}function ei(t,e){let n=t.charCodeAt(e);if(!vre(n)||e+1==t.length)return n;let r=t.charCodeAt(e+1);return xre(r)?(n-55296<<10)+(r-56320)+65536:n}function C6(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10)+55296,(t&1023)+56320))}function Za(t){return t<65536?1:2}const K3=/\r\n?|\n/;var vs=(function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t})(vs||(vs={}));class cl{constructor(e){this.sections=e}get length(){let e=0;for(let n=0;ne)return i+(e-s);i+=o}else{if(r!=vs.Simple&&h>=e&&(r==vs.TrackDel&&se||r==vs.TrackBefore&&se))return null;if(h>e||h==e&&n<0&&!o)return e==s||n<0?i:i+c;i+=c}s=h}if(e>s)throw new RangeError(`Position ${e} is out of range for changeset of length ${s}`);return i}touchesRange(e,n=e){for(let r=0,s=0;r=0&&s<=n&&o>=e)return sn?"cover":!0;s=o}return!1}toString(){let e="";for(let n=0;n=0?":"+s:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(n=>typeof n!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new cl(e)}static create(e){return new cl(e)}}class Kr extends cl{constructor(e,n){super(e),this.inserted=n}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return Z3(this,(n,r,s,i,a)=>e=e.replace(s,s+(r-n),a),!1),e}mapDesc(e,n=!1){return J3(this,e,n,!0)}invert(e){let n=this.sections.slice(),r=[];for(let s=0,i=0;s=0){n[s]=o,n[s+1]=a;let c=s>>1;for(;r.length0&&dc(r,n,i.text),i.forward(f),o+=f}let h=e[a++];for(;o>1].toJSON()))}return e}static of(e,n,r){let s=[],i=[],a=0,o=null;function c(f=!1){if(!f&&!s.length)return;ag||m<0||g>n)throw new RangeError(`Invalid change range ${m} to ${g} (in doc of length ${n})`);let y=x?typeof x=="string"?pn.of(x.split(r||K3)):x:pn.empty,w=y.length;if(m==g&&w==0)return;ma&&js(s,m-a,-1),js(s,g-m,w),dc(i,s,y),a=g}}return h(e),c(!o),o}static empty(e){return new Kr(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let n=[],r=[];for(let s=0;so&&typeof a!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(i.length==1)n.push(i[0],0);else{for(;r.length=0&&n<=0&&n==t[s+1]?t[s]+=e:s>=0&&e==0&&t[s]==0?t[s+1]+=n:r?(t[s]+=e,t[s+1]+=n):t.push(e,n)}function dc(t,e,n){if(n.length==0)return;let r=e.length-2>>1;if(r>1])),!(n||a==t.sections.length||t.sections[a+1]<0);)o=t.sections[a++],c=t.sections[a++];e(s,h,i,f,m),s=h,i=f}}}function J3(t,e,n,r=!1){let s=[],i=r?[]:null,a=new Um(t),o=new Um(e);for(let c=-1;;){if(a.done&&o.len||o.done&&a.len)throw new Error("Mismatched change set lengths");if(a.ins==-1&&o.ins==-1){let h=Math.min(a.len,o.len);js(s,h,-1),a.forward(h),o.forward(h)}else if(o.ins>=0&&(a.ins<0||c==a.i||a.off==0&&(o.len=0&&c=0){let h=0,f=a.len;for(;f;)if(o.ins==-1){let m=Math.min(f,o.len);h+=m,f-=m,o.forward(m)}else if(o.ins==0&&o.lenc||a.ins>=0&&a.len>c)&&(o||r.length>h),i.forward2(c),a.forward(c)}}}}class Um{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i>1;return n>=e.length?pn.empty:e[n]}textBit(e){let{inserted:n}=this.set,r=this.i-2>>1;return r>=n.length&&!e?pn.empty:n[r].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class pu{constructor(e,n,r){this.from=e,this.to=n,this.flags=r}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,n=-1){let r,s;return this.empty?r=s=e.mapPos(this.from,n):(r=e.mapPos(this.from,1),s=e.mapPos(this.to,-1)),r==this.from&&s==this.to?this:new pu(r,s,this.flags)}extend(e,n=e){if(e<=this.anchor&&n>=this.anchor)return Ae.range(e,n);let r=Math.abs(e-this.anchor)>Math.abs(n-this.anchor)?e:n;return Ae.range(this.anchor,r)}eq(e,n=!1){return this.anchor==e.anchor&&this.head==e.head&&(!n||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return Ae.range(e.anchor,e.head)}static create(e,n,r){return new pu(e,n,r)}}class Ae{constructor(e,n){this.ranges=e,this.mainIndex=n}map(e,n=-1){return e.empty?this:Ae.create(this.ranges.map(r=>r.map(e,n)),this.mainIndex)}eq(e,n=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let r=0;re.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new Ae(e.ranges.map(n=>pu.fromJSON(n)),e.main)}static single(e,n=e){return new Ae([Ae.range(e,n)],0)}static create(e,n=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let r=0,s=0;se?8:0)|i)}static normalized(e,n=0){let r=e[n];e.sort((s,i)=>s.from-i.from),n=e.indexOf(r);for(let s=1;si.head?Ae.range(c,o):Ae.range(o,c))}}return new Ae(e,n)}}function ZL(t,e){for(let n of t.ranges)if(n.to>e)throw new RangeError("Selection points outside of document")}let T6=0;class nt{constructor(e,n,r,s,i){this.combine=e,this.compareInput=n,this.compare=r,this.isStatic=s,this.id=T6++,this.default=e([]),this.extensions=typeof i=="function"?i(this):i}get reader(){return this}static define(e={}){return new nt(e.combine||(n=>n),e.compareInput||((n,r)=>n===r),e.compare||(e.combine?(n,r)=>n===r:E6),!!e.static,e.enables)}of(e){return new s1([],this,0,e)}compute(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new s1(e,this,1,n)}computeN(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new s1(e,this,2,n)}from(e,n){return n||(n=r=>r),this.compute([e],r=>n(r.field(e)))}}function E6(t,e){return t==e||t.length==e.length&&t.every((n,r)=>n===e[r])}class s1{constructor(e,n,r,s){this.dependencies=e,this.facet=n,this.type=r,this.value=s,this.id=T6++}dynamicSlot(e){var n;let r=this.value,s=this.facet.compareInput,i=this.id,a=e[i]>>1,o=this.type==2,c=!1,h=!1,f=[];for(let m of this.dependencies)m=="doc"?c=!0:m=="selection"?h=!0:(((n=e[m.id])!==null&&n!==void 0?n:1)&1)==0&&f.push(e[m.id]);return{create(m){return m.values[a]=r(m),1},update(m,g){if(c&&g.docChanged||h&&(g.docChanged||g.selection)||eS(m,f)){let x=r(m);if(o?!_9(x,m.values[a],s):!s(x,m.values[a]))return m.values[a]=x,1}return 0},reconfigure:(m,g)=>{let x,y=g.config.address[i];if(y!=null){let w=z1(g,y);if(this.dependencies.every(S=>S instanceof nt?g.facet(S)===m.facet(S):S instanceof us?g.field(S,!1)==m.field(S,!1):!0)||(o?_9(x=r(m),w,s):s(x=r(m),w)))return m.values[a]=w,0}else x=r(m);return m.values[a]=x,1}}}}function _9(t,e,n){if(t.length!=e.length)return!1;for(let r=0;rt[c.id]),s=n.map(c=>c.type),i=r.filter(c=>!(c&1)),a=t[e.id]>>1;function o(c){let h=[];for(let f=0;fr===s),e);return e.provide&&(n.provides=e.provide(n)),n}create(e){let n=e.facet(Kg).find(r=>r.field==this);return(n?.create||this.createF)(e)}slot(e){let n=e[this.id]>>1;return{create:r=>(r.values[n]=this.create(r),1),update:(r,s)=>{let i=r.values[n],a=this.updateF(i,s);return this.compareF(i,a)?0:(r.values[n]=a,1)},reconfigure:(r,s)=>{let i=r.facet(Kg),a=s.facet(Kg),o;return(o=i.find(c=>c.field==this))&&o!=a.find(c=>c.field==this)?(r.values[n]=o.create(r),1):s.config.address[this.id]!=null?(r.values[n]=s.field(this),0):(r.values[n]=this.create(r),1)}}}init(e){return[this,Kg.of({field:this,create:e})]}get extension(){return this}}const du={lowest:4,low:3,default:2,high:1,highest:0};function Zf(t){return e=>new JL(e,t)}const Ac={highest:Zf(du.highest),high:Zf(du.high),default:Zf(du.default),low:Zf(du.low),lowest:Zf(du.lowest)};class JL{constructor(e,n){this.inner=e,this.prec=n}}class Xv{of(e){return new tS(this,e)}reconfigure(e){return Xv.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class tS{constructor(e,n){this.compartment=e,this.inner=n}}class D1{constructor(e,n,r,s,i,a){for(this.base=e,this.compartments=n,this.dynamicSlots=r,this.address=s,this.staticValues=i,this.facets=a,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(e,n,r){let s=[],i=Object.create(null),a=new Map;for(let g of bre(e,n,a))g instanceof us?s.push(g):(i[g.facet.id]||(i[g.facet.id]=[])).push(g);let o=Object.create(null),c=[],h=[];for(let g of s)o[g.id]=h.length<<1,h.push(x=>g.slot(x));let f=r?.config.facets;for(let g in i){let x=i[g],y=x[0].facet,w=f&&f[g]||[];if(x.every(S=>S.type==0))if(o[y.id]=c.length<<1|1,E6(w,x))c.push(r.facet(y));else{let S=y.combine(x.map(k=>k.value));c.push(r&&y.compare(S,r.facet(y))?r.facet(y):S)}else{for(let S of x)S.type==0?(o[S.id]=c.length<<1|1,c.push(S.value)):(o[S.id]=h.length<<1,h.push(k=>S.dynamicSlot(k)));o[y.id]=h.length<<1,h.push(S=>yre(S,y,x))}}let m=h.map(g=>g(o));return new D1(e,a,m,o,c,i)}}function bre(t,e,n){let r=[[],[],[],[],[]],s=new Map;function i(a,o){let c=s.get(a);if(c!=null){if(c<=o)return;let h=r[c].indexOf(a);h>-1&&r[c].splice(h,1),a instanceof tS&&n.delete(a.compartment)}if(s.set(a,o),Array.isArray(a))for(let h of a)i(h,o);else if(a instanceof tS){if(n.has(a.compartment))throw new RangeError("Duplicate use of compartment in extensions");let h=e.get(a.compartment)||a.inner;n.set(a.compartment,h),i(h,o)}else if(a instanceof JL)i(a.inner,a.prec);else if(a instanceof us)r[o].push(a),a.provides&&i(a.provides,o);else if(a instanceof s1)r[o].push(a),a.facet.extensions&&i(a.facet.extensions,du.default);else{let h=a.extension;if(!h)throw new Error(`Unrecognized extension value in extension set (${a}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);i(h,o)}}return i(t,du.default),r.reduce((a,o)=>a.concat(o))}function Tm(t,e){if(e&1)return 2;let n=e>>1,r=t.status[n];if(r==4)throw new Error("Cyclic dependency between fields and/or facets");if(r&2)return r;t.status[n]=4;let s=t.computeSlot(t,t.config.dynamicSlots[n]);return t.status[n]=2|s}function z1(t,e){return e&1?t.config.staticValues[e>>1]:t.values[e>>1]}const eI=nt.define(),nS=nt.define({combine:t=>t.some(e=>e),static:!0}),tI=nt.define({combine:t=>t.length?t[0]:void 0,static:!0}),nI=nt.define(),rI=nt.define(),sI=nt.define(),iI=nt.define({combine:t=>t.length?t[0]:!1});class pl{constructor(e,n){this.type=e,this.value=n}static define(){return new wre}}class wre{of(e){return new pl(this,e)}}class Sre{constructor(e){this.map=e}of(e){return new Lt(this,e)}}class Lt{constructor(e,n){this.type=e,this.value=n}map(e){let n=this.type.map(this.value,e);return n===void 0?void 0:n==this.value?this:new Lt(this.type,n)}is(e){return this.type==e}static define(e={}){return new Sre(e.map||(n=>n))}static mapEffects(e,n){if(!e.length)return e;let r=[];for(let s of e){let i=s.map(n);i&&r.push(i)}return r}}Lt.reconfigure=Lt.define();Lt.appendConfig=Lt.define();class $r{constructor(e,n,r,s,i,a){this.startState=e,this.changes=n,this.selection=r,this.effects=s,this.annotations=i,this.scrollIntoView=a,this._doc=null,this._state=null,r&&ZL(r,n.newLength),i.some(o=>o.type==$r.time)||(this.annotations=i.concat($r.time.of(Date.now())))}static create(e,n,r,s,i,a){return new $r(e,n,r,s,i,a)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let n of this.annotations)if(n.type==e)return n.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let n=this.annotation($r.userEvent);return!!(n&&(n==e||n.length>e.length&&n.slice(0,e.length)==e&&n[e.length]=="."))}}$r.time=pl.define();$r.userEvent=pl.define();$r.addToHistory=pl.define();$r.remote=pl.define();function kre(t,e){let n=[];for(let r=0,s=0;;){let i,a;if(r=t[r]))i=t[r++],a=t[r++];else if(s=0;s--){let i=r[s](t);i instanceof $r?t=i:Array.isArray(i)&&i.length==1&&i[0]instanceof $r?t=i[0]:t=lI(e,nh(i),!1)}return t}function Ore(t){let e=t.startState,n=e.facet(sI),r=t;for(let s=n.length-1;s>=0;s--){let i=n[s](t);i&&Object.keys(i).length&&(r=aI(r,rS(e,i,t.changes.newLength),!0))}return r==t?t:$r.create(e,t.changes,t.selection,r.effects,r.annotations,r.scrollIntoView)}const Nre=[];function nh(t){return t==null?Nre:Array.isArray(t)?t:[t]}var ar=(function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t})(ar||(ar={}));const Cre=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let sS;try{sS=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function Tre(t){if(sS)return sS.test(t);for(let e=0;e"€"&&(n.toUpperCase()!=n.toLowerCase()||Cre.test(n)))return!0}return!1}function Ere(t){return e=>{if(!/\S/.test(e))return ar.Space;if(Tre(e))return ar.Word;for(let n=0;n-1)return ar.Word;return ar.Other}}class dn{constructor(e,n,r,s,i,a){this.config=e,this.doc=n,this.selection=r,this.values=s,this.status=e.statusTemplate.slice(),this.computeSlot=i,a&&(a._state=this);for(let o=0;os.set(h,c)),n=null),s.set(o.value.compartment,o.value.extension)):o.is(Lt.reconfigure)?(n=null,r=o.value):o.is(Lt.appendConfig)&&(n=null,r=nh(r).concat(o.value));let i;n?i=e.startState.values.slice():(n=D1.resolve(r,s,this),i=new dn(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(c,h)=>h.reconfigure(c,this),null).values);let a=e.startState.facet(nS)?e.newSelection:e.newSelection.asSingle();new dn(n,e.newDoc,a,i,(o,c)=>c.update(o,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:e},range:Ae.cursor(n.from+e.length)}))}changeByRange(e){let n=this.selection,r=e(n.ranges[0]),s=this.changes(r.changes),i=[r.range],a=nh(r.effects);for(let o=1;oa.spec.fromJSON(o,c)))}}return dn.create({doc:e.doc,selection:Ae.fromJSON(e.selection),extensions:n.extensions?s.concat([n.extensions]):s})}static create(e={}){let n=D1.resolve(e.extensions||[],new Map),r=e.doc instanceof pn?e.doc:pn.of((e.doc||"").split(n.staticFacet(dn.lineSeparator)||K3)),s=e.selection?e.selection instanceof Ae?e.selection:Ae.single(e.selection.anchor,e.selection.head):Ae.single(0);return ZL(s,r.length),n.staticFacet(nS)||(s=s.asSingle()),new dn(n,r,s,n.dynamicSlots.map(()=>null),(i,a)=>a.create(i),null)}get tabSize(){return this.facet(dn.tabSize)}get lineBreak(){return this.facet(dn.lineSeparator)||` +`}get readOnly(){return this.facet(iI)}phrase(e,...n){for(let r of this.facet(dn.phrases))if(Object.prototype.hasOwnProperty.call(r,e)){e=r[e];break}return n.length&&(e=e.replace(/\$(\$|\d*)/g,(r,s)=>{if(s=="$")return"$";let i=+(s||1);return!i||i>n.length?r:n[i-1]})),e}languageDataAt(e,n,r=-1){let s=[];for(let i of this.facet(eI))for(let a of i(this,n,r))Object.prototype.hasOwnProperty.call(a,e)&&s.push(a[e]);return s}charCategorizer(e){return Ere(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:n,from:r,length:s}=this.doc.lineAt(e),i=this.charCategorizer(e),a=e-r,o=e-r;for(;a>0;){let c=ys(n,a,!1);if(i(n.slice(c,a))!=ar.Word)break;a=c}for(;ot.length?t[0]:4});dn.lineSeparator=tI;dn.readOnly=iI;dn.phrases=nt.define({compare(t,e){let n=Object.keys(t),r=Object.keys(e);return n.length==r.length&&n.every(s=>t[s]==e[s])}});dn.languageData=eI;dn.changeFilter=nI;dn.transactionFilter=rI;dn.transactionExtender=sI;Xv.reconfigure=Lt.define();function gl(t,e,n={}){let r={};for(let s of t)for(let i of Object.keys(s)){let a=s[i],o=r[i];if(o===void 0)r[i]=a;else if(!(o===a||a===void 0))if(Object.hasOwnProperty.call(n,i))r[i]=n[i](o,a);else throw new Error("Config merge conflict for field "+i)}for(let s in e)r[s]===void 0&&(r[s]=e[s]);return r}class _u{eq(e){return this==e}range(e,n=e){return iS.create(e,n,this)}}_u.prototype.startSide=_u.prototype.endSide=0;_u.prototype.point=!1;_u.prototype.mapMode=vs.TrackDel;let iS=class oI{constructor(e,n,r){this.from=e,this.to=n,this.value=r}static create(e,n,r){return new oI(e,n,r)}};function aS(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}class _6{constructor(e,n,r,s){this.from=e,this.to=n,this.value=r,this.maxPoint=s}get length(){return this.to[this.to.length-1]}findIndex(e,n,r,s=0){let i=r?this.to:this.from;for(let a=s,o=i.length;;){if(a==o)return a;let c=a+o>>1,h=i[c]-e||(r?this.value[c].endSide:this.value[c].startSide)-n;if(c==a)return h>=0?a:o;h>=0?o=c:a=c+1}}between(e,n,r,s){for(let i=this.findIndex(n,-1e9,!0),a=this.findIndex(r,1e9,!1,i);ix||g==x&&h.startSide>0&&h.endSide<=0)continue;(x-g||h.endSide-h.startSide)<0||(a<0&&(a=g),h.point&&(o=Math.max(o,x-g)),r.push(h),s.push(g-a),i.push(x-a))}return{mapped:r.length?new _6(s,i,r,o):null,pos:a}}}class On{constructor(e,n,r,s){this.chunkPos=e,this.chunk=n,this.nextLayer=r,this.maxPoint=s}static create(e,n,r,s){return new On(e,n,r,s)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let n of this.chunk)e+=n.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:n=[],sort:r=!1,filterFrom:s=0,filterTo:i=this.length}=e,a=e.filter;if(n.length==0&&!a)return this;if(r&&(n=n.slice().sort(aS)),this.isEmpty)return n.length?On.of(n):this;let o=new cI(this,null,-1).goto(0),c=0,h=[],f=new fo;for(;o.value||c=0){let m=n[c++];f.addInner(m.from,m.to,m.value)||h.push(m)}else o.rangeIndex==1&&o.chunkIndexthis.chunkEnd(o.chunkIndex)||io.to||i=i&&e<=i+a.length&&a.between(i,e-i,n-i,r)===!1)return}this.nextLayer.between(e,n,r)}}iter(e=0){return Wm.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,n=0){return Wm.from(e).goto(n)}static compare(e,n,r,s,i=-1){let a=e.filter(m=>m.maxPoint>0||!m.isEmpty&&m.maxPoint>=i),o=n.filter(m=>m.maxPoint>0||!m.isEmpty&&m.maxPoint>=i),c=M9(a,o,r),h=new Jf(a,c,i),f=new Jf(o,c,i);r.iterGaps((m,g,x)=>A9(h,m,f,g,x,s)),r.empty&&r.length==0&&A9(h,0,f,0,0,s)}static eq(e,n,r=0,s){s==null&&(s=999999999);let i=e.filter(f=>!f.isEmpty&&n.indexOf(f)<0),a=n.filter(f=>!f.isEmpty&&e.indexOf(f)<0);if(i.length!=a.length)return!1;if(!i.length)return!0;let o=M9(i,a),c=new Jf(i,o,0).goto(r),h=new Jf(a,o,0).goto(r);for(;;){if(c.to!=h.to||!lS(c.active,h.active)||c.point&&(!h.point||!c.point.eq(h.point)))return!1;if(c.to>s)return!0;c.next(),h.next()}}static spans(e,n,r,s,i=-1){let a=new Jf(e,null,i).goto(n),o=n,c=a.openStart;for(;;){let h=Math.min(a.to,r);if(a.point){let f=a.activeForPoint(a.to),m=a.pointFromo&&(s.span(o,h,a.active,c),c=a.openEnd(h));if(a.to>r)return c+(a.point&&a.to>r?1:0);o=a.to,a.next()}}static of(e,n=!1){let r=new fo;for(let s of e instanceof iS?[e]:n?_re(e):e)r.add(s.from,s.to,s.value);return r.finish()}static join(e){if(!e.length)return On.empty;let n=e[e.length-1];for(let r=e.length-2;r>=0;r--)for(let s=e[r];s!=On.empty;s=s.nextLayer)n=new On(s.chunkPos,s.chunk,n,Math.max(s.maxPoint,n.maxPoint));return n}}On.empty=new On([],[],null,-1);function _re(t){if(t.length>1)for(let e=t[0],n=1;n0)return t.slice().sort(aS);e=r}return t}On.empty.nextLayer=On.empty;class fo{finishChunk(e){this.chunks.push(new _6(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,n,r){this.addInner(e,n,r)||(this.nextLayer||(this.nextLayer=new fo)).add(e,n,r)}addInner(e,n,r){let s=e-this.lastTo||r.startSide-this.last.endSide;if(s<=0&&(e-this.lastFrom||r.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return s<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(n-this.chunkStart),this.last=r,this.lastFrom=e,this.lastTo=n,this.value.push(r),r.point&&(this.maxPoint=Math.max(this.maxPoint,n-e)),!0)}addChunk(e,n){if((e-this.lastTo||n.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,n.maxPoint),this.chunks.push(n),this.chunkPos.push(e);let r=n.value.length-1;return this.last=n.value[r],this.lastFrom=n.from[r]+e,this.lastTo=n.to[r]+e,!0}finish(){return this.finishInner(On.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let n=On.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,n}}function M9(t,e,n){let r=new Map;for(let i of t)for(let a=0;a=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex=r&&s.push(new cI(a,n,r,i));return s.length==1?s[0]:new Wm(s)}get startSide(){return this.value?this.value.startSide:0}goto(e,n=-1e9){for(let r of this.heap)r.goto(e,n);for(let r=this.heap.length>>1;r>=0;r--)xw(this.heap,r);return this.next(),this}forward(e,n){for(let r of this.heap)r.forward(e,n);for(let r=this.heap.length>>1;r>=0;r--)xw(this.heap,r);(this.to-e||this.value.endSide-n)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),xw(this.heap,0)}}}function xw(t,e){for(let n=t[e];;){let r=(e<<1)+1;if(r>=t.length)break;let s=t[r];if(r+1=0&&(s=t[r+1],r++),n.compare(s)<0)break;t[r]=n,t[e]=s,e=r}}class Jf{constructor(e,n,r){this.minPoint=r,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=Wm.from(e,n,r)}goto(e,n=-1e9){return this.cursor.goto(e,n),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=n,this.openStart=-1,this.next(),this}forward(e,n){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-n)<0;)this.removeActive(this.minActive);this.cursor.forward(e,n)}removeActive(e){Zg(this.active,e),Zg(this.activeTo,e),Zg(this.activeRank,e),this.minActive=R9(this.active,this.activeTo)}addActive(e){let n=0,{value:r,to:s,rank:i}=this.cursor;for(;n0;)n++;Jg(this.active,n,r),Jg(this.activeTo,n,s),Jg(this.activeRank,n,i),e&&Jg(e,n,this.cursor.from),this.minActive=R9(this.active,this.activeTo)}next(){let e=this.to,n=this.point;this.point=null;let r=this.openStart<0?[]:null;for(;;){let s=this.minActive;if(s>-1&&(this.activeTo[s]-this.cursor.from||this.active[s].endSide-this.cursor.startSide)<0){if(this.activeTo[s]>e){this.to=this.activeTo[s],this.endSide=this.active[s].endSide;break}this.removeActive(s),r&&Zg(r,s)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let i=this.cursor.value;if(!i.point)this.addActive(r),this.cursor.next();else if(n&&this.cursor.to==this.to&&this.cursor.from=0&&r[s]=0&&!(this.activeRank[r]e||this.activeTo[r]==e&&this.active[r].endSide>=this.point.endSide)&&n.push(this.active[r]);return n.reverse()}openEnd(e){let n=0;for(let r=this.activeTo.length-1;r>=0&&this.activeTo[r]>e;r--)n++;return n}}function A9(t,e,n,r,s,i){t.goto(e),n.goto(r);let a=r+s,o=r,c=r-e;for(;;){let h=t.to+c-n.to,f=h||t.endSide-n.endSide,m=f<0?t.to+c:n.to,g=Math.min(m,a);if(t.point||n.point?t.point&&n.point&&(t.point==n.point||t.point.eq(n.point))&&lS(t.activeForPoint(t.to),n.activeForPoint(n.to))||i.comparePoint(o,g,t.point,n.point):g>o&&!lS(t.active,n.active)&&i.compareRange(o,g,t.active,n.active),m>a)break;(h||t.openEnd!=n.openEnd)&&i.boundChange&&i.boundChange(m),o=m,f<=0&&t.next(),f>=0&&n.next()}}function lS(t,e){if(t.length!=e.length)return!1;for(let n=0;n=e;r--)t[r+1]=t[r];t[e]=n}function R9(t,e){let n=-1,r=1e9;for(let s=0;s=e)return s;if(s==t.length)break;i+=t.charCodeAt(s)==9?n-i%n:1,s=ys(t,s)}return r===!0?-1:t.length}const cS="ͼ",D9=typeof Symbol>"u"?"__"+cS:Symbol.for(cS),uS=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),z9=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class yc{constructor(e,n){this.rules=[];let{finish:r}=n||{};function s(a){return/^@/.test(a)?[a]:a.split(/,\s*/)}function i(a,o,c,h){let f=[],m=/^@(\w+)\b/.exec(a[0]),g=m&&m[1]=="keyframes";if(m&&o==null)return c.push(a[0]+";");for(let x in o){let y=o[x];if(/&/.test(x))i(x.split(/,\s*/).map(w=>a.map(S=>w.replace(/&/,S))).reduce((w,S)=>w.concat(S)),y,c);else if(y&&typeof y=="object"){if(!m)throw new RangeError("The value of a property ("+x+") should be a primitive value.");i(s(x),y,f,g)}else y!=null&&f.push(x.replace(/_.*/,"").replace(/[A-Z]/g,w=>"-"+w.toLowerCase())+": "+y+";")}(f.length||g)&&c.push((r&&!m&&!h?a.map(r):a).join(", ")+" {"+f.join(" ")+"}")}for(let a in e)i(s(a),e[a],this.rules)}getRules(){return this.rules.join(` +`)}static newName(){let e=z9[D9]||1;return z9[D9]=e+1,cS+e.toString(36)}static mount(e,n,r){let s=e[uS],i=r&&r.nonce;s?i&&s.setNonce(i):s=new Mre(e,i),s.mount(Array.isArray(n)?n:[n],e)}}let P9=new Map;class Mre{constructor(e,n){let r=e.ownerDocument||e,s=r.defaultView;if(!e.head&&e.adoptedStyleSheets&&s.CSSStyleSheet){let i=P9.get(r);if(i)return e[uS]=i;this.sheet=new s.CSSStyleSheet,P9.set(r,this)}else this.styleTag=r.createElement("style"),n&&this.styleTag.setAttribute("nonce",n);this.modules=[],e[uS]=this}mount(e,n){let r=this.sheet,s=0,i=0;for(let a=0;a-1&&(this.modules.splice(c,1),i--,c=-1),c==-1){if(this.modules.splice(i++,0,o),r)for(let h=0;h",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Are=typeof navigator<"u"&&/Mac/.test(navigator.platform),Rre=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var xs=0;xs<10;xs++)bc[48+xs]=bc[96+xs]=String(xs);for(var xs=1;xs<=24;xs++)bc[xs+111]="F"+xs;for(var xs=65;xs<=90;xs++)bc[xs]=String.fromCharCode(xs+32),Gm[xs]=String.fromCharCode(xs);for(var vw in bc)Gm.hasOwnProperty(vw)||(Gm[vw]=bc[vw]);function Dre(t){var e=Are&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||Rre&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?Gm:bc)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}function Wn(){var t=arguments[0];typeof t=="string"&&(t=document.createElement(t));var e=1,n=arguments[1];if(n&&typeof n=="object"&&n.nodeType==null&&!Array.isArray(n)){for(var r in n)if(Object.prototype.hasOwnProperty.call(n,r)){var s=n[r];typeof s=="string"?t.setAttribute(r,s):s!=null&&(t[r]=s)}e++}for(;e2);var Je={mac:I9||/Mac/.test(Ds.platform),windows:/Win/.test(Ds.platform),linux:/Linux|X11/.test(Ds.platform),ie:Yv,ie_version:dI?dS.documentMode||6:fS?+fS[1]:hS?+hS[1]:0,gecko:L9,gecko_version:L9?+(/Firefox\/(\d+)/.exec(Ds.userAgent)||[0,0])[1]:0,chrome:!!yw,chrome_version:yw?+yw[1]:0,ios:I9,android:/Android\b/.test(Ds.userAgent),webkit_version:zre?+(/\bAppleWebKit\/(\d+)/.exec(Ds.userAgent)||[0,0])[1]:0,safari:mS,safari_version:mS?+(/\bVersion\/(\d+(\.\d+)?)/.exec(Ds.userAgent)||[0,0])[1]:0,tabSize:dS.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function Xm(t){let e;return t.nodeType==11?e=t.getSelection?t:t.ownerDocument:e=t,e.getSelection()}function pS(t,e){return e?t==e||t.contains(e.nodeType!=1?e.parentNode:e):!1}function i1(t,e){if(!e.anchorNode)return!1;try{return pS(t,e.anchorNode)}catch{return!1}}function yh(t){return t.nodeType==3?Au(t,0,t.nodeValue.length).getClientRects():t.nodeType==1?t.getClientRects():[]}function Em(t,e,n,r){return n?B9(t,e,n,r,-1)||B9(t,e,n,r,1):!1}function Mu(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e}function P1(t){return t.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}function B9(t,e,n,r,s){for(;;){if(t==n&&e==r)return!0;if(e==(s<0?0:hl(t))){if(t.nodeName=="DIV")return!1;let i=t.parentNode;if(!i||i.nodeType!=1)return!1;e=Mu(t)+(s<0?0:1),t=i}else if(t.nodeType==1){if(t=t.childNodes[e+(s<0?-1:0)],t.nodeType==1&&t.contentEditable=="false")return!1;e=s<0?hl(t):0}else return!1}}function hl(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function W0(t,e){let n=e?t.left:t.right;return{left:n,right:n,top:t.top,bottom:t.bottom}}function Pre(t){let e=t.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}function hI(t,e){let n=e.width/t.offsetWidth,r=e.height/t.offsetHeight;return(n>.995&&n<1.005||!isFinite(n)||Math.abs(e.width-t.offsetWidth)<1)&&(n=1),(r>.995&&r<1.005||!isFinite(r)||Math.abs(e.height-t.offsetHeight)<1)&&(r=1),{scaleX:n,scaleY:r}}function Lre(t,e,n,r,s,i,a,o){let c=t.ownerDocument,h=c.defaultView||window;for(let f=t,m=!1;f&&!m;)if(f.nodeType==1){let g,x=f==c.body,y=1,w=1;if(x)g=Pre(h);else{if(/^(fixed|sticky)$/.test(getComputedStyle(f).position)&&(m=!0),f.scrollHeight<=f.clientHeight&&f.scrollWidth<=f.clientWidth){f=f.assignedSlot||f.parentNode;continue}let N=f.getBoundingClientRect();({scaleX:y,scaleY:w}=hI(f,N)),g={left:N.left,right:N.left+f.clientWidth*y,top:N.top,bottom:N.top+f.clientHeight*w}}let S=0,k=0;if(s=="nearest")e.top0&&e.bottom>g.bottom+k&&(k=e.bottom-g.bottom+a)):e.bottom>g.bottom&&(k=e.bottom-g.bottom+a,n<0&&e.top-k0&&e.right>g.right+S&&(S=e.right-g.right+i)):e.right>g.right&&(S=e.right-g.right+i,n<0&&e.leftg.bottom||e.leftg.right)&&(e={left:Math.max(e.left,g.left),right:Math.min(e.right,g.right),top:Math.max(e.top,g.top),bottom:Math.min(e.bottom,g.bottom)}),f=f.assignedSlot||f.parentNode}else if(f.nodeType==11)f=f.host;else break}function Ire(t){let e=t.ownerDocument,n,r;for(let s=t.parentNode;s&&!(s==e.body||n&&r);)if(s.nodeType==1)!r&&s.scrollHeight>s.clientHeight&&(r=s),!n&&s.scrollWidth>s.clientWidth&&(n=s),s=s.assignedSlot||s.parentNode;else if(s.nodeType==11)s=s.host;else break;return{x:n,y:r}}class Bre{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:n,focusNode:r}=e;this.set(n,Math.min(e.anchorOffset,n?hl(n):0),r,Math.min(e.focusOffset,r?hl(r):0))}set(e,n,r,s){this.anchorNode=e,this.anchorOffset=n,this.focusNode=r,this.focusOffset=s}}let ou=null;Je.safari&&Je.safari_version>=26&&(ou=!1);function fI(t){if(t.setActive)return t.setActive();if(ou)return t.focus(ou);let e=[];for(let n=t;n&&(e.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(t.focus(ou==null?{get preventScroll(){return ou={preventScroll:!0},!0}}:void 0),!ou){ou=!1;for(let n=0;nMath.max(1,t.scrollHeight-t.clientHeight-4)}function gI(t,e){for(let n=t,r=e;;){if(n.nodeType==3&&r>0)return{node:n,offset:r};if(n.nodeType==1&&r>0){if(n.contentEditable=="false")return null;n=n.childNodes[r-1],r=hl(n)}else if(n.parentNode&&!P1(n))r=Mu(n),n=n.parentNode;else return null}}function xI(t,e){for(let n=t,r=e;;){if(n.nodeType==3&&rn)return m.domBoundsAround(e,n,h);if(g>=e&&s==-1&&(s=c,i=h),h>n&&m.dom.parentNode==this.dom){a=c,o=f;break}f=g,h=g+m.breakAfter}return{from:i,to:o<0?r+this.length:o,startDOM:(s?this.children[s-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:a=0?this.children[a].dom:null}}markDirty(e=!1){this.flags|=2,this.markParentsDirty(e)}markParentsDirty(e){for(let n=this.parent;n;n=n.parent){if(e&&(n.flags|=2),n.flags&1)return;n.flags|=1,e=!1}}setParent(e){this.parent!=e&&(this.parent=e,this.flags&7&&this.markParentsDirty(!0))}setDOM(e){this.dom!=e&&(this.dom&&(this.dom.cmView=null),this.dom=e,e.cmView=this)}get rootView(){for(let e=this;;){let n=e.parent;if(!n)return e;e=n}}replaceChildren(e,n,r=M6){this.markDirty();for(let s=e;sthis.pos||e==this.pos&&(n>0||this.i==0||this.children[this.i-1].breakAfter))return this.off=e-this.pos,this;let r=this.children[--this.i];this.pos-=r.length+r.breakAfter}}}function yI(t,e,n,r,s,i,a,o,c){let{children:h}=t,f=h.length?h[e]:null,m=i.length?i[i.length-1]:null,g=m?m.breakAfter:a;if(!(e==r&&f&&!a&&!g&&i.length<2&&f.merge(n,s,i.length?m:null,n==0,o,c))){if(r0&&(!a&&i.length&&f.merge(n,f.length,i[0],!1,o,0)?f.breakAfter=i.shift().breakAfter:(n$re||r.flags&8)?!1:(this.text=this.text.slice(0,e)+(r?r.text:"")+this.text.slice(n),this.markDirty(),!0)}split(e){let n=new _a(this.text.slice(e));return this.text=this.text.slice(0,e),this.markDirty(),n.flags|=this.flags&8,n}localPosFromDOM(e,n){return e==this.dom?n:n?this.text.length:0}domAtPos(e){return new Cs(this.dom,e)}domBoundsAround(e,n,r){return{from:r,to:r+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(e,n){return Qre(this.dom,e,n)}}class mo extends Qn{constructor(e,n=[],r=0){super(),this.mark=e,this.children=n,this.length=r;for(let s of n)s.setParent(this)}setAttrs(e){if(mI(e),this.mark.class&&(e.className=this.mark.class),this.mark.attrs)for(let n in this.mark.attrs)e.setAttribute(n,this.mark.attrs[n]);return e}canReuseDOM(e){return super.canReuseDOM(e)&&!((this.flags|e.flags)&8)}reuseDOM(e){e.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(e),this.flags|=6)}sync(e,n){this.dom?this.flags&4&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(e,n)}merge(e,n,r,s,i,a){return r&&(!(r instanceof mo&&r.mark.eq(this.mark))||e&&i<=0||ne&&n.push(r=e&&(s=i),r=c,i++}let a=this.length-e;return this.length=e,s>-1&&(this.children.length=s,this.markDirty()),new mo(this.mark,n,a)}domAtPos(e){return wI(this,e)}coordsAt(e,n){return kI(this,e,n)}}function Qre(t,e,n){let r=t.nodeValue.length;e>r&&(e=r);let s=e,i=e,a=0;e==0&&n<0||e==r&&n>=0?Je.chrome||Je.gecko||(e?(s--,a=1):i=0)?0:o.length-1];return Je.safari&&!a&&c.width==0&&(c=Array.prototype.find.call(o,h=>h.width)||c),a?W0(c,a<0):c||null}class ro extends Qn{static create(e,n,r){return new ro(e,n,r)}constructor(e,n,r){super(),this.widget=e,this.length=n,this.side=r,this.prevWidget=null}split(e){let n=ro.create(this.widget,this.length-e,this.side);return this.length-=e,n}sync(e){(!this.dom||!this.widget.updateDOM(this.dom,e))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.widget.editable||(this.dom.contentEditable="false"))}getSide(){return this.side}merge(e,n,r,s,i,a){return r&&(!(r instanceof ro)||!this.widget.compare(r.widget)||e>0&&i<=0||n0)?Cs.before(this.dom):Cs.after(this.dom,e==this.length)}domBoundsAround(){return null}coordsAt(e,n){let r=this.widget.coordsAt(this.dom,e,n);if(r)return r;let s=this.dom.getClientRects(),i=null;if(!s.length)return null;let a=this.side?this.side<0:e>0;for(let o=a?s.length-1:0;i=s[o],!(e>0?o==0:o==s.length-1||i.top0?Cs.before(this.dom):Cs.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(e){return this.dom.getBoundingClientRect()}get overrideDOMText(){return pn.empty}get isHidden(){return!0}}_a.prototype.children=ro.prototype.children=bh.prototype.children=M6;function wI(t,e){let n=t.dom,{children:r}=t,s=0;for(let i=0;si&&e0;i--){let a=r[i-1];if(a.dom.parentNode==n)return a.domAtPos(a.length)}for(let i=s;i0&&e instanceof mo&&s.length&&(r=s[s.length-1])instanceof mo&&r.mark.eq(e.mark)?SI(r,e.children[0],n-1):(s.push(e),e.setParent(t)),t.length+=e.length}function kI(t,e,n){let r=null,s=-1,i=null,a=-1;function o(h,f){for(let m=0,g=0;m=f&&(x.children.length?o(x,f-g):(!i||i.isHidden&&(n>0||Vre(i,x)))&&(y>f||g==y&&x.getSide()>0)?(i=x,a=f-g):(g-1?1:0)!=s.length-(n&&s.indexOf(n)>-1?1:0))return!1;for(let i of r)if(i!=n&&(s.indexOf(i)==-1||t[i]!==e[i]))return!1;return!0}function xS(t,e,n){let r=!1;if(e)for(let s in e)n&&s in n||(r=!0,s=="style"?t.style.cssText="":t.removeAttribute(s));if(n)for(let s in n)e&&e[s]==n[s]||(r=!0,s=="style"?t.style.cssText=n[s]:t.setAttribute(s,n[s]));return r}function Ure(t){let e=Object.create(null);for(let n=0;n0?3e8:-4e8:n>0?1e8:-1e8,new wc(e,n,n,r,e.widget||null,!1)}static replace(e){let n=!!e.block,r,s;if(e.isBlockGap)r=-5e8,s=4e8;else{let{start:i,end:a}=jI(e,n);r=(i?n?-3e8:-1:5e8)-1,s=(a?n?2e8:1:-6e8)+1}return new wc(e,r,s,n,e.widget||null,!0)}static line(e){return new X0(e)}static set(e,n=!1){return On.of(e,n)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}xt.none=On.empty;class G0 extends xt{constructor(e){let{start:n,end:r}=jI(e);super(n?-1:5e8,r?1:-6e8,null,e),this.tagName=e.tagName||"span",this.class=e.class||"",this.attrs=e.attributes||null}eq(e){var n,r;return this==e||e instanceof G0&&this.tagName==e.tagName&&(this.class||((n=this.attrs)===null||n===void 0?void 0:n.class))==(e.class||((r=e.attrs)===null||r===void 0?void 0:r.class))&&L1(this.attrs,e.attrs,"class")}range(e,n=e){if(e>=n)throw new RangeError("Mark decorations may not be empty");return super.range(e,n)}}G0.prototype.point=!1;class X0 extends xt{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof X0&&this.spec.class==e.spec.class&&L1(this.spec.attributes,e.spec.attributes)}range(e,n=e){if(n!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,n)}}X0.prototype.mapMode=vs.TrackBefore;X0.prototype.point=!0;class wc extends xt{constructor(e,n,r,s,i,a){super(n,r,i,e),this.block=s,this.isReplace=a,this.mapMode=s?n<=0?vs.TrackBefore:vs.TrackAfter:vs.TrackDel}get type(){return this.startSide!=this.endSide?Is.WidgetRange:this.startSide<=0?Is.WidgetBefore:Is.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof wc&&Wre(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,n=e){if(this.isReplace&&(e>n||e==n&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&n!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,n)}}wc.prototype.point=!0;function jI(t,e=!1){let{inclusiveStart:n,inclusiveEnd:r}=t;return n==null&&(n=t.inclusive),r==null&&(r=t.inclusive),{start:n??e,end:r??e}}function Wre(t,e){return t==e||!!(t&&e&&t.compare(e))}function a1(t,e,n,r=0){let s=n.length-1;s>=0&&n[s]+r>=t?n[s]=Math.max(n[s],e):n.push(t,e)}class qr extends Qn{constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(e,n,r,s,i,a){if(r){if(!(r instanceof qr))return!1;this.dom||r.transferDOM(this)}return s&&this.setDeco(r?r.attrs:null),bI(this,e,n,r?r.children.slice():[],i,a),!0}split(e){let n=new qr;if(n.breakAfter=this.breakAfter,this.length==0)return n;let{i:r,off:s}=this.childPos(e);s&&(n.append(this.children[r].split(s),0),this.children[r].merge(s,this.children[r].length,null,!1,0,0),r++);for(let i=r;i0&&this.children[r-1].length==0;)this.children[--r].destroy();return this.children.length=r,this.markDirty(),this.length=e,n}transferDOM(e){this.dom&&(this.markDirty(),e.setDOM(this.dom),e.prevAttrs=this.prevAttrs===void 0?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(e){L1(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,n){SI(this,e,n)}addLineDeco(e){let n=e.spec.attributes,r=e.spec.class;n&&(this.attrs=gS(n,this.attrs||{})),r&&(this.attrs=gS({class:r},this.attrs||{}))}domAtPos(e){return wI(this,e)}reuseDOM(e){e.nodeName=="DIV"&&(this.setDOM(e),this.flags|=6)}sync(e,n){var r;this.dom?this.flags&4&&(mI(this.dom),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0):(this.setDOM(document.createElement("div")),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0),this.prevAttrs!==void 0&&(xS(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(e,n);let s=this.dom.lastChild;for(;s&&Qn.get(s)instanceof mo;)s=s.lastChild;if(!s||!this.length||s.nodeName!="BR"&&((r=Qn.get(s))===null||r===void 0?void 0:r.isEditable)==!1&&(!Je.ios||!this.children.some(i=>i instanceof _a))){let i=document.createElement("BR");i.cmIgnore=!0,this.dom.appendChild(i)}}measureTextSize(){if(this.children.length==0||this.length>20)return null;let e=0,n;for(let r of this.children){if(!(r instanceof _a)||/[^ -~]/.test(r.text))return null;let s=yh(r.dom);if(s.length!=1)return null;e+=s[0].width,n=s[0].height}return e?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:e/this.length,textHeight:n}:null}coordsAt(e,n){let r=kI(this,e,n);if(!this.children.length&&r&&this.parent){let{heightOracle:s}=this.parent.view.viewState,i=r.bottom-r.top;if(Math.abs(i-s.lineHeight)<2&&s.textHeight=n){if(i instanceof qr)return i;if(a>n)break}s=a+i.breakAfter}return null}}class oo extends Qn{constructor(e,n,r){super(),this.widget=e,this.length=n,this.deco=r,this.breakAfter=0,this.prevWidget=null}merge(e,n,r,s,i,a){return r&&(!(r instanceof oo)||!this.widget.compare(r.widget)||e>0&&i<=0||n0}}class vS extends xl{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}class _m{constructor(e,n,r,s){this.doc=e,this.pos=n,this.end=r,this.disallowBlockEffectsFor=s,this.content=[],this.curLine=null,this.breakAtStart=0,this.pendingBuffer=0,this.bufferMarks=[],this.atCursorPos=!0,this.openStart=-1,this.openEnd=-1,this.text="",this.textOff=0,this.cursor=e.iter(),this.skip=n}posCovered(){if(this.content.length==0)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;let e=this.content[this.content.length-1];return!(e.breakAfter||e instanceof oo&&e.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new qr),this.atCursorPos=!0),this.curLine}flushBuffer(e=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(ex(new bh(-1),e),e.length),this.pendingBuffer=0)}addBlockWidget(e){this.flushBuffer(),this.curLine=null,this.content.push(e)}finish(e){this.pendingBuffer&&e<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,!this.posCovered()&&!(e&&this.content.length&&this.content[this.content.length-1]instanceof oo)&&this.getLine()}buildText(e,n,r){for(;e>0;){if(this.textOff==this.text.length){let{value:a,lineBreak:o,done:c}=this.cursor.next(this.skip);if(this.skip=0,c)throw new Error("Ran out of text content when drawing inline views");if(o){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.flushBuffer(),this.curLine=null,this.atCursorPos=!0,e--;continue}else this.text=a,this.textOff=0}let s=Math.min(this.text.length-this.textOff,e),i=Math.min(s,512);this.flushBuffer(n.slice(n.length-r)),this.getLine().append(ex(new _a(this.text.slice(this.textOff,this.textOff+i)),n),r),this.atCursorPos=!0,this.textOff+=i,e-=i,r=s<=i?0:n.length}}span(e,n,r,s){this.buildText(n-e,r,s),this.pos=n,this.openStart<0&&(this.openStart=s)}point(e,n,r,s,i,a){if(this.disallowBlockEffectsFor[a]&&r instanceof wc){if(r.block)throw new RangeError("Block decorations may not be specified via plugins");if(n>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let o=n-e;if(r instanceof wc)if(r.block)r.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new oo(r.widget||wh.block,o,r));else{let c=ro.create(r.widget||wh.inline,o,o?0:r.startSide),h=this.atCursorPos&&!c.isEditable&&i<=s.length&&(e0),f=!c.isEditable&&(es.length||r.startSide<=0),m=this.getLine();this.pendingBuffer==2&&!h&&!c.isEditable&&(this.pendingBuffer=0),this.flushBuffer(s),h&&(m.append(ex(new bh(1),s),i),i=s.length+Math.max(0,i-s.length)),m.append(ex(c,s),i),this.atCursorPos=f,this.pendingBuffer=f?es.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=s.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(r);o&&(this.textOff+o<=this.text.length?this.textOff+=o:(this.skip+=o-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=n),this.openStart<0&&(this.openStart=i)}static build(e,n,r,s,i){let a=new _m(e,n,r,i);return a.openEnd=On.spans(s,n,r,a),a.openStart<0&&(a.openStart=a.openEnd),a.finish(a.openEnd),a}}function ex(t,e){for(let n of e)t=new mo(n,[t],t.length);return t}class wh extends xl{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}wh.inline=new wh("span");wh.block=new wh("div");var sr=(function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t})(sr||(sr={}));const Ru=sr.LTR,A6=sr.RTL;function OI(t){let e=[];for(let n=0;n=n){if(o.level==r)return a;(i<0||(s!=0?s<0?o.fromn:e[i].level>o.level))&&(i=a)}}if(i<0)throw new RangeError("Index out of range");return i}}function CI(t,e){if(t.length!=e.length)return!1;for(let n=0;n=0;w-=3)if(Va[w+1]==-x){let S=Va[w+2],k=S&2?s:S&4?S&1?i:s:0;k&&(Gn[m]=Gn[Va[w]]=k),o=w;break}}else{if(Va.length==189)break;Va[o++]=m,Va[o++]=g,Va[o++]=c}else if((y=Gn[m])==2||y==1){let w=y==s;c=w?0:1;for(let S=o-3;S>=0;S-=3){let k=Va[S+2];if(k&2)break;if(w)Va[S+2]|=2;else{if(k&4)break;Va[S+2]|=4}}}}}function Jre(t,e,n,r){for(let s=0,i=r;s<=n.length;s++){let a=s?n[s-1].to:t,o=sc;)y==S&&(y=n[--w].from,S=w?n[w-1].to:t),Gn[--y]=x;c=f}else i=h,c++}}}function bS(t,e,n,r,s,i,a){let o=r%2?2:1;if(r%2==s%2)for(let c=e,h=0;cc&&a.push(new hc(c,w.from,x));let S=w.direction==Ru!=!(x%2);wS(t,S?r+1:r,s,w.inner,w.from,w.to,a),c=w.to}y=w.to}else{if(y==n||(f?Gn[y]!=o:Gn[y]==o))break;y++}g?bS(t,c,y,r+1,s,g,a):ce;){let f=!0,m=!1;if(!h||c>i[h-1].to){let w=Gn[c-1];w!=o&&(f=!1,m=w==16)}let g=!f&&o==1?[]:null,x=f?r:r+1,y=c;e:for(;;)if(h&&y==i[h-1].to){if(m)break e;let w=i[--h];if(!f)for(let S=w.from,k=h;;){if(S==e)break e;if(k&&i[k-1].to==S)S=i[--k].from;else{if(Gn[S-1]==o)break e;break}}if(g)g.push(w);else{w.toGn.length;)Gn[Gn.length]=256;let r=[],s=e==Ru?0:1;return wS(t,s,s,n,0,t.length,r),r}function TI(t){return[new hc(0,t,0)]}let EI="";function tse(t,e,n,r,s){var i;let a=r.head-t.from,o=hc.find(e,a,(i=r.bidiLevel)!==null&&i!==void 0?i:-1,r.assoc),c=e[o],h=c.side(s,n);if(a==h){let g=o+=s?1:-1;if(g<0||g>=e.length)return null;c=e[o=g],a=c.side(!s,n),h=c.side(s,n)}let f=ys(t.text,a,c.forward(s,n));(fc.to)&&(f=h),EI=t.text.slice(Math.min(a,f),Math.max(a,f));let m=o==(s?e.length-1:0)?null:e[o+(s?1:-1)];return m&&f==h&&m.level+(s?0:1)t.some(e=>e)}),LI=nt.define({combine:t=>t.some(e=>e)}),II=nt.define();class sh{constructor(e,n="nearest",r="nearest",s=5,i=5,a=!1){this.range=e,this.y=n,this.x=r,this.yMargin=s,this.xMargin=i,this.isSnapshot=a}map(e){return e.empty?this:new sh(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new sh(Ae.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const tx=Lt.define({map:(t,e)=>t.map(e)}),BI=Lt.define();function ni(t,e,n){let r=t.facet(RI);r.length?r[0](e):window.onerror&&window.onerror(String(e),n,void 0,void 0,e)||(n?console.error(n+":",e):console.error(e))}const no=nt.define({combine:t=>t.length?t[0]:!0});let rse=0;const Gd=nt.define({combine(t){return t.filter((e,n)=>{for(let r=0;r{let c=[];return a&&c.push(Ym.of(h=>{let f=h.plugin(o);return f?a(f):xt.none})),i&&c.push(i(o)),c})}static fromClass(e,n){return _r.define((r,s)=>new e(r,s),n)}}class bw{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(e){if(this.value){if(this.mustUpdate){let n=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(n)}catch(r){if(ni(n.state,r,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(n){ni(e.state,n,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var n;if(!((n=this.value)===null||n===void 0)&&n.destroy)try{this.value.destroy()}catch(r){ni(e.state,r,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const qI=nt.define(),z6=nt.define(),Ym=nt.define(),FI=nt.define(),Y0=nt.define(),$I=nt.define();function Q9(t,e){let n=t.state.facet($I);if(!n.length)return n;let r=n.map(i=>i instanceof Function?i(t):i),s=[];return On.spans(r,e.from,e.to,{point(){},span(i,a,o,c){let h=i-e.from,f=a-e.from,m=s;for(let g=o.length-1;g>=0;g--,c--){let x=o[g].spec.bidiIsolate,y;if(x==null&&(x=nse(e.text,h,f)),c>0&&m.length&&(y=m[m.length-1]).to==h&&y.direction==x)y.to=f,m=y.inner;else{let w={from:h,to:f,direction:x,inner:[]};m.push(w),m=w.inner}}}}),s}const QI=nt.define();function P6(t){let e=0,n=0,r=0,s=0;for(let i of t.state.facet(QI)){let a=i(t);a&&(a.left!=null&&(e=Math.max(e,a.left)),a.right!=null&&(n=Math.max(n,a.right)),a.top!=null&&(r=Math.max(r,a.top)),a.bottom!=null&&(s=Math.max(s,a.bottom)))}return{left:e,right:n,top:r,bottom:s}}const mm=nt.define();class ia{constructor(e,n,r,s){this.fromA=e,this.toA=n,this.fromB=r,this.toB=s}join(e){return new ia(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let n=e.length,r=this;for(;n>0;n--){let s=e[n-1];if(!(s.fromA>r.toA)){if(s.toAf)break;i+=2}if(!c)return r;new ia(c.fromA,c.toA,c.fromB,c.toB).addToSet(r),a=c.toA,o=c.toB}}}class I1{constructor(e,n,r){this.view=e,this.state=n,this.transactions=r,this.flags=0,this.startState=e.state,this.changes=Kr.empty(this.startState.doc.length);for(let i of r)this.changes=this.changes.compose(i.changes);let s=[];this.changes.iterChangedRanges((i,a,o,c)=>s.push(new ia(i,a,o,c))),this.changedRanges=s}static create(e,n,r){return new I1(e,n,r)}get viewportChanged(){return(this.flags&4)>0}get viewportMoved(){return(this.flags&8)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&18)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}class H9 extends Qn{get length(){return this.view.state.doc.length}constructor(e){super(),this.view=e,this.decorations=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.markedForComposition=new Set,this.editContextFormatting=xt.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(e.contentDOM),this.children=[new qr],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new ia(0,0,0,e.state.doc.length)],0,null)}update(e){var n;let r=e.changedRanges;this.minWidth>0&&r.length&&(r.every(({fromA:h,toA:f})=>fthis.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let s=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((n=this.domChanged)===null||n===void 0)&&n.newSel?s=this.domChanged.newSel.head:!use(e.changes,this.hasComposition)&&!e.selectionSet&&(s=e.state.selection.main.head));let i=s>-1?ise(this.view,e.changes,s):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:h,to:f}=this.hasComposition;r=new ia(h,f,e.changes.mapPos(h,-1),e.changes.mapPos(f,1)).addToSet(r.slice())}this.hasComposition=i?{from:i.range.fromB,to:i.range.toB}:null,(Je.ie||Je.chrome)&&!i&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let a=this.decorations,o=this.updateDeco(),c=ose(a,o,e.changes);return r=ia.extendWithRanges(r,c),!(this.flags&7)&&r.length==0?!1:(this.updateInner(r,e.startState.doc.length,i),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,n,r){this.view.viewState.mustMeasureContent=!0,this.updateChildren(e,n,r);let{observer:s}=this.view;s.ignore(()=>{this.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let a=Je.chrome||Je.ios?{node:s.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,a),this.flags&=-8,a&&(a.written||s.selectionRange.focusNode!=a.node)&&(this.forceSelection=!0),this.dom.style.height=""}),this.markedForComposition.forEach(a=>a.flags&=-9);let i=[];if(this.view.viewport.from||this.view.viewport.to=0?s[a]:null;if(!o)break;let{fromA:c,toA:h,fromB:f,toB:m}=o,g,x,y,w;if(r&&r.range.fromBf){let T=_m.build(this.view.state.doc,f,r.range.fromB,this.decorations,this.dynamicDecorationMap),_=_m.build(this.view.state.doc,r.range.toB,m,this.decorations,this.dynamicDecorationMap);x=T.breakAtStart,y=T.openStart,w=_.openEnd;let E=this.compositionView(r);_.breakAtStart?E.breakAfter=1:_.content.length&&E.merge(E.length,E.length,_.content[0],!1,_.openStart,0)&&(E.breakAfter=_.content[0].breakAfter,_.content.shift()),T.content.length&&E.merge(0,0,T.content[T.content.length-1],!0,0,T.openEnd)&&T.content.pop(),g=T.content.concat(E).concat(_.content)}else({content:g,breakAtStart:x,openStart:y,openEnd:w}=_m.build(this.view.state.doc,f,m,this.decorations,this.dynamicDecorationMap));let{i:S,off:k}=i.findPos(h,1),{i:N,off:C}=i.findPos(c,-1);yI(this,N,C,S,k,g,x,y,w)}r&&this.fixCompositionDOM(r)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let n of e.transactions)for(let r of n.effects)r.is(BI)&&(this.editContextFormatting=r.value)}compositionView(e){let n=new _a(e.text.nodeValue);n.flags|=8;for(let{deco:s}of e.marks)n=new mo(s,[n],n.length);let r=new qr;return r.append(n,0),r}fixCompositionDOM(e){let n=(i,a)=>{a.flags|=8|(a.children.some(c=>c.flags&7)?1:0),this.markedForComposition.add(a);let o=Qn.get(i);o&&o!=a&&(o.dom=null),a.setDOM(i)},r=this.childPos(e.range.fromB,1),s=this.children[r.i];n(e.line,s);for(let i=e.marks.length-1;i>=-1;i--)r=s.childPos(r.off,1),s=s.children[r.i],n(i>=0?e.marks[i].node:e.text,s)}updateSelection(e=!1,n=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let r=this.view.root.activeElement,s=r==this.dom,i=!s&&!(this.view.state.facet(no)||this.dom.tabIndex>-1)&&i1(this.dom,this.view.observer.selectionRange)&&!(r&&this.dom.contains(r));if(!(s||n||i))return;let a=this.forceSelection;this.forceSelection=!1;let o=this.view.state.selection.main,c=this.moveToLine(this.domAtPos(o.anchor)),h=o.empty?c:this.moveToLine(this.domAtPos(o.head));if(Je.gecko&&o.empty&&!this.hasComposition&&sse(c)){let m=document.createTextNode("");this.view.observer.ignore(()=>c.node.insertBefore(m,c.node.childNodes[c.offset]||null)),c=h=new Cs(m,0),a=!0}let f=this.view.observer.selectionRange;(a||!f.focusNode||(!Em(c.node,c.offset,f.anchorNode,f.anchorOffset)||!Em(h.node,h.offset,f.focusNode,f.focusOffset))&&!this.suppressWidgetCursorChange(f,o))&&(this.view.observer.ignore(()=>{Je.android&&Je.chrome&&this.dom.contains(f.focusNode)&&cse(f.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let m=Xm(this.view.root);if(m)if(o.empty){if(Je.gecko){let g=ase(c.node,c.offset);if(g&&g!=3){let x=(g==1?gI:xI)(c.node,c.offset);x&&(c=new Cs(x.node,x.offset))}}m.collapse(c.node,c.offset),o.bidiLevel!=null&&m.caretBidiLevel!==void 0&&(m.caretBidiLevel=o.bidiLevel)}else if(m.extend){m.collapse(c.node,c.offset);try{m.extend(h.node,h.offset)}catch{}}else{let g=document.createRange();o.anchor>o.head&&([c,h]=[h,c]),g.setEnd(h.node,h.offset),g.setStart(c.node,c.offset),m.removeAllRanges(),m.addRange(g)}i&&this.view.root.activeElement==this.dom&&(this.dom.blur(),r&&r.focus())}),this.view.observer.setSelectionRange(c,h)),this.impreciseAnchor=c.precise?null:new Cs(f.anchorNode,f.anchorOffset),this.impreciseHead=h.precise?null:new Cs(f.focusNode,f.focusOffset)}suppressWidgetCursorChange(e,n){return this.hasComposition&&n.empty&&Em(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==n.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,n=e.state.selection.main,r=Xm(e.root),{anchorNode:s,anchorOffset:i}=e.observer.selectionRange;if(!r||!n.empty||!n.assoc||!r.modify)return;let a=qr.find(this,n.head);if(!a)return;let o=a.posAtStart;if(n.head==o||n.head==o+a.length)return;let c=this.coordsAt(n.head,-1),h=this.coordsAt(n.head,1);if(!c||!h||c.bottom>h.top)return;let f=this.domAtPos(n.head+n.assoc);r.collapse(f.node,f.offset),r.modify("move",n.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let m=e.observer.selectionRange;e.docView.posFromDOM(m.anchorNode,m.anchorOffset)!=n.from&&r.collapse(s,i)}moveToLine(e){let n=this.dom,r;if(e.node!=n)return e;for(let s=e.offset;!r&&s=0;s--){let i=Qn.get(n.childNodes[s]);i instanceof qr&&(r=i.domAtPos(i.length))}return r?new Cs(r.node,r.offset,!0):e}nearest(e){for(let n=e;n;){let r=Qn.get(n);if(r&&r.rootView==this)return r;n=n.parentNode}return null}posFromDOM(e,n){let r=this.nearest(e);if(!r)throw new RangeError("Trying to find position for a DOM position outside of the document");return r.localPosFromDOM(e,n)+r.posAtStart}domAtPos(e){let{i:n,off:r}=this.childCursor().findPos(e,-1);for(;n=0;a--){let o=this.children[a],c=i-o.breakAfter,h=c-o.length;if(ce||o.covers(1))&&(!r||o instanceof qr&&!(r instanceof qr&&n>=0)))r=o,s=h;else if(r&&h==e&&c==e&&o instanceof oo&&Math.abs(n)<2){if(o.deco.startSide<0)break;a&&(r=null)}i=h}return r?r.coordsAt(e-s,n):null}coordsForChar(e){let{i:n,off:r}=this.childPos(e,1),s=this.children[n];if(!(s instanceof qr))return null;for(;s.children.length;){let{i:o,off:c}=s.childPos(r,1);for(;;o++){if(o==s.children.length)return null;if((s=s.children[o]).length)break}r=c}if(!(s instanceof _a))return null;let i=ys(s.text,r);if(i==r)return null;let a=Au(s.dom,r,i).getClientRects();for(let o=0;oMath.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,o=-1,c=this.view.textDirection==sr.LTR;for(let h=0,f=0;fs)break;if(h>=r){let x=m.dom.getBoundingClientRect();if(n.push(x.height),a){let y=m.dom.lastChild,w=y?yh(y):[];if(w.length){let S=w[w.length-1],k=c?S.right-x.left:x.right-S.left;k>o&&(o=k,this.minWidth=i,this.minWidthFrom=h,this.minWidthTo=g)}}}h=g+m.breakAfter}return n}textDirectionAt(e){let{i:n}=this.childPos(e,1);return getComputedStyle(this.children[n].dom).direction=="rtl"?sr.RTL:sr.LTR}measureTextSize(){for(let i of this.children)if(i instanceof qr){let a=i.measureTextSize();if(a)return a}let e=document.createElement("div"),n,r,s;return e.className="cm-line",e.style.width="99999px",e.style.position="absolute",e.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.dom.appendChild(e);let i=yh(e.firstChild)[0];n=e.getBoundingClientRect().height,r=i?i.width/27:7,s=i?i.height:n,e.remove()}),{lineHeight:n,charWidth:r,textHeight:s}}childCursor(e=this.length){let n=this.children.length;return n&&(e-=this.children[--n].length),new vI(this.children,e,n)}computeBlockGapDeco(){let e=[],n=this.view.viewState;for(let r=0,s=0;;s++){let i=s==n.viewports.length?null:n.viewports[s],a=i?i.from-1:this.length;if(a>r){let o=(n.lineBlockAt(a).bottom-n.lineBlockAt(r).top)/this.view.scaleY;e.push(xt.replace({widget:new vS(o),block:!0,inclusive:!0,isBlockGap:!0}).range(r,a))}if(!i)break;r=i.to+1}return xt.set(e)}updateDeco(){let e=1,n=this.view.state.facet(Ym).map(i=>(this.dynamicDecorationMap[e++]=typeof i=="function")?i(this.view):i),r=!1,s=this.view.state.facet(FI).map((i,a)=>{let o=typeof i=="function";return o&&(r=!0),o?i(this.view):i});for(s.length&&(this.dynamicDecorationMap[e++]=r,n.push(On.join(s))),this.decorations=[this.editContextFormatting,...n,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];en.anchor?-1:1),s;if(!r)return;!n.empty&&(s=this.coordsAt(n.anchor,n.anchor>n.head?-1:1))&&(r={left:Math.min(r.left,s.left),top:Math.min(r.top,s.top),right:Math.max(r.right,s.right),bottom:Math.max(r.bottom,s.bottom)});let i=P6(this.view),a={left:r.left-i.left,top:r.top-i.top,right:r.right+i.right,bottom:r.bottom+i.bottom},{offsetWidth:o,offsetHeight:c}=this.view.scrollDOM;Lre(this.view.scrollDOM,a,n.heads instanceof ro||s.children.some(r);return r(this.children[n])}}function sse(t){return t.node.nodeType==1&&t.node.firstChild&&(t.offset==0||t.node.childNodes[t.offset-1].contentEditable=="false")&&(t.offset==t.node.childNodes.length||t.node.childNodes[t.offset].contentEditable=="false")}function HI(t,e){let n=t.observer.selectionRange;if(!n.focusNode)return null;let r=gI(n.focusNode,n.focusOffset),s=xI(n.focusNode,n.focusOffset),i=r||s;if(s&&r&&s.node!=r.node){let o=Qn.get(s.node);if(!o||o instanceof _a&&o.text!=s.node.nodeValue)i=s;else if(t.docView.lastCompositionAfterCursor){let c=Qn.get(r.node);!c||c instanceof _a&&c.text!=r.node.nodeValue||(i=s)}}if(t.docView.lastCompositionAfterCursor=i!=r,!i)return null;let a=e-i.offset;return{from:a,to:a+i.node.nodeValue.length,node:i.node}}function ise(t,e,n){let r=HI(t,n);if(!r)return null;let{node:s,from:i,to:a}=r,o=s.nodeValue;if(/[\n\r]/.test(o)||t.state.doc.sliceString(r.from,r.to)!=o)return null;let c=e.invertedDesc,h=new ia(c.mapPos(i),c.mapPos(a),i,a),f=[];for(let m=s.parentNode;;m=m.parentNode){let g=Qn.get(m);if(g instanceof mo)f.push({node:m,deco:g.mark});else{if(g instanceof qr||m.nodeName=="DIV"&&m.parentNode==t.contentDOM)return{range:h,text:s,marks:f,line:m};if(m!=t.contentDOM)f.push({node:m,deco:new G0({inclusive:!0,attributes:Ure(m),tagName:m.tagName.toLowerCase()})});else return null}}}function ase(t,e){return t.nodeType!=1?0:(e&&t.childNodes[e-1].contentEditable=="false"?1:0)|(e{re.from&&(n=!0)}),n}function dse(t,e,n=1){let r=t.charCategorizer(e),s=t.doc.lineAt(e),i=e-s.from;if(s.length==0)return Ae.cursor(e);i==0?n=1:i==s.length&&(n=-1);let a=i,o=i;n<0?a=ys(s.text,i,!1):o=ys(s.text,i);let c=r(s.text.slice(a,o));for(;a>0;){let h=ys(s.text,a,!1);if(r(s.text.slice(h,a))!=c)break;a=h}for(;ot?e.left-t:Math.max(0,t-e.right)}function fse(t,e){return e.top>t?e.top-t:Math.max(0,t-e.bottom)}function ww(t,e){return t.tope.top+1}function V9(t,e){return et.bottom?{top:t.top,left:t.left,right:t.right,bottom:e}:t}function kS(t,e,n){let r,s,i,a,o=!1,c,h,f,m;for(let y=t.firstChild;y;y=y.nextSibling){let w=yh(y);for(let S=0;SC||a==C&&i>N)&&(r=y,s=k,i=N,a=C,o=N?e0:Sk.bottom&&(!f||f.bottomk.top)&&(h=y,m=k):f&&ww(f,k)?f=U9(f,k.bottom):m&&ww(m,k)&&(m=V9(m,k.top))}}if(f&&f.bottom>=n?(r=c,s=f):m&&m.top<=n&&(r=h,s=m),!r)return{node:t,offset:0};let g=Math.max(s.left,Math.min(s.right,e));if(r.nodeType==3)return W9(r,g,n);if(o&&r.contentEditable!="false")return kS(r,g,n);let x=Array.prototype.indexOf.call(t.childNodes,r)+(e>=(s.left+s.right)/2?1:0);return{node:t,offset:x}}function W9(t,e,n){let r=t.nodeValue.length,s=-1,i=1e9,a=0;for(let o=0;on?f.top-n:n-f.bottom)-1;if(f.left-1<=e&&f.right+1>=e&&m=(f.left+f.right)/2,x=g;if(Je.chrome||Je.gecko){let y=Au(t,o).getBoundingClientRect();Math.abs(y.left-f.right)<.1&&(x=!g)}if(m<=0)return{node:t,offset:o+(x?1:0)};s=o+(x?1:0),i=m}}}return{node:t,offset:s>-1?s:a>0?t.nodeValue.length:0}}function VI(t,e,n,r=-1){var s,i;let a=t.contentDOM.getBoundingClientRect(),o=a.top+t.viewState.paddingTop,c,{docHeight:h}=t.viewState,{x:f,y:m}=e,g=m-o;if(g<0)return 0;if(g>h)return t.state.doc.length;for(let T=t.viewState.heightOracle.textHeight/2,_=!1;c=t.elementAtHeight(g),c.type!=Is.Text;)for(;g=r>0?c.bottom+T:c.top-T,!(g>=0&&g<=h);){if(_)return n?null:0;_=!0,r=-r}m=o+g;let x=c.from;if(xt.viewport.to)return t.viewport.to==t.state.doc.length?t.state.doc.length:n?null:G9(t,a,c,f,m);let y=t.dom.ownerDocument,w=t.root.elementFromPoint?t.root:y,S=w.elementFromPoint(f,m);S&&!t.contentDOM.contains(S)&&(S=null),S||(f=Math.max(a.left+1,Math.min(a.right-1,f)),S=w.elementFromPoint(f,m),S&&!t.contentDOM.contains(S)&&(S=null));let k,N=-1;if(S&&((s=t.docView.nearest(S))===null||s===void 0?void 0:s.isEditable)!=!1){if(y.caretPositionFromPoint){let T=y.caretPositionFromPoint(f,m);T&&({offsetNode:k,offset:N}=T)}else if(y.caretRangeFromPoint){let T=y.caretRangeFromPoint(f,m);T&&({startContainer:k,startOffset:N}=T)}k&&(!t.contentDOM.contains(k)||Je.safari&&mse(k,N,f)||Je.chrome&&pse(k,N,f))&&(k=void 0),k&&(N=Math.min(hl(k),N))}if(!k||!t.docView.dom.contains(k)){let T=qr.find(t.docView,x);if(!T)return g>c.top+c.height/2?c.to:c.from;({node:k,offset:N}=kS(T.dom,f,m))}let C=t.docView.nearest(k);if(!C)return null;if(C.isWidget&&((i=C.dom)===null||i===void 0?void 0:i.nodeType)==1){let T=C.dom.getBoundingClientRect();return e.yt.defaultLineHeight*1.5){let o=t.viewState.heightOracle.textHeight,c=Math.floor((s-n.top-(t.defaultLineHeight-o)*.5)/o);i+=c*t.viewState.heightOracle.lineLength}let a=t.state.sliceDoc(n.from,n.to);return n.from+oS(a,i,t.state.tabSize)}function UI(t,e,n){let r,s=t;if(t.nodeType!=3||e!=(r=t.nodeValue.length))return!1;for(;;){let i=s.nextSibling;if(i){if(i.nodeName=="BR")break;return!1}else{let a=s.parentNode;if(!a||a.nodeName=="DIV")break;s=a}}return Au(t,r-1,r).getBoundingClientRect().right>n}function mse(t,e,n){return UI(t,e,n)}function pse(t,e,n){if(e!=0)return UI(t,e,n);for(let s=t;;){let i=s.parentNode;if(!i||i.nodeType!=1||i.firstChild!=s)return!1;if(i.classList.contains("cm-line"))break;s=i}let r=t.nodeType==1?t.getBoundingClientRect():Au(t,0,Math.max(t.nodeValue.length,1)).getBoundingClientRect();return n-r.left>5}function jS(t,e,n){let r=t.lineBlockAt(e);if(Array.isArray(r.type)){let s;for(let i of r.type){if(i.from>e)break;if(!(i.toe)return i;(!s||i.type==Is.Text&&(s.type!=i.type||(n<0?i.frome)))&&(s=i)}}return s||r}return r}function gse(t,e,n,r){let s=jS(t,e.head,e.assoc||-1),i=!r||s.type!=Is.Text||!(t.lineWrapping||s.widgetLineBreaks)?null:t.coordsAtPos(e.assoc<0&&e.head>s.from?e.head-1:e.head);if(i){let a=t.dom.getBoundingClientRect(),o=t.textDirectionAt(s.from),c=t.posAtCoords({x:n==(o==sr.LTR)?a.right-1:a.left+1,y:(i.top+i.bottom)/2});if(c!=null)return Ae.cursor(c,n?-1:1)}return Ae.cursor(n?s.to:s.from,n?-1:1)}function X9(t,e,n,r){let s=t.state.doc.lineAt(e.head),i=t.bidiSpans(s),a=t.textDirectionAt(s.from);for(let o=e,c=null;;){let h=tse(s,i,a,o,n),f=EI;if(!h){if(s.number==(n?t.state.doc.lines:1))return o;f=` +`,s=t.state.doc.line(s.number+(n?1:-1)),i=t.bidiSpans(s),h=t.visualLineSide(s,!n)}if(c){if(!c(f))return o}else{if(!r)return h;c=r(f)}o=h}}function xse(t,e,n){let r=t.state.charCategorizer(e),s=r(n);return i=>{let a=r(i);return s==ar.Space&&(s=a),s==a}}function vse(t,e,n,r){let s=e.head,i=n?1:-1;if(s==(n?t.state.doc.length:0))return Ae.cursor(s,e.assoc);let a=e.goalColumn,o,c=t.contentDOM.getBoundingClientRect(),h=t.coordsAtPos(s,e.assoc||-1),f=t.documentTop;if(h)a==null&&(a=h.left-c.left),o=i<0?h.top:h.bottom;else{let x=t.viewState.lineBlockAt(s);a==null&&(a=Math.min(c.right-c.left,t.defaultCharacterWidth*(s-x.from))),o=(i<0?x.top:x.bottom)+f}let m=c.left+a,g=r??t.viewState.heightOracle.textHeight>>1;for(let x=0;;x+=10){let y=o+(g+x)*i,w=VI(t,{x:m,y},!1,i);if(yc.bottom||(i<0?ws)){let S=t.docView.coordsForChar(w),k=!S||y{if(e>i&&es(t)),n.from,e.head>n.from?-1:1);return r==n.from?n:Ae.cursor(r,ri)&&!wse(a,n)&&this.lineBreak(),s=a}return this.findPointBefore(r,n),this}readTextNode(e){let n=e.nodeValue;for(let r of this.points)r.node==e&&(r.pos=this.text.length+Math.min(r.offset,n.length));for(let r=0,s=this.lineSeparator?null:/\r\n?|\n/g;;){let i=-1,a=1,o;if(this.lineSeparator?(i=n.indexOf(this.lineSeparator,r),a=this.lineSeparator.length):(o=s.exec(n))&&(i=o.index,a=o[0].length),this.append(n.slice(r,i<0?n.length:i)),i<0)break;if(this.lineBreak(),a>1)for(let c of this.points)c.node==e&&c.pos>this.text.length&&(c.pos-=a-1);r=i+a}}readNode(e){if(e.cmIgnore)return;let n=Qn.get(e),r=n&&n.overrideDOMText;if(r!=null){this.findPointInside(e,r.length);for(let s=r.iter();!s.next().done;)s.lineBreak?this.lineBreak():this.append(s.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,n){for(let r of this.points)r.node==e&&e.childNodes[r.offset]==n&&(r.pos=this.text.length)}findPointInside(e,n){for(let r of this.points)(e.nodeType==3?r.node==e:e.contains(r.node))&&(r.pos=this.text.length+(bse(e,r.node,r.offset)?n:0))}}function bse(t,e,n){for(;;){if(!e||n-1;let{impreciseHead:i,impreciseAnchor:a}=e.docView;if(e.state.readOnly&&n>-1)this.newSel=null;else if(n>-1&&(this.bounds=e.docView.domBoundsAround(n,r,0))){let o=i||a?[]:jse(e),c=new yse(o,e.state);c.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=c.text,this.newSel=Ose(o,this.bounds.from)}else{let o=e.observer.selectionRange,c=i&&i.node==o.focusNode&&i.offset==o.focusOffset||!pS(e.contentDOM,o.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(o.focusNode,o.focusOffset),h=a&&a.node==o.anchorNode&&a.offset==o.anchorOffset||!pS(e.contentDOM,o.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(o.anchorNode,o.anchorOffset),f=e.viewport;if((Je.ios||Je.chrome)&&e.state.selection.main.empty&&c!=h&&(f.from>0||f.to-1&&e.state.selection.ranges.length>1?this.newSel=e.state.selection.replaceRange(Ae.range(h,c)):this.newSel=Ae.single(h,c)}}}function GI(t,e){let n,{newSel:r}=e,s=t.state.selection.main,i=t.inputState.lastKeyTime>Date.now()-100?t.inputState.lastKeyCode:-1;if(e.bounds){let{from:a,to:o}=e.bounds,c=s.from,h=null;(i===8||Je.android&&e.text.length=s.from&&n.to<=s.to&&(n.from!=s.from||n.to!=s.to)&&s.to-s.from-(n.to-n.from)<=4?n={from:s.from,to:s.to,insert:t.state.doc.slice(s.from,n.from).append(n.insert).append(t.state.doc.slice(n.to,s.to))}:t.state.doc.lineAt(s.from).toDate.now()-50?n={from:s.from,to:s.to,insert:t.state.toText(t.inputState.insertingText)}:Je.chrome&&n&&n.from==n.to&&n.from==s.head&&n.insert.toString()==` + `&&t.lineWrapping&&(r&&(r=Ae.single(r.main.anchor-1,r.main.head-1)),n={from:s.from,to:s.to,insert:pn.of([" "])}),n)return L6(t,n,r,i);if(r&&!r.main.eq(s)){let a=!1,o="select";return t.inputState.lastSelectionTime>Date.now()-50&&(t.inputState.lastSelectionOrigin=="select"&&(a=!0),o=t.inputState.lastSelectionOrigin,o=="select.pointer"&&(r=WI(t.state.facet(Y0).map(c=>c(t)),r))),t.dispatch({selection:r,scrollIntoView:a,userEvent:o}),!0}else return!1}function L6(t,e,n,r=-1){if(Je.ios&&t.inputState.flushIOSKey(e))return!0;let s=t.state.selection.main;if(Je.android&&(e.to==s.to&&(e.from==s.from||e.from==s.from-1&&t.state.sliceDoc(e.from,s.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&rh(t.contentDOM,"Enter",13)||(e.from==s.from-1&&e.to==s.to&&e.insert.length==0||r==8&&e.insert.lengths.head)&&rh(t.contentDOM,"Backspace",8)||e.from==s.from&&e.to==s.to+1&&e.insert.length==0&&rh(t.contentDOM,"Delete",46)))return!0;let i=e.insert.toString();t.inputState.composing>=0&&t.inputState.composing++;let a,o=()=>a||(a=kse(t,e,n));return t.state.facet(DI).some(c=>c(t,e.from,e.to,i,o))||t.dispatch(o()),!0}function kse(t,e,n){let r,s=t.state,i=s.selection.main,a=-1;if(e.from==e.to&&e.fromi.to){let c=e.fromm(t)),h,c);e.from==f&&(a=f)}if(a>-1)r={changes:e,selection:Ae.cursor(e.from+e.insert.length,-1)};else if(e.from>=i.from&&e.to<=i.to&&e.to-e.from>=(i.to-i.from)/3&&(!n||n.main.empty&&n.main.from==e.from+e.insert.length)&&t.inputState.composing<0){let c=i.frome.to?s.sliceDoc(e.to,i.to):"";r=s.replaceSelection(t.state.toText(c+e.insert.sliceString(0,void 0,t.state.lineBreak)+h))}else{let c=s.changes(e),h=n&&n.main.to<=c.newLength?n.main:void 0;if(s.selection.ranges.length>1&&(t.inputState.composing>=0||t.inputState.compositionPendingChange)&&e.to<=i.to+10&&e.to>=i.to-10){let f=t.state.sliceDoc(e.from,e.to),m,g=n&&HI(t,n.main.head);if(g){let y=e.insert.length-(e.to-e.from);m={from:g.from,to:g.to-y}}else m=t.state.doc.lineAt(i.head);let x=i.to-e.to;r=s.changeByRange(y=>{if(y.from==i.from&&y.to==i.to)return{changes:c,range:h||y.map(c)};let w=y.to-x,S=w-f.length;if(t.state.sliceDoc(S,w)!=f||w>=m.from&&S<=m.to)return{range:y};let k=s.changes({from:S,to:w,insert:e.insert}),N=y.to-i.to;return{changes:k,range:h?Ae.range(Math.max(0,h.anchor+N),Math.max(0,h.head+N)):y.map(k)}})}else r={changes:c,selection:h&&s.selection.replaceRange(h)}}let o="input.type";return(t.composing||t.inputState.compositionPendingChange&&t.inputState.compositionEndedAt>Date.now()-50)&&(t.inputState.compositionPendingChange=!1,o+=".compose",t.inputState.compositionFirstChange&&(o+=".start",t.inputState.compositionFirstChange=!1)),s.update(r,{userEvent:o,scrollIntoView:!0})}function XI(t,e,n,r){let s=Math.min(t.length,e.length),i=0;for(;i0&&o>0&&t.charCodeAt(a-1)==e.charCodeAt(o-1);)a--,o--;if(r=="end"){let c=Math.max(0,i-Math.min(a,o));n-=a+c-i}if(a=a?i-n:0;i-=c,o=i+(o-a),a=i}else if(o=o?i-n:0;i-=c,a=i+(a-o),o=i}return{from:i,toA:a,toB:o}}function jse(t){let e=[];if(t.root.activeElement!=t.contentDOM)return e;let{anchorNode:n,anchorOffset:r,focusNode:s,focusOffset:i}=t.observer.selectionRange;return n&&(e.push(new Y9(n,r)),(s!=n||i!=r)&&e.push(new Y9(s,i))),e}function Ose(t,e){if(t.length==0)return null;let n=t[0].pos,r=t.length==2?t[1].pos:n;return n>-1&&r>-1?Ae.single(n+e,r+e):null}class Nse{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,Je.safari&&e.contentDOM.addEventListener("input",()=>null),Je.gecko&&$se(e.contentDOM.ownerDocument)}handleEvent(e){!Dse(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e))}runHandlers(e,n){let r=this.handlers[e];if(r){for(let s of r.observers)s(this.view,n);for(let s of r.handlers){if(n.defaultPrevented)break;if(s(this.view,n)){n.preventDefault();break}}}}ensureHandlers(e){let n=Cse(e),r=this.handlers,s=this.view.contentDOM;for(let i in n)if(i!="scroll"){let a=!n[i].handlers.length,o=r[i];o&&a!=!o.handlers.length&&(s.removeEventListener(i,this.handleEvent),o=null),o||s.addEventListener(i,this.handleEvent,{passive:a})}for(let i in r)i!="scroll"&&!n[i]&&s.removeEventListener(i,this.handleEvent);this.handlers=n}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&KI.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),Je.android&&Je.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let n;return Je.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((n=YI.find(r=>r.keyCode==e.keyCode))&&!e.ctrlKey||Tse.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(this.pendingIOSKey=n||e,setTimeout(()=>this.flushIOSKey(),250),!0):(e.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(e){let n=this.pendingIOSKey;return!n||n.key=="Enter"&&e&&e.from0?!0:Je.safari&&!Je.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function K9(t,e){return(n,r)=>{try{return e.call(t,r,n)}catch(s){ni(n.state,s)}}}function Cse(t){let e=Object.create(null);function n(r){return e[r]||(e[r]={observers:[],handlers:[]})}for(let r of t){let s=r.spec,i=s&&s.plugin.domEventHandlers,a=s&&s.plugin.domEventObservers;if(i)for(let o in i){let c=i[o];c&&n(o).handlers.push(K9(r.value,c))}if(a)for(let o in a){let c=a[o];c&&n(o).observers.push(K9(r.value,c))}}for(let r in Ma)n(r).handlers.push(Ma[r]);for(let r in ca)n(r).observers.push(ca[r]);return e}const YI=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],Tse="dthko",KI=[16,17,18,20,91,92,224,225],nx=6;function rx(t){return Math.max(0,t)*.7+8}function Ese(t,e){return Math.max(Math.abs(t.clientX-e.clientX),Math.abs(t.clientY-e.clientY))}class _se{constructor(e,n,r,s){this.view=e,this.startEvent=n,this.style=r,this.mustSelect=s,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=n,this.scrollParents=Ire(e.contentDOM),this.atoms=e.state.facet(Y0).map(a=>a(e));let i=e.contentDOM.ownerDocument;i.addEventListener("mousemove",this.move=this.move.bind(this)),i.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=n.shiftKey,this.multiple=e.state.facet(dn.allowMultipleSelections)&&Mse(e,n),this.dragging=Rse(e,n)&&eB(n)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&Ese(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let n=0,r=0,s=0,i=0,a=this.view.win.innerWidth,o=this.view.win.innerHeight;this.scrollParents.x&&({left:s,right:a}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:i,bottom:o}=this.scrollParents.y.getBoundingClientRect());let c=P6(this.view);e.clientX-c.left<=s+nx?n=-rx(s-e.clientX):e.clientX+c.right>=a-nx&&(n=rx(e.clientX-a)),e.clientY-c.top<=i+nx?r=-rx(i-e.clientY):e.clientY+c.bottom>=o-nx&&(r=rx(e.clientY-o)),this.setScrollSpeed(n,r)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,n){this.scrollSpeed={x:e,y:n},e||n?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:n}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),n&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=n,n=0),(e||n)&&this.view.win.scrollBy(e,n),this.dragging===!1&&this.select(this.lastEvent)}select(e){let{view:n}=this,r=WI(this.atoms,this.style.get(e,this.extend,this.multiple));(this.mustSelect||!r.eq(n.state.selection,this.dragging===!1))&&this.view.dispatch({selection:r,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(n=>n.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function Mse(t,e){let n=t.state.facet(_I);return n.length?n[0](e):Je.mac?e.metaKey:e.ctrlKey}function Ase(t,e){let n=t.state.facet(MI);return n.length?n[0](e):Je.mac?!e.altKey:!e.ctrlKey}function Rse(t,e){let{main:n}=t.state.selection;if(n.empty)return!1;let r=Xm(t.root);if(!r||r.rangeCount==0)return!0;let s=r.getRangeAt(0).getClientRects();for(let i=0;i=e.clientX&&a.top<=e.clientY&&a.bottom>=e.clientY)return!0}return!1}function Dse(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target,r;n!=t.contentDOM;n=n.parentNode)if(!n||n.nodeType==11||(r=Qn.get(n))&&r.ignoreEvent(e))return!1;return!0}const Ma=Object.create(null),ca=Object.create(null),ZI=Je.ie&&Je.ie_version<15||Je.ios&&Je.webkit_version<604;function zse(t){let e=t.dom.parentNode;if(!e)return;let n=e.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus(),setTimeout(()=>{t.focus(),n.remove(),JI(t,n.value)},50)}function Kv(t,e,n){for(let r of t.facet(e))n=r(n,t);return n}function JI(t,e){e=Kv(t.state,R6,e);let{state:n}=t,r,s=1,i=n.toText(e),a=i.lines==n.selection.ranges.length;if(OS!=null&&n.selection.ranges.every(c=>c.empty)&&OS==i.toString()){let c=-1;r=n.changeByRange(h=>{let f=n.doc.lineAt(h.from);if(f.from==c)return{range:h};c=f.from;let m=n.toText((a?i.line(s++).text:e)+n.lineBreak);return{changes:{from:f.from,insert:m},range:Ae.cursor(h.from+m.length)}})}else a?r=n.changeByRange(c=>{let h=i.line(s++);return{changes:{from:c.from,to:c.to,insert:h.text},range:Ae.cursor(c.from+h.length)}}):r=n.replaceSelection(i);t.dispatch(r,{userEvent:"input.paste",scrollIntoView:!0})}ca.scroll=t=>{t.inputState.lastScrollTop=t.scrollDOM.scrollTop,t.inputState.lastScrollLeft=t.scrollDOM.scrollLeft};Ma.keydown=(t,e)=>(t.inputState.setSelectionOrigin("select"),e.keyCode==27&&t.inputState.tabFocusMode!=0&&(t.inputState.tabFocusMode=Date.now()+2e3),!1);ca.touchstart=(t,e)=>{t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")};ca.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")};Ma.mousedown=(t,e)=>{if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return!1;let n=null;for(let r of t.state.facet(AI))if(n=r(t,e),n)break;if(!n&&e.button==0&&(n=Ise(t,e)),n){let r=!t.hasFocus;t.inputState.startMouseSelection(new _se(t,e,n,r)),r&&t.observer.ignore(()=>{fI(t.contentDOM);let i=t.root.activeElement;i&&!i.contains(t.contentDOM)&&i.blur()});let s=t.inputState.mouseSelection;if(s)return s.start(e),s.dragging===!1}else t.inputState.setSelectionOrigin("select.pointer");return!1};function Z9(t,e,n,r){if(r==1)return Ae.cursor(e,n);if(r==2)return dse(t.state,e,n);{let s=qr.find(t.docView,e),i=t.state.doc.lineAt(s?s.posAtEnd:e),a=s?s.posAtStart:i.from,o=s?s.posAtEnd:i.to;return oe>=n.top&&e<=n.bottom&&t>=n.left&&t<=n.right;function Pse(t,e,n,r){let s=qr.find(t.docView,e);if(!s)return 1;let i=e-s.posAtStart;if(i==0)return 1;if(i==s.length)return-1;let a=s.coordsAt(i,-1);if(a&&J9(n,r,a))return-1;let o=s.coordsAt(i,1);return o&&J9(n,r,o)?1:a&&a.bottom>=r?-1:1}function eT(t,e){let n=t.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:n,bias:Pse(t,n,e.clientX,e.clientY)}}const Lse=Je.ie&&Je.ie_version<=11;let tT=null,nT=0,rT=0;function eB(t){if(!Lse)return t.detail;let e=tT,n=rT;return tT=t,rT=Date.now(),nT=!e||n>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(nT+1)%3:1}function Ise(t,e){let n=eT(t,e),r=eB(e),s=t.state.selection;return{update(i){i.docChanged&&(n.pos=i.changes.mapPos(n.pos),s=s.map(i.changes))},get(i,a,o){let c=eT(t,i),h,f=Z9(t,c.pos,c.bias,r);if(n.pos!=c.pos&&!a){let m=Z9(t,n.pos,n.bias,r),g=Math.min(m.from,f.from),x=Math.max(m.to,f.to);f=g1&&(h=Bse(s,c.pos))?h:o?s.addRange(f):Ae.create([f])}}}function Bse(t,e){for(let n=0;n=e)return Ae.create(t.ranges.slice(0,n).concat(t.ranges.slice(n+1)),t.mainIndex==n?0:t.mainIndex-(t.mainIndex>n?1:0))}return null}Ma.dragstart=(t,e)=>{let{selection:{main:n}}=t.state;if(e.target.draggable){let s=t.docView.nearest(e.target);if(s&&s.isWidget){let i=s.posAtStart,a=i+s.length;(i>=n.to||a<=n.from)&&(n=Ae.range(i,a))}}let{inputState:r}=t;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=n,e.dataTransfer&&(e.dataTransfer.setData("Text",Kv(t.state,D6,t.state.sliceDoc(n.from,n.to))),e.dataTransfer.effectAllowed="copyMove"),!1};Ma.dragend=t=>(t.inputState.draggedContent=null,!1);function sT(t,e,n,r){if(n=Kv(t.state,R6,n),!n)return;let s=t.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:i}=t.inputState,a=r&&i&&Ase(t,e)?{from:i.from,to:i.to}:null,o={from:s,insert:n},c=t.state.changes(a?[a,o]:o);t.focus(),t.dispatch({changes:c,selection:{anchor:c.mapPos(s,-1),head:c.mapPos(s,1)},userEvent:a?"move.drop":"input.drop"}),t.inputState.draggedContent=null}Ma.drop=(t,e)=>{if(!e.dataTransfer)return!1;if(t.state.readOnly)return!0;let n=e.dataTransfer.files;if(n&&n.length){let r=Array(n.length),s=0,i=()=>{++s==n.length&&sT(t,e,r.filter(a=>a!=null).join(t.state.lineBreak),!1)};for(let a=0;a{/[\x00-\x08\x0e-\x1f]{2}/.test(o.result)||(r[a]=o.result),i()},o.readAsText(n[a])}return!0}else{let r=e.dataTransfer.getData("Text");if(r)return sT(t,e,r,!0),!0}return!1};Ma.paste=(t,e)=>{if(t.state.readOnly)return!0;t.observer.flush();let n=ZI?null:e.clipboardData;return n?(JI(t,n.getData("text/plain")||n.getData("text/uri-list")),!0):(zse(t),!1)};function qse(t,e){let n=t.dom.parentNode;if(!n)return;let r=n.appendChild(document.createElement("textarea"));r.style.cssText="position: fixed; left: -10000px; top: 10px",r.value=e,r.focus(),r.selectionEnd=e.length,r.selectionStart=0,setTimeout(()=>{r.remove(),t.focus()},50)}function Fse(t){let e=[],n=[],r=!1;for(let s of t.selection.ranges)s.empty||(e.push(t.sliceDoc(s.from,s.to)),n.push(s));if(!e.length){let s=-1;for(let{from:i}of t.selection.ranges){let a=t.doc.lineAt(i);a.number>s&&(e.push(a.text),n.push({from:a.from,to:Math.min(t.doc.length,a.to+1)})),s=a.number}r=!0}return{text:Kv(t,D6,e.join(t.lineBreak)),ranges:n,linewise:r}}let OS=null;Ma.copy=Ma.cut=(t,e)=>{let{text:n,ranges:r,linewise:s}=Fse(t.state);if(!n&&!s)return!1;OS=s?n:null,e.type=="cut"&&!t.state.readOnly&&t.dispatch({changes:r,scrollIntoView:!0,userEvent:"delete.cut"});let i=ZI?null:e.clipboardData;return i?(i.clearData(),i.setData("text/plain",n),!0):(qse(t,n),!1)};const tB=pl.define();function nB(t,e){let n=[];for(let r of t.facet(zI)){let s=r(t,e);s&&n.push(s)}return n.length?t.update({effects:n,annotations:tB.of(!0)}):null}function rB(t){setTimeout(()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let n=nB(t.state,e);n?t.dispatch(n):t.update([])}},10)}ca.focus=t=>{t.inputState.lastFocusTime=Date.now(),!t.scrollDOM.scrollTop&&(t.inputState.lastScrollTop||t.inputState.lastScrollLeft)&&(t.scrollDOM.scrollTop=t.inputState.lastScrollTop,t.scrollDOM.scrollLeft=t.inputState.lastScrollLeft),rB(t)};ca.blur=t=>{t.observer.clearSelectionRange(),rB(t)};ca.compositionstart=ca.compositionupdate=t=>{t.observer.editContext||(t.inputState.compositionFirstChange==null&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0))};ca.compositionend=t=>{t.observer.editContext||(t.inputState.composing=-1,t.inputState.compositionEndedAt=Date.now(),t.inputState.compositionPendingKey=!0,t.inputState.compositionPendingChange=t.observer.pendingRecords().length>0,t.inputState.compositionFirstChange=null,Je.chrome&&Je.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then(()=>t.observer.flush()):setTimeout(()=>{t.inputState.composing<0&&t.docView.hasComposition&&t.update([])},50))};ca.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()};Ma.beforeinput=(t,e)=>{var n,r;if((e.inputType=="insertText"||e.inputType=="insertCompositionText")&&(t.inputState.insertingText=e.data,t.inputState.insertingTextAt=Date.now()),e.inputType=="insertReplacementText"&&t.observer.editContext){let i=(n=e.dataTransfer)===null||n===void 0?void 0:n.getData("text/plain"),a=e.getTargetRanges();if(i&&a.length){let o=a[0],c=t.posAtDOM(o.startContainer,o.startOffset),h=t.posAtDOM(o.endContainer,o.endOffset);return L6(t,{from:c,to:h,insert:t.state.toText(i)},null),!0}}let s;if(Je.chrome&&Je.android&&(s=YI.find(i=>i.inputType==e.inputType))&&(t.observer.delayAndroidKey(s.key,s.keyCode),s.key=="Backspace"||s.key=="Delete")){let i=((r=window.visualViewport)===null||r===void 0?void 0:r.height)||0;setTimeout(()=>{var a;(((a=window.visualViewport)===null||a===void 0?void 0:a.height)||0)>i+10&&t.hasFocus&&(t.contentDOM.blur(),t.focus())},100)}return Je.ios&&e.inputType=="deleteContentForward"&&t.observer.flushSoon(),Je.safari&&e.inputType=="insertText"&&t.inputState.composing>=0&&setTimeout(()=>ca.compositionend(t,e),20),!1};const iT=new Set;function $se(t){iT.has(t)||(iT.add(t),t.addEventListener("copy",()=>{}),t.addEventListener("cut",()=>{}))}const aT=["pre-wrap","normal","pre-line","break-spaces"];let Sh=!1;function lT(){Sh=!1}class Qse{constructor(e){this.lineWrapping=e,this.doc=pn.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,n){let r=this.doc.lineAt(n).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(r+=Math.max(0,Math.ceil((n-e-r*this.lineLength*.5)/this.lineLength))),this.lineHeight*r}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return aT.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let n=!1;for(let r=0;r-1,c=Math.round(n)!=Math.round(this.lineHeight)||this.lineWrapping!=o;if(this.lineWrapping=o,this.lineHeight=n,this.charWidth=r,this.textHeight=s,this.lineLength=i,c){this.heightSamples={};for(let h=0;h0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>l1&&(Sh=!0),this.height=e)}replace(e,n,r){return Bs.of(r)}decomposeLeft(e,n){n.push(this)}decomposeRight(e,n){n.push(this)}applyChanges(e,n,r,s){let i=this,a=r.doc;for(let o=s.length-1;o>=0;o--){let{fromA:c,toA:h,fromB:f,toB:m}=s[o],g=i.lineAt(c,rr.ByPosNoHeight,r.setDoc(n),0,0),x=g.to>=h?g:i.lineAt(h,rr.ByPosNoHeight,r,0,0);for(m+=x.to-h,h=x.to;o>0&&g.from<=s[o-1].toA;)c=s[o-1].fromA,f=s[o-1].fromB,o--,ci*2){let o=e[n-1];o.break?e.splice(--n,1,o.left,null,o.right):e.splice(--n,1,o.left,o.right),r+=1+o.break,s-=o.size}else if(i>s*2){let o=e[r];o.break?e.splice(r,1,o.left,null,o.right):e.splice(r,1,o.left,o.right),r+=2+o.break,i-=o.size}else break;else if(s=i&&a(this.blockAt(0,r,s,i))}updateHeight(e,n=0,r=!1,s){return s&&s.from<=n&&s.more&&this.setHeight(s.heights[s.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class Ni extends sB{constructor(e,n){super(e,n,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,n,r,s){return new Ja(s,this.length,r,this.height,this.breaks)}replace(e,n,r){let s=r[0];return r.length==1&&(s instanceof Ni||s instanceof gs&&s.flags&4)&&Math.abs(this.length-s.length)<10?(s instanceof gs?s=new Ni(s.length,this.height):s.height=this.height,this.outdated||(s.outdated=!1),s):Bs.of(r)}updateHeight(e,n=0,r=!1,s){return s&&s.from<=n&&s.more?this.setHeight(s.heights[s.index++]):(r||this.outdated)&&this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class gs extends Bs{constructor(e){super(e,0)}heightMetrics(e,n){let r=e.doc.lineAt(n).number,s=e.doc.lineAt(n+this.length).number,i=s-r+1,a,o=0;if(e.lineWrapping){let c=Math.min(this.height,e.lineHeight*i);a=c/i,this.length>i+1&&(o=(this.height-c)/(this.length-i-1))}else a=this.height/i;return{firstLine:r,lastLine:s,perLine:a,perChar:o}}blockAt(e,n,r,s){let{firstLine:i,lastLine:a,perLine:o,perChar:c}=this.heightMetrics(n,s);if(n.lineWrapping){let h=s+(e0){let i=r[r.length-1];i instanceof gs?r[r.length-1]=new gs(i.length+s):r.push(null,new gs(s-1))}if(e>0){let i=r[0];i instanceof gs?r[0]=new gs(e+i.length):r.unshift(new gs(e-1),null)}return Bs.of(r)}decomposeLeft(e,n){n.push(new gs(e-1),null)}decomposeRight(e,n){n.push(null,new gs(this.length-e-1))}updateHeight(e,n=0,r=!1,s){let i=n+this.length;if(s&&s.from<=n+this.length&&s.more){let a=[],o=Math.max(n,s.from),c=-1;for(s.from>n&&a.push(new gs(s.from-n-1).updateHeight(e,n));o<=i&&s.more;){let f=e.doc.lineAt(o).length;a.length&&a.push(null);let m=s.heights[s.index++];c==-1?c=m:Math.abs(m-c)>=l1&&(c=-2);let g=new Ni(f,m);g.outdated=!1,a.push(g),o+=f+1}o<=i&&a.push(null,new gs(i-o).updateHeight(e,o));let h=Bs.of(a);return(c<0||Math.abs(h.height-this.height)>=l1||Math.abs(c-this.heightMetrics(e,n).perLine)>=l1)&&(Sh=!0),B1(this,h)}else(r||this.outdated)&&(this.setHeight(e.heightForGap(n,n+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class Vse extends Bs{constructor(e,n,r){super(e.length+n+r.length,e.height+r.height,n|(e.outdated||r.outdated?2:0)),this.left=e,this.right=r,this.size=e.size+r.size}get break(){return this.flags&1}blockAt(e,n,r,s){let i=r+this.left.height;return eo))return h;let f=n==rr.ByPosNoHeight?rr.ByPosNoHeight:rr.ByPos;return c?h.join(this.right.lineAt(o,f,r,a,o)):this.left.lineAt(o,f,r,s,i).join(h)}forEachLine(e,n,r,s,i,a){let o=s+this.left.height,c=i+this.left.length+this.break;if(this.break)e=c&&this.right.forEachLine(e,n,r,o,c,a);else{let h=this.lineAt(c,rr.ByPos,r,s,i);e=e&&h.from<=n&&a(h),n>h.to&&this.right.forEachLine(h.to+1,n,r,o,c,a)}}replace(e,n,r){let s=this.left.length+this.break;if(nthis.left.length)return this.balanced(this.left,this.right.replace(e-s,n-s,r));let i=[];e>0&&this.decomposeLeft(e,i);let a=i.length;for(let o of r)i.push(o);if(e>0&&oT(i,a-1),n=r&&n.push(null)),e>r&&this.right.decomposeLeft(e-r,n)}decomposeRight(e,n){let r=this.left.length,s=r+this.break;if(e>=s)return this.right.decomposeRight(e-s,n);e2*n.size||n.size>2*e.size?Bs.of(this.break?[e,null,n]:[e,n]):(this.left=B1(this.left,e),this.right=B1(this.right,n),this.setHeight(e.height+n.height),this.outdated=e.outdated||n.outdated,this.size=e.size+n.size,this.length=e.length+this.break+n.length,this)}updateHeight(e,n=0,r=!1,s){let{left:i,right:a}=this,o=n+i.length+this.break,c=null;return s&&s.from<=n+i.length&&s.more?c=i=i.updateHeight(e,n,r,s):i.updateHeight(e,n,r),s&&s.from<=o+a.length&&s.more?c=a=a.updateHeight(e,o,r,s):a.updateHeight(e,o,r),c?this.balanced(i,a):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function oT(t,e){let n,r;t[e]==null&&(n=t[e-1])instanceof gs&&(r=t[e+1])instanceof gs&&t.splice(e-1,3,new gs(n.length+1+r.length))}const Use=5;class I6{constructor(e,n){this.pos=e,this.oracle=n,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,n){if(this.lineStart>-1){let r=Math.min(n,this.lineEnd),s=this.nodes[this.nodes.length-1];s instanceof Ni?s.length+=r-this.pos:(r>this.pos||!this.isCovered)&&this.nodes.push(new Ni(r-this.pos,-1)),this.writtenTo=r,n>r&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=n}point(e,n,r){if(e=Use)&&this.addLineDeco(s,i,a)}else n>e&&this.span(e,n);this.lineEnd>-1&&this.lineEnd-1)return;let{from:e,to:n}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=n,this.writtenToe&&this.nodes.push(new Ni(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,n){let r=new gs(n-e);return this.oracle.doc.lineAt(e).to==n&&(r.flags|=4),r}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof Ni)return e;let n=new Ni(0,-1);return this.nodes.push(n),n}addBlock(e){this.enterLine();let n=e.deco;n&&n.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,n&&n.endSide>0&&(this.covering=e)}addLineDeco(e,n,r){let s=this.ensureLine();s.length+=r,s.collapsed+=r,s.widgetHeight=Math.max(s.widgetHeight,e),s.breaks+=n,this.writtenTo=this.pos=this.pos+r}finish(e){let n=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(n instanceof Ni)&&!this.isCovered?this.nodes.push(new Ni(0,-1)):(this.writtenTof.clientHeight||f.scrollWidth>f.clientWidth)&&m.overflow!="visible"){let g=f.getBoundingClientRect();i=Math.max(i,g.left),a=Math.min(a,g.right),o=Math.max(o,g.top),c=Math.min(h==t.parentNode?s.innerHeight:c,g.bottom)}h=m.position=="absolute"||m.position=="fixed"?f.offsetParent:f.parentNode}else if(h.nodeType==11)h=h.host;else break;return{left:i-n.left,right:Math.max(i,a)-n.left,top:o-(n.top+e),bottom:Math.max(o,c)-(n.top+e)}}function Yse(t){let e=t.getBoundingClientRect(),n=t.ownerDocument.defaultView||window;return e.left0&&e.top0}function Kse(t,e){let n=t.getBoundingClientRect();return{left:0,right:n.right-n.left,top:e,bottom:n.bottom-(n.top+e)}}class kw{constructor(e,n,r,s){this.from=e,this.to=n,this.size=r,this.displaySize=s}static same(e,n){if(e.length!=n.length)return!1;for(let r=0;rtypeof r!="function"&&r.class=="cm-lineWrapping");this.heightOracle=new Qse(n),this.stateDeco=e.facet(Ym).filter(r=>typeof r!="function"),this.heightMap=Bs.empty().applyChanges(this.stateDeco,pn.empty,this.heightOracle.setDoc(e.doc),[new ia(0,0,0,e.doc.length)]);for(let r=0;r<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());r++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=xt.set(this.lineGaps.map(r=>r.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:n}=this.state.selection;for(let r=0;r<=1;r++){let s=r?n.head:n.anchor;if(!e.some(({from:i,to:a})=>s>=i&&s<=a)){let{from:i,to:a}=this.lineBlockAt(s);e.push(new sx(i,a))}}return this.viewports=e.sort((r,s)=>r.from-s.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?uT:new B6(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(gm(e,this.scaler))})}update(e,n=null){this.state=e.state;let r=this.stateDeco;this.stateDeco=this.state.facet(Ym).filter(f=>typeof f!="function");let s=e.changedRanges,i=ia.extendWithRanges(s,Wse(r,this.stateDeco,e?e.changes:Kr.empty(this.state.doc.length))),a=this.heightMap.height,o=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);lT(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),i),(this.heightMap.height!=a||Sh)&&(e.flags|=2),o?(this.scrollAnchorPos=e.changes.mapPos(o.from,-1),this.scrollAnchorHeight=o.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=a);let c=i.length?this.mapViewport(this.viewport,e.changes):this.viewport;(n&&(n.range.headc.to)||!this.viewportIsAppropriate(c))&&(c=this.getViewport(0,n));let h=c.from!=this.viewport.from||c.to!=this.viewport.to;this.viewport=c,e.flags|=this.updateForViewport(),(h||!e.changes.empty||e.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(e.changes),n&&(this.scrollTarget=n),!this.mustEnforceCursorAssoc&&e.selectionSet&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(LI)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let n=e.contentDOM,r=window.getComputedStyle(n),s=this.heightOracle,i=r.whiteSpace;this.defaultTextDirection=r.direction=="rtl"?sr.RTL:sr.LTR;let a=this.heightOracle.mustRefreshForWrapping(i),o=n.getBoundingClientRect(),c=a||this.mustMeasureContent||this.contentDOMHeight!=o.height;this.contentDOMHeight=o.height,this.mustMeasureContent=!1;let h=0,f=0;if(o.width&&o.height){let{scaleX:T,scaleY:_}=hI(n,o);(T>.005&&Math.abs(this.scaleX-T)>.005||_>.005&&Math.abs(this.scaleY-_)>.005)&&(this.scaleX=T,this.scaleY=_,h|=16,a=c=!0)}let m=(parseInt(r.paddingTop)||0)*this.scaleY,g=(parseInt(r.paddingBottom)||0)*this.scaleY;(this.paddingTop!=m||this.paddingBottom!=g)&&(this.paddingTop=m,this.paddingBottom=g,h|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(s.lineWrapping&&(c=!0),this.editorWidth=e.scrollDOM.clientWidth,h|=16);let x=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=x&&(this.scrollAnchorHeight=-1,this.scrollTop=x),this.scrolledToBottom=pI(e.scrollDOM);let y=(this.printing?Kse:Xse)(n,this.paddingTop),w=y.top-this.pixelViewport.top,S=y.bottom-this.pixelViewport.bottom;this.pixelViewport=y;let k=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(k!=this.inView&&(this.inView=k,k&&(c=!0)),!this.inView&&!this.scrollTarget&&!Yse(e.dom))return 0;let N=o.width;if((this.contentDOMWidth!=N||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=o.width,this.editorHeight=e.scrollDOM.clientHeight,h|=16),c){let T=e.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(T)&&(a=!0),a||s.lineWrapping&&Math.abs(N-this.contentDOMWidth)>s.charWidth){let{lineHeight:_,charWidth:E,textHeight:M}=e.docView.measureTextSize();a=_>0&&s.refresh(i,_,E,M,Math.max(5,N/E),T),a&&(e.docView.minWidth=0,h|=16)}w>0&&S>0?f=Math.max(w,S):w<0&&S<0&&(f=Math.min(w,S)),lT();for(let _ of this.viewports){let E=_.from==this.viewport.from?T:e.docView.measureVisibleLineHeights(_);this.heightMap=(a?Bs.empty().applyChanges(this.stateDeco,pn.empty,this.heightOracle,[new ia(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(s,0,a,new Hse(_.from,E))}Sh&&(h|=2)}let C=!this.viewportIsAppropriate(this.viewport,f)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return C&&(h&2&&(h|=this.updateScaler()),this.viewport=this.getViewport(f,this.scrollTarget),h|=this.updateForViewport()),(h&2||C)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(a?[]:this.lineGaps,e)),h|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),h}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,n){let r=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),s=this.heightMap,i=this.heightOracle,{visibleTop:a,visibleBottom:o}=this,c=new sx(s.lineAt(a-r*1e3,rr.ByHeight,i,0,0).from,s.lineAt(o+(1-r)*1e3,rr.ByHeight,i,0,0).to);if(n){let{head:h}=n.range;if(hc.to){let f=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),m=s.lineAt(h,rr.ByPos,i,0,0),g;n.y=="center"?g=(m.top+m.bottom)/2-f/2:n.y=="start"||n.y=="nearest"&&h=o+Math.max(10,Math.min(r,250)))&&s>a-2*1e3&&i>1,a=s<<1;if(this.defaultTextDirection!=sr.LTR&&!r)return[];let o=[],c=(f,m,g,x)=>{if(m-ff&&kk.from>=g.from&&k.to<=g.to&&Math.abs(k.from-f)k.fromN));if(!S){if(mC.from<=m&&C.to>=m)){let C=n.moveToLineBoundary(Ae.cursor(m),!1,!0).head;C>f&&(m=C)}let k=this.gapSize(g,f,m,x),N=r||k<2e6?k:2e6;S=new kw(f,m,k,N)}o.push(S)},h=f=>{if(f.length2e6)for(let E of e)E.from>=f.from&&E.fromf.from&&c(f.from,x,f,m),yn.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let n=this.stateDeco;this.lineGaps.length&&(n=n.concat(this.lineGapDeco));let r=[];On.spans(n,this.viewport.from,this.viewport.to,{span(i,a){r.push({from:i,to:a})},point(){}},20);let s=0;if(r.length!=this.visibleRanges.length)s=12;else for(let i=0;i=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(n=>n.from<=e&&n.to>=e)||gm(this.heightMap.lineAt(e,rr.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(n=>n.top<=e&&n.bottom>=e)||gm(this.heightMap.lineAt(this.scaler.fromDOM(e),rr.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let n=this.lineBlockAtHeight(e+8);return n.from>=this.viewport.from||this.viewportLines[0].top-e>200?n:this.viewportLines[0]}elementAtHeight(e){return gm(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}let sx=class{constructor(e,n){this.from=e,this.to=n}};function Jse(t,e,n){let r=[],s=t,i=0;return On.spans(n,t,e,{span(){},point(a,o){a>s&&(r.push({from:s,to:a}),i+=a-s),s=o}},20),s=1)return e[e.length-1].to;let r=Math.floor(t*n);for(let s=0;;s++){let{from:i,to:a}=e[s],o=a-i;if(r<=o)return i+r;r-=o}}function ax(t,e){let n=0;for(let{from:r,to:s}of t.ranges){if(e<=s){n+=e-r;break}n+=s-r}return n/t.total}function eie(t,e){for(let n of t)if(e(n))return n}const uT={toDOM(t){return t},fromDOM(t){return t},scale:1,eq(t){return t==this}};class B6{constructor(e,n,r){let s=0,i=0,a=0;this.viewports=r.map(({from:o,to:c})=>{let h=n.lineAt(o,rr.ByPos,e,0,0).top,f=n.lineAt(c,rr.ByPos,e,0,0).bottom;return s+=f-h,{from:o,to:c,top:h,bottom:f,domTop:0,domBottom:0}}),this.scale=(7e6-s)/(n.height-s);for(let o of this.viewports)o.domTop=a+(o.top-i)*this.scale,a=o.domBottom=o.domTop+(o.bottom-o.top),i=o.bottom}toDOM(e){for(let n=0,r=0,s=0;;n++){let i=nn.from==e.viewports[r].from&&n.to==e.viewports[r].to):!1}}function gm(t,e){if(e.scale==1)return t;let n=e.toDOM(t.top),r=e.toDOM(t.bottom);return new Ja(t.from,t.length,n,r-n,Array.isArray(t._content)?t._content.map(s=>gm(s,e)):t._content)}const lx=nt.define({combine:t=>t.join(" ")}),NS=nt.define({combine:t=>t.indexOf(!0)>-1}),CS=yc.newName(),iB=yc.newName(),aB=yc.newName(),lB={"&light":"."+iB,"&dark":"."+aB};function TS(t,e,n){return new yc(e,{finish(r){return/&/.test(r)?r.replace(/&\w*/,s=>{if(s=="&")return t;if(!n||!n[s])throw new RangeError(`Unsupported selector: ${s}`);return n[s]}):t+" "+r}})}const tie=TS("."+CS,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},lB),nie={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},jw=Je.ie&&Je.ie_version<=11;class rie{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new Bre,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(n=>{for(let r of n)this.queue.push(r);(Je.ie&&Je.ie_version<=11||Je.ios&&e.composing)&&n.some(r=>r.type=="childList"&&r.removedNodes.length||r.type=="characterData"&&r.oldValue.length>r.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&Je.android&&e.constructor.EDIT_CONTEXT!==!1&&!(Je.chrome&&Je.chrome_version<126)&&(this.editContext=new iie(e),e.state.facet(no)&&(e.contentDOM.editContext=this.editContext.editContext)),jw&&(this.onCharData=n=>{this.queue.push({target:n.target,type:"characterData",oldValue:n.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var n;((n=this.view.docView)===null||n===void 0?void 0:n.lastUpdate){this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),n.length>0&&n[n.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(n=>{n.length>0&&n[n.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){(e.type=="change"||!e.type)&&!e.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((n,r)=>n!=e[r]))){this.gapIntersection.disconnect();for(let n of e)this.gapIntersection.observe(n);this.gaps=e}}onSelectionChange(e){let n=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:r}=this,s=this.selectionRange;if(r.state.facet(no)?r.root.activeElement!=this.dom:!i1(this.dom,s))return;let i=s.anchorNode&&r.docView.nearest(s.anchorNode);if(i&&i.ignoreEvent(e)){n||(this.selectionChanged=!1);return}(Je.ie&&Je.ie_version<=11||Je.android&&Je.chrome)&&!r.state.selection.main.empty&&s.focusNode&&Em(s.focusNode,s.focusOffset,s.anchorNode,s.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,n=Xm(e.root);if(!n)return!1;let r=Je.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&sie(this.view,n)||n;if(!r||this.selectionRange.eq(r))return!1;let s=i1(this.dom,r);return s&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime{let i=this.delayedAndroidKey;i&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=i.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&i.force&&rh(this.dom,i.key,i.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(s)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:n,force:this.lastChange{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let n=-1,r=-1,s=!1;for(let i of e){let a=this.readMutation(i);a&&(a.typeOver&&(s=!0),n==-1?{from:n,to:r}=a:(n=Math.min(a.from,n),r=Math.max(a.to,r)))}return{from:n,to:r,typeOver:s}}readChange(){let{from:e,to:n,typeOver:r}=this.processRecords(),s=this.selectionChanged&&i1(this.dom,this.selectionRange);if(e<0&&!s)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let i=new Sse(this.view,e,n,r);return this.view.docView.domChanged={newSel:i.newSel?i.newSel.main:null},i}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let n=this.readChange();if(!n)return this.view.requestMeasure(),!1;let r=this.view.state,s=GI(this.view,n);return this.view.state==r&&(n.domChanged||n.newSel&&!n.newSel.main.eq(this.view.state.selection.main))&&this.view.update([]),s}readMutation(e){let n=this.view.docView.nearest(e.target);if(!n||n.ignoreMutation(e))return null;if(n.markDirty(e.type=="attributes"),e.type=="attributes"&&(n.flags|=4),e.type=="childList"){let r=dT(n,e.previousSibling||e.target.previousSibling,-1),s=dT(n,e.nextSibling||e.target.nextSibling,1);return{from:r?n.posAfter(r):n.posAtStart,to:s?n.posBefore(s):n.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(no)!=e.state.facet(no)&&(e.view.contentDOM.editContext=e.state.facet(no)?this.editContext.editContext:null))}destroy(){var e,n,r;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(n=this.gapIntersection)===null||n===void 0||n.disconnect(),(r=this.resizeScroll)===null||r===void 0||r.disconnect();for(let s of this.scrollTargets)s.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function dT(t,e,n){for(;e;){let r=Qn.get(e);if(r&&r.parent==t)return r;let s=e.parentNode;e=s!=t.dom?s:n>0?e.nextSibling:e.previousSibling}return null}function hT(t,e){let n=e.startContainer,r=e.startOffset,s=e.endContainer,i=e.endOffset,a=t.docView.domAtPos(t.state.selection.main.anchor);return Em(a.node,a.offset,s,i)&&([n,r,s,i]=[s,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:s,focusOffset:i}}function sie(t,e){if(e.getComposedRanges){let s=e.getComposedRanges(t.root)[0];if(s)return hT(t,s)}let n=null;function r(s){s.preventDefault(),s.stopImmediatePropagation(),n=s.getTargetRanges()[0]}return t.contentDOM.addEventListener("beforeinput",r,!0),t.dom.ownerDocument.execCommand("indent"),t.contentDOM.removeEventListener("beforeinput",r,!0),n?hT(t,n):null}class iie{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let n=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=r=>{let s=e.state.selection.main,{anchor:i,head:a}=s,o=this.toEditorPos(r.updateRangeStart),c=this.toEditorPos(r.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:r.updateRangeStart,editorBase:o,drifted:!1});let h=c-o>r.text.length;o==this.from&&ithis.to&&(c=i);let f=XI(e.state.sliceDoc(o,c),r.text,(h?s.from:s.to)-o,h?"end":null);if(!f){let g=Ae.single(this.toEditorPos(r.selectionStart),this.toEditorPos(r.selectionEnd));g.main.eq(s)||e.dispatch({selection:g,userEvent:"select"});return}let m={from:f.from+o,to:f.toA+o,insert:pn.of(r.text.slice(f.from,f.toB).split(` +`))};if((Je.mac||Je.android)&&m.from==a-1&&/^\. ?$/.test(r.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(m={from:o,to:c,insert:pn.of([r.text.replace("."," ")])}),this.pendingContextChange=m,!e.state.readOnly){let g=this.to-this.from+(m.to-m.from+m.insert.length);L6(e,m,Ae.single(this.toEditorPos(r.selectionStart,g),this.toEditorPos(r.selectionEnd,g)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),m.from=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(n.text.slice(Math.max(0,r.updateRangeStart-1),Math.min(n.text.length,r.updateRangeStart+1)))&&this.handlers.compositionend(r)},this.handlers.characterboundsupdate=r=>{let s=[],i=null;for(let a=this.toEditorPos(r.rangeStart),o=this.toEditorPos(r.rangeEnd);a{let s=[];for(let i of r.getTextFormats()){let a=i.underlineStyle,o=i.underlineThickness;if(!/none/i.test(a)&&!/none/i.test(o)){let c=this.toEditorPos(i.rangeStart),h=this.toEditorPos(i.rangeEnd);if(c{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:r}=this.composing;this.composing=null,r&&this.reset(e.state)}};for(let r in this.handlers)n.addEventListener(r,this.handlers[r]);this.measureReq={read:r=>{this.editContext.updateControlBounds(r.contentDOM.getBoundingClientRect());let s=Xm(r.root);s&&s.rangeCount&&this.editContext.updateSelectionBounds(s.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let n=0,r=!1,s=this.pendingContextChange;return e.changes.iterChanges((i,a,o,c,h)=>{if(r)return;let f=h.length-(a-i);if(s&&a>=s.to)if(s.from==i&&s.to==a&&s.insert.eq(h)){s=this.pendingContextChange=null,n+=f,this.to+=f;return}else s=null,this.revertPending(e.state);if(i+=n,a+=n,a<=this.from)this.from+=f,this.to+=f;else if(ithis.to||this.to-this.from+h.length>3e4){r=!0;return}this.editContext.updateText(this.toContextPos(i),this.toContextPos(a),h.toString()),this.to+=f}n+=f}),s&&!r&&this.revertPending(e.state),!r}update(e){let n=this.pendingContextChange,r=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(r.from,r.to)&&e.transactions.some(s=>!s.isUserEvent("input.type")&&s.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||n)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:n}=e.selection.main;this.from=Math.max(0,n-1e4),this.to=Math.min(e.doc.length,n+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let n=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(n.from),this.toContextPos(n.from+n.insert.length),e.doc.sliceString(n.from,n.to))}setSelection(e){let{main:n}=e.selection,r=this.toContextPos(Math.max(this.from,Math.min(this.to,n.anchor))),s=this.toContextPos(n.head);(this.editContext.selectionStart!=r||this.editContext.selectionEnd!=s)&&this.editContext.updateSelection(r,s)}rangeIsValid(e){let{head:n}=e.selection.main;return!(this.from>0&&n-this.from<500||this.to1e4*3)}toEditorPos(e,n=this.to-this.from){e=Math.min(e,n);let r=this.composing;return r&&r.drifted?r.editorBase+(e-r.contextBase):e+this.from}toContextPos(e){let n=this.composing;return n&&n.drifted?n.contextBase+(e-n.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class Ke{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var n;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:r}=e;this.dispatchTransactions=e.dispatchTransactions||r&&(s=>s.forEach(i=>r(i,this)))||(s=>this.update(s)),this.dispatch=this.dispatch.bind(this),this._root=e.root||qre(e.parent)||document,this.viewState=new cT(e.state||dn.create(e)),e.scrollTo&&e.scrollTo.is(tx)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Gd).map(s=>new bw(s));for(let s of this.plugins)s.update(this);this.observer=new rie(this),this.inputState=new Nse(this),this.inputState.ensureHandlers(this.plugins),this.docView=new H9(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((n=document.fonts)===null||n===void 0)&&n.ready&&document.fonts.ready.then(()=>this.requestMeasure())}dispatch(...e){let n=e.length==1&&e[0]instanceof $r?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(n,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let n=!1,r=!1,s,i=this.state;for(let g of e){if(g.startState!=i)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");i=g.state}if(this.destroyed){this.viewState.state=i;return}let a=this.hasFocus,o=0,c=null;e.some(g=>g.annotation(tB))?(this.inputState.notifiedFocused=a,o=1):a!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=a,c=nB(i,a),c||(o=1));let h=this.observer.delayedAndroidKey,f=null;if(h?(this.observer.clearDelayedAndroidKey(),f=this.observer.readChange(),(f&&!this.state.doc.eq(i.doc)||!this.state.selection.eq(i.selection))&&(f=null)):this.observer.clear(),i.facet(dn.phrases)!=this.state.facet(dn.phrases))return this.setState(i);s=I1.create(this,i,e),s.flags|=o;let m=this.viewState.scrollTarget;try{this.updateState=2;for(let g of e){if(m&&(m=m.map(g.changes)),g.scrollIntoView){let{main:x}=g.state.selection;m=new sh(x.empty?x:Ae.cursor(x.head,x.head>x.anchor?-1:1))}for(let x of g.effects)x.is(tx)&&(m=x.value.clip(this.state))}this.viewState.update(s,m),this.bidiCache=q1.update(this.bidiCache,s.changes),s.empty||(this.updatePlugins(s),this.inputState.update(s)),n=this.docView.update(s),this.state.facet(mm)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(n,e.some(g=>g.isUserEvent("select.pointer")))}finally{this.updateState=0}if(s.startState.facet(lx)!=s.state.facet(lx)&&(this.viewState.mustMeasureContent=!0),(n||r||m||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!s.empty)for(let g of this.state.facet(SS))try{g(s)}catch(x){ni(this.state,x,"update listener")}(c||f)&&Promise.resolve().then(()=>{c&&this.state==c.startState&&this.dispatch(c),f&&!GI(this,f)&&h.force&&rh(this.contentDOM,h.key,h.keyCode)})}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let n=this.hasFocus;try{for(let r of this.plugins)r.destroy(this);this.viewState=new cT(e),this.plugins=e.facet(Gd).map(r=>new bw(r)),this.pluginMap.clear();for(let r of this.plugins)r.update(this);this.docView.destroy(),this.docView=new H9(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}n&&this.focus(),this.requestMeasure()}updatePlugins(e){let n=e.startState.facet(Gd),r=e.state.facet(Gd);if(n!=r){let s=[];for(let i of r){let a=n.indexOf(i);if(a<0)s.push(new bw(i));else{let o=this.plugins[a];o.mustUpdate=e,s.push(o)}}for(let i of this.plugins)i.mustUpdate!=e&&i.destroy(this);this.plugins=s,this.pluginMap.clear()}else for(let s of this.plugins)s.mustUpdate=e;for(let s=0;s-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let n=null,r=this.scrollDOM,s=r.scrollTop*this.scaleY,{scrollAnchorPos:i,scrollAnchorHeight:a}=this.viewState;Math.abs(s-this.viewState.scrollTop)>1&&(a=-1),this.viewState.scrollAnchorHeight=-1;try{for(let o=0;;o++){if(a<0)if(pI(r))i=-1,a=this.viewState.heightMap.height;else{let x=this.viewState.scrollAnchorAt(s);i=x.from,a=x.top}this.updateState=1;let c=this.viewState.measure(this);if(!c&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(o>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let h=[];c&4||([this.measureRequests,h]=[h,this.measureRequests]);let f=h.map(x=>{try{return x.read(this)}catch(y){return ni(this.state,y),fT}}),m=I1.create(this,this.state,[]),g=!1;m.flags|=c,n?n.flags|=c:n=m,this.updateState=2,m.empty||(this.updatePlugins(m),this.inputState.update(m),this.updateAttrs(),g=this.docView.update(m),g&&this.docViewUpdate());for(let x=0;x1||y<-1){s=s+y,r.scrollTop=s/this.scaleY,a=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(n&&!n.empty)for(let o of this.state.facet(SS))o(n)}get themeClasses(){return CS+" "+(this.state.facet(NS)?aB:iB)+" "+this.state.facet(lx)}updateAttrs(){let e=mT(this,qI,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),n={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(no)?"true":"false",class:"cm-content",style:`${Je.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(n["aria-readonly"]="true"),mT(this,z6,n);let r=this.observer.ignore(()=>{let s=xS(this.contentDOM,this.contentAttrs,n),i=xS(this.dom,this.editorAttrs,e);return s||i});return this.editorAttrs=e,this.contentAttrs=n,r}showAnnouncements(e){let n=!0;for(let r of e)for(let s of r.effects)if(s.is(Ke.announce)){n&&(this.announceDOM.textContent=""),n=!1;let i=this.announceDOM.appendChild(document.createElement("div"));i.textContent=s.value}}mountStyles(){this.styleModules=this.state.facet(mm);let e=this.state.facet(Ke.cspNonce);yc.mount(this.root,this.styleModules.concat(tie).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let n=0;nr.plugin==e)||null),n&&n.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,n,r){return Sw(this,e,X9(this,e,n,r))}moveByGroup(e,n){return Sw(this,e,X9(this,e,n,r=>xse(this,e.head,r)))}visualLineSide(e,n){let r=this.bidiSpans(e),s=this.textDirectionAt(e.from),i=r[n?r.length-1:0];return Ae.cursor(i.side(n,s)+e.from,i.forward(!n,s)?1:-1)}moveToLineBoundary(e,n,r=!0){return gse(this,e,n,r)}moveVertically(e,n,r){return Sw(this,e,vse(this,e,n,r))}domAtPos(e){return this.docView.domAtPos(e)}posAtDOM(e,n=0){return this.docView.posFromDOM(e,n)}posAtCoords(e,n=!0){return this.readMeasured(),VI(this,e,n)}coordsAtPos(e,n=1){this.readMeasured();let r=this.docView.coordsAt(e,n);if(!r||r.left==r.right)return r;let s=this.state.doc.lineAt(e),i=this.bidiSpans(s),a=i[hc.find(i,e-s.from,-1,n)];return W0(r,a.dir==sr.LTR==n>0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(PI)||ethis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>aie)return TI(e.length);let n=this.textDirectionAt(e.from),r;for(let i of this.bidiCache)if(i.from==e.from&&i.dir==n&&(i.fresh||CI(i.isolates,r=Q9(this,e))))return i.order;r||(r=Q9(this,e));let s=ese(e.text,n,r);return this.bidiCache.push(new q1(e.from,e.to,n,r,!0,s)),s}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||Je.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{fI(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,n={}){return tx.of(new sh(typeof e=="number"?Ae.cursor(e):e,n.y,n.x,n.yMargin,n.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:n}=this.scrollDOM,r=this.viewState.scrollAnchorAt(e);return tx.of(new sh(Ae.cursor(r.from),"start","start",r.top-e,n,!0))}setTabFocusMode(e){e==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof e=="boolean"?this.inputState.tabFocusMode=e?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return _r.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return _r.define(()=>({}),{eventObservers:e})}static theme(e,n){let r=yc.newName(),s=[lx.of(r),mm.of(TS(`.${r}`,e))];return n&&n.dark&&s.push(NS.of(!0)),s}static baseTheme(e){return Ac.lowest(mm.of(TS("."+CS,e,lB)))}static findFromDOM(e){var n;let r=e.querySelector(".cm-content"),s=r&&Qn.get(r)||Qn.get(e);return((n=s?.rootView)===null||n===void 0?void 0:n.view)||null}}Ke.styleModule=mm;Ke.inputHandler=DI;Ke.clipboardInputFilter=R6;Ke.clipboardOutputFilter=D6;Ke.scrollHandler=II;Ke.focusChangeEffect=zI;Ke.perLineTextDirection=PI;Ke.exceptionSink=RI;Ke.updateListener=SS;Ke.editable=no;Ke.mouseSelectionStyle=AI;Ke.dragMovesSelection=MI;Ke.clickAddsSelectionRange=_I;Ke.decorations=Ym;Ke.outerDecorations=FI;Ke.atomicRanges=Y0;Ke.bidiIsolatedRanges=$I;Ke.scrollMargins=QI;Ke.darkTheme=NS;Ke.cspNonce=nt.define({combine:t=>t.length?t[0]:""});Ke.contentAttributes=z6;Ke.editorAttributes=qI;Ke.lineWrapping=Ke.contentAttributes.of({class:"cm-lineWrapping"});Ke.announce=Lt.define();const aie=4096,fT={};class q1{constructor(e,n,r,s,i,a){this.from=e,this.to=n,this.dir=r,this.isolates=s,this.fresh=i,this.order=a}static update(e,n){if(n.empty&&!e.some(i=>i.fresh))return e;let r=[],s=e.length?e[e.length-1].dir:sr.LTR;for(let i=Math.max(0,e.length-10);i=0;s--){let i=r[s],a=typeof i=="function"?i(t):i;a&&gS(a,n)}return n}const lie=Je.mac?"mac":Je.windows?"win":Je.linux?"linux":"key";function oie(t,e){const n=t.split(/-(?!$)/);let r=n[n.length-1];r=="Space"&&(r=" ");let s,i,a,o;for(let c=0;cr.concat(s),[]))),n}function uie(t,e,n){return cB(oB(t.state),e,t,n)}let cc=null;const die=4e3;function hie(t,e=lie){let n=Object.create(null),r=Object.create(null),s=(a,o)=>{let c=r[a];if(c==null)r[a]=o;else if(c!=o)throw new Error("Key binding "+a+" is used both as a regular binding and as a multi-stroke prefix")},i=(a,o,c,h,f)=>{var m,g;let x=n[a]||(n[a]=Object.create(null)),y=o.split(/ (?!$)/).map(k=>oie(k,e));for(let k=1;k{let T=cc={view:C,prefix:N,scope:a};return setTimeout(()=>{cc==T&&(cc=null)},die),!0}]})}let w=y.join(" ");s(w,!1);let S=x[w]||(x[w]={preventDefault:!1,stopPropagation:!1,run:((g=(m=x._any)===null||m===void 0?void 0:m.run)===null||g===void 0?void 0:g.slice())||[]});c&&S.run.push(c),h&&(S.preventDefault=!0),f&&(S.stopPropagation=!0)};for(let a of t){let o=a.scope?a.scope.split(" "):["editor"];if(a.any)for(let h of o){let f=n[h]||(n[h]=Object.create(null));f._any||(f._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:m}=a;for(let g in f)f[g].run.push(x=>m(x,ES))}let c=a[e]||a.key;if(c)for(let h of o)i(h,c,a.run,a.preventDefault,a.stopPropagation),a.shift&&i(h,"Shift-"+c,a.shift,a.preventDefault,a.stopPropagation)}return n}let ES=null;function cB(t,e,n,r){ES=e;let s=Dre(e),i=ei(s,0),a=Za(i)==s.length&&s!=" ",o="",c=!1,h=!1,f=!1;cc&&cc.view==n&&cc.scope==r&&(o=cc.prefix+" ",KI.indexOf(e.keyCode)<0&&(h=!0,cc=null));let m=new Set,g=S=>{if(S){for(let k of S.run)if(!m.has(k)&&(m.add(k),k(n)))return S.stopPropagation&&(f=!0),!0;S.preventDefault&&(S.stopPropagation&&(f=!0),h=!0)}return!1},x=t[r],y,w;return x&&(g(x[o+ox(s,e,!a)])?c=!0:a&&(e.altKey||e.metaKey||e.ctrlKey)&&!(Je.windows&&e.ctrlKey&&e.altKey)&&!(Je.mac&&e.altKey&&!(e.ctrlKey||e.metaKey))&&(y=bc[e.keyCode])&&y!=s?(g(x[o+ox(y,e,!0)])||e.shiftKey&&(w=Gm[e.keyCode])!=s&&w!=y&&g(x[o+ox(w,e,!1)]))&&(c=!0):a&&e.shiftKey&&g(x[o+ox(s,e,!0)])&&(c=!0),!c&&g(x._any)&&(c=!0)),h&&(c=!0),c&&f&&e.stopPropagation(),ES=null,c}class Z0{constructor(e,n,r,s,i){this.className=e,this.left=n,this.top=r,this.width=s,this.height=i}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,n){return n.className!=this.className?!1:(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",this.width!=null&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,n,r){if(r.empty){let s=e.coordsAtPos(r.head,r.assoc||1);if(!s)return[];let i=uB(e);return[new Z0(n,s.left-i.left,s.top-i.top,null,s.bottom-s.top)]}else return fie(e,n,r)}}function uB(t){let e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==sr.LTR?e.left:e.right-t.scrollDOM.clientWidth*t.scaleX)-t.scrollDOM.scrollLeft*t.scaleX,top:e.top-t.scrollDOM.scrollTop*t.scaleY}}function gT(t,e,n,r){let s=t.coordsAtPos(e,n*2);if(!s)return r;let i=t.dom.getBoundingClientRect(),a=(s.top+s.bottom)/2,o=t.posAtCoords({x:i.left+1,y:a}),c=t.posAtCoords({x:i.right-1,y:a});return o==null||c==null?r:{from:Math.max(r.from,Math.min(o,c)),to:Math.min(r.to,Math.max(o,c))}}function fie(t,e,n){if(n.to<=t.viewport.from||n.from>=t.viewport.to)return[];let r=Math.max(n.from,t.viewport.from),s=Math.min(n.to,t.viewport.to),i=t.textDirection==sr.LTR,a=t.contentDOM,o=a.getBoundingClientRect(),c=uB(t),h=a.querySelector(".cm-line"),f=h&&window.getComputedStyle(h),m=o.left+(f?parseInt(f.paddingLeft)+Math.min(0,parseInt(f.textIndent)):0),g=o.right-(f?parseInt(f.paddingRight):0),x=jS(t,r,1),y=jS(t,s,-1),w=x.type==Is.Text?x:null,S=y.type==Is.Text?y:null;if(w&&(t.lineWrapping||x.widgetLineBreaks)&&(w=gT(t,r,1,w)),S&&(t.lineWrapping||y.widgetLineBreaks)&&(S=gT(t,s,-1,S)),w&&S&&w.from==S.from&&w.to==S.to)return N(C(n.from,n.to,w));{let _=w?C(n.from,null,w):T(x,!1),E=S?C(null,n.to,S):T(y,!0),M=[];return(w||x).to<(S||y).from-(w&&S?1:0)||x.widgetLineBreaks>1&&_.bottom+t.defaultLineHeight/2U&&z.from=B)break;R>H&&Q(Math.max(G,H),_==null&&G<=U,Math.min(R,B),E==null&&R>=ee,J.dir)}if(H=X.to+1,H>=B)break}return I.length==0&&Q(U,_==null,ee,E==null,t.textDirection),{top:L,bottom:P,horizontal:I}}function T(_,E){let M=o.top+(E?_.top:_.bottom);return{top:M,bottom:M,horizontal:[]}}}function mie(t,e){return t.constructor==e.constructor&&t.eq(e)}class pie{constructor(e,n){this.view=e,this.layer=n,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),n.above&&this.dom.classList.add("cm-layer-above"),n.class&&this.dom.classList.add(n.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),n.mount&&n.mount(this.dom,e)}update(e){e.startState.facet(o1)!=e.state.facet(o1)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}docViewUpdate(e){this.layer.updateOnDocViewUpdate!==!1&&e.requestMeasure(this.measureReq)}setOrder(e){let n=0,r=e.facet(o1);for(;n!mie(n,this.drawn[r]))){let n=this.dom.firstChild,r=0;for(let s of e)s.update&&n&&s.constructor&&this.drawn[r].constructor&&s.update(n,this.drawn[r])?(n=n.nextSibling,r++):this.dom.insertBefore(s.draw(),n);for(;n;){let s=n.nextSibling;n.remove(),n=s}this.drawn=e,Je.safari&&Je.safari_version>=26&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const o1=nt.define();function dB(t){return[_r.define(e=>new pie(e,t)),o1.of(t)]}const Km=nt.define({combine(t){return gl(t,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,n)=>Math.min(e,n),drawRangeCursor:(e,n)=>e||n})}});function gie(t={}){return[Km.of(t),xie,vie,yie,LI.of(!0)]}function hB(t){return t.startState.facet(Km)!=t.state.facet(Km)}const xie=dB({above:!0,markers(t){let{state:e}=t,n=e.facet(Km),r=[];for(let s of e.selection.ranges){let i=s==e.selection.main;if(s.empty||n.drawRangeCursor){let a=i?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",o=s.empty?s:Ae.cursor(s.head,s.head>s.anchor?-1:1);for(let c of Z0.forRange(t,a,o))r.push(c)}}return r},update(t,e){t.transactions.some(r=>r.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let n=hB(t);return n&&xT(t.state,e),t.docChanged||t.selectionSet||n},mount(t,e){xT(e.state,t)},class:"cm-cursorLayer"});function xT(t,e){e.style.animationDuration=t.facet(Km).cursorBlinkRate+"ms"}const vie=dB({above:!1,markers(t){return t.state.selection.ranges.map(e=>e.empty?[]:Z0.forRange(t,"cm-selectionBackground",e)).reduce((e,n)=>e.concat(n))},update(t,e){return t.docChanged||t.selectionSet||t.viewportChanged||hB(t)},class:"cm-selectionLayer"}),yie=Ac.highest(Ke.theme({".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}})),fB=Lt.define({map(t,e){return t==null?null:e.mapPos(t)}}),xm=us.define({create(){return null},update(t,e){return t!=null&&(t=e.changes.mapPos(t)),e.effects.reduce((n,r)=>r.is(fB)?r.value:n,t)}}),bie=_r.fromClass(class{constructor(t){this.view=t,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(t){var e;let n=t.state.field(xm);n==null?this.cursor!=null&&((e=this.cursor)===null||e===void 0||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(t.startState.field(xm)!=n||t.docChanged||t.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:t}=this,e=t.state.field(xm),n=e!=null&&t.coordsAtPos(e);if(!n)return null;let r=t.scrollDOM.getBoundingClientRect();return{left:n.left-r.left+t.scrollDOM.scrollLeft*t.scaleX,top:n.top-r.top+t.scrollDOM.scrollTop*t.scaleY,height:n.bottom-n.top}}drawCursor(t){if(this.cursor){let{scaleX:e,scaleY:n}=this.view;t?(this.cursor.style.left=t.left/e+"px",this.cursor.style.top=t.top/n+"px",this.cursor.style.height=t.height/n+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(t){this.view.state.field(xm)!=t&&this.view.dispatch({effects:fB.of(t)})}},{eventObservers:{dragover(t){this.setDropPos(this.view.posAtCoords({x:t.clientX,y:t.clientY}))},dragleave(t){(t.target==this.view.contentDOM||!this.view.contentDOM.contains(t.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function wie(){return[xm,bie]}function vT(t,e,n,r,s){e.lastIndex=0;for(let i=t.iterRange(n,r),a=n,o;!i.next().done;a+=i.value.length)if(!i.lineBreak)for(;o=e.exec(i.value);)s(a+o.index,o)}function Sie(t,e){let n=t.visibleRanges;if(n.length==1&&n[0].from==t.viewport.from&&n[0].to==t.viewport.to)return n;let r=[];for(let{from:s,to:i}of n)s=Math.max(t.state.doc.lineAt(s).from,s-e),i=Math.min(t.state.doc.lineAt(i).to,i+e),r.length&&r[r.length-1].to>=s?r[r.length-1].to=i:r.push({from:s,to:i});return r}class kie{constructor(e){const{regexp:n,decoration:r,decorate:s,boundary:i,maxLength:a=1e3}=e;if(!n.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=n,s)this.addMatch=(o,c,h,f)=>s(f,h,h+o[0].length,o,c);else if(typeof r=="function")this.addMatch=(o,c,h,f)=>{let m=r(o,c,h);m&&f(h,h+o[0].length,m)};else if(r)this.addMatch=(o,c,h,f)=>f(h,h+o[0].length,r);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=i,this.maxLength=a}createDeco(e){let n=new fo,r=n.add.bind(n);for(let{from:s,to:i}of Sie(e,this.maxLength))vT(e.state.doc,this.regexp,s,i,(a,o)=>this.addMatch(o,e,a,r));return n.finish()}updateDeco(e,n){let r=1e9,s=-1;return e.docChanged&&e.changes.iterChanges((i,a,o,c)=>{c>=e.view.viewport.from&&o<=e.view.viewport.to&&(r=Math.min(o,r),s=Math.max(c,s))}),e.viewportMoved||s-r>1e3?this.createDeco(e.view):s>-1?this.updateRange(e.view,n.map(e.changes),r,s):n}updateRange(e,n,r,s){for(let i of e.visibleRanges){let a=Math.max(i.from,r),o=Math.min(i.to,s);if(o>=a){let c=e.state.doc.lineAt(a),h=c.toc.from;a--)if(this.boundary.test(c.text[a-1-c.from])){f=a;break}for(;og.push(k.range(w,S));if(c==h)for(this.regexp.lastIndex=f-c.from;(x=this.regexp.exec(c.text))&&x.indexthis.addMatch(S,e,w,y));n=n.update({filterFrom:f,filterTo:m,filter:(w,S)=>wm,add:g})}}return n}}const _S=/x/.unicode!=null?"gu":"g",jie=new RegExp(`[\0-\b +--Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF-]`,_S),Oie={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let Ow=null;function Nie(){var t;if(Ow==null&&typeof document<"u"&&document.body){let e=document.body.style;Ow=((t=e.tabSize)!==null&&t!==void 0?t:e.MozTabSize)!=null}return Ow||!1}const c1=nt.define({combine(t){let e=gl(t,{render:null,specialChars:jie,addSpecialChars:null});return(e.replaceTabs=!Nie())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,_S)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,_S)),e}});function Cie(t={}){return[c1.of(t),Tie()]}let yT=null;function Tie(){return yT||(yT=_r.fromClass(class{constructor(t){this.view=t,this.decorations=xt.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(c1)),this.decorations=this.decorator.createDeco(t)}makeDecorator(t){return new kie({regexp:t.specialChars,decoration:(e,n,r)=>{let{doc:s}=n.state,i=ei(e[0],0);if(i==9){let a=s.lineAt(r),o=n.state.tabSize,c=Fh(a.text,o,r-a.from);return xt.replace({widget:new Aie((o-c%o)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[i]||(this.decorationCache[i]=xt.replace({widget:new Mie(t,i)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(c1);t.startState.facet(c1)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(t.view)):this.decorations=this.decorator.updateDeco(t,this.decorations)}},{decorations:t=>t.decorations}))}const Eie="•";function _ie(t){return t>=32?Eie:t==10?"␤":String.fromCharCode(9216+t)}class Mie extends xl{constructor(e,n){super(),this.options=e,this.code=n}eq(e){return e.code==this.code}toDOM(e){let n=_ie(this.code),r=e.state.phrase("Control character")+" "+(Oie[this.code]||"0x"+this.code.toString(16)),s=this.options.render&&this.options.render(this.code,r,n);if(s)return s;let i=document.createElement("span");return i.textContent=n,i.title=r,i.setAttribute("aria-label",r),i.className="cm-specialChar",i}ignoreEvent(){return!1}}class Aie extends xl{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent=" ",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}}function Rie(){return zie}const Die=xt.line({class:"cm-activeLine"}),zie=_r.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.docChanged||t.selectionSet)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=-1,n=[];for(let r of t.state.selection.ranges){let s=t.lineBlockAt(r.head);s.from>e&&(n.push(Die.range(s.from)),e=s.from)}return xt.set(n)}},{decorations:t=>t.decorations});class Pie extends xl{constructor(e){super(),this.content=e}toDOM(e){let n=document.createElement("span");return n.className="cm-placeholder",n.style.pointerEvents="none",n.appendChild(typeof this.content=="string"?document.createTextNode(this.content):typeof this.content=="function"?this.content(e):this.content.cloneNode(!0)),n.setAttribute("aria-hidden","true"),n}coordsAt(e){let n=e.firstChild?yh(e.firstChild):[];if(!n.length)return null;let r=window.getComputedStyle(e.parentNode),s=W0(n[0],r.direction!="rtl"),i=parseInt(r.lineHeight);return s.bottom-s.top>i*1.5?{left:s.left,right:s.right,top:s.top,bottom:s.top+i}:s}ignoreEvent(){return!1}}function Lie(t){let e=_r.fromClass(class{constructor(n){this.view=n,this.placeholder=t?xt.set([xt.widget({widget:new Pie(t),side:1}).range(0)]):xt.none}get decorations(){return this.view.state.doc.length?xt.none:this.placeholder}},{decorations:n=>n.decorations});return typeof t=="string"?[e,Ke.contentAttributes.of({"aria-placeholder":t})]:e}const MS=2e3;function Iie(t,e,n){let r=Math.min(e.line,n.line),s=Math.max(e.line,n.line),i=[];if(e.off>MS||n.off>MS||e.col<0||n.col<0){let a=Math.min(e.off,n.off),o=Math.max(e.off,n.off);for(let c=r;c<=s;c++){let h=t.doc.line(c);h.length<=o&&i.push(Ae.range(h.from+a,h.to+o))}}else{let a=Math.min(e.col,n.col),o=Math.max(e.col,n.col);for(let c=r;c<=s;c++){let h=t.doc.line(c),f=oS(h.text,a,t.tabSize,!0);if(f<0)i.push(Ae.cursor(h.to));else{let m=oS(h.text,o,t.tabSize);i.push(Ae.range(h.from+f,h.from+m))}}}return i}function Bie(t,e){let n=t.coordsAtPos(t.viewport.from);return n?Math.round(Math.abs((n.left-e)/t.defaultCharacterWidth)):-1}function bT(t,e){let n=t.posAtCoords({x:e.clientX,y:e.clientY},!1),r=t.state.doc.lineAt(n),s=n-r.from,i=s>MS?-1:s==r.length?Bie(t,e.clientX):Fh(r.text,t.state.tabSize,n-r.from);return{line:r.number,col:i,off:s}}function qie(t,e){let n=bT(t,e),r=t.state.selection;return n?{update(s){if(s.docChanged){let i=s.changes.mapPos(s.startState.doc.line(n.line).from),a=s.state.doc.lineAt(i);n={line:a.number,col:n.col,off:Math.min(n.off,a.length)},r=r.map(s.changes)}},get(s,i,a){let o=bT(t,s);if(!o)return r;let c=Iie(t.state,n,o);return c.length?a?Ae.create(c.concat(r.ranges)):Ae.create(c):r}}:null}function Fie(t){let e=(n=>n.altKey&&n.button==0);return Ke.mouseSelectionStyle.of((n,r)=>e(r)?qie(n,r):null)}const $ie={Alt:[18,t=>!!t.altKey],Control:[17,t=>!!t.ctrlKey],Shift:[16,t=>!!t.shiftKey],Meta:[91,t=>!!t.metaKey]},Qie={style:"cursor: crosshair"};function Hie(t={}){let[e,n]=$ie[t.key||"Alt"],r=_r.fromClass(class{constructor(s){this.view=s,this.isDown=!1}set(s){this.isDown!=s&&(this.isDown=s,this.view.update([]))}},{eventObservers:{keydown(s){this.set(s.keyCode==e||n(s))},keyup(s){(s.keyCode==e||!n(s))&&this.set(!1)},mousemove(s){this.set(n(s))}}});return[r,Ke.contentAttributes.of(s=>{var i;return!((i=s.plugin(r))===null||i===void 0)&&i.isDown?Qie:null})]}const cx="-10000px";class mB{constructor(e,n,r,s){this.facet=n,this.createTooltipView=r,this.removeTooltipView=s,this.input=e.state.facet(n),this.tooltips=this.input.filter(a=>a);let i=null;this.tooltipViews=this.tooltips.map(a=>i=r(a,i))}update(e,n){var r;let s=e.state.facet(this.facet),i=s.filter(c=>c);if(s===this.input){for(let c of this.tooltipViews)c.update&&c.update(e);return!1}let a=[],o=n?[]:null;for(let c=0;cn[h]=c),n.length=o.length),this.input=s,this.tooltips=i,this.tooltipViews=a,!0}}function Vie(t){let e=t.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:e.clientHeight,right:e.clientWidth}}const Nw=nt.define({combine:t=>{var e,n,r;return{position:Je.ios?"absolute":((e=t.find(s=>s.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((n=t.find(s=>s.parent))===null||n===void 0?void 0:n.parent)||null,tooltipSpace:((r=t.find(s=>s.tooltipSpace))===null||r===void 0?void 0:r.tooltipSpace)||Vie}}}),wT=new WeakMap,q6=_r.fromClass(class{constructor(t){this.view=t,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=t.state.facet(Nw);this.position=e.position,this.parent=e.parent,this.classes=t.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new mB(t,F6,(n,r)=>this.createTooltip(n,r),n=>{this.resizeObserver&&this.resizeObserver.unobserve(n.dom),n.dom.remove()}),this.above=this.manager.tooltips.map(n=>!!n.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(n=>{Date.now()>this.lastTransaction-50&&n.length>0&&n[n.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),t.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let t of this.manager.tooltipViews)this.intersectionObserver.observe(t.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(t){t.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(t,this.above);e&&this.observeIntersection();let n=e||t.geometryChanged,r=t.state.facet(Nw);if(r.position!=this.position&&!this.madeAbsolute){this.position=r.position;for(let s of this.manager.tooltipViews)s.dom.style.position=this.position;n=!0}if(r.parent!=this.parent){this.parent&&this.container.remove(),this.parent=r.parent,this.createContainer();for(let s of this.manager.tooltipViews)this.container.appendChild(s.dom);n=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);n&&this.maybeMeasure()}createTooltip(t,e){let n=t.create(this.view),r=e?e.dom:null;if(n.dom.classList.add("cm-tooltip"),t.arrow&&!n.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let s=document.createElement("div");s.className="cm-tooltip-arrow",n.dom.appendChild(s)}return n.dom.style.position=this.position,n.dom.style.top=cx,n.dom.style.left="0px",this.container.insertBefore(n.dom,r),n.mount&&n.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(n.dom),n}destroy(){var t,e,n;this.view.win.removeEventListener("resize",this.measureSoon);for(let r of this.manager.tooltipViews)r.dom.remove(),(t=r.destroy)===null||t===void 0||t.call(r);this.parent&&this.container.remove(),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),(n=this.intersectionObserver)===null||n===void 0||n.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let t=1,e=1,n=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:i}=this.manager.tooltipViews[0];if(Je.safari){let a=i.getBoundingClientRect();n=Math.abs(a.top+1e4)>1||Math.abs(a.left)>1}else n=!!i.offsetParent&&i.offsetParent!=this.container.ownerDocument.body}if(n||this.position=="absolute")if(this.parent){let i=this.parent.getBoundingClientRect();i.width&&i.height&&(t=i.width/this.parent.offsetWidth,e=i.height/this.parent.offsetHeight)}else({scaleX:t,scaleY:e}=this.view.viewState);let r=this.view.scrollDOM.getBoundingClientRect(),s=P6(this.view);return{visible:{left:r.left+s.left,top:r.top+s.top,right:r.right-s.right,bottom:r.bottom-s.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((i,a)=>{let o=this.manager.tooltipViews[a];return o.getCoords?o.getCoords(i.pos):this.view.coordsAtPos(i.pos)}),size:this.manager.tooltipViews.map(({dom:i})=>i.getBoundingClientRect()),space:this.view.state.facet(Nw).tooltipSpace(this.view),scaleX:t,scaleY:e,makeAbsolute:n}}writeMeasure(t){var e;if(t.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let o of this.manager.tooltipViews)o.dom.style.position="absolute"}let{visible:n,space:r,scaleX:s,scaleY:i}=t,a=[];for(let o=0;o=Math.min(n.bottom,r.bottom)||m.rightMath.min(n.right,r.right)+.1)){f.style.top=cx;continue}let x=c.arrow?h.dom.querySelector(".cm-tooltip-arrow"):null,y=x?7:0,w=g.right-g.left,S=(e=wT.get(h))!==null&&e!==void 0?e:g.bottom-g.top,k=h.offset||Wie,N=this.view.textDirection==sr.LTR,C=g.width>r.right-r.left?N?r.left:r.right-g.width:N?Math.max(r.left,Math.min(m.left-(x?14:0)+k.x,r.right-w)):Math.min(Math.max(r.left,m.left-w+(x?14:0)-k.x),r.right-w),T=this.above[o];!c.strictSide&&(T?m.top-S-y-k.yr.bottom)&&T==r.bottom-m.bottom>m.top-r.top&&(T=this.above[o]=!T);let _=(T?m.top-r.top:r.bottom-m.bottom)-y;if(_C&&L.topE&&(E=T?L.top-S-2-y:L.bottom+y+2);if(this.position=="absolute"?(f.style.top=(E-t.parent.top)/i+"px",ST(f,(C-t.parent.left)/s)):(f.style.top=E/i+"px",ST(f,C/s)),x){let L=m.left+(N?k.x:-k.x)-(C+14-7);x.style.left=L/s+"px"}h.overlap!==!0&&a.push({left:C,top:E,right:M,bottom:E+S}),f.classList.toggle("cm-tooltip-above",T),f.classList.toggle("cm-tooltip-below",!T),h.positioned&&h.positioned(t.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let t of this.manager.tooltipViews)t.dom.style.top=cx}},{eventObservers:{scroll(){this.maybeMeasure()}}});function ST(t,e){let n=parseInt(t.style.left,10);(isNaN(n)||Math.abs(e-n)>1)&&(t.style.left=e+"px")}const Uie=Ke.baseTheme({".cm-tooltip":{zIndex:500,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),Wie={x:0,y:0},F6=nt.define({enables:[q6,Uie]}),F1=nt.define({combine:t=>t.reduce((e,n)=>e.concat(n),[])});class Zv{static create(e){return new Zv(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new mB(e,F1,(n,r)=>this.createHostedView(n,r),n=>n.dom.remove())}createHostedView(e,n){let r=e.create(this.view);return r.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(r.dom,n?n.dom.nextSibling:this.dom.firstChild),this.mounted&&r.mount&&r.mount(this.view),r}mount(e){for(let n of this.manager.tooltipViews)n.mount&&n.mount(e);this.mounted=!0}positioned(e){for(let n of this.manager.tooltipViews)n.positioned&&n.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let n of this.manager.tooltipViews)(e=n.destroy)===null||e===void 0||e.call(n)}passProp(e){let n;for(let r of this.manager.tooltipViews){let s=r[e];if(s!==void 0){if(n===void 0)n=s;else if(n!==s)return}}return n}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const Gie=F6.compute([F1],t=>{let e=t.facet(F1);return e.length===0?null:{pos:Math.min(...e.map(n=>n.pos)),end:Math.max(...e.map(n=>{var r;return(r=n.end)!==null&&r!==void 0?r:n.pos})),create:Zv.create,above:e[0].above,arrow:e.some(n=>n.arrow)}});class Xie{constructor(e,n,r,s,i){this.view=e,this.source=n,this.field=r,this.setHover=s,this.hoverTime=i,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let e=Date.now()-this.lastMove.time;eo.bottom||n.xo.right+e.defaultCharacterWidth)return;let c=e.bidiSpans(e.state.doc.lineAt(s)).find(f=>f.from<=s&&f.to>=s),h=c&&c.dir==sr.RTL?-1:1;i=n.x{this.pending==o&&(this.pending=null,c&&!(Array.isArray(c)&&!c.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(c)?c:[c])}))},c=>ni(e.state,c,"hover tooltip"))}else a&&!(Array.isArray(a)&&!a.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(a)?a:[a])})}get tooltip(){let e=this.view.plugin(q6),n=e?e.manager.tooltips.findIndex(r=>r.create==Zv.create):-1;return n>-1?e.manager.tooltipViews[n]:null}mousemove(e){var n,r;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:s,tooltip:i}=this;if(s.length&&i&&!Yie(i.dom,e)||this.pending){let{pos:a}=s[0]||this.pending,o=(r=(n=s[0])===null||n===void 0?void 0:n.end)!==null&&r!==void 0?r:a;(a==o?this.view.posAtCoords(this.lastMove)!=a:!Kie(this.view,a,o,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:n}=this;if(n.length){let{tooltip:r}=this;r&&r.dom.contains(e.relatedTarget)?this.watchTooltipLeave(r.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let n=r=>{e.removeEventListener("mouseleave",n),this.active.length&&!this.view.dom.contains(r.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",n)}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const ux=4;function Yie(t,e){let{left:n,right:r,top:s,bottom:i}=t.getBoundingClientRect(),a;if(a=t.querySelector(".cm-tooltip-arrow")){let o=a.getBoundingClientRect();s=Math.min(o.top,s),i=Math.max(o.bottom,i)}return e.clientX>=n-ux&&e.clientX<=r+ux&&e.clientY>=s-ux&&e.clientY<=i+ux}function Kie(t,e,n,r,s,i){let a=t.scrollDOM.getBoundingClientRect(),o=t.documentTop+t.documentPadding.top+t.contentHeight;if(a.left>r||a.rights||Math.min(a.bottom,o)=e&&c<=n}function Zie(t,e={}){let n=Lt.define(),r=us.define({create(){return[]},update(s,i){if(s.length&&(e.hideOnChange&&(i.docChanged||i.selection)?s=[]:e.hideOn&&(s=s.filter(a=>!e.hideOn(i,a))),i.docChanged)){let a=[];for(let o of s){let c=i.changes.mapPos(o.pos,-1,vs.TrackDel);if(c!=null){let h=Object.assign(Object.create(null),o);h.pos=c,h.end!=null&&(h.end=i.changes.mapPos(h.end)),a.push(h)}}s=a}for(let a of i.effects)a.is(n)&&(s=a.value),a.is(Jie)&&(s=[]);return s},provide:s=>F1.from(s)});return{active:r,extension:[r,_r.define(s=>new Xie(s,t,r,n,e.hoverTime||300)),Gie]}}function pB(t,e){let n=t.plugin(q6);if(!n)return null;let r=n.manager.tooltips.indexOf(e);return r<0?null:n.manager.tooltipViews[r]}const Jie=Lt.define(),kT=nt.define({combine(t){let e,n;for(let r of t)e=e||r.topContainer,n=n||r.bottomContainer;return{topContainer:e,bottomContainer:n}}});function Zm(t,e){let n=t.plugin(gB),r=n?n.specs.indexOf(e):-1;return r>-1?n.panels[r]:null}const gB=_r.fromClass(class{constructor(t){this.input=t.state.facet(Jm),this.specs=this.input.filter(n=>n),this.panels=this.specs.map(n=>n(t));let e=t.state.facet(kT);this.top=new dx(t,!0,e.topContainer),this.bottom=new dx(t,!1,e.bottomContainer),this.top.sync(this.panels.filter(n=>n.top)),this.bottom.sync(this.panels.filter(n=>!n.top));for(let n of this.panels)n.dom.classList.add("cm-panel"),n.mount&&n.mount()}update(t){let e=t.state.facet(kT);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new dx(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new dx(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=t.state.facet(Jm);if(n!=this.input){let r=n.filter(c=>c),s=[],i=[],a=[],o=[];for(let c of r){let h=this.specs.indexOf(c),f;h<0?(f=c(t.view),o.push(f)):(f=this.panels[h],f.update&&f.update(t)),s.push(f),(f.top?i:a).push(f)}this.specs=r,this.panels=s,this.top.sync(i),this.bottom.sync(a);for(let c of o)c.dom.classList.add("cm-panel"),c.mount&&c.mount()}else for(let r of this.panels)r.update&&r.update(t)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:t=>Ke.scrollMargins.of(e=>{let n=e.plugin(t);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})});class dx{constructor(e,n,r){this.view=e,this.top=n,this.container=r,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let n of this.panels)n.destroy&&e.indexOf(n)<0&&n.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let n=this.container||this.view.dom;n.insertBefore(this.dom,this.top?n.firstChild:null)}let e=this.dom.firstChild;for(let n of this.panels)if(n.dom.parentNode==this.dom){for(;e!=n.dom;)e=jT(e);e=e.nextSibling}else this.dom.insertBefore(n.dom,e);for(;e;)e=jT(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function jT(t){let e=t.nextSibling;return t.remove(),e}const Jm=nt.define({enables:gB});class po extends _u{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}po.prototype.elementClass="";po.prototype.toDOM=void 0;po.prototype.mapMode=vs.TrackBefore;po.prototype.startSide=po.prototype.endSide=-1;po.prototype.point=!0;const u1=nt.define(),eae=nt.define(),tae={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>On.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},Am=nt.define();function nae(t){return[xB(),Am.of({...tae,...t})]}const OT=nt.define({combine:t=>t.some(e=>e)});function xB(t){return[rae]}const rae=_r.fromClass(class{constructor(t){this.view=t,this.domAfter=null,this.prevViewport=t.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters cm-gutters-before",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=t.state.facet(Am).map(e=>new CT(t,e)),this.fixed=!t.state.facet(OT);for(let e of this.gutters)e.config.side=="after"?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),t.scrollDOM.insertBefore(this.dom,t.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement("div"),this.domAfter.className="cm-gutters cm-gutters-after",this.domAfter.setAttribute("aria-hidden","true"),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.domAfter.style.position=this.fixed?"sticky":"",this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}update(t){if(this.updateGutters(t)){let e=this.prevViewport,n=t.view.viewport,r=Math.min(e.to,n.to)-Math.max(e.from,n.from);this.syncGutters(r<(n.to-n.from)*.8)}if(t.geometryChanged){let e=this.view.contentHeight/this.view.scaleY+"px";this.dom.style.minHeight=e,this.domAfter&&(this.domAfter.style.minHeight=e)}this.view.state.facet(OT)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=t.view.viewport}syncGutters(t){let e=this.dom.nextSibling;t&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let n=On.iter(this.view.state.facet(u1),this.view.viewport.from),r=[],s=this.gutters.map(i=>new sae(i,this.view.viewport,-this.view.documentPadding.top));for(let i of this.view.viewportLineBlocks)if(r.length&&(r=[]),Array.isArray(i.type)){let a=!0;for(let o of i.type)if(o.type==Is.Text&&a){AS(n,r,o.from);for(let c of s)c.line(this.view,o,r);a=!1}else if(o.widget)for(let c of s)c.widget(this.view,o)}else if(i.type==Is.Text){AS(n,r,i.from);for(let a of s)a.line(this.view,i,r)}else if(i.widget)for(let a of s)a.widget(this.view,i);for(let i of s)i.finish();t&&(this.view.scrollDOM.insertBefore(this.dom,e),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(t){let e=t.startState.facet(Am),n=t.state.facet(Am),r=t.docChanged||t.heightChanged||t.viewportChanged||!On.eq(t.startState.facet(u1),t.state.facet(u1),t.view.viewport.from,t.view.viewport.to);if(e==n)for(let s of this.gutters)s.update(t)&&(r=!0);else{r=!0;let s=[];for(let i of n){let a=e.indexOf(i);a<0?s.push(new CT(this.view,i)):(this.gutters[a].update(t),s.push(this.gutters[a]))}for(let i of this.gutters)i.dom.remove(),s.indexOf(i)<0&&i.destroy();for(let i of s)i.config.side=="after"?this.getDOMAfter().appendChild(i.dom):this.dom.appendChild(i.dom);this.gutters=s}return r}destroy(){for(let t of this.gutters)t.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:t=>Ke.scrollMargins.of(e=>{let n=e.plugin(t);if(!n||n.gutters.length==0||!n.fixed)return null;let r=n.dom.offsetWidth*e.scaleX,s=n.domAfter?n.domAfter.offsetWidth*e.scaleX:0;return e.textDirection==sr.LTR?{left:r,right:s}:{right:r,left:s}})});function NT(t){return Array.isArray(t)?t:[t]}function AS(t,e,n){for(;t.value&&t.from<=n;)t.from==n&&e.push(t.value),t.next()}class sae{constructor(e,n,r){this.gutter=e,this.height=r,this.i=0,this.cursor=On.iter(e.markers,n.from)}addElement(e,n,r){let{gutter:s}=this,i=(n.top-this.height)/e.scaleY,a=n.height/e.scaleY;if(this.i==s.elements.length){let o=new vB(e,a,i,r);s.elements.push(o),s.dom.appendChild(o.dom)}else s.elements[this.i].update(e,a,i,r);this.height=n.bottom,this.i++}line(e,n,r){let s=[];AS(this.cursor,s,n.from),r.length&&(s=s.concat(r));let i=this.gutter.config.lineMarker(e,n,s);i&&s.unshift(i);let a=this.gutter;s.length==0&&!a.config.renderEmptyElements||this.addElement(e,n,s)}widget(e,n){let r=this.gutter.config.widgetMarker(e,n.widget,n),s=r?[r]:null;for(let i of e.state.facet(eae)){let a=i(e,n.widget,n);a&&(s||(s=[])).push(a)}s&&this.addElement(e,n,s)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let n=e.elements.pop();e.dom.removeChild(n.dom),n.destroy()}}}class CT{constructor(e,n){this.view=e,this.config=n,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let r in n.domEventHandlers)this.dom.addEventListener(r,s=>{let i=s.target,a;if(i!=this.dom&&this.dom.contains(i)){for(;i.parentNode!=this.dom;)i=i.parentNode;let c=i.getBoundingClientRect();a=(c.top+c.bottom)/2}else a=s.clientY;let o=e.lineBlockAtHeight(a-e.documentTop);n.domEventHandlers[r](e,o,s)&&s.preventDefault()});this.markers=NT(n.markers(e)),n.initialSpacer&&(this.spacer=new vB(e,0,0,[n.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let n=this.markers;if(this.markers=NT(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let s=this.config.updateSpacer(this.spacer.markers[0],e);s!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[s])}let r=e.view.viewport;return!On.eq(this.markers,n,r.from,r.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class vB{constructor(e,n,r,s){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,n,r,s)}update(e,n,r,s){this.height!=n&&(this.height=n,this.dom.style.height=n+"px"),this.above!=r&&(this.dom.style.marginTop=(this.above=r)?r+"px":""),iae(this.markers,s)||this.setMarkers(e,s)}setMarkers(e,n){let r="cm-gutterElement",s=this.dom.firstChild;for(let i=0,a=0;;){let o=a,c=ii(o,c,h)||a(o,c,h):a}return r}})}});class Cw extends po{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function Tw(t,e){return t.state.facet(Xd).formatNumber(e,t.state)}const oae=Am.compute([Xd],t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(aae)},lineMarker(e,n,r){return r.some(s=>s.toDOM)?null:new Cw(Tw(e,e.state.doc.lineAt(n.from).number))},widgetMarker:(e,n,r)=>{for(let s of e.state.facet(lae)){let i=s(e,n,r);if(i)return i}return null},lineMarkerChange:e=>e.startState.facet(Xd)!=e.state.facet(Xd),initialSpacer(e){return new Cw(Tw(e,TT(e.state.doc.lines)))},updateSpacer(e,n){let r=Tw(n.view,TT(n.view.state.doc.lines));return r==e.number?e:new Cw(r)},domEventHandlers:t.facet(Xd).domEventHandlers,side:"before"}));function cae(t={}){return[Xd.of(t),xB(),oae]}function TT(t){let e=9;for(;e{let e=[],n=-1;for(let r of t.selection.ranges){let s=t.doc.lineAt(r.head).from;s>n&&(n=s,e.push(uae.range(s)))}return On.of(e)});function hae(){return dae}const yB=1024;let fae=0;class Ew{constructor(e,n){this.from=e,this.to=n}}class Yt{constructor(e={}){this.id=fae++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=qs.match(e)),n=>{let r=e(n);return r===void 0?null:[this,r]}}}Yt.closedBy=new Yt({deserialize:t=>t.split(" ")});Yt.openedBy=new Yt({deserialize:t=>t.split(" ")});Yt.group=new Yt({deserialize:t=>t.split(" ")});Yt.isolate=new Yt({deserialize:t=>{if(t&&t!="rtl"&&t!="ltr"&&t!="auto")throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}});Yt.contextHash=new Yt({perNode:!0});Yt.lookAhead=new Yt({perNode:!0});Yt.mounted=new Yt({perNode:!0});class $1{constructor(e,n,r){this.tree=e,this.overlay=n,this.parser=r}static get(e){return e&&e.props&&e.props[Yt.mounted.id]}}const mae=Object.create(null);class qs{constructor(e,n,r,s=0){this.name=e,this.props=n,this.id=r,this.flags=s}static define(e){let n=e.props&&e.props.length?Object.create(null):mae,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),s=new qs(e.name||"",n,e.id,r);if(e.props){for(let i of e.props)if(Array.isArray(i)||(i=i(s)),i){if(i[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");n[i[0].id]=i[1]}}return s}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let n=this.prop(Yt.group);return n?n.indexOf(e)>-1:!1}return this.id==e}static match(e){let n=Object.create(null);for(let r in e)for(let s of r.split(" "))n[s]=e[r];return r=>{for(let s=r.prop(Yt.group),i=-1;i<(s?s.length:0);i++){let a=n[i<0?r.name:s[i]];if(a)return a}}}}qs.none=new qs("",Object.create(null),0,8);class Jv{constructor(e){this.types=e;for(let n=0;n0;for(let c=this.cursor(a|Jr.IncludeAnonymous);;){let h=!1;if(c.from<=i&&c.to>=s&&(!o&&c.type.isAnonymous||n(c)!==!1)){if(c.firstChild())continue;h=!0}for(;h&&r&&(o||!c.type.isAnonymous)&&r(c),!c.nextSibling();){if(!c.parent())return;h=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let n in this.props)e.push([+n,this.props[n]]);return e}balance(e={}){return this.children.length<=8?this:H6(qs.none,this.children,this.positions,0,this.children.length,0,this.length,(n,r,s)=>new Xn(this.type,n,r,s,this.propValues),e.makeTree||((n,r,s)=>new Xn(qs.none,n,r,s)))}static build(e){return vae(e)}}Xn.empty=new Xn(qs.none,[],[],0);class $6{constructor(e,n){this.buffer=e,this.index=n}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new $6(this.buffer,this.index)}}class Sc{constructor(e,n,r){this.buffer=e,this.length=n,this.set=r}get type(){return qs.none}toString(){let e=[];for(let n=0;n0));c=a[c+3]);return o}slice(e,n,r){let s=this.buffer,i=new Uint16Array(n-e),a=0;for(let o=e,c=0;o=e&&ne;case 1:return n<=e&&r>e;case 2:return r>e;case 4:return!0}}function e0(t,e,n,r){for(var s;t.from==t.to||(n<1?t.from>=e:t.from>e)||(n>-1?t.to<=e:t.to0?o.length:-1;e!=h;e+=n){let f=o[e],m=c[e]+a.from;if(bB(s,r,m,m+f.length)){if(f instanceof Sc){if(i&Jr.ExcludeBuffers)continue;let g=f.findChild(0,f.buffer.length,n,r-m,s);if(g>-1)return new nl(new pae(a,f,e,m),null,g)}else if(i&Jr.IncludeAnonymous||!f.type.isAnonymous||Q6(f)){let g;if(!(i&Jr.IgnoreMounts)&&(g=$1.get(f))&&!g.overlay)return new ai(g.tree,m,e,a);let x=new ai(f,m,e,a);return i&Jr.IncludeAnonymous||!x.type.isAnonymous?x:x.nextChild(n<0?f.children.length-1:0,n,r,s)}}}if(i&Jr.IncludeAnonymous||!a.type.isAnonymous||(a.index>=0?e=a.index+n:e=n<0?-1:a._parent._tree.children.length,a=a._parent,!a))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}enter(e,n,r=0){let s;if(!(r&Jr.IgnoreOverlays)&&(s=$1.get(this._tree))&&s.overlay){let i=e-this.from;for(let{from:a,to:o}of s.overlay)if((n>0?a<=i:a=i:o>i))return new ai(s.tree,s.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,n,r)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function _T(t,e,n,r){let s=t.cursor(),i=[];if(!s.firstChild())return i;if(n!=null){for(let a=!1;!a;)if(a=s.type.is(n),!s.nextSibling())return i}for(;;){if(r!=null&&s.type.is(r))return i;if(s.type.is(e)&&i.push(s.node),!s.nextSibling())return r==null?i:[]}}function RS(t,e,n=e.length-1){for(let r=t;n>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(e[n]&&e[n]!=r.name)return!1;n--}}return!0}class pae{constructor(e,n,r,s){this.parent=e,this.buffer=n,this.index=r,this.start=s}}class nl extends wB{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,n,r){super(),this.context=e,this._parent=n,this.index=r,this.type=e.buffer.set.types[e.buffer.buffer[r]]}child(e,n,r){let{buffer:s}=this.context,i=s.findChild(this.index+4,s.buffer[this.index+3],e,n-this.context.start,r);return i<0?null:new nl(this.context,this,i)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}enter(e,n,r=0){if(r&Jr.ExcludeBuffers)return null;let{buffer:s}=this.context,i=s.findChild(this.index+4,s.buffer[this.index+3],n>0?1:-1,e-this.context.start,n);return i<0?null:new nl(this.context,this,i)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,n=e.buffer[this.index+3];return n<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new nl(this.context,this._parent,n):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,n=this._parent?this._parent.index+4:0;return this.index==n?this.externalSibling(-1):new nl(this.context,this._parent,e.findChild(n,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],n=[],{buffer:r}=this.context,s=this.index+4,i=r.buffer[this.index+3];if(i>s){let a=r.buffer[this.index+1];e.push(r.slice(s,i,a)),n.push(0)}return new Xn(this.type,e,n,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function SB(t){if(!t.length)return null;let e=0,n=t[0];for(let i=1;in.from||a.to=e){let o=new ai(a.tree,a.overlay[0].from+i.from,-1,i);(s||(s=[r])).push(e0(o,e,n,!1))}}return s?SB(s):r}class DS{get name(){return this.type.name}constructor(e,n=0){if(this.mode=n,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof ai)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let r=e._parent;r;r=r._parent)this.stack.unshift(r.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,n){this.index=e;let{start:r,buffer:s}=this.buffer;return this.type=n||s.set.types[s.buffer[e]],this.from=r+s.buffer[e+1],this.to=r+s.buffer[e+2],!0}yield(e){return e?e instanceof ai?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,n,r){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,n,r,this.mode));let{buffer:s}=this.buffer,i=s.findChild(this.index+4,s.buffer[this.index+3],e,n-this.buffer.start,r);return i<0?!1:(this.stack.push(this.index),this.yieldBuf(i))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,n,r=this.mode){return this.buffer?r&Jr.ExcludeBuffers?!1:this.enterChild(1,e,n):this.yield(this._tree.enter(e,n,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Jr.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&Jr.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:n}=this.buffer,r=this.stack.length-1;if(e<0){let s=r<0?0:this.stack[r]+4;if(this.index!=s)return this.yieldBuf(n.findChild(s,this.index,-1,0,4))}else{let s=n.buffer[this.index+3];if(s<(r<0?n.buffer.length:n.buffer[this.stack[r]+3]))return this.yieldBuf(s)}return r<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let n,r,{buffer:s}=this;if(s){if(e>0){if(this.index-1)for(let i=n+e,a=e<0?-1:r._tree.children.length;i!=a;i+=e){let o=r._tree.children[i];if(this.mode&Jr.IncludeAnonymous||o instanceof Sc||!o.type.isAnonymous||Q6(o))return!1}return!0}move(e,n){if(n&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,n=0){for(;(this.from==this.to||(n<1?this.from>=e:this.from>e)||(n>-1?this.to<=e:this.to=0;){for(let a=e;a;a=a._parent)if(a.index==s){if(s==this.index)return a;n=a,r=i+1;break e}s=this.stack[--i]}for(let s=r;s=0;i--){if(i<0)return RS(this._tree,e,s);let a=r[n.buffer[this.stack[i]]];if(!a.isAnonymous){if(e[s]&&e[s]!=a.name)return!1;s--}}return!0}}function Q6(t){return t.children.some(e=>e instanceof Sc||!e.type.isAnonymous||Q6(e))}function vae(t){var e;let{buffer:n,nodeSet:r,maxBufferLength:s=yB,reused:i=[],minRepeatType:a=r.types.length}=t,o=Array.isArray(n)?new $6(n,n.length):n,c=r.types,h=0,f=0;function m(_,E,M,L,P,I){let{id:Q,start:U,end:ee,size:z}=o,H=f,B=h;if(z<0)if(o.next(),z==-1){let se=i[Q];M.push(se),L.push(U-_);return}else if(z==-3){h=Q;return}else if(z==-4){f=Q;return}else throw new RangeError(`Unrecognized record size: ${z}`);let X=c[Q],J,G,R=U-_;if(ee-U<=s&&(G=S(o.pos-E,P))){let se=new Uint16Array(G.size-G.skip),W=o.pos-G.size,F=se.length;for(;o.pos>W;)F=k(G.start,se,F);J=new Sc(se,ee-G.start,r),R=G.start-_}else{let se=o.pos-z;o.next();let W=[],F=[],V=Q>=a?Q:-1,te=0,ne=ee;for(;o.pos>se;)V>=0&&o.id==V&&o.size>=0?(o.end<=ne-s&&(y(W,F,U,te,o.end,ne,V,H,B),te=W.length,ne=o.end),o.next()):I>2500?g(U,se,W,F):m(U,se,W,F,V,I+1);if(V>=0&&te>0&&te-1&&te>0){let K=x(X,B);J=H6(X,W,F,0,W.length,0,ee-U,K,K)}else J=w(X,W,F,ee-U,H-ee,B)}M.push(J),L.push(R)}function g(_,E,M,L){let P=[],I=0,Q=-1;for(;o.pos>E;){let{id:U,start:ee,end:z,size:H}=o;if(H>4)o.next();else{if(Q>-1&&ee=0;z-=3)U[H++]=P[z],U[H++]=P[z+1]-ee,U[H++]=P[z+2]-ee,U[H++]=H;M.push(new Sc(U,P[2]-ee,r)),L.push(ee-_)}}function x(_,E){return(M,L,P)=>{let I=0,Q=M.length-1,U,ee;if(Q>=0&&(U=M[Q])instanceof Xn){if(!Q&&U.type==_&&U.length==P)return U;(ee=U.prop(Yt.lookAhead))&&(I=L[Q]+U.length+ee)}return w(_,M,L,P,I,E)}}function y(_,E,M,L,P,I,Q,U,ee){let z=[],H=[];for(;_.length>L;)z.push(_.pop()),H.push(E.pop()+M-P);_.push(w(r.types[Q],z,H,I-P,U-I,ee)),E.push(P-M)}function w(_,E,M,L,P,I,Q){if(I){let U=[Yt.contextHash,I];Q=Q?[U].concat(Q):[U]}if(P>25){let U=[Yt.lookAhead,P];Q=Q?[U].concat(Q):[U]}return new Xn(_,E,M,L,Q)}function S(_,E){let M=o.fork(),L=0,P=0,I=0,Q=M.end-s,U={size:0,start:0,skip:0};e:for(let ee=M.pos-_;M.pos>ee;){let z=M.size;if(M.id==E&&z>=0){U.size=L,U.start=P,U.skip=I,I+=4,L+=4,M.next();continue}let H=M.pos-z;if(z<0||H=a?4:0,X=M.start;for(M.next();M.pos>H;){if(M.size<0)if(M.size==-3)B+=4;else break e;else M.id>=a&&(B+=4);M.next()}P=X,L+=z,I+=B}return(E<0||L==_)&&(U.size=L,U.start=P,U.skip=I),U.size>4?U:void 0}function k(_,E,M){let{id:L,start:P,end:I,size:Q}=o;if(o.next(),Q>=0&&L4){let ee=o.pos-(Q-4);for(;o.pos>ee;)M=k(_,E,M)}E[--M]=U,E[--M]=I-_,E[--M]=P-_,E[--M]=L}else Q==-3?h=L:Q==-4&&(f=L);return M}let N=[],C=[];for(;o.pos>0;)m(t.start||0,t.bufferStart||0,N,C,-1,0);let T=(e=t.length)!==null&&e!==void 0?e:N.length?C[0]+N[0].length:0;return new Xn(c[t.topID],N.reverse(),C.reverse(),T)}const MT=new WeakMap;function d1(t,e){if(!t.isAnonymous||e instanceof Sc||e.type!=t)return 1;let n=MT.get(e);if(n==null){n=1;for(let r of e.children){if(r.type!=t||!(r instanceof Xn)){n=1;break}n+=d1(t,r)}MT.set(e,n)}return n}function H6(t,e,n,r,s,i,a,o,c){let h=0;for(let y=r;y=f)break;E+=M}if(C==T+1){if(E>f){let M=y[T];x(M.children,M.positions,0,M.children.length,w[T]+N);continue}m.push(y[T])}else{let M=w[C-1]+y[C-1].length-_;m.push(H6(t,y,w,T,C,_,M,null,c))}g.push(_+N-i)}}return x(e,n,r,s,0),(o||c)(m,g,a)}class yae{constructor(){this.map=new WeakMap}setBuffer(e,n,r){let s=this.map.get(e);s||this.map.set(e,s=new Map),s.set(n,r)}getBuffer(e,n){let r=this.map.get(e);return r&&r.get(n)}set(e,n){e instanceof nl?this.setBuffer(e.context.buffer,e.index,n):e instanceof ai&&this.map.set(e.tree,n)}get(e){return e instanceof nl?this.getBuffer(e.context.buffer,e.index):e instanceof ai?this.map.get(e.tree):void 0}cursorSet(e,n){e.buffer?this.setBuffer(e.buffer.buffer,e.index,n):this.map.set(e.tree,n)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class ju{constructor(e,n,r,s,i=!1,a=!1){this.from=e,this.to=n,this.tree=r,this.offset=s,this.open=(i?1:0)|(a?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,n=[],r=!1){let s=[new ju(0,e.length,e,0,!1,r)];for(let i of n)i.to>e.length&&s.push(i);return s}static applyChanges(e,n,r=128){if(!n.length)return e;let s=[],i=1,a=e.length?e[0]:null;for(let o=0,c=0,h=0;;o++){let f=o=r)for(;a&&a.from=g.from||m<=g.to||h){let x=Math.max(g.from,c)-h,y=Math.min(g.to,m)-h;g=x>=y?null:new ju(x,y,g.tree,g.offset+h,o>0,!!f)}if(g&&s.push(g),a.to>m)break;a=inew Ew(s.from,s.to)):[new Ew(0,0)]:[new Ew(0,e.length)],this.createParse(e,n||[],r)}parse(e,n,r){let s=this.startParse(e,n,r);for(;;){let i=s.advance();if(i)return i}}};class bae{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,n){return this.string.slice(e,n)}}new Yt({perNode:!0});let wae=0;class Xi{constructor(e,n,r,s){this.name=e,this.set=n,this.base=r,this.modified=s,this.id=wae++}toString(){let{name:e}=this;for(let n of this.modified)n.name&&(e=`${n.name}(${e})`);return e}static define(e,n){let r=typeof e=="string"?e:"?";if(e instanceof Xi&&(n=e),n?.base)throw new Error("Can not derive from a modified tag");let s=new Xi(r,[],null,[]);if(s.set.push(s),n)for(let i of n.set)s.set.push(i);return s}static defineModifier(e){let n=new Q1(e);return r=>r.modified.indexOf(n)>-1?r:Q1.get(r.base||r,r.modified.concat(n).sort((s,i)=>s.id-i.id))}}let Sae=0;class Q1{constructor(e){this.name=e,this.instances=[],this.id=Sae++}static get(e,n){if(!n.length)return e;let r=n[0].instances.find(o=>o.base==e&&kae(n,o.modified));if(r)return r;let s=[],i=new Xi(e.name,s,e,n);for(let o of n)o.instances.push(i);let a=jae(n);for(let o of e.set)if(!o.modified.length)for(let c of a)s.push(Q1.get(o,c));return i}}function kae(t,e){return t.length==e.length&&t.every((n,r)=>n==e[r])}function jae(t){let e=[[]];for(let n=0;nr.length-n.length)}function U6(t){let e=Object.create(null);for(let n in t){let r=t[n];Array.isArray(r)||(r=[r]);for(let s of n.split(" "))if(s){let i=[],a=2,o=s;for(let m=0;;){if(o=="..."&&m>0&&m+3==s.length){a=1;break}let g=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(o);if(!g)throw new RangeError("Invalid path: "+s);if(i.push(g[0]=="*"?"":g[0][0]=='"'?JSON.parse(g[0]):g[0]),m+=g[0].length,m==s.length)break;let x=s[m++];if(m==s.length&&x=="!"){a=0;break}if(x!="/")throw new RangeError("Invalid path: "+s);o=s.slice(m)}let c=i.length-1,h=i[c];if(!h)throw new RangeError("Invalid path: "+s);let f=new t0(r,a,c>0?i.slice(0,c):null);e[h]=f.sort(e[h])}}return kB.add(e)}const kB=new Yt({combine(t,e){let n,r,s;for(;t||e;){if(!t||e&&t.depth>=e.depth?(s=e,e=e.next):(s=t,t=t.next),n&&n.mode==s.mode&&!s.context&&!n.context)continue;let i=new t0(s.tags,s.mode,s.context);n?n.next=i:r=i,n=i}return r}});class t0{constructor(e,n,r,s){this.tags=e,this.mode=n,this.context=r,this.next=s}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth{let a=s;for(let o of i)for(let c of o.set){let h=n[c.id];if(h){a=a?a+" "+h:h;break}}return a},scope:r}}function Oae(t,e){let n=null;for(let r of t){let s=r.style(e);s&&(n=n?n+" "+s:s)}return n}function Nae(t,e,n,r=0,s=t.length){let i=new Cae(r,Array.isArray(e)?e:[e],n);i.highlightRange(t.cursor(),r,s,"",i.highlighters),i.flush(s)}class Cae{constructor(e,n,r){this.at=e,this.highlighters=n,this.span=r,this.class=""}startSpan(e,n){n!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=n)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,n,r,s,i){let{type:a,from:o,to:c}=e;if(o>=r||c<=n)return;a.isTop&&(i=this.highlighters.filter(x=>!x.scope||x.scope(a)));let h=s,f=Tae(e)||t0.empty,m=Oae(i,f.tags);if(m&&(h&&(h+=" "),h+=m,f.mode==1&&(s+=(s?" ":"")+m)),this.startSpan(Math.max(n,o),h),f.opaque)return;let g=e.tree&&e.tree.prop(Yt.mounted);if(g&&g.overlay){let x=e.node.enter(g.overlay[0].from+o,1),y=this.highlighters.filter(S=>!S.scope||S.scope(g.tree.type)),w=e.firstChild();for(let S=0,k=o;;S++){let N=S=C||!e.nextSibling())););if(!N||C>r)break;k=N.to+o,k>n&&(this.highlightRange(x.cursor(),Math.max(n,N.from+o),Math.min(r,k),"",y),this.startSpan(Math.min(r,k),h))}w&&e.parent()}else if(e.firstChild()){g&&(s="");do if(!(e.to<=n)){if(e.from>=r)break;this.highlightRange(e,n,r,s,i),this.startSpan(Math.min(r,e.to),h)}while(e.nextSibling());e.parent()}}}function Tae(t){let e=t.type.prop(kB);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}const Ye=Xi.define,fx=Ye(),ic=Ye(),AT=Ye(ic),RT=Ye(ic),ac=Ye(),mx=Ye(ac),_w=Ye(ac),Ga=Ye(),su=Ye(Ga),Ua=Ye(),Wa=Ye(),zS=Ye(),em=Ye(zS),px=Ye(),xe={comment:fx,lineComment:Ye(fx),blockComment:Ye(fx),docComment:Ye(fx),name:ic,variableName:Ye(ic),typeName:AT,tagName:Ye(AT),propertyName:RT,attributeName:Ye(RT),className:Ye(ic),labelName:Ye(ic),namespace:Ye(ic),macroName:Ye(ic),literal:ac,string:mx,docString:Ye(mx),character:Ye(mx),attributeValue:Ye(mx),number:_w,integer:Ye(_w),float:Ye(_w),bool:Ye(ac),regexp:Ye(ac),escape:Ye(ac),color:Ye(ac),url:Ye(ac),keyword:Ua,self:Ye(Ua),null:Ye(Ua),atom:Ye(Ua),unit:Ye(Ua),modifier:Ye(Ua),operatorKeyword:Ye(Ua),controlKeyword:Ye(Ua),definitionKeyword:Ye(Ua),moduleKeyword:Ye(Ua),operator:Wa,derefOperator:Ye(Wa),arithmeticOperator:Ye(Wa),logicOperator:Ye(Wa),bitwiseOperator:Ye(Wa),compareOperator:Ye(Wa),updateOperator:Ye(Wa),definitionOperator:Ye(Wa),typeOperator:Ye(Wa),controlOperator:Ye(Wa),punctuation:zS,separator:Ye(zS),bracket:em,angleBracket:Ye(em),squareBracket:Ye(em),paren:Ye(em),brace:Ye(em),content:Ga,heading:su,heading1:Ye(su),heading2:Ye(su),heading3:Ye(su),heading4:Ye(su),heading5:Ye(su),heading6:Ye(su),contentSeparator:Ye(Ga),list:Ye(Ga),quote:Ye(Ga),emphasis:Ye(Ga),strong:Ye(Ga),link:Ye(Ga),monospace:Ye(Ga),strikethrough:Ye(Ga),inserted:Ye(),deleted:Ye(),changed:Ye(),invalid:Ye(),meta:px,documentMeta:Ye(px),annotation:Ye(px),processingInstruction:Ye(px),definition:Xi.defineModifier("definition"),constant:Xi.defineModifier("constant"),function:Xi.defineModifier("function"),standard:Xi.defineModifier("standard"),local:Xi.defineModifier("local"),special:Xi.defineModifier("special")};for(let t in xe){let e=xe[t];e instanceof Xi&&(e.name=t)}jB([{tag:xe.link,class:"tok-link"},{tag:xe.heading,class:"tok-heading"},{tag:xe.emphasis,class:"tok-emphasis"},{tag:xe.strong,class:"tok-strong"},{tag:xe.keyword,class:"tok-keyword"},{tag:xe.atom,class:"tok-atom"},{tag:xe.bool,class:"tok-bool"},{tag:xe.url,class:"tok-url"},{tag:xe.labelName,class:"tok-labelName"},{tag:xe.inserted,class:"tok-inserted"},{tag:xe.deleted,class:"tok-deleted"},{tag:xe.literal,class:"tok-literal"},{tag:xe.string,class:"tok-string"},{tag:xe.number,class:"tok-number"},{tag:[xe.regexp,xe.escape,xe.special(xe.string)],class:"tok-string2"},{tag:xe.variableName,class:"tok-variableName"},{tag:xe.local(xe.variableName),class:"tok-variableName tok-local"},{tag:xe.definition(xe.variableName),class:"tok-variableName tok-definition"},{tag:xe.special(xe.variableName),class:"tok-variableName2"},{tag:xe.definition(xe.propertyName),class:"tok-propertyName tok-definition"},{tag:xe.typeName,class:"tok-typeName"},{tag:xe.namespace,class:"tok-namespace"},{tag:xe.className,class:"tok-className"},{tag:xe.macroName,class:"tok-macroName"},{tag:xe.propertyName,class:"tok-propertyName"},{tag:xe.operator,class:"tok-operator"},{tag:xe.comment,class:"tok-comment"},{tag:xe.meta,class:"tok-meta"},{tag:xe.invalid,class:"tok-invalid"},{tag:xe.punctuation,class:"tok-punctuation"}]);var Mw;const gu=new Yt;function OB(t){return nt.define({combine:t?e=>e.concat(t):void 0})}const Eae=new Yt;class Zi{constructor(e,n,r=[],s=""){this.data=e,this.name=s,dn.prototype.hasOwnProperty("tree")||Object.defineProperty(dn.prototype,"tree",{get(){return ls(this)}}),this.parser=n,this.extension=[kc.of(this),dn.languageData.of((i,a,o)=>{let c=DT(i,a,o),h=c.type.prop(gu);if(!h)return[];let f=i.facet(h),m=c.type.prop(Eae);if(m){let g=c.resolve(a-c.from,o);for(let x of m)if(x.test(g,i)){let y=i.facet(x.facet);return x.type=="replace"?y:y.concat(f)}}return f})].concat(r)}isActiveAt(e,n,r=-1){return DT(e,n,r).type.prop(gu)==this.data}findRegions(e){let n=e.facet(kc);if(n?.data==this.data)return[{from:0,to:e.doc.length}];if(!n||!n.allowsNesting)return[];let r=[],s=(i,a)=>{if(i.prop(gu)==this.data){r.push({from:a,to:a+i.length});return}let o=i.prop(Yt.mounted);if(o){if(o.tree.prop(gu)==this.data){if(o.overlay)for(let c of o.overlay)r.push({from:c.from+a,to:c.to+a});else r.push({from:a,to:a+i.length});return}else if(o.overlay){let c=r.length;if(s(o.tree,o.overlay[0].from+a),r.length>c)return}}for(let c=0;cr.isTop?n:void 0)]}),e.name)}configure(e,n){return new n0(this.data,this.parser.configure(e),n||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function ls(t){let e=t.field(Zi.state,!1);return e?e.tree:Xn.empty}class _ae{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,n){let r=this.cursorPos-this.string.length;return e=this.cursorPos?this.doc.sliceString(e,n):this.string.slice(e-r,n-r)}}let tm=null;class kh{constructor(e,n,r=[],s,i,a,o,c){this.parser=e,this.state=n,this.fragments=r,this.tree=s,this.treeLen=i,this.viewport=a,this.skipped=o,this.scheduleOn=c,this.parse=null,this.tempSkipped=[]}static create(e,n,r){return new kh(e,n,[],Xn.empty,0,r,[],null)}startParse(){return this.parser.startParse(new _ae(this.state.doc),this.fragments)}work(e,n){return n!=null&&n>=this.state.doc.length&&(n=void 0),this.tree!=Xn.empty&&this.isDone(n??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var r;if(typeof e=="number"){let s=Date.now()+e;e=()=>Date.now()>s}for(this.parse||(this.parse=this.startParse()),n!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>n)&&n=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(n=this.parse.advance()););}),this.treeLen=e,this.tree=n,this.fragments=this.withoutTempSkipped(ju.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let n=tm;tm=this;try{return e()}finally{tm=n}}withoutTempSkipped(e){for(let n;n=this.tempSkipped.pop();)e=zT(e,n.from,n.to);return e}changes(e,n){let{fragments:r,tree:s,treeLen:i,viewport:a,skipped:o}=this;if(this.takeTree(),!e.empty){let c=[];if(e.iterChangedRanges((h,f,m,g)=>c.push({fromA:h,toA:f,fromB:m,toB:g})),r=ju.applyChanges(r,c),s=Xn.empty,i=0,a={from:e.mapPos(a.from,-1),to:e.mapPos(a.to,1)},this.skipped.length){o=[];for(let h of this.skipped){let f=e.mapPos(h.from,1),m=e.mapPos(h.to,-1);fe.from&&(this.fragments=zT(this.fragments,s,i),this.skipped.splice(r--,1))}return this.skipped.length>=n?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,n){this.skipped.push({from:e,to:n})}static getSkippingParser(e){return new class extends V6{createParse(n,r,s){let i=s[0].from,a=s[s.length-1].to;return{parsedPos:i,advance(){let c=tm;if(c){for(let h of s)c.tempSkipped.push(h);e&&(c.scheduleOn=c.scheduleOn?Promise.all([c.scheduleOn,e]):e)}return this.parsedPos=a,new Xn(qs.none,[],[],a-i)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let n=this.fragments;return this.treeLen>=e&&n.length&&n[0].from==0&&n[0].to>=e}static get(){return tm}}function zT(t,e,n){return ju.applyChanges(t,[{fromA:e,toA:n,fromB:e,toB:n}])}class jh{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let n=this.context.changes(e.changes,e.state),r=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),n.viewport.to);return n.work(20,r)||n.takeTree(),new jh(n)}static init(e){let n=Math.min(3e3,e.doc.length),r=kh.create(e.facet(kc).parser,e,{from:0,to:n});return r.work(20,n)||r.takeTree(),new jh(r)}}Zi.state=us.define({create:jh.init,update(t,e){for(let n of e.effects)if(n.is(Zi.setState))return n.value;return e.startState.facet(kc)!=e.state.facet(kc)?jh.init(e.state):t.apply(e)}});let NB=t=>{let e=setTimeout(()=>t(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(NB=t=>{let e=-1,n=setTimeout(()=>{e=requestIdleCallback(t,{timeout:400})},100);return()=>e<0?clearTimeout(n):cancelIdleCallback(e)});const Aw=typeof navigator<"u"&&(!((Mw=navigator.scheduling)===null||Mw===void 0)&&Mw.isInputPending)?()=>navigator.scheduling.isInputPending():null,Mae=_r.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let n=this.view.state.field(Zi.state).context;(n.updateViewport(e.view.viewport)||this.view.viewport.to>n.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(n)}scheduleWork(){if(this.working)return;let{state:e}=this.view,n=e.field(Zi.state);(n.tree!=n.context.tree||!n.context.isDone(e.doc.length))&&(this.working=NB(this.work))}work(e){this.working=null;let n=Date.now();if(this.chunkEnds+1e3,c=i.context.work(()=>Aw&&Aw()||Date.now()>a,s+(o?0:1e5));this.chunkBudget-=Date.now()-n,(c||this.chunkBudget<=0)&&(i.context.takeTree(),this.view.dispatch({effects:Zi.setState.of(new jh(i.context))})),this.chunkBudget>0&&!(c&&!o)&&this.scheduleWork(),this.checkAsyncSchedule(i.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(n=>ni(this.view.state,n)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),kc=nt.define({combine(t){return t.length?t[0]:null},enables:t=>[Zi.state,Mae,Ke.contentAttributes.compute([t],e=>{let n=e.facet(t);return n&&n.name?{"data-language":n.name}:{}})]});class CB{constructor(e,n=[]){this.language=e,this.support=n,this.extension=[e,n]}}const Aae=nt.define(),J0=nt.define({combine:t=>{if(!t.length)return" ";let e=t[0];if(!e||/\S/.test(e)||Array.from(e).some(n=>n!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(t[0]));return e}});function Du(t){let e=t.facet(J0);return e.charCodeAt(0)==9?t.tabSize*e.length:e.length}function r0(t,e){let n="",r=t.tabSize,s=t.facet(J0)[0];if(s==" "){for(;e>=r;)n+=" ",e-=r;s=" "}for(let i=0;i=e?Rae(t,n,e):null}class ey{constructor(e,n={}){this.state=e,this.options=n,this.unit=Du(e)}lineAt(e,n=1){let r=this.state.doc.lineAt(e),{simulateBreak:s,simulateDoubleBreak:i}=this.options;return s!=null&&s>=r.from&&s<=r.to?i&&s==e?{text:"",from:e}:(n<0?s-1&&(i+=a-this.countColumn(r,r.search(/\S|$/))),i}countColumn(e,n=e.length){return Fh(e,this.state.tabSize,n)}lineIndent(e,n=1){let{text:r,from:s}=this.lineAt(e,n),i=this.options.overrideIndentation;if(i){let a=i(s);if(a>-1)return a}return this.countColumn(r,r.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const ty=new Yt;function Rae(t,e,n){let r=e.resolveStack(n),s=e.resolveInner(n,-1).resolve(n,0).enterUnfinishedNodesBefore(n);if(s!=r.node){let i=[];for(let a=s;a&&!(a.fromr.node.to||a.from==r.node.from&&a.type==r.node.type);a=a.parent)i.push(a);for(let a=i.length-1;a>=0;a--)r={node:i[a],next:r}}return TB(r,t,n)}function TB(t,e,n){for(let r=t;r;r=r.next){let s=zae(r.node);if(s)return s(G6.create(e,n,r))}return 0}function Dae(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}function zae(t){let e=t.type.prop(ty);if(e)return e;let n=t.firstChild,r;if(n&&(r=n.type.prop(Yt.closedBy))){let s=t.lastChild,i=s&&r.indexOf(s.name)>-1;return a=>EB(a,!0,1,void 0,i&&!Dae(a)?s.from:void 0)}return t.parent==null?Pae:null}function Pae(){return 0}class G6 extends ey{constructor(e,n,r){super(e.state,e.options),this.base=e,this.pos=n,this.context=r}get node(){return this.context.node}static create(e,n,r){return new G6(e,n,r)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let n=this.state.doc.lineAt(e.from);for(;;){let r=e.resolve(n.from);for(;r.parent&&r.parent.from==r.from;)r=r.parent;if(Lae(r,e))break;n=this.state.doc.lineAt(r.from)}return this.lineIndent(n.from)}continue(){return TB(this.context.next,this.base,this.pos)}}function Lae(t,e){for(let n=e;n;n=n.parent)if(t==n)return!0;return!1}function Iae(t){let e=t.node,n=e.childAfter(e.from),r=e.lastChild;if(!n)return null;let s=t.options.simulateBreak,i=t.state.doc.lineAt(n.from),a=s==null||s<=i.from?i.to:Math.min(i.to,s);for(let o=n.to;;){let c=e.childAfter(o);if(!c||c==r)return null;if(!c.type.isSkipped){if(c.from>=a)return null;let h=/^ */.exec(i.text.slice(n.to-i.from))[0].length;return{from:n.from,to:n.to+h}}o=c.to}}function Rw({closing:t,align:e=!0,units:n=1}){return r=>EB(r,e,n,t)}function EB(t,e,n,r,s){let i=t.textAfter,a=i.match(/^\s*/)[0].length,o=r&&i.slice(a,a+r.length)==r||s==t.pos+a,c=e?Iae(t):null;return c?o?t.column(c.from):t.column(c.to):t.baseIndent+(o?0:t.unit*n)}function PT({except:t,units:e=1}={}){return n=>{let r=t&&t.test(n.textAfter);return n.baseIndent+(r?0:e*n.unit)}}const Bae=200;function qae(){return dn.transactionFilter.of(t=>{if(!t.docChanged||!t.isUserEvent("input.type")&&!t.isUserEvent("input.complete"))return t;let e=t.startState.languageDataAt("indentOnInput",t.startState.selection.main.head);if(!e.length)return t;let n=t.newDoc,{head:r}=t.newSelection.main,s=n.lineAt(r);if(r>s.from+Bae)return t;let i=n.sliceString(s.from,r);if(!e.some(h=>h.test(i)))return t;let{state:a}=t,o=-1,c=[];for(let{head:h}of a.selection.ranges){let f=a.doc.lineAt(h);if(f.from==o)continue;o=f.from;let m=W6(a,f.from);if(m==null)continue;let g=/^\s*/.exec(f.text)[0],x=r0(a,m);g!=x&&c.push({from:f.from,to:f.from+g.length,insert:x})}return c.length?[t,{changes:c,sequential:!0}]:t})}const Fae=nt.define(),X6=new Yt;function _B(t){let e=t.firstChild,n=t.lastChild;return e&&e.ton)continue;if(i&&o.from=e&&h.to>n&&(i=h)}}return i}function Qae(t){let e=t.lastChild;return e&&e.to==t.to&&e.type.isError}function H1(t,e,n){for(let r of t.facet(Fae)){let s=r(t,e,n);if(s)return s}return $ae(t,e,n)}function MB(t,e){let n=e.mapPos(t.from,1),r=e.mapPos(t.to,-1);return n>=r?void 0:{from:n,to:r}}const ny=Lt.define({map:MB}),ep=Lt.define({map:MB});function AB(t){let e=[];for(let{head:n}of t.state.selection.ranges)e.some(r=>r.from<=n&&r.to>=n)||e.push(t.lineBlockAt(n));return e}const zu=us.define({create(){return xt.none},update(t,e){e.isUserEvent("delete")&&e.changes.iterChangedRanges((n,r)=>t=LT(t,n,r)),t=t.map(e.changes);for(let n of e.effects)if(n.is(ny)&&!Hae(t,n.value.from,n.value.to)){let{preparePlaceholder:r}=e.state.facet(zB),s=r?xt.replace({widget:new Kae(r(e.state,n.value))}):IT;t=t.update({add:[s.range(n.value.from,n.value.to)]})}else n.is(ep)&&(t=t.update({filter:(r,s)=>n.value.from!=r||n.value.to!=s,filterFrom:n.value.from,filterTo:n.value.to}));return e.selection&&(t=LT(t,e.selection.main.head)),t},provide:t=>Ke.decorations.from(t),toJSON(t,e){let n=[];return t.between(0,e.doc.length,(r,s)=>{n.push(r,s)}),n},fromJSON(t){if(!Array.isArray(t)||t.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let n=0;n{se&&(r=!0)}),r?t.update({filterFrom:e,filterTo:n,filter:(s,i)=>s>=n||i<=e}):t}function V1(t,e,n){var r;let s=null;return(r=t.field(zu,!1))===null||r===void 0||r.between(e,n,(i,a)=>{(!s||s.from>i)&&(s={from:i,to:a})}),s}function Hae(t,e,n){let r=!1;return t.between(e,e,(s,i)=>{s==e&&i==n&&(r=!0)}),r}function RB(t,e){return t.field(zu,!1)?e:e.concat(Lt.appendConfig.of(PB()))}const Vae=t=>{for(let e of AB(t)){let n=H1(t.state,e.from,e.to);if(n)return t.dispatch({effects:RB(t.state,[ny.of(n),DB(t,n)])}),!0}return!1},Uae=t=>{if(!t.state.field(zu,!1))return!1;let e=[];for(let n of AB(t)){let r=V1(t.state,n.from,n.to);r&&e.push(ep.of(r),DB(t,r,!1))}return e.length&&t.dispatch({effects:e}),e.length>0};function DB(t,e,n=!0){let r=t.state.doc.lineAt(e.from).number,s=t.state.doc.lineAt(e.to).number;return Ke.announce.of(`${t.state.phrase(n?"Folded lines":"Unfolded lines")} ${r} ${t.state.phrase("to")} ${s}.`)}const Wae=t=>{let{state:e}=t,n=[];for(let r=0;r{let e=t.state.field(zu,!1);if(!e||!e.size)return!1;let n=[];return e.between(0,t.state.doc.length,(r,s)=>{n.push(ep.of({from:r,to:s}))}),t.dispatch({effects:n}),!0},Xae=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:Vae},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:Uae},{key:"Ctrl-Alt-[",run:Wae},{key:"Ctrl-Alt-]",run:Gae}],Yae={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},zB=nt.define({combine(t){return gl(t,Yae)}});function PB(t){return[zu,ele]}function LB(t,e){let{state:n}=t,r=n.facet(zB),s=a=>{let o=t.lineBlockAt(t.posAtDOM(a.target)),c=V1(t.state,o.from,o.to);c&&t.dispatch({effects:ep.of(c)}),a.preventDefault()};if(r.placeholderDOM)return r.placeholderDOM(t,s,e);let i=document.createElement("span");return i.textContent=r.placeholderText,i.setAttribute("aria-label",n.phrase("folded code")),i.title=n.phrase("unfold"),i.className="cm-foldPlaceholder",i.onclick=s,i}const IT=xt.replace({widget:new class extends xl{toDOM(t){return LB(t,null)}}});class Kae extends xl{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return LB(e,this.value)}}const Zae={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class Dw extends po{constructor(e,n){super(),this.config=e,this.open=n}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let n=document.createElement("span");return n.textContent=this.open?this.config.openText:this.config.closedText,n.title=e.state.phrase(this.open?"Fold line":"Unfold line"),n}}function Jae(t={}){let e={...Zae,...t},n=new Dw(e,!0),r=new Dw(e,!1),s=_r.fromClass(class{constructor(a){this.from=a.viewport.from,this.markers=this.buildMarkers(a)}update(a){(a.docChanged||a.viewportChanged||a.startState.facet(kc)!=a.state.facet(kc)||a.startState.field(zu,!1)!=a.state.field(zu,!1)||ls(a.startState)!=ls(a.state)||e.foldingChanged(a))&&(this.markers=this.buildMarkers(a.view))}buildMarkers(a){let o=new fo;for(let c of a.viewportLineBlocks){let h=V1(a.state,c.from,c.to)?r:H1(a.state,c.from,c.to)?n:null;h&&o.add(c.from,c.from,h)}return o.finish()}}),{domEventHandlers:i}=e;return[s,nae({class:"cm-foldGutter",markers(a){var o;return((o=a.plugin(s))===null||o===void 0?void 0:o.markers)||On.empty},initialSpacer(){return new Dw(e,!1)},domEventHandlers:{...i,click:(a,o,c)=>{if(i.click&&i.click(a,o,c))return!0;let h=V1(a.state,o.from,o.to);if(h)return a.dispatch({effects:ep.of(h)}),!0;let f=H1(a.state,o.from,o.to);return f?(a.dispatch({effects:ny.of(f)}),!0):!1}}}),PB()]}const ele=Ke.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class tp{constructor(e,n){this.specs=e;let r;function s(o){let c=yc.newName();return(r||(r=Object.create(null)))["."+c]=o,c}const i=typeof n.all=="string"?n.all:n.all?s(n.all):void 0,a=n.scope;this.scope=a instanceof Zi?o=>o.prop(gu)==a.data:a?o=>o==a:void 0,this.style=jB(e.map(o=>({tag:o.tag,class:o.class||s(Object.assign({},o,{tag:null}))})),{all:i}).style,this.module=r?new yc(r):null,this.themeType=n.themeType}static define(e,n){return new tp(e,n||{})}}const PS=nt.define(),IB=nt.define({combine(t){return t.length?[t[0]]:null}});function zw(t){let e=t.facet(PS);return e.length?e:t.facet(IB)}function BB(t,e){let n=[nle],r;return t instanceof tp&&(t.module&&n.push(Ke.styleModule.of(t.module)),r=t.themeType),e?.fallback?n.push(IB.of(t)):r?n.push(PS.computeN([Ke.darkTheme],s=>s.facet(Ke.darkTheme)==(r=="dark")?[t]:[])):n.push(PS.of(t)),n}class tle{constructor(e){this.markCache=Object.create(null),this.tree=ls(e.state),this.decorations=this.buildDeco(e,zw(e.state)),this.decoratedTo=e.viewport.to}update(e){let n=ls(e.state),r=zw(e.state),s=r!=zw(e.startState),{viewport:i}=e.view,a=e.changes.mapPos(this.decoratedTo,1);n.length=i.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=a):(n!=this.tree||e.viewportChanged||s)&&(this.tree=n,this.decorations=this.buildDeco(e.view,r),this.decoratedTo=i.to)}buildDeco(e,n){if(!n||!this.tree.length)return xt.none;let r=new fo;for(let{from:s,to:i}of e.visibleRanges)Nae(this.tree,n,(a,o,c)=>{r.add(a,o,this.markCache[c]||(this.markCache[c]=xt.mark({class:c})))},s,i);return r.finish()}}const nle=Ac.high(_r.fromClass(tle,{decorations:t=>t.decorations})),rle=tp.define([{tag:xe.meta,color:"#404740"},{tag:xe.link,textDecoration:"underline"},{tag:xe.heading,textDecoration:"underline",fontWeight:"bold"},{tag:xe.emphasis,fontStyle:"italic"},{tag:xe.strong,fontWeight:"bold"},{tag:xe.strikethrough,textDecoration:"line-through"},{tag:xe.keyword,color:"#708"},{tag:[xe.atom,xe.bool,xe.url,xe.contentSeparator,xe.labelName],color:"#219"},{tag:[xe.literal,xe.inserted],color:"#164"},{tag:[xe.string,xe.deleted],color:"#a11"},{tag:[xe.regexp,xe.escape,xe.special(xe.string)],color:"#e40"},{tag:xe.definition(xe.variableName),color:"#00f"},{tag:xe.local(xe.variableName),color:"#30a"},{tag:[xe.typeName,xe.namespace],color:"#085"},{tag:xe.className,color:"#167"},{tag:[xe.special(xe.variableName),xe.macroName],color:"#256"},{tag:xe.definition(xe.propertyName),color:"#00c"},{tag:xe.comment,color:"#940"},{tag:xe.invalid,color:"#f00"}]),sle=Ke.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),qB=1e4,FB="()[]{}",$B=nt.define({combine(t){return gl(t,{afterCursor:!0,brackets:FB,maxScanDistance:qB,renderMatch:lle})}}),ile=xt.mark({class:"cm-matchingBracket"}),ale=xt.mark({class:"cm-nonmatchingBracket"});function lle(t){let e=[],n=t.matched?ile:ale;return e.push(n.range(t.start.from,t.start.to)),t.end&&e.push(n.range(t.end.from,t.end.to)),e}const ole=us.define({create(){return xt.none},update(t,e){if(!e.docChanged&&!e.selection)return t;let n=[],r=e.state.facet($B);for(let s of e.state.selection.ranges){if(!s.empty)continue;let i=rl(e.state,s.head,-1,r)||s.head>0&&rl(e.state,s.head-1,1,r)||r.afterCursor&&(rl(e.state,s.head,1,r)||s.headKe.decorations.from(t)}),cle=[ole,sle];function ule(t={}){return[$B.of(t),cle]}const dle=new Yt;function LS(t,e,n){let r=t.prop(e<0?Yt.openedBy:Yt.closedBy);if(r)return r;if(t.name.length==1){let s=n.indexOf(t.name);if(s>-1&&s%2==(e<0?1:0))return[n[s+e]]}return null}function IS(t){let e=t.type.prop(dle);return e?e(t.node):t}function rl(t,e,n,r={}){let s=r.maxScanDistance||qB,i=r.brackets||FB,a=ls(t),o=a.resolveInner(e,n);for(let c=o;c;c=c.parent){let h=LS(c.type,n,i);if(h&&c.from0?e>=f.from&&ef.from&&e<=f.to))return hle(t,e,n,c,f,h,i)}}return fle(t,e,n,a,o.type,s,i)}function hle(t,e,n,r,s,i,a){let o=r.parent,c={from:s.from,to:s.to},h=0,f=o?.cursor();if(f&&(n<0?f.childBefore(r.from):f.childAfter(r.to)))do if(n<0?f.to<=r.from:f.from>=r.to){if(h==0&&i.indexOf(f.type.name)>-1&&f.from0)return null;let h={from:n<0?e-1:e,to:n>0?e+1:e},f=t.doc.iterRange(e,n>0?t.doc.length:0),m=0;for(let g=0;!f.next().done&&g<=i;){let x=f.value;n<0&&(g+=x.length);let y=e+g*n;for(let w=n>0?0:x.length-1,S=n>0?x.length:-1;w!=S;w+=n){let k=a.indexOf(x[w]);if(!(k<0||r.resolveInner(y+w,1).type!=s))if(k%2==0==n>0)m++;else{if(m==1)return{start:h,end:{from:y+w,to:y+w+1},matched:k>>1==c>>1};m--}}n>0&&(g+=x.length)}return f.done?{start:h,matched:!1}:null}function BT(t,e,n,r=0,s=0){e==null&&(e=t.search(/[^\s\u00a0]/),e==-1&&(e=t.length));let i=s;for(let a=r;a=this.string.length}sol(){return this.pos==0}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.posn}eatSpace(){let e=this.pos;for(;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e}skipToEnd(){this.pos=this.string.length}skipTo(e){let n=this.string.indexOf(e,this.pos);if(n>-1)return this.pos=n,!0}backUp(e){this.pos-=e}column(){return this.lastColumnPosr?a.toLowerCase():a,i=this.string.substr(this.pos,e.length);return s(i)==s(e)?(n!==!1&&(this.pos+=e.length),!0):null}else{let s=this.string.slice(this.pos).match(e);return s&&s.index>0?null:(s&&n!==!1&&(this.pos+=s[0].length),s)}}current(){return this.string.slice(this.start,this.pos)}}function mle(t){return{name:t.name||"",token:t.token,blankLine:t.blankLine||(()=>{}),startState:t.startState||(()=>!0),copyState:t.copyState||ple,indent:t.indent||(()=>null),languageData:t.languageData||{},tokenTable:t.tokenTable||Z6,mergeTokens:t.mergeTokens!==!1}}function ple(t){if(typeof t!="object")return t;let e={};for(let n in t){let r=t[n];e[n]=r instanceof Array?r.slice():r}return e}const qT=new WeakMap;class Y6 extends Zi{constructor(e){let n=OB(e.languageData),r=mle(e),s,i=new class extends V6{createParse(a,o,c){return new xle(s,a,o,c)}};super(n,i,[],e.name),this.topNode=ble(n,this),s=this,this.streamParser=r,this.stateAfter=new Yt({perNode:!0}),this.tokenTable=e.tokenTable?new WB(r.tokenTable):yle}static define(e){return new Y6(e)}getIndent(e){let n,{overrideIndentation:r}=e.options;r&&(n=qT.get(e.state),n!=null&&n1e4)return null;for(;i=r&&n+e.length<=s&&e.prop(t.stateAfter);if(i)return{state:t.streamParser.copyState(i),pos:n+e.length};for(let a=e.children.length-1;a>=0;a--){let o=e.children[a],c=n+e.positions[a],h=o instanceof Xn&&c=e.length)return e;!s&&n==0&&e.type==t.topNode&&(s=!0);for(let i=e.children.length-1;i>=0;i--){let a=e.positions[i],o=e.children[i],c;if(an&&K6(t,i.tree,0-i.offset,n,o),h;if(c&&c.pos<=r&&(h=HB(t,i.tree,n+i.offset,c.pos+i.offset,!1)))return{state:c.state,tree:h}}return{state:t.streamParser.startState(s?Du(s):4),tree:Xn.empty}}let xle=class{constructor(e,n,r,s){this.lang=e,this.input=n,this.fragments=r,this.ranges=s,this.stoppedAt=null,this.chunks=[],this.chunkPos=[],this.chunk=[],this.chunkReused=void 0,this.rangeIndex=0,this.to=s[s.length-1].to;let i=kh.get(),a=s[0].from,{state:o,tree:c}=gle(e,r,a,this.to,i?.state);this.state=o,this.parsedPos=this.chunkStart=a+c.length;for(let h=0;hh.from<=i.viewport.from&&h.to>=i.viewport.from)&&(this.state=this.lang.streamParser.startState(Du(i.state)),i.skipUntilInView(this.parsedPos,i.viewport.from),this.parsedPos=i.viewport.from),this.moveRangeIndex()}advance(){let e=kh.get(),n=this.stoppedAt==null?this.to:Math.min(this.to,this.stoppedAt),r=Math.min(n,this.chunkStart+512);for(e&&(r=Math.min(r,e.viewport.to));this.parsedPos=n?this.finish():e&&this.parsedPos>=e.viewport.to?(e.skipUntilInView(this.parsedPos,n),this.finish()):null}stopAt(e){this.stoppedAt=e}lineAfter(e){let n=this.input.chunk(e);if(this.input.lineChunks)n==` `&&(n="");else{let r=n.indexOf(` -`);r>-1&&(n=n.slice(0,r))}return e+n.length<=this.to?n:n.slice(0,this.to-e)}nextLine(){let e=this.parsedPos,n=this.lineAfter(e),r=e+n.length;for(let s=this.rangeIndex;;){let i=this.ranges[s].to;if(i>=r||(n=n.slice(0,i-(r-n.length)),s++,s==this.ranges.length))break;let a=this.ranges[s].from,o=this.lineAfter(a);n+=o,r=a+o.length}return{line:n,end:r}}skipGapsTo(e,n,r){for(;;){let s=this.ranges[this.rangeIndex].to,i=e+n;if(r>0?s>i:s>=i)break;let a=this.ranges[++this.rangeIndex].from;n+=a-s}return n}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to1){s=this.skipGapsTo(n,s,1),n+=s;let o=this.chunk.length;s=this.skipGapsTo(r,s,-1),r+=s,i+=this.chunk.length-o}let a=this.chunk.length-4;return this.lang.streamParser.mergeTokens&&i==4&&a>=0&&this.chunk[a]==e&&this.chunk[a+2]==n?this.chunk[a+2]=r:this.chunk.push(e,n,r,i),s}parseLine(e){let{line:n,end:r}=this.nextLine(),s=0,{streamParser:i}=this.lang,a=new FB(n,e?e.state.tabSize:4,e?Au(e.state):2);if(a.eol())i.blankLine(this.state,a.indentUnit);else for(;!a.eol();){let o=QB(i.token,a,this.state);if(o&&(s=this.emitToken(this.lang.tokenTable.resolve(o),this.parsedPos+a.start,this.parsedPos+a.pos,s)),a.start>1e4)break}this.parsedPos=r,this.moveRangeIndex(),this.parsedPose.start)return s}throw new Error("Stream parser failed to advance stream.")}const V6=Object.create(null),r0=[zs.none],ple=new Kv(r0),qT=[],FT=Object.create(null),HB=Object.create(null);for(let[t,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])HB[t]=UB(V6,e);class VB{constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),HB)}resolve(e){return e?this.table[e]||(this.table[e]=UB(this.extra,e)):0}}const gle=new VB(V6);function _w(t,e){qT.indexOf(t)>-1||(qT.push(t),console.warn(e))}function UB(t,e){let n=[];for(let o of e.split(" ")){let c=[];for(let h of o.split(".")){let f=t[h]||ve[h];f?typeof f=="function"?c.length?c=c.map(f):_w(h,`Modifier ${h} used at start of tag`):c.length?_w(h,`Tag ${h} used as modifier`):c=Array.isArray(f)?f:[f]:_w(h,`Unknown highlighting tag ${h}`)}for(let h of c)n.push(h)}if(!n.length)return 0;let r=e.replace(/ /g,"_"),s=r+" "+n.map(o=>o.id),i=FT[s];if(i)return i.id;let a=FT[s]=zs.define({id:r0.length,name:r,props:[B6({[r]:n})]});return r0.push(a),a.id}function xle(t,e){let n=zs.define({id:r0.length,name:"Document",props:[pu.add(()=>t),Jv.add(()=>r=>e.getIndent(r))],top:!0});return r0.push(n),n}Jn.RTL,Jn.LTR;const vle=t=>{let{state:e}=t,n=e.doc.lineAt(e.selection.main.from),r=W6(t.state,n.from);return r.line?yle(t):r.block?wle(t):!1};function U6(t,e){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let s=t(e,n);return s?(r(n.update(s)),!0):!1}}const yle=U6(Ole,0),ble=U6(WB,0),wle=U6((t,e)=>WB(t,e,kle(e)),0);function W6(t,e){let n=t.languageDataAt("commentTokens",e,1);return n.length?n[0]:{}}const nm=50;function Sle(t,{open:e,close:n},r,s){let i=t.sliceDoc(r-nm,r),a=t.sliceDoc(s,s+nm),o=/\s*$/.exec(i)[0].length,c=/^\s*/.exec(a)[0].length,h=i.length-o;if(i.slice(h-e.length,h)==e&&a.slice(c,c+n.length)==n)return{open:{pos:r-o,margin:o&&1},close:{pos:s+c,margin:c&&1}};let f,m;s-r<=2*nm?f=m=t.sliceDoc(r,s):(f=t.sliceDoc(r,r+nm),m=t.sliceDoc(s-nm,s));let g=/^\s*/.exec(f)[0].length,x=/\s*$/.exec(m)[0].length,y=m.length-x-n.length;return f.slice(g,g+e.length)==e&&m.slice(y,y+n.length)==n?{open:{pos:r+g+e.length,margin:/\s/.test(f.charAt(g+e.length))?1:0},close:{pos:s-x-n.length,margin:/\s/.test(m.charAt(y-1))?1:0}}:null}function kle(t){let e=[];for(let n of t.selection.ranges){let r=t.doc.lineAt(n.from),s=n.to<=r.to?r:t.doc.lineAt(n.to);s.from>r.from&&s.from==n.to&&(s=n.to==r.to+1?r:t.doc.lineAt(n.to-1));let i=e.length-1;i>=0&&e[i].to>r.from?e[i].to=s.to:e.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:s.to})}return e}function WB(t,e,n=e.selection.ranges){let r=n.map(i=>W6(e,i.from).block);if(!r.every(i=>i))return null;let s=n.map((i,a)=>Sle(e,r[a],i.from,i.to));if(t!=2&&!s.every(i=>i))return{changes:e.changes(n.map((i,a)=>s[a]?[]:[{from:i.from,insert:r[a].open+" "},{from:i.to,insert:" "+r[a].close}]))};if(t!=1&&s.some(i=>i)){let i=[];for(let a=0,o;as&&(i==a||a>m.from)){s=m.from;let g=/^\s*/.exec(m.text)[0].length,x=g==m.length,y=m.text.slice(g,g+h.length)==h?g:-1;gi.comment<0&&(!i.empty||i.single))){let i=[];for(let{line:o,token:c,indent:h,empty:f,single:m}of r)(m||!f)&&i.push({from:o.from+h,insert:c+" "});let a=e.changes(i);return{changes:a,selection:e.selection.map(a,1)}}else if(t!=1&&r.some(i=>i.comment>=0)){let i=[];for(let{line:a,comment:o,token:c}of r)if(o>=0){let h=a.from+o,f=h+c.length;a.text[f-a.from]==" "&&f++,i.push({from:h,to:f})}return{changes:i}}return null}const RS=hl.define(),jle=hl.define(),Nle=et.define(),GB=et.define({combine(t){return fl(t,{minDepth:100,newGroupDelay:500,joinToEvent:(e,n)=>n},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,n)=>(r,s)=>e(r,s)||n(r,s)})}}),XB=is.define({create(){return tl.empty},update(t,e){let n=e.state.facet(GB),r=e.annotation(RS);if(r){let c=ei.fromTransaction(e,r.selection),h=r.side,f=h==0?t.undone:t.done;return c?f=H1(f,f.length,n.minDepth,c):f=ZB(f,e.startState.selection),new tl(h==0?r.rest:f,h==0?f:r.rest)}let s=e.annotation(jle);if((s=="full"||s=="before")&&(t=t.isolate()),e.annotation(Pr.addToHistory)===!1)return e.changes.empty?t:t.addMapping(e.changes.desc);let i=ei.fromTransaction(e),a=e.annotation(Pr.time),o=e.annotation(Pr.userEvent);return i?t=t.addChanges(i,a,o,n,e):e.selection&&(t=t.addSelection(e.startState.selection,a,o,n.newGroupDelay)),(s=="full"||s=="after")&&(t=t.isolate()),t},toJSON(t){return{done:t.done.map(e=>e.toJSON()),undone:t.undone.map(e=>e.toJSON())}},fromJSON(t){return new tl(t.done.map(ei.fromJSON),t.undone.map(ei.fromJSON))}});function Cle(t={}){return[XB,GB.of(t),We.domEventHandlers({beforeinput(e,n){let r=e.inputType=="historyUndo"?YB:e.inputType=="historyRedo"?DS:null;return r?(e.preventDefault(),r(n)):!1}})]}function ty(t,e){return function({state:n,dispatch:r}){if(!e&&n.readOnly)return!1;let s=n.field(XB,!1);if(!s)return!1;let i=s.pop(t,n,e);return i?(r(i),!0):!1}}const YB=ty(0,!1),DS=ty(1,!1),Tle=ty(0,!0),Ele=ty(1,!0);class ei{constructor(e,n,r,s,i){this.changes=e,this.effects=n,this.mapped=r,this.startSelection=s,this.selectionsAfter=i}setSelAfter(e){return new ei(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,n,r;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(n=this.mapped)===null||n===void 0?void 0:n.toJSON(),startSelection:(r=this.startSelection)===null||r===void 0?void 0:r.toJSON(),selectionsAfter:this.selectionsAfter.map(s=>s.toJSON())}}static fromJSON(e){return new ei(e.changes&&Hr.fromJSON(e.changes),[],e.mapped&&ll.fromJSON(e.mapped),e.startSelection&&Ae.fromJSON(e.startSelection),e.selectionsAfter.map(Ae.fromJSON))}static fromTransaction(e,n){let r=Zi;for(let s of e.startState.facet(Nle)){let i=s(e);i.length&&(r=r.concat(i))}return!r.length&&e.changes.empty?null:new ei(e.changes.invert(e.startState.doc),r,void 0,n||e.startState.selection,Zi)}static selection(e){return new ei(void 0,Zi,void 0,void 0,e)}}function H1(t,e,n,r){let s=e+1>n+20?e-n-1:0,i=t.slice(s,e);return i.push(r),i}function _le(t,e){let n=[],r=!1;return t.iterChangedRanges((s,i)=>n.push(s,i)),e.iterChangedRanges((s,i,a,o)=>{for(let c=0;c=h&&a<=f&&(r=!0)}}),r}function Mle(t,e){return t.ranges.length==e.ranges.length&&t.ranges.filter((n,r)=>n.empty!=e.ranges[r].empty).length===0}function KB(t,e){return t.length?e.length?t.concat(e):t:e}const Zi=[],Ale=200;function ZB(t,e){if(t.length){let n=t[t.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-Ale));return r.length&&r[r.length-1].eq(e)?t:(r.push(e),H1(t,t.length-1,1e9,n.setSelAfter(r)))}else return[ei.selection([e])]}function Rle(t){let e=t[t.length-1],n=t.slice();return n[t.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),n}function Mw(t,e){if(!t.length)return t;let n=t.length,r=Zi;for(;n;){let s=Dle(t[n-1],e,r);if(s.changes&&!s.changes.empty||s.effects.length){let i=t.slice(0,n);return i[n-1]=s,i}else e=s.mapped,n--,r=s.selectionsAfter}return r.length?[ei.selection(r)]:Zi}function Dle(t,e,n){let r=KB(t.selectionsAfter.length?t.selectionsAfter.map(o=>o.map(e)):Zi,n);if(!t.changes)return ei.selection(r);let s=t.changes.map(e),i=e.mapDesc(t.changes,!0),a=t.mapped?t.mapped.composeDesc(i):i;return new ei(s,Mt.mapEffects(t.effects,e),a,t.startSelection.map(i),r)}const zle=/^(input\.type|delete)($|\.)/;class tl{constructor(e,n,r=0,s=void 0){this.done=e,this.undone=n,this.prevTime=r,this.prevUserEvent=s}isolate(){return this.prevTime?new tl(this.done,this.undone):this}addChanges(e,n,r,s,i){let a=this.done,o=a[a.length-1];return o&&o.changes&&!o.changes.empty&&e.changes&&(!r||zle.test(r))&&(!o.selectionsAfter.length&&n-this.prevTime0&&n-this.prevTimen.empty?t.moveByChar(n,e):ny(n,e))}function Os(t){return t.textDirectionAt(t.state.selection.main.head)==Jn.LTR}const eq=t=>JB(t,!Os(t)),tq=t=>JB(t,Os(t));function nq(t,e){return Da(t,n=>n.empty?t.moveByGroup(n,e):ny(n,e))}const Lle=t=>nq(t,!Os(t)),Ile=t=>nq(t,Os(t));function Ble(t,e,n){if(e.type.prop(n))return!0;let r=e.to-e.from;return r&&(r>2||/[^\s,.;:]/.test(t.sliceDoc(e.from,e.to)))||e.firstChild}function ry(t,e,n){let r=ns(t).resolveInner(e.head),s=n?Ht.closedBy:Ht.openedBy;for(let c=e.head;;){let h=n?r.childAfter(c):r.childBefore(c);if(!h)break;Ble(t,h,s)?r=h:c=n?h.to:h.from}let i=r.type.prop(s),a,o;return i&&(a=n?el(t,r.from,1):el(t,r.to,-1))&&a.matched?o=n?a.end.to:a.end.from:o=n?r.to:r.from,Ae.cursor(o,n?-1:1)}const qle=t=>Da(t,e=>ry(t.state,e,!Os(t))),Fle=t=>Da(t,e=>ry(t.state,e,Os(t)));function rq(t,e){return Da(t,n=>{if(!n.empty)return ny(n,e);let r=t.moveVertically(n,e);return r.head!=n.head?r:t.moveToLineBoundary(n,e)})}const sq=t=>rq(t,!1),iq=t=>rq(t,!0);function aq(t){let e=t.scrollDOM.clientHeighta.empty?t.moveVertically(a,e,n.height):ny(a,e));if(s.eq(r.selection))return!1;let i;if(n.selfScroll){let a=t.coordsAtPos(r.selection.main.head),o=t.scrollDOM.getBoundingClientRect(),c=o.top+n.marginTop,h=o.bottom-n.marginBottom;a&&a.top>c&&a.bottomlq(t,!1),zS=t=>lq(t,!0);function Ac(t,e,n){let r=t.lineBlockAt(e.head),s=t.moveToLineBoundary(e,n);if(s.head==e.head&&s.head!=(n?r.to:r.from)&&(s=t.moveToLineBoundary(e,n,!1)),!n&&s.head==r.from&&r.length){let i=/^\s*/.exec(t.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;i&&e.head!=r.from+i&&(s=Ae.cursor(r.from+i))}return s}const $le=t=>Da(t,e=>Ac(t,e,!0)),Qle=t=>Da(t,e=>Ac(t,e,!1)),Hle=t=>Da(t,e=>Ac(t,e,!Os(t))),Vle=t=>Da(t,e=>Ac(t,e,Os(t))),Ule=t=>Da(t,e=>Ae.cursor(t.lineBlockAt(e.head).from,1)),Wle=t=>Da(t,e=>Ae.cursor(t.lineBlockAt(e.head).to,-1));function Gle(t,e,n){let r=!1,s=$h(t.selection,i=>{let a=el(t,i.head,-1)||el(t,i.head,1)||i.head>0&&el(t,i.head-1,1)||i.headGle(t,e);function ha(t,e){let n=$h(t.state.selection,r=>{let s=e(r);return Ae.range(r.anchor,s.head,s.goalColumn,s.bidiLevel||void 0)});return n.eq(t.state.selection)?!1:(t.dispatch(Ra(t.state,n)),!0)}function oq(t,e){return ha(t,n=>t.moveByChar(n,e))}const cq=t=>oq(t,!Os(t)),uq=t=>oq(t,Os(t));function dq(t,e){return ha(t,n=>t.moveByGroup(n,e))}const Yle=t=>dq(t,!Os(t)),Kle=t=>dq(t,Os(t)),Zle=t=>ha(t,e=>ry(t.state,e,!Os(t))),Jle=t=>ha(t,e=>ry(t.state,e,Os(t)));function hq(t,e){return ha(t,n=>t.moveVertically(n,e))}const fq=t=>hq(t,!1),mq=t=>hq(t,!0);function pq(t,e){return ha(t,n=>t.moveVertically(n,e,aq(t).height))}const QT=t=>pq(t,!1),HT=t=>pq(t,!0),eoe=t=>ha(t,e=>Ac(t,e,!0)),toe=t=>ha(t,e=>Ac(t,e,!1)),noe=t=>ha(t,e=>Ac(t,e,!Os(t))),roe=t=>ha(t,e=>Ac(t,e,Os(t))),soe=t=>ha(t,e=>Ae.cursor(t.lineBlockAt(e.head).from)),ioe=t=>ha(t,e=>Ae.cursor(t.lineBlockAt(e.head).to)),VT=({state:t,dispatch:e})=>(e(Ra(t,{anchor:0})),!0),UT=({state:t,dispatch:e})=>(e(Ra(t,{anchor:t.doc.length})),!0),WT=({state:t,dispatch:e})=>(e(Ra(t,{anchor:t.selection.main.anchor,head:0})),!0),GT=({state:t,dispatch:e})=>(e(Ra(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0),aoe=({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0),loe=({state:t,dispatch:e})=>{let n=sy(t).map(({from:r,to:s})=>Ae.range(r,Math.min(s+1,t.doc.length)));return e(t.update({selection:Ae.create(n),userEvent:"select"})),!0},ooe=({state:t,dispatch:e})=>{let n=$h(t.selection,r=>{let s=ns(t),i=s.resolveStack(r.from,1);if(r.empty){let a=s.resolveStack(r.from,-1);a.node.from>=i.node.from&&a.node.to<=i.node.to&&(i=a)}for(let a=i;a;a=a.next){let{node:o}=a;if((o.from=r.to||o.to>r.to&&o.from<=r.from)&&a.next)return Ae.range(o.to,o.from)}return r});return n.eq(t.selection)?!1:(e(Ra(t,n)),!0)};function gq(t,e){let{state:n}=t,r=n.selection,s=n.selection.ranges.slice();for(let i of n.selection.ranges){let a=n.doc.lineAt(i.head);if(e?a.to0)for(let o=i;;){let c=t.moveVertically(o,e);if(c.heada.to){s.some(h=>h.head==c.head)||s.push(c);break}else{if(c.head==o.head)break;o=c}}}return s.length==r.ranges.length?!1:(t.dispatch(Ra(n,Ae.create(s,s.length-1))),!0)}const coe=t=>gq(t,!1),uoe=t=>gq(t,!0),doe=({state:t,dispatch:e})=>{let n=t.selection,r=null;return n.ranges.length>1?r=Ae.create([n.main]):n.main.empty||(r=Ae.create([Ae.cursor(n.main.head)])),r?(e(Ra(t,r)),!0):!1};function J0(t,e){if(t.state.readOnly)return!1;let n="delete.selection",{state:r}=t,s=r.changeByRange(i=>{let{from:a,to:o}=i;if(a==o){let c=e(i);ca&&(n="delete.forward",c=fx(t,c,!0)),a=Math.min(a,c),o=Math.max(o,c)}else a=fx(t,a,!1),o=fx(t,o,!0);return a==o?{range:i}:{changes:{from:a,to:o},range:Ae.cursor(a,as(t)))r.between(e,e,(s,i)=>{se&&(e=n?i:s)});return e}const xq=(t,e,n)=>J0(t,r=>{let s=r.from,{state:i}=t,a=i.doc.lineAt(s),o,c;if(n&&!e&&s>a.from&&sxq(t,!1,!0),vq=t=>xq(t,!0,!1),yq=(t,e)=>J0(t,n=>{let r=n.head,{state:s}=t,i=s.doc.lineAt(r),a=s.charCategorizer(r);for(let o=null;;){if(r==(e?i.to:i.from)){r==n.head&&i.number!=(e?s.doc.lines:1)&&(r+=e?1:-1);break}let c=ms(i.text,r-i.from,e)+i.from,h=i.text.slice(Math.min(r,c)-i.from,Math.max(r,c)-i.from),f=a(h);if(o!=null&&f!=o)break;(h!=" "||r!=n.head)&&(o=f),r=c}return r}),bq=t=>yq(t,!1),hoe=t=>yq(t,!0),foe=t=>J0(t,e=>{let n=t.lineBlockAt(e.head).to;return e.headJ0(t,e=>{let n=t.moveToLineBoundary(e,!1).head;return e.head>n?n:Math.max(0,e.head-1)}),poe=t=>J0(t,e=>{let n=t.moveToLineBoundary(e,!0).head;return e.head{if(t.readOnly)return!1;let n=t.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:cn.of(["",""])},range:Ae.cursor(r.from)}));return e(t.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},xoe=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=t.changeByRange(r=>{if(!r.empty||r.from==0||r.from==t.doc.length)return{range:r};let s=r.from,i=t.doc.lineAt(s),a=s==i.from?s-1:ms(i.text,s-i.from,!1)+i.from,o=s==i.to?s+1:ms(i.text,s-i.from,!0)+i.from;return{changes:{from:a,to:o,insert:t.doc.slice(s,o).append(t.doc.slice(a,s))},range:Ae.cursor(o)}});return n.changes.empty?!1:(e(t.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function sy(t){let e=[],n=-1;for(let r of t.selection.ranges){let s=t.doc.lineAt(r.from),i=t.doc.lineAt(r.to);if(!r.empty&&r.to==i.from&&(i=t.doc.lineAt(r.to-1)),n>=s.number){let a=e[e.length-1];a.to=i.to,a.ranges.push(r)}else e.push({from:s.from,to:i.to,ranges:[r]});n=i.number+1}return e}function wq(t,e,n){if(t.readOnly)return!1;let r=[],s=[];for(let i of sy(t)){if(n?i.to==t.doc.length:i.from==0)continue;let a=t.doc.lineAt(n?i.to+1:i.from-1),o=a.length+1;if(n){r.push({from:i.to,to:a.to},{from:i.from,insert:a.text+t.lineBreak});for(let c of i.ranges)s.push(Ae.range(Math.min(t.doc.length,c.anchor+o),Math.min(t.doc.length,c.head+o)))}else{r.push({from:a.from,to:i.from},{from:i.to,insert:t.lineBreak+a.text});for(let c of i.ranges)s.push(Ae.range(c.anchor-o,c.head-o))}}return r.length?(e(t.update({changes:r,scrollIntoView:!0,selection:Ae.create(s,t.selection.mainIndex),userEvent:"move.line"})),!0):!1}const voe=({state:t,dispatch:e})=>wq(t,e,!1),yoe=({state:t,dispatch:e})=>wq(t,e,!0);function Sq(t,e,n){if(t.readOnly)return!1;let r=[];for(let s of sy(t))n?r.push({from:s.from,insert:t.doc.slice(s.from,s.to)+t.lineBreak}):r.push({from:s.to,insert:t.lineBreak+t.doc.slice(s.from,s.to)});return e(t.update({changes:r,scrollIntoView:!0,userEvent:"input.copyline"})),!0}const boe=({state:t,dispatch:e})=>Sq(t,e,!1),woe=({state:t,dispatch:e})=>Sq(t,e,!0),Soe=t=>{if(t.state.readOnly)return!1;let{state:e}=t,n=e.changes(sy(e).map(({from:s,to:i})=>(s>0?s--:i{let i;if(t.lineWrapping){let a=t.lineBlockAt(s.head),o=t.coordsAtPos(s.head,s.assoc||1);o&&(i=a.bottom+t.documentTop-o.bottom+t.defaultLineHeight/2)}return t.moveVertically(s,!0,i)}).map(n);return t.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0};function koe(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let n=ns(t).resolveInner(e),r=n.childBefore(e),s=n.childAfter(e),i;return r&&s&&r.to<=e&&s.from>=e&&(i=r.type.prop(Ht.closedBy))&&i.indexOf(s.name)>-1&&t.doc.lineAt(r.to).from==t.doc.lineAt(s.from).from&&!/\S/.test(t.sliceDoc(r.to,s.from))?{from:r.to,to:s.from}:null}const XT=kq(!1),Ooe=kq(!0);function kq(t){return({state:e,dispatch:n})=>{if(e.readOnly)return!1;let r=e.changeByRange(s=>{let{from:i,to:a}=s,o=e.doc.lineAt(i),c=!t&&i==a&&koe(e,i);t&&(i=a=(a<=o.to?o:e.doc.lineAt(a)).to);let h=new Zv(e,{simulateBreak:i,simulateDoubleBreak:!!c}),f=q6(h,i);for(f==null&&(f=Fh(/^\s*/.exec(e.doc.lineAt(i).text)[0],e.tabSize));ao.from&&i{let s=[];for(let a=r.from;a<=r.to;){let o=t.doc.lineAt(a);o.number>n&&(r.empty||r.to>o.from)&&(e(o,s,r),n=o.number),a=o.to+1}let i=t.changes(s);return{changes:s,range:Ae.range(i.mapPos(r.anchor,1),i.mapPos(r.head,1))}})}const joe=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=Object.create(null),r=new Zv(t,{overrideIndentation:i=>{let a=n[i];return a??-1}}),s=G6(t,(i,a,o)=>{let c=q6(r,i.from);if(c==null)return;/\S/.test(i.text)||(c=0);let h=/^\s*/.exec(i.text)[0],f=n0(t,c);(h!=f||o.fromt.readOnly?!1:(e(t.update(G6(t,(n,r)=>{r.push({from:n.from,insert:t.facet(Y0)})}),{userEvent:"input.indent"})),!0),jq=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(G6(t,(n,r)=>{let s=/^\s*/.exec(n.text)[0];if(!s)return;let i=Fh(s,t.tabSize),a=0,o=n0(t,Math.max(0,i-Au(t)));for(;a(t.setTabFocusMode(),!0),Coe=[{key:"Ctrl-b",run:eq,shift:cq,preventDefault:!0},{key:"Ctrl-f",run:tq,shift:uq},{key:"Ctrl-p",run:sq,shift:fq},{key:"Ctrl-n",run:iq,shift:mq},{key:"Ctrl-a",run:Ule,shift:soe},{key:"Ctrl-e",run:Wle,shift:ioe},{key:"Ctrl-d",run:vq},{key:"Ctrl-h",run:PS},{key:"Ctrl-k",run:foe},{key:"Ctrl-Alt-h",run:bq},{key:"Ctrl-o",run:goe},{key:"Ctrl-t",run:xoe},{key:"Ctrl-v",run:zS}],Toe=[{key:"ArrowLeft",run:eq,shift:cq,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:Lle,shift:Yle,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:Hle,shift:noe,preventDefault:!0},{key:"ArrowRight",run:tq,shift:uq,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:Ile,shift:Kle,preventDefault:!0},{mac:"Cmd-ArrowRight",run:Vle,shift:roe,preventDefault:!0},{key:"ArrowUp",run:sq,shift:fq,preventDefault:!0},{mac:"Cmd-ArrowUp",run:VT,shift:WT},{mac:"Ctrl-ArrowUp",run:$T,shift:QT},{key:"ArrowDown",run:iq,shift:mq,preventDefault:!0},{mac:"Cmd-ArrowDown",run:UT,shift:GT},{mac:"Ctrl-ArrowDown",run:zS,shift:HT},{key:"PageUp",run:$T,shift:QT},{key:"PageDown",run:zS,shift:HT},{key:"Home",run:Qle,shift:toe,preventDefault:!0},{key:"Mod-Home",run:VT,shift:WT},{key:"End",run:$le,shift:eoe,preventDefault:!0},{key:"Mod-End",run:UT,shift:GT},{key:"Enter",run:XT,shift:XT},{key:"Mod-a",run:aoe},{key:"Backspace",run:PS,shift:PS,preventDefault:!0},{key:"Delete",run:vq,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:bq,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:hoe,preventDefault:!0},{mac:"Mod-Backspace",run:moe,preventDefault:!0},{mac:"Mod-Delete",run:poe,preventDefault:!0}].concat(Coe.map(t=>({mac:t.key,run:t.run,shift:t.shift}))),Eoe=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:qle,shift:Zle},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:Fle,shift:Jle},{key:"Alt-ArrowUp",run:voe},{key:"Shift-Alt-ArrowUp",run:boe},{key:"Alt-ArrowDown",run:yoe},{key:"Shift-Alt-ArrowDown",run:woe},{key:"Mod-Alt-ArrowUp",run:coe},{key:"Mod-Alt-ArrowDown",run:uoe},{key:"Escape",run:doe},{key:"Mod-Enter",run:Ooe},{key:"Alt-l",mac:"Ctrl-l",run:loe},{key:"Mod-i",run:ooe,preventDefault:!0},{key:"Mod-[",run:jq},{key:"Mod-]",run:Oq},{key:"Mod-Alt-\\",run:joe},{key:"Shift-Mod-k",run:Soe},{key:"Shift-Mod-\\",run:Xle},{key:"Mod-/",run:vle},{key:"Alt-A",run:ble},{key:"Ctrl-m",mac:"Shift-Alt-m",run:Noe}].concat(Toe),_oe={key:"Tab",run:Oq,shift:jq},YT=typeof String.prototype.normalize=="function"?t=>t.normalize("NFKD"):t=>t;class jh{constructor(e,n,r=0,s=e.length,i,a){this.test=a,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(r,s),this.bufferStart=r,this.normalize=i?o=>i(YT(o)):YT,this.query=this.normalize(n)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return Ks(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let n=b6(e),r=this.bufferStart+this.bufferPos;this.bufferPos+=Xa(e);let s=this.normalize(n);if(s.length)for(let i=0,a=r;;i++){let o=s.charCodeAt(i),c=this.match(o,a,this.bufferPos+this.bufferStart);if(i==s.length-1){if(c)return this.value=c,this;break}a==r&&ithis.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let n=this.matchPos<=this.to&&this.re.exec(this.curLine);if(n){let r=this.curLineStart+n.index,s=r+n[0].length;if(this.matchPos=V1(this.text,s+(r==s?1:0)),r==this.curLineStart+this.curLine.length&&this.nextLine(),(rthis.value.to)&&(!this.test||this.test(r,s,n)))return this.value={from:r,to:s,match:n},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length=r||s.to<=n){let o=new rh(n,e.sliceString(n,r));return Aw.set(e,o),o}if(s.from==n&&s.to==r)return s;let{text:i,from:a}=s;return a>n&&(i=e.sliceString(n,a)+i,a=n),s.to=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,n=this.re.exec(this.flat.text);if(n&&!n[0]&&n.index==e&&(this.re.lastIndex=e+1,n=this.re.exec(this.flat.text)),n){let r=this.flat.from+n.index,s=r+n[0].length;if((this.flat.to>=this.to||n.index+n[0].length<=this.flat.text.length-10)&&(!this.test||this.test(r,s,n)))return this.value={from:r,to:s,match:n},this.matchPos=V1(this.text,s+(r==s?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=rh.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(Cq.prototype[Symbol.iterator]=Tq.prototype[Symbol.iterator]=function(){return this});function Moe(t){try{return new RegExp(t,X6),!0}catch{return!1}}function V1(t,e){if(e>=t.length)return e;let n=t.lineAt(e),r;for(;e=56320&&r<57344;)e++;return e}function LS(t){let e=String(t.state.doc.lineAt(t.state.selection.main.head).number),n=$n("input",{class:"cm-textfield",name:"line",value:e}),r=$n("form",{class:"cm-gotoLine",onkeydown:i=>{i.keyCode==27?(i.preventDefault(),t.dispatch({effects:Am.of(!1)}),t.focus()):i.keyCode==13&&(i.preventDefault(),s())},onsubmit:i=>{i.preventDefault(),s()}},$n("label",t.state.phrase("Go to line"),": ",n)," ",$n("button",{class:"cm-button",type:"submit"},t.state.phrase("go")),$n("button",{name:"close",onclick:()=>{t.dispatch({effects:Am.of(!1)}),t.focus()},"aria-label":t.state.phrase("close"),type:"button"},["×"]));function s(){let i=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(n.value);if(!i)return;let{state:a}=t,o=a.doc.lineAt(a.selection.main.head),[,c,h,f,m]=i,g=f?+f.slice(1):0,x=h?+h:o.number;if(h&&m){let S=x/100;c&&(S=S*(c=="-"?-1:1)+o.number/a.doc.lines),x=Math.round(a.doc.lines*S)}else h&&c&&(x=x*(c=="-"?-1:1)+o.number);let y=a.doc.line(Math.max(1,Math.min(a.doc.lines,x))),w=Ae.cursor(y.from+Math.max(0,Math.min(g,y.length)));t.dispatch({effects:[Am.of(!1),We.scrollIntoView(w.from,{y:"center"})],selection:w}),t.focus()}return{dom:r}}const Am=Mt.define(),KT=is.define({create(){return!0},update(t,e){for(let n of e.effects)n.is(Am)&&(t=n.value);return t},provide:t=>Zm.from(t,e=>e?LS:null)}),Aoe=t=>{let e=Km(t,LS);if(!e){let n=[Am.of(!0)];t.state.field(KT,!1)==null&&n.push(Mt.appendConfig.of([KT,Roe])),t.dispatch({effects:n}),e=Km(t,LS)}return e&&e.dom.querySelector("input").select(),!0},Roe=We.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px",position:"relative","& label":{fontSize:"80%"},"& [name=close]":{position:"absolute",top:"0",bottom:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:"0"}}}),Doe={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},zoe=et.define({combine(t){return fl(t,Doe,{highlightWordAroundCursor:(e,n)=>e||n,minSelectionLength:Math.min,maxMatches:Math.min})}});function Poe(t){return[Foe,qoe]}const Loe=ft.mark({class:"cm-selectionMatch"}),Ioe=ft.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function ZT(t,e,n,r){return(n==0||t(e.sliceDoc(n-1,n))!=nr.Word)&&(r==e.doc.length||t(e.sliceDoc(r,r+1))!=nr.Word)}function Boe(t,e,n,r){return t(e.sliceDoc(n,n+1))==nr.Word&&t(e.sliceDoc(r-1,r))==nr.Word}const qoe=Nr.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.selectionSet||t.docChanged||t.viewportChanged)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=t.state.facet(zoe),{state:n}=t,r=n.selection;if(r.ranges.length>1)return ft.none;let s=r.main,i,a=null;if(s.empty){if(!e.highlightWordAroundCursor)return ft.none;let c=n.wordAt(s.head);if(!c)return ft.none;a=n.charCategorizer(s.head),i=n.sliceDoc(c.from,c.to)}else{let c=s.to-s.from;if(c200)return ft.none;if(e.wholeWords){if(i=n.sliceDoc(s.from,s.to),a=n.charCategorizer(s.head),!(ZT(a,n,s.from,s.to)&&Boe(a,n,s.from,s.to)))return ft.none}else if(i=n.sliceDoc(s.from,s.to),!i)return ft.none}let o=[];for(let c of t.visibleRanges){let h=new jh(n.doc,i,c.from,c.to);for(;!h.next().done;){let{from:f,to:m}=h.value;if((!a||ZT(a,n,f,m))&&(s.empty&&f<=s.from&&m>=s.to?o.push(Ioe.range(f,m)):(f>=s.to||m<=s.from)&&o.push(Loe.range(f,m)),o.length>e.maxMatches))return ft.none}}return ft.set(o)}},{decorations:t=>t.decorations}),Foe=We.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),$oe=({state:t,dispatch:e})=>{let{selection:n}=t,r=Ae.create(n.ranges.map(s=>t.wordAt(s.head)||Ae.cursor(s.head)),n.mainIndex);return r.eq(n)?!1:(e(t.update({selection:r})),!0)};function Qoe(t,e){let{main:n,ranges:r}=t.selection,s=t.wordAt(n.head),i=s&&s.from==n.from&&s.to==n.to;for(let a=!1,o=new jh(t.doc,e,r[r.length-1].to);;)if(o.next(),o.done){if(a)return null;o=new jh(t.doc,e,0,Math.max(0,r[r.length-1].from-1)),a=!0}else{if(a&&r.some(c=>c.from==o.value.from))continue;if(i){let c=t.wordAt(o.value.from);if(!c||c.from!=o.value.from||c.to!=o.value.to)continue}return o.value}}const Hoe=({state:t,dispatch:e})=>{let{ranges:n}=t.selection;if(n.some(i=>i.from===i.to))return $oe({state:t,dispatch:e});let r=t.sliceDoc(n[0].from,n[0].to);if(t.selection.ranges.some(i=>t.sliceDoc(i.from,i.to)!=r))return!1;let s=Qoe(t,r);return s?(e(t.update({selection:t.selection.addRange(Ae.range(s.from,s.to),!1),effects:We.scrollIntoView(s.to)})),!0):!1},Qh=et.define({combine(t){return fl(t,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new nce(e),scrollToMatch:e=>We.scrollIntoView(e)})}});class Eq{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||Moe(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(n,r)=>r=="n"?` -`:r=="r"?"\r":r=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord}create(){return this.regexp?new Goe(this):new Uoe(this)}getCursor(e,n=0,r){let s=e.doc?e:an.create({doc:e});return r==null&&(r=s.doc.length),this.regexp?qd(this,s,n,r):Bd(this,s,n,r)}}class _q{constructor(e){this.spec=e}}function Bd(t,e,n,r){return new jh(e.doc,t.unquoted,n,r,t.caseSensitive?void 0:s=>s.toLowerCase(),t.wholeWord?Voe(e.doc,e.charCategorizer(e.selection.main.head)):void 0)}function Voe(t,e){return(n,r,s,i)=>((i>n||i+s.length=n)return null;s.push(r.value)}return s}highlight(e,n,r,s){let i=Bd(this.spec,e,Math.max(0,n-this.spec.unquoted.length),Math.min(r+this.spec.unquoted.length,e.doc.length));for(;!i.next().done;)s(i.value.from,i.value.to)}}function qd(t,e,n,r){return new Cq(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:t.wholeWord?Woe(e.charCategorizer(e.selection.main.head)):void 0},n,r)}function U1(t,e){return t.slice(ms(t,e,!1),e)}function W1(t,e){return t.slice(e,ms(t,e))}function Woe(t){return(e,n,r)=>!r[0].length||(t(U1(r.input,r.index))!=nr.Word||t(W1(r.input,r.index))!=nr.Word)&&(t(W1(r.input,r.index+r[0].length))!=nr.Word||t(U1(r.input,r.index+r[0].length))!=nr.Word)}class Goe extends _q{nextMatch(e,n,r){let s=qd(this.spec,e,r,e.doc.length).next();return s.done&&(s=qd(this.spec,e,0,n).next()),s.done?null:s.value}prevMatchInRange(e,n,r){for(let s=1;;s++){let i=Math.max(n,r-s*1e4),a=qd(this.spec,e,i,r),o=null;for(;!a.next().done;)o=a.value;if(o&&(i==n||o.from>i+10))return o;if(i==n)return null}}prevMatch(e,n,r){return this.prevMatchInRange(e,0,n)||this.prevMatchInRange(e,r,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(n,r)=>{if(r=="&")return e.match[0];if(r=="$")return"$";for(let s=r.length;s>0;s--){let i=+r.slice(0,s);if(i>0&&i=n)return null;s.push(r.value)}return s}highlight(e,n,r,s){let i=qd(this.spec,e,Math.max(0,n-250),Math.min(r+250,e.doc.length));for(;!i.next().done;)s(i.value.from,i.value.to)}}const s0=Mt.define(),Y6=Mt.define(),mc=is.define({create(t){return new Rw(IS(t).create(),null)},update(t,e){for(let n of e.effects)n.is(s0)?t=new Rw(n.value.create(),t.panel):n.is(Y6)&&(t=new Rw(t.query,n.value?K6:null));return t},provide:t=>Zm.from(t,e=>e.panel)});class Rw{constructor(e,n){this.query=e,this.panel=n}}const Xoe=ft.mark({class:"cm-searchMatch"}),Yoe=ft.mark({class:"cm-searchMatch cm-searchMatch-selected"}),Koe=Nr.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(mc))}update(t){let e=t.state.field(mc);(e!=t.startState.field(mc)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return ft.none;let{view:n}=this,r=new fo;for(let s=0,i=n.visibleRanges,a=i.length;si[s+1].from-500;)c=i[++s].to;t.highlight(n.state,o,c,(h,f)=>{let m=n.state.selection.ranges.some(g=>g.from==h&&g.to==f);r.add(h,f,m?Yoe:Xoe)})}return r.finish()}},{decorations:t=>t.decorations});function ep(t){return e=>{let n=e.state.field(mc,!1);return n&&n.query.spec.valid?t(e,n):Rq(e)}}const G1=ep((t,{query:e})=>{let{to:n}=t.state.selection.main,r=e.nextMatch(t.state,n,n);if(!r)return!1;let s=Ae.single(r.from,r.to),i=t.state.facet(Qh);return t.dispatch({selection:s,effects:[Z6(t,r),i.scrollToMatch(s.main,t)],userEvent:"select.search"}),Aq(t),!0}),X1=ep((t,{query:e})=>{let{state:n}=t,{from:r}=n.selection.main,s=e.prevMatch(n,r,r);if(!s)return!1;let i=Ae.single(s.from,s.to),a=t.state.facet(Qh);return t.dispatch({selection:i,effects:[Z6(t,s),a.scrollToMatch(i.main,t)],userEvent:"select.search"}),Aq(t),!0}),Zoe=ep((t,{query:e})=>{let n=e.matchAll(t.state,1e3);return!n||!n.length?!1:(t.dispatch({selection:Ae.create(n.map(r=>Ae.range(r.from,r.to))),userEvent:"select.search.matches"}),!0)}),Joe=({state:t,dispatch:e})=>{let n=t.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:s}=n.main,i=[],a=0;for(let o=new jh(t.doc,t.sliceDoc(r,s));!o.next().done;){if(i.length>1e3)return!1;o.value.from==r&&(a=i.length),i.push(Ae.range(o.value.from,o.value.to))}return e(t.update({selection:Ae.create(i,a),userEvent:"select.search.matches"})),!0},JT=ep((t,{query:e})=>{let{state:n}=t,{from:r,to:s}=n.selection.main;if(n.readOnly)return!1;let i=e.nextMatch(n,r,r);if(!i)return!1;let a=i,o=[],c,h,f=[];a.from==r&&a.to==s&&(h=n.toText(e.getReplacement(a)),o.push({from:a.from,to:a.to,insert:h}),a=e.nextMatch(n,a.from,a.to),f.push(We.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(r).number)+".")));let m=t.state.changes(o);return a&&(c=Ae.single(a.from,a.to).map(m),f.push(Z6(t,a)),f.push(n.facet(Qh).scrollToMatch(c.main,t))),t.dispatch({changes:m,selection:c,effects:f,userEvent:"input.replace"}),!0}),ece=ep((t,{query:e})=>{if(t.state.readOnly)return!1;let n=e.matchAll(t.state,1e9).map(s=>{let{from:i,to:a}=s;return{from:i,to:a,insert:e.getReplacement(s)}});if(!n.length)return!1;let r=t.state.phrase("replaced $ matches",n.length)+".";return t.dispatch({changes:n,effects:We.announce.of(r),userEvent:"input.replace.all"}),!0});function K6(t){return t.state.facet(Qh).createPanel(t)}function IS(t,e){var n,r,s,i,a;let o=t.selection.main,c=o.empty||o.to>o.from+100?"":t.sliceDoc(o.from,o.to);if(e&&!c)return e;let h=t.facet(Qh);return new Eq({search:((n=e?.literal)!==null&&n!==void 0?n:h.literal)?c:c.replace(/\n/g,"\\n"),caseSensitive:(r=e?.caseSensitive)!==null&&r!==void 0?r:h.caseSensitive,literal:(s=e?.literal)!==null&&s!==void 0?s:h.literal,regexp:(i=e?.regexp)!==null&&i!==void 0?i:h.regexp,wholeWord:(a=e?.wholeWord)!==null&&a!==void 0?a:h.wholeWord})}function Mq(t){let e=Km(t,K6);return e&&e.dom.querySelector("[main-field]")}function Aq(t){let e=Mq(t);e&&e==t.root.activeElement&&e.select()}const Rq=t=>{let e=t.state.field(mc,!1);if(e&&e.panel){let n=Mq(t);if(n&&n!=t.root.activeElement){let r=IS(t.state,e.query.spec);r.valid&&t.dispatch({effects:s0.of(r)}),n.focus(),n.select()}}else t.dispatch({effects:[Y6.of(!0),e?s0.of(IS(t.state,e.query.spec)):Mt.appendConfig.of(sce)]});return!0},Dq=t=>{let e=t.state.field(mc,!1);if(!e||!e.panel)return!1;let n=Km(t,K6);return n&&n.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:Y6.of(!1)}),!0},tce=[{key:"Mod-f",run:Rq,scope:"editor search-panel"},{key:"F3",run:G1,shift:X1,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:G1,shift:X1,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:Dq,scope:"editor search-panel"},{key:"Mod-Shift-l",run:Joe},{key:"Mod-Alt-g",run:Aoe},{key:"Mod-d",run:Hoe,preventDefault:!0}];class nce{constructor(e){this.view=e;let n=this.query=e.state.field(mc).query.spec;this.commit=this.commit.bind(this),this.searchField=$n("input",{value:n.search,placeholder:wi(e,"Find"),"aria-label":wi(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=$n("input",{value:n.replace,placeholder:wi(e,"Replace"),"aria-label":wi(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=$n("input",{type:"checkbox",name:"case",form:"",checked:n.caseSensitive,onchange:this.commit}),this.reField=$n("input",{type:"checkbox",name:"re",form:"",checked:n.regexp,onchange:this.commit}),this.wordField=$n("input",{type:"checkbox",name:"word",form:"",checked:n.wholeWord,onchange:this.commit});function r(s,i,a){return $n("button",{class:"cm-button",name:s,onclick:i,type:"button"},a)}this.dom=$n("div",{onkeydown:s=>this.keydown(s),class:"cm-search"},[this.searchField,r("next",()=>G1(e),[wi(e,"next")]),r("prev",()=>X1(e),[wi(e,"previous")]),r("select",()=>Zoe(e),[wi(e,"all")]),$n("label",null,[this.caseField,wi(e,"match case")]),$n("label",null,[this.reField,wi(e,"regexp")]),$n("label",null,[this.wordField,wi(e,"by word")]),...e.state.readOnly?[]:[$n("br"),this.replaceField,r("replace",()=>JT(e),[wi(e,"replace")]),r("replaceAll",()=>ece(e),[wi(e,"replace all")])],$n("button",{name:"close",onclick:()=>Dq(e),"aria-label":wi(e,"close"),type:"button"},["×"])])}commit(){let e=new Eq({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:s0.of(e)}))}keydown(e){lie(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?X1:G1)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),JT(this.view))}update(e){for(let n of e.transactions)for(let r of n.effects)r.is(s0)&&!r.value.eq(this.query)&&this.setQuery(r.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(Qh).top}}function wi(t,e){return t.state.phrase(e)}const mx=30,px=/[\s\.,:;?!]/;function Z6(t,{from:e,to:n}){let r=t.state.doc.lineAt(e),s=t.state.doc.lineAt(n).to,i=Math.max(r.from,e-mx),a=Math.min(s,n+mx),o=t.state.sliceDoc(i,a);if(i!=r.from){for(let c=0;co.length-mx;c--)if(!px.test(o[c-1])&&px.test(o[c])){o=o.slice(0,c);break}}return We.announce.of(`${t.state.phrase("current match")}. ${o} ${t.state.phrase("on line")} ${r.number}.`)}const rce=We.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),sce=[mc,Mc.low(Koe),rce];class zq{constructor(e,n,r,s){this.state=e,this.pos=n,this.explicit=r,this.view=s,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let n=ns(this.state).resolveInner(this.pos,-1);for(;n&&e.indexOf(n.name)<0;)n=n.parent;return n?{from:n.from,to:this.pos,text:this.state.sliceDoc(n.from,this.pos),type:n.type}:null}matchBefore(e){let n=this.state.doc.lineAt(this.pos),r=Math.max(n.from,this.pos-250),s=n.text.slice(r-n.from,this.pos-n.from),i=s.search(Lq(e,!1));return i<0?null:{from:r+i,to:this.pos,text:s.slice(i)}}get aborted(){return this.abortListeners==null}addEventListener(e,n,r){e=="abort"&&this.abortListeners&&(this.abortListeners.push(n),r&&r.onDocChange&&(this.abortOnDocChange=!0))}}function eE(t){let e=Object.keys(t).join(""),n=/\w/.test(e);return n&&(e=e.replace(/\w/g,"")),`[${n?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function ice(t){let e=Object.create(null),n=Object.create(null);for(let{label:s}of t){e[s[0]]=!0;for(let i=1;itypeof s=="string"?{label:s}:s),[n,r]=e.every(s=>/^\w+$/.test(s.label))?[/\w*$/,/\w+$/]:ice(e);return s=>{let i=s.matchBefore(r);return i||s.explicit?{from:i?i.from:s.pos,options:e,validFor:n}:null}}function ace(t,e){return n=>{for(let r=ns(n.state).resolveInner(n.pos,-1);r;r=r.parent){if(t.indexOf(r.name)>-1)return null;if(r.type.isTop)break}return e(n)}}let tE=class{constructor(e,n,r,s){this.completion=e,this.source=n,this.match=r,this.score=s}};function ku(t){return t.selection.main.from}function Lq(t,e){var n;let{source:r}=t,s=e&&r[0]!="^",i=r[r.length-1]!="$";return!s&&!i?t:new RegExp(`${s?"^":""}(?:${r})${i?"$":""}`,(n=t.flags)!==null&&n!==void 0?n:t.ignoreCase?"i":"")}const J6=hl.define();function lce(t,e,n,r){let{main:s}=t.selection,i=n-s.from,a=r-s.from;return{...t.changeByRange(o=>{if(o!=s&&n!=r&&t.sliceDoc(o.from+i,o.from+a)!=t.sliceDoc(n,r))return{range:o};let c=t.toText(e);return{changes:{from:o.from+i,to:r==s.from?o.to:o.from+a,insert:c},range:Ae.cursor(o.from+i+c.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const nE=new WeakMap;function oce(t){if(!Array.isArray(t))return t;let e=nE.get(t);return e||nE.set(t,e=Pq(t)),e}const Y1=Mt.define(),i0=Mt.define();class cce{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let n=0;n=48&&_<=57||_>=97&&_<=122?2:_>=65&&_<=90?1:0:(E=b6(_))!=E.toLowerCase()?1:E!=E.toUpperCase()?2:0;(!N||M==1&&S||T==0&&M!=0)&&(n[m]==_||r[m]==_&&(g=!0)?a[m++]=N:a.length&&(k=!1)),T=M,N+=Xa(_)}return m==c&&a[0]==0&&k?this.result(-100+(g?-200:0),a,e):x==c&&y==0?this.ret(-200-e.length+(w==e.length?0:-100),[0,w]):o>-1?this.ret(-700-e.length,[o,o+this.pattern.length]):x==c?this.ret(-900-e.length,[y,w]):m==c?this.result(-100+(g?-200:0)+-700+(k?0:-1100),a,e):n.length==2?null:this.result((s[0]?-700:0)+-200+-1100,s,e)}result(e,n,r){let s=[],i=0;for(let a of n){let o=a+(this.astral?Xa(Ks(r,a)):1);i&&s[i-1]==a?s[i-1]=o:(s[i++]=a,s[i++]=o)}return this.ret(e-r.length,s)}}class uce{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:dce,filterStrict:!1,compareCompletions:(e,n)=>e.label.localeCompare(n.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,n)=>e&&n,closeOnBlur:(e,n)=>e&&n,icons:(e,n)=>e&&n,tooltipClass:(e,n)=>r=>rE(e(r),n(r)),optionClass:(e,n)=>r=>rE(e(r),n(r)),addToOptions:(e,n)=>e.concat(n),filterStrict:(e,n)=>e||n})}});function rE(t,e){return t?e?t+" "+e:t:e}function dce(t,e,n,r,s,i){let a=t.textDirection==Jn.RTL,o=a,c=!1,h="top",f,m,g=e.left-s.left,x=s.right-e.right,y=r.right-r.left,w=r.bottom-r.top;if(o&&g=w||N>e.top?f=n.bottom-e.top:(h="bottom",f=e.bottom-n.top)}let S=(e.bottom-e.top)/i.offsetHeight,k=(e.right-e.left)/i.offsetWidth;return{style:`${h}: ${f/S}px; max-width: ${m/k}px`,class:"cm-completionInfo-"+(c?a?"left-narrow":"right-narrow":o?"left":"right")}}function hce(t){let e=t.addToOptions.slice();return t.icons&&e.push({render(n){let r=document.createElement("div");return r.classList.add("cm-completionIcon"),n.type&&r.classList.add(...n.type.split(/\s+/g).map(s=>"cm-completionIcon-"+s)),r.setAttribute("aria-hidden","true"),r},position:20}),e.push({render(n,r,s,i){let a=document.createElement("span");a.className="cm-completionLabel";let o=n.displayLabel||n.label,c=0;for(let h=0;hc&&a.appendChild(document.createTextNode(o.slice(c,f)));let g=a.appendChild(document.createElement("span"));g.appendChild(document.createTextNode(o.slice(f,m))),g.className="cm-completionMatchedText",c=m}return cn.position-r.position).map(n=>n.render)}function Dw(t,e,n){if(t<=n)return{from:0,to:t};if(e<0&&(e=0),e<=t>>1){let s=Math.floor(e/n);return{from:s*n,to:(s+1)*n}}let r=Math.floor((t-e)/n);return{from:t-(r+1)*n,to:t-r*n}}class fce{constructor(e,n,r){this.view=e,this.stateField=n,this.applyCompletion=r,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:c=>this.placeInfo(c),key:this},this.space=null,this.currentClass="";let s=e.state.field(n),{options:i,selected:a}=s.open,o=e.state.facet(es);this.optionContent=hce(o),this.optionClass=o.optionClass,this.tooltipClass=o.tooltipClass,this.range=Dw(i.length,a,o.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",c=>{let{options:h}=e.state.field(n).open;for(let f=c.target,m;f&&f!=this.dom;f=f.parentNode)if(f.nodeName=="LI"&&(m=/-(\d+)$/.exec(f.id))&&+m[1]{let h=e.state.field(this.stateField,!1);h&&h.tooltip&&e.state.facet(es).closeOnBlur&&c.relatedTarget!=e.contentDOM&&e.dispatch({effects:i0.of(null)})}),this.showOptions(i,s.id)}mount(){this.updateSel()}showOptions(e,n){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,n,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var n;let r=e.state.field(this.stateField),s=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),r!=s){let{options:i,selected:a,disabled:o}=r.open;(!s.open||s.open.options!=i)&&(this.range=Dw(i.length,a,e.state.facet(es).maxRenderedOptions),this.showOptions(i,r.id)),this.updateSel(),o!=((n=s.open)===null||n===void 0?void 0:n.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!o)}}updateTooltipClass(e){let n=this.tooltipClass(e);if(n!=this.currentClass){for(let r of this.currentClass.split(" "))r&&this.dom.classList.remove(r);for(let r of n.split(" "))r&&this.dom.classList.add(r);this.currentClass=n}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),n=e.open;(n.selected>-1&&n.selected=this.range.to)&&(this.range=Dw(n.options.length,n.selected,this.view.state.facet(es).maxRenderedOptions),this.showOptions(n.options,e.id));let r=this.updateSelectedOption(n.selected);if(r){this.destroyInfo();let{completion:s}=n.options[n.selected],{info:i}=s;if(!i)return;let a=typeof i=="string"?document.createTextNode(i):i(s);if(!a)return;"then"in a?a.then(o=>{o&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(o,s)}).catch(o=>Js(this.view.state,o,"completion info")):(this.addInfoPane(a,s),r.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,n){this.destroyInfo();let r=this.info=document.createElement("div");if(r.className="cm-tooltip cm-completionInfo",r.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)r.appendChild(e),this.infoDestroy=null;else{let{dom:s,destroy:i}=e;r.appendChild(s),this.infoDestroy=i||null}this.dom.appendChild(r),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let n=null;for(let r=this.list.firstChild,s=this.range.from;r;r=r.nextSibling,s++)r.nodeName!="LI"||!r.id?s--:s==e?r.hasAttribute("aria-selected")||(r.setAttribute("aria-selected","true"),n=r):r.hasAttribute("aria-selected")&&(r.removeAttribute("aria-selected"),r.removeAttribute("aria-describedby"));return n&&pce(this.list,n),n}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let n=this.dom.getBoundingClientRect(),r=this.info.getBoundingClientRect(),s=e.getBoundingClientRect(),i=this.space;if(!i){let a=this.dom.ownerDocument.documentElement;i={left:0,top:0,right:a.clientWidth,bottom:a.clientHeight}}return s.top>Math.min(i.bottom,n.bottom)-10||s.bottom{a.target==s&&a.preventDefault()});let i=null;for(let a=r.from;ar.from||r.from==0))if(i=g,typeof h!="string"&&h.header)s.appendChild(h.header(h));else{let x=s.appendChild(document.createElement("completion-section"));x.textContent=g}}const f=s.appendChild(document.createElement("li"));f.id=n+"-"+a,f.setAttribute("role","option");let m=this.optionClass(o);m&&(f.className=m);for(let g of this.optionContent){let x=g(o,this.view.state,this.view,c);x&&f.appendChild(x)}}return r.from&&s.classList.add("cm-completionListIncompleteTop"),r.tonew fce(n,t,e)}function pce(t,e){let n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),s=n.height/t.offsetHeight;r.topn.bottom&&(t.scrollTop+=(r.bottom-n.bottom)/s)}function sE(t){return(t.boost||0)*100+(t.apply?10:0)+(t.info?5:0)+(t.type?1:0)}function gce(t,e){let n=[],r=null,s=null,i=f=>{n.push(f);let{section:m}=f.completion;if(m){r||(r=[]);let g=typeof m=="string"?m:m.name;r.some(x=>x.name==g)||r.push(typeof m=="string"?{name:g}:m)}},a=e.facet(es);for(let f of t)if(f.hasResult()){let m=f.result.getMatch;if(f.result.filter===!1)for(let g of f.result.options)i(new tE(g,f.source,m?m(g):[],1e9-n.length));else{let g=e.sliceDoc(f.from,f.to),x,y=a.filterStrict?new uce(g):new cce(g);for(let w of f.result.options)if(x=y.match(w.label)){let S=w.displayLabel?m?m(w,x.matched):[]:x.matched,k=x.score+(w.boost||0);if(i(new tE(w,f.source,S,k)),typeof w.section=="object"&&w.section.rank==="dynamic"){let{name:N}=w.section;s||(s=Object.create(null)),s[N]=Math.max(k,s[N]||-1e9)}}}}if(r){let f=Object.create(null),m=0,g=(x,y)=>(x.rank==="dynamic"&&y.rank==="dynamic"?s[y.name]-s[x.name]:0)||(typeof x.rank=="number"?x.rank:1e9)-(typeof y.rank=="number"?y.rank:1e9)||(x.nameg.score-m.score||h(m.completion,g.completion))){let m=f.completion;!c||c.label!=m.label||c.detail!=m.detail||c.type!=null&&m.type!=null&&c.type!=m.type||c.apply!=m.apply||c.boost!=m.boost?o.push(f):sE(f.completion)>sE(c)&&(o[o.length-1]=f),c=f.completion}return o}class Gd{constructor(e,n,r,s,i,a){this.options=e,this.attrs=n,this.tooltip=r,this.timestamp=s,this.selected=i,this.disabled=a}setSelected(e,n){return e==this.selected||e>=this.options.length?this:new Gd(this.options,iE(n,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,n,r,s,i,a){if(s&&!a&&e.some(h=>h.isPending))return s.setDisabled();let o=gce(e,n);if(!o.length)return s&&e.some(h=>h.isPending)?s.setDisabled():null;let c=n.facet(es).selectOnOpen?0:-1;if(s&&s.selected!=c&&s.selected!=-1){let h=s.options[s.selected].completion;for(let f=0;ff.hasResult()?Math.min(h,f.from):h,1e8),create:Sce,above:i.aboveCursor},s?s.timestamp:Date.now(),c,!1)}map(e){return new Gd(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new Gd(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class K1{constructor(e,n,r){this.active=e,this.id=n,this.open=r}static start(){return new K1(bce,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:n}=e,r=n.facet(es),i=(r.override||n.languageDataAt("autocomplete",ku(n)).map(oce)).map(c=>(this.active.find(f=>f.source==c)||new Ji(c,this.active.some(f=>f.state!=0)?1:0)).update(e,r));i.length==this.active.length&&i.every((c,h)=>c==this.active[h])&&(i=this.active);let a=this.open,o=e.effects.some(c=>c.is(eO));a&&e.docChanged&&(a=a.map(e.changes)),e.selection||i.some(c=>c.hasResult()&&e.changes.touchesRange(c.from,c.to))||!xce(i,this.active)||o?a=Gd.build(i,n,this.id,a,r,o):a&&a.disabled&&!i.some(c=>c.isPending)&&(a=null),!a&&i.every(c=>!c.isPending)&&i.some(c=>c.hasResult())&&(i=i.map(c=>c.hasResult()?new Ji(c.source,0):c));for(let c of e.effects)c.is(Bq)&&(a=a&&a.setSelected(c.value,this.id));return i==this.active&&a==this.open?this:new K1(i,this.id,a)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?vce:yce}}function xce(t,e){if(t==e)return!0;for(let n=0,r=0;;){for(;n-1&&(n["aria-activedescendant"]=t+"-"+e),n}const bce=[];function Iq(t,e){if(t.isUserEvent("input.complete")){let r=t.annotation(J6);if(r&&e.activateOnCompletion(r))return 12}let n=t.isUserEvent("input.type");return n&&e.activateOnTyping?5:n?1:t.isUserEvent("delete.backward")?2:t.selection?8:t.docChanged?16:0}class Ji{constructor(e,n,r=!1){this.source=e,this.state=n,this.explicit=r}hasResult(){return!1}get isPending(){return this.state==1}update(e,n){let r=Iq(e,n),s=this;(r&8||r&16&&this.touches(e))&&(s=new Ji(s.source,0)),r&4&&s.state==0&&(s=new Ji(this.source,1)),s=s.updateFor(e,r);for(let i of e.effects)if(i.is(Y1))s=new Ji(s.source,1,i.value);else if(i.is(i0))s=new Ji(s.source,0);else if(i.is(eO))for(let a of i.value)a.source==s.source&&(s=a);return s}updateFor(e,n){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(ku(e.state))}}class sh extends Ji{constructor(e,n,r,s,i,a){super(e,3,n),this.limit=r,this.result=s,this.from=i,this.to=a}hasResult(){return!0}updateFor(e,n){var r;if(!(n&3))return this.map(e.changes);let s=this.result;s.map&&!e.changes.empty&&(s=s.map(s,e.changes));let i=e.changes.mapPos(this.from),a=e.changes.mapPos(this.to,1),o=ku(e.state);if(o>a||!s||n&2&&(ku(e.startState)==this.from||on.map(e))}}),Bq=Mt.define(),Zs=is.define({create(){return K1.start()},update(t,e){return t.update(e)},provide:t=>[D6.from(t,e=>e.tooltip),We.contentAttributes.from(t,e=>e.attrs)]});function tO(t,e){const n=e.completion.apply||e.completion.label;let r=t.state.field(Zs).active.find(s=>s.source==e.source);return r instanceof sh?(typeof n=="string"?t.dispatch({...lce(t.state,n,r.from,r.to),annotations:J6.of(e.completion)}):n(t,e.completion,r.from,r.to),!0):!1}const Sce=mce(Zs,tO);function gx(t,e="option"){return n=>{let r=n.state.field(Zs,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp-1?r.open.selected+s*(t?1:-1):t?0:a-1;return o<0?o=e=="page"?0:a-1:o>=a&&(o=e=="page"?a-1:0),n.dispatch({effects:Bq.of(o)}),!0}}const kce=t=>{let e=t.state.field(Zs,!1);return t.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestampt.state.field(Zs,!1)?(t.dispatch({effects:Y1.of(!0)}),!0):!1,Oce=t=>{let e=t.state.field(Zs,!1);return!e||!e.active.some(n=>n.state!=0)?!1:(t.dispatch({effects:i0.of(null)}),!0)};class jce{constructor(e,n){this.active=e,this.context=n,this.time=Date.now(),this.updates=[],this.done=void 0}}const Nce=50,Cce=1e3,Tce=Nr.fromClass(class{constructor(t){this.view=t,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of t.state.field(Zs).active)e.isPending&&this.startQuery(e)}update(t){let e=t.state.field(Zs),n=t.state.facet(es);if(!t.selectionSet&&!t.docChanged&&t.startState.field(Zs)==e)return;let r=t.transactions.some(i=>{let a=Iq(i,n);return a&8||(i.selection||i.docChanged)&&!(a&3)});for(let i=0;iNce&&Date.now()-a.time>Cce){for(let o of a.context.abortListeners)try{o()}catch(c){Js(this.view.state,c)}a.context.abortListeners=null,this.running.splice(i--,1)}else a.updates.push(...t.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),t.transactions.some(i=>i.effects.some(a=>a.is(Y1)))&&(this.pendingStart=!0);let s=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(i=>i.isPending&&!this.running.some(a=>a.active.source==i.source))?setTimeout(()=>this.startUpdate(),s):-1,this.composing!=0)for(let i of t.transactions)i.isUserEvent("input.type")?this.composing=2:this.composing==2&&i.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:t}=this.view,e=t.field(Zs);for(let n of e.active)n.isPending&&!this.running.some(r=>r.active.source==n.source)&&this.startQuery(n);this.running.length&&e.open&&e.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(es).updateSyncTime))}startQuery(t){let{state:e}=this.view,n=ku(e),r=new zq(e,n,t.explicit,this.view),s=new jce(t,r);this.running.push(s),Promise.resolve(t.source(r)).then(i=>{s.context.aborted||(s.done=i||null,this.scheduleAccept())},i=>{this.view.dispatch({effects:i0.of(null)}),Js(this.view.state,i)})}scheduleAccept(){this.running.every(t=>t.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(es).updateSyncTime))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],n=this.view.state.facet(es),r=this.view.state.field(Zs);for(let s=0;so.source==i.active.source);if(a&&a.isPending)if(i.done==null){let o=new Ji(i.active.source,0);for(let c of i.updates)o=o.update(c,n);o.isPending||e.push(o)}else this.startQuery(a)}(e.length||r.open&&r.open.disabled)&&this.view.dispatch({effects:eO.of(e)})}},{eventHandlers:{blur(t){let e=this.view.state.field(Zs,!1);if(e&&e.tooltip&&this.view.state.facet(es).closeOnBlur){let n=e.open&&fB(this.view,e.open.tooltip);(!n||!n.dom.contains(t.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:i0.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:Y1.of(!1)}),20),this.composing=0}}}),Ece=typeof navigator=="object"&&/Win/.test(navigator.platform),_ce=Mc.highest(We.domEventHandlers({keydown(t,e){let n=e.state.field(Zs,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||t.key.length>1||t.ctrlKey&&!(Ece&&t.altKey)||t.metaKey)return!1;let r=n.open.options[n.open.selected],s=n.active.find(a=>a.source==r.source),i=r.completion.commitCharacters||s.result.commitCharacters;return i&&i.indexOf(t.key)>-1&&tO(e,r),!1}})),qq=We.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class Mce{constructor(e,n,r,s){this.field=e,this.line=n,this.from=r,this.to=s}}class nO{constructor(e,n,r){this.field=e,this.from=n,this.to=r}map(e){let n=e.mapPos(this.from,-1,fs.TrackDel),r=e.mapPos(this.to,1,fs.TrackDel);return n==null||r==null?null:new nO(this.field,n,r)}}class rO{constructor(e,n){this.lines=e,this.fieldPositions=n}instantiate(e,n){let r=[],s=[n],i=e.doc.lineAt(n),a=/^\s*/.exec(i.text)[0];for(let c of this.lines){if(r.length){let h=a,f=/^\t*/.exec(c)[0].length;for(let m=0;mnew nO(c.field,s[c.line]+c.from,s[c.line]+c.to));return{text:r,ranges:o}}static parse(e){let n=[],r=[],s=[],i;for(let a of e.split(/\r\n?|\n/)){for(;i=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(a);){let o=i[1]?+i[1]:null,c=i[2]||i[3]||"",h=-1,f=c.replace(/\\[{}]/g,m=>m[1]);for(let m=0;m=h&&g.field++}for(let m of s)if(m.line==r.length&&m.from>i.index){let g=i[2]?3+(i[1]||"").length:2;m.from-=g,m.to-=g}s.push(new Mce(h,r.length,i.index,i.index+f.length)),a=a.slice(0,i.index)+c+a.slice(i.index+i[0].length)}a=a.replace(/\\([{}])/g,(o,c,h)=>{for(let f of s)f.line==r.length&&f.from>h&&(f.from--,f.to--);return c}),r.push(a)}return new rO(r,s)}}let Ace=ft.widget({widget:new class extends ml{toDOM(){let t=document.createElement("span");return t.className="cm-snippetFieldPosition",t}ignoreEvent(){return!1}}}),Rce=ft.mark({class:"cm-snippetField"});class Hh{constructor(e,n){this.ranges=e,this.active=n,this.deco=ft.set(e.map(r=>(r.from==r.to?Ace:Rce).range(r.from,r.to)),!0)}map(e){let n=[];for(let r of this.ranges){let s=r.map(e);if(!s)return null;n.push(s)}return new Hh(n,this.active)}selectionInsideField(e){return e.ranges.every(n=>this.ranges.some(r=>r.field==this.active&&r.from<=n.from&&r.to>=n.to))}}const tp=Mt.define({map(t,e){return t&&t.map(e)}}),Dce=Mt.define(),a0=is.define({create(){return null},update(t,e){for(let n of e.effects){if(n.is(tp))return n.value;if(n.is(Dce)&&t)return new Hh(t.ranges,n.value)}return t&&e.docChanged&&(t=t.map(e.changes)),t&&e.selection&&!t.selectionInsideField(e.selection)&&(t=null),t},provide:t=>We.decorations.from(t,e=>e?e.deco:ft.none)});function sO(t,e){return Ae.create(t.filter(n=>n.field==e).map(n=>Ae.range(n.from,n.to)))}function zce(t){let e=rO.parse(t);return(n,r,s,i)=>{let{text:a,ranges:o}=e.instantiate(n.state,s),{main:c}=n.state.selection,h={changes:{from:s,to:i==c.from?c.to:i,insert:cn.of(a)},scrollIntoView:!0,annotations:r?[J6.of(r),Pr.userEvent.of("input.complete")]:void 0};if(o.length&&(h.selection=sO(o,0)),o.some(f=>f.field>0)){let f=new Hh(o,0),m=h.effects=[tp.of(f)];n.state.field(a0,!1)===void 0&&m.push(Mt.appendConfig.of([a0,qce,Fce,qq]))}n.dispatch(n.state.update(h))}}function Fq(t){return({state:e,dispatch:n})=>{let r=e.field(a0,!1);if(!r||t<0&&r.active==0)return!1;let s=r.active+t,i=t>0&&!r.ranges.some(a=>a.field==s+t);return n(e.update({selection:sO(r.ranges,s),effects:tp.of(i?null:new Hh(r.ranges,s)),scrollIntoView:!0})),!0}}const Pce=({state:t,dispatch:e})=>t.field(a0,!1)?(e(t.update({effects:tp.of(null)})),!0):!1,Lce=Fq(1),Ice=Fq(-1),Bce=[{key:"Tab",run:Lce,shift:Ice},{key:"Escape",run:Pce}],aE=et.define({combine(t){return t.length?t[0]:Bce}}),qce=Mc.highest(G0.compute([aE],t=>t.facet(aE)));function Ql(t,e){return{...e,apply:zce(t)}}const Fce=We.domEventHandlers({mousedown(t,e){let n=e.state.field(a0,!1),r;if(!n||(r=e.posAtCoords({x:t.clientX,y:t.clientY}))==null)return!1;let s=n.ranges.find(i=>i.from<=r&&i.to>=r);return!s||s.field==n.active?!1:(e.dispatch({selection:sO(n.ranges,s.field),effects:tp.of(n.ranges.some(i=>i.field>s.field)?new Hh(n.ranges,s.field):null),scrollIntoView:!0}),!0)}}),l0={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},gu=Mt.define({map(t,e){let n=e.mapPos(t,-1,fs.TrackAfter);return n??void 0}}),iO=new class extends Tu{};iO.startSide=1;iO.endSide=-1;const $q=is.define({create(){return bn.empty},update(t,e){if(t=t.map(e.changes),e.selection){let n=e.state.doc.lineAt(e.selection.main.head);t=t.update({filter:r=>r>=n.from&&r<=n.to})}for(let n of e.effects)n.is(gu)&&(t=t.update({add:[iO.range(n.value,n.value+1)]}));return t}});function $ce(){return[Hce,$q]}const Pw="()[]{}<>«»»«[]{}";function Qq(t){for(let e=0;e{if((Qce?t.composing:t.compositionStarted)||t.state.readOnly)return!1;let s=t.state.selection.main;if(r.length>2||r.length==2&&Xa(Ks(r,0))==1||e!=s.from||n!=s.to)return!1;let i=Wce(t.state,r);return i?(t.dispatch(i),!0):!1}),Vce=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let r=Hq(t,t.selection.main.head).brackets||l0.brackets,s=null,i=t.changeByRange(a=>{if(a.empty){let o=Gce(t.doc,a.head);for(let c of r)if(c==o&&iy(t.doc,a.head)==Qq(Ks(c,0)))return{changes:{from:a.head-c.length,to:a.head+c.length},range:Ae.cursor(a.head-c.length)}}return{range:s=a}});return s||e(t.update(i,{scrollIntoView:!0,userEvent:"delete.backward"})),!s},Uce=[{key:"Backspace",run:Vce}];function Wce(t,e){let n=Hq(t,t.selection.main.head),r=n.brackets||l0.brackets;for(let s of r){let i=Qq(Ks(s,0));if(e==s)return i==s?Kce(t,s,r.indexOf(s+s+s)>-1,n):Xce(t,s,i,n.before||l0.before);if(e==i&&Vq(t,t.selection.main.from))return Yce(t,s,i)}return null}function Vq(t,e){let n=!1;return t.field($q).between(0,t.doc.length,r=>{r==e&&(n=!0)}),n}function iy(t,e){let n=t.sliceString(e,e+2);return n.slice(0,Xa(Ks(n,0)))}function Gce(t,e){let n=t.sliceString(e-2,e);return Xa(Ks(n,0))==n.length?n:n.slice(1)}function Xce(t,e,n,r){let s=null,i=t.changeByRange(a=>{if(!a.empty)return{changes:[{insert:e,from:a.from},{insert:n,from:a.to}],effects:gu.of(a.to+e.length),range:Ae.range(a.anchor+e.length,a.head+e.length)};let o=iy(t.doc,a.head);return!o||/\s/.test(o)||r.indexOf(o)>-1?{changes:{insert:e+n,from:a.head},effects:gu.of(a.head+e.length),range:Ae.cursor(a.head+e.length)}:{range:s=a}});return s?null:t.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function Yce(t,e,n){let r=null,s=t.changeByRange(i=>i.empty&&iy(t.doc,i.head)==n?{changes:{from:i.head,to:i.head+n.length,insert:n},range:Ae.cursor(i.head+n.length)}:r={range:i});return r?null:t.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function Kce(t,e,n,r){let s=r.stringPrefixes||l0.stringPrefixes,i=null,a=t.changeByRange(o=>{if(!o.empty)return{changes:[{insert:e,from:o.from},{insert:e,from:o.to}],effects:gu.of(o.to+e.length),range:Ae.range(o.anchor+e.length,o.head+e.length)};let c=o.head,h=iy(t.doc,c),f;if(h==e){if(lE(t,c))return{changes:{insert:e+e,from:c},effects:gu.of(c+e.length),range:Ae.cursor(c+e.length)};if(Vq(t,c)){let g=n&&t.sliceDoc(c,c+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:c,to:c+g.length,insert:g},range:Ae.cursor(c+g.length)}}}else{if(n&&t.sliceDoc(c-2*e.length,c)==e+e&&(f=oE(t,c-2*e.length,s))>-1&&lE(t,f))return{changes:{insert:e+e+e+e,from:c},effects:gu.of(c+e.length),range:Ae.cursor(c+e.length)};if(t.charCategorizer(c)(h)!=nr.Word&&oE(t,c,s)>-1&&!Zce(t,c,e,s))return{changes:{insert:e+e,from:c},effects:gu.of(c+e.length),range:Ae.cursor(c+e.length)}}return{range:i=o}});return i?null:t.update(a,{scrollIntoView:!0,userEvent:"input.type"})}function lE(t,e){let n=ns(t).resolveInner(e+1);return n.parent&&n.from==e}function Zce(t,e,n,r){let s=ns(t).resolveInner(e,-1),i=r.reduce((a,o)=>Math.max(a,o.length),0);for(let a=0;a<5;a++){let o=t.sliceDoc(s.from,Math.min(s.to,s.from+n.length+i)),c=o.indexOf(n);if(!c||c>-1&&r.indexOf(o.slice(0,c))>-1){let f=s.firstChild;for(;f&&f.from==s.from&&f.to-f.from>n.length+c;){if(t.sliceDoc(f.to-n.length,f.to)==n)return!1;f=f.firstChild}return!0}let h=s.to==e&&s.parent;if(!h)break;s=h}return!1}function oE(t,e,n){let r=t.charCategorizer(e);if(r(t.sliceDoc(e-1,e))!=nr.Word)return e;for(let s of n){let i=e-s.length;if(t.sliceDoc(i,e)==s&&r(t.sliceDoc(i-1,i))!=nr.Word)return i}return-1}function Jce(t={}){return[_ce,Zs,es.of(t),Tce,eue,qq]}const Uq=[{key:"Ctrl-Space",run:zw},{mac:"Alt-`",run:zw},{mac:"Alt-i",run:zw},{key:"Escape",run:Oce},{key:"ArrowDown",run:gx(!0)},{key:"ArrowUp",run:gx(!1)},{key:"PageDown",run:gx(!0,"page")},{key:"PageUp",run:gx(!1,"page")},{key:"Enter",run:kce}],eue=Mc.highest(G0.computeN([es],t=>t.facet(es).defaultKeymap?[Uq]:[]));class cE{constructor(e,n,r){this.from=e,this.to=n,this.diagnostic=r}}class du{constructor(e,n,r){this.diagnostics=e,this.panel=n,this.selected=r}static init(e,n,r){let s=r.facet(o0).markerFilter;s&&(e=s(e,r));let i=e.slice().sort((x,y)=>x.from-y.from||x.to-y.to),a=new fo,o=[],c=0,h=r.doc.iter(),f=0,m=r.doc.length;for(let x=0;;){let y=x==i.length?null:i[x];if(!y&&!o.length)break;let w,S;if(o.length)w=c,S=o.reduce((C,T)=>Math.min(C,T.to),y&&y.from>w?y.from:1e8);else{if(w=y.from,w>m)break;S=y.to,o.push(y),x++}for(;xC.from||C.to==w))o.push(C),x++,S=Math.min(C.to,S);else{S=Math.min(C.from,S);break}}S=Math.min(S,m);let k=!1;if(o.some(C=>C.from==w&&(C.to==S||S==m))&&(k=w==S,!k&&S-w<10)){let C=w-(f+h.value.length);C>0&&(h.next(C),f=w);for(let T=w;;){if(T>=S){k=!0;break}if(!h.lineBreak&&f+h.value.length>T)break;T=f+h.value.length,f+=h.value.length,h.next()}}let N=fue(o);if(k)a.add(w,w,ft.widget({widget:new cue(N),diagnostics:o.slice()}));else{let C=o.reduce((T,_)=>_.markClass?T+" "+_.markClass:T,"");a.add(w,S,ft.mark({class:"cm-lintRange cm-lintRange-"+N+C,diagnostics:o.slice(),inclusiveEnd:o.some(T=>T.to>S)}))}if(c=S,c==m)break;for(let C=0;C{if(!(e&&a.diagnostics.indexOf(e)<0))if(!r)r=new cE(s,i,e||a.diagnostics[0]);else{if(a.diagnostics.indexOf(r.diagnostic)<0)return!1;r=new cE(r.from,i,r.diagnostic)}}),r}function tue(t,e){let n=e.pos,r=e.end||n,s=t.state.facet(o0).hideOn(t,n,r);if(s!=null)return s;let i=t.startState.doc.lineAt(e.pos);return!!(t.effects.some(a=>a.is(Wq))||t.changes.touchesRange(i.from,Math.max(i.to,r)))}function nue(t,e){return t.field(Ti,!1)?e:e.concat(Mt.appendConfig.of(mue))}const Wq=Mt.define(),aO=Mt.define(),Gq=Mt.define(),Ti=is.define({create(){return new du(ft.none,null,null)},update(t,e){if(e.docChanged&&t.diagnostics.size){let n=t.diagnostics.map(e.changes),r=null,s=t.panel;if(t.selected){let i=e.changes.mapPos(t.selected.from,1);r=Nh(n,t.selected.diagnostic,i)||Nh(n,null,i)}!n.size&&s&&e.state.facet(o0).autoPanel&&(s=null),t=new du(n,s,r)}for(let n of e.effects)if(n.is(Wq)){let r=e.state.facet(o0).autoPanel?n.value.length?c0.open:null:t.panel;t=du.init(n.value,r,e.state)}else n.is(aO)?t=new du(t.diagnostics,n.value?c0.open:null,t.selected):n.is(Gq)&&(t=new du(t.diagnostics,t.panel,n.value));return t},provide:t=>[Zm.from(t,e=>e.panel),We.decorations.from(t,e=>e.diagnostics)]}),rue=ft.mark({class:"cm-lintRange cm-lintRange-active"});function sue(t,e,n){let{diagnostics:r}=t.state.field(Ti),s,i=-1,a=-1;r.between(e-(n<0?1:0),e+(n>0?1:0),(c,h,{spec:f})=>{if(e>=c&&e<=h&&(c==h||(e>c||n>0)&&(eYq(t,n,!1)))}const aue=t=>{let e=t.state.field(Ti,!1);(!e||!e.panel)&&t.dispatch({effects:nue(t.state,[aO.of(!0)])});let n=Km(t,c0.open);return n&&n.dom.querySelector(".cm-panel-lint ul").focus(),!0},uE=t=>{let e=t.state.field(Ti,!1);return!e||!e.panel?!1:(t.dispatch({effects:aO.of(!1)}),!0)},lue=t=>{let e=t.state.field(Ti,!1);if(!e)return!1;let n=t.state.selection.main,r=e.diagnostics.iter(n.to+1);return!r.value&&(r=e.diagnostics.iter(0),!r.value||r.from==n.from&&r.to==n.to)?!1:(t.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),!0)},oue=[{key:"Mod-Shift-m",run:aue,preventDefault:!0},{key:"F8",run:lue}],o0=et.define({combine(t){return{sources:t.map(e=>e.source).filter(e=>e!=null),...fl(t.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:dE,tooltipFilter:dE,needsRefresh:(e,n)=>e?n?r=>e(r)||n(r):e:n,hideOn:(e,n)=>e?n?(r,s,i)=>e(r,s,i)||n(r,s,i):e:n,autoPanel:(e,n)=>e||n})}}});function dE(t,e){return t?e?(n,r)=>e(t(n,r),r):t:e}function Xq(t){let e=[];if(t)e:for(let{name:n}of t){for(let r=0;ri.toLowerCase()==s.toLowerCase())){e.push(s);continue e}}e.push("")}return e}function Yq(t,e,n){var r;let s=n?Xq(e.actions):[];return $n("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},$n("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(t):e.message),(r=e.actions)===null||r===void 0?void 0:r.map((i,a)=>{let o=!1,c=x=>{if(x.preventDefault(),o)return;o=!0;let y=Nh(t.state.field(Ti).diagnostics,e);y&&i.apply(t,y.from,y.to)},{name:h}=i,f=s[a]?h.indexOf(s[a]):-1,m=f<0?h:[h.slice(0,f),$n("u",h.slice(f,f+1)),h.slice(f+1)],g=i.markClass?" "+i.markClass:"";return $n("button",{type:"button",class:"cm-diagnosticAction"+g,onclick:c,onmousedown:c,"aria-label":` Action: ${h}${f<0?"":` (access key "${s[a]})"`}.`},m)}),e.source&&$n("div",{class:"cm-diagnosticSource"},e.source))}class cue extends ml{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return $n("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class hE{constructor(e,n){this.diagnostic=n,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=Yq(e,n,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class c0{constructor(e){this.view=e,this.items=[];let n=s=>{if(s.keyCode==27)uE(this.view),this.view.focus();else if(s.keyCode==38||s.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(s.keyCode==40||s.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(s.keyCode==36)this.moveSelection(0);else if(s.keyCode==35)this.moveSelection(this.items.length-1);else if(s.keyCode==13)this.view.focus();else if(s.keyCode>=65&&s.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:i}=this.items[this.selectedIndex],a=Xq(i.actions);for(let o=0;o{for(let i=0;iuE(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(Ti).selected;if(!e)return-1;for(let n=0;n{for(let f of h.diagnostics){if(a.has(f))continue;a.add(f);let m=-1,g;for(let x=r;xr&&(this.items.splice(r,m-r),s=!0)),n&&g.diagnostic==n.diagnostic?g.dom.hasAttribute("aria-selected")||(g.dom.setAttribute("aria-selected","true"),i=g):g.dom.hasAttribute("aria-selected")&&g.dom.removeAttribute("aria-selected"),r++}});r({sel:i.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:o,panel:c})=>{let h=c.height/this.list.offsetHeight;o.topc.bottom&&(this.list.scrollTop+=(o.bottom-c.bottom)/h)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),s&&this.sync()}sync(){let e=this.list.firstChild;function n(){let r=e;e=r.nextSibling,r.remove()}for(let r of this.items)if(r.dom.parentNode==this.list){for(;e!=r.dom;)n();e=r.dom.nextSibling}else this.list.insertBefore(r.dom,e);for(;e;)n()}moveSelection(e){if(this.selectedIndex<0)return;let n=this.view.state.field(Ti),r=Nh(n.diagnostics,this.items[e].diagnostic);r&&this.view.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0,effects:Gq.of(r)})}static open(e){return new c0(e)}}function uue(t,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,${encodeURIComponent(t)}')`}function xx(t){return uue(``,'width="6" height="3"')}const due=We.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:xx("#d11")},".cm-lintRange-warning":{backgroundImage:xx("orange")},".cm-lintRange-info":{backgroundImage:xx("#999")},".cm-lintRange-hint":{backgroundImage:xx("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}});function hue(t){return t=="error"?4:t=="warning"?3:t=="info"?2:1}function fue(t){let e="hint",n=1;for(let r of t){let s=hue(r.severity);s>n&&(n=s,e=r.severity)}return e}const mue=[Ti,We.decorations.compute([Ti],t=>{let{selected:e,panel:n}=t.field(Ti);return!e||!n||e.from==e.to?ft.none:ft.set([rue.range(e.from,e.to)])}),Xie(sue,{hideOn:tue}),due];var fE=function(e){e===void 0&&(e={});var{crosshairCursor:n=!1}=e,r=[];e.closeBracketsKeymap!==!1&&(r=r.concat(Uce)),e.defaultKeymap!==!1&&(r=r.concat(Eoe)),e.searchKeymap!==!1&&(r=r.concat(tce)),e.historyKeymap!==!1&&(r=r.concat(Ple)),e.foldKeymap!==!1&&(r=r.concat(Uae)),e.completionKeymap!==!1&&(r=r.concat(Uq)),e.lintKeymap!==!1&&(r=r.concat(oue));var s=[];return e.lineNumbers!==!1&&s.push(aae()),e.highlightActiveLineGutter!==!1&&s.push(cae()),e.highlightSpecialChars!==!1&&s.push(Oie()),e.history!==!1&&s.push(Cle()),e.foldGutter!==!1&&s.push(Yae()),e.drawSelection!==!1&&s.push(fie()),e.dropCursor!==!1&&s.push(vie()),e.allowMultipleSelections!==!1&&s.push(an.allowMultipleSelections.of(!0)),e.indentOnInput!==!1&&s.push(Lae()),e.syntaxHighlighting!==!1&&s.push(LB(ele,{fallback:!0})),e.bracketMatching!==!1&&s.push(lle()),e.closeBrackets!==!1&&s.push($ce()),e.autocompletion!==!1&&s.push(Jce()),e.rectangularSelection!==!1&&s.push(Iie()),n!==!1&&s.push(Fie()),e.highlightActiveLine!==!1&&s.push(_ie()),e.highlightSelectionMatches!==!1&&s.push(Poe()),e.tabSize&&typeof e.tabSize=="number"&&s.push(Y0.of(" ".repeat(e.tabSize))),s.concat([G0.of(r.flat())]).filter(Boolean)};const pue="#e5c07b",mE="#e06c75",gue="#56b6c2",xue="#ffffff",u1="#abb2bf",BS="#7d8799",vue="#61afef",yue="#98c379",pE="#d19a66",bue="#c678dd",wue="#21252b",gE="#2c313a",xE="#282c34",Lw="#353a42",Sue="#3E4451",vE="#528bff",kue=We.theme({"&":{color:u1,backgroundColor:xE},".cm-content":{caretColor:vE},".cm-cursor, .cm-dropCursor":{borderLeftColor:vE},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:Sue},".cm-panels":{backgroundColor:wue,color:u1},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847"},".cm-gutters":{backgroundColor:xE,color:BS,border:"none"},".cm-activeLineGutter":{backgroundColor:gE},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:Lw},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:Lw,borderBottomColor:Lw},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:gE,color:u1}}},{dark:!0}),Oue=Z0.define([{tag:ve.keyword,color:bue},{tag:[ve.name,ve.deleted,ve.character,ve.propertyName,ve.macroName],color:mE},{tag:[ve.function(ve.variableName),ve.labelName],color:vue},{tag:[ve.color,ve.constant(ve.name),ve.standard(ve.name)],color:pE},{tag:[ve.definition(ve.name),ve.separator],color:u1},{tag:[ve.typeName,ve.className,ve.number,ve.changed,ve.annotation,ve.modifier,ve.self,ve.namespace],color:pue},{tag:[ve.operator,ve.operatorKeyword,ve.url,ve.escape,ve.regexp,ve.link,ve.special(ve.string)],color:gue},{tag:[ve.meta,ve.comment],color:BS},{tag:ve.strong,fontWeight:"bold"},{tag:ve.emphasis,fontStyle:"italic"},{tag:ve.strikethrough,textDecoration:"line-through"},{tag:ve.link,color:BS,textDecoration:"underline"},{tag:ve.heading,fontWeight:"bold",color:mE},{tag:[ve.atom,ve.bool,ve.special(ve.variableName)],color:pE},{tag:[ve.processingInstruction,ve.string,ve.inserted],color:yue},{tag:ve.invalid,color:xue}]),Kq=[kue,LB(Oue)];var jue=We.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),Nue=function(e){e===void 0&&(e={});var{indentWithTab:n=!0,editable:r=!0,readOnly:s=!1,theme:i="light",placeholder:a="",basicSetup:o=!0}=e,c=[];switch(n&&c.unshift(G0.of([_oe])),o&&(typeof o=="boolean"?c.unshift(fE()):c.unshift(fE(o))),a&&c.unshift(Die(a)),i){case"light":c.push(jue);break;case"dark":c.push(Kq);break;case"none":break;default:c.push(i);break}return r===!1&&c.push(We.editable.of(!1)),s&&c.push(an.readOnly.of(!0)),[...c]},Cue=t=>({line:t.state.doc.lineAt(t.state.selection.main.from),lineCount:t.state.doc.lines,lineBreak:t.state.lineBreak,length:t.state.doc.length,readOnly:t.state.readOnly,tabSize:t.state.tabSize,selection:t.state.selection,selectionAsSingle:t.state.selection.asSingle().main,ranges:t.state.selection.ranges,selectionCode:t.state.sliceDoc(t.state.selection.main.from,t.state.selection.main.to),selections:t.state.selection.ranges.map(e=>t.state.sliceDoc(e.from,e.to)),selectedText:t.state.selection.ranges.some(e=>!e.empty)});class Tue{constructor(e,n){this.timeLeftMS=void 0,this.timeoutMS=void 0,this.isCancelled=!1,this.isTimeExhausted=!1,this.callbacks=[],this.timeLeftMS=n,this.timeoutMS=n,this.callbacks.push(e)}tick(){if(!this.isCancelled&&!this.isTimeExhausted&&(this.timeLeftMS--,this.timeLeftMS<=0)){this.isTimeExhausted=!0;var e=this.callbacks.slice();this.callbacks.length=0,e.forEach(n=>{try{n()}catch(r){console.error("TimeoutLatch callback error:",r)}})}}cancel(){this.isCancelled=!0,this.callbacks.length=0}reset(){this.timeLeftMS=this.timeoutMS,this.isCancelled=!1,this.isTimeExhausted=!1}get isDone(){return this.isCancelled||this.isTimeExhausted}}class yE{constructor(){this.interval=null,this.latches=new Set}add(e){this.latches.add(e),this.start()}remove(e){this.latches.delete(e),this.latches.size===0&&this.stop()}start(){this.interval===null&&(this.interval=setInterval(()=>{this.latches.forEach(e=>{e.tick(),e.isDone&&this.remove(e)})},1))}stop(){this.interval!==null&&(clearInterval(this.interval),this.interval=null)}}var Iw=null,Eue=()=>typeof window>"u"?new yE:(Iw||(Iw=new yE),Iw),bE=hl.define(),_ue=200,Mue=[];function Aue(t){var{value:e,selection:n,onChange:r,onStatistics:s,onCreateEditor:i,onUpdate:a,extensions:o=Mue,autoFocus:c,theme:h="light",height:f=null,minHeight:m=null,maxHeight:g=null,width:x=null,minWidth:y=null,maxWidth:w=null,placeholder:S="",editable:k=!0,readOnly:N=!1,indentWithTab:C=!0,basicSetup:T=!0,root:_,initialState:E}=t,[M,q]=b.useState(),[L,I]=b.useState(),[$,V]=b.useState(),ee=b.useState(()=>({current:null}))[0],z=b.useState(()=>({current:null}))[0],H=We.theme({"&":{height:f,minHeight:m,maxHeight:g,width:x,minWidth:y,maxWidth:w},"& .cm-scroller":{height:"100% !important"}}),P=We.updateListener.of(X=>{if(X.docChanged&&typeof r=="function"&&!X.transactions.some(G=>G.annotation(bE))){ee.current?ee.current.reset():(ee.current=new Tue(()=>{if(z.current){var G=z.current;z.current=null,G()}ee.current=null},_ue),Eue().add(ee.current));var R=X.state.doc,se=R.toString();r(se,X)}s&&s(Cue(X))}),W=Nue({theme:h,editable:k,readOnly:N,placeholder:S,indentWithTab:C,basicSetup:T}),J=[P,H,...W];return a&&typeof a=="function"&&J.push(We.updateListener.of(a)),J=J.concat(o),b.useLayoutEffect(()=>{if(M&&!$){var X={doc:e,selection:n,extensions:J},R=E?an.fromJSON(E.json,X,E.fields):an.create(X);if(V(R),!L){var se=new We({state:R,parent:M,root:_});I(se),i&&i(se,R)}}return()=>{L&&(V(void 0),I(void 0))}},[M,$]),b.useEffect(()=>{t.container&&q(t.container)},[t.container]),b.useEffect(()=>()=>{L&&(L.destroy(),I(void 0)),ee.current&&(ee.current.cancel(),ee.current=null)},[L]),b.useEffect(()=>{c&&L&&L.focus()},[c,L]),b.useEffect(()=>{L&&L.dispatch({effects:Mt.reconfigure.of(J)})},[h,o,f,m,g,x,y,w,S,k,N,C,T,r,a]),b.useEffect(()=>{if(e!==void 0){var X=L?L.state.doc.toString():"";if(L&&e!==X){var R=ee.current&&!ee.current.isDone,se=()=>{L&&e!==L.state.doc.toString()&&L.dispatch({changes:{from:0,to:L.state.doc.toString().length,insert:e||""},annotations:[bE.of(!0)]})};R?z.current=se:se()}}},[e,L]),{state:$,setState:V,view:L,setView:I,container:M,setContainer:q}}var Rue=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],Zq=b.forwardRef((t,e)=>{var{className:n,value:r="",selection:s,extensions:i=[],onChange:a,onStatistics:o,onCreateEditor:c,onUpdate:h,autoFocus:f,theme:m="light",height:g,minHeight:x,maxHeight:y,width:w,minWidth:S,maxWidth:k,basicSetup:N,placeholder:C,indentWithTab:T,editable:_,readOnly:E,root:M,initialState:q}=t,L=SY(t,Rue),I=b.useRef(null),{state:$,view:V,container:ee,setContainer:z}=Aue({root:M,value:r,autoFocus:f,theme:m,height:g,minHeight:x,maxHeight:y,width:w,minWidth:S,maxWidth:k,basicSetup:N,placeholder:C,indentWithTab:T,editable:_,readOnly:E,selection:s,onChange:a,onStatistics:o,onCreateEditor:c,onUpdate:h,extensions:i,initialState:q});b.useImperativeHandle(e,()=>({editor:I.current,state:$,view:V}),[I,ee,$,V]);var H=b.useCallback(W=>{I.current=W,z(W)},[z]);if(typeof r!="string")throw new Error("value must be typeof string but got "+typeof r);var P=typeof m=="string"?"cm-theme-"+m:"cm-theme";return l.jsx("div",kY({ref:H,className:""+P+(n?" "+n:"")},L))});Zq.displayName="CodeMirror";var wE={};class Z1{constructor(e,n,r,s,i,a,o,c,h,f=0,m){this.p=e,this.stack=n,this.state=r,this.reducePos=s,this.pos=i,this.score=a,this.buffer=o,this.bufferBase=c,this.curContext=h,this.lookAhead=f,this.parent=m}toString(){return`[${this.stack.filter((e,n)=>n%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,n,r=0){let s=e.parser.context;return new Z1(e,[],n,r,r,0,[],0,s?new SE(s,s.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,n){this.stack.push(this.state,n,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var n;let r=e>>19,s=e&65535,{parser:i}=this.p,a=this.reducePos=2e3&&!(!((n=this.p.parser.nodeSet.types[s])===null||n===void 0)&&n.isAnonymous)&&(h==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=f):this.p.lastBigReductionSizec;)this.stack.pop();this.reduceContext(s,h)}storeNode(e,n,r,s=4,i=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]0&&a.buffer[o-4]==0&&a.buffer[o-1]>-1){if(n==r)return;if(a.buffer[o-2]>=n){a.buffer[o-2]=r;return}}}if(!i||this.pos==r)this.buffer.push(e,n,r,s);else{let a=this.buffer.length;if(a>0&&(this.buffer[a-4]!=0||this.buffer[a-1]<0)){let o=!1;for(let c=a;c>0&&this.buffer[c-2]>r;c-=4)if(this.buffer[c-1]>=0){o=!0;break}if(o)for(;a>0&&this.buffer[a-2]>r;)this.buffer[a]=this.buffer[a-4],this.buffer[a+1]=this.buffer[a-3],this.buffer[a+2]=this.buffer[a-2],this.buffer[a+3]=this.buffer[a-1],a-=4,s>4&&(s-=4)}this.buffer[a]=e,this.buffer[a+1]=n,this.buffer[a+2]=r,this.buffer[a+3]=s}}shift(e,n,r,s){if(e&131072)this.pushState(e&65535,this.pos);else if((e&262144)==0){let i=e,{parser:a}=this.p;(s>this.pos||n<=a.maxNode)&&(this.pos=s,a.stateFlag(i,1)||(this.reducePos=s)),this.pushState(i,r),this.shiftContext(n,r),n<=a.maxNode&&this.buffer.push(n,r,s,4)}else this.pos=s,this.shiftContext(n,r),n<=this.p.parser.maxNode&&this.buffer.push(n,r,s,4)}apply(e,n,r,s){e&65536?this.reduce(e):this.shift(e,n,r,s)}useNode(e,n){let r=this.p.reused.length-1;(r<0||this.p.reused[r]!=e)&&(this.p.reused.push(e),r++);let s=this.pos;this.reducePos=this.pos=s+e.length,this.pushState(n,s),this.buffer.push(r,s,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,n=e.buffer.length;for(;n>0&&e.buffer[n-2]>e.reducePos;)n-=4;let r=e.buffer.slice(n),s=e.bufferBase+n;for(;e&&s==e.bufferBase;)e=e.parent;return new Z1(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,r,s,this.curContext,this.lookAhead,e)}recoverByDelete(e,n){let r=e<=this.p.parser.maxNode;r&&this.storeNode(e,this.pos,n,4),this.storeNode(0,this.pos,n,r?8:4),this.pos=this.reducePos=n,this.score-=190}canShift(e){for(let n=new Due(this);;){let r=this.p.parser.stateSlot(n.state,4)||this.p.parser.hasAction(n.state,e);if(r==0)return!1;if((r&65536)==0)return!0;n.reduce(r)}}recoverByInsert(e){if(this.stack.length>=300)return[];let n=this.p.parser.nextStates(this.state);if(n.length>8||this.stack.length>=120){let s=[];for(let i=0,a;ic&1&&o==a)||s.push(n[i],a)}n=s}let r=[];for(let s=0;s>19,s=n&65535,i=this.stack.length-r*3;if(i<0||e.getGoto(this.stack[i],s,!1)<0){let a=this.findForcedReduction();if(a==null)return!1;n=a}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(n),!0}findForcedReduction(){let{parser:e}=this.p,n=[],r=(s,i)=>{if(!n.includes(s))return n.push(s),e.allActions(s,a=>{if(!(a&393216))if(a&65536){let o=(a>>19)-i;if(o>1){let c=a&65535,h=this.stack.length-o*3;if(h>=0&&e.getGoto(this.stack[h],c,!1)>=0)return o<<19|65536|c}}else{let o=r(a,i+1);if(o!=null)return o}})};return r(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let n=0;nthis.lookAhead&&(this.emitLookAhead(),this.lookAhead=e)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class SE{constructor(e,n){this.tracker=e,this.context=n,this.hash=e.strict?e.hash(n):0}}class Due{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let n=e&65535,r=e>>19;r==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(r-1)*3;let s=this.start.p.parser.getGoto(this.stack[this.base-3],n,!0);this.state=s}}class J1{constructor(e,n,r){this.stack=e,this.pos=n,this.index=r,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,n=e.bufferBase+e.buffer.length){return new J1(e,n,n-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new J1(this.stack,this.pos,this.index)}}function vx(t,e=Uint16Array){if(typeof t!="string")return t;let n=null;for(let r=0,s=0;r=92&&a--,a>=34&&a--;let c=a-32;if(c>=46&&(c-=46,o=!0),i+=c,o)break;i*=46}n?n[s++]=i:n=new e(i)}return n}class d1{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const kE=new d1;class zue{constructor(e,n){this.input=e,this.ranges=n,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=kE,this.rangeIndex=0,this.pos=this.chunkPos=n[0].from,this.range=n[0],this.end=n[n.length-1].to,this.readNext()}resolveOffset(e,n){let r=this.range,s=this.rangeIndex,i=this.pos+e;for(;ir.to:i>=r.to;){if(s==this.ranges.length-1)return null;let a=this.ranges[++s];i+=a.from-r.to,r=a}return i}clipPos(e){if(e>=this.range.from&&ee)return Math.max(e,n.from);return this.end}peek(e){let n=this.chunkOff+e,r,s;if(n>=0&&n=this.chunk2Pos&&ro.to&&(this.chunk2=this.chunk2.slice(0,o.to-r)),s=this.chunk2.charCodeAt(0)}}return r>=this.token.lookAhead&&(this.token.lookAhead=r+1),s}acceptToken(e,n=0){let r=n?this.resolveOffset(n,-1):this.pos;if(r==null||r=this.chunk2Pos&&this.posthis.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,n){if(n?(this.token=n,n.start=e,n.lookAhead=e+1,n.value=n.extended=-1):this.token=kE,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e=this.chunkPos&&n<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,n-this.chunkPos);if(e>=this.chunk2Pos&&n<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,n-this.chunk2Pos);if(e>=this.range.from&&n<=this.range.to)return this.input.read(e,n);let r="";for(let s of this.ranges){if(s.from>=n)break;s.to>e&&(r+=this.input.read(Math.max(s.from,e),Math.min(s.to,n)))}return r}}class ih{constructor(e,n){this.data=e,this.id=n}token(e,n){let{parser:r}=n.p;Pue(this.data,e,n,this.id,r.data,r.tokenPrecTable)}}ih.prototype.contextual=ih.prototype.fallback=ih.prototype.extend=!1;ih.prototype.fallback=ih.prototype.extend=!1;class ay{constructor(e,n={}){this.token=e,this.contextual=!!n.contextual,this.fallback=!!n.fallback,this.extend=!!n.extend}}function Pue(t,e,n,r,s,i){let a=0,o=1<0){let y=t[x];if(c.allows(y)&&(e.token.value==-1||e.token.value==y||Lue(y,e.token.value,s,i))){e.acceptToken(y);break}}let f=e.next,m=0,g=t[a+2];if(e.next<0&&g>m&&t[h+g*3-3]==65535){a=t[h+g*3-1];continue e}for(;m>1,y=h+x+(x<<1),w=t[y],S=t[y+1]||65536;if(f=S)m=x+1;else{a=t[y+2],e.advance();continue e}}break}}function OE(t,e,n){for(let r=e,s;(s=t[r])!=65535;r++)if(s==n)return r-e;return-1}function Lue(t,e,n,r){let s=OE(n,r,e);return s<0||OE(n,r,t)e)&&!r.type.isError)return n<0?Math.max(0,Math.min(r.to-1,e-25)):Math.min(t.length,Math.max(r.from+1,e+25));if(n<0?r.prevSibling():r.nextSibling())break;if(!r.parent())return n<0?0:t.length}}class Iue{constructor(e,n){this.fragments=e,this.nodeSet=n,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?jE(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?jE(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(ee)return this.nextStart=a,null;if(i instanceof Hn){if(a==e){if(a=Math.max(this.safeFrom,e)&&(this.trees.push(i),this.start.push(a),this.index.push(0))}else this.index[n]++,this.nextStart=a+i.length}}}class Bue{constructor(e,n){this.stream=n,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(r=>new d1)}getActions(e){let n=0,r=null,{parser:s}=e.p,{tokenizers:i}=s,a=s.stateSlot(e.state,3),o=e.curContext?e.curContext.hash:0,c=0;for(let h=0;hm.end+25&&(c=Math.max(m.lookAhead,c)),m.value!=0)){let g=n;if(m.extended>-1&&(n=this.addActions(e,m.extended,m.end,n)),n=this.addActions(e,m.value,m.end,n),!f.extend&&(r=m,n>g))break}}for(;this.actions.length>n;)this.actions.pop();return c&&e.setLookAhead(c),!r&&e.pos==this.stream.end&&(r=new d1,r.value=e.p.parser.eofTerm,r.start=r.end=e.pos,n=this.addActions(e,r.value,r.end,n)),this.mainToken=r,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let n=new d1,{pos:r,p:s}=e;return n.start=r,n.end=Math.min(r+1,s.stream.end),n.value=r==s.stream.end?s.parser.eofTerm:0,n}updateCachedToken(e,n,r){let s=this.stream.clipPos(r.pos);if(n.token(this.stream.reset(s,e),r),e.value>-1){let{parser:i}=r.p;for(let a=0;a=0&&r.p.parser.dialect.allows(o>>1)){(o&1)==0?e.value=o>>1:e.extended=o>>1;break}}}else e.value=0,e.end=this.stream.clipPos(s+1)}putAction(e,n,r,s){for(let i=0;ie.bufferLength*4?new Iue(r,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,n=this.minStackPos,r=this.stacks=[],s,i;if(this.bigReductionCount>300&&e.length==1){let[a]=e;for(;a.forceReduce()&&a.stack.length&&a.stack[a.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let a=0;an)r.push(o);else{if(this.advanceStack(o,r,e))continue;{s||(s=[],i=[]),s.push(o);let c=this.tokens.getMainToken(o);i.push(c.value,c.end)}}break}}if(!r.length){let a=s&&Que(s);if(a)return Si&&console.log("Finish with "+this.stackID(a)),this.stackToTree(a);if(this.parser.strict)throw Si&&s&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+n);this.recovering||(this.recovering=5)}if(this.recovering&&s){let a=this.stoppedAt!=null&&s[0].pos>this.stoppedAt?s[0]:this.runRecovery(s,i,r);if(a)return Si&&console.log("Force-finish "+this.stackID(a)),this.stackToTree(a.forceAll())}if(this.recovering){let a=this.recovering==1?1:this.recovering*3;if(r.length>a)for(r.sort((o,c)=>c.score-o.score);r.length>a;)r.pop();r.some(o=>o.reducePos>n)&&this.recovering--}else if(r.length>1){e:for(let a=0;a500&&h.buffer.length>500)if((o.score-h.score||o.buffer.length-h.buffer.length)>0)r.splice(c--,1);else{r.splice(a--,1);continue e}}}r.length>12&&r.splice(12,r.length-12)}this.minStackPos=r[0].pos;for(let a=1;a ":"";if(this.stoppedAt!=null&&s>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let h=e.curContext&&e.curContext.tracker.strict,f=h?e.curContext.hash:0;for(let m=this.fragments.nodeAt(s);m;){let g=this.parser.nodeSet.types[m.type.id]==m.type?i.getGoto(e.state,m.type.id):-1;if(g>-1&&m.length&&(!h||(m.prop(Ht.contextHash)||0)==f))return e.useNode(m,g),Si&&console.log(a+this.stackID(e)+` (via reuse of ${i.getName(m.type.id)})`),!0;if(!(m instanceof Hn)||m.children.length==0||m.positions[0]>0)break;let x=m.children[0];if(x instanceof Hn&&m.positions[0]==0)m=x;else break}}let o=i.stateSlot(e.state,4);if(o>0)return e.reduce(o),Si&&console.log(a+this.stackID(e)+` (via always-reduce ${i.getName(o&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let c=this.tokens.getActions(e);for(let h=0;hs?n.push(y):r.push(y)}return!1}advanceFully(e,n){let r=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>r)return NE(e,n),!0}}runRecovery(e,n,r){let s=null,i=!1;for(let a=0;a ":"";if(o.deadEnd&&(i||(i=!0,o.restart(),Si&&console.log(f+this.stackID(o)+" (restarted)"),this.advanceFully(o,r))))continue;let m=o.split(),g=f;for(let x=0;x<10&&m.forceReduce()&&(Si&&console.log(g+this.stackID(m)+" (via force-reduce)"),!this.advanceFully(m,r));x++)Si&&(g=this.stackID(m)+" -> ");for(let x of o.recoverByInsert(c))Si&&console.log(f+this.stackID(x)+" (via recover-insert)"),this.advanceFully(x,r);this.stream.end>o.pos?(h==o.pos&&(h++,c=0),o.recoverByDelete(c,h),Si&&console.log(f+this.stackID(o)+` (via recover-delete ${this.parser.getName(c)})`),NE(o,r)):(!s||s.scoret;class $ue{constructor(e){this.start=e.start,this.shift=e.shift||qw,this.reduce=e.reduce||qw,this.reuse=e.reuse||qw,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}}class u0 extends I6{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let n=e.nodeNames.split(" ");this.minRepeatTerm=n.length;for(let o=0;oe.topRules[o][1]),s=[];for(let o=0;o=0)i(f,c,o[h++]);else{let m=o[h+-f];for(let g=-f;g>0;g--)i(o[h++],c,m);h++}}}this.nodeSet=new Kv(n.map((o,c)=>zs.define({name:c>=this.minRepeatTerm?void 0:o,id:c,props:s[c],top:r.indexOf(c)>-1,error:c==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(c)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=xB;let a=vx(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let o=0;otypeof o=="number"?new ih(a,o):o),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,n,r){let s=new que(this,e,n,r);for(let i of this.wrappers)s=i(s,e,n,r);return s}getGoto(e,n,r=!1){let s=this.goto;if(n>=s[0])return-1;for(let i=s[n+1];;){let a=s[i++],o=a&1,c=s[i++];if(o&&r)return c;for(let h=i+(a>>1);i0}validAction(e,n){return!!this.allActions(e,r=>r==n?!0:null)}allActions(e,n){let r=this.stateSlot(e,4),s=r?n(r):void 0;for(let i=this.stateSlot(e,1);s==null;i+=3){if(this.data[i]==65535)if(this.data[i+1]==1)i=Kl(this.data,i+2);else break;s=n(Kl(this.data,i+1))}return s}nextStates(e){let n=[];for(let r=this.stateSlot(e,1);;r+=3){if(this.data[r]==65535)if(this.data[r+1]==1)r=Kl(this.data,r+2);else break;if((this.data[r+2]&1)==0){let s=this.data[r+1];n.some((i,a)=>a&1&&i==s)||n.push(this.data[r],s)}}return n}configure(e){let n=Object.assign(Object.create(u0.prototype),this);if(e.props&&(n.nodeSet=this.nodeSet.extend(...e.props)),e.top){let r=this.topRules[e.top];if(!r)throw new RangeError(`Invalid top rule name ${e.top}`);n.top=r}return e.tokenizers&&(n.tokenizers=this.tokenizers.map(r=>{let s=e.tokenizers.find(i=>i.from==r);return s?s.to:r})),e.specializers&&(n.specializers=this.specializers.slice(),n.specializerSpecs=this.specializerSpecs.map((r,s)=>{let i=e.specializers.find(o=>o.from==r.external);if(!i)return r;let a=Object.assign(Object.assign({},r),{external:i.to});return n.specializers[s]=CE(a),a})),e.contextTracker&&(n.context=e.contextTracker),e.dialect&&(n.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(n.strict=e.strict),e.wrap&&(n.wrappers=n.wrappers.concat(e.wrap)),e.bufferLength!=null&&(n.bufferLength=e.bufferLength),n}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let n=this.dynamicPrecedences;return n==null?0:n[e]||0}parseDialect(e){let n=Object.keys(this.dialects),r=n.map(()=>!1);if(e)for(let i of e.split(" ")){let a=n.indexOf(i);a>=0&&(r[a]=!0)}let s=null;for(let i=0;ir)&&n.p.parser.stateFlag(n.state,2)&&(!e||e.scoret.external(n,r)<<1|e}return t.get}const Hue=1,Jq=194,eF=195,Vue=196,TE=197,Uue=198,Wue=199,Gue=200,Xue=2,tF=3,EE=201,Yue=24,Kue=25,Zue=49,Jue=50,ede=55,tde=56,nde=57,rde=59,sde=60,ide=61,ade=62,lde=63,ode=65,cde=238,ude=71,dde=241,hde=242,fde=243,mde=244,pde=245,gde=246,xde=247,vde=248,nF=72,yde=249,bde=250,wde=251,Sde=252,kde=253,Ode=254,jde=255,Nde=256,Cde=73,Tde=77,Ede=263,_de=112,Mde=130,Ade=151,Rde=152,Dde=155,Du=10,d0=13,lO=32,ly=9,oO=35,zde=40,Pde=46,qS=123,_E=125,rF=39,sF=34,ME=92,Lde=111,Ide=120,Bde=78,qde=117,Fde=85,$de=new Set([Kue,Zue,Jue,Ede,ode,Mde,tde,nde,cde,ade,lde,nF,Cde,Tde,sde,ide,Ade,Rde,Dde,_de]);function Fw(t){return t==Du||t==d0}function $w(t){return t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102}const Qde=new ay((t,e)=>{let n;if(t.next<0)t.acceptToken(Wue);else if(e.context.flags&h1)Fw(t.next)&&t.acceptToken(Uue,1);else if(((n=t.peek(-1))<0||Fw(n))&&e.canShift(TE)){let r=0;for(;t.next==lO||t.next==ly;)t.advance(),r++;(t.next==Du||t.next==d0||t.next==oO)&&t.acceptToken(TE,-r)}else Fw(t.next)&&t.acceptToken(Vue,1)},{contextual:!0}),Hde=new ay((t,e)=>{let n=e.context;if(n.flags)return;let r=t.peek(-1);if(r==Du||r==d0){let s=0,i=0;for(;;){if(t.next==lO)s++;else if(t.next==ly)s+=8-s%8;else break;t.advance(),i++}s!=n.indent&&t.next!=Du&&t.next!=d0&&t.next!=oO&&(s[t,e|iF])),Wde=new $ue({start:Vde,reduce(t,e,n,r){return t.flags&h1&&$de.has(e)||(e==ude||e==nF)&&t.flags&iF?t.parent:t},shift(t,e,n,r){return e==Jq?new f1(t,Ude(r.read(r.pos,n.pos)),0):e==eF?t.parent:e==Yue||e==ede||e==rde||e==tF?new f1(t,0,h1):AE.has(e)?new f1(t,0,AE.get(e)|t.flags&h1):t},hash(t){return t.hash}}),Gde=new ay(t=>{for(let e=0;e<5;e++){if(t.next!="print".charCodeAt(e))return;t.advance()}if(!/\w/.test(String.fromCharCode(t.next)))for(let e=0;;e++){let n=t.peek(e);if(!(n==lO||n==ly)){n!=zde&&n!=Pde&&n!=Du&&n!=d0&&n!=oO&&t.acceptToken(Hue);return}}}),Xde=new ay((t,e)=>{let{flags:n}=e.context,r=n&Wl?sF:rF,s=(n&Gl)>0,i=!(n&Xl),a=(n&Yl)>0,o=t.pos;for(;!(t.next<0);)if(a&&t.next==qS)if(t.peek(1)==qS)t.advance(2);else{if(t.pos==o){t.acceptToken(tF,1);return}break}else if(i&&t.next==ME){if(t.pos==o){t.advance();let c=t.next;c>=0&&(t.advance(),Yde(t,c)),t.acceptToken(Xue);return}break}else if(t.next==ME&&!i&&t.peek(1)>-1)t.advance(2);else if(t.next==r&&(!s||t.peek(1)==r&&t.peek(2)==r)){if(t.pos==o){t.acceptToken(EE,s?3:1);return}break}else if(t.next==Du){if(s)t.advance();else if(t.pos==o){t.acceptToken(EE);return}break}else t.advance();t.pos>o&&t.acceptToken(Gue)});function Yde(t,e){if(e==Lde)for(let n=0;n<2&&t.next>=48&&t.next<=55;n++)t.advance();else if(e==Ide)for(let n=0;n<2&&$w(t.next);n++)t.advance();else if(e==qde)for(let n=0;n<4&&$w(t.next);n++)t.advance();else if(e==Fde)for(let n=0;n<8&&$w(t.next);n++)t.advance();else if(e==Bde&&t.next==qS){for(t.advance();t.next>=0&&t.next!=_E&&t.next!=rF&&t.next!=sF&&t.next!=Du;)t.advance();t.next==_E&&t.advance()}}const Kde=B6({'async "*" "**" FormatConversion FormatSpec':ve.modifier,"for while if elif else try except finally return raise break continue with pass assert await yield match case":ve.controlKeyword,"in not and or is del":ve.operatorKeyword,"from def class global nonlocal lambda":ve.definitionKeyword,import:ve.moduleKeyword,"with as print":ve.keyword,Boolean:ve.bool,None:ve.null,VariableName:ve.variableName,"CallExpression/VariableName":ve.function(ve.variableName),"FunctionDefinition/VariableName":ve.function(ve.definition(ve.variableName)),"ClassDefinition/VariableName":ve.definition(ve.className),PropertyName:ve.propertyName,"CallExpression/MemberExpression/PropertyName":ve.function(ve.propertyName),Comment:ve.lineComment,Number:ve.number,String:ve.string,FormatString:ve.special(ve.string),Escape:ve.escape,UpdateOp:ve.updateOperator,"ArithOp!":ve.arithmeticOperator,BitOp:ve.bitwiseOperator,CompareOp:ve.compareOperator,AssignOp:ve.definitionOperator,Ellipsis:ve.punctuation,At:ve.meta,"( )":ve.paren,"[ ]":ve.squareBracket,"{ }":ve.brace,".":ve.derefOperator,", ;":ve.separator}),Zde={__proto__:null,await:44,or:54,and:56,in:60,not:62,is:64,if:70,else:72,lambda:76,yield:94,from:96,async:102,for:104,None:162,True:164,False:164,del:178,pass:182,break:186,continue:190,return:194,raise:202,import:206,as:208,global:212,nonlocal:214,assert:218,type:223,elif:236,while:240,try:246,except:248,finally:250,with:254,def:258,class:268,match:279,case:285},Jde=u0.deserialize({version:14,states:"##jO`QeOOP$}OSOOO&WQtO'#HUOOQS'#Co'#CoOOQS'#Cp'#CpO'vQdO'#CnO*UQtO'#HTOOQS'#HU'#HUOOQS'#DU'#DUOOQS'#HT'#HTO*rQdO'#D_O+VQdO'#DfO+gQdO'#DjO+zOWO'#DuO,VOWO'#DvO.[QtO'#GuOOQS'#Gu'#GuO'vQdO'#GtO0ZQtO'#GtOOQS'#Eb'#EbO0rQdO'#EcOOQS'#Gs'#GsO0|QdO'#GrOOQV'#Gr'#GrO1XQdO'#FYOOQS'#G^'#G^O1^QdO'#FXOOQV'#IS'#ISOOQV'#Gq'#GqOOQV'#Fq'#FqQ`QeOOO'vQdO'#CqO1lQdO'#C}O1sQdO'#DRO2RQdO'#HYO2cQtO'#EVO'vQdO'#EWOOQS'#EY'#EYOOQS'#E['#E[OOQS'#E^'#E^O2wQdO'#E`O3_QdO'#EdO3rQdO'#EfO3zQtO'#EfO1XQdO'#EiO0rQdO'#ElO1XQdO'#EnO0rQdO'#EtO0rQdO'#EwO4VQdO'#EyO4^QdO'#FOO4iQdO'#EzO0rQdO'#FOO1XQdO'#FQO1XQdO'#FVO4nQdO'#F[P4uOdO'#GpPOOO)CBd)CBdOOQS'#Ce'#CeOOQS'#Cf'#CfOOQS'#Cg'#CgOOQS'#Ch'#ChOOQS'#Ci'#CiOOQS'#Cj'#CjOOQS'#Cl'#ClO'vQdO,59OO'vQdO,59OO'vQdO,59OO'vQdO,59OO'vQdO,59OO'vQdO,59OO5TQdO'#DoOOQS,5:Y,5:YO5hQdO'#HdOOQS,5:],5:]O5uQ!fO,5:]O5zQtO,59YO1lQdO,59bO1lQdO,59bO1lQdO,59bO8jQdO,59bO8oQdO,59bO8vQdO,59jO8}QdO'#HTO:TQdO'#HSOOQS'#HS'#HSOOQS'#D['#D[O:lQdO,59aO'vQdO,59aO:zQdO,59aOOQS,59y,59yO;PQdO,5:RO'vQdO,5:ROOQS,5:Q,5:QO;_QdO,5:QO;dQdO,5:XO'vQdO,5:XO'vQdO,5:VOOQS,5:U,5:UO;uQdO,5:UO;zQdO,5:WOOOW'#Fy'#FyOOOOQS'#Ds'#DsOOQS1G/w1G/wOOQS1G.|1G.|O!/[QtO1G.|O!/cQtO1G.|O1lQdO1G.|O!0OQdO1G/UOOQS'#DZ'#DZO0rQdO,59tOOQS1G.{1G.{O!0VQdO1G/eO!0gQdO1G/eO!0oQdO1G/fO'vQdO'#H[O!0tQdO'#H[O!0yQtO1G.{O!1ZQdO,59iO!2aQdO,5=zO!2qQdO,5=zO!2yQdO1G/mO!3OQtO1G/mOOQS1G/l1G/lO!3`QdO,5=uO!4VQdO,5=uO0rQdO1G/qO!4tQdO1G/sO!4yQtO1G/sO!5ZQtO1G/qOOQS1G/p1G/pOOQS1G/r1G/rOOOW-E9w-E9wOOQS1G/{1G/{O!5kQdO'#HxO0rQdO'#HxO!5|QdO,5>cOOOW-E9x-E9xOOQS1G/|1G/|OOQS-E9{-E9{O!6[Q#xO1G2zO!6{QtO1G2zO'vQdO,5kOOQS1G1`1G1`O!8RQdO1G1`OOQS'#DV'#DVO0rQdO,5=qOOQS,5=q,5=qO!8WQdO'#FrO!8cQdO,59oO!8kQdO1G/XO!8uQtO,5=uOOQS1G3`1G3`OOQS,5:m,5:mO!9fQdO'#GtOOQS,5jO!;ZQdO,5>jO1XQdO,5>jO!;lQdO,5>iOOQS-E:R-E:RO!;qQdO1G0lO!;|QdO1G0lO!lO!lO!hO!=VQdO,5>hO!=hQdO'#EpO0rQdO1G0tO!=sQdO1G0tO!=xQgO1G0zO!AvQgO1G0}O!EqQdO,5>oO!E{QdO,5>oO!FTQtO,5>oO0rQdO1G1PO!F_QdO1G1PO4iQdO1G1UO!!vQdO1G1WOOQV,5;a,5;aO!FdQfO,5;aO!FiQgO1G1QO!JjQdO'#GZO4iQdO1G1QO4iQdO1G1QO!JzQdO,5>pO!KXQdO,5>pO1XQdO,5>pOOQV1G1U1G1UO!KaQdO'#FSO!KrQ!fO1G1WO!KzQdO1G1WOOQV1G1]1G1]O4iQdO1G1]O!LPQdO1G1]O!LXQdO'#F^OOQV1G1b1G1bO!#ZQtO1G1bPOOO1G2v1G2vP!L^OSO1G2vOOQS,5=},5=}OOQS'#Dp'#DpO0rQdO,5=}O!LfQdO,5=|O!LyQdO,5=|OOQS1G/u1G/uO!MRQdO,5>PO!McQdO,5>PO!MkQdO,5>PO!NOQdO,5>PO!N`QdO,5>POOQS1G3j1G3jOOQS7+$h7+$hO!8kQdO7+$pO#!RQdO1G.|O#!YQdO1G.|OOQS1G/`1G/`OOQS,5<`,5<`O'vQdO,5<`OOQS7+%P7+%PO#!aQdO7+%POOQS-E9r-E9rOOQS7+%Q7+%QO#!qQdO,5=vO'vQdO,5=vOOQS7+$g7+$gO#!vQdO7+%PO##OQdO7+%QO##TQdO1G3fOOQS7+%X7+%XO##eQdO1G3fO##mQdO7+%XOOQS,5<_,5<_O'vQdO,5<_O##rQdO1G3aOOQS-E9q-E9qO#$iQdO7+%]OOQS7+%_7+%_O#$wQdO1G3aO#%fQdO7+%_O#%kQdO1G3gO#%{QdO1G3gO#&TQdO7+%]O#&YQdO,5>dO#&sQdO,5>dO#&sQdO,5>dOOQS'#Dx'#DxO#'UO&jO'#DzO#'aO`O'#HyOOOW1G3}1G3}O#'fQdO1G3}O#'nQdO1G3}O#'yQ#xO7+(fO#(jQtO1G2UP#)TQdO'#GOOOQS,5nQdO,5sQdO1G4OOOQS-E9y-E9yO#?^QdO1G4OO<[QdO'#H{OOOO'#D{'#D{OOOO'#F|'#F|O#?oO&jO,5:fOOOW,5>e,5>eOOOW7+)i7+)iO#?zQdO7+)iO#@SQdO1G2zO#@mQdO1G2zP'vQdO'#FuO0rQdO<mO#BQQdO,5>mOOQS1G0v1G0vOOQS<rO#KgQdO,5>rO#KrQdO,5>rO#K}QdO,5>qO#L`QdO,5>qOOQS1G1Y1G1YOOQS,5;p,5;pOOQV<VAN>VO$ oQdO<cAN>cO0rQdO1G1|O$!PQtO1G1|P$!ZQdO'#FvOOQS1G2R1G2RP$!hQdO'#F{O$!uQdO7+)jO$#`QdO,5>gOOOO-E9z-E9zOOOW<tO$4{QdO,5>tO1XQdO,5vO$)nQdO,5>vOOQS1G1p1G1pOOQS,5<[,5<[OOQU7+'P7+'PO$+zQdO1G/iO$)nQdO,5wO$8zQdO,5>wOOQS1G1s1G1sOOQS7+'S7+'SP$)nQdO'#GdO$9SQdO1G4bO$9^QdO1G4bO$9fQdO1G4bOOQS7+%T7+%TO$9tQdO1G1tO$:SQtO'#FaO$:ZQdO,5<}OOQS,5<},5<}O$:iQdO1G4cOOQS-E:a-E:aO$)nQdO,5<|O$:pQdO,5<|O$:uQdO7+)|OOQS-E:`-E:`O$;PQdO7+)|O$)nQdO,5S~O%cOS%^OSSOS%]PQ~OPdOVaOfoOhYOopOs!POvqO!PrO!Q{O!T!SO!U!RO!XZO!][O!h`O!r`O!s`O!t`O!{tO!}uO#PvO#RwO#TxO#XyO#ZzO#^|O#_|O#a}O#c!OO#l!QO#o!TO#s!UO#u!VO#z!WO#}hO$P!XO%oRO%pRO%tSO%uWO&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O&c^O&d^O&e^O&f^O&g^O&h^O&i^O&j^O~O%]!YO~OV!aO_!aOa!bOh!iO!X!kO!f!mO%j![O%k!]O%l!^O%m!_O%n!_O%o!`O%p!`O%q!aO%r!aO%s!aO~Ok%xXl%xXm%xXn%xXo%xXp%xXs%xXz%xX{%xX!x%xX#g%xX%[%xX%_%xX%z%xXg%xX!T%xX!U%xX%{%xX!W%xX![%xX!Q%xX#[%xXt%xX!m%xX~P%SOfoOhYO!XZO!][O!h`O!r`O!s`O!t`O%oRO%pRO%tSO%uWO&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O&c^O&d^O&e^O&f^O&g^O&h^O&i^O&j^O~Oz%wX{%wX#g%wX%[%wX%_%wX%z%wX~Ok!pOl!qOm!oOn!oOo!rOp!sOs!tO!x%wX~P)pOV!zOg!|Oo0cOv0qO!PrO~P'vOV#OOo0cOv0qO!W#PO~P'vOV#SOa#TOo0cOv0qO![#UO~P'vOQ#XO%`#XO%a#ZO~OQ#^OR#[O%`#^O%a#`O~OV%iX_%iXa%iXh%iXk%iXl%iXm%iXn%iXo%iXp%iXs%iXz%iX!X%iX!f%iX%j%iX%k%iX%l%iX%m%iX%n%iX%o%iX%p%iX%q%iX%r%iX%s%iXg%iX!T%iX!U%iX~O&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O&c^O&d^O&e^O&f^O&g^O&h^O&i^O&j^O{%iX!x%iX#g%iX%[%iX%_%iX%z%iX%{%iX!W%iX![%iX!Q%iX#[%iXt%iX!m%iX~P,eOz#dO{%hX!x%hX#g%hX%[%hX%_%hX%z%hX~Oo0cOv0qO~P'vO#g#gO%[#iO%_#iO~O%uWO~O!T#nO#u!VO#z!WO#}hO~OopO~P'vOV#sOa#tO%uWO{wP~OV#xOo0cOv0qO!Q#yO~P'vO{#{O!x$QO%z#|O#g!yX%[!yX%_!yX~OV#xOo0cOv0qO#g#SX%[#SX%_#SX~P'vOo0cOv0qO#g#WX%[#WX%_#WX~P'vOh$WO%uWO~O!f$YO!r$YO%uWO~OV$eO~P'vO!U$gO#s$hO#u$iO~O{$jO~OV$qO~P'vOS$sO%[$rO%_$rO%c$tO~OV$}Oa$}Og%POo0cOv0qO~P'vOo0cOv0qO{%SO~P'vO&Y%UO~Oa!bOh!iO!X!kO!f!mOVba_bakbalbambanbaobapbasbazba{ba!xba#gba%[ba%_ba%jba%kba%lba%mba%nba%oba%pba%qba%rba%sba%zbagba!Tba!Uba%{ba!Wba![ba!Qba#[batba!mba~On%ZO~Oo%ZO~P'vOo0cO~P'vOk0eOl0fOm0dOn0dOo0mOp0nOs0rOg%wX!T%wX!U%wX%{%wX!W%wX![%wX!Q%wX#[%wX!m%wX~P)pO%{%]Og%vXz%vX!T%vX!U%vX!W%vX{%vX~Og%_Oz%`O!T%dO!U%cO~Og%_O~Oz%gO!T%dO!U%cO!W&SX~O!W%kO~Oz%lO{%nO!T%dO!U%cO![%}X~O![%rO~O![%sO~OQ#XO%`#XO%a%uO~OV%wOo0cOv0qO!PrO~P'vOQ#^OR#[O%`#^O%a%zO~OV!qa_!qaa!qah!qak!qal!qam!qan!qao!qap!qas!qaz!qa{!qa!X!qa!f!qa!x!qa#g!qa%[!qa%_!qa%j!qa%k!qa%l!qa%m!qa%n!qa%o!qa%p!qa%q!qa%r!qa%s!qa%z!qag!qa!T!qa!U!qa%{!qa!W!qa![!qa!Q!qa#[!qat!qa!m!qa~P#yOz%|O{%ha!x%ha#g%ha%[%ha%_%ha%z%ha~P%SOV&OOopOvqO{%ha!x%ha#g%ha%[%ha%_%ha%z%ha~P'vOz%|O{%ha!x%ha#g%ha%[%ha%_%ha%z%ha~OPdOVaOopOvqO!PrO!Q{O!{tO!}uO#PvO#RwO#TxO#XyO#ZzO#^|O#_|O#a}O#c!OO#g$zX%[$zX%_$zX~P'vO#g#gO%[&TO%_&TO~O!f&UOh&sX%[&sXz&sX#[&sX#g&sX%_&sX#Z&sXg&sX~Oh!iO%[&WO~Okealeameaneaoeapeaseazea{ea!xea#gea%[ea%_ea%zeagea!Tea!Uea%{ea!Wea![ea!Qea#[eatea!mea~P%SOsqazqa{qa#gqa%[qa%_qa%zqa~Ok!pOl!qOm!oOn!oOo!rOp!sO!xqa~PEcO%z&YOz%yX{%yX~O%uWOz%yX{%yX~Oz&]O{wX~O{&_O~Oz%lO#g%}X%[%}X%_%}Xg%}X{%}X![%}X!m%}X%z%}X~OV0lOo0cOv0qO!PrO~P'vO%z#|O#gUa%[Ua%_Ua~Oz&hO#g&PX%[&PX%_&PXn&PX~P%SOz&kO!Q&jO#g#Wa%[#Wa%_#Wa~Oz&lO#[&nO#g&rX%[&rX%_&rXg&rX~O!f$YO!r$YO#Z&qO%uWO~O#Z&qO~Oz&sO#g&tX%[&tX%_&tX~Oz&uO#g&pX%[&pX%_&pX{&pX~O!X&wO%z&xO~Oz&|On&wX~P%SOn'PO~OPdOVaOopOvqO!PrO!Q{O!{tO!}uO#PvO#RwO#TxO#XyO#ZzO#^|O#_|O#a}O#c!OO%['UO~P'vOt'YO#p'WO#q'XOP#naV#naf#nah#nao#nas#nav#na!P#na!Q#na!T#na!U#na!X#na!]#na!h#na!r#na!s#na!t#na!{#na!}#na#P#na#R#na#T#na#X#na#Z#na#^#na#_#na#a#na#c#na#l#na#o#na#s#na#u#na#z#na#}#na$P#na%X#na%o#na%p#na%t#na%u#na&Z#na&[#na&]#na&^#na&_#na&`#na&a#na&b#na&c#na&d#na&e#na&f#na&g#na&h#na&i#na&j#na%Z#na%_#na~Oz'ZO#[']O{&xX~Oh'_O!X&wO~Oh!iO{$jO!X&wO~O{'eO~P%SO%['hO%_'hO~OS'iO%['hO%_'hO~OV!aO_!aOa!bOh!iO!X!kO!f!mO%l!^O%m!_O%n!_O%o!`O%p!`O%q!aO%r!aO%s!aOkWilWimWinWioWipWisWizWi{Wi!xWi#gWi%[Wi%_Wi%jWi%zWigWi!TWi!UWi%{Wi!WWi![Wi!QWi#[WitWi!mWi~O%k!]O~P!#uO%kWi~P!#uOV!aO_!aOa!bOh!iO!X!kO!f!mO%o!`O%p!`O%q!aO%r!aO%s!aOkWilWimWinWioWipWisWizWi{Wi!xWi#gWi%[Wi%_Wi%jWi%kWi%lWi%zWigWi!TWi!UWi%{Wi!WWi![Wi!QWi#[WitWi!mWi~O%m!_O%n!_O~P!&pO%mWi%nWi~P!&pOa!bOh!iO!X!kO!f!mOkWilWimWinWioWipWisWizWi{Wi!xWi#gWi%[Wi%_Wi%jWi%kWi%lWi%mWi%nWi%oWi%pWi%zWigWi!TWi!UWi%{Wi!WWi![Wi!QWi#[WitWi!mWi~OV!aO_!aO%q!aO%r!aO%s!aO~P!)nOVWi_Wi%qWi%rWi%sWi~P!)nO!T%dO!U%cOg&VXz&VX~O%z'kO%{'kO~P,eOz'mOg&UX~Og'oO~Oz'pO{'rO!W&XX~Oo0cOv0qOz'pO{'sO!W&XX~P'vO!W'uO~Om!oOn!oOo!rOp!sOkjisjizji{ji!xji#gji%[ji%_ji%zji~Ol!qO~P!.aOlji~P!.aOk0eOl0fOm0dOn0dOo0mOp0nO~Ot'wO~P!/jOV'|Og'}Oo0cOv0qO~P'vOg'}Oz(OO~Og(QO~O!U(SO~Og(TOz(OO!T%dO!U%cO~P%SOk0eOl0fOm0dOn0dOo0mOp0nOgqa!Tqa!Uqa%{qa!Wqa![qa!Qqa#[qatqa!mqa~PEcOV'|Oo0cOv0qO!W&Sa~P'vOz(WO!W&Sa~O!W(XO~Oz(WO!T%dO!U%cO!W&Sa~P%SOV(]Oo0cOv0qO![%}a#g%}a%[%}a%_%}ag%}a{%}a!m%}a%z%}a~P'vOz(^O![%}a#g%}a%[%}a%_%}ag%}a{%}a!m%}a%z%}a~O![(aO~Oz(^O!T%dO!U%cO![%}a~P%SOz(dO!T%dO!U%cO![&Ta~P%SOz(gO{&lX![&lX!m&lX%z&lX~O{(kO![(mO!m(nO%z(jO~OV&OOopOvqO{%hi!x%hi#g%hi%[%hi%_%hi%z%hi~P'vOz(pO{%hi!x%hi#g%hi%[%hi%_%hi%z%hi~O!f&UOh&sa%[&saz&sa#[&sa#g&sa%_&sa#Z&sag&sa~O%[(uO~OV#sOa#tO%uWO~Oz&]O{wa~OopOvqO~P'vOz(^O#g%}a%[%}a%_%}ag%}a{%}a![%}a!m%}a%z%}a~P%SOz(zO#g%hX%[%hX%_%hX%z%hX~O%z#|O#gUi%[Ui%_Ui~O#g&Pa%[&Pa%_&Pan&Pa~P'vOz(}O#g&Pa%[&Pa%_&Pan&Pa~O%uWO#g&ra%[&ra%_&rag&ra~Oz)SO#g&ra%[&ra%_&rag&ra~Og)VO~OV)WOh$WO%uWO~O#Z)XO~O%uWO#g&ta%[&ta%_&ta~Oz)ZO#g&ta%[&ta%_&ta~Oo0cOv0qO#g&pa%[&pa%_&pa{&pa~P'vOz)^O#g&pa%[&pa%_&pa{&pa~OV)`Oa)`O%uWO~O%z)eO~Ot)hO#j)gOP#hiV#hif#hih#hio#his#hiv#hi!P#hi!Q#hi!T#hi!U#hi!X#hi!]#hi!h#hi!r#hi!s#hi!t#hi!{#hi!}#hi#P#hi#R#hi#T#hi#X#hi#Z#hi#^#hi#_#hi#a#hi#c#hi#l#hi#o#hi#s#hi#u#hi#z#hi#}#hi$P#hi%X#hi%o#hi%p#hi%t#hi%u#hi&Z#hi&[#hi&]#hi&^#hi&_#hi&`#hi&a#hi&b#hi&c#hi&d#hi&e#hi&f#hi&g#hi&h#hi&i#hi&j#hi%Z#hi%_#hi~Ot)iOP#kiV#kif#kih#kio#kis#kiv#ki!P#ki!Q#ki!T#ki!U#ki!X#ki!]#ki!h#ki!r#ki!s#ki!t#ki!{#ki!}#ki#P#ki#R#ki#T#ki#X#ki#Z#ki#^#ki#_#ki#a#ki#c#ki#l#ki#o#ki#s#ki#u#ki#z#ki#}#ki$P#ki%X#ki%o#ki%p#ki%t#ki%u#ki&Z#ki&[#ki&]#ki&^#ki&_#ki&`#ki&a#ki&b#ki&c#ki&d#ki&e#ki&f#ki&g#ki&h#ki&i#ki&j#ki%Z#ki%_#ki~OV)kOn&wa~P'vOz)lOn&wa~Oz)lOn&wa~P%SOn)pO~O%Y)tO~Ot)wO#p'WO#q)vOP#niV#nif#nih#nio#nis#niv#ni!P#ni!Q#ni!T#ni!U#ni!X#ni!]#ni!h#ni!r#ni!s#ni!t#ni!{#ni!}#ni#P#ni#R#ni#T#ni#X#ni#Z#ni#^#ni#_#ni#a#ni#c#ni#l#ni#o#ni#s#ni#u#ni#z#ni#}#ni$P#ni%X#ni%o#ni%p#ni%t#ni%u#ni&Z#ni&[#ni&]#ni&^#ni&_#ni&`#ni&a#ni&b#ni&c#ni&d#ni&e#ni&f#ni&g#ni&h#ni&i#ni&j#ni%Z#ni%_#ni~OV)zOo0cOv0qO{$jO~P'vOo0cOv0qO{&xa~P'vOz*OO{&xa~OV*SOa*TOg*WO%q*UO%uWO~O{$jO&{*YO~Oh'_O~Oh!iO{$jO~O%[*_O~O%[*aO%_*aO~OV$}Oa$}Oo0cOv0qOg&Ua~P'vOz*dOg&Ua~Oo0cOv0qO{*gO!W&Xa~P'vOz*hO!W&Xa~Oo0cOv0qOz*hO{*kO!W&Xa~P'vOo0cOv0qOz*hO!W&Xa~P'vOz*hO{*kO!W&Xa~Om0dOn0dOo0mOp0nOgjikjisjizji!Tji!Uji%{ji!Wji{ji![ji#gji%[ji%_ji!Qji#[jitji!mji%zji~Ol0fO~P!NkOlji~P!NkOV'|Og*pOo0cOv0qO~P'vOn*rO~Og*pOz*tO~Og*uO~OV'|Oo0cOv0qO!W&Si~P'vOz*vO!W&Si~O!W*wO~OV(]Oo0cOv0qO![%}i#g%}i%[%}i%_%}ig%}i{%}i!m%}i%z%}i~P'vOz*zO!T%dO!U%cO![&Ti~Oz*}O![%}i#g%}i%[%}i%_%}ig%}i{%}i!m%}i%z%}i~O![+OO~Oa+QOo0cOv0qO![&Ti~P'vOz*zO![&Ti~O![+SO~OV+UOo0cOv0qO{&la![&la!m&la%z&la~P'vOz+VO{&la![&la!m&la%z&la~O!]+YO&n+[O![!nX~O![+^O~O{(kO![+_O~O{(kO![+_O!m+`O~OV&OOopOvqO{%hq!x%hq#g%hq%[%hq%_%hq%z%hq~P'vOz$ri{$ri!x$ri#g$ri%[$ri%_$ri%z$ri~P%SOV&OOopOvqO~P'vOV&OOo0cOv0qO#g%ha%[%ha%_%ha%z%ha~P'vOz+aO#g%ha%[%ha%_%ha%z%ha~Oz$ia#g$ia%[$ia%_$ian$ia~P%SO#g&Pi%[&Pi%_&Pin&Pi~P'vOz+dO#g#Wq%[#Wq%_#Wq~O#[+eOz$va#g$va%[$va%_$vag$va~O%uWO#g&ri%[&ri%_&rig&ri~Oz+gO#g&ri%[&ri%_&rig&ri~OV+iOh$WO%uWO~O%uWO#g&ti%[&ti%_&ti~Oo0cOv0qO#g&pi%[&pi%_&pi{&pi~P'vO{#{Oz#eX!W#eX~Oz+mO!W&uX~O!W+oO~Ot+rO#j)gOP#hqV#hqf#hqh#hqo#hqs#hqv#hq!P#hq!Q#hq!T#hq!U#hq!X#hq!]#hq!h#hq!r#hq!s#hq!t#hq!{#hq!}#hq#P#hq#R#hq#T#hq#X#hq#Z#hq#^#hq#_#hq#a#hq#c#hq#l#hq#o#hq#s#hq#u#hq#z#hq#}#hq$P#hq%X#hq%o#hq%p#hq%t#hq%u#hq&Z#hq&[#hq&]#hq&^#hq&_#hq&`#hq&a#hq&b#hq&c#hq&d#hq&e#hq&f#hq&g#hq&h#hq&i#hq&j#hq%Z#hq%_#hq~On$|az$|a~P%SOV)kOn&wi~P'vOz+yOn&wi~Oz,TO{$jO#[,TO~O#q,VOP#nqV#nqf#nqh#nqo#nqs#nqv#nq!P#nq!Q#nq!T#nq!U#nq!X#nq!]#nq!h#nq!r#nq!s#nq!t#nq!{#nq!}#nq#P#nq#R#nq#T#nq#X#nq#Z#nq#^#nq#_#nq#a#nq#c#nq#l#nq#o#nq#s#nq#u#nq#z#nq#}#nq$P#nq%X#nq%o#nq%p#nq%t#nq%u#nq&Z#nq&[#nq&]#nq&^#nq&_#nq&`#nq&a#nq&b#nq&c#nq&d#nq&e#nq&f#nq&g#nq&h#nq&i#nq&j#nq%Z#nq%_#nq~O#[,WOz%Oa{%Oa~Oo0cOv0qO{&xi~P'vOz,YO{&xi~O{#{O%z,[Og&zXz&zX~O%uWOg&zXz&zX~Oz,`Og&yX~Og,bO~O%Y,eO~O!T%dO!U%cOg&Viz&Vi~OV$}Oa$}Oo0cOv0qOg&Ui~P'vO{,hOz$la!W$la~Oo0cOv0qO{,iOz$la!W$la~P'vOo0cOv0qO{*gO!W&Xi~P'vOz,lO!W&Xi~Oo0cOv0qOz,lO!W&Xi~P'vOz,lO{,oO!W&Xi~Og$hiz$hi!W$hi~P%SOV'|Oo0cOv0qO~P'vOn,qO~OV'|Og,rOo0cOv0qO~P'vOV'|Oo0cOv0qO!W&Sq~P'vOz$gi![$gi#g$gi%[$gi%_$gig$gi{$gi!m$gi%z$gi~P%SOV(]Oo0cOv0qO~P'vOa+QOo0cOv0qO![&Tq~P'vOz,sO![&Tq~O![,tO~OV(]Oo0cOv0qO![%}q#g%}q%[%}q%_%}qg%}q{%}q!m%}q%z%}q~P'vO{,uO~OV+UOo0cOv0qO{&li![&li!m&li%z&li~P'vOz,zO{&li![&li!m&li%z&li~O!]+YO&n+[O![!na~O{(kO![,}O~OV&OOo0cOv0qO#g%hi%[%hi%_%hi%z%hi~P'vOz-OO#g%hi%[%hi%_%hi%z%hi~O%uWO#g&rq%[&rq%_&rqg&rq~Oz-RO#g&rq%[&rq%_&rqg&rq~OV)`Oa)`O%uWO!W&ua~Oz-TO!W&ua~On$|iz$|i~P%SOV)kO~P'vOV)kOn&wq~P'vOt-XOP#myV#myf#myh#myo#mys#myv#my!P#my!Q#my!T#my!U#my!X#my!]#my!h#my!r#my!s#my!t#my!{#my!}#my#P#my#R#my#T#my#X#my#Z#my#^#my#_#my#a#my#c#my#l#my#o#my#s#my#u#my#z#my#}#my$P#my%X#my%o#my%p#my%t#my%u#my&Z#my&[#my&]#my&^#my&_#my&`#my&a#my&b#my&c#my&d#my&e#my&f#my&g#my&h#my&i#my&j#my%Z#my%_#my~O%Z-]O%_-]O~P`O#q-^OP#nyV#nyf#nyh#nyo#nys#nyv#ny!P#ny!Q#ny!T#ny!U#ny!X#ny!]#ny!h#ny!r#ny!s#ny!t#ny!{#ny!}#ny#P#ny#R#ny#T#ny#X#ny#Z#ny#^#ny#_#ny#a#ny#c#ny#l#ny#o#ny#s#ny#u#ny#z#ny#}#ny$P#ny%X#ny%o#ny%p#ny%t#ny%u#ny&Z#ny&[#ny&]#ny&^#ny&_#ny&`#ny&a#ny&b#ny&c#ny&d#ny&e#ny&f#ny&g#ny&h#ny&i#ny&j#ny%Z#ny%_#ny~Oz-aO{$jO#[-aO~Oo0cOv0qO{&xq~P'vOz-dO{&xq~O%z,[Og&zaz&za~O{#{Og&zaz&za~OV*SOa*TO%q*UO%uWOg&ya~Oz-hOg&ya~O$S-lO~OV$}Oa$}Oo0cOv0qO~P'vOo0cOv0qO{-mOz$li!W$li~P'vOo0cOv0qOz$li!W$li~P'vO{-mOz$li!W$li~Oo0cOv0qO{*gO~P'vOo0cOv0qO{*gO!W&Xq~P'vOz-pO!W&Xq~Oo0cOv0qOz-pO!W&Xq~P'vOs-sO!T%dO!U%cOg&Oq!W&Oq![&Oqz&Oq~P!/jOa+QOo0cOv0qO![&Ty~P'vOz$ji![$ji~P%SOa+QOo0cOv0qO~P'vOV+UOo0cOv0qO~P'vOV+UOo0cOv0qO{&lq![&lq!m&lq%z&lq~P'vO{(kO![-xO!m-yO%z-wO~OV&OOo0cOv0qO#g%hq%[%hq%_%hq%z%hq~P'vO%uWO#g&ry%[&ry%_&ryg&ry~OV)`Oa)`O%uWO!W&ui~Ot-}OP#m!RV#m!Rf#m!Rh#m!Ro#m!Rs#m!Rv#m!R!P#m!R!Q#m!R!T#m!R!U#m!R!X#m!R!]#m!R!h#m!R!r#m!R!s#m!R!t#m!R!{#m!R!}#m!R#P#m!R#R#m!R#T#m!R#X#m!R#Z#m!R#^#m!R#_#m!R#a#m!R#c#m!R#l#m!R#o#m!R#s#m!R#u#m!R#z#m!R#}#m!R$P#m!R%X#m!R%o#m!R%p#m!R%t#m!R%u#m!R&Z#m!R&[#m!R&]#m!R&^#m!R&_#m!R&`#m!R&a#m!R&b#m!R&c#m!R&d#m!R&e#m!R&f#m!R&g#m!R&h#m!R&i#m!R&j#m!R%Z#m!R%_#m!R~Oo0cOv0qO{&xy~P'vOV*SOa*TO%q*UO%uWOg&yi~O$S-lO%Z.VO%_.VO~OV.aOh._O!X.^O!].`O!h.YO!s.[O!t.[O%p.XO%uWO&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O~Oo0cOv0qOz$lq!W$lq~P'vO{.fOz$lq!W$lq~Oo0cOv0qO{*gO!W&Xy~P'vOz.gO!W&Xy~Oo0cOv.kO~P'vOs-sO!T%dO!U%cOg&Oy!W&Oy![&Oyz&Oy~P!/jO{(kO![.nO~O{(kO![.nO!m.oO~OV*SOa*TO%q*UO%uWO~Oh.tO!f.rOz$TX#[$TX%j$TXg$TX~Os$TX{$TX!W$TX![$TX~P$-bO%o.vO%p.vOs$UXz$UX{$UX#[$UX%j$UX!W$UXg$UX![$UX~O!h.xO~Oz.|O#[/OO%j.yOs&|X{&|X!W&|Xg&|X~Oa/RO~P$)zOh.tOs&}Xz&}X{&}X#[&}X%j&}X!W&}Xg&}X![&}X~Os/VO{$jO~Oo0cOv0qOz$ly!W$ly~P'vOo0cOv0qO{*gO!W&X!R~P'vOz/ZO!W&X!R~Og&RXs&RX!T&RX!U&RX!W&RX![&RXz&RX~P!/jOs-sO!T%dO!U%cOg&Qa!W&Qa![&Qaz&Qa~O{(kO![/^O~O!f.rOh$[as$[az$[a{$[a#[$[a%j$[a!W$[ag$[a![$[a~O!h/eO~O%o.vO%p.vOs$Uaz$Ua{$Ua#[$Ua%j$Ua!W$Uag$Ua![$Ua~O%j.yOs$Yaz$Ya{$Ya#[$Ya!W$Yag$Ya![$Ya~Os&|a{&|a!W&|ag&|a~P$)nOz/jOs&|a{&|a!W&|ag&|a~O!W/mO~Og/mO~O{/oO~O![/pO~Oo0cOv0qO{*gO!W&X!Z~P'vO{/sO~O%z/tO~P$-bOz/uO#[/OO%j.yOg'PX~Oz/uOg'PX~Og/wO~O!h/xO~O#[/OOs%Saz%Sa{%Sa%j%Sa!W%Sag%Sa![%Sa~O#[/OO%j.yOs%Waz%Wa{%Wa!W%Wag%Wa~Os&|i{&|i!W&|ig&|i~P$)nOz/zO#[/OO%j.yO!['Oa~Og'Pa~P$)nOz0SOg'Pa~Oa0UO!['Oi~P$)zOz0WO!['Oi~Oz0WO#[/OO%j.yO!['Oi~O#[/OO%j.yOg$biz$bi~O%z0ZO~P$-bO#[/OO%j.yOg%Vaz%Va~Og'Pi~P$)nO{0^O~Oa0UO!['Oq~P$)zOz0`O!['Oq~O#[/OO%j.yOz%Ui![%Ui~Oa0UO~P$)zOa0UO!['Oy~P$)zO#[/OO%j.yOg$ciz$ci~O#[/OO%j.yOz%Uq![%Uq~Oz+aO#g%ha%[%ha%_%ha%z%ha~P%SOV&OOo0cOv0qO~P'vOn0hO~Oo0hO~P'vO{0iO~Ot0jO~P!/jO&]&Z&j&h&i&g&f&d&e&c&b&`&a&_&^&[%u~",goto:"!=j'QPPPPPP'RP'Z*s+[+t,_,y-fP.SP'Z.r.r'ZPPP'Z2[PPPPPP2[5PPP5PP7b7k=sPP=v>h>kPP'Z'ZPP>zPP'Z'ZPP'Z'Z'Z'Z'Z?O?w'ZP?zP@QDXGuGyPG|HWH['ZPPPH_Hk'RP'R'RP'RP'RP'RP'RP'R'R'RP'RPP'RPP'RP'RPHqH}IVPI^IdPI^PI^I^PPPI^PKrPK{LVL]KrPI^LfPI^PLmLsPLwM]MzNeLwLwNkNxLwLwLwLw! ^! d! g! l! o! y!!P!!]!!o!!u!#P!#V!#s!#y!$P!$Z!$a!$g!$y!%T!%Z!%a!%k!%q!%w!%}!&T!&Z!&e!&k!&u!&{!'U!'[!'k!'s!'}!(UPPPPPPPPPPP!([!(_!(e!(n!(x!)TPPPPPPPPPPPP!-u!/Z!3^!6oPP!6w!7W!7a!8Y!8P!8c!8i!8l!8o!8r!8z!9jPPPPPPPPPPPPPPPPP!9m!9q!9wP!:]!:a!:m!:v!;S!;j!;m!;p!;v!;|!_![!]Do!]!^Es!^!_FZ!_!`Gk!`!aHX!a!b%T!b!cIf!c!dJU!d!eK^!e!hJU!h!i!#f!i!tJU!t!u!,|!u!wJU!w!x!.t!x!}JU!}#O!0S#O#P&o#P#Q!0j#Q#R!1Q#R#SJU#S#T%T#T#UJU#U#VK^#V#YJU#Y#Z!#f#Z#fJU#f#g!,|#g#iJU#i#j!.t#j#oJU#o#p!1n#p#q!1s#q#r!2a#r#s!2f#s$g%T$g;'SJU;'S;=`KW<%lOJU`%YT&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T`%lP;=`<%l%To%v]&n`%c_OX%TXY%oY[%T[]%o]p%Tpq%oq#O%T#O#P&o#P#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To&tX&n`OY%TYZ%oZ]%T]^%o^#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc'f[&n`O!_%T!_!`([!`#T%T#T#U(r#U#f%T#f#g(r#g#h(r#h#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc(cTmR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc(yT!mR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk)aV&n`&[ZOr%Trs)vs#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk){V&n`Or%Trs*bs#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk*iT&n`&^ZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To+PZS_&n`OY*xYZ%TZ]*x]^%T^#o*x#o#p+r#p#q*x#q#r+r#r;'S*x;'S;=`,^<%lO*x_+wTS_OY+rZ]+r^;'S+r;'S;=`,W<%lO+r_,ZP;=`<%l+ro,aP;=`<%l*xj,kV%rQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj-XT!xY&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj-oV%lQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk.]V&n`&ZZOw%Twx.rx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk.wV&n`Ow%Twx/^x#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk/eT&n`&]ZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk/{ThZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc0cTgR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk0yXVZ&n`Oz%Tz{1f{!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk1mVaR&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk2ZV%oZ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc2wTzR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To3_W%pZ&n`O!_%T!_!`-Q!`!a3w!a#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Td4OT&{S&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk4fX!fQ&n`O!O%T!O!P5R!P!Q%T!Q![6T![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk5WV&n`O!O%T!O!P5m!P#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk5tT!rZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti6[a!hX&n`O!Q%T!Q![6T![!g%T!g!h7a!h!l%T!l!m9s!m#R%T#R#S6T#S#X%T#X#Y7a#Y#^%T#^#_9s#_#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti7fZ&n`O{%T{|8X|}%T}!O8X!O!Q%T!Q![8s![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti8^V&n`O!Q%T!Q![8s![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti8z]!hX&n`O!Q%T!Q![8s![!l%T!l!m9s!m#R%T#R#S8s#S#^%T#^#_9s#_#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti9zT!hX&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk:bX%qR&n`O!P%T!P!Q:}!Q!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj;UV%sQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti;ro!hX&n`O!O%T!O!P=s!P!Q%T!Q![>_![!d%T!d!e?q!e!g%T!g!h7a!h!l%T!l!m9s!m!q%T!q!rA]!r!z%T!z!{Bq!{#R%T#R#S>_#S#U%T#U#V?q#V#X%T#X#Y7a#Y#^%T#^#_9s#_#c%T#c#dA]#d#l%T#l#mBq#m#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti=xV&n`O!Q%T!Q![6T![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti>fc!hX&n`O!O%T!O!P=s!P!Q%T!Q![>_![!g%T!g!h7a!h!l%T!l!m9s!m#R%T#R#S>_#S#X%T#X#Y7a#Y#^%T#^#_9s#_#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti?vY&n`O!Q%T!Q!R@f!R!S@f!S#R%T#R#S@f#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti@mY!hX&n`O!Q%T!Q!R@f!R!S@f!S#R%T#R#S@f#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiAbX&n`O!Q%T!Q!YA}!Y#R%T#R#SA}#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiBUX!hX&n`O!Q%T!Q!YA}!Y#R%T#R#SA}#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiBv]&n`O!Q%T!Q![Co![!c%T!c!iCo!i#R%T#R#SCo#S#T%T#T#ZCo#Z#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiCv]!hX&n`O!Q%T!Q![Co![!c%T!c!iCo!i#R%T#R#SCo#S#T%T#T#ZCo#Z#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%ToDvV{_&n`O!_%T!_!`E]!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TcEdT%{R&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkEzT#gZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkFbXmR&n`O!^%T!^!_F}!_!`([!`!a([!a#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TjGUV%mQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkGrV%zZ&n`O!_%T!_!`([!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkH`WmR&n`O!_%T!_!`([!`!aHx!a#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TjIPV%nQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkIoV_Q#}P&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%ToJ_]&n`&YS%uZO!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUoKZP;=`<%lJUoKge&n`&YS%uZOr%Trs)Ysw%Twx.Ux!Q%T!Q![JU![!c%T!c!tJU!t!uLx!u!}JU!}#R%T#R#SJU#S#T%T#T#fJU#f#gLx#g#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUoMRa&n`&YS%uZOr%TrsNWsw%Twx! vx!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUkN_V&n`&`ZOr%TrsNts#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkNyV&n`Or%Trs! `s#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk! gT&n`&bZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk! }V&n`&_ZOw%Twx!!dx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!!iV&n`Ow%Twx!#Ox#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!#VT&n`&aZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To!#oe&n`&YS%uZOr%Trs!%Qsw%Twx!&px!Q%T!Q![JU![!c%T!c!tJU!t!u!(`!u!}JU!}#R%T#R#SJU#S#T%T#T#fJU#f#g!(`#g#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUk!%XV&n`&dZOr%Trs!%ns#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!%sV&n`Or%Trs!&Ys#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!&aT&n`&fZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!&wV&n`&cZOw%Twx!'^x#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!'cV&n`Ow%Twx!'xx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!(PT&n`&eZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To!(ia&n`&YS%uZOr%Trs!)nsw%Twx!+^x!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUk!)uV&n`&hZOr%Trs!*[s#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!*aV&n`Or%Trs!*vs#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!*}T&n`&jZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!+eV&n`&gZOw%Twx!+zx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!,PV&n`Ow%Twx!,fx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!,mT&n`&iZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To!-Vi&n`&YS%uZOr%TrsNWsw%Twx! vx!Q%T!Q![JU![!c%T!c!dJU!d!eLx!e!hJU!h!i!(`!i!}JU!}#R%T#R#SJU#S#T%T#T#UJU#U#VLx#V#YJU#Y#Z!(`#Z#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUo!.}a&n`&YS%uZOr%Trs)Ysw%Twx.Ux!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUk!0ZT!XZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc!0qT!WR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj!1XV%kQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T~!1sO!]~k!1zV%jR&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T~!2fO![~i!2mT%tX&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T",tokenizers:[Gde,Hde,Qde,Xde,0,1,2,3,4],topRules:{Script:[0,5]},specialized:[{term:221,get:t=>Zde[t]||-1}],tokenPrec:7668}),RE=new gae,aF=new Set(["Script","Body","FunctionDefinition","ClassDefinition","LambdaExpression","ForStatement","MatchClause"]);function yx(t){return(e,n,r)=>{if(r)return!1;let s=e.node.getChild("VariableName");return s&&n(s,t),!0}}const ehe={FunctionDefinition:yx("function"),ClassDefinition:yx("class"),ForStatement(t,e,n){if(n){for(let r=t.node.firstChild;r;r=r.nextSibling)if(r.name=="VariableName")e(r,"variable");else if(r.name=="in")break}},ImportStatement(t,e){var n,r;let{node:s}=t,i=((n=s.firstChild)===null||n===void 0?void 0:n.name)=="from";for(let a=s.getChild("import");a;a=a.nextSibling)a.name=="VariableName"&&((r=a.nextSibling)===null||r===void 0?void 0:r.name)!="as"&&e(a,i?"variable":"namespace")},AssignStatement(t,e){for(let n=t.node.firstChild;n;n=n.nextSibling)if(n.name=="VariableName")e(n,"variable");else if(n.name==":"||n.name=="AssignOp")break},ParamList(t,e){for(let n=null,r=t.node.firstChild;r;r=r.nextSibling)r.name=="VariableName"&&(!n||!/\*|AssignOp/.test(n.name))&&e(r,"variable"),n=r},CapturePattern:yx("variable"),AsPattern:yx("variable"),__proto__:null};function lF(t,e){let n=RE.get(e);if(n)return n;let r=[],s=!0;function i(a,o){let c=t.sliceString(a.from,a.to);r.push({label:c,type:o})}return e.cursor(Ur.IncludeAnonymous).iterate(a=>{if(a.name){let o=ehe[a.name];if(o&&o(a,i,s)||!s&&aF.has(a.name))return!1;s=!1}else if(a.to-a.from>8192){for(let o of lF(t,a.node))r.push(o);return!1}}),RE.set(e,r),r}const DE=/^[\w\xa1-\uffff][\w\d\xa1-\uffff]*$/,oF=["String","FormatString","Comment","PropertyName"];function the(t){let e=ns(t.state).resolveInner(t.pos,-1);if(oF.indexOf(e.name)>-1)return null;let n=e.name=="VariableName"||e.to-e.from<20&&DE.test(t.state.sliceDoc(e.from,e.to));if(!n&&!t.explicit)return null;let r=[];for(let s=e;s;s=s.parent)aF.has(s.name)&&(r=r.concat(lF(t.state.doc,s)));return{options:r,from:n?e.from:t.pos,validFor:DE}}const nhe=["__annotations__","__builtins__","__debug__","__doc__","__import__","__name__","__loader__","__package__","__spec__","False","None","True"].map(t=>({label:t,type:"constant"})).concat(["ArithmeticError","AssertionError","AttributeError","BaseException","BlockingIOError","BrokenPipeError","BufferError","BytesWarning","ChildProcessError","ConnectionAbortedError","ConnectionError","ConnectionRefusedError","ConnectionResetError","DeprecationWarning","EOFError","Ellipsis","EncodingWarning","EnvironmentError","Exception","FileExistsError","FileNotFoundError","FloatingPointError","FutureWarning","GeneratorExit","IOError","ImportError","ImportWarning","IndentationError","IndexError","InterruptedError","IsADirectoryError","KeyError","KeyboardInterrupt","LookupError","MemoryError","ModuleNotFoundError","NameError","NotADirectoryError","NotImplemented","NotImplementedError","OSError","OverflowError","PendingDeprecationWarning","PermissionError","ProcessLookupError","RecursionError","ReferenceError","ResourceWarning","RuntimeError","RuntimeWarning","StopAsyncIteration","StopIteration","SyntaxError","SyntaxWarning","SystemError","SystemExit","TabError","TimeoutError","TypeError","UnboundLocalError","UnicodeDecodeError","UnicodeEncodeError","UnicodeError","UnicodeTranslateError","UnicodeWarning","UserWarning","ValueError","Warning","ZeroDivisionError"].map(t=>({label:t,type:"type"}))).concat(["bool","bytearray","bytes","classmethod","complex","float","frozenset","int","list","map","memoryview","object","range","set","staticmethod","str","super","tuple","type"].map(t=>({label:t,type:"class"}))).concat(["abs","aiter","all","anext","any","ascii","bin","breakpoint","callable","chr","compile","delattr","dict","dir","divmod","enumerate","eval","exec","exit","filter","format","getattr","globals","hasattr","hash","help","hex","id","input","isinstance","issubclass","iter","len","license","locals","max","min","next","oct","open","ord","pow","print","property","quit","repr","reversed","round","setattr","slice","sorted","sum","vars","zip"].map(t=>({label:t,type:"function"}))),rhe=[Ql("def ${name}(${params}):\n ${}",{label:"def",detail:"function",type:"keyword"}),Ql("for ${name} in ${collection}:\n ${}",{label:"for",detail:"loop",type:"keyword"}),Ql("while ${}:\n ${}",{label:"while",detail:"loop",type:"keyword"}),Ql("try:\n ${}\nexcept ${error}:\n ${}",{label:"try",detail:"/ except block",type:"keyword"}),Ql(`if \${}: +`);r>-1&&(n=n.slice(0,r))}return e+n.length<=this.to?n:n.slice(0,this.to-e)}nextLine(){let e=this.parsedPos,n=this.lineAfter(e),r=e+n.length;for(let s=this.rangeIndex;;){let i=this.ranges[s].to;if(i>=r||(n=n.slice(0,i-(r-n.length)),s++,s==this.ranges.length))break;let a=this.ranges[s].from,o=this.lineAfter(a);n+=o,r=a+o.length}return{line:n,end:r}}skipGapsTo(e,n,r){for(;;){let s=this.ranges[this.rangeIndex].to,i=e+n;if(r>0?s>i:s>=i)break;let a=this.ranges[++this.rangeIndex].from;n+=a-s}return n}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to1){s=this.skipGapsTo(n,s,1),n+=s;let o=this.chunk.length;s=this.skipGapsTo(r,s,-1),r+=s,i+=this.chunk.length-o}let a=this.chunk.length-4;return this.lang.streamParser.mergeTokens&&i==4&&a>=0&&this.chunk[a]==e&&this.chunk[a+2]==n?this.chunk[a+2]=r:this.chunk.push(e,n,r,i),s}parseLine(e){let{line:n,end:r}=this.nextLine(),s=0,{streamParser:i}=this.lang,a=new QB(n,e?e.state.tabSize:4,e?Du(e.state):2);if(a.eol())i.blankLine(this.state,a.indentUnit);else for(;!a.eol();){let o=VB(i.token,a,this.state);if(o&&(s=this.emitToken(this.lang.tokenTable.resolve(o),this.parsedPos+a.start,this.parsedPos+a.pos,s)),a.start>1e4)break}this.parsedPos=r,this.moveRangeIndex(),this.parsedPose.start)return s}throw new Error("Stream parser failed to advance stream.")}const Z6=Object.create(null),s0=[qs.none],vle=new Jv(s0),FT=[],$T=Object.create(null),UB=Object.create(null);for(let[t,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])UB[t]=GB(Z6,e);class WB{constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),UB)}resolve(e){return e?this.table[e]||(this.table[e]=GB(this.extra,e)):0}}const yle=new WB(Z6);function Pw(t,e){FT.indexOf(t)>-1||(FT.push(t),console.warn(e))}function GB(t,e){let n=[];for(let o of e.split(" ")){let c=[];for(let h of o.split(".")){let f=t[h]||xe[h];f?typeof f=="function"?c.length?c=c.map(f):Pw(h,`Modifier ${h} used at start of tag`):c.length?Pw(h,`Tag ${h} used as modifier`):c=Array.isArray(f)?f:[f]:Pw(h,`Unknown highlighting tag ${h}`)}for(let h of c)n.push(h)}if(!n.length)return 0;let r=e.replace(/ /g,"_"),s=r+" "+n.map(o=>o.id),i=$T[s];if(i)return i.id;let a=$T[s]=qs.define({id:s0.length,name:r,props:[U6({[r]:n})]});return s0.push(a),a.id}function ble(t,e){let n=qs.define({id:s0.length,name:"Document",props:[gu.add(()=>t),ty.add(()=>r=>e.getIndent(r))],top:!0});return s0.push(n),n}sr.RTL,sr.LTR;const wle=t=>{let{state:e}=t,n=e.doc.lineAt(e.selection.main.from),r=ej(t.state,n.from);return r.line?Sle(t):r.block?jle(t):!1};function J6(t,e){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let s=t(e,n);return s?(r(n.update(s)),!0):!1}}const Sle=J6(Cle,0),kle=J6(XB,0),jle=J6((t,e)=>XB(t,e,Nle(e)),0);function ej(t,e){let n=t.languageDataAt("commentTokens",e,1);return n.length?n[0]:{}}const nm=50;function Ole(t,{open:e,close:n},r,s){let i=t.sliceDoc(r-nm,r),a=t.sliceDoc(s,s+nm),o=/\s*$/.exec(i)[0].length,c=/^\s*/.exec(a)[0].length,h=i.length-o;if(i.slice(h-e.length,h)==e&&a.slice(c,c+n.length)==n)return{open:{pos:r-o,margin:o&&1},close:{pos:s+c,margin:c&&1}};let f,m;s-r<=2*nm?f=m=t.sliceDoc(r,s):(f=t.sliceDoc(r,r+nm),m=t.sliceDoc(s-nm,s));let g=/^\s*/.exec(f)[0].length,x=/\s*$/.exec(m)[0].length,y=m.length-x-n.length;return f.slice(g,g+e.length)==e&&m.slice(y,y+n.length)==n?{open:{pos:r+g+e.length,margin:/\s/.test(f.charAt(g+e.length))?1:0},close:{pos:s-x-n.length,margin:/\s/.test(m.charAt(y-1))?1:0}}:null}function Nle(t){let e=[];for(let n of t.selection.ranges){let r=t.doc.lineAt(n.from),s=n.to<=r.to?r:t.doc.lineAt(n.to);s.from>r.from&&s.from==n.to&&(s=n.to==r.to+1?r:t.doc.lineAt(n.to-1));let i=e.length-1;i>=0&&e[i].to>r.from?e[i].to=s.to:e.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:s.to})}return e}function XB(t,e,n=e.selection.ranges){let r=n.map(i=>ej(e,i.from).block);if(!r.every(i=>i))return null;let s=n.map((i,a)=>Ole(e,r[a],i.from,i.to));if(t!=2&&!s.every(i=>i))return{changes:e.changes(n.map((i,a)=>s[a]?[]:[{from:i.from,insert:r[a].open+" "},{from:i.to,insert:" "+r[a].close}]))};if(t!=1&&s.some(i=>i)){let i=[];for(let a=0,o;as&&(i==a||a>m.from)){s=m.from;let g=/^\s*/.exec(m.text)[0].length,x=g==m.length,y=m.text.slice(g,g+h.length)==h?g:-1;gi.comment<0&&(!i.empty||i.single))){let i=[];for(let{line:o,token:c,indent:h,empty:f,single:m}of r)(m||!f)&&i.push({from:o.from+h,insert:c+" "});let a=e.changes(i);return{changes:a,selection:e.selection.map(a,1)}}else if(t!=1&&r.some(i=>i.comment>=0)){let i=[];for(let{line:a,comment:o,token:c}of r)if(o>=0){let h=a.from+o,f=h+c.length;a.text[f-a.from]==" "&&f++,i.push({from:h,to:f})}return{changes:i}}return null}const BS=pl.define(),Tle=pl.define(),Ele=nt.define(),YB=nt.define({combine(t){return gl(t,{minDepth:100,newGroupDelay:500,joinToEvent:(e,n)=>n},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,n)=>(r,s)=>e(r,s)||n(r,s)})}}),KB=us.define({create(){return sl.empty},update(t,e){let n=e.state.facet(YB),r=e.annotation(BS);if(r){let c=ri.fromTransaction(e,r.selection),h=r.side,f=h==0?t.undone:t.done;return c?f=U1(f,f.length,n.minDepth,c):f=eq(f,e.startState.selection),new sl(h==0?r.rest:f,h==0?f:r.rest)}let s=e.annotation(Tle);if((s=="full"||s=="before")&&(t=t.isolate()),e.annotation($r.addToHistory)===!1)return e.changes.empty?t:t.addMapping(e.changes.desc);let i=ri.fromTransaction(e),a=e.annotation($r.time),o=e.annotation($r.userEvent);return i?t=t.addChanges(i,a,o,n,e):e.selection&&(t=t.addSelection(e.startState.selection,a,o,n.newGroupDelay)),(s=="full"||s=="after")&&(t=t.isolate()),t},toJSON(t){return{done:t.done.map(e=>e.toJSON()),undone:t.undone.map(e=>e.toJSON())}},fromJSON(t){return new sl(t.done.map(ri.fromJSON),t.undone.map(ri.fromJSON))}});function _le(t={}){return[KB,YB.of(t),Ke.domEventHandlers({beforeinput(e,n){let r=e.inputType=="historyUndo"?ZB:e.inputType=="historyRedo"?qS:null;return r?(e.preventDefault(),r(n)):!1}})]}function ry(t,e){return function({state:n,dispatch:r}){if(!e&&n.readOnly)return!1;let s=n.field(KB,!1);if(!s)return!1;let i=s.pop(t,n,e);return i?(r(i),!0):!1}}const ZB=ry(0,!1),qS=ry(1,!1),Mle=ry(0,!0),Ale=ry(1,!0);class ri{constructor(e,n,r,s,i){this.changes=e,this.effects=n,this.mapped=r,this.startSelection=s,this.selectionsAfter=i}setSelAfter(e){return new ri(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,n,r;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(n=this.mapped)===null||n===void 0?void 0:n.toJSON(),startSelection:(r=this.startSelection)===null||r===void 0?void 0:r.toJSON(),selectionsAfter:this.selectionsAfter.map(s=>s.toJSON())}}static fromJSON(e){return new ri(e.changes&&Kr.fromJSON(e.changes),[],e.mapped&&cl.fromJSON(e.mapped),e.startSelection&&Ae.fromJSON(e.startSelection),e.selectionsAfter.map(Ae.fromJSON))}static fromTransaction(e,n){let r=Ji;for(let s of e.startState.facet(Ele)){let i=s(e);i.length&&(r=r.concat(i))}return!r.length&&e.changes.empty?null:new ri(e.changes.invert(e.startState.doc),r,void 0,n||e.startState.selection,Ji)}static selection(e){return new ri(void 0,Ji,void 0,void 0,e)}}function U1(t,e,n,r){let s=e+1>n+20?e-n-1:0,i=t.slice(s,e);return i.push(r),i}function Rle(t,e){let n=[],r=!1;return t.iterChangedRanges((s,i)=>n.push(s,i)),e.iterChangedRanges((s,i,a,o)=>{for(let c=0;c=h&&a<=f&&(r=!0)}}),r}function Dle(t,e){return t.ranges.length==e.ranges.length&&t.ranges.filter((n,r)=>n.empty!=e.ranges[r].empty).length===0}function JB(t,e){return t.length?e.length?t.concat(e):t:e}const Ji=[],zle=200;function eq(t,e){if(t.length){let n=t[t.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-zle));return r.length&&r[r.length-1].eq(e)?t:(r.push(e),U1(t,t.length-1,1e9,n.setSelAfter(r)))}else return[ri.selection([e])]}function Ple(t){let e=t[t.length-1],n=t.slice();return n[t.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),n}function Lw(t,e){if(!t.length)return t;let n=t.length,r=Ji;for(;n;){let s=Lle(t[n-1],e,r);if(s.changes&&!s.changes.empty||s.effects.length){let i=t.slice(0,n);return i[n-1]=s,i}else e=s.mapped,n--,r=s.selectionsAfter}return r.length?[ri.selection(r)]:Ji}function Lle(t,e,n){let r=JB(t.selectionsAfter.length?t.selectionsAfter.map(o=>o.map(e)):Ji,n);if(!t.changes)return ri.selection(r);let s=t.changes.map(e),i=e.mapDesc(t.changes,!0),a=t.mapped?t.mapped.composeDesc(i):i;return new ri(s,Lt.mapEffects(t.effects,e),a,t.startSelection.map(i),r)}const Ile=/^(input\.type|delete)($|\.)/;class sl{constructor(e,n,r=0,s=void 0){this.done=e,this.undone=n,this.prevTime=r,this.prevUserEvent=s}isolate(){return this.prevTime?new sl(this.done,this.undone):this}addChanges(e,n,r,s,i){let a=this.done,o=a[a.length-1];return o&&o.changes&&!o.changes.empty&&e.changes&&(!r||Ile.test(r))&&(!o.selectionsAfter.length&&n-this.prevTime0&&n-this.prevTimen.empty?t.moveByChar(n,e):sy(n,e))}function Es(t){return t.textDirectionAt(t.state.selection.main.head)==sr.LTR}const nq=t=>tq(t,!Es(t)),rq=t=>tq(t,Es(t));function sq(t,e){return La(t,n=>n.empty?t.moveByGroup(n,e):sy(n,e))}const qle=t=>sq(t,!Es(t)),Fle=t=>sq(t,Es(t));function $le(t,e,n){if(e.type.prop(n))return!0;let r=e.to-e.from;return r&&(r>2||/[^\s,.;:]/.test(t.sliceDoc(e.from,e.to)))||e.firstChild}function iy(t,e,n){let r=ls(t).resolveInner(e.head),s=n?Yt.closedBy:Yt.openedBy;for(let c=e.head;;){let h=n?r.childAfter(c):r.childBefore(c);if(!h)break;$le(t,h,s)?r=h:c=n?h.to:h.from}let i=r.type.prop(s),a,o;return i&&(a=n?rl(t,r.from,1):rl(t,r.to,-1))&&a.matched?o=n?a.end.to:a.end.from:o=n?r.to:r.from,Ae.cursor(o,n?-1:1)}const Qle=t=>La(t,e=>iy(t.state,e,!Es(t))),Hle=t=>La(t,e=>iy(t.state,e,Es(t)));function iq(t,e){return La(t,n=>{if(!n.empty)return sy(n,e);let r=t.moveVertically(n,e);return r.head!=n.head?r:t.moveToLineBoundary(n,e)})}const aq=t=>iq(t,!1),lq=t=>iq(t,!0);function oq(t){let e=t.scrollDOM.clientHeighta.empty?t.moveVertically(a,e,n.height):sy(a,e));if(s.eq(r.selection))return!1;let i;if(n.selfScroll){let a=t.coordsAtPos(r.selection.main.head),o=t.scrollDOM.getBoundingClientRect(),c=o.top+n.marginTop,h=o.bottom-n.marginBottom;a&&a.top>c&&a.bottomcq(t,!1),FS=t=>cq(t,!0);function Rc(t,e,n){let r=t.lineBlockAt(e.head),s=t.moveToLineBoundary(e,n);if(s.head==e.head&&s.head!=(n?r.to:r.from)&&(s=t.moveToLineBoundary(e,n,!1)),!n&&s.head==r.from&&r.length){let i=/^\s*/.exec(t.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;i&&e.head!=r.from+i&&(s=Ae.cursor(r.from+i))}return s}const Vle=t=>La(t,e=>Rc(t,e,!0)),Ule=t=>La(t,e=>Rc(t,e,!1)),Wle=t=>La(t,e=>Rc(t,e,!Es(t))),Gle=t=>La(t,e=>Rc(t,e,Es(t))),Xle=t=>La(t,e=>Ae.cursor(t.lineBlockAt(e.head).from,1)),Yle=t=>La(t,e=>Ae.cursor(t.lineBlockAt(e.head).to,-1));function Kle(t,e,n){let r=!1,s=$h(t.selection,i=>{let a=rl(t,i.head,-1)||rl(t,i.head,1)||i.head>0&&rl(t,i.head-1,1)||i.headKle(t,e);function ma(t,e){let n=$h(t.state.selection,r=>{let s=e(r);return Ae.range(r.anchor,s.head,s.goalColumn,s.bidiLevel||void 0)});return n.eq(t.state.selection)?!1:(t.dispatch(Pa(t.state,n)),!0)}function uq(t,e){return ma(t,n=>t.moveByChar(n,e))}const dq=t=>uq(t,!Es(t)),hq=t=>uq(t,Es(t));function fq(t,e){return ma(t,n=>t.moveByGroup(n,e))}const Jle=t=>fq(t,!Es(t)),eoe=t=>fq(t,Es(t)),toe=t=>ma(t,e=>iy(t.state,e,!Es(t))),noe=t=>ma(t,e=>iy(t.state,e,Es(t)));function mq(t,e){return ma(t,n=>t.moveVertically(n,e))}const pq=t=>mq(t,!1),gq=t=>mq(t,!0);function xq(t,e){return ma(t,n=>t.moveVertically(n,e,oq(t).height))}const HT=t=>xq(t,!1),VT=t=>xq(t,!0),roe=t=>ma(t,e=>Rc(t,e,!0)),soe=t=>ma(t,e=>Rc(t,e,!1)),ioe=t=>ma(t,e=>Rc(t,e,!Es(t))),aoe=t=>ma(t,e=>Rc(t,e,Es(t))),loe=t=>ma(t,e=>Ae.cursor(t.lineBlockAt(e.head).from)),ooe=t=>ma(t,e=>Ae.cursor(t.lineBlockAt(e.head).to)),UT=({state:t,dispatch:e})=>(e(Pa(t,{anchor:0})),!0),WT=({state:t,dispatch:e})=>(e(Pa(t,{anchor:t.doc.length})),!0),GT=({state:t,dispatch:e})=>(e(Pa(t,{anchor:t.selection.main.anchor,head:0})),!0),XT=({state:t,dispatch:e})=>(e(Pa(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0),coe=({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0),uoe=({state:t,dispatch:e})=>{let n=ay(t).map(({from:r,to:s})=>Ae.range(r,Math.min(s+1,t.doc.length)));return e(t.update({selection:Ae.create(n),userEvent:"select"})),!0},doe=({state:t,dispatch:e})=>{let n=$h(t.selection,r=>{let s=ls(t),i=s.resolveStack(r.from,1);if(r.empty){let a=s.resolveStack(r.from,-1);a.node.from>=i.node.from&&a.node.to<=i.node.to&&(i=a)}for(let a=i;a;a=a.next){let{node:o}=a;if((o.from=r.to||o.to>r.to&&o.from<=r.from)&&a.next)return Ae.range(o.to,o.from)}return r});return n.eq(t.selection)?!1:(e(Pa(t,n)),!0)};function vq(t,e){let{state:n}=t,r=n.selection,s=n.selection.ranges.slice();for(let i of n.selection.ranges){let a=n.doc.lineAt(i.head);if(e?a.to0)for(let o=i;;){let c=t.moveVertically(o,e);if(c.heada.to){s.some(h=>h.head==c.head)||s.push(c);break}else{if(c.head==o.head)break;o=c}}}return s.length==r.ranges.length?!1:(t.dispatch(Pa(n,Ae.create(s,s.length-1))),!0)}const hoe=t=>vq(t,!1),foe=t=>vq(t,!0),moe=({state:t,dispatch:e})=>{let n=t.selection,r=null;return n.ranges.length>1?r=Ae.create([n.main]):n.main.empty||(r=Ae.create([Ae.cursor(n.main.head)])),r?(e(Pa(t,r)),!0):!1};function np(t,e){if(t.state.readOnly)return!1;let n="delete.selection",{state:r}=t,s=r.changeByRange(i=>{let{from:a,to:o}=i;if(a==o){let c=e(i);ca&&(n="delete.forward",c=gx(t,c,!0)),a=Math.min(a,c),o=Math.max(o,c)}else a=gx(t,a,!1),o=gx(t,o,!0);return a==o?{range:i}:{changes:{from:a,to:o},range:Ae.cursor(a,as(t)))r.between(e,e,(s,i)=>{se&&(e=n?i:s)});return e}const yq=(t,e,n)=>np(t,r=>{let s=r.from,{state:i}=t,a=i.doc.lineAt(s),o,c;if(n&&!e&&s>a.from&&syq(t,!1,!0),bq=t=>yq(t,!0,!1),wq=(t,e)=>np(t,n=>{let r=n.head,{state:s}=t,i=s.doc.lineAt(r),a=s.charCategorizer(r);for(let o=null;;){if(r==(e?i.to:i.from)){r==n.head&&i.number!=(e?s.doc.lines:1)&&(r+=e?1:-1);break}let c=ys(i.text,r-i.from,e)+i.from,h=i.text.slice(Math.min(r,c)-i.from,Math.max(r,c)-i.from),f=a(h);if(o!=null&&f!=o)break;(h!=" "||r!=n.head)&&(o=f),r=c}return r}),Sq=t=>wq(t,!1),poe=t=>wq(t,!0),goe=t=>np(t,e=>{let n=t.lineBlockAt(e.head).to;return e.headnp(t,e=>{let n=t.moveToLineBoundary(e,!1).head;return e.head>n?n:Math.max(0,e.head-1)}),voe=t=>np(t,e=>{let n=t.moveToLineBoundary(e,!0).head;return e.head{if(t.readOnly)return!1;let n=t.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:pn.of(["",""])},range:Ae.cursor(r.from)}));return e(t.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},boe=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=t.changeByRange(r=>{if(!r.empty||r.from==0||r.from==t.doc.length)return{range:r};let s=r.from,i=t.doc.lineAt(s),a=s==i.from?s-1:ys(i.text,s-i.from,!1)+i.from,o=s==i.to?s+1:ys(i.text,s-i.from,!0)+i.from;return{changes:{from:a,to:o,insert:t.doc.slice(s,o).append(t.doc.slice(a,s))},range:Ae.cursor(o)}});return n.changes.empty?!1:(e(t.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function ay(t){let e=[],n=-1;for(let r of t.selection.ranges){let s=t.doc.lineAt(r.from),i=t.doc.lineAt(r.to);if(!r.empty&&r.to==i.from&&(i=t.doc.lineAt(r.to-1)),n>=s.number){let a=e[e.length-1];a.to=i.to,a.ranges.push(r)}else e.push({from:s.from,to:i.to,ranges:[r]});n=i.number+1}return e}function kq(t,e,n){if(t.readOnly)return!1;let r=[],s=[];for(let i of ay(t)){if(n?i.to==t.doc.length:i.from==0)continue;let a=t.doc.lineAt(n?i.to+1:i.from-1),o=a.length+1;if(n){r.push({from:i.to,to:a.to},{from:i.from,insert:a.text+t.lineBreak});for(let c of i.ranges)s.push(Ae.range(Math.min(t.doc.length,c.anchor+o),Math.min(t.doc.length,c.head+o)))}else{r.push({from:a.from,to:i.from},{from:i.to,insert:t.lineBreak+a.text});for(let c of i.ranges)s.push(Ae.range(c.anchor-o,c.head-o))}}return r.length?(e(t.update({changes:r,scrollIntoView:!0,selection:Ae.create(s,t.selection.mainIndex),userEvent:"move.line"})),!0):!1}const woe=({state:t,dispatch:e})=>kq(t,e,!1),Soe=({state:t,dispatch:e})=>kq(t,e,!0);function jq(t,e,n){if(t.readOnly)return!1;let r=[];for(let s of ay(t))n?r.push({from:s.from,insert:t.doc.slice(s.from,s.to)+t.lineBreak}):r.push({from:s.to,insert:t.lineBreak+t.doc.slice(s.from,s.to)});return e(t.update({changes:r,scrollIntoView:!0,userEvent:"input.copyline"})),!0}const koe=({state:t,dispatch:e})=>jq(t,e,!1),joe=({state:t,dispatch:e})=>jq(t,e,!0),Ooe=t=>{if(t.state.readOnly)return!1;let{state:e}=t,n=e.changes(ay(e).map(({from:s,to:i})=>(s>0?s--:i{let i;if(t.lineWrapping){let a=t.lineBlockAt(s.head),o=t.coordsAtPos(s.head,s.assoc||1);o&&(i=a.bottom+t.documentTop-o.bottom+t.defaultLineHeight/2)}return t.moveVertically(s,!0,i)}).map(n);return t.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0};function Noe(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let n=ls(t).resolveInner(e),r=n.childBefore(e),s=n.childAfter(e),i;return r&&s&&r.to<=e&&s.from>=e&&(i=r.type.prop(Yt.closedBy))&&i.indexOf(s.name)>-1&&t.doc.lineAt(r.to).from==t.doc.lineAt(s.from).from&&!/\S/.test(t.sliceDoc(r.to,s.from))?{from:r.to,to:s.from}:null}const YT=Oq(!1),Coe=Oq(!0);function Oq(t){return({state:e,dispatch:n})=>{if(e.readOnly)return!1;let r=e.changeByRange(s=>{let{from:i,to:a}=s,o=e.doc.lineAt(i),c=!t&&i==a&&Noe(e,i);t&&(i=a=(a<=o.to?o:e.doc.lineAt(a)).to);let h=new ey(e,{simulateBreak:i,simulateDoubleBreak:!!c}),f=W6(h,i);for(f==null&&(f=Fh(/^\s*/.exec(e.doc.lineAt(i).text)[0],e.tabSize));ao.from&&i{let s=[];for(let a=r.from;a<=r.to;){let o=t.doc.lineAt(a);o.number>n&&(r.empty||r.to>o.from)&&(e(o,s,r),n=o.number),a=o.to+1}let i=t.changes(s);return{changes:s,range:Ae.range(i.mapPos(r.anchor,1),i.mapPos(r.head,1))}})}const Toe=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=Object.create(null),r=new ey(t,{overrideIndentation:i=>{let a=n[i];return a??-1}}),s=tj(t,(i,a,o)=>{let c=W6(r,i.from);if(c==null)return;/\S/.test(i.text)||(c=0);let h=/^\s*/.exec(i.text)[0],f=r0(t,c);(h!=f||o.fromt.readOnly?!1:(e(t.update(tj(t,(n,r)=>{r.push({from:n.from,insert:t.facet(J0)})}),{userEvent:"input.indent"})),!0),Cq=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(tj(t,(n,r)=>{let s=/^\s*/.exec(n.text)[0];if(!s)return;let i=Fh(s,t.tabSize),a=0,o=r0(t,Math.max(0,i-Du(t)));for(;a(t.setTabFocusMode(),!0),_oe=[{key:"Ctrl-b",run:nq,shift:dq,preventDefault:!0},{key:"Ctrl-f",run:rq,shift:hq},{key:"Ctrl-p",run:aq,shift:pq},{key:"Ctrl-n",run:lq,shift:gq},{key:"Ctrl-a",run:Xle,shift:loe},{key:"Ctrl-e",run:Yle,shift:ooe},{key:"Ctrl-d",run:bq},{key:"Ctrl-h",run:$S},{key:"Ctrl-k",run:goe},{key:"Ctrl-Alt-h",run:Sq},{key:"Ctrl-o",run:yoe},{key:"Ctrl-t",run:boe},{key:"Ctrl-v",run:FS}],Moe=[{key:"ArrowLeft",run:nq,shift:dq,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:qle,shift:Jle,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:Wle,shift:ioe,preventDefault:!0},{key:"ArrowRight",run:rq,shift:hq,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:Fle,shift:eoe,preventDefault:!0},{mac:"Cmd-ArrowRight",run:Gle,shift:aoe,preventDefault:!0},{key:"ArrowUp",run:aq,shift:pq,preventDefault:!0},{mac:"Cmd-ArrowUp",run:UT,shift:GT},{mac:"Ctrl-ArrowUp",run:QT,shift:HT},{key:"ArrowDown",run:lq,shift:gq,preventDefault:!0},{mac:"Cmd-ArrowDown",run:WT,shift:XT},{mac:"Ctrl-ArrowDown",run:FS,shift:VT},{key:"PageUp",run:QT,shift:HT},{key:"PageDown",run:FS,shift:VT},{key:"Home",run:Ule,shift:soe,preventDefault:!0},{key:"Mod-Home",run:UT,shift:GT},{key:"End",run:Vle,shift:roe,preventDefault:!0},{key:"Mod-End",run:WT,shift:XT},{key:"Enter",run:YT,shift:YT},{key:"Mod-a",run:coe},{key:"Backspace",run:$S,shift:$S,preventDefault:!0},{key:"Delete",run:bq,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Sq,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:poe,preventDefault:!0},{mac:"Mod-Backspace",run:xoe,preventDefault:!0},{mac:"Mod-Delete",run:voe,preventDefault:!0}].concat(_oe.map(t=>({mac:t.key,run:t.run,shift:t.shift}))),Aoe=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:Qle,shift:toe},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:Hle,shift:noe},{key:"Alt-ArrowUp",run:woe},{key:"Shift-Alt-ArrowUp",run:koe},{key:"Alt-ArrowDown",run:Soe},{key:"Shift-Alt-ArrowDown",run:joe},{key:"Mod-Alt-ArrowUp",run:hoe},{key:"Mod-Alt-ArrowDown",run:foe},{key:"Escape",run:moe},{key:"Mod-Enter",run:Coe},{key:"Alt-l",mac:"Ctrl-l",run:uoe},{key:"Mod-i",run:doe,preventDefault:!0},{key:"Mod-[",run:Cq},{key:"Mod-]",run:Nq},{key:"Mod-Alt-\\",run:Toe},{key:"Shift-Mod-k",run:Ooe},{key:"Shift-Mod-\\",run:Zle},{key:"Mod-/",run:wle},{key:"Alt-A",run:kle},{key:"Ctrl-m",mac:"Shift-Alt-m",run:Eoe}].concat(Moe),Roe={key:"Tab",run:Nq,shift:Cq},KT=typeof String.prototype.normalize=="function"?t=>t.normalize("NFKD"):t=>t;class Oh{constructor(e,n,r=0,s=e.length,i,a){this.test=a,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(r,s),this.bufferStart=r,this.normalize=i?o=>i(KT(o)):KT,this.query=this.normalize(n)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return ei(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let n=C6(e),r=this.bufferStart+this.bufferPos;this.bufferPos+=Za(e);let s=this.normalize(n);if(s.length)for(let i=0,a=r;;i++){let o=s.charCodeAt(i),c=this.match(o,a,this.bufferPos+this.bufferStart);if(i==s.length-1){if(c)return this.value=c,this;break}a==r&&ithis.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let n=this.matchPos<=this.to&&this.re.exec(this.curLine);if(n){let r=this.curLineStart+n.index,s=r+n[0].length;if(this.matchPos=W1(this.text,s+(r==s?1:0)),r==this.curLineStart+this.curLine.length&&this.nextLine(),(rthis.value.to)&&(!this.test||this.test(r,s,n)))return this.value={from:r,to:s,match:n},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length=r||s.to<=n){let o=new ih(n,e.sliceString(n,r));return Iw.set(e,o),o}if(s.from==n&&s.to==r)return s;let{text:i,from:a}=s;return a>n&&(i=e.sliceString(n,a)+i,a=n),s.to=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,n=this.re.exec(this.flat.text);if(n&&!n[0]&&n.index==e&&(this.re.lastIndex=e+1,n=this.re.exec(this.flat.text)),n){let r=this.flat.from+n.index,s=r+n[0].length;if((this.flat.to>=this.to||n.index+n[0].length<=this.flat.text.length-10)&&(!this.test||this.test(r,s,n)))return this.value={from:r,to:s,match:n},this.matchPos=W1(this.text,s+(r==s?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=ih.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(Eq.prototype[Symbol.iterator]=_q.prototype[Symbol.iterator]=function(){return this});function Doe(t){try{return new RegExp(t,nj),!0}catch{return!1}}function W1(t,e){if(e>=t.length)return e;let n=t.lineAt(e),r;for(;e=56320&&r<57344;)e++;return e}function QS(t){let e=String(t.state.doc.lineAt(t.state.selection.main.head).number),n=Wn("input",{class:"cm-textfield",name:"line",value:e}),r=Wn("form",{class:"cm-gotoLine",onkeydown:i=>{i.keyCode==27?(i.preventDefault(),t.dispatch({effects:Rm.of(!1)}),t.focus()):i.keyCode==13&&(i.preventDefault(),s())},onsubmit:i=>{i.preventDefault(),s()}},Wn("label",t.state.phrase("Go to line"),": ",n)," ",Wn("button",{class:"cm-button",type:"submit"},t.state.phrase("go")),Wn("button",{name:"close",onclick:()=>{t.dispatch({effects:Rm.of(!1)}),t.focus()},"aria-label":t.state.phrase("close"),type:"button"},["×"]));function s(){let i=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(n.value);if(!i)return;let{state:a}=t,o=a.doc.lineAt(a.selection.main.head),[,c,h,f,m]=i,g=f?+f.slice(1):0,x=h?+h:o.number;if(h&&m){let S=x/100;c&&(S=S*(c=="-"?-1:1)+o.number/a.doc.lines),x=Math.round(a.doc.lines*S)}else h&&c&&(x=x*(c=="-"?-1:1)+o.number);let y=a.doc.line(Math.max(1,Math.min(a.doc.lines,x))),w=Ae.cursor(y.from+Math.max(0,Math.min(g,y.length)));t.dispatch({effects:[Rm.of(!1),Ke.scrollIntoView(w.from,{y:"center"})],selection:w}),t.focus()}return{dom:r}}const Rm=Lt.define(),ZT=us.define({create(){return!0},update(t,e){for(let n of e.effects)n.is(Rm)&&(t=n.value);return t},provide:t=>Jm.from(t,e=>e?QS:null)}),zoe=t=>{let e=Zm(t,QS);if(!e){let n=[Rm.of(!0)];t.state.field(ZT,!1)==null&&n.push(Lt.appendConfig.of([ZT,Poe])),t.dispatch({effects:n}),e=Zm(t,QS)}return e&&e.dom.querySelector("input").select(),!0},Poe=Ke.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px",position:"relative","& label":{fontSize:"80%"},"& [name=close]":{position:"absolute",top:"0",bottom:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:"0"}}}),Loe={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Ioe=nt.define({combine(t){return gl(t,Loe,{highlightWordAroundCursor:(e,n)=>e||n,minSelectionLength:Math.min,maxMatches:Math.min})}});function Boe(t){return[Hoe,Qoe]}const qoe=xt.mark({class:"cm-selectionMatch"}),Foe=xt.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function JT(t,e,n,r){return(n==0||t(e.sliceDoc(n-1,n))!=ar.Word)&&(r==e.doc.length||t(e.sliceDoc(r,r+1))!=ar.Word)}function $oe(t,e,n,r){return t(e.sliceDoc(n,n+1))==ar.Word&&t(e.sliceDoc(r-1,r))==ar.Word}const Qoe=_r.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.selectionSet||t.docChanged||t.viewportChanged)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=t.state.facet(Ioe),{state:n}=t,r=n.selection;if(r.ranges.length>1)return xt.none;let s=r.main,i,a=null;if(s.empty){if(!e.highlightWordAroundCursor)return xt.none;let c=n.wordAt(s.head);if(!c)return xt.none;a=n.charCategorizer(s.head),i=n.sliceDoc(c.from,c.to)}else{let c=s.to-s.from;if(c200)return xt.none;if(e.wholeWords){if(i=n.sliceDoc(s.from,s.to),a=n.charCategorizer(s.head),!(JT(a,n,s.from,s.to)&&$oe(a,n,s.from,s.to)))return xt.none}else if(i=n.sliceDoc(s.from,s.to),!i)return xt.none}let o=[];for(let c of t.visibleRanges){let h=new Oh(n.doc,i,c.from,c.to);for(;!h.next().done;){let{from:f,to:m}=h.value;if((!a||JT(a,n,f,m))&&(s.empty&&f<=s.from&&m>=s.to?o.push(Foe.range(f,m)):(f>=s.to||m<=s.from)&&o.push(qoe.range(f,m)),o.length>e.maxMatches))return xt.none}}return xt.set(o)}},{decorations:t=>t.decorations}),Hoe=Ke.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),Voe=({state:t,dispatch:e})=>{let{selection:n}=t,r=Ae.create(n.ranges.map(s=>t.wordAt(s.head)||Ae.cursor(s.head)),n.mainIndex);return r.eq(n)?!1:(e(t.update({selection:r})),!0)};function Uoe(t,e){let{main:n,ranges:r}=t.selection,s=t.wordAt(n.head),i=s&&s.from==n.from&&s.to==n.to;for(let a=!1,o=new Oh(t.doc,e,r[r.length-1].to);;)if(o.next(),o.done){if(a)return null;o=new Oh(t.doc,e,0,Math.max(0,r[r.length-1].from-1)),a=!0}else{if(a&&r.some(c=>c.from==o.value.from))continue;if(i){let c=t.wordAt(o.value.from);if(!c||c.from!=o.value.from||c.to!=o.value.to)continue}return o.value}}const Woe=({state:t,dispatch:e})=>{let{ranges:n}=t.selection;if(n.some(i=>i.from===i.to))return Voe({state:t,dispatch:e});let r=t.sliceDoc(n[0].from,n[0].to);if(t.selection.ranges.some(i=>t.sliceDoc(i.from,i.to)!=r))return!1;let s=Uoe(t,r);return s?(e(t.update({selection:t.selection.addRange(Ae.range(s.from,s.to),!1),effects:Ke.scrollIntoView(s.to)})),!0):!1},Qh=nt.define({combine(t){return gl(t,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new ice(e),scrollToMatch:e=>Ke.scrollIntoView(e)})}});class Mq{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||Doe(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(n,r)=>r=="n"?` +`:r=="r"?"\r":r=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord}create(){return this.regexp?new Koe(this):new Xoe(this)}getCursor(e,n=0,r){let s=e.doc?e:dn.create({doc:e});return r==null&&(r=s.doc.length),this.regexp?$d(this,s,n,r):Fd(this,s,n,r)}}class Aq{constructor(e){this.spec=e}}function Fd(t,e,n,r){return new Oh(e.doc,t.unquoted,n,r,t.caseSensitive?void 0:s=>s.toLowerCase(),t.wholeWord?Goe(e.doc,e.charCategorizer(e.selection.main.head)):void 0)}function Goe(t,e){return(n,r,s,i)=>((i>n||i+s.length=n)return null;s.push(r.value)}return s}highlight(e,n,r,s){let i=Fd(this.spec,e,Math.max(0,n-this.spec.unquoted.length),Math.min(r+this.spec.unquoted.length,e.doc.length));for(;!i.next().done;)s(i.value.from,i.value.to)}}function $d(t,e,n,r){return new Eq(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:t.wholeWord?Yoe(e.charCategorizer(e.selection.main.head)):void 0},n,r)}function G1(t,e){return t.slice(ys(t,e,!1),e)}function X1(t,e){return t.slice(e,ys(t,e))}function Yoe(t){return(e,n,r)=>!r[0].length||(t(G1(r.input,r.index))!=ar.Word||t(X1(r.input,r.index))!=ar.Word)&&(t(X1(r.input,r.index+r[0].length))!=ar.Word||t(G1(r.input,r.index+r[0].length))!=ar.Word)}class Koe extends Aq{nextMatch(e,n,r){let s=$d(this.spec,e,r,e.doc.length).next();return s.done&&(s=$d(this.spec,e,0,n).next()),s.done?null:s.value}prevMatchInRange(e,n,r){for(let s=1;;s++){let i=Math.max(n,r-s*1e4),a=$d(this.spec,e,i,r),o=null;for(;!a.next().done;)o=a.value;if(o&&(i==n||o.from>i+10))return o;if(i==n)return null}}prevMatch(e,n,r){return this.prevMatchInRange(e,0,n)||this.prevMatchInRange(e,r,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(n,r)=>{if(r=="&")return e.match[0];if(r=="$")return"$";for(let s=r.length;s>0;s--){let i=+r.slice(0,s);if(i>0&&i=n)return null;s.push(r.value)}return s}highlight(e,n,r,s){let i=$d(this.spec,e,Math.max(0,n-250),Math.min(r+250,e.doc.length));for(;!i.next().done;)s(i.value.from,i.value.to)}}const i0=Lt.define(),rj=Lt.define(),mc=us.define({create(t){return new Bw(HS(t).create(),null)},update(t,e){for(let n of e.effects)n.is(i0)?t=new Bw(n.value.create(),t.panel):n.is(rj)&&(t=new Bw(t.query,n.value?sj:null));return t},provide:t=>Jm.from(t,e=>e.panel)});class Bw{constructor(e,n){this.query=e,this.panel=n}}const Zoe=xt.mark({class:"cm-searchMatch"}),Joe=xt.mark({class:"cm-searchMatch cm-searchMatch-selected"}),ece=_r.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(mc))}update(t){let e=t.state.field(mc);(e!=t.startState.field(mc)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return xt.none;let{view:n}=this,r=new fo;for(let s=0,i=n.visibleRanges,a=i.length;si[s+1].from-500;)c=i[++s].to;t.highlight(n.state,o,c,(h,f)=>{let m=n.state.selection.ranges.some(g=>g.from==h&&g.to==f);r.add(h,f,m?Joe:Zoe)})}return r.finish()}},{decorations:t=>t.decorations});function rp(t){return e=>{let n=e.state.field(mc,!1);return n&&n.query.spec.valid?t(e,n):zq(e)}}const Y1=rp((t,{query:e})=>{let{to:n}=t.state.selection.main,r=e.nextMatch(t.state,n,n);if(!r)return!1;let s=Ae.single(r.from,r.to),i=t.state.facet(Qh);return t.dispatch({selection:s,effects:[ij(t,r),i.scrollToMatch(s.main,t)],userEvent:"select.search"}),Dq(t),!0}),K1=rp((t,{query:e})=>{let{state:n}=t,{from:r}=n.selection.main,s=e.prevMatch(n,r,r);if(!s)return!1;let i=Ae.single(s.from,s.to),a=t.state.facet(Qh);return t.dispatch({selection:i,effects:[ij(t,s),a.scrollToMatch(i.main,t)],userEvent:"select.search"}),Dq(t),!0}),tce=rp((t,{query:e})=>{let n=e.matchAll(t.state,1e3);return!n||!n.length?!1:(t.dispatch({selection:Ae.create(n.map(r=>Ae.range(r.from,r.to))),userEvent:"select.search.matches"}),!0)}),nce=({state:t,dispatch:e})=>{let n=t.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:s}=n.main,i=[],a=0;for(let o=new Oh(t.doc,t.sliceDoc(r,s));!o.next().done;){if(i.length>1e3)return!1;o.value.from==r&&(a=i.length),i.push(Ae.range(o.value.from,o.value.to))}return e(t.update({selection:Ae.create(i,a),userEvent:"select.search.matches"})),!0},eE=rp((t,{query:e})=>{let{state:n}=t,{from:r,to:s}=n.selection.main;if(n.readOnly)return!1;let i=e.nextMatch(n,r,r);if(!i)return!1;let a=i,o=[],c,h,f=[];a.from==r&&a.to==s&&(h=n.toText(e.getReplacement(a)),o.push({from:a.from,to:a.to,insert:h}),a=e.nextMatch(n,a.from,a.to),f.push(Ke.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(r).number)+".")));let m=t.state.changes(o);return a&&(c=Ae.single(a.from,a.to).map(m),f.push(ij(t,a)),f.push(n.facet(Qh).scrollToMatch(c.main,t))),t.dispatch({changes:m,selection:c,effects:f,userEvent:"input.replace"}),!0}),rce=rp((t,{query:e})=>{if(t.state.readOnly)return!1;let n=e.matchAll(t.state,1e9).map(s=>{let{from:i,to:a}=s;return{from:i,to:a,insert:e.getReplacement(s)}});if(!n.length)return!1;let r=t.state.phrase("replaced $ matches",n.length)+".";return t.dispatch({changes:n,effects:Ke.announce.of(r),userEvent:"input.replace.all"}),!0});function sj(t){return t.state.facet(Qh).createPanel(t)}function HS(t,e){var n,r,s,i,a;let o=t.selection.main,c=o.empty||o.to>o.from+100?"":t.sliceDoc(o.from,o.to);if(e&&!c)return e;let h=t.facet(Qh);return new Mq({search:((n=e?.literal)!==null&&n!==void 0?n:h.literal)?c:c.replace(/\n/g,"\\n"),caseSensitive:(r=e?.caseSensitive)!==null&&r!==void 0?r:h.caseSensitive,literal:(s=e?.literal)!==null&&s!==void 0?s:h.literal,regexp:(i=e?.regexp)!==null&&i!==void 0?i:h.regexp,wholeWord:(a=e?.wholeWord)!==null&&a!==void 0?a:h.wholeWord})}function Rq(t){let e=Zm(t,sj);return e&&e.dom.querySelector("[main-field]")}function Dq(t){let e=Rq(t);e&&e==t.root.activeElement&&e.select()}const zq=t=>{let e=t.state.field(mc,!1);if(e&&e.panel){let n=Rq(t);if(n&&n!=t.root.activeElement){let r=HS(t.state,e.query.spec);r.valid&&t.dispatch({effects:i0.of(r)}),n.focus(),n.select()}}else t.dispatch({effects:[rj.of(!0),e?i0.of(HS(t.state,e.query.spec)):Lt.appendConfig.of(lce)]});return!0},Pq=t=>{let e=t.state.field(mc,!1);if(!e||!e.panel)return!1;let n=Zm(t,sj);return n&&n.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:rj.of(!1)}),!0},sce=[{key:"Mod-f",run:zq,scope:"editor search-panel"},{key:"F3",run:Y1,shift:K1,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:Y1,shift:K1,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:Pq,scope:"editor search-panel"},{key:"Mod-Shift-l",run:nce},{key:"Mod-Alt-g",run:zoe},{key:"Mod-d",run:Woe,preventDefault:!0}];class ice{constructor(e){this.view=e;let n=this.query=e.state.field(mc).query.spec;this.commit=this.commit.bind(this),this.searchField=Wn("input",{value:n.search,placeholder:Si(e,"Find"),"aria-label":Si(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=Wn("input",{value:n.replace,placeholder:Si(e,"Replace"),"aria-label":Si(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=Wn("input",{type:"checkbox",name:"case",form:"",checked:n.caseSensitive,onchange:this.commit}),this.reField=Wn("input",{type:"checkbox",name:"re",form:"",checked:n.regexp,onchange:this.commit}),this.wordField=Wn("input",{type:"checkbox",name:"word",form:"",checked:n.wholeWord,onchange:this.commit});function r(s,i,a){return Wn("button",{class:"cm-button",name:s,onclick:i,type:"button"},a)}this.dom=Wn("div",{onkeydown:s=>this.keydown(s),class:"cm-search"},[this.searchField,r("next",()=>Y1(e),[Si(e,"next")]),r("prev",()=>K1(e),[Si(e,"previous")]),r("select",()=>tce(e),[Si(e,"all")]),Wn("label",null,[this.caseField,Si(e,"match case")]),Wn("label",null,[this.reField,Si(e,"regexp")]),Wn("label",null,[this.wordField,Si(e,"by word")]),...e.state.readOnly?[]:[Wn("br"),this.replaceField,r("replace",()=>eE(e),[Si(e,"replace")]),r("replaceAll",()=>rce(e),[Si(e,"replace all")])],Wn("button",{name:"close",onclick:()=>Pq(e),"aria-label":Si(e,"close"),type:"button"},["×"])])}commit(){let e=new Mq({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:i0.of(e)}))}keydown(e){uie(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?K1:Y1)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),eE(this.view))}update(e){for(let n of e.transactions)for(let r of n.effects)r.is(i0)&&!r.value.eq(this.query)&&this.setQuery(r.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(Qh).top}}function Si(t,e){return t.state.phrase(e)}const xx=30,vx=/[\s\.,:;?!]/;function ij(t,{from:e,to:n}){let r=t.state.doc.lineAt(e),s=t.state.doc.lineAt(n).to,i=Math.max(r.from,e-xx),a=Math.min(s,n+xx),o=t.state.sliceDoc(i,a);if(i!=r.from){for(let c=0;co.length-xx;c--)if(!vx.test(o[c-1])&&vx.test(o[c])){o=o.slice(0,c);break}}return Ke.announce.of(`${t.state.phrase("current match")}. ${o} ${t.state.phrase("on line")} ${r.number}.`)}const ace=Ke.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),lce=[mc,Ac.low(ece),ace];class Lq{constructor(e,n,r,s){this.state=e,this.pos=n,this.explicit=r,this.view=s,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let n=ls(this.state).resolveInner(this.pos,-1);for(;n&&e.indexOf(n.name)<0;)n=n.parent;return n?{from:n.from,to:this.pos,text:this.state.sliceDoc(n.from,this.pos),type:n.type}:null}matchBefore(e){let n=this.state.doc.lineAt(this.pos),r=Math.max(n.from,this.pos-250),s=n.text.slice(r-n.from,this.pos-n.from),i=s.search(Bq(e,!1));return i<0?null:{from:r+i,to:this.pos,text:s.slice(i)}}get aborted(){return this.abortListeners==null}addEventListener(e,n,r){e=="abort"&&this.abortListeners&&(this.abortListeners.push(n),r&&r.onDocChange&&(this.abortOnDocChange=!0))}}function tE(t){let e=Object.keys(t).join(""),n=/\w/.test(e);return n&&(e=e.replace(/\w/g,"")),`[${n?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function oce(t){let e=Object.create(null),n=Object.create(null);for(let{label:s}of t){e[s[0]]=!0;for(let i=1;itypeof s=="string"?{label:s}:s),[n,r]=e.every(s=>/^\w+$/.test(s.label))?[/\w*$/,/\w+$/]:oce(e);return s=>{let i=s.matchBefore(r);return i||s.explicit?{from:i?i.from:s.pos,options:e,validFor:n}:null}}function cce(t,e){return n=>{for(let r=ls(n.state).resolveInner(n.pos,-1);r;r=r.parent){if(t.indexOf(r.name)>-1)return null;if(r.type.isTop)break}return e(n)}}let nE=class{constructor(e,n,r,s){this.completion=e,this.source=n,this.match=r,this.score=s}};function Ou(t){return t.selection.main.from}function Bq(t,e){var n;let{source:r}=t,s=e&&r[0]!="^",i=r[r.length-1]!="$";return!s&&!i?t:new RegExp(`${s?"^":""}(?:${r})${i?"$":""}`,(n=t.flags)!==null&&n!==void 0?n:t.ignoreCase?"i":"")}const aj=pl.define();function uce(t,e,n,r){let{main:s}=t.selection,i=n-s.from,a=r-s.from;return{...t.changeByRange(o=>{if(o!=s&&n!=r&&t.sliceDoc(o.from+i,o.from+a)!=t.sliceDoc(n,r))return{range:o};let c=t.toText(e);return{changes:{from:o.from+i,to:r==s.from?o.to:o.from+a,insert:c},range:Ae.cursor(o.from+i+c.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const rE=new WeakMap;function dce(t){if(!Array.isArray(t))return t;let e=rE.get(t);return e||rE.set(t,e=Iq(t)),e}const Z1=Lt.define(),a0=Lt.define();class hce{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let n=0;n=48&&_<=57||_>=97&&_<=122?2:_>=65&&_<=90?1:0:(E=C6(_))!=E.toLowerCase()?1:E!=E.toUpperCase()?2:0;(!N||M==1&&S||T==0&&M!=0)&&(n[m]==_||r[m]==_&&(g=!0)?a[m++]=N:a.length&&(k=!1)),T=M,N+=Za(_)}return m==c&&a[0]==0&&k?this.result(-100+(g?-200:0),a,e):x==c&&y==0?this.ret(-200-e.length+(w==e.length?0:-100),[0,w]):o>-1?this.ret(-700-e.length,[o,o+this.pattern.length]):x==c?this.ret(-900-e.length,[y,w]):m==c?this.result(-100+(g?-200:0)+-700+(k?0:-1100),a,e):n.length==2?null:this.result((s[0]?-700:0)+-200+-1100,s,e)}result(e,n,r){let s=[],i=0;for(let a of n){let o=a+(this.astral?Za(ei(r,a)):1);i&&s[i-1]==a?s[i-1]=o:(s[i++]=a,s[i++]=o)}return this.ret(e-r.length,s)}}class fce{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:mce,filterStrict:!1,compareCompletions:(e,n)=>e.label.localeCompare(n.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,n)=>e&&n,closeOnBlur:(e,n)=>e&&n,icons:(e,n)=>e&&n,tooltipClass:(e,n)=>r=>sE(e(r),n(r)),optionClass:(e,n)=>r=>sE(e(r),n(r)),addToOptions:(e,n)=>e.concat(n),filterStrict:(e,n)=>e||n})}});function sE(t,e){return t?e?t+" "+e:t:e}function mce(t,e,n,r,s,i){let a=t.textDirection==sr.RTL,o=a,c=!1,h="top",f,m,g=e.left-s.left,x=s.right-e.right,y=r.right-r.left,w=r.bottom-r.top;if(o&&g=w||N>e.top?f=n.bottom-e.top:(h="bottom",f=e.bottom-n.top)}let S=(e.bottom-e.top)/i.offsetHeight,k=(e.right-e.left)/i.offsetWidth;return{style:`${h}: ${f/S}px; max-width: ${m/k}px`,class:"cm-completionInfo-"+(c?a?"left-narrow":"right-narrow":o?"left":"right")}}function pce(t){let e=t.addToOptions.slice();return t.icons&&e.push({render(n){let r=document.createElement("div");return r.classList.add("cm-completionIcon"),n.type&&r.classList.add(...n.type.split(/\s+/g).map(s=>"cm-completionIcon-"+s)),r.setAttribute("aria-hidden","true"),r},position:20}),e.push({render(n,r,s,i){let a=document.createElement("span");a.className="cm-completionLabel";let o=n.displayLabel||n.label,c=0;for(let h=0;hc&&a.appendChild(document.createTextNode(o.slice(c,f)));let g=a.appendChild(document.createElement("span"));g.appendChild(document.createTextNode(o.slice(f,m))),g.className="cm-completionMatchedText",c=m}return cn.position-r.position).map(n=>n.render)}function qw(t,e,n){if(t<=n)return{from:0,to:t};if(e<0&&(e=0),e<=t>>1){let s=Math.floor(e/n);return{from:s*n,to:(s+1)*n}}let r=Math.floor((t-e)/n);return{from:t-(r+1)*n,to:t-r*n}}class gce{constructor(e,n,r){this.view=e,this.stateField=n,this.applyCompletion=r,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:c=>this.placeInfo(c),key:this},this.space=null,this.currentClass="";let s=e.state.field(n),{options:i,selected:a}=s.open,o=e.state.facet(is);this.optionContent=pce(o),this.optionClass=o.optionClass,this.tooltipClass=o.tooltipClass,this.range=qw(i.length,a,o.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",c=>{let{options:h}=e.state.field(n).open;for(let f=c.target,m;f&&f!=this.dom;f=f.parentNode)if(f.nodeName=="LI"&&(m=/-(\d+)$/.exec(f.id))&&+m[1]{let h=e.state.field(this.stateField,!1);h&&h.tooltip&&e.state.facet(is).closeOnBlur&&c.relatedTarget!=e.contentDOM&&e.dispatch({effects:a0.of(null)})}),this.showOptions(i,s.id)}mount(){this.updateSel()}showOptions(e,n){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,n,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var n;let r=e.state.field(this.stateField),s=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),r!=s){let{options:i,selected:a,disabled:o}=r.open;(!s.open||s.open.options!=i)&&(this.range=qw(i.length,a,e.state.facet(is).maxRenderedOptions),this.showOptions(i,r.id)),this.updateSel(),o!=((n=s.open)===null||n===void 0?void 0:n.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!o)}}updateTooltipClass(e){let n=this.tooltipClass(e);if(n!=this.currentClass){for(let r of this.currentClass.split(" "))r&&this.dom.classList.remove(r);for(let r of n.split(" "))r&&this.dom.classList.add(r);this.currentClass=n}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),n=e.open;(n.selected>-1&&n.selected=this.range.to)&&(this.range=qw(n.options.length,n.selected,this.view.state.facet(is).maxRenderedOptions),this.showOptions(n.options,e.id));let r=this.updateSelectedOption(n.selected);if(r){this.destroyInfo();let{completion:s}=n.options[n.selected],{info:i}=s;if(!i)return;let a=typeof i=="string"?document.createTextNode(i):i(s);if(!a)return;"then"in a?a.then(o=>{o&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(o,s)}).catch(o=>ni(this.view.state,o,"completion info")):(this.addInfoPane(a,s),r.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,n){this.destroyInfo();let r=this.info=document.createElement("div");if(r.className="cm-tooltip cm-completionInfo",r.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)r.appendChild(e),this.infoDestroy=null;else{let{dom:s,destroy:i}=e;r.appendChild(s),this.infoDestroy=i||null}this.dom.appendChild(r),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let n=null;for(let r=this.list.firstChild,s=this.range.from;r;r=r.nextSibling,s++)r.nodeName!="LI"||!r.id?s--:s==e?r.hasAttribute("aria-selected")||(r.setAttribute("aria-selected","true"),n=r):r.hasAttribute("aria-selected")&&(r.removeAttribute("aria-selected"),r.removeAttribute("aria-describedby"));return n&&vce(this.list,n),n}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let n=this.dom.getBoundingClientRect(),r=this.info.getBoundingClientRect(),s=e.getBoundingClientRect(),i=this.space;if(!i){let a=this.dom.ownerDocument.documentElement;i={left:0,top:0,right:a.clientWidth,bottom:a.clientHeight}}return s.top>Math.min(i.bottom,n.bottom)-10||s.bottom{a.target==s&&a.preventDefault()});let i=null;for(let a=r.from;ar.from||r.from==0))if(i=g,typeof h!="string"&&h.header)s.appendChild(h.header(h));else{let x=s.appendChild(document.createElement("completion-section"));x.textContent=g}}const f=s.appendChild(document.createElement("li"));f.id=n+"-"+a,f.setAttribute("role","option");let m=this.optionClass(o);m&&(f.className=m);for(let g of this.optionContent){let x=g(o,this.view.state,this.view,c);x&&f.appendChild(x)}}return r.from&&s.classList.add("cm-completionListIncompleteTop"),r.tonew gce(n,t,e)}function vce(t,e){let n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),s=n.height/t.offsetHeight;r.topn.bottom&&(t.scrollTop+=(r.bottom-n.bottom)/s)}function iE(t){return(t.boost||0)*100+(t.apply?10:0)+(t.info?5:0)+(t.type?1:0)}function yce(t,e){let n=[],r=null,s=null,i=f=>{n.push(f);let{section:m}=f.completion;if(m){r||(r=[]);let g=typeof m=="string"?m:m.name;r.some(x=>x.name==g)||r.push(typeof m=="string"?{name:g}:m)}},a=e.facet(is);for(let f of t)if(f.hasResult()){let m=f.result.getMatch;if(f.result.filter===!1)for(let g of f.result.options)i(new nE(g,f.source,m?m(g):[],1e9-n.length));else{let g=e.sliceDoc(f.from,f.to),x,y=a.filterStrict?new fce(g):new hce(g);for(let w of f.result.options)if(x=y.match(w.label)){let S=w.displayLabel?m?m(w,x.matched):[]:x.matched,k=x.score+(w.boost||0);if(i(new nE(w,f.source,S,k)),typeof w.section=="object"&&w.section.rank==="dynamic"){let{name:N}=w.section;s||(s=Object.create(null)),s[N]=Math.max(k,s[N]||-1e9)}}}}if(r){let f=Object.create(null),m=0,g=(x,y)=>(x.rank==="dynamic"&&y.rank==="dynamic"?s[y.name]-s[x.name]:0)||(typeof x.rank=="number"?x.rank:1e9)-(typeof y.rank=="number"?y.rank:1e9)||(x.nameg.score-m.score||h(m.completion,g.completion))){let m=f.completion;!c||c.label!=m.label||c.detail!=m.detail||c.type!=null&&m.type!=null&&c.type!=m.type||c.apply!=m.apply||c.boost!=m.boost?o.push(f):iE(f.completion)>iE(c)&&(o[o.length-1]=f),c=f.completion}return o}class Yd{constructor(e,n,r,s,i,a){this.options=e,this.attrs=n,this.tooltip=r,this.timestamp=s,this.selected=i,this.disabled=a}setSelected(e,n){return e==this.selected||e>=this.options.length?this:new Yd(this.options,aE(n,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,n,r,s,i,a){if(s&&!a&&e.some(h=>h.isPending))return s.setDisabled();let o=yce(e,n);if(!o.length)return s&&e.some(h=>h.isPending)?s.setDisabled():null;let c=n.facet(is).selectOnOpen?0:-1;if(s&&s.selected!=c&&s.selected!=-1){let h=s.options[s.selected].completion;for(let f=0;ff.hasResult()?Math.min(h,f.from):h,1e8),create:Oce,above:i.aboveCursor},s?s.timestamp:Date.now(),c,!1)}map(e){return new Yd(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new Yd(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class J1{constructor(e,n,r){this.active=e,this.id=n,this.open=r}static start(){return new J1(kce,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:n}=e,r=n.facet(is),i=(r.override||n.languageDataAt("autocomplete",Ou(n)).map(dce)).map(c=>(this.active.find(f=>f.source==c)||new ea(c,this.active.some(f=>f.state!=0)?1:0)).update(e,r));i.length==this.active.length&&i.every((c,h)=>c==this.active[h])&&(i=this.active);let a=this.open,o=e.effects.some(c=>c.is(lj));a&&e.docChanged&&(a=a.map(e.changes)),e.selection||i.some(c=>c.hasResult()&&e.changes.touchesRange(c.from,c.to))||!bce(i,this.active)||o?a=Yd.build(i,n,this.id,a,r,o):a&&a.disabled&&!i.some(c=>c.isPending)&&(a=null),!a&&i.every(c=>!c.isPending)&&i.some(c=>c.hasResult())&&(i=i.map(c=>c.hasResult()?new ea(c.source,0):c));for(let c of e.effects)c.is(Fq)&&(a=a&&a.setSelected(c.value,this.id));return i==this.active&&a==this.open?this:new J1(i,this.id,a)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?wce:Sce}}function bce(t,e){if(t==e)return!0;for(let n=0,r=0;;){for(;n-1&&(n["aria-activedescendant"]=t+"-"+e),n}const kce=[];function qq(t,e){if(t.isUserEvent("input.complete")){let r=t.annotation(aj);if(r&&e.activateOnCompletion(r))return 12}let n=t.isUserEvent("input.type");return n&&e.activateOnTyping?5:n?1:t.isUserEvent("delete.backward")?2:t.selection?8:t.docChanged?16:0}class ea{constructor(e,n,r=!1){this.source=e,this.state=n,this.explicit=r}hasResult(){return!1}get isPending(){return this.state==1}update(e,n){let r=qq(e,n),s=this;(r&8||r&16&&this.touches(e))&&(s=new ea(s.source,0)),r&4&&s.state==0&&(s=new ea(this.source,1)),s=s.updateFor(e,r);for(let i of e.effects)if(i.is(Z1))s=new ea(s.source,1,i.value);else if(i.is(a0))s=new ea(s.source,0);else if(i.is(lj))for(let a of i.value)a.source==s.source&&(s=a);return s}updateFor(e,n){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(Ou(e.state))}}class ah extends ea{constructor(e,n,r,s,i,a){super(e,3,n),this.limit=r,this.result=s,this.from=i,this.to=a}hasResult(){return!0}updateFor(e,n){var r;if(!(n&3))return this.map(e.changes);let s=this.result;s.map&&!e.changes.empty&&(s=s.map(s,e.changes));let i=e.changes.mapPos(this.from),a=e.changes.mapPos(this.to,1),o=Ou(e.state);if(o>a||!s||n&2&&(Ou(e.startState)==this.from||on.map(e))}}),Fq=Lt.define(),ti=us.define({create(){return J1.start()},update(t,e){return t.update(e)},provide:t=>[F6.from(t,e=>e.tooltip),Ke.contentAttributes.from(t,e=>e.attrs)]});function oj(t,e){const n=e.completion.apply||e.completion.label;let r=t.state.field(ti).active.find(s=>s.source==e.source);return r instanceof ah?(typeof n=="string"?t.dispatch({...uce(t.state,n,r.from,r.to),annotations:aj.of(e.completion)}):n(t,e.completion,r.from,r.to),!0):!1}const Oce=xce(ti,oj);function yx(t,e="option"){return n=>{let r=n.state.field(ti,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp-1?r.open.selected+s*(t?1:-1):t?0:a-1;return o<0?o=e=="page"?0:a-1:o>=a&&(o=e=="page"?a-1:0),n.dispatch({effects:Fq.of(o)}),!0}}const Nce=t=>{let e=t.state.field(ti,!1);return t.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestampt.state.field(ti,!1)?(t.dispatch({effects:Z1.of(!0)}),!0):!1,Cce=t=>{let e=t.state.field(ti,!1);return!e||!e.active.some(n=>n.state!=0)?!1:(t.dispatch({effects:a0.of(null)}),!0)};class Tce{constructor(e,n){this.active=e,this.context=n,this.time=Date.now(),this.updates=[],this.done=void 0}}const Ece=50,_ce=1e3,Mce=_r.fromClass(class{constructor(t){this.view=t,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of t.state.field(ti).active)e.isPending&&this.startQuery(e)}update(t){let e=t.state.field(ti),n=t.state.facet(is);if(!t.selectionSet&&!t.docChanged&&t.startState.field(ti)==e)return;let r=t.transactions.some(i=>{let a=qq(i,n);return a&8||(i.selection||i.docChanged)&&!(a&3)});for(let i=0;iEce&&Date.now()-a.time>_ce){for(let o of a.context.abortListeners)try{o()}catch(c){ni(this.view.state,c)}a.context.abortListeners=null,this.running.splice(i--,1)}else a.updates.push(...t.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),t.transactions.some(i=>i.effects.some(a=>a.is(Z1)))&&(this.pendingStart=!0);let s=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(i=>i.isPending&&!this.running.some(a=>a.active.source==i.source))?setTimeout(()=>this.startUpdate(),s):-1,this.composing!=0)for(let i of t.transactions)i.isUserEvent("input.type")?this.composing=2:this.composing==2&&i.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:t}=this.view,e=t.field(ti);for(let n of e.active)n.isPending&&!this.running.some(r=>r.active.source==n.source)&&this.startQuery(n);this.running.length&&e.open&&e.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(is).updateSyncTime))}startQuery(t){let{state:e}=this.view,n=Ou(e),r=new Lq(e,n,t.explicit,this.view),s=new Tce(t,r);this.running.push(s),Promise.resolve(t.source(r)).then(i=>{s.context.aborted||(s.done=i||null,this.scheduleAccept())},i=>{this.view.dispatch({effects:a0.of(null)}),ni(this.view.state,i)})}scheduleAccept(){this.running.every(t=>t.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(is).updateSyncTime))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],n=this.view.state.facet(is),r=this.view.state.field(ti);for(let s=0;so.source==i.active.source);if(a&&a.isPending)if(i.done==null){let o=new ea(i.active.source,0);for(let c of i.updates)o=o.update(c,n);o.isPending||e.push(o)}else this.startQuery(a)}(e.length||r.open&&r.open.disabled)&&this.view.dispatch({effects:lj.of(e)})}},{eventHandlers:{blur(t){let e=this.view.state.field(ti,!1);if(e&&e.tooltip&&this.view.state.facet(is).closeOnBlur){let n=e.open&&pB(this.view,e.open.tooltip);(!n||!n.dom.contains(t.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:a0.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:Z1.of(!1)}),20),this.composing=0}}}),Ace=typeof navigator=="object"&&/Win/.test(navigator.platform),Rce=Ac.highest(Ke.domEventHandlers({keydown(t,e){let n=e.state.field(ti,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||t.key.length>1||t.ctrlKey&&!(Ace&&t.altKey)||t.metaKey)return!1;let r=n.open.options[n.open.selected],s=n.active.find(a=>a.source==r.source),i=r.completion.commitCharacters||s.result.commitCharacters;return i&&i.indexOf(t.key)>-1&&oj(e,r),!1}})),$q=Ke.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class Dce{constructor(e,n,r,s){this.field=e,this.line=n,this.from=r,this.to=s}}class cj{constructor(e,n,r){this.field=e,this.from=n,this.to=r}map(e){let n=e.mapPos(this.from,-1,vs.TrackDel),r=e.mapPos(this.to,1,vs.TrackDel);return n==null||r==null?null:new cj(this.field,n,r)}}class uj{constructor(e,n){this.lines=e,this.fieldPositions=n}instantiate(e,n){let r=[],s=[n],i=e.doc.lineAt(n),a=/^\s*/.exec(i.text)[0];for(let c of this.lines){if(r.length){let h=a,f=/^\t*/.exec(c)[0].length;for(let m=0;mnew cj(c.field,s[c.line]+c.from,s[c.line]+c.to));return{text:r,ranges:o}}static parse(e){let n=[],r=[],s=[],i;for(let a of e.split(/\r\n?|\n/)){for(;i=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(a);){let o=i[1]?+i[1]:null,c=i[2]||i[3]||"",h=-1,f=c.replace(/\\[{}]/g,m=>m[1]);for(let m=0;m=h&&g.field++}for(let m of s)if(m.line==r.length&&m.from>i.index){let g=i[2]?3+(i[1]||"").length:2;m.from-=g,m.to-=g}s.push(new Dce(h,r.length,i.index,i.index+f.length)),a=a.slice(0,i.index)+c+a.slice(i.index+i[0].length)}a=a.replace(/\\([{}])/g,(o,c,h)=>{for(let f of s)f.line==r.length&&f.from>h&&(f.from--,f.to--);return c}),r.push(a)}return new uj(r,s)}}let zce=xt.widget({widget:new class extends xl{toDOM(){let t=document.createElement("span");return t.className="cm-snippetFieldPosition",t}ignoreEvent(){return!1}}}),Pce=xt.mark({class:"cm-snippetField"});class Hh{constructor(e,n){this.ranges=e,this.active=n,this.deco=xt.set(e.map(r=>(r.from==r.to?zce:Pce).range(r.from,r.to)),!0)}map(e){let n=[];for(let r of this.ranges){let s=r.map(e);if(!s)return null;n.push(s)}return new Hh(n,this.active)}selectionInsideField(e){return e.ranges.every(n=>this.ranges.some(r=>r.field==this.active&&r.from<=n.from&&r.to>=n.to))}}const sp=Lt.define({map(t,e){return t&&t.map(e)}}),Lce=Lt.define(),l0=us.define({create(){return null},update(t,e){for(let n of e.effects){if(n.is(sp))return n.value;if(n.is(Lce)&&t)return new Hh(t.ranges,n.value)}return t&&e.docChanged&&(t=t.map(e.changes)),t&&e.selection&&!t.selectionInsideField(e.selection)&&(t=null),t},provide:t=>Ke.decorations.from(t,e=>e?e.deco:xt.none)});function dj(t,e){return Ae.create(t.filter(n=>n.field==e).map(n=>Ae.range(n.from,n.to)))}function Ice(t){let e=uj.parse(t);return(n,r,s,i)=>{let{text:a,ranges:o}=e.instantiate(n.state,s),{main:c}=n.state.selection,h={changes:{from:s,to:i==c.from?c.to:i,insert:pn.of(a)},scrollIntoView:!0,annotations:r?[aj.of(r),$r.userEvent.of("input.complete")]:void 0};if(o.length&&(h.selection=dj(o,0)),o.some(f=>f.field>0)){let f=new Hh(o,0),m=h.effects=[sp.of(f)];n.state.field(l0,!1)===void 0&&m.push(Lt.appendConfig.of([l0,Qce,Hce,$q]))}n.dispatch(n.state.update(h))}}function Qq(t){return({state:e,dispatch:n})=>{let r=e.field(l0,!1);if(!r||t<0&&r.active==0)return!1;let s=r.active+t,i=t>0&&!r.ranges.some(a=>a.field==s+t);return n(e.update({selection:dj(r.ranges,s),effects:sp.of(i?null:new Hh(r.ranges,s)),scrollIntoView:!0})),!0}}const Bce=({state:t,dispatch:e})=>t.field(l0,!1)?(e(t.update({effects:sp.of(null)})),!0):!1,qce=Qq(1),Fce=Qq(-1),$ce=[{key:"Tab",run:qce,shift:Fce},{key:"Escape",run:Bce}],lE=nt.define({combine(t){return t.length?t[0]:$ce}}),Qce=Ac.highest(K0.compute([lE],t=>t.facet(lE)));function Ul(t,e){return{...e,apply:Ice(t)}}const Hce=Ke.domEventHandlers({mousedown(t,e){let n=e.state.field(l0,!1),r;if(!n||(r=e.posAtCoords({x:t.clientX,y:t.clientY}))==null)return!1;let s=n.ranges.find(i=>i.from<=r&&i.to>=r);return!s||s.field==n.active?!1:(e.dispatch({selection:dj(n.ranges,s.field),effects:sp.of(n.ranges.some(i=>i.field>s.field)?new Hh(n.ranges,s.field):null),scrollIntoView:!0}),!0)}}),o0={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},xu=Lt.define({map(t,e){let n=e.mapPos(t,-1,vs.TrackAfter);return n??void 0}}),hj=new class extends _u{};hj.startSide=1;hj.endSide=-1;const Hq=us.define({create(){return On.empty},update(t,e){if(t=t.map(e.changes),e.selection){let n=e.state.doc.lineAt(e.selection.main.head);t=t.update({filter:r=>r>=n.from&&r<=n.to})}for(let n of e.effects)n.is(xu)&&(t=t.update({add:[hj.range(n.value,n.value+1)]}));return t}});function Vce(){return[Wce,Hq]}const $w="()[]{}<>«»»«[]{}";function Vq(t){for(let e=0;e<$w.length;e+=2)if($w.charCodeAt(e)==t)return $w.charAt(e+1);return C6(t<128?t:t+1)}function Uq(t,e){return t.languageDataAt("closeBrackets",e)[0]||o0}const Uce=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),Wce=Ke.inputHandler.of((t,e,n,r)=>{if((Uce?t.composing:t.compositionStarted)||t.state.readOnly)return!1;let s=t.state.selection.main;if(r.length>2||r.length==2&&Za(ei(r,0))==1||e!=s.from||n!=s.to)return!1;let i=Yce(t.state,r);return i?(t.dispatch(i),!0):!1}),Gce=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let r=Uq(t,t.selection.main.head).brackets||o0.brackets,s=null,i=t.changeByRange(a=>{if(a.empty){let o=Kce(t.doc,a.head);for(let c of r)if(c==o&&ly(t.doc,a.head)==Vq(ei(c,0)))return{changes:{from:a.head-c.length,to:a.head+c.length},range:Ae.cursor(a.head-c.length)}}return{range:s=a}});return s||e(t.update(i,{scrollIntoView:!0,userEvent:"delete.backward"})),!s},Xce=[{key:"Backspace",run:Gce}];function Yce(t,e){let n=Uq(t,t.selection.main.head),r=n.brackets||o0.brackets;for(let s of r){let i=Vq(ei(s,0));if(e==s)return i==s?eue(t,s,r.indexOf(s+s+s)>-1,n):Zce(t,s,i,n.before||o0.before);if(e==i&&Wq(t,t.selection.main.from))return Jce(t,s,i)}return null}function Wq(t,e){let n=!1;return t.field(Hq).between(0,t.doc.length,r=>{r==e&&(n=!0)}),n}function ly(t,e){let n=t.sliceString(e,e+2);return n.slice(0,Za(ei(n,0)))}function Kce(t,e){let n=t.sliceString(e-2,e);return Za(ei(n,0))==n.length?n:n.slice(1)}function Zce(t,e,n,r){let s=null,i=t.changeByRange(a=>{if(!a.empty)return{changes:[{insert:e,from:a.from},{insert:n,from:a.to}],effects:xu.of(a.to+e.length),range:Ae.range(a.anchor+e.length,a.head+e.length)};let o=ly(t.doc,a.head);return!o||/\s/.test(o)||r.indexOf(o)>-1?{changes:{insert:e+n,from:a.head},effects:xu.of(a.head+e.length),range:Ae.cursor(a.head+e.length)}:{range:s=a}});return s?null:t.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function Jce(t,e,n){let r=null,s=t.changeByRange(i=>i.empty&&ly(t.doc,i.head)==n?{changes:{from:i.head,to:i.head+n.length,insert:n},range:Ae.cursor(i.head+n.length)}:r={range:i});return r?null:t.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function eue(t,e,n,r){let s=r.stringPrefixes||o0.stringPrefixes,i=null,a=t.changeByRange(o=>{if(!o.empty)return{changes:[{insert:e,from:o.from},{insert:e,from:o.to}],effects:xu.of(o.to+e.length),range:Ae.range(o.anchor+e.length,o.head+e.length)};let c=o.head,h=ly(t.doc,c),f;if(h==e){if(oE(t,c))return{changes:{insert:e+e,from:c},effects:xu.of(c+e.length),range:Ae.cursor(c+e.length)};if(Wq(t,c)){let g=n&&t.sliceDoc(c,c+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:c,to:c+g.length,insert:g},range:Ae.cursor(c+g.length)}}}else{if(n&&t.sliceDoc(c-2*e.length,c)==e+e&&(f=cE(t,c-2*e.length,s))>-1&&oE(t,f))return{changes:{insert:e+e+e+e,from:c},effects:xu.of(c+e.length),range:Ae.cursor(c+e.length)};if(t.charCategorizer(c)(h)!=ar.Word&&cE(t,c,s)>-1&&!tue(t,c,e,s))return{changes:{insert:e+e,from:c},effects:xu.of(c+e.length),range:Ae.cursor(c+e.length)}}return{range:i=o}});return i?null:t.update(a,{scrollIntoView:!0,userEvent:"input.type"})}function oE(t,e){let n=ls(t).resolveInner(e+1);return n.parent&&n.from==e}function tue(t,e,n,r){let s=ls(t).resolveInner(e,-1),i=r.reduce((a,o)=>Math.max(a,o.length),0);for(let a=0;a<5;a++){let o=t.sliceDoc(s.from,Math.min(s.to,s.from+n.length+i)),c=o.indexOf(n);if(!c||c>-1&&r.indexOf(o.slice(0,c))>-1){let f=s.firstChild;for(;f&&f.from==s.from&&f.to-f.from>n.length+c;){if(t.sliceDoc(f.to-n.length,f.to)==n)return!1;f=f.firstChild}return!0}let h=s.to==e&&s.parent;if(!h)break;s=h}return!1}function cE(t,e,n){let r=t.charCategorizer(e);if(r(t.sliceDoc(e-1,e))!=ar.Word)return e;for(let s of n){let i=e-s.length;if(t.sliceDoc(i,e)==s&&r(t.sliceDoc(i-1,i))!=ar.Word)return i}return-1}function nue(t={}){return[Rce,ti,is.of(t),Mce,rue,$q]}const Gq=[{key:"Ctrl-Space",run:Fw},{mac:"Alt-`",run:Fw},{mac:"Alt-i",run:Fw},{key:"Escape",run:Cce},{key:"ArrowDown",run:yx(!0)},{key:"ArrowUp",run:yx(!1)},{key:"PageDown",run:yx(!0,"page")},{key:"PageUp",run:yx(!1,"page")},{key:"Enter",run:Nce}],rue=Ac.highest(K0.computeN([is],t=>t.facet(is).defaultKeymap?[Gq]:[]));class uE{constructor(e,n,r){this.from=e,this.to=n,this.diagnostic=r}}class hu{constructor(e,n,r){this.diagnostics=e,this.panel=n,this.selected=r}static init(e,n,r){let s=r.facet(c0).markerFilter;s&&(e=s(e,r));let i=e.slice().sort((x,y)=>x.from-y.from||x.to-y.to),a=new fo,o=[],c=0,h=r.doc.iter(),f=0,m=r.doc.length;for(let x=0;;){let y=x==i.length?null:i[x];if(!y&&!o.length)break;let w,S;if(o.length)w=c,S=o.reduce((C,T)=>Math.min(C,T.to),y&&y.from>w?y.from:1e8);else{if(w=y.from,w>m)break;S=y.to,o.push(y),x++}for(;xC.from||C.to==w))o.push(C),x++,S=Math.min(C.to,S);else{S=Math.min(C.from,S);break}}S=Math.min(S,m);let k=!1;if(o.some(C=>C.from==w&&(C.to==S||S==m))&&(k=w==S,!k&&S-w<10)){let C=w-(f+h.value.length);C>0&&(h.next(C),f=w);for(let T=w;;){if(T>=S){k=!0;break}if(!h.lineBreak&&f+h.value.length>T)break;T=f+h.value.length,f+=h.value.length,h.next()}}let N=gue(o);if(k)a.add(w,w,xt.widget({widget:new hue(N),diagnostics:o.slice()}));else{let C=o.reduce((T,_)=>_.markClass?T+" "+_.markClass:T,"");a.add(w,S,xt.mark({class:"cm-lintRange cm-lintRange-"+N+C,diagnostics:o.slice(),inclusiveEnd:o.some(T=>T.to>S)}))}if(c=S,c==m)break;for(let C=0;C{if(!(e&&a.diagnostics.indexOf(e)<0))if(!r)r=new uE(s,i,e||a.diagnostics[0]);else{if(a.diagnostics.indexOf(r.diagnostic)<0)return!1;r=new uE(r.from,i,r.diagnostic)}}),r}function sue(t,e){let n=e.pos,r=e.end||n,s=t.state.facet(c0).hideOn(t,n,r);if(s!=null)return s;let i=t.startState.doc.lineAt(e.pos);return!!(t.effects.some(a=>a.is(Xq))||t.changes.touchesRange(i.from,Math.max(i.to,r)))}function iue(t,e){return t.field(Ei,!1)?e:e.concat(Lt.appendConfig.of(xue))}const Xq=Lt.define(),fj=Lt.define(),Yq=Lt.define(),Ei=us.define({create(){return new hu(xt.none,null,null)},update(t,e){if(e.docChanged&&t.diagnostics.size){let n=t.diagnostics.map(e.changes),r=null,s=t.panel;if(t.selected){let i=e.changes.mapPos(t.selected.from,1);r=Nh(n,t.selected.diagnostic,i)||Nh(n,null,i)}!n.size&&s&&e.state.facet(c0).autoPanel&&(s=null),t=new hu(n,s,r)}for(let n of e.effects)if(n.is(Xq)){let r=e.state.facet(c0).autoPanel?n.value.length?u0.open:null:t.panel;t=hu.init(n.value,r,e.state)}else n.is(fj)?t=new hu(t.diagnostics,n.value?u0.open:null,t.selected):n.is(Yq)&&(t=new hu(t.diagnostics,t.panel,n.value));return t},provide:t=>[Jm.from(t,e=>e.panel),Ke.decorations.from(t,e=>e.diagnostics)]}),aue=xt.mark({class:"cm-lintRange cm-lintRange-active"});function lue(t,e,n){let{diagnostics:r}=t.state.field(Ei),s,i=-1,a=-1;r.between(e-(n<0?1:0),e+(n>0?1:0),(c,h,{spec:f})=>{if(e>=c&&e<=h&&(c==h||(e>c||n>0)&&(eZq(t,n,!1)))}const cue=t=>{let e=t.state.field(Ei,!1);(!e||!e.panel)&&t.dispatch({effects:iue(t.state,[fj.of(!0)])});let n=Zm(t,u0.open);return n&&n.dom.querySelector(".cm-panel-lint ul").focus(),!0},dE=t=>{let e=t.state.field(Ei,!1);return!e||!e.panel?!1:(t.dispatch({effects:fj.of(!1)}),!0)},uue=t=>{let e=t.state.field(Ei,!1);if(!e)return!1;let n=t.state.selection.main,r=e.diagnostics.iter(n.to+1);return!r.value&&(r=e.diagnostics.iter(0),!r.value||r.from==n.from&&r.to==n.to)?!1:(t.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),!0)},due=[{key:"Mod-Shift-m",run:cue,preventDefault:!0},{key:"F8",run:uue}],c0=nt.define({combine(t){return{sources:t.map(e=>e.source).filter(e=>e!=null),...gl(t.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:hE,tooltipFilter:hE,needsRefresh:(e,n)=>e?n?r=>e(r)||n(r):e:n,hideOn:(e,n)=>e?n?(r,s,i)=>e(r,s,i)||n(r,s,i):e:n,autoPanel:(e,n)=>e||n})}}});function hE(t,e){return t?e?(n,r)=>e(t(n,r),r):t:e}function Kq(t){let e=[];if(t)e:for(let{name:n}of t){for(let r=0;ri.toLowerCase()==s.toLowerCase())){e.push(s);continue e}}e.push("")}return e}function Zq(t,e,n){var r;let s=n?Kq(e.actions):[];return Wn("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},Wn("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(t):e.message),(r=e.actions)===null||r===void 0?void 0:r.map((i,a)=>{let o=!1,c=x=>{if(x.preventDefault(),o)return;o=!0;let y=Nh(t.state.field(Ei).diagnostics,e);y&&i.apply(t,y.from,y.to)},{name:h}=i,f=s[a]?h.indexOf(s[a]):-1,m=f<0?h:[h.slice(0,f),Wn("u",h.slice(f,f+1)),h.slice(f+1)],g=i.markClass?" "+i.markClass:"";return Wn("button",{type:"button",class:"cm-diagnosticAction"+g,onclick:c,onmousedown:c,"aria-label":` Action: ${h}${f<0?"":` (access key "${s[a]})"`}.`},m)}),e.source&&Wn("div",{class:"cm-diagnosticSource"},e.source))}class hue extends xl{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return Wn("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class fE{constructor(e,n){this.diagnostic=n,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=Zq(e,n,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class u0{constructor(e){this.view=e,this.items=[];let n=s=>{if(s.keyCode==27)dE(this.view),this.view.focus();else if(s.keyCode==38||s.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(s.keyCode==40||s.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(s.keyCode==36)this.moveSelection(0);else if(s.keyCode==35)this.moveSelection(this.items.length-1);else if(s.keyCode==13)this.view.focus();else if(s.keyCode>=65&&s.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:i}=this.items[this.selectedIndex],a=Kq(i.actions);for(let o=0;o{for(let i=0;idE(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(Ei).selected;if(!e)return-1;for(let n=0;n{for(let f of h.diagnostics){if(a.has(f))continue;a.add(f);let m=-1,g;for(let x=r;xr&&(this.items.splice(r,m-r),s=!0)),n&&g.diagnostic==n.diagnostic?g.dom.hasAttribute("aria-selected")||(g.dom.setAttribute("aria-selected","true"),i=g):g.dom.hasAttribute("aria-selected")&&g.dom.removeAttribute("aria-selected"),r++}});r({sel:i.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:o,panel:c})=>{let h=c.height/this.list.offsetHeight;o.topc.bottom&&(this.list.scrollTop+=(o.bottom-c.bottom)/h)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),s&&this.sync()}sync(){let e=this.list.firstChild;function n(){let r=e;e=r.nextSibling,r.remove()}for(let r of this.items)if(r.dom.parentNode==this.list){for(;e!=r.dom;)n();e=r.dom.nextSibling}else this.list.insertBefore(r.dom,e);for(;e;)n()}moveSelection(e){if(this.selectedIndex<0)return;let n=this.view.state.field(Ei),r=Nh(n.diagnostics,this.items[e].diagnostic);r&&this.view.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0,effects:Yq.of(r)})}static open(e){return new u0(e)}}function fue(t,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,${encodeURIComponent(t)}')`}function bx(t){return fue(``,'width="6" height="3"')}const mue=Ke.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:bx("#d11")},".cm-lintRange-warning":{backgroundImage:bx("orange")},".cm-lintRange-info":{backgroundImage:bx("#999")},".cm-lintRange-hint":{backgroundImage:bx("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}});function pue(t){return t=="error"?4:t=="warning"?3:t=="info"?2:1}function gue(t){let e="hint",n=1;for(let r of t){let s=pue(r.severity);s>n&&(n=s,e=r.severity)}return e}const xue=[Ei,Ke.decorations.compute([Ei],t=>{let{selected:e,panel:n}=t.field(Ei);return!e||!n||e.from==e.to?xt.none:xt.set([aue.range(e.from,e.to)])}),Zie(lue,{hideOn:sue}),mue];var mE=function(e){e===void 0&&(e={});var{crosshairCursor:n=!1}=e,r=[];e.closeBracketsKeymap!==!1&&(r=r.concat(Xce)),e.defaultKeymap!==!1&&(r=r.concat(Aoe)),e.searchKeymap!==!1&&(r=r.concat(sce)),e.historyKeymap!==!1&&(r=r.concat(Ble)),e.foldKeymap!==!1&&(r=r.concat(Xae)),e.completionKeymap!==!1&&(r=r.concat(Gq)),e.lintKeymap!==!1&&(r=r.concat(due));var s=[];return e.lineNumbers!==!1&&s.push(cae()),e.highlightActiveLineGutter!==!1&&s.push(hae()),e.highlightSpecialChars!==!1&&s.push(Cie()),e.history!==!1&&s.push(_le()),e.foldGutter!==!1&&s.push(Jae()),e.drawSelection!==!1&&s.push(gie()),e.dropCursor!==!1&&s.push(wie()),e.allowMultipleSelections!==!1&&s.push(dn.allowMultipleSelections.of(!0)),e.indentOnInput!==!1&&s.push(qae()),e.syntaxHighlighting!==!1&&s.push(BB(rle,{fallback:!0})),e.bracketMatching!==!1&&s.push(ule()),e.closeBrackets!==!1&&s.push(Vce()),e.autocompletion!==!1&&s.push(nue()),e.rectangularSelection!==!1&&s.push(Fie()),n!==!1&&s.push(Hie()),e.highlightActiveLine!==!1&&s.push(Rie()),e.highlightSelectionMatches!==!1&&s.push(Boe()),e.tabSize&&typeof e.tabSize=="number"&&s.push(J0.of(" ".repeat(e.tabSize))),s.concat([K0.of(r.flat())]).filter(Boolean)};const vue="#e5c07b",pE="#e06c75",yue="#56b6c2",bue="#ffffff",h1="#abb2bf",VS="#7d8799",wue="#61afef",Sue="#98c379",gE="#d19a66",kue="#c678dd",jue="#21252b",xE="#2c313a",vE="#282c34",Qw="#353a42",Oue="#3E4451",yE="#528bff",Nue=Ke.theme({"&":{color:h1,backgroundColor:vE},".cm-content":{caretColor:yE},".cm-cursor, .cm-dropCursor":{borderLeftColor:yE},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:Oue},".cm-panels":{backgroundColor:jue,color:h1},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847"},".cm-gutters":{backgroundColor:vE,color:VS,border:"none"},".cm-activeLineGutter":{backgroundColor:xE},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:Qw},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:Qw,borderBottomColor:Qw},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:xE,color:h1}}},{dark:!0}),Cue=tp.define([{tag:xe.keyword,color:kue},{tag:[xe.name,xe.deleted,xe.character,xe.propertyName,xe.macroName],color:pE},{tag:[xe.function(xe.variableName),xe.labelName],color:wue},{tag:[xe.color,xe.constant(xe.name),xe.standard(xe.name)],color:gE},{tag:[xe.definition(xe.name),xe.separator],color:h1},{tag:[xe.typeName,xe.className,xe.number,xe.changed,xe.annotation,xe.modifier,xe.self,xe.namespace],color:vue},{tag:[xe.operator,xe.operatorKeyword,xe.url,xe.escape,xe.regexp,xe.link,xe.special(xe.string)],color:yue},{tag:[xe.meta,xe.comment],color:VS},{tag:xe.strong,fontWeight:"bold"},{tag:xe.emphasis,fontStyle:"italic"},{tag:xe.strikethrough,textDecoration:"line-through"},{tag:xe.link,color:VS,textDecoration:"underline"},{tag:xe.heading,fontWeight:"bold",color:pE},{tag:[xe.atom,xe.bool,xe.special(xe.variableName)],color:gE},{tag:[xe.processingInstruction,xe.string,xe.inserted],color:Sue},{tag:xe.invalid,color:bue}]),Jq=[Nue,BB(Cue)];var Tue=Ke.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),Eue=function(e){e===void 0&&(e={});var{indentWithTab:n=!0,editable:r=!0,readOnly:s=!1,theme:i="light",placeholder:a="",basicSetup:o=!0}=e,c=[];switch(n&&c.unshift(K0.of([Roe])),o&&(typeof o=="boolean"?c.unshift(mE()):c.unshift(mE(o))),a&&c.unshift(Lie(a)),i){case"light":c.push(Tue);break;case"dark":c.push(Jq);break;case"none":break;default:c.push(i);break}return r===!1&&c.push(Ke.editable.of(!1)),s&&c.push(dn.readOnly.of(!0)),[...c]},_ue=t=>({line:t.state.doc.lineAt(t.state.selection.main.from),lineCount:t.state.doc.lines,lineBreak:t.state.lineBreak,length:t.state.doc.length,readOnly:t.state.readOnly,tabSize:t.state.tabSize,selection:t.state.selection,selectionAsSingle:t.state.selection.asSingle().main,ranges:t.state.selection.ranges,selectionCode:t.state.sliceDoc(t.state.selection.main.from,t.state.selection.main.to),selections:t.state.selection.ranges.map(e=>t.state.sliceDoc(e.from,e.to)),selectedText:t.state.selection.ranges.some(e=>!e.empty)});class Mue{constructor(e,n){this.timeLeftMS=void 0,this.timeoutMS=void 0,this.isCancelled=!1,this.isTimeExhausted=!1,this.callbacks=[],this.timeLeftMS=n,this.timeoutMS=n,this.callbacks.push(e)}tick(){if(!this.isCancelled&&!this.isTimeExhausted&&(this.timeLeftMS--,this.timeLeftMS<=0)){this.isTimeExhausted=!0;var e=this.callbacks.slice();this.callbacks.length=0,e.forEach(n=>{try{n()}catch(r){console.error("TimeoutLatch callback error:",r)}})}}cancel(){this.isCancelled=!0,this.callbacks.length=0}reset(){this.timeLeftMS=this.timeoutMS,this.isCancelled=!1,this.isTimeExhausted=!1}get isDone(){return this.isCancelled||this.isTimeExhausted}}class bE{constructor(){this.interval=null,this.latches=new Set}add(e){this.latches.add(e),this.start()}remove(e){this.latches.delete(e),this.latches.size===0&&this.stop()}start(){this.interval===null&&(this.interval=setInterval(()=>{this.latches.forEach(e=>{e.tick(),e.isDone&&this.remove(e)})},1))}stop(){this.interval!==null&&(clearInterval(this.interval),this.interval=null)}}var Hw=null,Aue=()=>typeof window>"u"?new bE:(Hw||(Hw=new bE),Hw),wE=pl.define(),Rue=200,Due=[];function zue(t){var{value:e,selection:n,onChange:r,onStatistics:s,onCreateEditor:i,onUpdate:a,extensions:o=Due,autoFocus:c,theme:h="light",height:f=null,minHeight:m=null,maxHeight:g=null,width:x=null,minWidth:y=null,maxWidth:w=null,placeholder:S="",editable:k=!0,readOnly:N=!1,indentWithTab:C=!0,basicSetup:T=!0,root:_,initialState:E}=t,[M,L]=b.useState(),[P,I]=b.useState(),[Q,U]=b.useState(),ee=b.useState(()=>({current:null}))[0],z=b.useState(()=>({current:null}))[0],H=Ke.theme({"&":{height:f,minHeight:m,maxHeight:g,width:x,minWidth:y,maxWidth:w},"& .cm-scroller":{height:"100% !important"}}),B=Ke.updateListener.of(G=>{if(G.docChanged&&typeof r=="function"&&!G.transactions.some(W=>W.annotation(wE))){ee.current?ee.current.reset():(ee.current=new Mue(()=>{if(z.current){var W=z.current;z.current=null,W()}ee.current=null},Rue),Aue().add(ee.current));var R=G.state.doc,se=R.toString();r(se,G)}s&&s(_ue(G))}),X=Eue({theme:h,editable:k,readOnly:N,placeholder:S,indentWithTab:C,basicSetup:T}),J=[B,H,...X];return a&&typeof a=="function"&&J.push(Ke.updateListener.of(a)),J=J.concat(o),b.useLayoutEffect(()=>{if(M&&!Q){var G={doc:e,selection:n,extensions:J},R=E?dn.fromJSON(E.json,G,E.fields):dn.create(G);if(U(R),!P){var se=new Ke({state:R,parent:M,root:_});I(se),i&&i(se,R)}}return()=>{P&&(U(void 0),I(void 0))}},[M,Q]),b.useEffect(()=>{t.container&&L(t.container)},[t.container]),b.useEffect(()=>()=>{P&&(P.destroy(),I(void 0)),ee.current&&(ee.current.cancel(),ee.current=null)},[P]),b.useEffect(()=>{c&&P&&P.focus()},[c,P]),b.useEffect(()=>{P&&P.dispatch({effects:Lt.reconfigure.of(J)})},[h,o,f,m,g,x,y,w,S,k,N,C,T,r,a]),b.useEffect(()=>{if(e!==void 0){var G=P?P.state.doc.toString():"";if(P&&e!==G){var R=ee.current&&!ee.current.isDone,se=()=>{P&&e!==P.state.doc.toString()&&P.dispatch({changes:{from:0,to:P.state.doc.toString().length,insert:e||""},annotations:[wE.of(!0)]})};R?z.current=se:se()}}},[e,P]),{state:Q,setState:U,view:P,setView:I,container:M,setContainer:L}}var Pue=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],eF=b.forwardRef((t,e)=>{var{className:n,value:r="",selection:s,extensions:i=[],onChange:a,onStatistics:o,onCreateEditor:c,onUpdate:h,autoFocus:f,theme:m="light",height:g,minHeight:x,maxHeight:y,width:w,minWidth:S,maxWidth:k,basicSetup:N,placeholder:C,indentWithTab:T,editable:_,readOnly:E,root:M,initialState:L}=t,P=jY(t,Pue),I=b.useRef(null),{state:Q,view:U,container:ee,setContainer:z}=zue({root:M,value:r,autoFocus:f,theme:m,height:g,minHeight:x,maxHeight:y,width:w,minWidth:S,maxWidth:k,basicSetup:N,placeholder:C,indentWithTab:T,editable:_,readOnly:E,selection:s,onChange:a,onStatistics:o,onCreateEditor:c,onUpdate:h,extensions:i,initialState:L});b.useImperativeHandle(e,()=>({editor:I.current,state:Q,view:U}),[I,ee,Q,U]);var H=b.useCallback(X=>{I.current=X,z(X)},[z]);if(typeof r!="string")throw new Error("value must be typeof string but got "+typeof r);var B=typeof m=="string"?"cm-theme-"+m:"cm-theme";return l.jsx("div",OY({ref:H,className:""+B+(n?" "+n:"")},P))});eF.displayName="CodeMirror";var SE={};class ev{constructor(e,n,r,s,i,a,o,c,h,f=0,m){this.p=e,this.stack=n,this.state=r,this.reducePos=s,this.pos=i,this.score=a,this.buffer=o,this.bufferBase=c,this.curContext=h,this.lookAhead=f,this.parent=m}toString(){return`[${this.stack.filter((e,n)=>n%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,n,r=0){let s=e.parser.context;return new ev(e,[],n,r,r,0,[],0,s?new kE(s,s.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,n){this.stack.push(this.state,n,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var n;let r=e>>19,s=e&65535,{parser:i}=this.p,a=this.reducePos=2e3&&!(!((n=this.p.parser.nodeSet.types[s])===null||n===void 0)&&n.isAnonymous)&&(h==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=f):this.p.lastBigReductionSizec;)this.stack.pop();this.reduceContext(s,h)}storeNode(e,n,r,s=4,i=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]0&&a.buffer[o-4]==0&&a.buffer[o-1]>-1){if(n==r)return;if(a.buffer[o-2]>=n){a.buffer[o-2]=r;return}}}if(!i||this.pos==r)this.buffer.push(e,n,r,s);else{let a=this.buffer.length;if(a>0&&(this.buffer[a-4]!=0||this.buffer[a-1]<0)){let o=!1;for(let c=a;c>0&&this.buffer[c-2]>r;c-=4)if(this.buffer[c-1]>=0){o=!0;break}if(o)for(;a>0&&this.buffer[a-2]>r;)this.buffer[a]=this.buffer[a-4],this.buffer[a+1]=this.buffer[a-3],this.buffer[a+2]=this.buffer[a-2],this.buffer[a+3]=this.buffer[a-1],a-=4,s>4&&(s-=4)}this.buffer[a]=e,this.buffer[a+1]=n,this.buffer[a+2]=r,this.buffer[a+3]=s}}shift(e,n,r,s){if(e&131072)this.pushState(e&65535,this.pos);else if((e&262144)==0){let i=e,{parser:a}=this.p;(s>this.pos||n<=a.maxNode)&&(this.pos=s,a.stateFlag(i,1)||(this.reducePos=s)),this.pushState(i,r),this.shiftContext(n,r),n<=a.maxNode&&this.buffer.push(n,r,s,4)}else this.pos=s,this.shiftContext(n,r),n<=this.p.parser.maxNode&&this.buffer.push(n,r,s,4)}apply(e,n,r,s){e&65536?this.reduce(e):this.shift(e,n,r,s)}useNode(e,n){let r=this.p.reused.length-1;(r<0||this.p.reused[r]!=e)&&(this.p.reused.push(e),r++);let s=this.pos;this.reducePos=this.pos=s+e.length,this.pushState(n,s),this.buffer.push(r,s,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,n=e.buffer.length;for(;n>0&&e.buffer[n-2]>e.reducePos;)n-=4;let r=e.buffer.slice(n),s=e.bufferBase+n;for(;e&&s==e.bufferBase;)e=e.parent;return new ev(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,r,s,this.curContext,this.lookAhead,e)}recoverByDelete(e,n){let r=e<=this.p.parser.maxNode;r&&this.storeNode(e,this.pos,n,4),this.storeNode(0,this.pos,n,r?8:4),this.pos=this.reducePos=n,this.score-=190}canShift(e){for(let n=new Lue(this);;){let r=this.p.parser.stateSlot(n.state,4)||this.p.parser.hasAction(n.state,e);if(r==0)return!1;if((r&65536)==0)return!0;n.reduce(r)}}recoverByInsert(e){if(this.stack.length>=300)return[];let n=this.p.parser.nextStates(this.state);if(n.length>8||this.stack.length>=120){let s=[];for(let i=0,a;ic&1&&o==a)||s.push(n[i],a)}n=s}let r=[];for(let s=0;s>19,s=n&65535,i=this.stack.length-r*3;if(i<0||e.getGoto(this.stack[i],s,!1)<0){let a=this.findForcedReduction();if(a==null)return!1;n=a}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(n),!0}findForcedReduction(){let{parser:e}=this.p,n=[],r=(s,i)=>{if(!n.includes(s))return n.push(s),e.allActions(s,a=>{if(!(a&393216))if(a&65536){let o=(a>>19)-i;if(o>1){let c=a&65535,h=this.stack.length-o*3;if(h>=0&&e.getGoto(this.stack[h],c,!1)>=0)return o<<19|65536|c}}else{let o=r(a,i+1);if(o!=null)return o}})};return r(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let n=0;nthis.lookAhead&&(this.emitLookAhead(),this.lookAhead=e)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class kE{constructor(e,n){this.tracker=e,this.context=n,this.hash=e.strict?e.hash(n):0}}class Lue{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let n=e&65535,r=e>>19;r==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(r-1)*3;let s=this.start.p.parser.getGoto(this.stack[this.base-3],n,!0);this.state=s}}class tv{constructor(e,n,r){this.stack=e,this.pos=n,this.index=r,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,n=e.bufferBase+e.buffer.length){return new tv(e,n,n-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new tv(this.stack,this.pos,this.index)}}function wx(t,e=Uint16Array){if(typeof t!="string")return t;let n=null;for(let r=0,s=0;r=92&&a--,a>=34&&a--;let c=a-32;if(c>=46&&(c-=46,o=!0),i+=c,o)break;i*=46}n?n[s++]=i:n=new e(i)}return n}class f1{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const jE=new f1;class Iue{constructor(e,n){this.input=e,this.ranges=n,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=jE,this.rangeIndex=0,this.pos=this.chunkPos=n[0].from,this.range=n[0],this.end=n[n.length-1].to,this.readNext()}resolveOffset(e,n){let r=this.range,s=this.rangeIndex,i=this.pos+e;for(;ir.to:i>=r.to;){if(s==this.ranges.length-1)return null;let a=this.ranges[++s];i+=a.from-r.to,r=a}return i}clipPos(e){if(e>=this.range.from&&ee)return Math.max(e,n.from);return this.end}peek(e){let n=this.chunkOff+e,r,s;if(n>=0&&n=this.chunk2Pos&&ro.to&&(this.chunk2=this.chunk2.slice(0,o.to-r)),s=this.chunk2.charCodeAt(0)}}return r>=this.token.lookAhead&&(this.token.lookAhead=r+1),s}acceptToken(e,n=0){let r=n?this.resolveOffset(n,-1):this.pos;if(r==null||r=this.chunk2Pos&&this.posthis.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,n){if(n?(this.token=n,n.start=e,n.lookAhead=e+1,n.value=n.extended=-1):this.token=jE,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e=this.chunkPos&&n<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,n-this.chunkPos);if(e>=this.chunk2Pos&&n<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,n-this.chunk2Pos);if(e>=this.range.from&&n<=this.range.to)return this.input.read(e,n);let r="";for(let s of this.ranges){if(s.from>=n)break;s.to>e&&(r+=this.input.read(Math.max(s.from,e),Math.min(s.to,n)))}return r}}class lh{constructor(e,n){this.data=e,this.id=n}token(e,n){let{parser:r}=n.p;Bue(this.data,e,n,this.id,r.data,r.tokenPrecTable)}}lh.prototype.contextual=lh.prototype.fallback=lh.prototype.extend=!1;lh.prototype.fallback=lh.prototype.extend=!1;class oy{constructor(e,n={}){this.token=e,this.contextual=!!n.contextual,this.fallback=!!n.fallback,this.extend=!!n.extend}}function Bue(t,e,n,r,s,i){let a=0,o=1<0){let y=t[x];if(c.allows(y)&&(e.token.value==-1||e.token.value==y||que(y,e.token.value,s,i))){e.acceptToken(y);break}}let f=e.next,m=0,g=t[a+2];if(e.next<0&&g>m&&t[h+g*3-3]==65535){a=t[h+g*3-1];continue e}for(;m>1,y=h+x+(x<<1),w=t[y],S=t[y+1]||65536;if(f=S)m=x+1;else{a=t[y+2],e.advance();continue e}}break}}function OE(t,e,n){for(let r=e,s;(s=t[r])!=65535;r++)if(s==n)return r-e;return-1}function que(t,e,n,r){let s=OE(n,r,e);return s<0||OE(n,r,t)e)&&!r.type.isError)return n<0?Math.max(0,Math.min(r.to-1,e-25)):Math.min(t.length,Math.max(r.from+1,e+25));if(n<0?r.prevSibling():r.nextSibling())break;if(!r.parent())return n<0?0:t.length}}class Fue{constructor(e,n){this.fragments=e,this.nodeSet=n,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?NE(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?NE(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(ee)return this.nextStart=a,null;if(i instanceof Xn){if(a==e){if(a=Math.max(this.safeFrom,e)&&(this.trees.push(i),this.start.push(a),this.index.push(0))}else this.index[n]++,this.nextStart=a+i.length}}}class $ue{constructor(e,n){this.stream=n,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(r=>new f1)}getActions(e){let n=0,r=null,{parser:s}=e.p,{tokenizers:i}=s,a=s.stateSlot(e.state,3),o=e.curContext?e.curContext.hash:0,c=0;for(let h=0;hm.end+25&&(c=Math.max(m.lookAhead,c)),m.value!=0)){let g=n;if(m.extended>-1&&(n=this.addActions(e,m.extended,m.end,n)),n=this.addActions(e,m.value,m.end,n),!f.extend&&(r=m,n>g))break}}for(;this.actions.length>n;)this.actions.pop();return c&&e.setLookAhead(c),!r&&e.pos==this.stream.end&&(r=new f1,r.value=e.p.parser.eofTerm,r.start=r.end=e.pos,n=this.addActions(e,r.value,r.end,n)),this.mainToken=r,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let n=new f1,{pos:r,p:s}=e;return n.start=r,n.end=Math.min(r+1,s.stream.end),n.value=r==s.stream.end?s.parser.eofTerm:0,n}updateCachedToken(e,n,r){let s=this.stream.clipPos(r.pos);if(n.token(this.stream.reset(s,e),r),e.value>-1){let{parser:i}=r.p;for(let a=0;a=0&&r.p.parser.dialect.allows(o>>1)){(o&1)==0?e.value=o>>1:e.extended=o>>1;break}}}else e.value=0,e.end=this.stream.clipPos(s+1)}putAction(e,n,r,s){for(let i=0;ie.bufferLength*4?new Fue(r,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,n=this.minStackPos,r=this.stacks=[],s,i;if(this.bigReductionCount>300&&e.length==1){let[a]=e;for(;a.forceReduce()&&a.stack.length&&a.stack[a.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let a=0;an)r.push(o);else{if(this.advanceStack(o,r,e))continue;{s||(s=[],i=[]),s.push(o);let c=this.tokens.getMainToken(o);i.push(c.value,c.end)}}break}}if(!r.length){let a=s&&Uue(s);if(a)return ki&&console.log("Finish with "+this.stackID(a)),this.stackToTree(a);if(this.parser.strict)throw ki&&s&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+n);this.recovering||(this.recovering=5)}if(this.recovering&&s){let a=this.stoppedAt!=null&&s[0].pos>this.stoppedAt?s[0]:this.runRecovery(s,i,r);if(a)return ki&&console.log("Force-finish "+this.stackID(a)),this.stackToTree(a.forceAll())}if(this.recovering){let a=this.recovering==1?1:this.recovering*3;if(r.length>a)for(r.sort((o,c)=>c.score-o.score);r.length>a;)r.pop();r.some(o=>o.reducePos>n)&&this.recovering--}else if(r.length>1){e:for(let a=0;a500&&h.buffer.length>500)if((o.score-h.score||o.buffer.length-h.buffer.length)>0)r.splice(c--,1);else{r.splice(a--,1);continue e}}}r.length>12&&r.splice(12,r.length-12)}this.minStackPos=r[0].pos;for(let a=1;a ":"";if(this.stoppedAt!=null&&s>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let h=e.curContext&&e.curContext.tracker.strict,f=h?e.curContext.hash:0;for(let m=this.fragments.nodeAt(s);m;){let g=this.parser.nodeSet.types[m.type.id]==m.type?i.getGoto(e.state,m.type.id):-1;if(g>-1&&m.length&&(!h||(m.prop(Yt.contextHash)||0)==f))return e.useNode(m,g),ki&&console.log(a+this.stackID(e)+` (via reuse of ${i.getName(m.type.id)})`),!0;if(!(m instanceof Xn)||m.children.length==0||m.positions[0]>0)break;let x=m.children[0];if(x instanceof Xn&&m.positions[0]==0)m=x;else break}}let o=i.stateSlot(e.state,4);if(o>0)return e.reduce(o),ki&&console.log(a+this.stackID(e)+` (via always-reduce ${i.getName(o&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let c=this.tokens.getActions(e);for(let h=0;hs?n.push(y):r.push(y)}return!1}advanceFully(e,n){let r=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>r)return CE(e,n),!0}}runRecovery(e,n,r){let s=null,i=!1;for(let a=0;a ":"";if(o.deadEnd&&(i||(i=!0,o.restart(),ki&&console.log(f+this.stackID(o)+" (restarted)"),this.advanceFully(o,r))))continue;let m=o.split(),g=f;for(let x=0;x<10&&m.forceReduce()&&(ki&&console.log(g+this.stackID(m)+" (via force-reduce)"),!this.advanceFully(m,r));x++)ki&&(g=this.stackID(m)+" -> ");for(let x of o.recoverByInsert(c))ki&&console.log(f+this.stackID(x)+" (via recover-insert)"),this.advanceFully(x,r);this.stream.end>o.pos?(h==o.pos&&(h++,c=0),o.recoverByDelete(c,h),ki&&console.log(f+this.stackID(o)+` (via recover-delete ${this.parser.getName(c)})`),CE(o,r)):(!s||s.scoret;class Vue{constructor(e){this.start=e.start,this.shift=e.shift||Uw,this.reduce=e.reduce||Uw,this.reuse=e.reuse||Uw,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}}class d0 extends V6{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let n=e.nodeNames.split(" ");this.minRepeatTerm=n.length;for(let o=0;oe.topRules[o][1]),s=[];for(let o=0;o=0)i(f,c,o[h++]);else{let m=o[h+-f];for(let g=-f;g>0;g--)i(o[h++],c,m);h++}}}this.nodeSet=new Jv(n.map((o,c)=>qs.define({name:c>=this.minRepeatTerm?void 0:o,id:c,props:s[c],top:r.indexOf(c)>-1,error:c==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(c)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=yB;let a=wx(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let o=0;otypeof o=="number"?new lh(a,o):o),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,n,r){let s=new Que(this,e,n,r);for(let i of this.wrappers)s=i(s,e,n,r);return s}getGoto(e,n,r=!1){let s=this.goto;if(n>=s[0])return-1;for(let i=s[n+1];;){let a=s[i++],o=a&1,c=s[i++];if(o&&r)return c;for(let h=i+(a>>1);i0}validAction(e,n){return!!this.allActions(e,r=>r==n?!0:null)}allActions(e,n){let r=this.stateSlot(e,4),s=r?n(r):void 0;for(let i=this.stateSlot(e,1);s==null;i+=3){if(this.data[i]==65535)if(this.data[i+1]==1)i=eo(this.data,i+2);else break;s=n(eo(this.data,i+1))}return s}nextStates(e){let n=[];for(let r=this.stateSlot(e,1);;r+=3){if(this.data[r]==65535)if(this.data[r+1]==1)r=eo(this.data,r+2);else break;if((this.data[r+2]&1)==0){let s=this.data[r+1];n.some((i,a)=>a&1&&i==s)||n.push(this.data[r],s)}}return n}configure(e){let n=Object.assign(Object.create(d0.prototype),this);if(e.props&&(n.nodeSet=this.nodeSet.extend(...e.props)),e.top){let r=this.topRules[e.top];if(!r)throw new RangeError(`Invalid top rule name ${e.top}`);n.top=r}return e.tokenizers&&(n.tokenizers=this.tokenizers.map(r=>{let s=e.tokenizers.find(i=>i.from==r);return s?s.to:r})),e.specializers&&(n.specializers=this.specializers.slice(),n.specializerSpecs=this.specializerSpecs.map((r,s)=>{let i=e.specializers.find(o=>o.from==r.external);if(!i)return r;let a=Object.assign(Object.assign({},r),{external:i.to});return n.specializers[s]=TE(a),a})),e.contextTracker&&(n.context=e.contextTracker),e.dialect&&(n.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(n.strict=e.strict),e.wrap&&(n.wrappers=n.wrappers.concat(e.wrap)),e.bufferLength!=null&&(n.bufferLength=e.bufferLength),n}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let n=this.dynamicPrecedences;return n==null?0:n[e]||0}parseDialect(e){let n=Object.keys(this.dialects),r=n.map(()=>!1);if(e)for(let i of e.split(" ")){let a=n.indexOf(i);a>=0&&(r[a]=!0)}let s=null;for(let i=0;ir)&&n.p.parser.stateFlag(n.state,2)&&(!e||e.scoret.external(n,r)<<1|e}return t.get}const Wue=1,tF=194,nF=195,Gue=196,EE=197,Xue=198,Yue=199,Kue=200,Zue=2,rF=3,_E=201,Jue=24,ede=25,tde=49,nde=50,rde=55,sde=56,ide=57,ade=59,lde=60,ode=61,cde=62,ude=63,dde=65,hde=238,fde=71,mde=241,pde=242,gde=243,xde=244,vde=245,yde=246,bde=247,wde=248,sF=72,Sde=249,kde=250,jde=251,Ode=252,Nde=253,Cde=254,Tde=255,Ede=256,_de=73,Mde=77,Ade=263,Rde=112,Dde=130,zde=151,Pde=152,Lde=155,Pu=10,h0=13,mj=32,cy=9,pj=35,Ide=40,Bde=46,US=123,ME=125,iF=39,aF=34,AE=92,qde=111,Fde=120,$de=78,Qde=117,Hde=85,Vde=new Set([ede,tde,nde,Ade,dde,Dde,sde,ide,hde,cde,ude,sF,_de,Mde,lde,ode,zde,Pde,Lde,Rde]);function Ww(t){return t==Pu||t==h0}function Gw(t){return t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102}const Ude=new oy((t,e)=>{let n;if(t.next<0)t.acceptToken(Yue);else if(e.context.flags&m1)Ww(t.next)&&t.acceptToken(Xue,1);else if(((n=t.peek(-1))<0||Ww(n))&&e.canShift(EE)){let r=0;for(;t.next==mj||t.next==cy;)t.advance(),r++;(t.next==Pu||t.next==h0||t.next==pj)&&t.acceptToken(EE,-r)}else Ww(t.next)&&t.acceptToken(Gue,1)},{contextual:!0}),Wde=new oy((t,e)=>{let n=e.context;if(n.flags)return;let r=t.peek(-1);if(r==Pu||r==h0){let s=0,i=0;for(;;){if(t.next==mj)s++;else if(t.next==cy)s+=8-s%8;else break;t.advance(),i++}s!=n.indent&&t.next!=Pu&&t.next!=h0&&t.next!=pj&&(s[t,e|lF])),Yde=new Vue({start:Gde,reduce(t,e,n,r){return t.flags&m1&&Vde.has(e)||(e==fde||e==sF)&&t.flags&lF?t.parent:t},shift(t,e,n,r){return e==tF?new p1(t,Xde(r.read(r.pos,n.pos)),0):e==nF?t.parent:e==Jue||e==rde||e==ade||e==rF?new p1(t,0,m1):RE.has(e)?new p1(t,0,RE.get(e)|t.flags&m1):t},hash(t){return t.hash}}),Kde=new oy(t=>{for(let e=0;e<5;e++){if(t.next!="print".charCodeAt(e))return;t.advance()}if(!/\w/.test(String.fromCharCode(t.next)))for(let e=0;;e++){let n=t.peek(e);if(!(n==mj||n==cy)){n!=Ide&&n!=Bde&&n!=Pu&&n!=h0&&n!=pj&&t.acceptToken(Wue);return}}}),Zde=new oy((t,e)=>{let{flags:n}=e.context,r=n&Yl?aF:iF,s=(n&Kl)>0,i=!(n&Zl),a=(n&Jl)>0,o=t.pos;for(;!(t.next<0);)if(a&&t.next==US)if(t.peek(1)==US)t.advance(2);else{if(t.pos==o){t.acceptToken(rF,1);return}break}else if(i&&t.next==AE){if(t.pos==o){t.advance();let c=t.next;c>=0&&(t.advance(),Jde(t,c)),t.acceptToken(Zue);return}break}else if(t.next==AE&&!i&&t.peek(1)>-1)t.advance(2);else if(t.next==r&&(!s||t.peek(1)==r&&t.peek(2)==r)){if(t.pos==o){t.acceptToken(_E,s?3:1);return}break}else if(t.next==Pu){if(s)t.advance();else if(t.pos==o){t.acceptToken(_E);return}break}else t.advance();t.pos>o&&t.acceptToken(Kue)});function Jde(t,e){if(e==qde)for(let n=0;n<2&&t.next>=48&&t.next<=55;n++)t.advance();else if(e==Fde)for(let n=0;n<2&&Gw(t.next);n++)t.advance();else if(e==Qde)for(let n=0;n<4&&Gw(t.next);n++)t.advance();else if(e==Hde)for(let n=0;n<8&&Gw(t.next);n++)t.advance();else if(e==$de&&t.next==US){for(t.advance();t.next>=0&&t.next!=ME&&t.next!=iF&&t.next!=aF&&t.next!=Pu;)t.advance();t.next==ME&&t.advance()}}const ehe=U6({'async "*" "**" FormatConversion FormatSpec':xe.modifier,"for while if elif else try except finally return raise break continue with pass assert await yield match case":xe.controlKeyword,"in not and or is del":xe.operatorKeyword,"from def class global nonlocal lambda":xe.definitionKeyword,import:xe.moduleKeyword,"with as print":xe.keyword,Boolean:xe.bool,None:xe.null,VariableName:xe.variableName,"CallExpression/VariableName":xe.function(xe.variableName),"FunctionDefinition/VariableName":xe.function(xe.definition(xe.variableName)),"ClassDefinition/VariableName":xe.definition(xe.className),PropertyName:xe.propertyName,"CallExpression/MemberExpression/PropertyName":xe.function(xe.propertyName),Comment:xe.lineComment,Number:xe.number,String:xe.string,FormatString:xe.special(xe.string),Escape:xe.escape,UpdateOp:xe.updateOperator,"ArithOp!":xe.arithmeticOperator,BitOp:xe.bitwiseOperator,CompareOp:xe.compareOperator,AssignOp:xe.definitionOperator,Ellipsis:xe.punctuation,At:xe.meta,"( )":xe.paren,"[ ]":xe.squareBracket,"{ }":xe.brace,".":xe.derefOperator,", ;":xe.separator}),the={__proto__:null,await:44,or:54,and:56,in:60,not:62,is:64,if:70,else:72,lambda:76,yield:94,from:96,async:102,for:104,None:162,True:164,False:164,del:178,pass:182,break:186,continue:190,return:194,raise:202,import:206,as:208,global:212,nonlocal:214,assert:218,type:223,elif:236,while:240,try:246,except:248,finally:250,with:254,def:258,class:268,match:279,case:285},nhe=d0.deserialize({version:14,states:"##jO`QeOOP$}OSOOO&WQtO'#HUOOQS'#Co'#CoOOQS'#Cp'#CpO'vQdO'#CnO*UQtO'#HTOOQS'#HU'#HUOOQS'#DU'#DUOOQS'#HT'#HTO*rQdO'#D_O+VQdO'#DfO+gQdO'#DjO+zOWO'#DuO,VOWO'#DvO.[QtO'#GuOOQS'#Gu'#GuO'vQdO'#GtO0ZQtO'#GtOOQS'#Eb'#EbO0rQdO'#EcOOQS'#Gs'#GsO0|QdO'#GrOOQV'#Gr'#GrO1XQdO'#FYOOQS'#G^'#G^O1^QdO'#FXOOQV'#IS'#ISOOQV'#Gq'#GqOOQV'#Fq'#FqQ`QeOOO'vQdO'#CqO1lQdO'#C}O1sQdO'#DRO2RQdO'#HYO2cQtO'#EVO'vQdO'#EWOOQS'#EY'#EYOOQS'#E['#E[OOQS'#E^'#E^O2wQdO'#E`O3_QdO'#EdO3rQdO'#EfO3zQtO'#EfO1XQdO'#EiO0rQdO'#ElO1XQdO'#EnO0rQdO'#EtO0rQdO'#EwO4VQdO'#EyO4^QdO'#FOO4iQdO'#EzO0rQdO'#FOO1XQdO'#FQO1XQdO'#FVO4nQdO'#F[P4uOdO'#GpPOOO)CBd)CBdOOQS'#Ce'#CeOOQS'#Cf'#CfOOQS'#Cg'#CgOOQS'#Ch'#ChOOQS'#Ci'#CiOOQS'#Cj'#CjOOQS'#Cl'#ClO'vQdO,59OO'vQdO,59OO'vQdO,59OO'vQdO,59OO'vQdO,59OO'vQdO,59OO5TQdO'#DoOOQS,5:Y,5:YO5hQdO'#HdOOQS,5:],5:]O5uQ!fO,5:]O5zQtO,59YO1lQdO,59bO1lQdO,59bO1lQdO,59bO8jQdO,59bO8oQdO,59bO8vQdO,59jO8}QdO'#HTO:TQdO'#HSOOQS'#HS'#HSOOQS'#D['#D[O:lQdO,59aO'vQdO,59aO:zQdO,59aOOQS,59y,59yO;PQdO,5:RO'vQdO,5:ROOQS,5:Q,5:QO;_QdO,5:QO;dQdO,5:XO'vQdO,5:XO'vQdO,5:VOOQS,5:U,5:UO;uQdO,5:UO;zQdO,5:WOOOW'#Fy'#FyOOOOQS'#Ds'#DsOOQS1G/w1G/wOOQS1G.|1G.|O!/[QtO1G.|O!/cQtO1G.|O1lQdO1G.|O!0OQdO1G/UOOQS'#DZ'#DZO0rQdO,59tOOQS1G.{1G.{O!0VQdO1G/eO!0gQdO1G/eO!0oQdO1G/fO'vQdO'#H[O!0tQdO'#H[O!0yQtO1G.{O!1ZQdO,59iO!2aQdO,5=zO!2qQdO,5=zO!2yQdO1G/mO!3OQtO1G/mOOQS1G/l1G/lO!3`QdO,5=uO!4VQdO,5=uO0rQdO1G/qO!4tQdO1G/sO!4yQtO1G/sO!5ZQtO1G/qOOQS1G/p1G/pOOQS1G/r1G/rOOOW-E9w-E9wOOQS1G/{1G/{O!5kQdO'#HxO0rQdO'#HxO!5|QdO,5>cOOOW-E9x-E9xOOQS1G/|1G/|OOQS-E9{-E9{O!6[Q#xO1G2zO!6{QtO1G2zO'vQdO,5kOOQS1G1`1G1`O!8RQdO1G1`OOQS'#DV'#DVO0rQdO,5=qOOQS,5=q,5=qO!8WQdO'#FrO!8cQdO,59oO!8kQdO1G/XO!8uQtO,5=uOOQS1G3`1G3`OOQS,5:m,5:mO!9fQdO'#GtOOQS,5jO!;ZQdO,5>jO1XQdO,5>jO!;lQdO,5>iOOQS-E:R-E:RO!;qQdO1G0lO!;|QdO1G0lO!lO!lO!hO!=VQdO,5>hO!=hQdO'#EpO0rQdO1G0tO!=sQdO1G0tO!=xQgO1G0zO!AvQgO1G0}O!EqQdO,5>oO!E{QdO,5>oO!FTQtO,5>oO0rQdO1G1PO!F_QdO1G1PO4iQdO1G1UO!!vQdO1G1WOOQV,5;a,5;aO!FdQfO,5;aO!FiQgO1G1QO!JjQdO'#GZO4iQdO1G1QO4iQdO1G1QO!JzQdO,5>pO!KXQdO,5>pO1XQdO,5>pOOQV1G1U1G1UO!KaQdO'#FSO!KrQ!fO1G1WO!KzQdO1G1WOOQV1G1]1G1]O4iQdO1G1]O!LPQdO1G1]O!LXQdO'#F^OOQV1G1b1G1bO!#ZQtO1G1bPOOO1G2v1G2vP!L^OSO1G2vOOQS,5=},5=}OOQS'#Dp'#DpO0rQdO,5=}O!LfQdO,5=|O!LyQdO,5=|OOQS1G/u1G/uO!MRQdO,5>PO!McQdO,5>PO!MkQdO,5>PO!NOQdO,5>PO!N`QdO,5>POOQS1G3j1G3jOOQS7+$h7+$hO!8kQdO7+$pO#!RQdO1G.|O#!YQdO1G.|OOQS1G/`1G/`OOQS,5<`,5<`O'vQdO,5<`OOQS7+%P7+%PO#!aQdO7+%POOQS-E9r-E9rOOQS7+%Q7+%QO#!qQdO,5=vO'vQdO,5=vOOQS7+$g7+$gO#!vQdO7+%PO##OQdO7+%QO##TQdO1G3fOOQS7+%X7+%XO##eQdO1G3fO##mQdO7+%XOOQS,5<_,5<_O'vQdO,5<_O##rQdO1G3aOOQS-E9q-E9qO#$iQdO7+%]OOQS7+%_7+%_O#$wQdO1G3aO#%fQdO7+%_O#%kQdO1G3gO#%{QdO1G3gO#&TQdO7+%]O#&YQdO,5>dO#&sQdO,5>dO#&sQdO,5>dOOQS'#Dx'#DxO#'UO&jO'#DzO#'aO`O'#HyOOOW1G3}1G3}O#'fQdO1G3}O#'nQdO1G3}O#'yQ#xO7+(fO#(jQtO1G2UP#)TQdO'#GOOOQS,5nQdO,5sQdO1G4OOOQS-E9y-E9yO#?^QdO1G4OO<[QdO'#H{OOOO'#D{'#D{OOOO'#F|'#F|O#?oO&jO,5:fOOOW,5>e,5>eOOOW7+)i7+)iO#?zQdO7+)iO#@SQdO1G2zO#@mQdO1G2zP'vQdO'#FuO0rQdO<mO#BQQdO,5>mOOQS1G0v1G0vOOQS<rO#KgQdO,5>rO#KrQdO,5>rO#K}QdO,5>qO#L`QdO,5>qOOQS1G1Y1G1YOOQS,5;p,5;pOOQV<VAN>VO$ oQdO<cAN>cO0rQdO1G1|O$!PQtO1G1|P$!ZQdO'#FvOOQS1G2R1G2RP$!hQdO'#F{O$!uQdO7+)jO$#`QdO,5>gOOOO-E9z-E9zOOOW<tO$4{QdO,5>tO1XQdO,5vO$)nQdO,5>vOOQS1G1p1G1pOOQS,5<[,5<[OOQU7+'P7+'PO$+zQdO1G/iO$)nQdO,5wO$8zQdO,5>wOOQS1G1s1G1sOOQS7+'S7+'SP$)nQdO'#GdO$9SQdO1G4bO$9^QdO1G4bO$9fQdO1G4bOOQS7+%T7+%TO$9tQdO1G1tO$:SQtO'#FaO$:ZQdO,5<}OOQS,5<},5<}O$:iQdO1G4cOOQS-E:a-E:aO$)nQdO,5<|O$:pQdO,5<|O$:uQdO7+)|OOQS-E:`-E:`O$;PQdO7+)|O$)nQdO,5S~O%cOS%^OSSOS%]PQ~OPdOVaOfoOhYOopOs!POvqO!PrO!Q{O!T!SO!U!RO!XZO!][O!h`O!r`O!s`O!t`O!{tO!}uO#PvO#RwO#TxO#XyO#ZzO#^|O#_|O#a}O#c!OO#l!QO#o!TO#s!UO#u!VO#z!WO#}hO$P!XO%oRO%pRO%tSO%uWO&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O&c^O&d^O&e^O&f^O&g^O&h^O&i^O&j^O~O%]!YO~OV!aO_!aOa!bOh!iO!X!kO!f!mO%j![O%k!]O%l!^O%m!_O%n!_O%o!`O%p!`O%q!aO%r!aO%s!aO~Ok%xXl%xXm%xXn%xXo%xXp%xXs%xXz%xX{%xX!x%xX#g%xX%[%xX%_%xX%z%xXg%xX!T%xX!U%xX%{%xX!W%xX![%xX!Q%xX#[%xXt%xX!m%xX~P%SOfoOhYO!XZO!][O!h`O!r`O!s`O!t`O%oRO%pRO%tSO%uWO&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O&c^O&d^O&e^O&f^O&g^O&h^O&i^O&j^O~Oz%wX{%wX#g%wX%[%wX%_%wX%z%wX~Ok!pOl!qOm!oOn!oOo!rOp!sOs!tO!x%wX~P)pOV!zOg!|Oo0cOv0qO!PrO~P'vOV#OOo0cOv0qO!W#PO~P'vOV#SOa#TOo0cOv0qO![#UO~P'vOQ#XO%`#XO%a#ZO~OQ#^OR#[O%`#^O%a#`O~OV%iX_%iXa%iXh%iXk%iXl%iXm%iXn%iXo%iXp%iXs%iXz%iX!X%iX!f%iX%j%iX%k%iX%l%iX%m%iX%n%iX%o%iX%p%iX%q%iX%r%iX%s%iXg%iX!T%iX!U%iX~O&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O&c^O&d^O&e^O&f^O&g^O&h^O&i^O&j^O{%iX!x%iX#g%iX%[%iX%_%iX%z%iX%{%iX!W%iX![%iX!Q%iX#[%iXt%iX!m%iX~P,eOz#dO{%hX!x%hX#g%hX%[%hX%_%hX%z%hX~Oo0cOv0qO~P'vO#g#gO%[#iO%_#iO~O%uWO~O!T#nO#u!VO#z!WO#}hO~OopO~P'vOV#sOa#tO%uWO{wP~OV#xOo0cOv0qO!Q#yO~P'vO{#{O!x$QO%z#|O#g!yX%[!yX%_!yX~OV#xOo0cOv0qO#g#SX%[#SX%_#SX~P'vOo0cOv0qO#g#WX%[#WX%_#WX~P'vOh$WO%uWO~O!f$YO!r$YO%uWO~OV$eO~P'vO!U$gO#s$hO#u$iO~O{$jO~OV$qO~P'vOS$sO%[$rO%_$rO%c$tO~OV$}Oa$}Og%POo0cOv0qO~P'vOo0cOv0qO{%SO~P'vO&Y%UO~Oa!bOh!iO!X!kO!f!mOVba_bakbalbambanbaobapbasbazba{ba!xba#gba%[ba%_ba%jba%kba%lba%mba%nba%oba%pba%qba%rba%sba%zbagba!Tba!Uba%{ba!Wba![ba!Qba#[batba!mba~On%ZO~Oo%ZO~P'vOo0cO~P'vOk0eOl0fOm0dOn0dOo0mOp0nOs0rOg%wX!T%wX!U%wX%{%wX!W%wX![%wX!Q%wX#[%wX!m%wX~P)pO%{%]Og%vXz%vX!T%vX!U%vX!W%vX{%vX~Og%_Oz%`O!T%dO!U%cO~Og%_O~Oz%gO!T%dO!U%cO!W&SX~O!W%kO~Oz%lO{%nO!T%dO!U%cO![%}X~O![%rO~O![%sO~OQ#XO%`#XO%a%uO~OV%wOo0cOv0qO!PrO~P'vOQ#^OR#[O%`#^O%a%zO~OV!qa_!qaa!qah!qak!qal!qam!qan!qao!qap!qas!qaz!qa{!qa!X!qa!f!qa!x!qa#g!qa%[!qa%_!qa%j!qa%k!qa%l!qa%m!qa%n!qa%o!qa%p!qa%q!qa%r!qa%s!qa%z!qag!qa!T!qa!U!qa%{!qa!W!qa![!qa!Q!qa#[!qat!qa!m!qa~P#yOz%|O{%ha!x%ha#g%ha%[%ha%_%ha%z%ha~P%SOV&OOopOvqO{%ha!x%ha#g%ha%[%ha%_%ha%z%ha~P'vOz%|O{%ha!x%ha#g%ha%[%ha%_%ha%z%ha~OPdOVaOopOvqO!PrO!Q{O!{tO!}uO#PvO#RwO#TxO#XyO#ZzO#^|O#_|O#a}O#c!OO#g$zX%[$zX%_$zX~P'vO#g#gO%[&TO%_&TO~O!f&UOh&sX%[&sXz&sX#[&sX#g&sX%_&sX#Z&sXg&sX~Oh!iO%[&WO~Okealeameaneaoeapeaseazea{ea!xea#gea%[ea%_ea%zeagea!Tea!Uea%{ea!Wea![ea!Qea#[eatea!mea~P%SOsqazqa{qa#gqa%[qa%_qa%zqa~Ok!pOl!qOm!oOn!oOo!rOp!sO!xqa~PEcO%z&YOz%yX{%yX~O%uWOz%yX{%yX~Oz&]O{wX~O{&_O~Oz%lO#g%}X%[%}X%_%}Xg%}X{%}X![%}X!m%}X%z%}X~OV0lOo0cOv0qO!PrO~P'vO%z#|O#gUa%[Ua%_Ua~Oz&hO#g&PX%[&PX%_&PXn&PX~P%SOz&kO!Q&jO#g#Wa%[#Wa%_#Wa~Oz&lO#[&nO#g&rX%[&rX%_&rXg&rX~O!f$YO!r$YO#Z&qO%uWO~O#Z&qO~Oz&sO#g&tX%[&tX%_&tX~Oz&uO#g&pX%[&pX%_&pX{&pX~O!X&wO%z&xO~Oz&|On&wX~P%SOn'PO~OPdOVaOopOvqO!PrO!Q{O!{tO!}uO#PvO#RwO#TxO#XyO#ZzO#^|O#_|O#a}O#c!OO%['UO~P'vOt'YO#p'WO#q'XOP#naV#naf#nah#nao#nas#nav#na!P#na!Q#na!T#na!U#na!X#na!]#na!h#na!r#na!s#na!t#na!{#na!}#na#P#na#R#na#T#na#X#na#Z#na#^#na#_#na#a#na#c#na#l#na#o#na#s#na#u#na#z#na#}#na$P#na%X#na%o#na%p#na%t#na%u#na&Z#na&[#na&]#na&^#na&_#na&`#na&a#na&b#na&c#na&d#na&e#na&f#na&g#na&h#na&i#na&j#na%Z#na%_#na~Oz'ZO#[']O{&xX~Oh'_O!X&wO~Oh!iO{$jO!X&wO~O{'eO~P%SO%['hO%_'hO~OS'iO%['hO%_'hO~OV!aO_!aOa!bOh!iO!X!kO!f!mO%l!^O%m!_O%n!_O%o!`O%p!`O%q!aO%r!aO%s!aOkWilWimWinWioWipWisWizWi{Wi!xWi#gWi%[Wi%_Wi%jWi%zWigWi!TWi!UWi%{Wi!WWi![Wi!QWi#[WitWi!mWi~O%k!]O~P!#uO%kWi~P!#uOV!aO_!aOa!bOh!iO!X!kO!f!mO%o!`O%p!`O%q!aO%r!aO%s!aOkWilWimWinWioWipWisWizWi{Wi!xWi#gWi%[Wi%_Wi%jWi%kWi%lWi%zWigWi!TWi!UWi%{Wi!WWi![Wi!QWi#[WitWi!mWi~O%m!_O%n!_O~P!&pO%mWi%nWi~P!&pOa!bOh!iO!X!kO!f!mOkWilWimWinWioWipWisWizWi{Wi!xWi#gWi%[Wi%_Wi%jWi%kWi%lWi%mWi%nWi%oWi%pWi%zWigWi!TWi!UWi%{Wi!WWi![Wi!QWi#[WitWi!mWi~OV!aO_!aO%q!aO%r!aO%s!aO~P!)nOVWi_Wi%qWi%rWi%sWi~P!)nO!T%dO!U%cOg&VXz&VX~O%z'kO%{'kO~P,eOz'mOg&UX~Og'oO~Oz'pO{'rO!W&XX~Oo0cOv0qOz'pO{'sO!W&XX~P'vO!W'uO~Om!oOn!oOo!rOp!sOkjisjizji{ji!xji#gji%[ji%_ji%zji~Ol!qO~P!.aOlji~P!.aOk0eOl0fOm0dOn0dOo0mOp0nO~Ot'wO~P!/jOV'|Og'}Oo0cOv0qO~P'vOg'}Oz(OO~Og(QO~O!U(SO~Og(TOz(OO!T%dO!U%cO~P%SOk0eOl0fOm0dOn0dOo0mOp0nOgqa!Tqa!Uqa%{qa!Wqa![qa!Qqa#[qatqa!mqa~PEcOV'|Oo0cOv0qO!W&Sa~P'vOz(WO!W&Sa~O!W(XO~Oz(WO!T%dO!U%cO!W&Sa~P%SOV(]Oo0cOv0qO![%}a#g%}a%[%}a%_%}ag%}a{%}a!m%}a%z%}a~P'vOz(^O![%}a#g%}a%[%}a%_%}ag%}a{%}a!m%}a%z%}a~O![(aO~Oz(^O!T%dO!U%cO![%}a~P%SOz(dO!T%dO!U%cO![&Ta~P%SOz(gO{&lX![&lX!m&lX%z&lX~O{(kO![(mO!m(nO%z(jO~OV&OOopOvqO{%hi!x%hi#g%hi%[%hi%_%hi%z%hi~P'vOz(pO{%hi!x%hi#g%hi%[%hi%_%hi%z%hi~O!f&UOh&sa%[&saz&sa#[&sa#g&sa%_&sa#Z&sag&sa~O%[(uO~OV#sOa#tO%uWO~Oz&]O{wa~OopOvqO~P'vOz(^O#g%}a%[%}a%_%}ag%}a{%}a![%}a!m%}a%z%}a~P%SOz(zO#g%hX%[%hX%_%hX%z%hX~O%z#|O#gUi%[Ui%_Ui~O#g&Pa%[&Pa%_&Pan&Pa~P'vOz(}O#g&Pa%[&Pa%_&Pan&Pa~O%uWO#g&ra%[&ra%_&rag&ra~Oz)SO#g&ra%[&ra%_&rag&ra~Og)VO~OV)WOh$WO%uWO~O#Z)XO~O%uWO#g&ta%[&ta%_&ta~Oz)ZO#g&ta%[&ta%_&ta~Oo0cOv0qO#g&pa%[&pa%_&pa{&pa~P'vOz)^O#g&pa%[&pa%_&pa{&pa~OV)`Oa)`O%uWO~O%z)eO~Ot)hO#j)gOP#hiV#hif#hih#hio#his#hiv#hi!P#hi!Q#hi!T#hi!U#hi!X#hi!]#hi!h#hi!r#hi!s#hi!t#hi!{#hi!}#hi#P#hi#R#hi#T#hi#X#hi#Z#hi#^#hi#_#hi#a#hi#c#hi#l#hi#o#hi#s#hi#u#hi#z#hi#}#hi$P#hi%X#hi%o#hi%p#hi%t#hi%u#hi&Z#hi&[#hi&]#hi&^#hi&_#hi&`#hi&a#hi&b#hi&c#hi&d#hi&e#hi&f#hi&g#hi&h#hi&i#hi&j#hi%Z#hi%_#hi~Ot)iOP#kiV#kif#kih#kio#kis#kiv#ki!P#ki!Q#ki!T#ki!U#ki!X#ki!]#ki!h#ki!r#ki!s#ki!t#ki!{#ki!}#ki#P#ki#R#ki#T#ki#X#ki#Z#ki#^#ki#_#ki#a#ki#c#ki#l#ki#o#ki#s#ki#u#ki#z#ki#}#ki$P#ki%X#ki%o#ki%p#ki%t#ki%u#ki&Z#ki&[#ki&]#ki&^#ki&_#ki&`#ki&a#ki&b#ki&c#ki&d#ki&e#ki&f#ki&g#ki&h#ki&i#ki&j#ki%Z#ki%_#ki~OV)kOn&wa~P'vOz)lOn&wa~Oz)lOn&wa~P%SOn)pO~O%Y)tO~Ot)wO#p'WO#q)vOP#niV#nif#nih#nio#nis#niv#ni!P#ni!Q#ni!T#ni!U#ni!X#ni!]#ni!h#ni!r#ni!s#ni!t#ni!{#ni!}#ni#P#ni#R#ni#T#ni#X#ni#Z#ni#^#ni#_#ni#a#ni#c#ni#l#ni#o#ni#s#ni#u#ni#z#ni#}#ni$P#ni%X#ni%o#ni%p#ni%t#ni%u#ni&Z#ni&[#ni&]#ni&^#ni&_#ni&`#ni&a#ni&b#ni&c#ni&d#ni&e#ni&f#ni&g#ni&h#ni&i#ni&j#ni%Z#ni%_#ni~OV)zOo0cOv0qO{$jO~P'vOo0cOv0qO{&xa~P'vOz*OO{&xa~OV*SOa*TOg*WO%q*UO%uWO~O{$jO&{*YO~Oh'_O~Oh!iO{$jO~O%[*_O~O%[*aO%_*aO~OV$}Oa$}Oo0cOv0qOg&Ua~P'vOz*dOg&Ua~Oo0cOv0qO{*gO!W&Xa~P'vOz*hO!W&Xa~Oo0cOv0qOz*hO{*kO!W&Xa~P'vOo0cOv0qOz*hO!W&Xa~P'vOz*hO{*kO!W&Xa~Om0dOn0dOo0mOp0nOgjikjisjizji!Tji!Uji%{ji!Wji{ji![ji#gji%[ji%_ji!Qji#[jitji!mji%zji~Ol0fO~P!NkOlji~P!NkOV'|Og*pOo0cOv0qO~P'vOn*rO~Og*pOz*tO~Og*uO~OV'|Oo0cOv0qO!W&Si~P'vOz*vO!W&Si~O!W*wO~OV(]Oo0cOv0qO![%}i#g%}i%[%}i%_%}ig%}i{%}i!m%}i%z%}i~P'vOz*zO!T%dO!U%cO![&Ti~Oz*}O![%}i#g%}i%[%}i%_%}ig%}i{%}i!m%}i%z%}i~O![+OO~Oa+QOo0cOv0qO![&Ti~P'vOz*zO![&Ti~O![+SO~OV+UOo0cOv0qO{&la![&la!m&la%z&la~P'vOz+VO{&la![&la!m&la%z&la~O!]+YO&n+[O![!nX~O![+^O~O{(kO![+_O~O{(kO![+_O!m+`O~OV&OOopOvqO{%hq!x%hq#g%hq%[%hq%_%hq%z%hq~P'vOz$ri{$ri!x$ri#g$ri%[$ri%_$ri%z$ri~P%SOV&OOopOvqO~P'vOV&OOo0cOv0qO#g%ha%[%ha%_%ha%z%ha~P'vOz+aO#g%ha%[%ha%_%ha%z%ha~Oz$ia#g$ia%[$ia%_$ian$ia~P%SO#g&Pi%[&Pi%_&Pin&Pi~P'vOz+dO#g#Wq%[#Wq%_#Wq~O#[+eOz$va#g$va%[$va%_$vag$va~O%uWO#g&ri%[&ri%_&rig&ri~Oz+gO#g&ri%[&ri%_&rig&ri~OV+iOh$WO%uWO~O%uWO#g&ti%[&ti%_&ti~Oo0cOv0qO#g&pi%[&pi%_&pi{&pi~P'vO{#{Oz#eX!W#eX~Oz+mO!W&uX~O!W+oO~Ot+rO#j)gOP#hqV#hqf#hqh#hqo#hqs#hqv#hq!P#hq!Q#hq!T#hq!U#hq!X#hq!]#hq!h#hq!r#hq!s#hq!t#hq!{#hq!}#hq#P#hq#R#hq#T#hq#X#hq#Z#hq#^#hq#_#hq#a#hq#c#hq#l#hq#o#hq#s#hq#u#hq#z#hq#}#hq$P#hq%X#hq%o#hq%p#hq%t#hq%u#hq&Z#hq&[#hq&]#hq&^#hq&_#hq&`#hq&a#hq&b#hq&c#hq&d#hq&e#hq&f#hq&g#hq&h#hq&i#hq&j#hq%Z#hq%_#hq~On$|az$|a~P%SOV)kOn&wi~P'vOz+yOn&wi~Oz,TO{$jO#[,TO~O#q,VOP#nqV#nqf#nqh#nqo#nqs#nqv#nq!P#nq!Q#nq!T#nq!U#nq!X#nq!]#nq!h#nq!r#nq!s#nq!t#nq!{#nq!}#nq#P#nq#R#nq#T#nq#X#nq#Z#nq#^#nq#_#nq#a#nq#c#nq#l#nq#o#nq#s#nq#u#nq#z#nq#}#nq$P#nq%X#nq%o#nq%p#nq%t#nq%u#nq&Z#nq&[#nq&]#nq&^#nq&_#nq&`#nq&a#nq&b#nq&c#nq&d#nq&e#nq&f#nq&g#nq&h#nq&i#nq&j#nq%Z#nq%_#nq~O#[,WOz%Oa{%Oa~Oo0cOv0qO{&xi~P'vOz,YO{&xi~O{#{O%z,[Og&zXz&zX~O%uWOg&zXz&zX~Oz,`Og&yX~Og,bO~O%Y,eO~O!T%dO!U%cOg&Viz&Vi~OV$}Oa$}Oo0cOv0qOg&Ui~P'vO{,hOz$la!W$la~Oo0cOv0qO{,iOz$la!W$la~P'vOo0cOv0qO{*gO!W&Xi~P'vOz,lO!W&Xi~Oo0cOv0qOz,lO!W&Xi~P'vOz,lO{,oO!W&Xi~Og$hiz$hi!W$hi~P%SOV'|Oo0cOv0qO~P'vOn,qO~OV'|Og,rOo0cOv0qO~P'vOV'|Oo0cOv0qO!W&Sq~P'vOz$gi![$gi#g$gi%[$gi%_$gig$gi{$gi!m$gi%z$gi~P%SOV(]Oo0cOv0qO~P'vOa+QOo0cOv0qO![&Tq~P'vOz,sO![&Tq~O![,tO~OV(]Oo0cOv0qO![%}q#g%}q%[%}q%_%}qg%}q{%}q!m%}q%z%}q~P'vO{,uO~OV+UOo0cOv0qO{&li![&li!m&li%z&li~P'vOz,zO{&li![&li!m&li%z&li~O!]+YO&n+[O![!na~O{(kO![,}O~OV&OOo0cOv0qO#g%hi%[%hi%_%hi%z%hi~P'vOz-OO#g%hi%[%hi%_%hi%z%hi~O%uWO#g&rq%[&rq%_&rqg&rq~Oz-RO#g&rq%[&rq%_&rqg&rq~OV)`Oa)`O%uWO!W&ua~Oz-TO!W&ua~On$|iz$|i~P%SOV)kO~P'vOV)kOn&wq~P'vOt-XOP#myV#myf#myh#myo#mys#myv#my!P#my!Q#my!T#my!U#my!X#my!]#my!h#my!r#my!s#my!t#my!{#my!}#my#P#my#R#my#T#my#X#my#Z#my#^#my#_#my#a#my#c#my#l#my#o#my#s#my#u#my#z#my#}#my$P#my%X#my%o#my%p#my%t#my%u#my&Z#my&[#my&]#my&^#my&_#my&`#my&a#my&b#my&c#my&d#my&e#my&f#my&g#my&h#my&i#my&j#my%Z#my%_#my~O%Z-]O%_-]O~P`O#q-^OP#nyV#nyf#nyh#nyo#nys#nyv#ny!P#ny!Q#ny!T#ny!U#ny!X#ny!]#ny!h#ny!r#ny!s#ny!t#ny!{#ny!}#ny#P#ny#R#ny#T#ny#X#ny#Z#ny#^#ny#_#ny#a#ny#c#ny#l#ny#o#ny#s#ny#u#ny#z#ny#}#ny$P#ny%X#ny%o#ny%p#ny%t#ny%u#ny&Z#ny&[#ny&]#ny&^#ny&_#ny&`#ny&a#ny&b#ny&c#ny&d#ny&e#ny&f#ny&g#ny&h#ny&i#ny&j#ny%Z#ny%_#ny~Oz-aO{$jO#[-aO~Oo0cOv0qO{&xq~P'vOz-dO{&xq~O%z,[Og&zaz&za~O{#{Og&zaz&za~OV*SOa*TO%q*UO%uWOg&ya~Oz-hOg&ya~O$S-lO~OV$}Oa$}Oo0cOv0qO~P'vOo0cOv0qO{-mOz$li!W$li~P'vOo0cOv0qOz$li!W$li~P'vO{-mOz$li!W$li~Oo0cOv0qO{*gO~P'vOo0cOv0qO{*gO!W&Xq~P'vOz-pO!W&Xq~Oo0cOv0qOz-pO!W&Xq~P'vOs-sO!T%dO!U%cOg&Oq!W&Oq![&Oqz&Oq~P!/jOa+QOo0cOv0qO![&Ty~P'vOz$ji![$ji~P%SOa+QOo0cOv0qO~P'vOV+UOo0cOv0qO~P'vOV+UOo0cOv0qO{&lq![&lq!m&lq%z&lq~P'vO{(kO![-xO!m-yO%z-wO~OV&OOo0cOv0qO#g%hq%[%hq%_%hq%z%hq~P'vO%uWO#g&ry%[&ry%_&ryg&ry~OV)`Oa)`O%uWO!W&ui~Ot-}OP#m!RV#m!Rf#m!Rh#m!Ro#m!Rs#m!Rv#m!R!P#m!R!Q#m!R!T#m!R!U#m!R!X#m!R!]#m!R!h#m!R!r#m!R!s#m!R!t#m!R!{#m!R!}#m!R#P#m!R#R#m!R#T#m!R#X#m!R#Z#m!R#^#m!R#_#m!R#a#m!R#c#m!R#l#m!R#o#m!R#s#m!R#u#m!R#z#m!R#}#m!R$P#m!R%X#m!R%o#m!R%p#m!R%t#m!R%u#m!R&Z#m!R&[#m!R&]#m!R&^#m!R&_#m!R&`#m!R&a#m!R&b#m!R&c#m!R&d#m!R&e#m!R&f#m!R&g#m!R&h#m!R&i#m!R&j#m!R%Z#m!R%_#m!R~Oo0cOv0qO{&xy~P'vOV*SOa*TO%q*UO%uWOg&yi~O$S-lO%Z.VO%_.VO~OV.aOh._O!X.^O!].`O!h.YO!s.[O!t.[O%p.XO%uWO&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O~Oo0cOv0qOz$lq!W$lq~P'vO{.fOz$lq!W$lq~Oo0cOv0qO{*gO!W&Xy~P'vOz.gO!W&Xy~Oo0cOv.kO~P'vOs-sO!T%dO!U%cOg&Oy!W&Oy![&Oyz&Oy~P!/jO{(kO![.nO~O{(kO![.nO!m.oO~OV*SOa*TO%q*UO%uWO~Oh.tO!f.rOz$TX#[$TX%j$TXg$TX~Os$TX{$TX!W$TX![$TX~P$-bO%o.vO%p.vOs$UXz$UX{$UX#[$UX%j$UX!W$UXg$UX![$UX~O!h.xO~Oz.|O#[/OO%j.yOs&|X{&|X!W&|Xg&|X~Oa/RO~P$)zOh.tOs&}Xz&}X{&}X#[&}X%j&}X!W&}Xg&}X![&}X~Os/VO{$jO~Oo0cOv0qOz$ly!W$ly~P'vOo0cOv0qO{*gO!W&X!R~P'vOz/ZO!W&X!R~Og&RXs&RX!T&RX!U&RX!W&RX![&RXz&RX~P!/jOs-sO!T%dO!U%cOg&Qa!W&Qa![&Qaz&Qa~O{(kO![/^O~O!f.rOh$[as$[az$[a{$[a#[$[a%j$[a!W$[ag$[a![$[a~O!h/eO~O%o.vO%p.vOs$Uaz$Ua{$Ua#[$Ua%j$Ua!W$Uag$Ua![$Ua~O%j.yOs$Yaz$Ya{$Ya#[$Ya!W$Yag$Ya![$Ya~Os&|a{&|a!W&|ag&|a~P$)nOz/jOs&|a{&|a!W&|ag&|a~O!W/mO~Og/mO~O{/oO~O![/pO~Oo0cOv0qO{*gO!W&X!Z~P'vO{/sO~O%z/tO~P$-bOz/uO#[/OO%j.yOg'PX~Oz/uOg'PX~Og/wO~O!h/xO~O#[/OOs%Saz%Sa{%Sa%j%Sa!W%Sag%Sa![%Sa~O#[/OO%j.yOs%Waz%Wa{%Wa!W%Wag%Wa~Os&|i{&|i!W&|ig&|i~P$)nOz/zO#[/OO%j.yO!['Oa~Og'Pa~P$)nOz0SOg'Pa~Oa0UO!['Oi~P$)zOz0WO!['Oi~Oz0WO#[/OO%j.yO!['Oi~O#[/OO%j.yOg$biz$bi~O%z0ZO~P$-bO#[/OO%j.yOg%Vaz%Va~Og'Pi~P$)nO{0^O~Oa0UO!['Oq~P$)zOz0`O!['Oq~O#[/OO%j.yOz%Ui![%Ui~Oa0UO~P$)zOa0UO!['Oy~P$)zO#[/OO%j.yOg$ciz$ci~O#[/OO%j.yOz%Uq![%Uq~Oz+aO#g%ha%[%ha%_%ha%z%ha~P%SOV&OOo0cOv0qO~P'vOn0hO~Oo0hO~P'vO{0iO~Ot0jO~P!/jO&]&Z&j&h&i&g&f&d&e&c&b&`&a&_&^&[%u~",goto:"!=j'QPPPPPP'RP'Z*s+[+t,_,y-fP.SP'Z.r.r'ZPPP'Z2[PPPPPP2[5PPP5PP7b7k=sPP=v>h>kPP'Z'ZPP>zPP'Z'ZPP'Z'Z'Z'Z'Z?O?w'ZP?zP@QDXGuGyPG|HWH['ZPPPH_Hk'RP'R'RP'RP'RP'RP'RP'R'R'RP'RPP'RPP'RP'RPHqH}IVPI^IdPI^PI^I^PPPI^PKrPK{LVL]KrPI^LfPI^PLmLsPLwM]MzNeLwLwNkNxLwLwLwLw! ^! d! g! l! o! y!!P!!]!!o!!u!#P!#V!#s!#y!$P!$Z!$a!$g!$y!%T!%Z!%a!%k!%q!%w!%}!&T!&Z!&e!&k!&u!&{!'U!'[!'k!'s!'}!(UPPPPPPPPPPP!([!(_!(e!(n!(x!)TPPPPPPPPPPPP!-u!/Z!3^!6oPP!6w!7W!7a!8Y!8P!8c!8i!8l!8o!8r!8z!9jPPPPPPPPPPPPPPPPP!9m!9q!9wP!:]!:a!:m!:v!;S!;j!;m!;p!;v!;|!_![!]Do!]!^Es!^!_FZ!_!`Gk!`!aHX!a!b%T!b!cIf!c!dJU!d!eK^!e!hJU!h!i!#f!i!tJU!t!u!,|!u!wJU!w!x!.t!x!}JU!}#O!0S#O#P&o#P#Q!0j#Q#R!1Q#R#SJU#S#T%T#T#UJU#U#VK^#V#YJU#Y#Z!#f#Z#fJU#f#g!,|#g#iJU#i#j!.t#j#oJU#o#p!1n#p#q!1s#q#r!2a#r#s!2f#s$g%T$g;'SJU;'S;=`KW<%lOJU`%YT&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T`%lP;=`<%l%To%v]&n`%c_OX%TXY%oY[%T[]%o]p%Tpq%oq#O%T#O#P&o#P#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To&tX&n`OY%TYZ%oZ]%T]^%o^#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc'f[&n`O!_%T!_!`([!`#T%T#T#U(r#U#f%T#f#g(r#g#h(r#h#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc(cTmR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc(yT!mR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk)aV&n`&[ZOr%Trs)vs#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk){V&n`Or%Trs*bs#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk*iT&n`&^ZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To+PZS_&n`OY*xYZ%TZ]*x]^%T^#o*x#o#p+r#p#q*x#q#r+r#r;'S*x;'S;=`,^<%lO*x_+wTS_OY+rZ]+r^;'S+r;'S;=`,W<%lO+r_,ZP;=`<%l+ro,aP;=`<%l*xj,kV%rQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj-XT!xY&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj-oV%lQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk.]V&n`&ZZOw%Twx.rx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk.wV&n`Ow%Twx/^x#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk/eT&n`&]ZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk/{ThZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc0cTgR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk0yXVZ&n`Oz%Tz{1f{!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk1mVaR&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk2ZV%oZ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc2wTzR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To3_W%pZ&n`O!_%T!_!`-Q!`!a3w!a#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Td4OT&{S&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk4fX!fQ&n`O!O%T!O!P5R!P!Q%T!Q![6T![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk5WV&n`O!O%T!O!P5m!P#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk5tT!rZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti6[a!hX&n`O!Q%T!Q![6T![!g%T!g!h7a!h!l%T!l!m9s!m#R%T#R#S6T#S#X%T#X#Y7a#Y#^%T#^#_9s#_#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti7fZ&n`O{%T{|8X|}%T}!O8X!O!Q%T!Q![8s![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti8^V&n`O!Q%T!Q![8s![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti8z]!hX&n`O!Q%T!Q![8s![!l%T!l!m9s!m#R%T#R#S8s#S#^%T#^#_9s#_#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti9zT!hX&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk:bX%qR&n`O!P%T!P!Q:}!Q!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj;UV%sQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti;ro!hX&n`O!O%T!O!P=s!P!Q%T!Q![>_![!d%T!d!e?q!e!g%T!g!h7a!h!l%T!l!m9s!m!q%T!q!rA]!r!z%T!z!{Bq!{#R%T#R#S>_#S#U%T#U#V?q#V#X%T#X#Y7a#Y#^%T#^#_9s#_#c%T#c#dA]#d#l%T#l#mBq#m#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti=xV&n`O!Q%T!Q![6T![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti>fc!hX&n`O!O%T!O!P=s!P!Q%T!Q![>_![!g%T!g!h7a!h!l%T!l!m9s!m#R%T#R#S>_#S#X%T#X#Y7a#Y#^%T#^#_9s#_#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti?vY&n`O!Q%T!Q!R@f!R!S@f!S#R%T#R#S@f#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti@mY!hX&n`O!Q%T!Q!R@f!R!S@f!S#R%T#R#S@f#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiAbX&n`O!Q%T!Q!YA}!Y#R%T#R#SA}#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiBUX!hX&n`O!Q%T!Q!YA}!Y#R%T#R#SA}#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiBv]&n`O!Q%T!Q![Co![!c%T!c!iCo!i#R%T#R#SCo#S#T%T#T#ZCo#Z#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiCv]!hX&n`O!Q%T!Q![Co![!c%T!c!iCo!i#R%T#R#SCo#S#T%T#T#ZCo#Z#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%ToDvV{_&n`O!_%T!_!`E]!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TcEdT%{R&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkEzT#gZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkFbXmR&n`O!^%T!^!_F}!_!`([!`!a([!a#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TjGUV%mQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkGrV%zZ&n`O!_%T!_!`([!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkH`WmR&n`O!_%T!_!`([!`!aHx!a#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TjIPV%nQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkIoV_Q#}P&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%ToJ_]&n`&YS%uZO!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUoKZP;=`<%lJUoKge&n`&YS%uZOr%Trs)Ysw%Twx.Ux!Q%T!Q![JU![!c%T!c!tJU!t!uLx!u!}JU!}#R%T#R#SJU#S#T%T#T#fJU#f#gLx#g#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUoMRa&n`&YS%uZOr%TrsNWsw%Twx! vx!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUkN_V&n`&`ZOr%TrsNts#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkNyV&n`Or%Trs! `s#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk! gT&n`&bZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk! }V&n`&_ZOw%Twx!!dx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!!iV&n`Ow%Twx!#Ox#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!#VT&n`&aZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To!#oe&n`&YS%uZOr%Trs!%Qsw%Twx!&px!Q%T!Q![JU![!c%T!c!tJU!t!u!(`!u!}JU!}#R%T#R#SJU#S#T%T#T#fJU#f#g!(`#g#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUk!%XV&n`&dZOr%Trs!%ns#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!%sV&n`Or%Trs!&Ys#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!&aT&n`&fZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!&wV&n`&cZOw%Twx!'^x#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!'cV&n`Ow%Twx!'xx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!(PT&n`&eZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To!(ia&n`&YS%uZOr%Trs!)nsw%Twx!+^x!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUk!)uV&n`&hZOr%Trs!*[s#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!*aV&n`Or%Trs!*vs#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!*}T&n`&jZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!+eV&n`&gZOw%Twx!+zx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!,PV&n`Ow%Twx!,fx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!,mT&n`&iZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To!-Vi&n`&YS%uZOr%TrsNWsw%Twx! vx!Q%T!Q![JU![!c%T!c!dJU!d!eLx!e!hJU!h!i!(`!i!}JU!}#R%T#R#SJU#S#T%T#T#UJU#U#VLx#V#YJU#Y#Z!(`#Z#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUo!.}a&n`&YS%uZOr%Trs)Ysw%Twx.Ux!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUk!0ZT!XZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc!0qT!WR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj!1XV%kQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T~!1sO!]~k!1zV%jR&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T~!2fO![~i!2mT%tX&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T",tokenizers:[Kde,Wde,Ude,Zde,0,1,2,3,4],topRules:{Script:[0,5]},specialized:[{term:221,get:t=>the[t]||-1}],tokenPrec:7668}),DE=new yae,oF=new Set(["Script","Body","FunctionDefinition","ClassDefinition","LambdaExpression","ForStatement","MatchClause"]);function Sx(t){return(e,n,r)=>{if(r)return!1;let s=e.node.getChild("VariableName");return s&&n(s,t),!0}}const rhe={FunctionDefinition:Sx("function"),ClassDefinition:Sx("class"),ForStatement(t,e,n){if(n){for(let r=t.node.firstChild;r;r=r.nextSibling)if(r.name=="VariableName")e(r,"variable");else if(r.name=="in")break}},ImportStatement(t,e){var n,r;let{node:s}=t,i=((n=s.firstChild)===null||n===void 0?void 0:n.name)=="from";for(let a=s.getChild("import");a;a=a.nextSibling)a.name=="VariableName"&&((r=a.nextSibling)===null||r===void 0?void 0:r.name)!="as"&&e(a,i?"variable":"namespace")},AssignStatement(t,e){for(let n=t.node.firstChild;n;n=n.nextSibling)if(n.name=="VariableName")e(n,"variable");else if(n.name==":"||n.name=="AssignOp")break},ParamList(t,e){for(let n=null,r=t.node.firstChild;r;r=r.nextSibling)r.name=="VariableName"&&(!n||!/\*|AssignOp/.test(n.name))&&e(r,"variable"),n=r},CapturePattern:Sx("variable"),AsPattern:Sx("variable"),__proto__:null};function cF(t,e){let n=DE.get(e);if(n)return n;let r=[],s=!0;function i(a,o){let c=t.sliceString(a.from,a.to);r.push({label:c,type:o})}return e.cursor(Jr.IncludeAnonymous).iterate(a=>{if(a.name){let o=rhe[a.name];if(o&&o(a,i,s)||!s&&oF.has(a.name))return!1;s=!1}else if(a.to-a.from>8192){for(let o of cF(t,a.node))r.push(o);return!1}}),DE.set(e,r),r}const zE=/^[\w\xa1-\uffff][\w\d\xa1-\uffff]*$/,uF=["String","FormatString","Comment","PropertyName"];function she(t){let e=ls(t.state).resolveInner(t.pos,-1);if(uF.indexOf(e.name)>-1)return null;let n=e.name=="VariableName"||e.to-e.from<20&&zE.test(t.state.sliceDoc(e.from,e.to));if(!n&&!t.explicit)return null;let r=[];for(let s=e;s;s=s.parent)oF.has(s.name)&&(r=r.concat(cF(t.state.doc,s)));return{options:r,from:n?e.from:t.pos,validFor:zE}}const ihe=["__annotations__","__builtins__","__debug__","__doc__","__import__","__name__","__loader__","__package__","__spec__","False","None","True"].map(t=>({label:t,type:"constant"})).concat(["ArithmeticError","AssertionError","AttributeError","BaseException","BlockingIOError","BrokenPipeError","BufferError","BytesWarning","ChildProcessError","ConnectionAbortedError","ConnectionError","ConnectionRefusedError","ConnectionResetError","DeprecationWarning","EOFError","Ellipsis","EncodingWarning","EnvironmentError","Exception","FileExistsError","FileNotFoundError","FloatingPointError","FutureWarning","GeneratorExit","IOError","ImportError","ImportWarning","IndentationError","IndexError","InterruptedError","IsADirectoryError","KeyError","KeyboardInterrupt","LookupError","MemoryError","ModuleNotFoundError","NameError","NotADirectoryError","NotImplemented","NotImplementedError","OSError","OverflowError","PendingDeprecationWarning","PermissionError","ProcessLookupError","RecursionError","ReferenceError","ResourceWarning","RuntimeError","RuntimeWarning","StopAsyncIteration","StopIteration","SyntaxError","SyntaxWarning","SystemError","SystemExit","TabError","TimeoutError","TypeError","UnboundLocalError","UnicodeDecodeError","UnicodeEncodeError","UnicodeError","UnicodeTranslateError","UnicodeWarning","UserWarning","ValueError","Warning","ZeroDivisionError"].map(t=>({label:t,type:"type"}))).concat(["bool","bytearray","bytes","classmethod","complex","float","frozenset","int","list","map","memoryview","object","range","set","staticmethod","str","super","tuple","type"].map(t=>({label:t,type:"class"}))).concat(["abs","aiter","all","anext","any","ascii","bin","breakpoint","callable","chr","compile","delattr","dict","dir","divmod","enumerate","eval","exec","exit","filter","format","getattr","globals","hasattr","hash","help","hex","id","input","isinstance","issubclass","iter","len","license","locals","max","min","next","oct","open","ord","pow","print","property","quit","repr","reversed","round","setattr","slice","sorted","sum","vars","zip"].map(t=>({label:t,type:"function"}))),ahe=[Ul("def ${name}(${params}):\n ${}",{label:"def",detail:"function",type:"keyword"}),Ul("for ${name} in ${collection}:\n ${}",{label:"for",detail:"loop",type:"keyword"}),Ul("while ${}:\n ${}",{label:"while",detail:"loop",type:"keyword"}),Ul("try:\n ${}\nexcept ${error}:\n ${}",{label:"try",detail:"/ except block",type:"keyword"}),Ul(`if \${}: -`,{label:"if",detail:"block",type:"keyword"}),Ql("if ${}:\n ${}\nelse:\n ${}",{label:"if",detail:"/ else block",type:"keyword"}),Ql("class ${name}:\n def __init__(self, ${params}):\n ${}",{label:"class",detail:"definition",type:"keyword"}),Ql("import ${module}",{label:"import",detail:"statement",type:"keyword"}),Ql("from ${module} import ${names}",{label:"from",detail:"import",type:"keyword"})],she=ace(oF,Pq(nhe.concat(rhe)));function Qw(t){let{node:e,pos:n}=t,r=t.lineIndent(n,-1),s=null;for(;;){let i=e.childBefore(n);if(i)if(i.name=="Comment")n=i.from;else if(i.name=="Body"||i.name=="MatchBody")t.baseIndentFor(i)+t.unit<=r&&(s=i),e=i;else if(i.name=="MatchClause")e=i;else if(i.type.is("Statement"))e=i;else break;else break}return s}function Hw(t,e){let n=t.baseIndentFor(e),r=t.lineAt(t.pos,-1),s=r.from+r.text.length;return/^\s*($|#)/.test(r.text)&&t.node.ton?null:n+t.unit}const Vw=t0.define({name:"python",parser:Jde.configure({props:[Jv.add({Body:t=>{var e;let n=/^\s*(#|$)/.test(t.textAfter)&&Qw(t)||t.node;return(e=Hw(t,n))!==null&&e!==void 0?e:t.continue()},MatchBody:t=>{var e;let n=Qw(t);return(e=Hw(t,n||t.node))!==null&&e!==void 0?e:t.continue()},IfStatement:t=>/^\s*(else:|elif )/.test(t.textAfter)?t.baseIndent:t.continue(),"ForStatement WhileStatement":t=>/^\s*else:/.test(t.textAfter)?t.baseIndent:t.continue(),TryStatement:t=>/^\s*(except[ :]|finally:|else:)/.test(t.textAfter)?t.baseIndent:t.continue(),MatchStatement:t=>/^\s*case /.test(t.textAfter)?t.baseIndent+t.unit:t.continue(),"TupleExpression ComprehensionExpression ParamList ArgList ParenthesizedExpression":Cw({closing:")"}),"DictionaryExpression DictionaryComprehensionExpression SetExpression SetComprehensionExpression":Cw({closing:"}"}),"ArrayExpression ArrayComprehensionExpression":Cw({closing:"]"}),MemberExpression:t=>t.baseIndent+t.unit,"String FormatString":()=>null,Script:t=>{var e;let n=Qw(t);return(e=n&&Hw(t,n))!==null&&e!==void 0?e:t.continue()}}),$6.add({"ArrayExpression DictionaryExpression SetExpression TupleExpression":TB,Body:(t,e)=>({from:t.from+1,to:t.to-(t.to==e.doc.length?0:1)}),"String FormatString":(t,e)=>({from:e.doc.lineAt(t.from).to,to:t.to})})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"'''",'"""'],stringPrefixes:["f","fr","rf","r","u","b","br","rb","F","FR","RF","R","U","B","BR","RB"]},commentTokens:{line:"#"},indentOnInput:/^\s*([\}\]\)]|else:|elif |except |finally:|case\s+[^:]*:?)$/}});function ihe(){return new jB(Vw,[Vw.data.of({autocomplete:the}),Vw.data.of({autocomplete:she})])}const ahe=B6({String:ve.string,Number:ve.number,"True False":ve.bool,PropertyName:ve.propertyName,Null:ve.null,", :":ve.separator,"[ ]":ve.squareBracket,"{ }":ve.brace}),lhe=u0.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#ClOOQO'#Cr'#CrQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CtOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59W,59WO!iQPO,59WOVQPO,59QOqQPO'#CmO!nQPO,59`OOQO1G.k1G.kOVQPO'#CnO!vQPO,59aOOQO1G.r1G.rOOQO1G.l1G.lOOQO,59X,59XOOQO-E6k-E6kOOQO,59Y,59YOOQO-E6l-E6l",stateData:"#O~OeOS~OQSORSOSSOTSOWQO_ROgPO~OVXOgUO~O^[O~PVO[^O~O]_OVhX~OVaO~O]bO^iX~O^dO~O]_OVha~O]bO^ia~O",goto:"!kjPPPPPPkPPkqwPPPPk{!RPPP!XP!e!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"⚠ JsonText True False Null Number String } { Object Property PropertyName : , ] [ Array",maxTerm:25,nodeProps:[["isolate",-2,6,11,""],["openedBy",7,"{",14,"["],["closedBy",8,"}",15,"]"]],propSources:[ahe],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oe~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Og~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zO]~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yO[~~'OO_~~'TO^~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0}),ohe=()=>t=>{try{JSON.parse(t.state.doc.toString())}catch(e){if(!(e instanceof SyntaxError))throw e;const n=che(e,t.state.doc);return[{from:n,message:e.message,severity:"error",to:n}]}return[]};function che(t,e){let n;return(n=t.message.match(/at position (\d+)/))?Math.min(+n[1],e.length):(n=t.message.match(/at line (\d+) column (\d+)/))?Math.min(e.line(+n[1]).from+ +n[2]-1,e.length):0}const uhe=t0.define({name:"json",parser:lhe.configure({props:[Jv.add({Object:zT({except:/^\s*\}/}),Array:zT({except:/^\s*\]/})}),$6.add({"Object Array":TB})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function dhe(){return new jB(uhe)}const hhe={name:"toml",startState:function(){return{inString:!1,stringType:"",lhs:!0,inArray:0}},token:function(t,e){let n;if(!e.inString&&(n=t.match(/^('''|"""|'|")/))&&(e.stringType=n[0],e.inString=!0),t.sol()&&!e.inString&&e.inArray===0&&(e.lhs=!0),e.inString){for(;e.inString;)if(t.match(e.stringType))e.inString=!1;else if(t.peek()==="\\")t.next(),t.next();else{if(t.eol())break;t.match(/^.[^\\\"\']*/)}return e.lhs?"property":"string"}else{if(e.inArray&&t.peek()==="]")return t.next(),e.inArray--,"bracket";if(e.lhs&&t.peek()==="["&&t.skipTo("]"))return t.next(),t.peek()==="]"&&t.next(),"atom";if(t.peek()==="#")return t.skipToEnd(),"comment";if(t.eatSpace())return null;if(e.lhs&&t.eatWhile(function(r){return r!="="&&r!=" "}))return"property";if(e.lhs&&t.peek()==="=")return t.next(),e.lhs=!1,null;if(!e.lhs&&t.match(/^\d\d\d\d[\d\-\:\.T]*Z/))return"atom";if(!e.lhs&&(t.match("true")||t.match("false")))return"atom";if(!e.lhs&&t.peek()==="[")return e.inArray++,t.next(),"bracket";if(!e.lhs&&t.match(/^\-?\d+(?:\.\d+)?/))return"number";t.eatSpace()||t.next()}return null},languageData:{commentTokens:{line:"#"}}},fhe={python:[ihe()],json:[dhe(),ohe()],toml:[Q6.define(hhe)],text:[]};function mhe({value:t,onChange:e,language:n="text",readOnly:r=!1,height:s="400px",minHeight:i,maxHeight:a,placeholder:o,theme:c="dark",className:h=""}){const[f,m]=b.useState(!1);if(b.useEffect(()=>{m(!0)},[]),!f)return l.jsx("div",{className:`rounded-md border bg-muted animate-pulse ${h}`,style:{height:s,minHeight:i,maxHeight:a}});const g=[...fhe[n]||[],We.lineWrapping];return r&&g.push(We.editable.of(!1)),l.jsx("div",{className:`rounded-md overflow-hidden border ${h}`,children:l.jsx(Zq,{value:t,height:s,minHeight:i,maxHeight:a,theme:c==="dark"?Kq:void 0,extensions:g,onChange:e,placeholder:o,basicSetup:{lineNumbers:!0,highlightActiveLineGutter:!0,highlightSpecialChars:!0,history:!0,foldGutter:!0,drawSelection:!0,dropCursor:!0,allowMultipleSelections:!0,indentOnInput:!0,syntaxHighlighting:!0,bracketMatching:!0,closeBrackets:!0,autocompletion:!0,rectangularSelection:!0,crosshairCursor:!0,highlightActiveLine:!0,highlightSelectionMatches:!0,closeBracketsKeymap:!0,defaultKeymap:!0,searchKeymap:!0,historyKeymap:!0,foldKeymap:!0,completionKeymap:!0,lintKeymap:!0}})})}function phe(){const[t,e]=b.useState(!0),[n,r]=b.useState(!1),[s,i]=b.useState(!1),[a,o]=b.useState(!1),[c,h]=b.useState(!1),[f,m]=b.useState(!1),[g,x]=b.useState("visual"),[y,w]=b.useState(""),[S,k]=b.useState(!1),{toast:N}=Gr(),[C,T]=b.useState(null),[_,E]=b.useState(null),[M,q]=b.useState(null),[L,I]=b.useState(null),[$,V]=b.useState(null),[ee,z]=b.useState(null),[H,P]=b.useState(null),[W,J]=b.useState(null),[X,R]=b.useState(null),[se,G]=b.useState(null),[F,U]=b.useState(null),[te,ne]=b.useState(null),[Y,ae]=b.useState(null),[re,le]=b.useState(null),[_e,Ge]=b.useState(null),[tt,Xe]=b.useState(null),[je,Qe]=b.useState(null),[He,$e]=b.useState(null),bt=b.useRef(null),lt=b.useRef(!0),xn=b.useRef({}),_n=b.useCallback(async()=>{try{const ie=await sre();w(ie),k(!1)}catch(ie){N({variant:"destructive",title:"加载失败",description:ie instanceof Error?ie.message:"加载源代码失败"})}},[N]),Cn=b.useCallback(async()=>{try{e(!0);const ie=await k9();xn.current=ie,T(ie.bot),E(ie.personality);const xe=ie.chat;xe.talk_value_rules||(xe.talk_value_rules=[]),q(xe),I(ie.expression),V(ie.emoji),z(ie.memory),P(ie.tool),J(ie.mood),R(ie.voice),G(ie.lpmm_knowledge),U(ie.keyword_reaction),ne(ie.response_post_process),ae(ie.chinese_typo),le(ie.response_splitter),Ge(ie.log),Xe(ie.debug),Qe(ie.maim_message),$e(ie.telemetry),o(!1),lt.current=!1,await _n()}catch(ie){console.error("加载配置失败:",ie),N({title:"加载失败",description:"无法加载配置文件",variant:"destructive"})}finally{e(!1)}},[N,_n]);b.useEffect(()=>{Cn()},[Cn]);const Dt=b.useCallback(async(ie,xe)=>{if(!lt.current)try{i(!0),await are(ie,xe),o(!1)}catch(Je){console.error(`自动保存 ${ie} 失败:`,Je),o(!0)}finally{i(!1)}},[]),xt=b.useCallback((ie,xe)=>{lt.current||(o(!0),bt.current&&clearTimeout(bt.current),bt.current=setTimeout(()=>{Dt(ie,xe)},2e3))},[Dt]);b.useEffect(()=>{C&&!lt.current&&xt("bot",C)},[C,xt]),b.useEffect(()=>{_&&!lt.current&&xt("personality",_)},[_,xt]),b.useEffect(()=>{M&&!lt.current&&xt("chat",M)},[M,xt]),b.useEffect(()=>{L&&!lt.current&&xt("expression",L)},[L,xt]),b.useEffect(()=>{$&&!lt.current&&xt("emoji",$)},[$,xt]),b.useEffect(()=>{ee&&!lt.current&&xt("memory",ee)},[ee,xt]),b.useEffect(()=>{H&&!lt.current&&xt("tool",H)},[H,xt]),b.useEffect(()=>{W&&!lt.current&&xt("mood",W)},[W,xt]),b.useEffect(()=>{X&&!lt.current&&xt("voice",X)},[X,xt]),b.useEffect(()=>{se&&!lt.current&&xt("lpmm_knowledge",se)},[se,xt]),b.useEffect(()=>{F&&!lt.current&&xt("keyword_reaction",F)},[F,xt]),b.useEffect(()=>{te&&!lt.current&&xt("response_post_process",te)},[te,xt]),b.useEffect(()=>{Y&&!lt.current&&xt("chinese_typo",Y)},[Y,xt]),b.useEffect(()=>{re&&!lt.current&&xt("response_splitter",re)},[re,xt]),b.useEffect(()=>{_e&&!lt.current&&xt("log",_e)},[_e,xt]),b.useEffect(()=>{tt&&!lt.current&&xt("debug",tt)},[tt,xt]),b.useEffect(()=>{je&&!lt.current&&xt("maim_message",je)},[je,xt]),b.useEffect(()=>{He&&!lt.current&&xt("telemetry",He)},[He,xt]);const Te=async()=>{try{r(!0),await ire(y),o(!1),k(!1),N({title:"保存成功",description:"配置已保存"}),await Cn()}catch(ie){k(!0),N({variant:"destructive",title:"保存失败",description:ie instanceof Error?ie.message:"保存配置失败"})}finally{r(!1)}},Re=async ie=>{if(a){N({variant:"destructive",title:"切换失败",description:"请先保存当前更改"});return}if(x(ie),ie==="source")await _n();else try{const xe=await k9();xn.current=xe,T(xe.bot),E(xe.personality);const Je=xe.chat;Je.talk_value_rules||(Je.talk_value_rules=[]),q(Je),I(xe.expression),V(xe.emoji),z(xe.memory),P(xe.tool),J(xe.mood),R(xe.voice),G(xe.lpmm_knowledge),U(xe.keyword_reaction),ne(xe.response_post_process),ae(xe.chinese_typo),le(xe.response_splitter),Ge(xe.log),Xe(xe.debug),Qe(xe.maim_message),$e(xe.telemetry),o(!1)}catch(xe){console.error("加载配置失败:",xe),N({title:"加载失败",description:"无法加载配置文件",variant:"destructive"})}},qe=async()=>{try{r(!0),bt.current&&clearTimeout(bt.current);const ie={...xn.current,bot:C,personality:_,chat:M,expression:L,emoji:$,memory:ee,tool:H,mood:W,voice:X,lpmm_knowledge:se,keyword_reaction:F,response_post_process:te,chinese_typo:Y,response_splitter:re,log:_e,debug:tt,maim_message:je,telemetry:He};await O9(ie),o(!1),N({title:"保存成功",description:"麦麦主程序配置已保存"})}catch(ie){console.error("保存配置失败:",ie),N({title:"保存失败",description:ie.message,variant:"destructive"})}finally{r(!1)}},rt=async()=>{try{h(!0),Hv().catch(()=>{}),m(!0)}catch(ie){console.error("重启失败:",ie),m(!1),N({title:"重启失败",description:"无法发送重启请求,请手动重启",variant:"destructive"}),h(!1)}},wt=async()=>{try{r(!0),bt.current&&clearTimeout(bt.current);const ie={...xn.current,bot:C,personality:_,chat:M,expression:L,emoji:$,memory:ee,tool:H,mood:W,voice:X,lpmm_knowledge:se,keyword_reaction:F,response_post_process:te,chinese_typo:Y,response_splitter:re,log:_e,debug:tt,maim_message:je,telemetry:He};await O9(ie),o(!1),N({title:"保存成功",description:"配置已保存,即将重启麦麦..."}),await new Promise(xe=>setTimeout(xe,500)),await rt()}catch(ie){console.error("保存失败:",ie),N({title:"保存失败",description:ie.message,variant:"destructive"})}finally{r(!1)}},jt=()=>{localStorage.removeItem("access-token"),window.location.href="/auth"},Ne=()=>{m(!1),h(!1),N({title:"重启失败",description:"服务器未能在预期时间内恢复,请手动检查",variant:"destructive"})};return t?l.jsx(on,{className:"h-full",children:l.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:l.jsx("div",{className:"flex items-center justify-center h-64",children:l.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})})}):l.jsx(on,{className:"h-full",children:l.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[l.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[l.jsxs("div",{children:[l.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"麦麦主程序配置"}),l.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理麦麦的核心功能和行为设置"})]}),l.jsxs("div",{className:"flex gap-2 w-full sm:w-auto items-center",children:[l.jsx(na,{value:g,onValueChange:ie=>Re(ie),className:"w-auto",children:l.jsxs(_i,{className:"h-9",children:[l.jsxs(Et,{value:"visual",className:"text-xs sm:text-sm px-2 sm:px-3",children:[l.jsx(LK,{className:"h-3 w-3 sm:h-4 sm:w-4 mr-1"}),"可视化"]}),l.jsxs(Et,{value:"source",className:"text-xs sm:text-sm px-2 sm:px-3",children:[l.jsx(IK,{className:"h-3 w-3 sm:h-4 sm:w-4 mr-1"}),"源代码"]})]})}),l.jsxs(fe,{onClick:g==="visual"?qe:Te,disabled:n||s||!a||c,size:"sm",variant:"outline",className:"flex-1 sm:flex-none",children:[l.jsx(Rv,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),n?"保存中...":s?"自动保存中...":a?"保存配置":"已保存"]}),l.jsxs(wn,{children:[l.jsx(Lr,{asChild:!0,children:l.jsxs(fe,{disabled:n||s||c,size:"sm",className:"flex-1 sm:flex-none",children:[l.jsx(e6,{className:"mr-2 h-4 w-4"}),c?"重启中...":a?"保存并重启":"重启麦麦"]})}),l.jsxs(un,{children:[l.jsxs(dn,{children:[l.jsx(fn,{children:"确认重启麦麦?"}),l.jsx(mn,{className:"space-y-3",asChild:!0,children:l.jsxs("div",{children:[l.jsx("p",{children:a?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"}),l.jsxs(il,{className:"border-yellow-500/50 bg-yellow-500/10",children:[l.jsx(Oa,{className:"h-4 w-4 text-yellow-600"}),l.jsxs(al,{className:"text-yellow-900 dark:text-yellow-100",children:[l.jsx("strong",{children:"重要提示:"}),"由于技术原因,使用重启功能后,将无法再使用 ",l.jsx("code",{className:"px-1 py-0.5 bg-yellow-200 dark:bg-yellow-900 rounded",children:"Ctrl+C"})," 结束程序。",l.jsxs(fr,{children:[l.jsx(Bh,{asChild:!0,children:l.jsxs("button",{className:"ml-1 text-yellow-700 dark:text-yellow-300 underline hover:text-yellow-800 dark:hover:text-yellow-200 inline-flex items-center gap-1",children:[l.jsx(Av,{className:"h-3 w-3"}),"如何结束程序?"]})}),l.jsxs(rr,{className:"max-w-2xl",children:[l.jsxs(sr,{children:[l.jsx(ir,{children:"如何结束使用重启功能后的麦麦程序"}),l.jsx(Ir,{children:"由于重启功能会使程序脱离终端控制,需要通过系统命令来结束进程"})]}),l.jsxs(na,{defaultValue:"windows",className:"w-full",children:[l.jsxs(_i,{className:"grid w-full grid-cols-3",children:[l.jsx(Et,{value:"windows",children:"Windows"}),l.jsx(Et,{value:"macos",children:"macOS"}),l.jsx(Et,{value:"linux",children:"Linux"})]}),l.jsxs(Kt,{value:"windows",className:"space-y-4 mt-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"font-semibold",children:"方法一:使用任务管理器"}),l.jsxs("ol",{className:"list-decimal list-inside space-y-1 text-sm text-muted-foreground",children:[l.jsxs("li",{children:["按 ",l.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"Ctrl + Shift + Esc"})," 打开任务管理器"]}),l.jsxs("li",{children:['在"进程"或"详细信息"标签页中找到 ',l.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"python.exe"})]}),l.jsx("li",{children:'右键点击并选择"结束任务"'})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"font-semibold",children:"方法二:使用命令行"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"打开 PowerShell 或命令提示符,执行以下命令:"}),l.jsxs("div",{className:"bg-muted p-3 rounded-md font-mono text-sm",children:[l.jsx("p",{children:"# 查找麦麦进程"}),l.jsx("p",{children:'Get-Process python | Where-Object {$_.MainWindowTitle -eq ""}'}),l.jsx("p",{className:"mt-2",children:"# 结束所有 Python 进程(谨慎使用)"}),l.jsx("p",{children:"Stop-Process -Name python -Force"})]})]})]}),l.jsxs(Kt,{value:"macos",className:"space-y-4 mt-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"font-semibold",children:"方法一:使用活动监视器"}),l.jsxs("ol",{className:"list-decimal list-inside space-y-1 text-sm text-muted-foreground",children:[l.jsxs("li",{children:["按 ",l.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"Cmd + Space"}),' 打开 Spotlight,搜索"活动监视器"']}),l.jsxs("li",{children:["在进程列表中找到 ",l.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"Python"})]}),l.jsx("li",{children:"选中后点击左上角的 X 按钮结束进程"})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"font-semibold",children:"方法二:使用终端"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"打开终端,执行以下命令:"}),l.jsxs("div",{className:"bg-muted p-3 rounded-md font-mono text-sm",children:[l.jsx("p",{children:"# 查找麦麦进程"}),l.jsx("p",{children:"ps aux | grep python | grep -v grep"}),l.jsx("p",{className:"mt-2",children:"# 结束指定 PID 的进程"}),l.jsx("p",{children:"kill -9 "}),l.jsx("p",{className:"mt-2",children:"# 或结束所有 Python 进程(谨慎使用)"}),l.jsx("p",{children:"pkill -9 python"})]})]})]}),l.jsxs(Kt,{value:"linux",className:"space-y-4 mt-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"font-semibold",children:"使用终端命令"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"打开终端,执行以下命令:"}),l.jsxs("div",{className:"bg-muted p-3 rounded-md font-mono text-sm",children:[l.jsx("p",{children:"# 查找麦麦进程"}),l.jsx("p",{children:"ps aux | grep python | grep -v grep"}),l.jsx("p",{className:"mt-2",children:"# 结束指定 PID 的进程"}),l.jsx("p",{children:"kill -9 "}),l.jsx("p",{className:"mt-2",children:"# 或使用 pkill 按名称结束"}),l.jsx("p",{children:'pkill -9 -f "bot.py"'}),l.jsx("p",{className:"mt-2",children:"# 或结束所有 Python 进程(谨慎使用)"}),l.jsx("p",{children:"pkill -9 python"})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"font-semibold",children:"使用 htop(如已安装)"}),l.jsxs("ol",{className:"list-decimal list-inside space-y-1 text-sm text-muted-foreground",children:[l.jsxs("li",{children:["在终端输入 ",l.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"htop"})]}),l.jsxs("li",{children:["按 ",l.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"F3"})," 搜索 python"]}),l.jsxs("li",{children:["按 ",l.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"F9"})," 发送信号,选择 SIGKILL"]})]})]})]})]}),l.jsx(ts,{children:l.jsx(g6,{asChild:!0,children:l.jsx(fe,{variant:"outline",children:"关闭"})})})]})]})]})]})]})})]}),l.jsxs(hn,{children:[l.jsx(gn,{children:"取消"}),l.jsx(pn,{onClick:a?wt:rt,children:a?"保存并重启":"确认重启"})]})]})]})]})]}),l.jsxs(il,{children:[l.jsx(Oa,{className:"h-4 w-4"}),l.jsxs(al,{children:["配置更新后需要",l.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),g==="source"&&l.jsxs("div",{className:"space-y-4",children:[l.jsxs(il,{children:[l.jsx(Oa,{className:"h-4 w-4"}),l.jsxs(al,{children:[l.jsx("strong",{children:"源代码模式(高级功能):"}),"直接编辑 TOML 配置文件。此功能仅适用于熟悉 TOML 语法的高级用户。保存时会在后端验证格式,只有格式完全正确才能保存。",S&&l.jsx("span",{className:"text-destructive font-semibold ml-2",children:"⚠️ 上次保存失败,请检查 TOML 格式"})]})]}),l.jsx(mhe,{value:y,onChange:ie=>{w(ie),o(!0),S&&k(!1)},language:"toml",theme:"dark",height:"calc(100vh - 280px)",minHeight:"500px",placeholder:"TOML 配置内容"})]}),g==="visual"&&l.jsx(l.Fragment,{children:l.jsxs(na,{defaultValue:"bot",className:"w-full",children:[l.jsx("div",{className:"overflow-x-auto -mx-4 px-4 sm:mx-0 sm:px-0",children:l.jsxs(_i,{className:"inline-flex w-auto min-w-full sm:grid sm:w-full sm:grid-cols-5 lg:grid-cols-10",children:[l.jsx(Et,{value:"bot",className:"flex-shrink-0",children:"基本信息"}),l.jsx(Et,{value:"personality",className:"flex-shrink-0",children:"人格"}),l.jsx(Et,{value:"chat",className:"flex-shrink-0",children:"聊天"}),l.jsx(Et,{value:"expression",className:"flex-shrink-0",children:"表达"}),l.jsx(Et,{value:"features",className:"flex-shrink-0",children:"功能"}),l.jsx(Et,{value:"processing",className:"flex-shrink-0",children:"处理"}),l.jsx(Et,{value:"mood",className:"flex-shrink-0",children:"情绪"}),l.jsx(Et,{value:"voice",className:"flex-shrink-0",children:"语音"}),l.jsx(Et,{value:"lpmm",className:"flex-shrink-0",children:"知识库"}),l.jsx(Et,{value:"other",className:"flex-shrink-0",children:"其他"})]})}),l.jsx(Kt,{value:"bot",className:"space-y-4",children:C&&l.jsx(ghe,{config:C,onChange:T})}),l.jsx(Kt,{value:"personality",className:"space-y-4",children:_&&l.jsx(xhe,{config:_,onChange:E})}),l.jsx(Kt,{value:"chat",className:"space-y-4",children:M&&l.jsx(vhe,{config:M,onChange:q})}),l.jsx(Kt,{value:"expression",className:"space-y-4",children:L&&l.jsx(bhe,{config:L,onChange:I})}),l.jsx(Kt,{value:"features",className:"space-y-4",children:$&&ee&&H&&l.jsx(whe,{emojiConfig:$,memoryConfig:ee,toolConfig:H,onEmojiChange:V,onMemoryChange:z,onToolChange:P})}),l.jsx(Kt,{value:"processing",className:"space-y-4",children:F&&te&&Y&&re&&l.jsx(She,{keywordReactionConfig:F,responsePostProcessConfig:te,chineseTypoConfig:Y,responseSplitterConfig:re,onKeywordReactionChange:U,onResponsePostProcessChange:ne,onChineseTypoChange:ae,onResponseSplitterChange:le})}),l.jsx(Kt,{value:"mood",className:"space-y-4",children:W&&l.jsx(khe,{config:W,onChange:J})}),l.jsx(Kt,{value:"voice",className:"space-y-4",children:X&&l.jsx(Ohe,{config:X,onChange:R})}),l.jsx(Kt,{value:"lpmm",className:"space-y-4",children:se&&l.jsx(jhe,{config:se,onChange:G})}),l.jsxs(Kt,{value:"other",className:"space-y-4",children:[_e&&l.jsx(Nhe,{config:_e,onChange:Ge}),tt&&l.jsx(Che,{config:tt,onChange:Xe}),je&&l.jsx(The,{config:je,onChange:Qe}),He&&l.jsx(Ehe,{config:He,onChange:$e})]})]})}),f&&l.jsx(y6,{onRestartComplete:jt,onRestartFailed:Ne})]})})}function ghe({config:t,onChange:e}){const n=()=>{e({...t,platforms:[...t.platforms,""]})},r=c=>{e({...t,platforms:t.platforms.filter((h,f)=>f!==c)})},s=(c,h)=>{const f=[...t.platforms];f[c]=h,e({...t,platforms:f})},i=()=>{e({...t,alias_names:[...t.alias_names,""]})},a=c=>{e({...t,alias_names:t.alias_names.filter((h,f)=>f!==c)})},o=(c,h)=>{const f=[...t.alias_names];f[c]=h,e({...t,alias_names:f})};return l.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:l.jsxs("div",{children:[l.jsx("h3",{className:"text-lg font-semibold mb-4",children:"基本信息"}),l.jsxs("div",{className:"grid gap-4",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"platform",children:"平台"}),l.jsx(Pe,{id:"platform",value:t.platform,onChange:c=>e({...t,platform:c.target.value}),placeholder:"qq"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"qq_account",children:"QQ账号"}),l.jsx(Pe,{id:"qq_account",value:t.qq_account,onChange:c=>e({...t,qq_account:c.target.value}),placeholder:"123456789"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"nickname",children:"昵称"}),l.jsx(Pe,{id:"nickname",value:t.nickname,onChange:c=>e({...t,nickname:c.target.value}),placeholder:"麦麦"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx(de,{children:"其他平台账号"}),l.jsxs(fe,{onClick:n,size:"sm",variant:"outline",children:[l.jsx(gs,{className:"h-4 w-4 mr-1"}),"添加"]})]}),l.jsxs("div",{className:"space-y-2",children:[t.platforms.map((c,h)=>l.jsxs("div",{className:"flex gap-2",children:[l.jsx(Pe,{value:c,onChange:f=>s(h,f.target.value),placeholder:"wx:114514"}),l.jsxs(wn,{children:[l.jsx(Lr,{asChild:!0,children:l.jsx(fe,{size:"icon",variant:"outline",children:l.jsx(ln,{className:"h-4 w-4"})})}),l.jsxs(un,{children:[l.jsxs(dn,{children:[l.jsx(fn,{children:"确认删除"}),l.jsxs(mn,{children:['确定要删除平台账号 "',c||"(空)",'" 吗?此操作无法撤销。']})]}),l.jsxs(hn,{children:[l.jsx(gn,{children:"取消"}),l.jsx(pn,{onClick:()=>r(h),children:"删除"})]})]})]})]},h)),t.platforms.length===0&&l.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无其他平台账号"})]})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx(de,{children:"别名"}),l.jsxs(fe,{onClick:i,size:"sm",variant:"outline",children:[l.jsx(gs,{className:"h-4 w-4 mr-1"}),"添加"]})]}),l.jsxs("div",{className:"space-y-2",children:[t.alias_names.map((c,h)=>l.jsxs("div",{className:"flex gap-2",children:[l.jsx(Pe,{value:c,onChange:f=>o(h,f.target.value),placeholder:"小麦"}),l.jsxs(wn,{children:[l.jsx(Lr,{asChild:!0,children:l.jsx(fe,{size:"icon",variant:"outline",children:l.jsx(ln,{className:"h-4 w-4"})})}),l.jsxs(un,{children:[l.jsxs(dn,{children:[l.jsx(fn,{children:"确认删除"}),l.jsxs(mn,{children:['确定要删除别名 "',c||"(空)",'" 吗?此操作无法撤销。']})]}),l.jsxs(hn,{children:[l.jsx(gn,{children:"取消"}),l.jsx(pn,{onClick:()=>a(h),children:"删除"})]})]})]})]},h)),t.alias_names.length===0&&l.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无别名"})]})]})]})]})})}function xhe({config:t,onChange:e}){const n=()=>{e({...t,states:[...t.states,""]})},r=i=>{e({...t,states:t.states.filter((a,o)=>o!==i)})},s=(i,a)=>{const o=[...t.states];o[i]=a,e({...t,states:o})};return l.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:l.jsxs("div",{children:[l.jsx("h3",{className:"text-lg font-semibold mb-4",children:"人格设置"}),l.jsxs("div",{className:"grid gap-4",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"personality",children:"人格特质"}),l.jsx(dr,{id:"personality",value:t.personality,onChange:i=>e({...t,personality:i.target.value}),placeholder:"描述人格特质和身份特征(建议120字以内)",rows:3}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"建议120字以内,描述人格特质和身份特征"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"reply_style",children:"表达风格"}),l.jsx(dr,{id:"reply_style",value:t.reply_style,onChange:i=>e({...t,reply_style:i.target.value}),placeholder:"描述说话的表达风格和习惯",rows:3})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"interest",children:"兴趣"}),l.jsx(dr,{id:"interest",value:t.interest,onChange:i=>e({...t,interest:i.target.value}),placeholder:"会影响麦麦对什么话题进行回复",rows:2})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"plan_style",children:"说话规则与行为风格"}),l.jsx(dr,{id:"plan_style",value:t.plan_style,onChange:i=>e({...t,plan_style:i.target.value}),placeholder:"麦麦的说话规则和行为风格",rows:5})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"visual_style",children:"识图规则"}),l.jsx(dr,{id:"visual_style",value:t.visual_style,onChange:i=>e({...t,visual_style:i.target.value}),placeholder:"识图时的处理规则",rows:3})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"private_plan_style",children:"私聊规则"}),l.jsx(dr,{id:"private_plan_style",value:t.private_plan_style,onChange:i=>e({...t,private_plan_style:i.target.value}),placeholder:"私聊的说话规则和行为风格",rows:4})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx(de,{children:"状态列表(人格多样性)"}),l.jsxs(fe,{onClick:n,size:"sm",variant:"outline",children:[l.jsx(gs,{className:"h-4 w-4 mr-1"}),"添加状态"]})]}),l.jsx("div",{className:"space-y-2",children:t.states.map((i,a)=>l.jsxs("div",{className:"flex gap-2",children:[l.jsx(dr,{value:i,onChange:o=>s(a,o.target.value),placeholder:"描述一个人格状态",rows:2}),l.jsxs(wn,{children:[l.jsx(Lr,{asChild:!0,children:l.jsx(fe,{size:"icon",variant:"outline",children:l.jsx(ln,{className:"h-4 w-4"})})}),l.jsxs(un,{children:[l.jsxs(dn,{children:[l.jsx(fn,{children:"确认删除"}),l.jsx(mn,{children:"确定要删除这个人格状态吗?此操作无法撤销。"})]}),l.jsxs(hn,{children:[l.jsx(gn,{children:"取消"}),l.jsx(pn,{onClick:()=>r(a),children:"删除"})]})]})]})]},a))})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"state_probability",children:"状态替换概率"}),l.jsx(Pe,{id:"state_probability",type:"number",step:"0.1",min:"0",max:"1",value:t.state_probability,onChange:i=>e({...t,state_probability:parseFloat(i.target.value)})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"每次构建人格时替换 personality 的概率(0.0-1.0)"})]})]})]})})}function vhe({config:t,onChange:e}){const n=()=>{e({...t,talk_value_rules:[...t.talk_value_rules,{target:"",time:"00:00-23:59",value:1}]})},r=o=>{e({...t,talk_value_rules:t.talk_value_rules.filter((c,h)=>h!==o)})},s=(o,c,h)=>{const f=[...t.talk_value_rules];f[o]={...f[o],[c]:h},e({...t,talk_value_rules:f})},i=({value:o,onChange:c})=>{const[h,f]=b.useState("00"),[m,g]=b.useState("00"),[x,y]=b.useState("23"),[w,S]=b.useState("59");b.useEffect(()=>{const N=o.split("-");if(N.length===2){const[C,T]=N,[_,E]=C.split(":"),[M,q]=T.split(":");_&&f(_.padStart(2,"0")),E&&g(E.padStart(2,"0")),M&&y(M.padStart(2,"0")),q&&S(q.padStart(2,"0"))}},[o]);const k=(N,C,T,_)=>{const E=`${N}:${C}-${T}:${_}`;c(E)};return l.jsxs(uo,{children:[l.jsx(ho,{asChild:!0,children:l.jsxs(fe,{variant:"outline",className:"w-full justify-start font-mono text-sm",children:[l.jsx(Yd,{className:"h-4 w-4 mr-2"}),o||"选择时间段"]})}),l.jsx(ol,{className:"w-80",children:l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{children:[l.jsx("h4",{className:"font-medium text-sm mb-3",children:"开始时间"}),l.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:gap-3",children:[l.jsxs("div",{children:[l.jsx(de,{className:"text-xs",children:"小时"}),l.jsxs(zt,{value:h,onValueChange:N=>{f(N),k(N,m,x,w)},children:[l.jsx(At,{children:l.jsx(Pt,{})}),l.jsx(Rt,{children:Array.from({length:24},(N,C)=>C).map(N=>l.jsx(ze,{value:N.toString().padStart(2,"0"),children:N.toString().padStart(2,"0")},N))})]})]}),l.jsxs("div",{children:[l.jsx(de,{className:"text-xs",children:"分钟"}),l.jsxs(zt,{value:m,onValueChange:N=>{g(N),k(h,N,x,w)},children:[l.jsx(At,{children:l.jsx(Pt,{})}),l.jsx(Rt,{children:Array.from({length:60},(N,C)=>C).map(N=>l.jsx(ze,{value:N.toString().padStart(2,"0"),children:N.toString().padStart(2,"0")},N))})]})]})]})]}),l.jsxs("div",{children:[l.jsx("h4",{className:"font-medium text-sm mb-3",children:"结束时间"}),l.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:gap-3",children:[l.jsxs("div",{children:[l.jsx(de,{className:"text-xs",children:"小时"}),l.jsxs(zt,{value:x,onValueChange:N=>{y(N),k(h,m,N,w)},children:[l.jsx(At,{children:l.jsx(Pt,{})}),l.jsx(Rt,{children:Array.from({length:24},(N,C)=>C).map(N=>l.jsx(ze,{value:N.toString().padStart(2,"0"),children:N.toString().padStart(2,"0")},N))})]})]}),l.jsxs("div",{children:[l.jsx(de,{className:"text-xs",children:"分钟"}),l.jsxs(zt,{value:w,onValueChange:N=>{S(N),k(h,m,x,N)},children:[l.jsx(At,{children:l.jsx(Pt,{})}),l.jsx(Rt,{children:Array.from({length:60},(N,C)=>C).map(N=>l.jsx(ze,{value:N.toString().padStart(2,"0"),children:N.toString().padStart(2,"0")},N))})]})]})]})]})]})})]})},a=({rule:o})=>{const c=`{ target = "${o.target}", time = "${o.time}", value = ${o.value.toFixed(1)} }`;return l.jsxs(uo,{children:[l.jsx(ho,{asChild:!0,children:l.jsxs(fe,{variant:"outline",size:"sm",children:[l.jsx(aa,{className:"h-4 w-4 mr-1"}),"预览"]})}),l.jsx(ol,{className:"w-96",children:l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),l.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:c}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})};return l.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[l.jsxs("div",{children:[l.jsx("h3",{className:"text-lg font-semibold mb-4",children:"聊天设置"}),l.jsxs("div",{className:"grid gap-4",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"talk_value",children:"聊天频率(基础值)"}),l.jsx(Pe,{id:"talk_value",type:"number",step:"0.1",min:"0",max:"1",value:t.talk_value,onChange:o=>e({...t,talk_value:parseFloat(o.target.value)})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"越小越沉默,范围 0-1"})]}),l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(_t,{id:"mentioned_bot_reply",checked:t.mentioned_bot_reply,onCheckedChange:o=>e({...t,mentioned_bot_reply:o})}),l.jsx(de,{htmlFor:"mentioned_bot_reply",className:"cursor-pointer",children:"启用提及必回复"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"max_context_size",children:"上下文长度"}),l.jsx(Pe,{id:"max_context_size",type:"number",min:"1",value:t.max_context_size,onChange:o=>e({...t,max_context_size:parseInt(o.target.value)})})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"planner_smooth",children:"规划器平滑"}),l.jsx(Pe,{id:"planner_smooth",type:"number",step:"1",min:"0",value:t.planner_smooth,onChange:o=>e({...t,planner_smooth:parseFloat(o.target.value)})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"增大数值会减小 planner 负荷,推荐 1-5,0 为关闭"})]}),l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(_t,{id:"enable_talk_value_rules",checked:t.enable_talk_value_rules,onCheckedChange:o=>e({...t,enable_talk_value_rules:o})}),l.jsx(de,{htmlFor:"enable_talk_value_rules",className:"cursor-pointer",children:"启用动态发言频率规则"})]}),l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(_t,{id:"include_planner_reasoning",checked:t.include_planner_reasoning,onCheckedChange:o=>e({...t,include_planner_reasoning:o})}),l.jsx(de,{htmlFor:"include_planner_reasoning",className:"cursor-pointer",children:"将 planner 推理加入 replyer"})]})]})]}),t.enable_talk_value_rules&&l.jsxs("div",{className:"border-t pt-6",children:[l.jsxs("div",{className:"flex items-center justify-between mb-4",children:[l.jsxs("div",{children:[l.jsx("h4",{className:"text-base font-semibold",children:"动态发言频率规则"}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"按时段或聊天流ID调整发言频率,优先匹配具体聊天,再匹配全局规则"})]}),l.jsxs(fe,{onClick:n,size:"sm",children:[l.jsx(gs,{className:"h-4 w-4 mr-1"}),"添加规则"]})]}),t.talk_value_rules&&t.talk_value_rules.length>0?l.jsx("div",{className:"space-y-4",children:t.talk_value_rules.map((o,c)=>l.jsxs("div",{className:"rounded-lg border p-4 bg-muted/50 space-y-4",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("span",{className:"text-sm font-medium text-muted-foreground",children:["规则 #",c+1]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(a,{rule:o}),l.jsxs(wn,{children:[l.jsx(Lr,{asChild:!0,children:l.jsx(fe,{variant:"ghost",size:"sm",children:l.jsx(ln,{className:"h-4 w-4 text-destructive"})})}),l.jsxs(un,{children:[l.jsxs(dn,{children:[l.jsx(fn,{children:"确认删除"}),l.jsxs(mn,{children:["确定要删除规则 #",c+1," 吗?此操作无法撤销。"]})]}),l.jsxs(hn,{children:[l.jsx(gn,{children:"取消"}),l.jsx(pn,{onClick:()=>r(c),children:"删除"})]})]})]})]})]}),l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{className:"text-xs font-medium",children:"配置类型"}),l.jsxs(zt,{value:o.target===""?"global":"specific",onValueChange:h=>{h==="global"?s(c,"target",""):s(c,"target","qq::group")},children:[l.jsx(At,{children:l.jsx(Pt,{})}),l.jsxs(Rt,{children:[l.jsx(ze,{value:"global",children:"全局配置"}),l.jsx(ze,{value:"specific",children:"详细配置"})]})]})]}),o.target!==""&&(()=>{const h=o.target.split(":"),f=h[0]||"qq",m=h[1]||"",g=h[2]||"group";return l.jsxs("div",{className:"grid gap-4 p-4 rounded-lg bg-muted/50",children:[l.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{className:"text-xs font-medium",children:"平台"}),l.jsxs(zt,{value:f,onValueChange:x=>{s(c,"target",`${x}:${m}:${g}`)},children:[l.jsx(At,{children:l.jsx(Pt,{})}),l.jsxs(Rt,{children:[l.jsx(ze,{value:"qq",children:"QQ"}),l.jsx(ze,{value:"wx",children:"微信"})]})]})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{className:"text-xs font-medium",children:"群 ID"}),l.jsx(Pe,{value:m,onChange:x=>{s(c,"target",`${f}:${x.target.value}:${g}`)},placeholder:"输入群 ID",className:"font-mono text-sm"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{className:"text-xs font-medium",children:"类型"}),l.jsxs(zt,{value:g,onValueChange:x=>{s(c,"target",`${f}:${m}:${x}`)},children:[l.jsx(At,{children:l.jsx(Pt,{})}),l.jsxs(Rt,{children:[l.jsx(ze,{value:"group",children:"群组(group)"}),l.jsx(ze,{value:"private",children:"私聊(private)"})]})]})]})]}),l.jsxs("p",{className:"text-xs text-muted-foreground",children:["当前聊天流 ID:",o.target||"(未设置)"]})]})})(),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{className:"text-xs font-medium",children:"时间段 (Time)"}),l.jsx(i,{value:o.time,onChange:h=>s(c,"time",h)}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"支持跨夜区间,例如 23:00-02:00"})]}),l.jsxs("div",{className:"grid gap-3",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx(de,{htmlFor:`rule-value-${c}`,className:"text-xs font-medium",children:"发言频率值 (Value)"}),l.jsx(Pe,{id:`rule-value-${c}`,type:"number",step:"0.01",min:"0.01",max:"1",value:o.value,onChange:h=>{const f=parseFloat(h.target.value);isNaN(f)||s(c,"value",Math.max(.01,Math.min(1,f)))},className:"w-20 h-8 text-xs"})]}),l.jsx($0,{value:[o.value],onValueChange:h=>s(c,"value",h[0]),min:.01,max:1,step:.01,className:"w-full"}),l.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[l.jsx("span",{children:"0.01 (极少发言)"}),l.jsx("span",{children:"0.5"}),l.jsx("span",{children:"1.0 (正常)"})]})]})]})]},c))}):l.jsx("div",{className:"text-center py-8 text-muted-foreground",children:l.jsx("p",{className:"text-sm",children:'暂无规则,点击"添加规则"按钮创建'})}),l.jsxs("div",{className:"mt-4 p-4 bg-blue-50 dark:bg-blue-950/20 border border-blue-200 dark:border-blue-800 rounded-lg",children:[l.jsx("h5",{className:"text-sm font-semibold text-blue-900 dark:text-blue-100 mb-2",children:"📝 规则说明"}),l.jsxs("ul",{className:"text-xs text-blue-800 dark:text-blue-200 space-y-1",children:[l.jsxs("li",{children:["• ",l.jsx("strong",{children:"Target 为空"}),":全局规则,对所有聊天生效"]}),l.jsxs("li",{children:["• ",l.jsx("strong",{children:"Target 指定"}),":仅对特定聊天流生效(格式:platform:id:type)"]}),l.jsxs("li",{children:["• ",l.jsx("strong",{children:"优先级"}),":先匹配具体聊天流规则,再匹配全局规则"]}),l.jsxs("li",{children:["• ",l.jsx("strong",{children:"时间支持跨夜"}),":例如 23:00-02:00 表示晚上11点到次日凌晨2点"]}),l.jsxs("li",{children:["• ",l.jsx("strong",{children:"数值范围"}),":建议 0-1,0 表示完全沉默,1 表示正常发言"]})]})]})]})]})}function yhe({member:t,groupIndex:e,memberIndex:n,availableChatIds:r,onUpdate:s,onRemove:i}){const a=r.includes(t)||t==="*",[o,c]=b.useState(!a);return l.jsxs("div",{className:"flex gap-2",children:[l.jsx("div",{className:"flex-1 flex gap-2",children:o?l.jsxs(l.Fragment,{children:[l.jsx(Pe,{value:t,onChange:h=>s(e,n,h.target.value),placeholder:'输入 "*" 或 "qq:123456:group"',className:"flex-1"}),r.length>0&&l.jsx(fe,{size:"sm",variant:"outline",onClick:()=>c(!1),title:"切换到下拉选择",children:"下拉"})]}):l.jsxs(l.Fragment,{children:[l.jsxs(zt,{value:t,onValueChange:h=>s(e,n,h),children:[l.jsx(At,{className:"flex-1",children:l.jsx(Pt,{placeholder:"选择聊天流"})}),l.jsxs(Rt,{children:[l.jsx(ze,{value:"*",children:"* (全局共享)"}),r.map((h,f)=>l.jsx(ze,{value:h,children:h},f))]})]}),l.jsx(fe,{size:"sm",variant:"outline",onClick:()=>c(!0),title:"切换到手动输入",children:"输入"})]})}),l.jsxs(wn,{children:[l.jsx(Lr,{asChild:!0,children:l.jsx(fe,{size:"icon",variant:"outline",children:l.jsx(ln,{className:"h-4 w-4"})})}),l.jsxs(un,{children:[l.jsxs(dn,{children:[l.jsx(fn,{children:"确认删除"}),l.jsxs(mn,{children:['确定要删除组成员 "',t||"(空)",'" 吗?此操作无法撤销。']})]}),l.jsxs(hn,{children:[l.jsx(gn,{children:"取消"}),l.jsx(pn,{onClick:()=>i(e,n),children:"删除"})]})]})]})]})}function bhe({config:t,onChange:e}){const n=()=>{e({...t,learning_list:[...t.learning_list,["","enable","enable","1.0"]]})},r=m=>{e({...t,learning_list:t.learning_list.filter((g,x)=>x!==m)})},s=(m,g,x)=>{const y=[...t.learning_list];y[m][g]=x,e({...t,learning_list:y})},i=({rule:m})=>{const g=`["${m[0]}", "${m[1]}", "${m[2]}", "${m[3]}"]`;return l.jsxs(uo,{children:[l.jsx(ho,{asChild:!0,children:l.jsxs(fe,{variant:"outline",size:"sm",children:[l.jsx(aa,{className:"h-4 w-4 mr-1"}),"预览"]})}),l.jsx(ol,{className:"w-96",children:l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),l.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:g}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})},a=()=>{e({...t,expression_groups:[...t.expression_groups,[]]})},o=m=>{e({...t,expression_groups:t.expression_groups.filter((g,x)=>x!==m)})},c=m=>{const g=[...t.expression_groups];g[m]=[...g[m],""],e({...t,expression_groups:g})},h=(m,g)=>{const x=[...t.expression_groups];x[m]=x[m].filter((y,w)=>w!==g),e({...t,expression_groups:x})},f=(m,g,x)=>{const y=[...t.expression_groups];y[m][g]=x,e({...t,expression_groups:y})};return l.jsxs("div",{className:"space-y-6",children:[l.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center justify-between mb-4",children:[l.jsxs("div",{children:[l.jsx("h3",{className:"text-lg font-semibold",children:"表达学习配置"}),l.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"配置麦麦如何学习和使用表达方式"})]}),l.jsxs(fe,{onClick:n,size:"sm",variant:"outline",children:[l.jsx(gs,{className:"h-4 w-4 mr-1"}),"添加规则"]})]}),l.jsxs("div",{className:"space-y-4",children:[t.learning_list.map((m,g)=>{const x=t.learning_list.some((C,T)=>T!==g&&C[0]===""),y=m[0]==="",w=m[0].split(":"),S=w[0]||"qq",k=w[1]||"",N=w[2]||"group";return l.jsxs("div",{className:"rounded-lg border p-4 space-y-4",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("span",{className:"text-sm font-medium",children:["规则 ",g+1," ",y&&"(全局配置)"]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(i,{rule:m}),l.jsxs(wn,{children:[l.jsx(Lr,{asChild:!0,children:l.jsx(fe,{size:"sm",variant:"ghost",children:l.jsx(ln,{className:"h-4 w-4"})})}),l.jsxs(un,{children:[l.jsxs(dn,{children:[l.jsx(fn,{children:"确认删除"}),l.jsxs(mn,{children:["确定要删除学习规则 ",g+1," 吗?此操作无法撤销。"]})]}),l.jsxs(hn,{children:[l.jsx(gn,{children:"取消"}),l.jsx(pn,{onClick:()=>r(g),children:"删除"})]})]})]})]})]}),l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{className:"text-xs font-medium",children:"配置类型"}),l.jsxs(zt,{value:y?"global":"specific",onValueChange:C=>{C==="global"?s(g,0,""):s(g,0,"qq::group")},disabled:x&&!y,children:[l.jsx(At,{children:l.jsx(Pt,{})}),l.jsxs(Rt,{children:[l.jsx(ze,{value:"global",children:"全局配置"}),l.jsx(ze,{value:"specific",disabled:x&&!y,children:"详细配置"})]})]}),x&&!y&&l.jsx("p",{className:"text-xs text-amber-600",children:"已存在全局配置,无法创建新的全局配置"})]}),!y&&l.jsxs("div",{className:"grid gap-4 p-4 rounded-lg bg-muted/50",children:[l.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{className:"text-xs font-medium",children:"平台"}),l.jsxs(zt,{value:S,onValueChange:C=>{s(g,0,`${C}:${k}:${N}`)},children:[l.jsx(At,{children:l.jsx(Pt,{})}),l.jsxs(Rt,{children:[l.jsx(ze,{value:"qq",children:"QQ"}),l.jsx(ze,{value:"wx",children:"微信"})]})]})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{className:"text-xs font-medium",children:"群 ID"}),l.jsx(Pe,{value:k,onChange:C=>{s(g,0,`${S}:${C.target.value}:${N}`)},placeholder:"输入群 ID",className:"font-mono text-sm"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{className:"text-xs font-medium",children:"类型"}),l.jsxs(zt,{value:N,onValueChange:C=>{s(g,0,`${S}:${k}:${C}`)},children:[l.jsx(At,{children:l.jsx(Pt,{})}),l.jsxs(Rt,{children:[l.jsx(ze,{value:"group",children:"群组(group)"}),l.jsx(ze,{value:"private",children:"私聊(private)"})]})]})]})]}),l.jsxs("p",{className:"text-xs text-muted-foreground",children:["当前聊天流 ID:",m[0]||"(未设置)"]})]}),l.jsx("div",{className:"grid gap-2",children:l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{children:[l.jsx(de,{className:"text-xs font-medium",children:"使用学到的表达"}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"允许麦麦使用从聊天中学到的表达方式"})]}),l.jsx(_t,{checked:m[1]==="enable",onCheckedChange:C=>s(g,1,C?"enable":"disable")})]})}),l.jsx("div",{className:"grid gap-2",children:l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{children:[l.jsx(de,{className:"text-xs font-medium",children:"学习表达"}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"允许麦麦从聊天中学习新的表达方式"})]}),l.jsx(_t,{checked:m[2]==="enable",onCheckedChange:C=>s(g,2,C?"enable":"disable")})]})}),l.jsxs("div",{className:"grid gap-3",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx(de,{className:"text-xs font-medium",children:"学习强度"}),l.jsx(Pe,{type:"number",step:"0.1",min:"0",max:"5",value:m[3],onChange:C=>{const T=parseFloat(C.target.value);isNaN(T)||s(g,3,Math.max(0,Math.min(5,T)).toFixed(1))},className:"w-20 h-8 text-xs"})]}),l.jsx($0,{value:[parseFloat(m[3])||1],onValueChange:C=>s(g,3,C[0].toFixed(1)),min:0,max:5,step:.1,className:"w-full"}),l.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[l.jsx("span",{children:"0 (不学习)"}),l.jsx("span",{children:"2.5"}),l.jsx("span",{children:"5.0 (快速学习)"})]}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"影响学习频率,最短学习间隔 = 300/学习强度(秒)"})]})]})]},g)}),t.learning_list.length===0&&l.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无学习规则,点击"添加规则"开始配置'})]})]})}),l.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center justify-between mb-4",children:[l.jsxs("div",{children:[l.jsx("h3",{className:"text-lg font-semibold",children:"表达共享组配置"}),l.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"配置不同聊天流之间如何共享学到的表达方式"})]}),l.jsxs(fe,{onClick:a,size:"sm",variant:"outline",children:[l.jsx(gs,{className:"h-4 w-4 mr-1"}),"添加共享组"]})]}),l.jsxs("div",{className:"space-y-4",children:[t.expression_groups.map((m,g)=>{const x=t.learning_list.map(y=>y[0]).filter(y=>y!=="");return l.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("span",{className:"text-sm font-medium",children:["共享组 ",g+1,m.length===1&&m[0]==="*"&&"(全局共享)"]}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx(fe,{onClick:()=>c(g),size:"sm",variant:"outline",children:l.jsx(gs,{className:"h-4 w-4"})}),l.jsxs(wn,{children:[l.jsx(Lr,{asChild:!0,children:l.jsx(fe,{size:"sm",variant:"ghost",children:l.jsx(ln,{className:"h-4 w-4"})})}),l.jsxs(un,{children:[l.jsxs(dn,{children:[l.jsx(fn,{children:"确认删除"}),l.jsxs(mn,{children:["确定要删除共享组 ",g+1," 吗?此操作无法撤销。"]})]}),l.jsxs(hn,{children:[l.jsx(gn,{children:"取消"}),l.jsx(pn,{onClick:()=>o(g),children:"删除"})]})]})]})]})]}),l.jsx("div",{className:"space-y-2",children:m.map((y,w)=>l.jsx(yhe,{member:y,groupIndex:g,memberIndex:w,availableChatIds:x,onUpdate:f,onRemove:h},`${g}-${w}`))}),l.jsx("p",{className:"text-xs text-muted-foreground",children:'提示:可以从下拉框选择已配置的聊天流,或手动输入。输入 "*" 启用全局共享'})]},g)}),t.expression_groups.length===0&&l.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无共享组,点击"添加共享组"开始配置'})]})]})})]})}function whe({emojiConfig:t,memoryConfig:e,toolConfig:n,onEmojiChange:r,onMemoryChange:s,onToolChange:i}){return l.jsxs("div",{className:"space-y-6",children:[l.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:l.jsxs("div",{children:[l.jsx("h3",{className:"text-lg font-semibold mb-4",children:"工具设置"}),l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(_t,{id:"enable_tool",checked:n.enable_tool,onCheckedChange:a=>i({...n,enable_tool:a})}),l.jsx(de,{htmlFor:"enable_tool",className:"cursor-pointer",children:"启用工具系统"})]}),l.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"允许麦麦使用各种工具来增强功能"})]})}),l.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:l.jsxs("div",{children:[l.jsx("h3",{className:"text-lg font-semibold mb-4",children:"记忆设置"}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"max_agent_iterations",children:"记忆思考深度"}),l.jsx(Pe,{id:"max_agent_iterations",type:"number",min:"1",value:e.max_agent_iterations,onChange:a=>s({...e,max_agent_iterations:parseInt(a.target.value)})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"最低为 1(不深入思考)"})]})]})}),l.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:l.jsxs("div",{children:[l.jsx("h3",{className:"text-lg font-semibold mb-4",children:"表情包设置"}),l.jsxs("div",{className:"grid gap-4",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"emoji_chance",children:"表情包激活概率"}),l.jsx(Pe,{id:"emoji_chance",type:"number",step:"0.1",min:"0",max:"1",value:t.emoji_chance,onChange:a=>r({...t,emoji_chance:parseFloat(a.target.value)})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"范围 0-1,越大越容易发送表情包"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"max_reg_num",children:"最大注册数量"}),l.jsx(Pe,{id:"max_reg_num",type:"number",min:"1",value:t.max_reg_num,onChange:a=>r({...t,max_reg_num:parseInt(a.target.value)})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦最多可以注册的表情包数量"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"check_interval",children:"检查间隔(分钟)"}),l.jsx(Pe,{id:"check_interval",type:"number",min:"1",value:t.check_interval,onChange:a=>r({...t,check_interval:parseInt(a.target.value)})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"检查表情包(注册、破损、删除)的时间间隔"})]}),l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(_t,{id:"do_replace",checked:t.do_replace,onCheckedChange:a=>r({...t,do_replace:a})}),l.jsx(de,{htmlFor:"do_replace",className:"cursor-pointer",children:"达到最大数量时替换表情包"})]}),l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(_t,{id:"steal_emoji",checked:t.steal_emoji,onCheckedChange:a=>r({...t,steal_emoji:a})}),l.jsx(de,{htmlFor:"steal_emoji",className:"cursor-pointer",children:"偷取表情包"})]}),l.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"允许麦麦将看到的表情包据为己有"}),l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(_t,{id:"content_filtration",checked:t.content_filtration,onCheckedChange:a=>r({...t,content_filtration:a})}),l.jsx(de,{htmlFor:"content_filtration",className:"cursor-pointer",children:"启用表情包过滤"})]}),t.content_filtration&&l.jsxs("div",{className:"grid gap-2 pl-6 border-l-2 border-primary/20",children:[l.jsx(de,{htmlFor:"filtration_prompt",children:"过滤要求"}),l.jsx(Pe,{id:"filtration_prompt",value:t.filtration_prompt,onChange:a=>r({...t,filtration_prompt:a.target.value}),placeholder:"符合公序良俗"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"只有符合此要求的表情包才会被保存"})]})]})]})})]})}function She({keywordReactionConfig:t,responsePostProcessConfig:e,chineseTypoConfig:n,responseSplitterConfig:r,onKeywordReactionChange:s,onResponsePostProcessChange:i,onChineseTypoChange:a,onResponseSplitterChange:o}){const c=()=>{s({...t,regex_rules:[...t.regex_rules,{regex:[""],reaction:""}]})},h=T=>{s({...t,regex_rules:t.regex_rules.filter((_,E)=>E!==T)})},f=(T,_,E)=>{const M=[...t.regex_rules];_==="regex"&&typeof E=="string"?M[T]={...M[T],regex:[E]}:_==="reaction"&&typeof E=="string"&&(M[T]={...M[T],reaction:E}),s({...t,regex_rules:M})},m=({regex:T,reaction:_,onRegexChange:E,onReactionChange:M})=>{const[q,L]=b.useState(!1),[I,$]=b.useState(""),[V,ee]=b.useState(null),[z,H]=b.useState(""),[P,W]=b.useState({}),[J,X]=b.useState(""),R=b.useRef(null),[se,G]=b.useState("build"),F=Y=>Y.replace(/\(\?P<([^>]+)>/g,"(?<$1>"),U=(Y,ae=0)=>{const re=R.current;if(!re)return;const le=re.selectionStart||0,_e=re.selectionEnd||0,Ge=T.substring(0,le)+Y+T.substring(_e);E(Ge),setTimeout(()=>{const tt=le+Y.length+ae;re.setSelectionRange(tt,tt),re.focus()},0)};b.useEffect(()=>{if(!T||!I){ee(null),W({}),X(_),H("");return}try{const Y=F(T),ae=new RegExp(Y,"g"),re=I.match(ae);ee(re),H("");const _e=new RegExp(Y).exec(I);if(_e&&_e.groups){W(_e.groups);let Ge=_;Object.entries(_e.groups).forEach(([tt,Xe])=>{Ge=Ge.replace(new RegExp(`\\[${tt}\\]`,"g"),Xe||"")}),X(Ge)}else W({}),X(_)}catch(Y){H(Y.message),ee(null),W({}),X(_)}},[T,I,_]);const te=()=>{if(!I||!V||V.length===0)return l.jsx("span",{className:"text-muted-foreground",children:I||"请输入测试文本"});try{const Y=F(T),ae=new RegExp(Y,"g");let re=0;const le=[];let _e;for(;(_e=ae.exec(I))!==null;)_e.index>re&&le.push(l.jsx("span",{children:I.substring(re,_e.index)},`text-${re}`)),le.push(l.jsx("span",{className:"bg-yellow-200 dark:bg-yellow-900 font-semibold",children:_e[0]},`match-${_e.index}`)),re=_e.index+_e[0].length;return re)",desc:"Python风格命名捕获组",moveCursor:-1},{label:"非捕获组",pattern:"(?:)",desc:"分组但不保存匹配结果",moveCursor:-1}]},{category:"字符类",items:[{label:"字符集",pattern:"[]",desc:"匹配括号内的任意字符",moveCursor:-1},{label:"排除字符",pattern:"[^]",desc:"匹配不在括号内的字符",moveCursor:-1},{label:"范围",pattern:"[a-z]",desc:"匹配a到z的字符"},{label:"中文字符",pattern:"[\\u4e00-\\u9fa5]",desc:"匹配中文汉字"}]},{category:"常用模板",items:[{label:"捕获词语",pattern:"(?P\\S+)",desc:"捕获一个词语"},{label:"捕获句子",pattern:"(?P.+)",desc:"捕获整个句子"},{label:"捕获数字",pattern:"(?P\\d+)",desc:"捕获一个或多个数字"},{label:"可选词语",pattern:"(?:词语1|词语2)",desc:"匹配多个可选项之一"}]}];return l.jsxs(fr,{open:q,onOpenChange:L,children:[l.jsx(Bh,{asChild:!0,children:l.jsxs(fe,{variant:"outline",size:"sm",children:[l.jsx(j1,{className:"h-4 w-4 mr-1"}),"正则编辑器"]})}),l.jsxs(rr,{className:"max-w-[95vw] sm:max-w-[900px] max-h-[90vh]",children:[l.jsxs(sr,{children:[l.jsx(ir,{children:"正则表达式编辑器"}),l.jsx(Ir,{className:"text-sm",children:"使用可视化工具构建正则表达式,并实时测试效果"})]}),l.jsx(on,{className:"max-h-[calc(90vh-120px)]",children:l.jsxs(na,{value:se,onValueChange:Y=>G(Y),className:"w-full",children:[l.jsxs(_i,{className:"grid w-full grid-cols-2",children:[l.jsx(Et,{value:"build",children:"🔧 构建器"}),l.jsx(Et,{value:"test",children:"🧪 测试器"})]}),l.jsxs(Kt,{value:"build",className:"space-y-4 mt-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(de,{className:"text-sm font-medium",children:"正则表达式"}),l.jsx(Pe,{ref:R,value:T,onChange:Y=>E(Y.target.value),className:"font-mono text-sm",placeholder:"点击下方按钮构建正则表达式..."})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(de,{className:"text-sm font-medium",children:"Reaction 内容"}),l.jsx(dr,{value:_,onChange:Y=>M(Y.target.value),placeholder:"使用 [捕获组名] 引用捕获的内容...",rows:3,className:"text-sm"})]}),l.jsxs("div",{className:"space-y-4 border-t pt-4",children:[ne.map(Y=>l.jsxs("div",{className:"space-y-2",children:[l.jsx("h5",{className:"text-xs font-semibold text-primary",children:Y.category}),l.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:Y.items.map(ae=>l.jsx(fe,{variant:"outline",size:"sm",className:"justify-start h-auto py-2 px-3",onClick:()=>U(ae.pattern,ae.moveCursor||0),children:l.jsxs("div",{className:"flex flex-col items-start w-full",children:[l.jsxs("div",{className:"flex items-center gap-2 w-full",children:[l.jsx("span",{className:"text-xs font-medium",children:ae.label}),l.jsx("code",{className:"ml-auto text-xs bg-muted px-1.5 py-0.5 rounded font-mono",children:ae.pattern})]}),l.jsx("span",{className:"text-xs text-muted-foreground mt-0.5",children:ae.desc})]})},ae.label))})]},Y.category)),l.jsxs("div",{className:"space-y-2 border-t pt-4",children:[l.jsx("h5",{className:"text-xs font-semibold text-primary",children:"完整示例模板"}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(fe,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>E("^(?P\\S{1,20})是这样的$"),children:l.jsxs("div",{className:"flex flex-col items-start w-full",children:[l.jsxs("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:["^(?P\\S","{1,20}",")是这样的$"]}),l.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"匹配「某事物是这样的」并捕获事物名称"})]})}),l.jsx(fe,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>E("(?:[^,。.\\s]+,\\s*)?我(?:也)?[没沒]要求你\\s*(?P.+?)[.。,,]?$"),children:l.jsxs("div",{className:"flex flex-col items-start w-full",children:[l.jsx("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:"(?:[^,。.\\s]+,\\s*)?我(?:也)?[没沒]要求你\\s*(?P.+?)[.。,,]?$"}),l.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"匹配「我没要求你做某事」并捕获具体行为"})]})}),l.jsx(fe,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>E("(?P.+?)(?:是|为什么|怎么)"),children:l.jsxs("div",{className:"flex flex-col items-start w-full",children:[l.jsx("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:"(?P.+?)(?:是|为什么|怎么)"}),l.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"捕获问题主题词"})]})})]})]})]}),l.jsxs("div",{className:"rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3 space-y-1",children:[l.jsx("p",{className:"text-xs font-medium text-blue-900 dark:text-blue-100",children:"💡 使用提示"}),l.jsxs("ul",{className:"text-xs text-blue-700 dark:text-blue-300 space-y-1 list-disc list-inside",children:[l.jsx("li",{children:"点击输入框设置光标位置,然后点击按钮插入模式"}),l.jsxs("li",{children:["命名捕获组格式:",l.jsx("code",{className:"bg-blue-100 dark:bg-blue-900 px-1 rounded",children:"(?P<名称>模式)"})]}),l.jsxs("li",{children:["在 reaction 中使用 ",l.jsx("code",{className:"bg-blue-100 dark:bg-blue-900 px-1 rounded",children:"[名称]"})," 引用捕获的内容"]}),l.jsx("li",{children:"切换到测试器标签页验证正则表达式效果"})]})]})]}),l.jsxs(Kt,{value:"test",className:"space-y-4 mt-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(de,{className:"text-sm font-medium",children:"当前正则表达式"}),l.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:T||"(未设置)"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(de,{htmlFor:"test-text",className:"text-sm font-medium",children:"测试文本"}),l.jsx(dr,{id:"test-text",value:I,onChange:Y=>$(Y.target.value),placeholder:`在此输入要测试的文本... -例如:打游戏是这样的`,className:"min-h-[100px] text-sm"})]}),z&&l.jsxs("div",{className:"rounded-md bg-destructive/10 border border-destructive/20 p-3",children:[l.jsx("p",{className:"text-sm text-destructive font-medium",children:"正则表达式错误"}),l.jsx("p",{className:"text-xs text-destructive/80 mt-1",children:z})]}),!z&&I&&l.jsxs("div",{className:"space-y-3",children:[l.jsx("div",{className:"flex items-center gap-2",children:V&&V.length>0?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"h-2 w-2 rounded-full bg-green-500"}),l.jsxs("span",{className:"text-sm font-medium text-green-600 dark:text-green-400",children:["匹配成功 (",V.length," 处)"]})]}):l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"h-2 w-2 rounded-full bg-gray-400"}),l.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"无匹配"})]})}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(de,{className:"text-sm font-medium",children:"匹配高亮"}),l.jsx(on,{className:"h-40 rounded-md bg-muted p-3",children:l.jsx("div",{className:"text-sm break-words",children:te()})})]}),Object.keys(P).length>0&&l.jsxs("div",{className:"space-y-2",children:[l.jsx(de,{className:"text-sm font-medium",children:"命名捕获组"}),l.jsx(on,{className:"h-32 rounded-md border p-3",children:l.jsx("div",{className:"space-y-2",children:Object.entries(P).map(([Y,ae])=>l.jsxs("div",{className:"flex items-start gap-2 text-sm",children:[l.jsxs("span",{className:"font-mono font-semibold text-primary min-w-[80px]",children:["[",Y,"]"]}),l.jsx("span",{className:"text-muted-foreground",children:"="}),l.jsx("span",{className:"font-mono bg-muted px-2 py-0.5 rounded",children:ae})]},Y))})})]}),Object.keys(P).length>0&&_&&l.jsxs("div",{className:"space-y-2",children:[l.jsx(de,{className:"text-sm font-medium",children:"Reaction 替换预览"}),l.jsx(on,{className:"h-48 rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3",children:l.jsx("div",{className:"text-sm break-words",children:J})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"reaction 中的 [name] 已被替换为对应的捕获组值"})]})]}),l.jsxs("div",{className:"rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3 space-y-1",children:[l.jsx("p",{className:"text-xs font-medium text-blue-900 dark:text-blue-100",children:"💡 测试说明"}),l.jsxs("ul",{className:"text-xs text-blue-700 dark:text-blue-300 space-y-1 list-disc list-inside",children:[l.jsx("li",{children:"匹配的文本会以黄色背景高亮显示"}),l.jsx("li",{children:"命名捕获组的值会显示在下方列表中"}),l.jsx("li",{children:"Reaction 替换预览显示最终生成的反应内容"}),l.jsx("li",{children:"如需修改正则,切换回构建器标签页"})]})]})]})]})})]})]})},g=()=>{s({...t,keyword_rules:[...t.keyword_rules,{keywords:[],reaction:""}]})},x=T=>{s({...t,keyword_rules:t.keyword_rules.filter((_,E)=>E!==T)})},y=(T,_,E)=>{const M=[...t.keyword_rules];typeof E=="string"&&(M[T]={...M[T],reaction:E}),s({...t,keyword_rules:M})},w=T=>{const _=[...t.keyword_rules];_[T]={..._[T],keywords:[..._[T].keywords||[],""]},s({...t,keyword_rules:_})},S=(T,_)=>{const E=[...t.keyword_rules];E[T]={...E[T],keywords:(E[T].keywords||[]).filter((M,q)=>q!==_)},s({...t,keyword_rules:E})},k=(T,_,E)=>{const M=[...t.keyword_rules],q=[...M[T].keywords||[]];q[_]=E,M[T]={...M[T],keywords:q},s({...t,keyword_rules:M})},N=({rule:T})=>{const _=`{ regex = [${(T.regex||[]).map(E=>`"${E}"`).join(", ")}], reaction = "${T.reaction}" }`;return l.jsxs(uo,{children:[l.jsx(ho,{asChild:!0,children:l.jsxs(fe,{variant:"outline",size:"sm",children:[l.jsx(aa,{className:"h-4 w-4 mr-1"}),"预览"]})}),l.jsx(ol,{className:"w-[95vw] sm:w-[500px]",children:l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),l.jsx(on,{className:"h-60 rounded-md bg-muted p-3",children:l.jsx("pre",{className:"font-mono text-xs break-all",children:_})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})},C=({rule:T})=>{const _=`[[keyword_reaction.keyword_rules]] +`,{label:"if",detail:"block",type:"keyword"}),Ul("if ${}:\n ${}\nelse:\n ${}",{label:"if",detail:"/ else block",type:"keyword"}),Ul("class ${name}:\n def __init__(self, ${params}):\n ${}",{label:"class",detail:"definition",type:"keyword"}),Ul("import ${module}",{label:"import",detail:"statement",type:"keyword"}),Ul("from ${module} import ${names}",{label:"from",detail:"import",type:"keyword"})],lhe=cce(uF,Iq(ihe.concat(ahe)));function Xw(t){let{node:e,pos:n}=t,r=t.lineIndent(n,-1),s=null;for(;;){let i=e.childBefore(n);if(i)if(i.name=="Comment")n=i.from;else if(i.name=="Body"||i.name=="MatchBody")t.baseIndentFor(i)+t.unit<=r&&(s=i),e=i;else if(i.name=="MatchClause")e=i;else if(i.type.is("Statement"))e=i;else break;else break}return s}function Yw(t,e){let n=t.baseIndentFor(e),r=t.lineAt(t.pos,-1),s=r.from+r.text.length;return/^\s*($|#)/.test(r.text)&&t.node.ton?null:n+t.unit}const Kw=n0.define({name:"python",parser:nhe.configure({props:[ty.add({Body:t=>{var e;let n=/^\s*(#|$)/.test(t.textAfter)&&Xw(t)||t.node;return(e=Yw(t,n))!==null&&e!==void 0?e:t.continue()},MatchBody:t=>{var e;let n=Xw(t);return(e=Yw(t,n||t.node))!==null&&e!==void 0?e:t.continue()},IfStatement:t=>/^\s*(else:|elif )/.test(t.textAfter)?t.baseIndent:t.continue(),"ForStatement WhileStatement":t=>/^\s*else:/.test(t.textAfter)?t.baseIndent:t.continue(),TryStatement:t=>/^\s*(except[ :]|finally:|else:)/.test(t.textAfter)?t.baseIndent:t.continue(),MatchStatement:t=>/^\s*case /.test(t.textAfter)?t.baseIndent+t.unit:t.continue(),"TupleExpression ComprehensionExpression ParamList ArgList ParenthesizedExpression":Rw({closing:")"}),"DictionaryExpression DictionaryComprehensionExpression SetExpression SetComprehensionExpression":Rw({closing:"}"}),"ArrayExpression ArrayComprehensionExpression":Rw({closing:"]"}),MemberExpression:t=>t.baseIndent+t.unit,"String FormatString":()=>null,Script:t=>{var e;let n=Xw(t);return(e=n&&Yw(t,n))!==null&&e!==void 0?e:t.continue()}}),X6.add({"ArrayExpression DictionaryExpression SetExpression TupleExpression":_B,Body:(t,e)=>({from:t.from+1,to:t.to-(t.to==e.doc.length?0:1)}),"String FormatString":(t,e)=>({from:e.doc.lineAt(t.from).to,to:t.to})})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"'''",'"""'],stringPrefixes:["f","fr","rf","r","u","b","br","rb","F","FR","RF","R","U","B","BR","RB"]},commentTokens:{line:"#"},indentOnInput:/^\s*([\}\]\)]|else:|elif |except |finally:|case\s+[^:]*:?)$/}});function ohe(){return new CB(Kw,[Kw.data.of({autocomplete:she}),Kw.data.of({autocomplete:lhe})])}const che=U6({String:xe.string,Number:xe.number,"True False":xe.bool,PropertyName:xe.propertyName,Null:xe.null,", :":xe.separator,"[ ]":xe.squareBracket,"{ }":xe.brace}),uhe=d0.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#ClOOQO'#Cr'#CrQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CtOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59W,59WO!iQPO,59WOVQPO,59QOqQPO'#CmO!nQPO,59`OOQO1G.k1G.kOVQPO'#CnO!vQPO,59aOOQO1G.r1G.rOOQO1G.l1G.lOOQO,59X,59XOOQO-E6k-E6kOOQO,59Y,59YOOQO-E6l-E6l",stateData:"#O~OeOS~OQSORSOSSOTSOWQO_ROgPO~OVXOgUO~O^[O~PVO[^O~O]_OVhX~OVaO~O]bO^iX~O^dO~O]_OVha~O]bO^ia~O",goto:"!kjPPPPPPkPPkqwPPPPk{!RPPP!XP!e!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"⚠ JsonText True False Null Number String } { Object Property PropertyName : , ] [ Array",maxTerm:25,nodeProps:[["isolate",-2,6,11,""],["openedBy",7,"{",14,"["],["closedBy",8,"}",15,"]"]],propSources:[che],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oe~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Og~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zO]~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yO[~~'OO_~~'TO^~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0}),dhe=()=>t=>{try{JSON.parse(t.state.doc.toString())}catch(e){if(!(e instanceof SyntaxError))throw e;const n=hhe(e,t.state.doc);return[{from:n,message:e.message,severity:"error",to:n}]}return[]};function hhe(t,e){let n;return(n=t.message.match(/at position (\d+)/))?Math.min(+n[1],e.length):(n=t.message.match(/at line (\d+) column (\d+)/))?Math.min(e.line(+n[1]).from+ +n[2]-1,e.length):0}const fhe=n0.define({name:"json",parser:uhe.configure({props:[ty.add({Object:PT({except:/^\s*\}/}),Array:PT({except:/^\s*\]/})}),X6.add({"Object Array":_B})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function mhe(){return new CB(fhe)}const phe={name:"toml",startState:function(){return{inString:!1,stringType:"",lhs:!0,inArray:0}},token:function(t,e){let n;if(!e.inString&&(n=t.match(/^('''|"""|'|")/))&&(e.stringType=n[0],e.inString=!0),t.sol()&&!e.inString&&e.inArray===0&&(e.lhs=!0),e.inString){for(;e.inString;)if(t.match(e.stringType))e.inString=!1;else if(t.peek()==="\\")t.next(),t.next();else{if(t.eol())break;t.match(/^.[^\\\"\']*/)}return e.lhs?"property":"string"}else{if(e.inArray&&t.peek()==="]")return t.next(),e.inArray--,"bracket";if(e.lhs&&t.peek()==="["&&t.skipTo("]"))return t.next(),t.peek()==="]"&&t.next(),"atom";if(t.peek()==="#")return t.skipToEnd(),"comment";if(t.eatSpace())return null;if(e.lhs&&t.eatWhile(function(r){return r!="="&&r!=" "}))return"property";if(e.lhs&&t.peek()==="=")return t.next(),e.lhs=!1,null;if(!e.lhs&&t.match(/^\d\d\d\d[\d\-\:\.T]*Z/))return"atom";if(!e.lhs&&(t.match("true")||t.match("false")))return"atom";if(!e.lhs&&t.peek()==="[")return e.inArray++,t.next(),"bracket";if(!e.lhs&&t.match(/^\-?\d+(?:\.\d+)?/))return"number";t.eatSpace()||t.next()}return null},languageData:{commentTokens:{line:"#"}}},ghe={python:[ohe()],json:[mhe(),dhe()],toml:[Y6.define(phe)],text:[]};function xhe({value:t,onChange:e,language:n="text",readOnly:r=!1,height:s="400px",minHeight:i,maxHeight:a,placeholder:o,theme:c="dark",className:h=""}){const[f,m]=b.useState(!1);if(b.useEffect(()=>{m(!0)},[]),!f)return l.jsx("div",{className:`rounded-md border bg-muted animate-pulse ${h}`,style:{height:s,minHeight:i,maxHeight:a}});const g=[...ghe[n]||[],Ke.lineWrapping];return r&&g.push(Ke.editable.of(!1)),l.jsx("div",{className:`rounded-md overflow-hidden border ${h}`,children:l.jsx(eF,{value:t,height:s,minHeight:i,maxHeight:a,theme:c==="dark"?Jq:void 0,extensions:g,onChange:e,placeholder:o,basicSetup:{lineNumbers:!0,highlightActiveLineGutter:!0,highlightSpecialChars:!0,history:!0,foldGutter:!0,drawSelection:!0,dropCursor:!0,allowMultipleSelections:!0,indentOnInput:!0,syntaxHighlighting:!0,bracketMatching:!0,closeBrackets:!0,autocompletion:!0,rectangularSelection:!0,crosshairCursor:!0,highlightActiveLine:!0,highlightSelectionMatches:!0,closeBracketsKeymap:!0,defaultKeymap:!0,searchKeymap:!0,historyKeymap:!0,foldKeymap:!0,completionKeymap:!0,lintKeymap:!0}})})}function vhe(){const[t,e]=b.useState(!0),[n,r]=b.useState(!1),[s,i]=b.useState(!1),[a,o]=b.useState(!1),[c,h]=b.useState(!1),[f,m]=b.useState(!1),[g,x]=b.useState("visual"),[y,w]=b.useState(""),[S,k]=b.useState(!1),{toast:N}=ts(),[C,T]=b.useState(null),[_,E]=b.useState(null),[M,L]=b.useState(null),[P,I]=b.useState(null),[Q,U]=b.useState(null),[ee,z]=b.useState(null),[H,B]=b.useState(null),[X,J]=b.useState(null),[G,R]=b.useState(null),[se,W]=b.useState(null),[F,V]=b.useState(null),[te,ne]=b.useState(null),[K,ie]=b.useState(null),[re,ae]=b.useState(null),[_e,Ue]=b.useState(null),[Xe,Ze]=b.useState(null),[Oe,He]=b.useState(null),[Ve,Be]=b.useState(null),ut=b.useRef(null),rt=b.useRef(!0),rn=b.useRef({}),Rn=b.useCallback(async()=>{try{const Te=await are();w(Te),k(!1)}catch(Te){N({variant:"destructive",title:"加载失败",description:Te instanceof Error?Te.message:"加载源代码失败"})}},[N]),Tn=b.useCallback(async()=>{try{e(!0);const Te=await j9();rn.current=Te,T(Te.bot),E(Te.personality);const qe=Te.chat;qe.talk_value_rules||(qe.talk_value_rules=[]),L(qe),I(Te.expression),U(Te.emoji),z(Te.memory),B(Te.tool),J(Te.mood),R(Te.voice),W(Te.lpmm_knowledge),V(Te.keyword_reaction),ne(Te.response_post_process),ie(Te.chinese_typo),ae(Te.response_splitter),Ue(Te.log),Ze(Te.debug),He(Te.maim_message),Be(Te.telemetry),o(!1),rt.current=!1,await Rn()}catch(Te){console.error("加载配置失败:",Te),N({title:"加载失败",description:"无法加载配置文件",variant:"destructive"})}finally{e(!1)}},[N,Rn]);b.useEffect(()=>{Tn()},[Tn]);const Mt=b.useCallback(async(Te,qe)=>{if(!rt.current)try{i(!0),await ore(Te,qe),o(!1)}catch(Rt){console.error(`自动保存 ${Te} 失败:`,Rt),o(!0)}finally{i(!1)}},[]),vt=b.useCallback((Te,qe)=>{rt.current||(o(!0),ut.current&&clearTimeout(ut.current),ut.current=setTimeout(()=>{Mt(Te,qe)},2e3))},[Mt]);b.useEffect(()=>{C&&!rt.current&&vt("bot",C)},[C,vt]),b.useEffect(()=>{_&&!rt.current&&vt("personality",_)},[_,vt]),b.useEffect(()=>{M&&!rt.current&&vt("chat",M)},[M,vt]),b.useEffect(()=>{P&&!rt.current&&vt("expression",P)},[P,vt]),b.useEffect(()=>{Q&&!rt.current&&vt("emoji",Q)},[Q,vt]),b.useEffect(()=>{ee&&!rt.current&&vt("memory",ee)},[ee,vt]),b.useEffect(()=>{H&&!rt.current&&vt("tool",H)},[H,vt]),b.useEffect(()=>{X&&!rt.current&&vt("mood",X)},[X,vt]),b.useEffect(()=>{G&&!rt.current&&vt("voice",G)},[G,vt]),b.useEffect(()=>{se&&!rt.current&&vt("lpmm_knowledge",se)},[se,vt]),b.useEffect(()=>{F&&!rt.current&&vt("keyword_reaction",F)},[F,vt]),b.useEffect(()=>{te&&!rt.current&&vt("response_post_process",te)},[te,vt]),b.useEffect(()=>{K&&!rt.current&&vt("chinese_typo",K)},[K,vt]),b.useEffect(()=>{re&&!rt.current&&vt("response_splitter",re)},[re,vt]),b.useEffect(()=>{_e&&!rt.current&&vt("log",_e)},[_e,vt]),b.useEffect(()=>{Xe&&!rt.current&&vt("debug",Xe)},[Xe,vt]),b.useEffect(()=>{Oe&&!rt.current&&vt("maim_message",Oe)},[Oe,vt]),b.useEffect(()=>{Ve&&!rt.current&&vt("telemetry",Ve)},[Ve,vt]);const Ce=async()=>{try{r(!0),await lre(y),o(!1),k(!1),N({title:"保存成功",description:"配置已保存"}),await Tn()}catch(Te){k(!0),N({variant:"destructive",title:"保存失败",description:Te instanceof Error?Te.message:"保存配置失败"})}finally{r(!1)}},Le=async Te=>{if(a){N({variant:"destructive",title:"切换失败",description:"请先保存当前更改"});return}if(x(Te),Te==="source")await Rn();else try{const qe=await j9();rn.current=qe,T(qe.bot),E(qe.personality);const Rt=qe.chat;Rt.talk_value_rules||(Rt.talk_value_rules=[]),L(Rt),I(qe.expression),U(qe.emoji),z(qe.memory),B(qe.tool),J(qe.mood),R(qe.voice),W(qe.lpmm_knowledge),V(qe.keyword_reaction),ne(qe.response_post_process),ie(qe.chinese_typo),ae(qe.response_splitter),Ue(qe.log),Ze(qe.debug),He(qe.maim_message),Be(qe.telemetry),o(!1)}catch(qe){console.error("加载配置失败:",qe),N({title:"加载失败",description:"无法加载配置文件",variant:"destructive"})}},Ge=async()=>{try{r(!0),ut.current&&clearTimeout(ut.current);const Te={...rn.current,bot:C,personality:_,chat:M,expression:P,emoji:Q,memory:ee,tool:H,mood:X,voice:G,lpmm_knowledge:se,keyword_reaction:F,response_post_process:te,chinese_typo:K,response_splitter:re,log:_e,debug:Xe,maim_message:Oe,telemetry:Ve};await O9(Te),o(!1),N({title:"保存成功",description:"麦麦主程序配置已保存"})}catch(Te){console.error("保存配置失败:",Te),N({title:"保存失败",description:Te.message,variant:"destructive"})}finally{r(!1)}},lt=async()=>{try{h(!0),Uv().catch(()=>{}),m(!0)}catch(Te){console.error("重启失败:",Te),m(!1),N({title:"重启失败",description:"无法发送重启请求,请手动重启",variant:"destructive"}),h(!1)}},jt=async()=>{try{r(!0),ut.current&&clearTimeout(ut.current);const Te={...rn.current,bot:C,personality:_,chat:M,expression:P,emoji:Q,memory:ee,tool:H,mood:X,voice:G,lpmm_knowledge:se,keyword_reaction:F,response_post_process:te,chinese_typo:K,response_splitter:re,log:_e,debug:Xe,maim_message:Oe,telemetry:Ve};await O9(Te),o(!1),N({title:"保存成功",description:"配置已保存,即将重启麦麦..."}),await new Promise(qe=>setTimeout(qe,500)),await lt()}catch(Te){console.error("保存失败:",Te),N({title:"保存失败",description:Te.message,variant:"destructive"})}finally{r(!1)}},Tt=()=>{localStorage.removeItem("access-token"),window.location.href="/auth"},ke=()=>{m(!1),h(!1),N({title:"重启失败",description:"服务器未能在预期时间内恢复,请手动检查",variant:"destructive"})};return t?l.jsx(hn,{className:"h-full",children:l.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:l.jsx("div",{className:"flex items-center justify-center h-64",children:l.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})})}):l.jsx(hn,{className:"h-full",children:l.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[l.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[l.jsxs("div",{children:[l.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"麦麦主程序配置"}),l.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理麦麦的核心功能和行为设置"})]}),l.jsxs("div",{className:"flex gap-2 w-full sm:w-auto items-center",children:[l.jsx(sa,{value:g,onValueChange:Te=>Le(Te),className:"w-auto",children:l.jsxs(Mi,{className:"h-9",children:[l.jsxs(zt,{value:"visual",className:"text-xs sm:text-sm px-2 sm:px-3",children:[l.jsx(BK,{className:"h-3 w-3 sm:h-4 sm:w-4 mr-1"}),"可视化"]}),l.jsxs(zt,{value:"source",className:"text-xs sm:text-sm px-2 sm:px-3",children:[l.jsx(qK,{className:"h-3 w-3 sm:h-4 sm:w-4 mr-1"}),"源代码"]})]})}),l.jsxs(de,{onClick:g==="visual"?Ge:Ce,disabled:n||s||!a||c,size:"sm",variant:"outline",className:"flex-1 sm:flex-none",children:[l.jsx(zv,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),n?"保存中...":s?"自动保存中...":a?"保存配置":"已保存"]}),l.jsxs(Nn,{children:[l.jsx(Qr,{asChild:!0,children:l.jsxs(de,{disabled:n||s||c,size:"sm",className:"flex-1 sm:flex-none",children:[l.jsx(a6,{className:"mr-2 h-4 w-4"}),c?"重启中...":a?"保存并重启":"重启麦麦"]})}),l.jsxs(gn,{children:[l.jsxs(xn,{children:[l.jsx(yn,{children:"确认重启麦麦?"}),l.jsx(bn,{className:"space-y-3",asChild:!0,children:l.jsxs("div",{children:[l.jsx("p",{children:a?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"}),l.jsxs(Na,{className:"border-yellow-500/50 bg-yellow-500/10",children:[l.jsx(ra,{className:"h-4 w-4 text-yellow-600"}),l.jsxs(Ca,{className:"text-yellow-900 dark:text-yellow-100",children:[l.jsx("strong",{children:"重要提示:"}),"由于技术原因,使用重启功能后,将无法再使用 ",l.jsx("code",{className:"px-1 py-0.5 bg-yellow-200 dark:bg-yellow-900 rounded",children:"Ctrl+C"})," 结束程序。",l.jsxs(xr,{children:[l.jsx(Bh,{asChild:!0,children:l.jsxs("button",{className:"ml-1 text-yellow-700 dark:text-yellow-300 underline hover:text-yellow-800 dark:hover:text-yellow-200 inline-flex items-center gap-1",children:[l.jsx(Dv,{className:"h-3 w-3"}),"如何结束程序?"]})}),l.jsxs(lr,{className:"max-w-2xl",children:[l.jsxs(or,{children:[l.jsx(cr,{children:"如何结束使用重启功能后的麦麦程序"}),l.jsx(Hr,{children:"由于重启功能会使程序脱离终端控制,需要通过系统命令来结束进程"})]}),l.jsxs(sa,{defaultValue:"windows",className:"w-full",children:[l.jsxs(Mi,{className:"grid w-full grid-cols-3",children:[l.jsx(zt,{value:"windows",children:"Windows"}),l.jsx(zt,{value:"macos",children:"macOS"}),l.jsx(zt,{value:"linux",children:"Linux"})]}),l.jsxs(tn,{value:"windows",className:"space-y-4 mt-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"font-semibold",children:"方法一:使用任务管理器"}),l.jsxs("ol",{className:"list-decimal list-inside space-y-1 text-sm text-muted-foreground",children:[l.jsxs("li",{children:["按 ",l.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"Ctrl + Shift + Esc"})," 打开任务管理器"]}),l.jsxs("li",{children:['在"进程"或"详细信息"标签页中找到 ',l.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"python.exe"})]}),l.jsx("li",{children:'右键点击并选择"结束任务"'})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"font-semibold",children:"方法二:使用命令行"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"打开 PowerShell 或命令提示符,执行以下命令:"}),l.jsxs("div",{className:"bg-muted p-3 rounded-md font-mono text-sm",children:[l.jsx("p",{children:"# 查找麦麦进程"}),l.jsx("p",{children:'Get-Process python | Where-Object {$_.MainWindowTitle -eq ""}'}),l.jsx("p",{className:"mt-2",children:"# 结束所有 Python 进程(谨慎使用)"}),l.jsx("p",{children:"Stop-Process -Name python -Force"})]})]})]}),l.jsxs(tn,{value:"macos",className:"space-y-4 mt-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"font-semibold",children:"方法一:使用活动监视器"}),l.jsxs("ol",{className:"list-decimal list-inside space-y-1 text-sm text-muted-foreground",children:[l.jsxs("li",{children:["按 ",l.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"Cmd + Space"}),' 打开 Spotlight,搜索"活动监视器"']}),l.jsxs("li",{children:["在进程列表中找到 ",l.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"Python"})]}),l.jsx("li",{children:"选中后点击左上角的 X 按钮结束进程"})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"font-semibold",children:"方法二:使用终端"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"打开终端,执行以下命令:"}),l.jsxs("div",{className:"bg-muted p-3 rounded-md font-mono text-sm",children:[l.jsx("p",{children:"# 查找麦麦进程"}),l.jsx("p",{children:"ps aux | grep python | grep -v grep"}),l.jsx("p",{className:"mt-2",children:"# 结束指定 PID 的进程"}),l.jsx("p",{children:"kill -9 "}),l.jsx("p",{className:"mt-2",children:"# 或结束所有 Python 进程(谨慎使用)"}),l.jsx("p",{children:"pkill -9 python"})]})]})]}),l.jsxs(tn,{value:"linux",className:"space-y-4 mt-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"font-semibold",children:"使用终端命令"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"打开终端,执行以下命令:"}),l.jsxs("div",{className:"bg-muted p-3 rounded-md font-mono text-sm",children:[l.jsx("p",{children:"# 查找麦麦进程"}),l.jsx("p",{children:"ps aux | grep python | grep -v grep"}),l.jsx("p",{className:"mt-2",children:"# 结束指定 PID 的进程"}),l.jsx("p",{children:"kill -9 "}),l.jsx("p",{className:"mt-2",children:"# 或使用 pkill 按名称结束"}),l.jsx("p",{children:'pkill -9 -f "bot.py"'}),l.jsx("p",{className:"mt-2",children:"# 或结束所有 Python 进程(谨慎使用)"}),l.jsx("p",{children:"pkill -9 python"})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"font-semibold",children:"使用 htop(如已安装)"}),l.jsxs("ol",{className:"list-decimal list-inside space-y-1 text-sm text-muted-foreground",children:[l.jsxs("li",{children:["在终端输入 ",l.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"htop"})]}),l.jsxs("li",{children:["按 ",l.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"F3"})," 搜索 python"]}),l.jsxs("li",{children:["按 ",l.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"F9"})," 发送信号,选择 SIGKILL"]})]})]})]})]}),l.jsx(as,{children:l.jsx(k6,{asChild:!0,children:l.jsx(de,{variant:"outline",children:"关闭"})})})]})]})]})]})]})})]}),l.jsxs(vn,{children:[l.jsx(Sn,{children:"取消"}),l.jsx(wn,{onClick:a?jt:lt,children:a?"保存并重启":"确认重启"})]})]})]})]})]}),l.jsxs(Na,{children:[l.jsx(ra,{className:"h-4 w-4"}),l.jsxs(Ca,{children:["配置更新后需要",l.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),g==="source"&&l.jsxs("div",{className:"space-y-4",children:[l.jsxs(Na,{children:[l.jsx(ra,{className:"h-4 w-4"}),l.jsxs(Ca,{children:[l.jsx("strong",{children:"源代码模式(高级功能):"}),"直接编辑 TOML 配置文件。此功能仅适用于熟悉 TOML 语法的高级用户。保存时会在后端验证格式,只有格式完全正确才能保存。",S&&l.jsx("span",{className:"text-destructive font-semibold ml-2",children:"⚠️ 上次保存失败,请检查 TOML 格式"})]})]}),l.jsx(xhe,{value:y,onChange:Te=>{w(Te),o(!0),S&&k(!1)},language:"toml",theme:"dark",height:"calc(100vh - 280px)",minHeight:"500px",placeholder:"TOML 配置内容"})]}),g==="visual"&&l.jsx(l.Fragment,{children:l.jsxs(sa,{defaultValue:"bot",className:"w-full",children:[l.jsx("div",{className:"overflow-x-auto -mx-4 px-4 sm:mx-0 sm:px-0",children:l.jsxs(Mi,{className:"inline-flex w-auto min-w-full sm:grid sm:w-full sm:grid-cols-5 lg:grid-cols-10",children:[l.jsx(zt,{value:"bot",className:"flex-shrink-0",children:"基本信息"}),l.jsx(zt,{value:"personality",className:"flex-shrink-0",children:"人格"}),l.jsx(zt,{value:"chat",className:"flex-shrink-0",children:"聊天"}),l.jsx(zt,{value:"expression",className:"flex-shrink-0",children:"表达"}),l.jsx(zt,{value:"features",className:"flex-shrink-0",children:"功能"}),l.jsx(zt,{value:"processing",className:"flex-shrink-0",children:"处理"}),l.jsx(zt,{value:"mood",className:"flex-shrink-0",children:"情绪"}),l.jsx(zt,{value:"voice",className:"flex-shrink-0",children:"语音"}),l.jsx(zt,{value:"lpmm",className:"flex-shrink-0",children:"知识库"}),l.jsx(zt,{value:"other",className:"flex-shrink-0",children:"其他"})]})}),l.jsx(tn,{value:"bot",className:"space-y-4",children:C&&l.jsx(yhe,{config:C,onChange:T})}),l.jsx(tn,{value:"personality",className:"space-y-4",children:_&&l.jsx(bhe,{config:_,onChange:E})}),l.jsx(tn,{value:"chat",className:"space-y-4",children:M&&l.jsx(whe,{config:M,onChange:L})}),l.jsx(tn,{value:"expression",className:"space-y-4",children:P&&l.jsx(khe,{config:P,onChange:I})}),l.jsx(tn,{value:"features",className:"space-y-4",children:Q&&ee&&H&&l.jsx(jhe,{emojiConfig:Q,memoryConfig:ee,toolConfig:H,onEmojiChange:U,onMemoryChange:z,onToolChange:B})}),l.jsx(tn,{value:"processing",className:"space-y-4",children:F&&te&&K&&re&&l.jsx(Ohe,{keywordReactionConfig:F,responsePostProcessConfig:te,chineseTypoConfig:K,responseSplitterConfig:re,onKeywordReactionChange:V,onResponsePostProcessChange:ne,onChineseTypoChange:ie,onResponseSplitterChange:ae})}),l.jsx(tn,{value:"mood",className:"space-y-4",children:X&&l.jsx(Nhe,{config:X,onChange:J})}),l.jsx(tn,{value:"voice",className:"space-y-4",children:G&&l.jsx(Che,{config:G,onChange:R})}),l.jsx(tn,{value:"lpmm",className:"space-y-4",children:se&&l.jsx(The,{config:se,onChange:W})}),l.jsxs(tn,{value:"other",className:"space-y-4",children:[_e&&l.jsx(Ehe,{config:_e,onChange:Ue}),Xe&&l.jsx(_he,{config:Xe,onChange:Ze}),Oe&&l.jsx(Mhe,{config:Oe,onChange:He}),Ve&&l.jsx(Ahe,{config:Ve,onChange:Be})]})]})}),f&&l.jsx(N6,{onRestartComplete:Tt,onRestartFailed:ke})]})})}function yhe({config:t,onChange:e}){const n=()=>{e({...t,platforms:[...t.platforms,""]})},r=c=>{e({...t,platforms:t.platforms.filter((h,f)=>f!==c)})},s=(c,h)=>{const f=[...t.platforms];f[c]=h,e({...t,platforms:f})},i=()=>{e({...t,alias_names:[...t.alias_names,""]})},a=c=>{e({...t,alias_names:t.alias_names.filter((h,f)=>f!==c)})},o=(c,h)=>{const f=[...t.alias_names];f[c]=h,e({...t,alias_names:f})};return l.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:l.jsxs("div",{children:[l.jsx("h3",{className:"text-lg font-semibold mb-4",children:"基本信息"}),l.jsxs("div",{className:"grid gap-4",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ue,{htmlFor:"platform",children:"平台"}),l.jsx(Pe,{id:"platform",value:t.platform,onChange:c=>e({...t,platform:c.target.value}),placeholder:"qq"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ue,{htmlFor:"qq_account",children:"QQ账号"}),l.jsx(Pe,{id:"qq_account",value:t.qq_account,onChange:c=>e({...t,qq_account:c.target.value}),placeholder:"123456789"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ue,{htmlFor:"nickname",children:"昵称"}),l.jsx(Pe,{id:"nickname",value:t.nickname,onChange:c=>e({...t,nickname:c.target.value}),placeholder:"麦麦"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx(ue,{children:"其他平台账号"}),l.jsxs(de,{onClick:n,size:"sm",variant:"outline",children:[l.jsx(ws,{className:"h-4 w-4 mr-1"}),"添加"]})]}),l.jsxs("div",{className:"space-y-2",children:[t.platforms.map((c,h)=>l.jsxs("div",{className:"flex gap-2",children:[l.jsx(Pe,{value:c,onChange:f=>s(h,f.target.value),placeholder:"wx:114514"}),l.jsxs(Nn,{children:[l.jsx(Qr,{asChild:!0,children:l.jsx(de,{size:"icon",variant:"outline",children:l.jsx(fn,{className:"h-4 w-4"})})}),l.jsxs(gn,{children:[l.jsxs(xn,{children:[l.jsx(yn,{children:"确认删除"}),l.jsxs(bn,{children:['确定要删除平台账号 "',c||"(空)",'" 吗?此操作无法撤销。']})]}),l.jsxs(vn,{children:[l.jsx(Sn,{children:"取消"}),l.jsx(wn,{onClick:()=>r(h),children:"删除"})]})]})]})]},h)),t.platforms.length===0&&l.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无其他平台账号"})]})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx(ue,{children:"别名"}),l.jsxs(de,{onClick:i,size:"sm",variant:"outline",children:[l.jsx(ws,{className:"h-4 w-4 mr-1"}),"添加"]})]}),l.jsxs("div",{className:"space-y-2",children:[t.alias_names.map((c,h)=>l.jsxs("div",{className:"flex gap-2",children:[l.jsx(Pe,{value:c,onChange:f=>o(h,f.target.value),placeholder:"小麦"}),l.jsxs(Nn,{children:[l.jsx(Qr,{asChild:!0,children:l.jsx(de,{size:"icon",variant:"outline",children:l.jsx(fn,{className:"h-4 w-4"})})}),l.jsxs(gn,{children:[l.jsxs(xn,{children:[l.jsx(yn,{children:"确认删除"}),l.jsxs(bn,{children:['确定要删除别名 "',c||"(空)",'" 吗?此操作无法撤销。']})]}),l.jsxs(vn,{children:[l.jsx(Sn,{children:"取消"}),l.jsx(wn,{onClick:()=>a(h),children:"删除"})]})]})]})]},h)),t.alias_names.length===0&&l.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无别名"})]})]})]})]})})}function bhe({config:t,onChange:e}){const n=()=>{e({...t,states:[...t.states,""]})},r=i=>{e({...t,states:t.states.filter((a,o)=>o!==i)})},s=(i,a)=>{const o=[...t.states];o[i]=a,e({...t,states:o})};return l.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:l.jsxs("div",{children:[l.jsx("h3",{className:"text-lg font-semibold mb-4",children:"人格设置"}),l.jsxs("div",{className:"grid gap-4",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ue,{htmlFor:"personality",children:"人格特质"}),l.jsx(pr,{id:"personality",value:t.personality,onChange:i=>e({...t,personality:i.target.value}),placeholder:"描述人格特质和身份特征(建议120字以内)",rows:3}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"建议120字以内,描述人格特质和身份特征"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ue,{htmlFor:"reply_style",children:"表达风格"}),l.jsx(pr,{id:"reply_style",value:t.reply_style,onChange:i=>e({...t,reply_style:i.target.value}),placeholder:"描述说话的表达风格和习惯",rows:3})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ue,{htmlFor:"interest",children:"兴趣"}),l.jsx(pr,{id:"interest",value:t.interest,onChange:i=>e({...t,interest:i.target.value}),placeholder:"会影响麦麦对什么话题进行回复",rows:2})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ue,{htmlFor:"plan_style",children:"说话规则与行为风格"}),l.jsx(pr,{id:"plan_style",value:t.plan_style,onChange:i=>e({...t,plan_style:i.target.value}),placeholder:"麦麦的说话规则和行为风格",rows:5})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ue,{htmlFor:"visual_style",children:"识图规则"}),l.jsx(pr,{id:"visual_style",value:t.visual_style,onChange:i=>e({...t,visual_style:i.target.value}),placeholder:"识图时的处理规则",rows:3})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ue,{htmlFor:"private_plan_style",children:"私聊规则"}),l.jsx(pr,{id:"private_plan_style",value:t.private_plan_style,onChange:i=>e({...t,private_plan_style:i.target.value}),placeholder:"私聊的说话规则和行为风格",rows:4})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx(ue,{children:"状态列表(人格多样性)"}),l.jsxs(de,{onClick:n,size:"sm",variant:"outline",children:[l.jsx(ws,{className:"h-4 w-4 mr-1"}),"添加状态"]})]}),l.jsx("div",{className:"space-y-2",children:t.states.map((i,a)=>l.jsxs("div",{className:"flex gap-2",children:[l.jsx(pr,{value:i,onChange:o=>s(a,o.target.value),placeholder:"描述一个人格状态",rows:2}),l.jsxs(Nn,{children:[l.jsx(Qr,{asChild:!0,children:l.jsx(de,{size:"icon",variant:"outline",children:l.jsx(fn,{className:"h-4 w-4"})})}),l.jsxs(gn,{children:[l.jsxs(xn,{children:[l.jsx(yn,{children:"确认删除"}),l.jsx(bn,{children:"确定要删除这个人格状态吗?此操作无法撤销。"})]}),l.jsxs(vn,{children:[l.jsx(Sn,{children:"取消"}),l.jsx(wn,{onClick:()=>r(a),children:"删除"})]})]})]})]},a))})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ue,{htmlFor:"state_probability",children:"状态替换概率"}),l.jsx(Pe,{id:"state_probability",type:"number",step:"0.1",min:"0",max:"1",value:t.state_probability,onChange:i=>e({...t,state_probability:parseFloat(i.target.value)})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"每次构建人格时替换 personality 的概率(0.0-1.0)"})]})]})]})})}function whe({config:t,onChange:e}){const n=()=>{e({...t,talk_value_rules:[...t.talk_value_rules,{target:"",time:"00:00-23:59",value:1}]})},r=o=>{e({...t,talk_value_rules:t.talk_value_rules.filter((c,h)=>h!==o)})},s=(o,c,h)=>{const f=[...t.talk_value_rules];f[o]={...f[o],[c]:h},e({...t,talk_value_rules:f})},i=({value:o,onChange:c})=>{const[h,f]=b.useState("00"),[m,g]=b.useState("00"),[x,y]=b.useState("23"),[w,S]=b.useState("59");b.useEffect(()=>{const N=o.split("-");if(N.length===2){const[C,T]=N,[_,E]=C.split(":"),[M,L]=T.split(":");_&&f(_.padStart(2,"0")),E&&g(E.padStart(2,"0")),M&&y(M.padStart(2,"0")),L&&S(L.padStart(2,"0"))}},[o]);const k=(N,C,T,_)=>{const E=`${N}:${C}-${T}:${_}`;c(E)};return l.jsxs(ul,{children:[l.jsx(dl,{asChild:!0,children:l.jsxs(de,{variant:"outline",className:"w-full justify-start font-mono text-sm",children:[l.jsx(Zd,{className:"h-4 w-4 mr-2"}),o||"选择时间段"]})}),l.jsx(Ea,{className:"w-80",children:l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{children:[l.jsx("h4",{className:"font-medium text-sm mb-3",children:"开始时间"}),l.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:gap-3",children:[l.jsxs("div",{children:[l.jsx(ue,{className:"text-xs",children:"小时"}),l.jsxs(qt,{value:h,onValueChange:N=>{f(N),k(N,m,x,w)},children:[l.jsx(It,{children:l.jsx(Ft,{})}),l.jsx(Bt,{children:Array.from({length:24},(N,C)=>C).map(N=>l.jsx(De,{value:N.toString().padStart(2,"0"),children:N.toString().padStart(2,"0")},N))})]})]}),l.jsxs("div",{children:[l.jsx(ue,{className:"text-xs",children:"分钟"}),l.jsxs(qt,{value:m,onValueChange:N=>{g(N),k(h,N,x,w)},children:[l.jsx(It,{children:l.jsx(Ft,{})}),l.jsx(Bt,{children:Array.from({length:60},(N,C)=>C).map(N=>l.jsx(De,{value:N.toString().padStart(2,"0"),children:N.toString().padStart(2,"0")},N))})]})]})]})]}),l.jsxs("div",{children:[l.jsx("h4",{className:"font-medium text-sm mb-3",children:"结束时间"}),l.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:gap-3",children:[l.jsxs("div",{children:[l.jsx(ue,{className:"text-xs",children:"小时"}),l.jsxs(qt,{value:x,onValueChange:N=>{y(N),k(h,m,N,w)},children:[l.jsx(It,{children:l.jsx(Ft,{})}),l.jsx(Bt,{children:Array.from({length:24},(N,C)=>C).map(N=>l.jsx(De,{value:N.toString().padStart(2,"0"),children:N.toString().padStart(2,"0")},N))})]})]}),l.jsxs("div",{children:[l.jsx(ue,{className:"text-xs",children:"分钟"}),l.jsxs(qt,{value:w,onValueChange:N=>{S(N),k(h,m,x,N)},children:[l.jsx(It,{children:l.jsx(Ft,{})}),l.jsx(Bt,{children:Array.from({length:60},(N,C)=>C).map(N=>l.jsx(De,{value:N.toString().padStart(2,"0"),children:N.toString().padStart(2,"0")},N))})]})]})]})]})]})})]})},a=({rule:o})=>{const c=`{ target = "${o.target}", time = "${o.time}", value = ${o.value.toFixed(1)} }`;return l.jsxs(ul,{children:[l.jsx(dl,{asChild:!0,children:l.jsxs(de,{variant:"outline",size:"sm",children:[l.jsx(oa,{className:"h-4 w-4 mr-1"}),"预览"]})}),l.jsx(Ea,{className:"w-96",children:l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),l.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:c}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})};return l.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[l.jsxs("div",{children:[l.jsx("h3",{className:"text-lg font-semibold mb-4",children:"聊天设置"}),l.jsxs("div",{className:"grid gap-4",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ue,{htmlFor:"talk_value",children:"聊天频率(基础值)"}),l.jsx(Pe,{id:"talk_value",type:"number",step:"0.1",min:"0",max:"1",value:t.talk_value,onChange:o=>e({...t,talk_value:parseFloat(o.target.value)})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"越小越沉默,范围 0-1"})]}),l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(Pt,{id:"mentioned_bot_reply",checked:t.mentioned_bot_reply,onCheckedChange:o=>e({...t,mentioned_bot_reply:o})}),l.jsx(ue,{htmlFor:"mentioned_bot_reply",className:"cursor-pointer",children:"启用提及必回复"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ue,{htmlFor:"max_context_size",children:"上下文长度"}),l.jsx(Pe,{id:"max_context_size",type:"number",min:"1",value:t.max_context_size,onChange:o=>e({...t,max_context_size:parseInt(o.target.value)})})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ue,{htmlFor:"planner_smooth",children:"规划器平滑"}),l.jsx(Pe,{id:"planner_smooth",type:"number",step:"1",min:"0",value:t.planner_smooth,onChange:o=>e({...t,planner_smooth:parseFloat(o.target.value)})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"增大数值会减小 planner 负荷,推荐 1-5,0 为关闭"})]}),l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(Pt,{id:"enable_talk_value_rules",checked:t.enable_talk_value_rules,onCheckedChange:o=>e({...t,enable_talk_value_rules:o})}),l.jsx(ue,{htmlFor:"enable_talk_value_rules",className:"cursor-pointer",children:"启用动态发言频率规则"})]}),l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(Pt,{id:"include_planner_reasoning",checked:t.include_planner_reasoning,onCheckedChange:o=>e({...t,include_planner_reasoning:o})}),l.jsx(ue,{htmlFor:"include_planner_reasoning",className:"cursor-pointer",children:"将 planner 推理加入 replyer"})]})]})]}),t.enable_talk_value_rules&&l.jsxs("div",{className:"border-t pt-6",children:[l.jsxs("div",{className:"flex items-center justify-between mb-4",children:[l.jsxs("div",{children:[l.jsx("h4",{className:"text-base font-semibold",children:"动态发言频率规则"}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"按时段或聊天流ID调整发言频率,优先匹配具体聊天,再匹配全局规则"})]}),l.jsxs(de,{onClick:n,size:"sm",children:[l.jsx(ws,{className:"h-4 w-4 mr-1"}),"添加规则"]})]}),t.talk_value_rules&&t.talk_value_rules.length>0?l.jsx("div",{className:"space-y-4",children:t.talk_value_rules.map((o,c)=>l.jsxs("div",{className:"rounded-lg border p-4 bg-muted/50 space-y-4",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("span",{className:"text-sm font-medium text-muted-foreground",children:["规则 #",c+1]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(a,{rule:o}),l.jsxs(Nn,{children:[l.jsx(Qr,{asChild:!0,children:l.jsx(de,{variant:"ghost",size:"sm",children:l.jsx(fn,{className:"h-4 w-4 text-destructive"})})}),l.jsxs(gn,{children:[l.jsxs(xn,{children:[l.jsx(yn,{children:"确认删除"}),l.jsxs(bn,{children:["确定要删除规则 #",c+1," 吗?此操作无法撤销。"]})]}),l.jsxs(vn,{children:[l.jsx(Sn,{children:"取消"}),l.jsx(wn,{onClick:()=>r(c),children:"删除"})]})]})]})]})]}),l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ue,{className:"text-xs font-medium",children:"配置类型"}),l.jsxs(qt,{value:o.target===""?"global":"specific",onValueChange:h=>{h==="global"?s(c,"target",""):s(c,"target","qq::group")},children:[l.jsx(It,{children:l.jsx(Ft,{})}),l.jsxs(Bt,{children:[l.jsx(De,{value:"global",children:"全局配置"}),l.jsx(De,{value:"specific",children:"详细配置"})]})]})]}),o.target!==""&&(()=>{const h=o.target.split(":"),f=h[0]||"qq",m=h[1]||"",g=h[2]||"group";return l.jsxs("div",{className:"grid gap-4 p-4 rounded-lg bg-muted/50",children:[l.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ue,{className:"text-xs font-medium",children:"平台"}),l.jsxs(qt,{value:f,onValueChange:x=>{s(c,"target",`${x}:${m}:${g}`)},children:[l.jsx(It,{children:l.jsx(Ft,{})}),l.jsxs(Bt,{children:[l.jsx(De,{value:"qq",children:"QQ"}),l.jsx(De,{value:"wx",children:"微信"})]})]})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ue,{className:"text-xs font-medium",children:"群 ID"}),l.jsx(Pe,{value:m,onChange:x=>{s(c,"target",`${f}:${x.target.value}:${g}`)},placeholder:"输入群 ID",className:"font-mono text-sm"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ue,{className:"text-xs font-medium",children:"类型"}),l.jsxs(qt,{value:g,onValueChange:x=>{s(c,"target",`${f}:${m}:${x}`)},children:[l.jsx(It,{children:l.jsx(Ft,{})}),l.jsxs(Bt,{children:[l.jsx(De,{value:"group",children:"群组(group)"}),l.jsx(De,{value:"private",children:"私聊(private)"})]})]})]})]}),l.jsxs("p",{className:"text-xs text-muted-foreground",children:["当前聊天流 ID:",o.target||"(未设置)"]})]})})(),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ue,{className:"text-xs font-medium",children:"时间段 (Time)"}),l.jsx(i,{value:o.time,onChange:h=>s(c,"time",h)}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"支持跨夜区间,例如 23:00-02:00"})]}),l.jsxs("div",{className:"grid gap-3",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx(ue,{htmlFor:`rule-value-${c}`,className:"text-xs font-medium",children:"发言频率值 (Value)"}),l.jsx(Pe,{id:`rule-value-${c}`,type:"number",step:"0.01",min:"0.01",max:"1",value:o.value,onChange:h=>{const f=parseFloat(h.target.value);isNaN(f)||s(c,"value",Math.max(.01,Math.min(1,f)))},className:"w-20 h-8 text-xs"})]}),l.jsx(V0,{value:[o.value],onValueChange:h=>s(c,"value",h[0]),min:.01,max:1,step:.01,className:"w-full"}),l.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[l.jsx("span",{children:"0.01 (极少发言)"}),l.jsx("span",{children:"0.5"}),l.jsx("span",{children:"1.0 (正常)"})]})]})]})]},c))}):l.jsx("div",{className:"text-center py-8 text-muted-foreground",children:l.jsx("p",{className:"text-sm",children:'暂无规则,点击"添加规则"按钮创建'})}),l.jsxs("div",{className:"mt-4 p-4 bg-blue-50 dark:bg-blue-950/20 border border-blue-200 dark:border-blue-800 rounded-lg",children:[l.jsx("h5",{className:"text-sm font-semibold text-blue-900 dark:text-blue-100 mb-2",children:"📝 规则说明"}),l.jsxs("ul",{className:"text-xs text-blue-800 dark:text-blue-200 space-y-1",children:[l.jsxs("li",{children:["• ",l.jsx("strong",{children:"Target 为空"}),":全局规则,对所有聊天生效"]}),l.jsxs("li",{children:["• ",l.jsx("strong",{children:"Target 指定"}),":仅对特定聊天流生效(格式:platform:id:type)"]}),l.jsxs("li",{children:["• ",l.jsx("strong",{children:"优先级"}),":先匹配具体聊天流规则,再匹配全局规则"]}),l.jsxs("li",{children:["• ",l.jsx("strong",{children:"时间支持跨夜"}),":例如 23:00-02:00 表示晚上11点到次日凌晨2点"]}),l.jsxs("li",{children:["• ",l.jsx("strong",{children:"数值范围"}),":建议 0-1,0 表示完全沉默,1 表示正常发言"]})]})]})]})]})}function She({member:t,groupIndex:e,memberIndex:n,availableChatIds:r,onUpdate:s,onRemove:i}){const a=r.includes(t)||t==="*",[o,c]=b.useState(!a);return l.jsxs("div",{className:"flex gap-2",children:[l.jsx("div",{className:"flex-1 flex gap-2",children:o?l.jsxs(l.Fragment,{children:[l.jsx(Pe,{value:t,onChange:h=>s(e,n,h.target.value),placeholder:'输入 "*" 或 "qq:123456:group"',className:"flex-1"}),r.length>0&&l.jsx(de,{size:"sm",variant:"outline",onClick:()=>c(!1),title:"切换到下拉选择",children:"下拉"})]}):l.jsxs(l.Fragment,{children:[l.jsxs(qt,{value:t,onValueChange:h=>s(e,n,h),children:[l.jsx(It,{className:"flex-1",children:l.jsx(Ft,{placeholder:"选择聊天流"})}),l.jsxs(Bt,{children:[l.jsx(De,{value:"*",children:"* (全局共享)"}),r.map((h,f)=>l.jsx(De,{value:h,children:h},f))]})]}),l.jsx(de,{size:"sm",variant:"outline",onClick:()=>c(!0),title:"切换到手动输入",children:"输入"})]})}),l.jsxs(Nn,{children:[l.jsx(Qr,{asChild:!0,children:l.jsx(de,{size:"icon",variant:"outline",children:l.jsx(fn,{className:"h-4 w-4"})})}),l.jsxs(gn,{children:[l.jsxs(xn,{children:[l.jsx(yn,{children:"确认删除"}),l.jsxs(bn,{children:['确定要删除组成员 "',t||"(空)",'" 吗?此操作无法撤销。']})]}),l.jsxs(vn,{children:[l.jsx(Sn,{children:"取消"}),l.jsx(wn,{onClick:()=>i(e,n),children:"删除"})]})]})]})]})}function khe({config:t,onChange:e}){const n=()=>{e({...t,learning_list:[...t.learning_list,["","enable","enable","1.0"]]})},r=m=>{e({...t,learning_list:t.learning_list.filter((g,x)=>x!==m)})},s=(m,g,x)=>{const y=[...t.learning_list];y[m][g]=x,e({...t,learning_list:y})},i=({rule:m})=>{const g=`["${m[0]}", "${m[1]}", "${m[2]}", "${m[3]}"]`;return l.jsxs(ul,{children:[l.jsx(dl,{asChild:!0,children:l.jsxs(de,{variant:"outline",size:"sm",children:[l.jsx(oa,{className:"h-4 w-4 mr-1"}),"预览"]})}),l.jsx(Ea,{className:"w-96",children:l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),l.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:g}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})},a=()=>{e({...t,expression_groups:[...t.expression_groups,[]]})},o=m=>{e({...t,expression_groups:t.expression_groups.filter((g,x)=>x!==m)})},c=m=>{const g=[...t.expression_groups];g[m]=[...g[m],""],e({...t,expression_groups:g})},h=(m,g)=>{const x=[...t.expression_groups];x[m]=x[m].filter((y,w)=>w!==g),e({...t,expression_groups:x})},f=(m,g,x)=>{const y=[...t.expression_groups];y[m][g]=x,e({...t,expression_groups:y})};return l.jsxs("div",{className:"space-y-6",children:[l.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center justify-between mb-4",children:[l.jsxs("div",{children:[l.jsx("h3",{className:"text-lg font-semibold",children:"表达学习配置"}),l.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"配置麦麦如何学习和使用表达方式"})]}),l.jsxs(de,{onClick:n,size:"sm",variant:"outline",children:[l.jsx(ws,{className:"h-4 w-4 mr-1"}),"添加规则"]})]}),l.jsxs("div",{className:"space-y-4",children:[t.learning_list.map((m,g)=>{const x=t.learning_list.some((C,T)=>T!==g&&C[0]===""),y=m[0]==="",w=m[0].split(":"),S=w[0]||"qq",k=w[1]||"",N=w[2]||"group";return l.jsxs("div",{className:"rounded-lg border p-4 space-y-4",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("span",{className:"text-sm font-medium",children:["规则 ",g+1," ",y&&"(全局配置)"]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(i,{rule:m}),l.jsxs(Nn,{children:[l.jsx(Qr,{asChild:!0,children:l.jsx(de,{size:"sm",variant:"ghost",children:l.jsx(fn,{className:"h-4 w-4"})})}),l.jsxs(gn,{children:[l.jsxs(xn,{children:[l.jsx(yn,{children:"确认删除"}),l.jsxs(bn,{children:["确定要删除学习规则 ",g+1," 吗?此操作无法撤销。"]})]}),l.jsxs(vn,{children:[l.jsx(Sn,{children:"取消"}),l.jsx(wn,{onClick:()=>r(g),children:"删除"})]})]})]})]})]}),l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ue,{className:"text-xs font-medium",children:"配置类型"}),l.jsxs(qt,{value:y?"global":"specific",onValueChange:C=>{C==="global"?s(g,0,""):s(g,0,"qq::group")},disabled:x&&!y,children:[l.jsx(It,{children:l.jsx(Ft,{})}),l.jsxs(Bt,{children:[l.jsx(De,{value:"global",children:"全局配置"}),l.jsx(De,{value:"specific",disabled:x&&!y,children:"详细配置"})]})]}),x&&!y&&l.jsx("p",{className:"text-xs text-amber-600",children:"已存在全局配置,无法创建新的全局配置"})]}),!y&&l.jsxs("div",{className:"grid gap-4 p-4 rounded-lg bg-muted/50",children:[l.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ue,{className:"text-xs font-medium",children:"平台"}),l.jsxs(qt,{value:S,onValueChange:C=>{s(g,0,`${C}:${k}:${N}`)},children:[l.jsx(It,{children:l.jsx(Ft,{})}),l.jsxs(Bt,{children:[l.jsx(De,{value:"qq",children:"QQ"}),l.jsx(De,{value:"wx",children:"微信"})]})]})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ue,{className:"text-xs font-medium",children:"群 ID"}),l.jsx(Pe,{value:k,onChange:C=>{s(g,0,`${S}:${C.target.value}:${N}`)},placeholder:"输入群 ID",className:"font-mono text-sm"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ue,{className:"text-xs font-medium",children:"类型"}),l.jsxs(qt,{value:N,onValueChange:C=>{s(g,0,`${S}:${k}:${C}`)},children:[l.jsx(It,{children:l.jsx(Ft,{})}),l.jsxs(Bt,{children:[l.jsx(De,{value:"group",children:"群组(group)"}),l.jsx(De,{value:"private",children:"私聊(private)"})]})]})]})]}),l.jsxs("p",{className:"text-xs text-muted-foreground",children:["当前聊天流 ID:",m[0]||"(未设置)"]})]}),l.jsx("div",{className:"grid gap-2",children:l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{children:[l.jsx(ue,{className:"text-xs font-medium",children:"使用学到的表达"}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"允许麦麦使用从聊天中学到的表达方式"})]}),l.jsx(Pt,{checked:m[1]==="enable",onCheckedChange:C=>s(g,1,C?"enable":"disable")})]})}),l.jsx("div",{className:"grid gap-2",children:l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{children:[l.jsx(ue,{className:"text-xs font-medium",children:"学习表达"}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"允许麦麦从聊天中学习新的表达方式"})]}),l.jsx(Pt,{checked:m[2]==="enable",onCheckedChange:C=>s(g,2,C?"enable":"disable")})]})}),l.jsxs("div",{className:"grid gap-3",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx(ue,{className:"text-xs font-medium",children:"学习强度"}),l.jsx(Pe,{type:"number",step:"0.1",min:"0",max:"5",value:m[3],onChange:C=>{const T=parseFloat(C.target.value);isNaN(T)||s(g,3,Math.max(0,Math.min(5,T)).toFixed(1))},className:"w-20 h-8 text-xs"})]}),l.jsx(V0,{value:[parseFloat(m[3])||1],onValueChange:C=>s(g,3,C[0].toFixed(1)),min:0,max:5,step:.1,className:"w-full"}),l.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[l.jsx("span",{children:"0 (不学习)"}),l.jsx("span",{children:"2.5"}),l.jsx("span",{children:"5.0 (快速学习)"})]}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"影响学习频率,最短学习间隔 = 300/学习强度(秒)"})]})]})]},g)}),t.learning_list.length===0&&l.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无学习规则,点击"添加规则"开始配置'})]})]})}),l.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center justify-between mb-4",children:[l.jsxs("div",{children:[l.jsx("h3",{className:"text-lg font-semibold",children:"表达共享组配置"}),l.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"配置不同聊天流之间如何共享学到的表达方式"})]}),l.jsxs(de,{onClick:a,size:"sm",variant:"outline",children:[l.jsx(ws,{className:"h-4 w-4 mr-1"}),"添加共享组"]})]}),l.jsxs("div",{className:"space-y-4",children:[t.expression_groups.map((m,g)=>{const x=t.learning_list.map(y=>y[0]).filter(y=>y!=="");return l.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("span",{className:"text-sm font-medium",children:["共享组 ",g+1,m.length===1&&m[0]==="*"&&"(全局共享)"]}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx(de,{onClick:()=>c(g),size:"sm",variant:"outline",children:l.jsx(ws,{className:"h-4 w-4"})}),l.jsxs(Nn,{children:[l.jsx(Qr,{asChild:!0,children:l.jsx(de,{size:"sm",variant:"ghost",children:l.jsx(fn,{className:"h-4 w-4"})})}),l.jsxs(gn,{children:[l.jsxs(xn,{children:[l.jsx(yn,{children:"确认删除"}),l.jsxs(bn,{children:["确定要删除共享组 ",g+1," 吗?此操作无法撤销。"]})]}),l.jsxs(vn,{children:[l.jsx(Sn,{children:"取消"}),l.jsx(wn,{onClick:()=>o(g),children:"删除"})]})]})]})]})]}),l.jsx("div",{className:"space-y-2",children:m.map((y,w)=>l.jsx(She,{member:y,groupIndex:g,memberIndex:w,availableChatIds:x,onUpdate:f,onRemove:h},`${g}-${w}`))}),l.jsx("p",{className:"text-xs text-muted-foreground",children:'提示:可以从下拉框选择已配置的聊天流,或手动输入。输入 "*" 启用全局共享'})]},g)}),t.expression_groups.length===0&&l.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无共享组,点击"添加共享组"开始配置'})]})]})})]})}function jhe({emojiConfig:t,memoryConfig:e,toolConfig:n,onEmojiChange:r,onMemoryChange:s,onToolChange:i}){return l.jsxs("div",{className:"space-y-6",children:[l.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:l.jsxs("div",{children:[l.jsx("h3",{className:"text-lg font-semibold mb-4",children:"工具设置"}),l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(Pt,{id:"enable_tool",checked:n.enable_tool,onCheckedChange:a=>i({...n,enable_tool:a})}),l.jsx(ue,{htmlFor:"enable_tool",className:"cursor-pointer",children:"启用工具系统"})]}),l.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"允许麦麦使用各种工具来增强功能"})]})}),l.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:l.jsxs("div",{children:[l.jsx("h3",{className:"text-lg font-semibold mb-4",children:"记忆设置"}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ue,{htmlFor:"max_agent_iterations",children:"记忆思考深度"}),l.jsx(Pe,{id:"max_agent_iterations",type:"number",min:"1",value:e.max_agent_iterations,onChange:a=>s({...e,max_agent_iterations:parseInt(a.target.value)})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"最低为 1(不深入思考)"})]})]})}),l.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:l.jsxs("div",{children:[l.jsx("h3",{className:"text-lg font-semibold mb-4",children:"表情包设置"}),l.jsxs("div",{className:"grid gap-4",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ue,{htmlFor:"emoji_chance",children:"表情包激活概率"}),l.jsx(Pe,{id:"emoji_chance",type:"number",step:"0.1",min:"0",max:"1",value:t.emoji_chance,onChange:a=>r({...t,emoji_chance:parseFloat(a.target.value)})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"范围 0-1,越大越容易发送表情包"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ue,{htmlFor:"max_reg_num",children:"最大注册数量"}),l.jsx(Pe,{id:"max_reg_num",type:"number",min:"1",value:t.max_reg_num,onChange:a=>r({...t,max_reg_num:parseInt(a.target.value)})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦最多可以注册的表情包数量"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ue,{htmlFor:"check_interval",children:"检查间隔(分钟)"}),l.jsx(Pe,{id:"check_interval",type:"number",min:"1",value:t.check_interval,onChange:a=>r({...t,check_interval:parseInt(a.target.value)})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"检查表情包(注册、破损、删除)的时间间隔"})]}),l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(Pt,{id:"do_replace",checked:t.do_replace,onCheckedChange:a=>r({...t,do_replace:a})}),l.jsx(ue,{htmlFor:"do_replace",className:"cursor-pointer",children:"达到最大数量时替换表情包"})]}),l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(Pt,{id:"steal_emoji",checked:t.steal_emoji,onCheckedChange:a=>r({...t,steal_emoji:a})}),l.jsx(ue,{htmlFor:"steal_emoji",className:"cursor-pointer",children:"偷取表情包"})]}),l.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"允许麦麦将看到的表情包据为己有"}),l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(Pt,{id:"content_filtration",checked:t.content_filtration,onCheckedChange:a=>r({...t,content_filtration:a})}),l.jsx(ue,{htmlFor:"content_filtration",className:"cursor-pointer",children:"启用表情包过滤"})]}),t.content_filtration&&l.jsxs("div",{className:"grid gap-2 pl-6 border-l-2 border-primary/20",children:[l.jsx(ue,{htmlFor:"filtration_prompt",children:"过滤要求"}),l.jsx(Pe,{id:"filtration_prompt",value:t.filtration_prompt,onChange:a=>r({...t,filtration_prompt:a.target.value}),placeholder:"符合公序良俗"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"只有符合此要求的表情包才会被保存"})]})]})]})})]})}function Ohe({keywordReactionConfig:t,responsePostProcessConfig:e,chineseTypoConfig:n,responseSplitterConfig:r,onKeywordReactionChange:s,onResponsePostProcessChange:i,onChineseTypoChange:a,onResponseSplitterChange:o}){const c=()=>{s({...t,regex_rules:[...t.regex_rules,{regex:[""],reaction:""}]})},h=T=>{s({...t,regex_rules:t.regex_rules.filter((_,E)=>E!==T)})},f=(T,_,E)=>{const M=[...t.regex_rules];_==="regex"&&typeof E=="string"?M[T]={...M[T],regex:[E]}:_==="reaction"&&typeof E=="string"&&(M[T]={...M[T],reaction:E}),s({...t,regex_rules:M})},m=({regex:T,reaction:_,onRegexChange:E,onReactionChange:M})=>{const[L,P]=b.useState(!1),[I,Q]=b.useState(""),[U,ee]=b.useState(null),[z,H]=b.useState(""),[B,X]=b.useState({}),[J,G]=b.useState(""),R=b.useRef(null),[se,W]=b.useState("build"),F=K=>K.replace(/\(\?P<([^>]+)>/g,"(?<$1>"),V=(K,ie=0)=>{const re=R.current;if(!re)return;const ae=re.selectionStart||0,_e=re.selectionEnd||0,Ue=T.substring(0,ae)+K+T.substring(_e);E(Ue),setTimeout(()=>{const Xe=ae+K.length+ie;re.setSelectionRange(Xe,Xe),re.focus()},0)};b.useEffect(()=>{if(!T||!I){ee(null),X({}),G(_),H("");return}try{const K=F(T),ie=new RegExp(K,"g"),re=I.match(ie);ee(re),H("");const _e=new RegExp(K).exec(I);if(_e&&_e.groups){X(_e.groups);let Ue=_;Object.entries(_e.groups).forEach(([Xe,Ze])=>{Ue=Ue.replace(new RegExp(`\\[${Xe}\\]`,"g"),Ze||"")}),G(Ue)}else X({}),G(_)}catch(K){H(K.message),ee(null),X({}),G(_)}},[T,I,_]);const te=()=>{if(!I||!U||U.length===0)return l.jsx("span",{className:"text-muted-foreground",children:I||"请输入测试文本"});try{const K=F(T),ie=new RegExp(K,"g");let re=0;const ae=[];let _e;for(;(_e=ie.exec(I))!==null;)_e.index>re&&ae.push(l.jsx("span",{children:I.substring(re,_e.index)},`text-${re}`)),ae.push(l.jsx("span",{className:"bg-yellow-200 dark:bg-yellow-900 font-semibold",children:_e[0]},`match-${_e.index}`)),re=_e.index+_e[0].length;return re)",desc:"Python风格命名捕获组",moveCursor:-1},{label:"非捕获组",pattern:"(?:)",desc:"分组但不保存匹配结果",moveCursor:-1}]},{category:"字符类",items:[{label:"字符集",pattern:"[]",desc:"匹配括号内的任意字符",moveCursor:-1},{label:"排除字符",pattern:"[^]",desc:"匹配不在括号内的字符",moveCursor:-1},{label:"范围",pattern:"[a-z]",desc:"匹配a到z的字符"},{label:"中文字符",pattern:"[\\u4e00-\\u9fa5]",desc:"匹配中文汉字"}]},{category:"常用模板",items:[{label:"捕获词语",pattern:"(?P\\S+)",desc:"捕获一个词语"},{label:"捕获句子",pattern:"(?P.+)",desc:"捕获整个句子"},{label:"捕获数字",pattern:"(?P\\d+)",desc:"捕获一个或多个数字"},{label:"可选词语",pattern:"(?:词语1|词语2)",desc:"匹配多个可选项之一"}]}];return l.jsxs(xr,{open:L,onOpenChange:P,children:[l.jsx(Bh,{asChild:!0,children:l.jsxs(de,{variant:"outline",size:"sm",children:[l.jsx(C1,{className:"h-4 w-4 mr-1"}),"正则编辑器"]})}),l.jsxs(lr,{className:"max-w-[95vw] sm:max-w-[900px] max-h-[90vh]",children:[l.jsxs(or,{children:[l.jsx(cr,{children:"正则表达式编辑器"}),l.jsx(Hr,{className:"text-sm",children:"使用可视化工具构建正则表达式,并实时测试效果"})]}),l.jsx(hn,{className:"max-h-[calc(90vh-120px)]",children:l.jsxs(sa,{value:se,onValueChange:K=>W(K),className:"w-full",children:[l.jsxs(Mi,{className:"grid w-full grid-cols-2",children:[l.jsx(zt,{value:"build",children:"🔧 构建器"}),l.jsx(zt,{value:"test",children:"🧪 测试器"})]}),l.jsxs(tn,{value:"build",className:"space-y-4 mt-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{className:"text-sm font-medium",children:"正则表达式"}),l.jsx(Pe,{ref:R,value:T,onChange:K=>E(K.target.value),className:"font-mono text-sm",placeholder:"点击下方按钮构建正则表达式..."})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{className:"text-sm font-medium",children:"Reaction 内容"}),l.jsx(pr,{value:_,onChange:K=>M(K.target.value),placeholder:"使用 [捕获组名] 引用捕获的内容...",rows:3,className:"text-sm"})]}),l.jsxs("div",{className:"space-y-4 border-t pt-4",children:[ne.map(K=>l.jsxs("div",{className:"space-y-2",children:[l.jsx("h5",{className:"text-xs font-semibold text-primary",children:K.category}),l.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:K.items.map(ie=>l.jsx(de,{variant:"outline",size:"sm",className:"justify-start h-auto py-2 px-3",onClick:()=>V(ie.pattern,ie.moveCursor||0),children:l.jsxs("div",{className:"flex flex-col items-start w-full",children:[l.jsxs("div",{className:"flex items-center gap-2 w-full",children:[l.jsx("span",{className:"text-xs font-medium",children:ie.label}),l.jsx("code",{className:"ml-auto text-xs bg-muted px-1.5 py-0.5 rounded font-mono",children:ie.pattern})]}),l.jsx("span",{className:"text-xs text-muted-foreground mt-0.5",children:ie.desc})]})},ie.label))})]},K.category)),l.jsxs("div",{className:"space-y-2 border-t pt-4",children:[l.jsx("h5",{className:"text-xs font-semibold text-primary",children:"完整示例模板"}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(de,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>E("^(?P\\S{1,20})是这样的$"),children:l.jsxs("div",{className:"flex flex-col items-start w-full",children:[l.jsxs("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:["^(?P\\S","{1,20}",")是这样的$"]}),l.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"匹配「某事物是这样的」并捕获事物名称"})]})}),l.jsx(de,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>E("(?:[^,。.\\s]+,\\s*)?我(?:也)?[没沒]要求你\\s*(?P.+?)[.。,,]?$"),children:l.jsxs("div",{className:"flex flex-col items-start w-full",children:[l.jsx("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:"(?:[^,。.\\s]+,\\s*)?我(?:也)?[没沒]要求你\\s*(?P.+?)[.。,,]?$"}),l.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"匹配「我没要求你做某事」并捕获具体行为"})]})}),l.jsx(de,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>E("(?P.+?)(?:是|为什么|怎么)"),children:l.jsxs("div",{className:"flex flex-col items-start w-full",children:[l.jsx("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:"(?P.+?)(?:是|为什么|怎么)"}),l.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"捕获问题主题词"})]})})]})]})]}),l.jsxs("div",{className:"rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3 space-y-1",children:[l.jsx("p",{className:"text-xs font-medium text-blue-900 dark:text-blue-100",children:"💡 使用提示"}),l.jsxs("ul",{className:"text-xs text-blue-700 dark:text-blue-300 space-y-1 list-disc list-inside",children:[l.jsx("li",{children:"点击输入框设置光标位置,然后点击按钮插入模式"}),l.jsxs("li",{children:["命名捕获组格式:",l.jsx("code",{className:"bg-blue-100 dark:bg-blue-900 px-1 rounded",children:"(?P<名称>模式)"})]}),l.jsxs("li",{children:["在 reaction 中使用 ",l.jsx("code",{className:"bg-blue-100 dark:bg-blue-900 px-1 rounded",children:"[名称]"})," 引用捕获的内容"]}),l.jsx("li",{children:"切换到测试器标签页验证正则表达式效果"})]})]})]}),l.jsxs(tn,{value:"test",className:"space-y-4 mt-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{className:"text-sm font-medium",children:"当前正则表达式"}),l.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:T||"(未设置)"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{htmlFor:"test-text",className:"text-sm font-medium",children:"测试文本"}),l.jsx(pr,{id:"test-text",value:I,onChange:K=>Q(K.target.value),placeholder:`在此输入要测试的文本... +例如:打游戏是这样的`,className:"min-h-[100px] text-sm"})]}),z&&l.jsxs("div",{className:"rounded-md bg-destructive/10 border border-destructive/20 p-3",children:[l.jsx("p",{className:"text-sm text-destructive font-medium",children:"正则表达式错误"}),l.jsx("p",{className:"text-xs text-destructive/80 mt-1",children:z})]}),!z&&I&&l.jsxs("div",{className:"space-y-3",children:[l.jsx("div",{className:"flex items-center gap-2",children:U&&U.length>0?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"h-2 w-2 rounded-full bg-green-500"}),l.jsxs("span",{className:"text-sm font-medium text-green-600 dark:text-green-400",children:["匹配成功 (",U.length," 处)"]})]}):l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"h-2 w-2 rounded-full bg-gray-400"}),l.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"无匹配"})]})}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{className:"text-sm font-medium",children:"匹配高亮"}),l.jsx(hn,{className:"h-40 rounded-md bg-muted p-3",children:l.jsx("div",{className:"text-sm break-words",children:te()})})]}),Object.keys(B).length>0&&l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{className:"text-sm font-medium",children:"命名捕获组"}),l.jsx(hn,{className:"h-32 rounded-md border p-3",children:l.jsx("div",{className:"space-y-2",children:Object.entries(B).map(([K,ie])=>l.jsxs("div",{className:"flex items-start gap-2 text-sm",children:[l.jsxs("span",{className:"font-mono font-semibold text-primary min-w-[80px]",children:["[",K,"]"]}),l.jsx("span",{className:"text-muted-foreground",children:"="}),l.jsx("span",{className:"font-mono bg-muted px-2 py-0.5 rounded",children:ie})]},K))})})]}),Object.keys(B).length>0&&_&&l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{className:"text-sm font-medium",children:"Reaction 替换预览"}),l.jsx(hn,{className:"h-48 rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3",children:l.jsx("div",{className:"text-sm break-words",children:J})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"reaction 中的 [name] 已被替换为对应的捕获组值"})]})]}),l.jsxs("div",{className:"rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3 space-y-1",children:[l.jsx("p",{className:"text-xs font-medium text-blue-900 dark:text-blue-100",children:"💡 测试说明"}),l.jsxs("ul",{className:"text-xs text-blue-700 dark:text-blue-300 space-y-1 list-disc list-inside",children:[l.jsx("li",{children:"匹配的文本会以黄色背景高亮显示"}),l.jsx("li",{children:"命名捕获组的值会显示在下方列表中"}),l.jsx("li",{children:"Reaction 替换预览显示最终生成的反应内容"}),l.jsx("li",{children:"如需修改正则,切换回构建器标签页"})]})]})]})]})})]})]})},g=()=>{s({...t,keyword_rules:[...t.keyword_rules,{keywords:[],reaction:""}]})},x=T=>{s({...t,keyword_rules:t.keyword_rules.filter((_,E)=>E!==T)})},y=(T,_,E)=>{const M=[...t.keyword_rules];typeof E=="string"&&(M[T]={...M[T],reaction:E}),s({...t,keyword_rules:M})},w=T=>{const _=[...t.keyword_rules];_[T]={..._[T],keywords:[..._[T].keywords||[],""]},s({...t,keyword_rules:_})},S=(T,_)=>{const E=[...t.keyword_rules];E[T]={...E[T],keywords:(E[T].keywords||[]).filter((M,L)=>L!==_)},s({...t,keyword_rules:E})},k=(T,_,E)=>{const M=[...t.keyword_rules],L=[...M[T].keywords||[]];L[_]=E,M[T]={...M[T],keywords:L},s({...t,keyword_rules:M})},N=({rule:T})=>{const _=`{ regex = [${(T.regex||[]).map(E=>`"${E}"`).join(", ")}], reaction = "${T.reaction}" }`;return l.jsxs(ul,{children:[l.jsx(dl,{asChild:!0,children:l.jsxs(de,{variant:"outline",size:"sm",children:[l.jsx(oa,{className:"h-4 w-4 mr-1"}),"预览"]})}),l.jsx(Ea,{className:"w-[95vw] sm:w-[500px]",children:l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),l.jsx(hn,{className:"h-60 rounded-md bg-muted p-3",children:l.jsx("pre",{className:"font-mono text-xs break-all",children:_})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})},C=({rule:T})=>{const _=`[[keyword_reaction.keyword_rules]] keywords = [${(T.keywords||[]).map(E=>`"${E}"`).join(", ")}] -reaction = "${T.reaction}"`;return l.jsxs(uo,{children:[l.jsx(ho,{asChild:!0,children:l.jsxs(fe,{variant:"outline",size:"sm",children:[l.jsx(aa,{className:"h-4 w-4 mr-1"}),"预览"]})}),l.jsx(ol,{className:"w-[95vw] sm:w-[500px]",children:l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),l.jsx(on,{className:"h-60 rounded-md bg-muted p-3",children:l.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap break-all",children:_})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})};return l.jsxs("div",{className:"space-y-6",children:[l.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[l.jsxs("div",{children:[l.jsx("h3",{className:"text-lg font-semibold mb-2",children:"关键词反应配置"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"配置触发特定反应的关键词和正则表达式规则"})]}),l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{children:[l.jsx("h4",{className:"text-base font-semibold",children:"正则表达式规则"}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"使用正则表达式匹配消息内容"})]}),l.jsxs(fe,{onClick:c,size:"sm",variant:"outline",children:[l.jsx(gs,{className:"h-4 w-4 mr-1"}),"添加正则规则"]})]}),l.jsxs("div",{className:"space-y-3",children:[t.regex_rules.map((T,_)=>l.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("span",{className:"text-sm font-medium",children:["正则规则 ",_+1]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(m,{regex:T.regex&&T.regex[0]||"",reaction:T.reaction,onRegexChange:E=>f(_,"regex",E),onReactionChange:E=>f(_,"reaction",E)}),l.jsx(N,{rule:T}),l.jsxs(wn,{children:[l.jsx(Lr,{asChild:!0,children:l.jsx(fe,{size:"sm",variant:"ghost",children:l.jsx(ln,{className:"h-4 w-4"})})}),l.jsxs(un,{children:[l.jsxs(dn,{children:[l.jsx(fn,{children:"确认删除"}),l.jsxs(mn,{children:["确定要删除正则规则 ",_+1," 吗?此操作无法撤销。"]})]}),l.jsxs(hn,{children:[l.jsx(gn,{children:"取消"}),l.jsx(pn,{onClick:()=>h(_),children:"删除"})]})]})]})]})]}),l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{className:"text-xs font-medium",children:"正则表达式(Python 语法)"}),l.jsx(Pe,{value:T.regex&&T.regex[0]||"",onChange:E=>f(_,"regex",E.target.value),placeholder:"例如:^(?P\\\\S{1,20})是这样的$ (点击正则编辑器按钮可视化构建)",className:"font-mono text-sm"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:'支持命名捕获组 (?Ppattern),可在 reaction 中使用 [name] 引用。点击"正则编辑器"可视化构建和测试!'})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{className:"text-xs font-medium",children:"反应内容"}),l.jsx(dr,{value:T.reaction,onChange:E=>f(_,"reaction",E.target.value),placeholder:`触发后麦麦的反应... -可以使用 [捕获组名] 来引用正则表达式中的内容`,rows:3,className:"text-sm"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"使用 [捕获组名] 引用正则表达式中的命名捕获组,例如 [n] 会被替换为捕获的内容"})]})]})]},_)),t.regex_rules.length===0&&l.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无正则规则,点击"添加正则规则"开始配置'})]})]}),l.jsxs("div",{className:"space-y-4 border-t pt-6",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{children:[l.jsx("h4",{className:"text-base font-semibold",children:"关键词规则"}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"使用关键词列表匹配消息内容"})]}),l.jsxs(fe,{onClick:g,size:"sm",variant:"outline",children:[l.jsx(gs,{className:"h-4 w-4 mr-1"}),"添加关键词规则"]})]}),l.jsxs("div",{className:"space-y-3",children:[t.keyword_rules.map((T,_)=>l.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("span",{className:"text-sm font-medium",children:["关键词规则 ",_+1]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(C,{rule:T}),l.jsxs(wn,{children:[l.jsx(Lr,{asChild:!0,children:l.jsx(fe,{size:"sm",variant:"ghost",children:l.jsx(ln,{className:"h-4 w-4"})})}),l.jsxs(un,{children:[l.jsxs(dn,{children:[l.jsx(fn,{children:"确认删除"}),l.jsxs(mn,{children:["确定要删除关键词规则 ",_+1," 吗?此操作无法撤销。"]})]}),l.jsxs(hn,{children:[l.jsx(gn,{children:"取消"}),l.jsx(pn,{onClick:()=>x(_),children:"删除"})]})]})]})]})]}),l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx(de,{className:"text-xs font-medium",children:"关键词列表"}),l.jsxs(fe,{onClick:()=>w(_),size:"sm",variant:"ghost",children:[l.jsx(gs,{className:"h-3 w-3 mr-1"}),"添加关键词"]})]}),l.jsxs("div",{className:"space-y-2",children:[(T.keywords||[]).map((E,M)=>l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Pe,{value:E,onChange:q=>k(_,M,q.target.value),placeholder:"关键词",className:"flex-1"}),l.jsx(fe,{onClick:()=>S(_,M),size:"sm",variant:"ghost",children:l.jsx(ln,{className:"h-4 w-4"})})]},M)),(!T.keywords||T.keywords.length===0)&&l.jsx("p",{className:"text-xs text-muted-foreground text-center py-2",children:'暂无关键词,点击"添加关键词"开始配置'})]})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{className:"text-xs font-medium",children:"反应内容"}),l.jsx(dr,{value:T.reaction,onChange:E=>y(_,"reaction",E.target.value),placeholder:"触发后麦麦的反应...",rows:3,className:"text-sm"})]})]})]},_)),t.keyword_rules.length===0&&l.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无关键词规则,点击"添加关键词规则"开始配置'})]})]})]}),l.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[l.jsxs("div",{children:[l.jsx("h3",{className:"text-lg font-semibold mb-4",children:"回复后处理配置"}),l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(_t,{id:"enable_response_post_process",checked:e.enable_response_post_process,onCheckedChange:T=>i({...e,enable_response_post_process:T})}),l.jsx(de,{htmlFor:"enable_response_post_process",className:"cursor-pointer",children:"启用回复后处理"})]}),l.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"包括错别字生成器和回复分割器"})]}),e.enable_response_post_process&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"border-t pt-6 space-y-4",children:l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center space-x-2 mb-4",children:[l.jsx(_t,{id:"enable_chinese_typo",checked:n.enable,onCheckedChange:T=>a({...n,enable:T})}),l.jsx(de,{htmlFor:"enable_chinese_typo",className:"cursor-pointer font-semibold",children:"中文错别字生成器"})]}),l.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"为回复添加随机错别字,让麦麦的回复更自然"}),n.enable&&l.jsxs("div",{className:"grid gap-4 pl-6 border-l-2 border-primary/20",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"error_rate",className:"text-xs font-medium",children:"单字替换概率"}),l.jsx(Pe,{id:"error_rate",type:"number",step:"0.001",min:"0",max:"1",value:n.error_rate,onChange:T=>a({...n,error_rate:parseFloat(T.target.value)})})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"min_freq",className:"text-xs font-medium",children:"最小字频阈值"}),l.jsx(Pe,{id:"min_freq",type:"number",min:"0",value:n.min_freq,onChange:T=>a({...n,min_freq:parseInt(T.target.value)})})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"tone_error_rate",className:"text-xs font-medium",children:"声调错误概率"}),l.jsx(Pe,{id:"tone_error_rate",type:"number",step:"0.01",min:"0",max:"1",value:n.tone_error_rate,onChange:T=>a({...n,tone_error_rate:parseFloat(T.target.value)})})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"word_replace_rate",className:"text-xs font-medium",children:"整词替换概率"}),l.jsx(Pe,{id:"word_replace_rate",type:"number",step:"0.001",min:"0",max:"1",value:n.word_replace_rate,onChange:T=>a({...n,word_replace_rate:parseFloat(T.target.value)})})]})]})]})}),l.jsx("div",{className:"border-t pt-6 space-y-4",children:l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center space-x-2 mb-4",children:[l.jsx(_t,{id:"enable_response_splitter",checked:r.enable,onCheckedChange:T=>o({...r,enable:T})}),l.jsx(de,{htmlFor:"enable_response_splitter",className:"cursor-pointer font-semibold",children:"回复分割器"})]}),l.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"控制回复的长度和句子数量"}),r.enable&&l.jsxs("div",{className:"grid gap-4 pl-6 border-l-2 border-primary/20",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"max_length",className:"text-xs font-medium",children:"最大长度"}),l.jsx(Pe,{id:"max_length",type:"number",min:"1",value:r.max_length,onChange:T=>o({...r,max_length:parseInt(T.target.value)})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"回复允许的最大字符数"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"max_sentence_num",className:"text-xs font-medium",children:"最大句子数"}),l.jsx(Pe,{id:"max_sentence_num",type:"number",min:"1",value:r.max_sentence_num,onChange:T=>o({...r,max_sentence_num:parseInt(T.target.value)})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"回复允许的最大句子数量"})]}),l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(_t,{id:"enable_kaomoji_protection",checked:r.enable_kaomoji_protection,onCheckedChange:T=>o({...r,enable_kaomoji_protection:T})}),l.jsx(de,{htmlFor:"enable_kaomoji_protection",className:"cursor-pointer",children:"启用颜文字保护"})]}),l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(_t,{id:"enable_overflow_return_all",checked:r.enable_overflow_return_all,onCheckedChange:T=>o({...r,enable_overflow_return_all:T})}),l.jsx(de,{htmlFor:"enable_overflow_return_all",className:"cursor-pointer",children:"超出时一次性返回全部"})]}),l.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"当句子数量超出限制时,合并后一次性返回所有内容"})]})]})})]})]})]})}function khe({config:t,onChange:e}){return l.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[l.jsx("h3",{className:"text-lg font-semibold",children:"情绪设置"}),l.jsxs("div",{className:"grid gap-4",children:[l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(_t,{checked:t.enable_mood,onCheckedChange:n=>e({...t,enable_mood:n})}),l.jsx(de,{className:"cursor-pointer",children:"启用情绪系统"})]}),t.enable_mood&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{children:"情绪更新阈值"}),l.jsx(Pe,{type:"number",min:"1",value:t.mood_update_threshold,onChange:n=>e({...t,mood_update_threshold:parseInt(n.target.value)})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"越高,更新越慢"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{children:"情感特征"}),l.jsx(dr,{value:t.emotion_style,onChange:n=>e({...t,emotion_style:n.target.value}),placeholder:"影响情绪的变化情况",rows:2})]})]})]})]})}function Ohe({config:t,onChange:e}){return l.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[l.jsx("h3",{className:"text-lg font-semibold",children:"语音设置"}),l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(_t,{checked:t.enable_asr,onCheckedChange:n=>e({...t,enable_asr:n})}),l.jsx(de,{className:"cursor-pointer",children:"启用语音识别"})]}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"启用后麦麦可以识别语音消息,需要配置语音识别模型"})]})}function jhe({config:t,onChange:e}){return l.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[l.jsx("h3",{className:"text-lg font-semibold",children:"LPMM 知识库设置"}),l.jsxs("div",{className:"grid gap-4",children:[l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(_t,{checked:t.enable,onCheckedChange:n=>e({...t,enable:n})}),l.jsx(de,{className:"cursor-pointer",children:"启用 LPMM 知识库"})]}),t.enable&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{children:"LPMM 模式"}),l.jsxs(zt,{value:t.lpmm_mode,onValueChange:n=>e({...t,lpmm_mode:n}),children:[l.jsx(At,{children:l.jsx(Pt,{placeholder:"选择 LPMM 模式"})}),l.jsxs(Rt,{children:[l.jsx(ze,{value:"classic",children:"经典模式"}),l.jsx(ze,{value:"agent",children:"Agent 模式"})]})]})]}),l.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{children:"同义词搜索 TopK"}),l.jsx(Pe,{type:"number",min:"1",value:t.rag_synonym_search_top_k,onChange:n=>e({...t,rag_synonym_search_top_k:parseInt(n.target.value)})})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{children:"同义词阈值"}),l.jsx(Pe,{type:"number",step:"0.1",min:"0",max:"1",value:t.rag_synonym_threshold,onChange:n=>e({...t,rag_synonym_threshold:parseFloat(n.target.value)})})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{children:"实体提取线程数"}),l.jsx(Pe,{type:"number",min:"1",value:t.info_extraction_workers,onChange:n=>e({...t,info_extraction_workers:parseInt(n.target.value)})})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{children:"嵌入向量维度"}),l.jsx(Pe,{type:"number",min:"1",value:t.embedding_dimension,onChange:n=>e({...t,embedding_dimension:parseInt(n.target.value)})})]})]})]})]})]})}function Nhe({config:t,onChange:e}){const[n,r]=b.useState(""),[s,i]=b.useState("WARNING"),a=()=>{n&&!t.suppress_libraries.includes(n)&&(e({...t,suppress_libraries:[...t.suppress_libraries,n]}),r(""))},o=x=>{e({...t,suppress_libraries:t.suppress_libraries.filter(y=>y!==x)})},c=()=>{n&&!t.library_log_levels[n]&&(e({...t,library_log_levels:{...t.library_log_levels,[n]:s}}),r(""),i("WARNING"))},h=x=>{const y={...t.library_log_levels};delete y[x],e({...t,library_log_levels:y})},f=["DEBUG","INFO","WARNING","ERROR","CRITICAL"],m=["FULL","compact","lite"],g=["none","title","full"];return l.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:[l.jsxs("div",{children:[l.jsx("h3",{className:"text-lg font-semibold mb-4",children:"日志配置"}),l.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{children:"日期格式"}),l.jsx(Pe,{value:t.date_style,onChange:x=>e({...t,date_style:x.target.value}),placeholder:"例如: m-d H:i:s"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"m=月, d=日, H=时, i=分, s=秒"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{children:"日志级别样式"}),l.jsxs(zt,{value:t.log_level_style,onValueChange:x=>e({...t,log_level_style:x}),children:[l.jsx(At,{children:l.jsx(Pt,{})}),l.jsx(Rt,{children:m.map(x=>l.jsx(ze,{value:x,children:x},x))})]})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{children:"日志文本颜色"}),l.jsxs(zt,{value:t.color_text,onValueChange:x=>e({...t,color_text:x}),children:[l.jsx(At,{children:l.jsx(Pt,{})}),l.jsx(Rt,{children:g.map(x=>l.jsx(ze,{value:x,children:x},x))})]})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{children:"全局日志级别"}),l.jsxs(zt,{value:t.log_level,onValueChange:x=>e({...t,log_level:x}),children:[l.jsx(At,{children:l.jsx(Pt,{})}),l.jsx(Rt,{children:f.map(x=>l.jsx(ze,{value:x,children:x},x))})]})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{children:"控制台日志级别"}),l.jsxs(zt,{value:t.console_log_level,onValueChange:x=>e({...t,console_log_level:x}),children:[l.jsx(At,{children:l.jsx(Pt,{})}),l.jsx(Rt,{children:f.map(x=>l.jsx(ze,{value:x,children:x},x))})]})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{children:"文件日志级别"}),l.jsxs(zt,{value:t.file_log_level,onValueChange:x=>e({...t,file_log_level:x}),children:[l.jsx(At,{children:l.jsx(Pt,{})}),l.jsx(Rt,{children:f.map(x=>l.jsx(ze,{value:x,children:x},x))})]})]})]})]}),l.jsxs("div",{children:[l.jsx(de,{className:"mb-2 block",children:"完全屏蔽的库"}),l.jsxs("div",{className:"flex gap-2 mb-2",children:[l.jsx(Pe,{value:n,onChange:x=>r(x.target.value),placeholder:"输入库名",className:"flex-1",onKeyDown:x=>{x.key==="Enter"&&(x.preventDefault(),a())}}),l.jsx(fe,{onClick:a,size:"sm",className:"flex-shrink-0",children:l.jsx(gs,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),l.jsx("div",{className:"flex flex-wrap gap-2",children:t.suppress_libraries.map(x=>l.jsxs("div",{className:"flex items-center gap-1 bg-secondary px-3 py-1 rounded-md",children:[l.jsx("span",{className:"text-sm",children:x}),l.jsx(fe,{variant:"ghost",size:"sm",className:"h-5 w-5 p-0",onClick:()=>o(x),children:l.jsx(ln,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]},x))})]}),l.jsxs("div",{children:[l.jsx(de,{className:"mb-2 block",children:"特定库的日志级别"}),l.jsxs("div",{className:"flex gap-2 mb-2",children:[l.jsx(Pe,{value:n,onChange:x=>r(x.target.value),placeholder:"输入库名",className:"flex-1"}),l.jsxs(zt,{value:s,onValueChange:i,children:[l.jsx(At,{className:"w-32",children:l.jsx(Pt,{})}),l.jsx(Rt,{children:f.map(x=>l.jsx(ze,{value:x,children:x},x))})]}),l.jsx(fe,{onClick:c,size:"sm",children:l.jsx(gs,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),l.jsx("div",{className:"space-y-2",children:Object.entries(t.library_log_levels).map(([x,y])=>l.jsxs("div",{className:"flex items-center justify-between bg-secondary px-3 py-2 rounded-md",children:[l.jsx("span",{className:"text-sm font-medium",children:x}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-sm text-muted-foreground",children:y}),l.jsx(fe,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>h(x),children:l.jsx(ln,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]})]},x))})]})]})}function Che({config:t,onChange:e}){return l.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[l.jsx("h3",{className:"text-lg font-semibold",children:"调试配置"}),l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"space-y-0.5",children:[l.jsx(de,{children:"显示 Prompt"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"是否在日志中显示提示词"})]}),l.jsx(_t,{checked:t.show_prompt,onCheckedChange:n=>e({...t,show_prompt:n})})]}),l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"space-y-0.5",children:[l.jsx(de,{children:"显示回复器 Prompt"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示回复器的提示词"})]}),l.jsx(_t,{checked:t.show_replyer_prompt,onCheckedChange:n=>e({...t,show_replyer_prompt:n})})]}),l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"space-y-0.5",children:[l.jsx(de,{children:"显示回复器推理"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示回复器的推理过程"})]}),l.jsx(_t,{checked:t.show_replyer_reasoning,onCheckedChange:n=>e({...t,show_replyer_reasoning:n})})]}),l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"space-y-0.5",children:[l.jsx(de,{children:"显示 Jargon Prompt"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示术语相关的提示词"})]}),l.jsx(_t,{checked:t.show_jargon_prompt,onCheckedChange:n=>e({...t,show_jargon_prompt:n})})]}),l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"space-y-0.5",children:[l.jsx(de,{children:"显示记忆检索 Prompt"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示记忆检索相关的提示词"})]}),l.jsx(_t,{checked:t.show_memory_prompt,onCheckedChange:n=>e({...t,show_memory_prompt:n})})]}),l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"space-y-0.5",children:[l.jsx(de,{children:"显示 Planner Prompt"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示 Planner 的提示词和原始返回结果"})]}),l.jsx(_t,{checked:t.show_planner_prompt,onCheckedChange:n=>e({...t,show_planner_prompt:n})})]}),l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"space-y-0.5",children:[l.jsx(de,{children:"显示 LPMM 相关文段"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示 LPMM 知识库找到的相关文段日志"})]}),l.jsx(_t,{checked:t.show_lpmm_paragraph,onCheckedChange:n=>e({...t,show_lpmm_paragraph:n})})]})]})]})}function The({config:t,onChange:e}){const[n,r]=b.useState(""),s=()=>{n&&!t.auth_token.includes(n)&&(e({...t,auth_token:[...t.auth_token,n]}),r(""))},i=a=>{e({...t,auth_token:t.auth_token.filter((o,c)=>c!==a)})};return l.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[l.jsxs("div",{children:[l.jsx("h3",{className:"text-lg font-semibold mb-4",children:"MaimMessage 服务配置"}),l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"space-y-0.5",children:[l.jsx(de,{children:"启用自定义服务器"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"是否使用自定义的 MaimMessage 服务器"})]}),l.jsx(_t,{checked:t.use_custom,onCheckedChange:a=>e({...t,use_custom:a})})]}),t.use_custom&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{children:"主机地址"}),l.jsx(Pe,{value:t.host,onChange:a=>e({...t,host:a.target.value}),placeholder:"127.0.0.1"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{children:"端口号"}),l.jsx(Pe,{type:"number",value:t.port,onChange:a=>e({...t,port:parseInt(a.target.value)}),placeholder:"8090"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{children:"连接模式"}),l.jsxs(zt,{value:t.mode,onValueChange:a=>e({...t,mode:a}),children:[l.jsx(At,{children:l.jsx(Pt,{})}),l.jsxs(Rt,{children:[l.jsx(ze,{value:"ws",children:"WebSocket (ws)"}),l.jsx(ze,{value:"tcp",children:"TCP"})]})]})]}),l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(_t,{checked:t.use_wss,onCheckedChange:a=>e({...t,use_wss:a}),disabled:t.mode!=="ws"}),l.jsx(de,{children:"使用 WSS 安全连接"})]})]}),t.use_wss&&t.mode==="ws"&&l.jsxs("div",{className:"grid gap-4",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{children:"SSL 证书文件路径"}),l.jsx(Pe,{value:t.cert_file,onChange:a=>e({...t,cert_file:a.target.value}),placeholder:"cert.pem"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{children:"SSL 密钥文件路径"}),l.jsx(Pe,{value:t.key_file,onChange:a=>e({...t,key_file:a.target.value}),placeholder:"key.pem"})]})]})]})]})]}),l.jsxs("div",{children:[l.jsx(de,{className:"mb-2 block",children:"认证令牌"}),l.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"用于 API 验证,为空则不启用验证"}),l.jsxs("div",{className:"flex gap-2 mb-2",children:[l.jsx(Pe,{value:n,onChange:a=>r(a.target.value),placeholder:"输入认证令牌",onKeyDown:a=>{a.key==="Enter"&&(a.preventDefault(),s())}}),l.jsx(fe,{onClick:s,size:"sm",children:l.jsx(gs,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),l.jsx("div",{className:"space-y-2",children:t.auth_token.map((a,o)=>l.jsxs("div",{className:"flex items-center justify-between bg-secondary px-3 py-2 rounded-md",children:[l.jsx("span",{className:"text-sm font-mono",children:a}),l.jsx(fe,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>i(o),children:l.jsx(ln,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]},o))})]})]})}function Ehe({config:t,onChange:e}){return l.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[l.jsx("h3",{className:"text-lg font-semibold",children:"统计信息"}),l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"space-y-0.5",children:[l.jsx(de,{children:"启用统计信息发送"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"发送匿名统计信息,帮助我们了解全球有多少只麦麦在运行"})]}),l.jsx(_t,{checked:t.enable,onCheckedChange:n=>e({...t,enable:n})})]})]})}const Vh=b.forwardRef(({className:t,...e},n)=>l.jsx("div",{className:"relative w-full overflow-auto",children:l.jsx("table",{ref:n,className:ye("w-full caption-bottom text-sm",t),...e})}));Vh.displayName="Table";const Uh=b.forwardRef(({className:t,...e},n)=>l.jsx("thead",{ref:n,className:ye("[&_tr]:border-b",t),...e}));Uh.displayName="TableHeader";const Wh=b.forwardRef(({className:t,...e},n)=>l.jsx("tbody",{ref:n,className:ye("[&_tr:last-child]:border-0",t),...e}));Wh.displayName="TableBody";const _he=b.forwardRef(({className:t,...e},n)=>l.jsx("tfoot",{ref:n,className:ye("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",t),...e}));_he.displayName="TableFooter";const ps=b.forwardRef(({className:t,...e},n)=>l.jsx("tr",{ref:n,className:ye("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",t),...e}));ps.displayName="TableRow";const tn=b.forwardRef(({className:t,...e},n)=>l.jsx("th",{ref:n,className:ye("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...e}));tn.displayName="TableHead";const It=b.forwardRef(({className:t,...e},n)=>l.jsx("td",{ref:n,className:ye("px-4 py-3 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...e}));It.displayName="TableCell";const Mhe=b.forwardRef(({className:t,...e},n)=>l.jsx("caption",{ref:n,className:ye("mt-4 text-sm text-muted-foreground",t),...e}));Mhe.displayName="TableCaption";var zE=1,Ahe=.9,Rhe=.8,Dhe=.17,Uw=.1,Ww=.999,zhe=.9999,Phe=.99,Lhe=/[\\\/_+.#"@\[\(\{&]/,Ihe=/[\\\/_+.#"@\[\(\{&]/g,Bhe=/[\s-]/,cF=/[\s-]/g;function FS(t,e,n,r,s,i,a){if(i===e.length)return s===t.length?zE:Phe;var o=`${s},${i}`;if(a[o]!==void 0)return a[o];for(var c=r.charAt(i),h=n.indexOf(c,s),f=0,m,g,x,y;h>=0;)m=FS(t,e,n,r,h+1,i+1,a),m>f&&(h===s?m*=zE:Lhe.test(t.charAt(h-1))?(m*=Rhe,x=t.slice(s,h-1).match(Ihe),x&&s>0&&(m*=Math.pow(Ww,x.length))):Bhe.test(t.charAt(h-1))?(m*=Ahe,y=t.slice(s,h-1).match(cF),y&&s>0&&(m*=Math.pow(Ww,y.length))):(m*=Dhe,s>0&&(m*=Math.pow(Ww,h-s))),t.charAt(h)!==e.charAt(i)&&(m*=zhe)),(mm&&(m=g*Uw)),m>f&&(f=m),h=n.indexOf(c,h+1);return a[o]=f,f}function PE(t){return t.toLowerCase().replace(cF," ")}function qhe(t,e,n){return t=n&&n.length>0?`${t+" "+n.join(" ")}`:t,FS(t,e,PE(t),PE(e),0,0,{})}var Fhe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Rc=Fhe.reduce((t,e)=>{const n=Vk(`Primitive.${e}`),r=b.forwardRef((s,i)=>{const{asChild:a,...o}=s,c=a?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(c,{...o,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),rm='[cmdk-group=""]',Gw='[cmdk-group-items=""]',$he='[cmdk-group-heading=""]',uF='[cmdk-item=""]',LE=`${uF}:not([aria-disabled="true"])`,$S="cmdk-item-select",Fd="data-value",Qhe=(t,e,n)=>qhe(t,e,n),dF=b.createContext(void 0),np=()=>b.useContext(dF),hF=b.createContext(void 0),cO=()=>b.useContext(hF),fF=b.createContext(void 0),mF=b.forwardRef((t,e)=>{let n=$d(()=>{var G,F;return{search:"",value:(F=(G=t.value)!=null?G:t.defaultValue)!=null?F:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=$d(()=>new Set),s=$d(()=>new Map),i=$d(()=>new Map),a=$d(()=>new Set),o=pF(t),{label:c,children:h,value:f,onValueChange:m,filter:g,shouldFilter:x,loop:y,disablePointerSelection:w=!1,vimBindings:S=!0,...k}=t,N=Ei(),C=Ei(),T=Ei(),_=b.useRef(null),E=efe();zu(()=>{if(f!==void 0){let G=f.trim();n.current.value=G,M.emit()}},[f]),zu(()=>{E(6,ee)},[]);let M=b.useMemo(()=>({subscribe:G=>(a.current.add(G),()=>a.current.delete(G)),snapshot:()=>n.current,setState:(G,F,U)=>{var te,ne,Y,ae;if(!Object.is(n.current[G],F)){if(n.current[G]=F,G==="search")V(),I(),E(1,$);else if(G==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let re=document.getElementById(T);re?re.focus():(te=document.getElementById(N))==null||te.focus()}if(E(7,()=>{var re;n.current.selectedItemId=(re=z())==null?void 0:re.id,M.emit()}),U||E(5,ee),((ne=o.current)==null?void 0:ne.value)!==void 0){let re=F??"";(ae=(Y=o.current).onValueChange)==null||ae.call(Y,re);return}}M.emit()}},emit:()=>{a.current.forEach(G=>G())}}),[]),q=b.useMemo(()=>({value:(G,F,U)=>{var te;F!==((te=i.current.get(G))==null?void 0:te.value)&&(i.current.set(G,{value:F,keywords:U}),n.current.filtered.items.set(G,L(F,U)),E(2,()=>{I(),M.emit()}))},item:(G,F)=>(r.current.add(G),F&&(s.current.has(F)?s.current.get(F).add(G):s.current.set(F,new Set([G]))),E(3,()=>{V(),I(),n.current.value||$(),M.emit()}),()=>{i.current.delete(G),r.current.delete(G),n.current.filtered.items.delete(G);let U=z();E(4,()=>{V(),U?.getAttribute("id")===G&&$(),M.emit()})}),group:G=>(s.current.has(G)||s.current.set(G,new Set),()=>{i.current.delete(G),s.current.delete(G)}),filter:()=>o.current.shouldFilter,label:c||t["aria-label"],getDisablePointerSelection:()=>o.current.disablePointerSelection,listId:N,inputId:T,labelId:C,listInnerRef:_}),[]);function L(G,F){var U,te;let ne=(te=(U=o.current)==null?void 0:U.filter)!=null?te:Qhe;return G?ne(G,n.current.search,F):0}function I(){if(!n.current.search||o.current.shouldFilter===!1)return;let G=n.current.filtered.items,F=[];n.current.filtered.groups.forEach(te=>{let ne=s.current.get(te),Y=0;ne.forEach(ae=>{let re=G.get(ae);Y=Math.max(re,Y)}),F.push([te,Y])});let U=_.current;H().sort((te,ne)=>{var Y,ae;let re=te.getAttribute("id"),le=ne.getAttribute("id");return((Y=G.get(le))!=null?Y:0)-((ae=G.get(re))!=null?ae:0)}).forEach(te=>{let ne=te.closest(Gw);ne?ne.appendChild(te.parentElement===ne?te:te.closest(`${Gw} > *`)):U.appendChild(te.parentElement===U?te:te.closest(`${Gw} > *`))}),F.sort((te,ne)=>ne[1]-te[1]).forEach(te=>{var ne;let Y=(ne=_.current)==null?void 0:ne.querySelector(`${rm}[${Fd}="${encodeURIComponent(te[0])}"]`);Y?.parentElement.appendChild(Y)})}function $(){let G=H().find(U=>U.getAttribute("aria-disabled")!=="true"),F=G?.getAttribute(Fd);M.setState("value",F||void 0)}function V(){var G,F,U,te;if(!n.current.search||o.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let ne=0;for(let Y of r.current){let ae=(F=(G=i.current.get(Y))==null?void 0:G.value)!=null?F:"",re=(te=(U=i.current.get(Y))==null?void 0:U.keywords)!=null?te:[],le=L(ae,re);n.current.filtered.items.set(Y,le),le>0&&ne++}for(let[Y,ae]of s.current)for(let re of ae)if(n.current.filtered.items.get(re)>0){n.current.filtered.groups.add(Y);break}n.current.filtered.count=ne}function ee(){var G,F,U;let te=z();te&&(((G=te.parentElement)==null?void 0:G.firstChild)===te&&((U=(F=te.closest(rm))==null?void 0:F.querySelector($he))==null||U.scrollIntoView({block:"nearest"})),te.scrollIntoView({block:"nearest"}))}function z(){var G;return(G=_.current)==null?void 0:G.querySelector(`${uF}[aria-selected="true"]`)}function H(){var G;return Array.from(((G=_.current)==null?void 0:G.querySelectorAll(LE))||[])}function P(G){let F=H()[G];F&&M.setState("value",F.getAttribute(Fd))}function W(G){var F;let U=z(),te=H(),ne=te.findIndex(ae=>ae===U),Y=te[ne+G];(F=o.current)!=null&&F.loop&&(Y=ne+G<0?te[te.length-1]:ne+G===te.length?te[0]:te[ne+G]),Y&&M.setState("value",Y.getAttribute(Fd))}function J(G){let F=z(),U=F?.closest(rm),te;for(;U&&!te;)U=G>0?Zhe(U,rm):Jhe(U,rm),te=U?.querySelector(LE);te?M.setState("value",te.getAttribute(Fd)):W(G)}let X=()=>P(H().length-1),R=G=>{G.preventDefault(),G.metaKey?X():G.altKey?J(1):W(1)},se=G=>{G.preventDefault(),G.metaKey?P(0):G.altKey?J(-1):W(-1)};return b.createElement(Rc.div,{ref:e,tabIndex:-1,...k,"cmdk-root":"",onKeyDown:G=>{var F;(F=k.onKeyDown)==null||F.call(k,G);let U=G.nativeEvent.isComposing||G.keyCode===229;if(!(G.defaultPrevented||U))switch(G.key){case"n":case"j":{S&&G.ctrlKey&&R(G);break}case"ArrowDown":{R(G);break}case"p":case"k":{S&&G.ctrlKey&&se(G);break}case"ArrowUp":{se(G);break}case"Home":{G.preventDefault(),P(0);break}case"End":{G.preventDefault(),X();break}case"Enter":{G.preventDefault();let te=z();if(te){let ne=new Event($S);te.dispatchEvent(ne)}}}}},b.createElement("label",{"cmdk-label":"",htmlFor:q.inputId,id:q.labelId,style:nfe},c),oy(t,G=>b.createElement(hF.Provider,{value:M},b.createElement(dF.Provider,{value:q},G))))}),Hhe=b.forwardRef((t,e)=>{var n,r;let s=Ei(),i=b.useRef(null),a=b.useContext(fF),o=np(),c=pF(t),h=(r=(n=c.current)==null?void 0:n.forceMount)!=null?r:a?.forceMount;zu(()=>{if(!h)return o.item(s,a?.id)},[h]);let f=gF(s,i,[t.value,t.children,i],t.keywords),m=cO(),g=kc(E=>E.value&&E.value===f.current),x=kc(E=>h||o.filter()===!1?!0:E.search?E.filtered.items.get(s)>0:!0);b.useEffect(()=>{let E=i.current;if(!(!E||t.disabled))return E.addEventListener($S,y),()=>E.removeEventListener($S,y)},[x,t.onSelect,t.disabled]);function y(){var E,M;w(),(M=(E=c.current).onSelect)==null||M.call(E,f.current)}function w(){m.setState("value",f.current,!0)}if(!x)return null;let{disabled:S,value:k,onSelect:N,forceMount:C,keywords:T,..._}=t;return b.createElement(Rc.div,{ref:gc(i,e),..._,id:s,"cmdk-item":"",role:"option","aria-disabled":!!S,"aria-selected":!!g,"data-disabled":!!S,"data-selected":!!g,onPointerMove:S||o.getDisablePointerSelection()?void 0:w,onClick:S?void 0:y},t.children)}),Vhe=b.forwardRef((t,e)=>{let{heading:n,children:r,forceMount:s,...i}=t,a=Ei(),o=b.useRef(null),c=b.useRef(null),h=Ei(),f=np(),m=kc(x=>s||f.filter()===!1?!0:x.search?x.filtered.groups.has(a):!0);zu(()=>f.group(a),[]),gF(a,o,[t.value,t.heading,c]);let g=b.useMemo(()=>({id:a,forceMount:s}),[s]);return b.createElement(Rc.div,{ref:gc(o,e),...i,"cmdk-group":"",role:"presentation",hidden:m?void 0:!0},n&&b.createElement("div",{ref:c,"cmdk-group-heading":"","aria-hidden":!0,id:h},n),oy(t,x=>b.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?h:void 0},b.createElement(fF.Provider,{value:g},x))))}),Uhe=b.forwardRef((t,e)=>{let{alwaysRender:n,...r}=t,s=b.useRef(null),i=kc(a=>!a.search);return!n&&!i?null:b.createElement(Rc.div,{ref:gc(s,e),...r,"cmdk-separator":"",role:"separator"})}),Whe=b.forwardRef((t,e)=>{let{onValueChange:n,...r}=t,s=t.value!=null,i=cO(),a=kc(h=>h.search),o=kc(h=>h.selectedItemId),c=np();return b.useEffect(()=>{t.value!=null&&i.setState("search",t.value)},[t.value]),b.createElement(Rc.input,{ref:e,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":o,id:c.inputId,type:"text",value:s?t.value:a,onChange:h=>{s||i.setState("search",h.target.value),n?.(h.target.value)}})}),Ghe=b.forwardRef((t,e)=>{let{children:n,label:r="Suggestions",...s}=t,i=b.useRef(null),a=b.useRef(null),o=kc(h=>h.selectedItemId),c=np();return b.useEffect(()=>{if(a.current&&i.current){let h=a.current,f=i.current,m,g=new ResizeObserver(()=>{m=requestAnimationFrame(()=>{let x=h.offsetHeight;f.style.setProperty("--cmdk-list-height",x.toFixed(1)+"px")})});return g.observe(h),()=>{cancelAnimationFrame(m),g.unobserve(h)}}},[]),b.createElement(Rc.div,{ref:gc(i,e),...s,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":o,"aria-label":r,id:c.listId},oy(t,h=>b.createElement("div",{ref:gc(a,c.listInnerRef),"cmdk-list-sizer":""},h)))}),Xhe=b.forwardRef((t,e)=>{let{open:n,onOpenChange:r,overlayClassName:s,contentClassName:i,container:a,...o}=t;return b.createElement(Xk,{open:n,onOpenChange:r},b.createElement(Uk,{container:a},b.createElement(Nv,{"cmdk-overlay":"",className:s}),b.createElement(Cv,{"aria-label":t.label,"cmdk-dialog":"",className:i},b.createElement(mF,{ref:e,...o}))))}),Yhe=b.forwardRef((t,e)=>kc(n=>n.filtered.count===0)?b.createElement(Rc.div,{ref:e,...t,"cmdk-empty":"",role:"presentation"}):null),Khe=b.forwardRef((t,e)=>{let{progress:n,children:r,label:s="Loading...",...i}=t;return b.createElement(Rc.div,{ref:e,...i,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":s},oy(t,a=>b.createElement("div",{"aria-hidden":!0},a)))}),oi=Object.assign(mF,{List:Ghe,Item:Hhe,Input:Whe,Group:Vhe,Separator:Uhe,Dialog:Xhe,Empty:Yhe,Loading:Khe});function Zhe(t,e){let n=t.nextElementSibling;for(;n;){if(n.matches(e))return n;n=n.nextElementSibling}}function Jhe(t,e){let n=t.previousElementSibling;for(;n;){if(n.matches(e))return n;n=n.previousElementSibling}}function pF(t){let e=b.useRef(t);return zu(()=>{e.current=t}),e}var zu=typeof window>"u"?b.useEffect:b.useLayoutEffect;function $d(t){let e=b.useRef();return e.current===void 0&&(e.current=t()),e}function kc(t){let e=cO(),n=()=>t(e.snapshot());return b.useSyncExternalStore(e.subscribe,n,n)}function gF(t,e,n,r=[]){let s=b.useRef(),i=np();return zu(()=>{var a;let o=(()=>{var h;for(let f of n){if(typeof f=="string")return f.trim();if(typeof f=="object"&&"current"in f)return f.current?(h=f.current.textContent)==null?void 0:h.trim():s.current}})(),c=r.map(h=>h.trim());i.value(t,o,c),(a=e.current)==null||a.setAttribute(Fd,o),s.current=o}),s}var efe=()=>{let[t,e]=b.useState(),n=$d(()=>new Map);return zu(()=>{n.current.forEach(r=>r()),n.current=new Map},[t]),(r,s)=>{n.current.set(r,s),e({})}};function tfe(t){let e=t.type;return typeof e=="function"?e(t.props):"render"in e?e.render(t.props):t}function oy({asChild:t,children:e},n){return t&&b.isValidElement(e)?b.cloneElement(tfe(e),{ref:e.ref},n(e.props.children)):n(e)}var nfe={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const uO=b.forwardRef(({className:t,...e},n)=>l.jsx(oi,{ref:n,className:ye("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",t),...e}));uO.displayName=oi.displayName;const dO=b.forwardRef(({className:t,...e},n)=>l.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[l.jsx(li,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),l.jsx(oi.Input,{ref:n,className:ye("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",t),...e})]}));dO.displayName=oi.Input.displayName;const hO=b.forwardRef(({className:t,...e},n)=>l.jsx(oi.List,{ref:n,className:ye("max-h-[300px] overflow-y-auto overflow-x-hidden",t),...e}));hO.displayName=oi.List.displayName;const fO=b.forwardRef((t,e)=>l.jsx(oi.Empty,{ref:e,className:"py-6 text-center text-sm",...t}));fO.displayName=oi.Empty.displayName;const mO=b.forwardRef(({className:t,...e},n)=>l.jsx(oi.Group,{ref:n,className:ye("overflow-hidden p-1 text-foreground [&_[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",t),...e}));mO.displayName=oi.Group.displayName;const rfe=b.forwardRef(({className:t,...e},n)=>l.jsx(oi.Separator,{ref:n,className:ye("-mx-1 h-px bg-border",t),...e}));rfe.displayName=oi.Separator.displayName;const pO=b.forwardRef(({className:t,...e},n)=>l.jsx(oi.Item,{ref:n,className:ye("relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",t),...e}));pO.displayName=oi.Item.displayName;const ii=b.forwardRef(({className:t,...e},n)=>l.jsx(ZD,{ref:n,className:ye("grid place-content-center peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",t),...e,children:l.jsx(SK,{className:ye("grid place-content-center text-current"),children:l.jsx(so,{className:"h-4 w-4"})})}));ii.displayName=ZD.displayName;const bx=[{id:"siliconflow",name:"SiliconFlow",base_url:"https://api.siliconflow.cn/v1",client_type:"openai",display_name:"硅基流动 (SiliconFlow)"},{id:"deepseek",name:"DeepSeek",base_url:"https://api.deepseek.com",client_type:"openai",display_name:"DeepSeek"},{id:"rinkoai",name:"RinkoAI",base_url:"https://rinkoai.com/v1",client_type:"openai",display_name:"RinkoAI"},{id:"zhipu",name:"ZhipuAI",base_url:"https://open.bigmodel.cn/api/paas/v4",client_type:"openai",display_name:"智谱 AI (ZhipuAI / GLM)"},{id:"moonshot",name:"Moonshot",base_url:"https://api.moonshot.cn/v1",client_type:"openai",display_name:"月之暗面 (Moonshot / Kimi)"},{id:"doubao",name:"Doubao",base_url:"https://ark.cn-beijing.volces.com/api/v3",client_type:"openai",display_name:"字节豆包 (Doubao)"},{id:"alibaba",name:"Alibaba",base_url:"https://dashscope.aliyuncs.com/compatible-mode/v1",client_type:"openai",display_name:"阿里云百炼 (Alibaba Qwen)"},{id:"baichuan",name:"Baichuan",base_url:"https://api.baichuan-ai.com/v1",client_type:"openai",display_name:"百川智能 (Baichuan)"},{id:"minimax",name:"MiniMax",base_url:"https://api.minimax.chat/v1",client_type:"openai",display_name:"MiniMax (海螺 AI)"},{id:"stepfun",name:"StepFun",base_url:"https://api.stepfun.com/v1",client_type:"openai",display_name:"阶跃星辰 (StepFun)"},{id:"lingyi",name:"Lingyi",base_url:"https://api.lingyiwanwu.com/v1",client_type:"openai",display_name:"零一万物 (Lingyi / Yi)"},{id:"openai",name:"OpenAI",base_url:"https://api.openai.com/v1",client_type:"openai",display_name:"OpenAI"},{id:"xai",name:"xAI",base_url:"https://api.x.ai/v1",client_type:"openai",display_name:"xAI (Grok)"},{id:"anthropic",name:"Anthropic",base_url:"https://api.anthropic.com/v1",client_type:"openai",display_name:"Anthropic (Claude)"},{id:"gemini",name:"Gemini",base_url:"https://generativelanguage.googleapis.com/v1beta",client_type:"gemini",display_name:"Google Gemini"},{id:"cohere",name:"Cohere",base_url:"https://api.cohere.ai/v1",client_type:"openai",display_name:"Cohere"},{id:"groq",name:"Groq",base_url:"https://api.groq.com/openai/v1",client_type:"openai",display_name:"Groq"},{id:"together",name:"Together AI",base_url:"https://api.together.xyz/v1",client_type:"openai",display_name:"Together AI"},{id:"fireworks",name:"Fireworks",base_url:"https://api.fireworks.ai/inference/v1",client_type:"openai",display_name:"Fireworks AI"},{id:"mistral",name:"Mistral",base_url:"https://api.mistral.ai/v1",client_type:"openai",display_name:"Mistral AI"},{id:"perplexity",name:"Perplexity",base_url:"https://api.perplexity.ai",client_type:"openai",display_name:"Perplexity AI"},{id:"custom",name:"",base_url:"",client_type:"openai",display_name:"自定义"}];function sfe(){const[t,e]=b.useState([]),[n,r]=b.useState(!0),[s,i]=b.useState(!1),[a,o]=b.useState(!1),[c,h]=b.useState(!1),[f,m]=b.useState(!1),[g,x]=b.useState(!1),[y,w]=b.useState(!1),[S,k]=b.useState(null),[N,C]=b.useState(null),[T,_]=b.useState("custom"),[E,M]=b.useState(!1),[q,L]=b.useState(!1),[I,$]=b.useState(null),[V,ee]=b.useState(!1),[z,H]=b.useState(""),[P,W]=b.useState(new Set),[J,X]=b.useState(!1),[R,se]=b.useState(1),[G,F]=b.useState(20),[U,te]=b.useState(""),{toast:ne}=Gr(),Y=b.useRef(null),ae=b.useRef(!0);b.useEffect(()=>{re()},[]);const re=async()=>{try{r(!0);const Ne=await Jd();e(Ne.api_providers||[]),h(!1),ae.current=!1}catch(Ne){console.error("加载配置失败:",Ne)}finally{r(!1)}},le=async()=>{try{m(!0),Hv().catch(()=>{}),x(!0)}catch(Ne){console.error("重启失败:",Ne),x(!1),ne({title:"重启失败",description:"无法发送重启请求,请手动重启",variant:"destructive"}),m(!1)}},_e=async()=>{try{i(!0),Y.current&&clearTimeout(Y.current);const Ne=await Jd();Ne.api_providers=t,await M1(Ne),h(!1),ne({title:"保存成功",description:"正在重启麦麦..."}),await le()}catch(Ne){console.error("保存配置失败:",Ne),ne({title:"保存失败",description:Ne.message,variant:"destructive"}),i(!1)}},Ge=()=>{localStorage.removeItem("access-token"),window.location.href="/auth"},tt=()=>{x(!1),m(!1),ne({title:"重启超时",description:"服务未能在预期时间内恢复,请手动检查或刷新页面",variant:"destructive"})},Xe=b.useCallback(async Ne=>{if(!ae.current)try{o(!0),await Q3("api_providers",Ne),h(!1)}catch(ie){console.error("自动保存失败:",ie),h(!0)}finally{o(!1)}},[]);b.useEffect(()=>{if(!ae.current)return h(!0),Y.current&&clearTimeout(Y.current),Y.current=setTimeout(()=>{Xe(t)},2e3),()=>{Y.current&&clearTimeout(Y.current)}},[t,Xe]);const je=async()=>{try{i(!0),Y.current&&clearTimeout(Y.current);const Ne=await Jd();Ne.api_providers=t,await M1(Ne),h(!1),ne({title:"保存成功",description:"模型提供商配置已保存"})}catch(Ne){console.error("保存配置失败:",Ne),ne({title:"保存失败",description:Ne.message,variant:"destructive"})}finally{i(!1)}},Qe=(Ne,ie)=>{if(Ne){const xe=bx.find(Je=>Je.base_url===Ne.base_url&&Je.client_type===Ne.client_type);_(xe?.id||"custom"),k(Ne)}else _("custom"),k({name:"",base_url:"",api_key:"",client_type:"openai",max_retry:2,timeout:30,retry_interval:10});C(ie),ee(!1),w(!0)},He=Ne=>{_(Ne),M(!1);const ie=bx.find(xe=>xe.id===Ne);ie&&ie.id!=="custom"?k(xe=>({...xe,name:ie.name,base_url:ie.base_url,client_type:ie.client_type})):ie?.id==="custom"&&k(xe=>({...xe,name:"",base_url:"",client_type:"openai"}))},$e=b.useMemo(()=>T!=="custom",[T]),bt=async()=>{if(S?.api_key)try{await navigator.clipboard.writeText(S.api_key),ne({title:"复制成功",description:"API Key 已复制到剪贴板"})}catch{ne({title:"复制失败",description:"无法访问剪贴板",variant:"destructive"})}},lt=()=>{if(!S)return;const Ne={...S,max_retry:S.max_retry??2,timeout:S.timeout??30,retry_interval:S.retry_interval??10};if(N!==null){const ie=[...t];ie[N]=Ne,e(ie)}else e([...t,Ne]);w(!1),k(null),C(null)},xn=Ne=>{if(!Ne&&S){const ie={...S,max_retry:S.max_retry??2,timeout:S.timeout??30,retry_interval:S.retry_interval??10};k(ie)}w(Ne)},_n=Ne=>{$(Ne),L(!0)},Cn=()=>{if(I!==null){const Ne=t.filter((ie,xe)=>xe!==I);e(Ne),ne({title:"删除成功",description:"提供商已从列表中移除"})}L(!1),$(null)},Dt=Ne=>{const ie=new Set(P);ie.has(Ne)?ie.delete(Ne):ie.add(Ne),W(ie)},xt=()=>{if(P.size===qe.length)W(new Set);else{const Ne=qe.map((ie,xe)=>t.findIndex(Je=>Je===qe[xe]));W(new Set(Ne))}},Te=()=>{if(P.size===0){ne({title:"提示",description:"请先选择要删除的提供商",variant:"default"});return}X(!0)},Re=()=>{const Ne=t.filter((ie,xe)=>!P.has(xe));e(Ne),W(new Set),X(!1),ne({title:"批量删除成功",description:`已删除 ${P.size} 个提供商`})},qe=t.filter(Ne=>{if(!z)return!0;const ie=z.toLowerCase();return Ne.name.toLowerCase().includes(ie)||Ne.base_url.toLowerCase().includes(ie)||Ne.client_type.toLowerCase().includes(ie)}),rt=Math.ceil(qe.length/G),wt=qe.slice((R-1)*G,R*G),jt=()=>{const Ne=parseInt(U);Ne>=1&&Ne<=rt&&(se(Ne),te(""))};return n?l.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:l.jsx("div",{className:"flex items-center justify-center h-64",children:l.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})}):l.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[l.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[l.jsxs("div",{children:[l.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"AI模型厂商配置"}),l.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理 AI 模型厂商的 API 配置"})]}),l.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[P.size>0&&l.jsxs(fe,{onClick:Te,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[l.jsx(ln,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"批量删除 (",P.size,")"]}),l.jsxs(fe,{onClick:()=>Qe(null,null),size:"sm",className:"w-full sm:w-auto",children:[l.jsx(gs,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"添加提供商"]}),l.jsxs(fe,{onClick:je,disabled:s||a||!c||f,size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[l.jsx(Rv,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),s?"保存中...":a?"自动保存中...":c?"保存配置":"已保存"]}),l.jsxs(wn,{children:[l.jsx(Lr,{asChild:!0,children:l.jsxs(fe,{disabled:s||a||f,size:"sm",className:"w-full sm:w-auto",children:[l.jsx(e6,{className:"mr-2 h-4 w-4"}),f?"重启中...":c?"保存并重启":"重启麦麦"]})}),l.jsxs(un,{children:[l.jsxs(dn,{children:[l.jsx(fn,{children:"确认重启麦麦?"}),l.jsx(mn,{className:"space-y-3",asChild:!0,children:l.jsxs("div",{children:[l.jsx("p",{children:c?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"}),l.jsxs(il,{className:"border-yellow-500/50 bg-yellow-500/10",children:[l.jsx(Oa,{className:"h-4 w-4 text-yellow-600"}),l.jsxs(al,{className:"text-yellow-900 dark:text-yellow-100",children:[l.jsx("strong",{children:"重要提示:"}),"由于技术原因,使用重启功能后,将无法再使用 ",l.jsx("code",{className:"px-1 py-0.5 bg-yellow-200 dark:bg-yellow-900 rounded",children:"Ctrl+C"})," 结束程序。",l.jsxs(fr,{children:[l.jsx(Bh,{asChild:!0,children:l.jsxs("button",{className:"ml-1 text-yellow-700 dark:text-yellow-300 underline hover:text-yellow-800 dark:hover:text-yellow-200 inline-flex items-center gap-1",children:[l.jsx(Av,{className:"h-3 w-3"}),"如何结束程序?"]})}),l.jsxs(rr,{className:"max-w-2xl",children:[l.jsxs(sr,{children:[l.jsx(ir,{children:"如何结束使用重启功能后的麦麦程序"}),l.jsx(Ir,{children:"由于重启功能会使程序脱离终端控制,需要通过系统命令来结束进程"})]}),l.jsxs(na,{defaultValue:"windows",className:"w-full",children:[l.jsxs(_i,{className:"grid w-full grid-cols-3",children:[l.jsx(Et,{value:"windows",children:"Windows"}),l.jsx(Et,{value:"macos",children:"macOS"}),l.jsx(Et,{value:"linux",children:"Linux"})]}),l.jsxs(Kt,{value:"windows",className:"space-y-4 mt-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"font-semibold",children:"方法一:使用任务管理器"}),l.jsxs("ol",{className:"list-decimal list-inside space-y-1 text-sm text-muted-foreground",children:[l.jsxs("li",{children:["按 ",l.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"Ctrl + Shift + Esc"})," 打开任务管理器"]}),l.jsxs("li",{children:["在“进程”或“详细信息”标签页中找到 ",l.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"python.exe"})]}),l.jsx("li",{children:"右键点击并选择“结束任务”"})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"font-semibold",children:"方法二:使用命令行"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"打开 PowerShell 或命令提示符,执行以下命令:"}),l.jsxs("div",{className:"bg-muted p-3 rounded-md font-mono text-sm",children:[l.jsx("p",{children:"# 查找麦麦进程"}),l.jsx("p",{children:'Get-Process python | Where-Object {$_.MainWindowTitle -eq ""}'}),l.jsx("p",{className:"mt-2",children:"# 结束所有 Python 进程(谨慎使用)"}),l.jsx("p",{children:"Stop-Process -Name python -Force"})]})]})]}),l.jsxs(Kt,{value:"macos",className:"space-y-4 mt-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"font-semibold",children:"方法一:使用活动监视器"}),l.jsxs("ol",{className:"list-decimal list-inside space-y-1 text-sm text-muted-foreground",children:[l.jsxs("li",{children:["按 ",l.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"Cmd + Space"})," 打开 Spotlight,搜索“活动监视器”"]}),l.jsxs("li",{children:["在进程列表中找到 ",l.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"Python"})]}),l.jsx("li",{children:"选中后点击左上角的 X 按钮结束进程"})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"font-semibold",children:"方法二:使用终端"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"打开终端,执行以下命令:"}),l.jsxs("div",{className:"bg-muted p-3 rounded-md font-mono text-sm",children:[l.jsx("p",{children:"# 查找麦麦进程"}),l.jsx("p",{children:"ps aux | grep python | grep -v grep"}),l.jsx("p",{className:"mt-2",children:"# 结束指定 PID 的进程"}),l.jsx("p",{children:"kill -9 "}),l.jsx("p",{className:"mt-2",children:"# 或结束所有 Python 进程(谨慎使用)"}),l.jsx("p",{children:"pkill -9 python"})]})]})]}),l.jsxs(Kt,{value:"linux",className:"space-y-4 mt-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"font-semibold",children:"使用终端命令"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"打开终端,执行以下命令:"}),l.jsxs("div",{className:"bg-muted p-3 rounded-md font-mono text-sm",children:[l.jsx("p",{children:"# 查找麦麦进程"}),l.jsx("p",{children:"ps aux | grep python | grep -v grep"}),l.jsx("p",{className:"mt-2",children:"# 结束指定 PID 的进程"}),l.jsx("p",{children:"kill -9 "}),l.jsx("p",{className:"mt-2",children:"# 或使用 pkill 按名称结束"}),l.jsx("p",{children:'pkill -9 -f "bot.py"'}),l.jsx("p",{className:"mt-2",children:"# 或结束所有 Python 进程(谨慎使用)"}),l.jsx("p",{children:"pkill -9 python"})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"font-semibold",children:"使用 htop(如已安装)"}),l.jsxs("ol",{className:"list-decimal list-inside space-y-1 text-sm text-muted-foreground",children:[l.jsxs("li",{children:["在终端输入 ",l.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"htop"})]}),l.jsxs("li",{children:["按 ",l.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"F3"})," 搜索 python"]}),l.jsxs("li",{children:["按 ",l.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"F9"})," 发送信号,选择 SIGKILL"]})]})]})]})]}),l.jsx(ts,{children:l.jsx(g6,{asChild:!0,children:l.jsx(fe,{variant:"outline",children:"关闭"})})})]})]})]})]})]})})]}),l.jsxs(hn,{children:[l.jsx(gn,{children:"取消"}),l.jsx(pn,{onClick:c?_e:le,children:c?"保存并重启":"确认重启"})]})]})]})]})]}),l.jsxs(il,{children:[l.jsx(Oa,{className:"h-4 w-4"}),l.jsxs(al,{children:["配置更新后需要",l.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),l.jsxs(on,{className:"h-[calc(100vh-260px)]",children:[l.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-2 mb-4",children:[l.jsxs("div",{className:"relative w-full sm:flex-1 sm:max-w-sm",children:[l.jsx(li,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),l.jsx(Pe,{placeholder:"搜索提供商名称、URL 或类型...",value:z,onChange:Ne=>H(Ne.target.value),className:"pl-9"})]}),z&&l.jsxs("p",{className:"text-sm text-muted-foreground whitespace-nowrap",children:["找到 ",qe.length," 个结果"]})]}),l.jsx("div",{className:"md:hidden space-y-3",children:qe.length===0?l.jsx("div",{className:"text-center text-muted-foreground py-8 rounded-lg border bg-card",children:z?"未找到匹配的提供商":'暂无提供商配置,点击"添加提供商"开始配置'}):wt.map((Ne,ie)=>{const xe=t.findIndex(Je=>Je===Ne);return l.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[l.jsxs("div",{className:"flex items-start justify-between gap-2",children:[l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("h3",{className:"font-semibold text-base truncate",children:Ne.name}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1 break-all",children:Ne.base_url})]}),l.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[l.jsxs(fe,{variant:"default",size:"sm",onClick:()=>Qe(Ne,xe),children:[l.jsx(fh,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),l.jsxs(fe,{size:"sm",onClick:()=>_n(xe),className:"bg-red-600 hover:bg-red-700 text-white",children:[l.jsx(ln,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})]}),l.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[l.jsxs("div",{children:[l.jsx("span",{className:"text-muted-foreground text-xs",children:"客户端类型"}),l.jsx("p",{className:"font-medium",children:Ne.client_type})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-muted-foreground text-xs",children:"最大重试"}),l.jsx("p",{className:"font-medium",children:Ne.max_retry})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-muted-foreground text-xs",children:"超时(秒)"}),l.jsx("p",{className:"font-medium",children:Ne.timeout})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-muted-foreground text-xs",children:"重试间隔(秒)"}),l.jsx("p",{className:"font-medium",children:Ne.retry_interval})]})]})]},ie)})}),l.jsx("div",{className:"hidden md:block rounded-lg border bg-card overflow-hidden",children:l.jsx("div",{className:"overflow-x-auto",children:l.jsxs(Vh,{children:[l.jsx(Uh,{children:l.jsxs(ps,{children:[l.jsx(tn,{className:"w-12",children:l.jsx(ii,{checked:P.size===qe.length&&qe.length>0,onCheckedChange:xt})}),l.jsx(tn,{children:"名称"}),l.jsx(tn,{children:"基础URL"}),l.jsx(tn,{children:"客户端类型"}),l.jsx(tn,{className:"text-right",children:"最大重试"}),l.jsx(tn,{className:"text-right",children:"超时(秒)"}),l.jsx(tn,{className:"text-right",children:"重试间隔(秒)"}),l.jsx(tn,{className:"text-right",children:"操作"})]})}),l.jsx(Wh,{children:wt.length===0?l.jsx(ps,{children:l.jsx(It,{colSpan:8,className:"text-center text-muted-foreground py-8",children:z?"未找到匹配的提供商":'暂无提供商配置,点击"添加提供商"开始配置'})}):wt.map((Ne,ie)=>{const xe=t.findIndex(Je=>Je===Ne);return l.jsxs(ps,{children:[l.jsx(It,{children:l.jsx(ii,{checked:P.has(xe),onCheckedChange:()=>Dt(xe)})}),l.jsx(It,{className:"font-medium",children:Ne.name}),l.jsx(It,{className:"max-w-xs truncate",title:Ne.base_url,children:Ne.base_url}),l.jsx(It,{children:Ne.client_type}),l.jsx(It,{className:"text-right",children:Ne.max_retry}),l.jsx(It,{className:"text-right",children:Ne.timeout}),l.jsx(It,{className:"text-right",children:Ne.retry_interval}),l.jsx(It,{className:"text-right",children:l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsxs(fe,{variant:"default",size:"sm",onClick:()=>Qe(Ne,xe),children:[l.jsx(fh,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),l.jsxs(fe,{size:"sm",onClick:()=>_n(xe),className:"bg-red-600 hover:bg-red-700 text-white",children:[l.jsx(ln,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})})]},ie)})})]})})}),qe.length>0&&l.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(de,{htmlFor:"page-size-provider",className:"text-sm whitespace-nowrap",children:"每页显示"}),l.jsxs(zt,{value:G.toString(),onValueChange:Ne=>{F(parseInt(Ne)),se(1),W(new Set)},children:[l.jsx(At,{id:"page-size-provider",className:"w-20",children:l.jsx(Pt,{})}),l.jsxs(Rt,{children:[l.jsx(ze,{value:"10",children:"10"}),l.jsx(ze,{value:"20",children:"20"}),l.jsx(ze,{value:"50",children:"50"}),l.jsx(ze,{value:"100",children:"100"})]})]}),l.jsxs("span",{className:"text-sm text-muted-foreground",children:["显示 ",(R-1)*G+1," 到"," ",Math.min(R*G,qe.length)," 条,共 ",qe.length," 条"]})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(fe,{variant:"outline",size:"sm",onClick:()=>se(1),disabled:R===1,className:"hidden sm:flex",children:l.jsx(D0,{className:"h-4 w-4"})}),l.jsxs(fe,{variant:"outline",size:"sm",onClick:()=>se(Ne=>Math.max(1,Ne-1)),disabled:R===1,children:[l.jsx(qu,{className:"h-4 w-4 sm:mr-1"}),l.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Pe,{type:"number",value:U,onChange:Ne=>te(Ne.target.value),onKeyDown:Ne=>Ne.key==="Enter"&&jt(),placeholder:R.toString(),className:"w-16 h-8 text-center",min:1,max:rt}),l.jsx(fe,{variant:"outline",size:"sm",onClick:jt,disabled:!U,className:"h-8",children:"跳转"})]}),l.jsxs(fe,{variant:"outline",size:"sm",onClick:()=>se(Ne=>Ne+1),disabled:R>=rt,children:[l.jsx("span",{className:"hidden sm:inline",children:"下一页"}),l.jsx(Fu,{className:"h-4 w-4 sm:ml-1"})]}),l.jsx(fe,{variant:"outline",size:"sm",onClick:()=>se(rt),disabled:R>=rt,className:"hidden sm:flex",children:l.jsx(z0,{className:"h-4 w-4"})})]})]})]}),l.jsx(fr,{open:y,onOpenChange:xn,children:l.jsxs(rr,{className:"max-w-[95vw] sm:max-w-2xl max-h-[90vh] overflow-y-auto",children:[l.jsxs(sr,{children:[l.jsx(ir,{children:N!==null?"编辑提供商":"添加提供商"}),l.jsx(Ir,{children:"配置 API 提供商的连接信息和参数"})]}),l.jsxs("div",{className:"grid gap-4 py-4",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"template",children:"提供商模板"}),l.jsxs(uo,{open:E,onOpenChange:M,children:[l.jsx(ho,{asChild:!0,children:l.jsxs(fe,{variant:"outline",role:"combobox","aria-expanded":E,className:"w-full justify-between",children:[T?bx.find(Ne=>Ne.id===T)?.display_name:"选择提供商模板...",l.jsx(iz,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),l.jsx(ol,{className:"p-0",align:"start",style:{width:"var(--radix-popover-trigger-width)"},children:l.jsxs(uO,{children:[l.jsx(dO,{placeholder:"搜索提供商模板..."}),l.jsx(on,{className:"h-[300px]",children:l.jsxs(hO,{className:"max-h-none overflow-visible",children:[l.jsx(fO,{children:"未找到匹配的模板"}),l.jsx(mO,{children:bx.map(Ne=>l.jsxs(pO,{value:Ne.display_name,onSelect:()=>He(Ne.id),children:[l.jsx(so,{className:`mr-2 h-4 w-4 ${T===Ne.id?"opacity-100":"opacity-0"}`}),Ne.display_name]},Ne.id))})]})})]})})]}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"选择预设模板可自动填充 URL 和客户端类型,支持搜索"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"name",children:"名称 *"}),l.jsx(Pe,{id:"name",value:S?.name||"",onChange:Ne=>k(ie=>ie?{...ie,name:Ne.target.value}:null),placeholder:"例如: DeepSeek, SiliconFlow"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"base_url",children:"基础 URL *"}),l.jsx(Pe,{id:"base_url",value:S?.base_url||"",onChange:Ne=>k(ie=>ie?{...ie,base_url:Ne.target.value}:null),placeholder:"https://api.example.com/v1",disabled:$e,className:$e?"bg-muted cursor-not-allowed":""}),$e&&l.jsx("p",{className:"text-xs text-muted-foreground",children:'使用模板时 URL 不可编辑,切换到"自定义"以手动配置'})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"api_key",children:"API Key *"}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx(Pe,{id:"api_key",type:V?"text":"password",value:S?.api_key||"",onChange:Ne=>k(ie=>ie?{...ie,api_key:Ne.target.value}:null),placeholder:"sk-...",className:"flex-1"}),l.jsx(fe,{type:"button",variant:"outline",size:"icon",onClick:()=>ee(!V),title:V?"隐藏密钥":"显示密钥",children:V?l.jsx(O1,{className:"h-4 w-4"}):l.jsx(aa,{className:"h-4 w-4"})}),l.jsx(fe,{type:"button",variant:"outline",size:"icon",onClick:bt,title:"复制密钥",children:l.jsx(k1,{className:"h-4 w-4"})})]})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"client_type",children:"客户端类型"}),l.jsxs(zt,{value:S?.client_type||"openai",onValueChange:Ne=>k(ie=>ie?{...ie,client_type:Ne}:null),disabled:$e,children:[l.jsx(At,{id:"client_type",className:$e?"bg-muted cursor-not-allowed":"",children:l.jsx(Pt,{placeholder:"选择客户端类型"})}),l.jsxs(Rt,{children:[l.jsx(ze,{value:"openai",children:"OpenAI"}),l.jsx(ze,{value:"gemini",children:"Gemini"})]})]}),$e&&l.jsx("p",{className:"text-xs text-muted-foreground",children:'使用模板时客户端类型不可编辑,切换到"自定义"以手动配置'})]}),l.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"max_retry",children:"最大重试"}),l.jsx(Pe,{id:"max_retry",type:"number",min:"0",value:S?.max_retry??"",onChange:Ne=>{const ie=Ne.target.value===""?null:parseInt(Ne.target.value);k(xe=>xe?{...xe,max_retry:ie}:null)},placeholder:"默认: 2"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"timeout",children:"超时(秒)"}),l.jsx(Pe,{id:"timeout",type:"number",min:"1",value:S?.timeout??"",onChange:Ne=>{const ie=Ne.target.value===""?null:parseInt(Ne.target.value);k(xe=>xe?{...xe,timeout:ie}:null)},placeholder:"默认: 30"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"retry_interval",children:"重试间隔(秒)"}),l.jsx(Pe,{id:"retry_interval",type:"number",min:"1",value:S?.retry_interval??"",onChange:Ne=>{const ie=Ne.target.value===""?null:parseInt(Ne.target.value);k(xe=>xe?{...xe,retry_interval:ie}:null)},placeholder:"默认: 10"})]})]})]}),l.jsxs(ts,{children:[l.jsx(fe,{variant:"outline",onClick:()=>w(!1),children:"取消"}),l.jsx(fe,{onClick:lt,children:"保存"})]})]})}),l.jsx(wn,{open:q,onOpenChange:L,children:l.jsxs(un,{children:[l.jsxs(dn,{children:[l.jsx(fn,{children:"确认删除"}),l.jsxs(mn,{children:['确定要删除提供商 "',I!==null?t[I]?.name:"",'" 吗? 此操作无法撤销。']})]}),l.jsxs(hn,{children:[l.jsx(gn,{children:"取消"}),l.jsx(pn,{onClick:Cn,children:"删除"})]})]})}),l.jsx(wn,{open:J,onOpenChange:X,children:l.jsxs(un,{children:[l.jsxs(dn,{children:[l.jsx(fn,{children:"确认批量删除"}),l.jsxs(mn,{children:["确定要删除选中的 ",P.size," 个提供商吗? 此操作无法撤销。"]})]}),l.jsxs(hn,{children:[l.jsx(gn,{children:"取消"}),l.jsx(pn,{onClick:Re,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})}),g&&l.jsx(y6,{onRestartComplete:Ge,onRestartFailed:tt})]})}function ife(){for(var t=arguments.length,e=new Array(t),n=0;nr=>{e.forEach(s=>s(r))},e)}const cy=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Gh(t){const e=Object.prototype.toString.call(t);return e==="[object Window]"||e==="[object global]"}function gO(t){return"nodeType"in t}function ci(t){var e,n;return t?Gh(t)?t:gO(t)&&(e=(n=t.ownerDocument)==null?void 0:n.defaultView)!=null?e:window:window}function xO(t){const{Document:e}=ci(t);return t instanceof e}function rp(t){return Gh(t)?!1:t instanceof ci(t).HTMLElement}function xF(t){return t instanceof ci(t).SVGElement}function Xh(t){return t?Gh(t)?t.document:gO(t)?xO(t)?t:rp(t)||xF(t)?t.ownerDocument:document:document:document}const ul=cy?b.useLayoutEffect:b.useEffect;function vO(t){const e=b.useRef(t);return ul(()=>{e.current=t}),b.useCallback(function(){for(var n=arguments.length,r=new Array(n),s=0;s{t.current=setInterval(r,s)},[]),n=b.useCallback(()=>{t.current!==null&&(clearInterval(t.current),t.current=null)},[]);return[e,n]}function h0(t,e){e===void 0&&(e=[t]);const n=b.useRef(t);return ul(()=>{n.current!==t&&(n.current=t)},e),n}function sp(t,e){const n=b.useRef();return b.useMemo(()=>{const r=t(n.current);return n.current=r,r},[...e])}function ev(t){const e=vO(t),n=b.useRef(null),r=b.useCallback(s=>{s!==n.current&&e?.(s,n.current),n.current=s},[]);return[n,r]}function QS(t){const e=b.useRef();return b.useEffect(()=>{e.current=t},[t]),e.current}let Xw={};function ip(t,e){return b.useMemo(()=>{if(e)return e;const n=Xw[t]==null?0:Xw[t]+1;return Xw[t]=n,t+"-"+n},[t,e])}function vF(t){return function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s{const o=Object.entries(a);for(const[c,h]of o){const f=i[c];f!=null&&(i[c]=f+t*h)}return i},{...e})}}const ah=vF(1),f0=vF(-1);function lfe(t){return"clientX"in t&&"clientY"in t}function yO(t){if(!t)return!1;const{KeyboardEvent:e}=ci(t.target);return e&&t instanceof e}function ofe(t){if(!t)return!1;const{TouchEvent:e}=ci(t.target);return e&&t instanceof e}function HS(t){if(ofe(t)){if(t.touches&&t.touches.length){const{clientX:e,clientY:n}=t.touches[0];return{x:e,y:n}}else if(t.changedTouches&&t.changedTouches.length){const{clientX:e,clientY:n}=t.changedTouches[0];return{x:e,y:n}}}return lfe(t)?{x:t.clientX,y:t.clientY}:null}const m0=Object.freeze({Translate:{toString(t){if(!t)return;const{x:e,y:n}=t;return"translate3d("+(e?Math.round(e):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(t){if(!t)return;const{scaleX:e,scaleY:n}=t;return"scaleX("+e+") scaleY("+n+")"}},Transform:{toString(t){if(t)return[m0.Translate.toString(t),m0.Scale.toString(t)].join(" ")}},Transition:{toString(t){let{property:e,duration:n,easing:r}=t;return e+" "+n+"ms "+r}}}),IE="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function cfe(t){return t.matches(IE)?t:t.querySelector(IE)}const ufe={display:"none"};function dfe(t){let{id:e,value:n}=t;return he.createElement("div",{id:e,style:ufe},n)}function hfe(t){let{id:e,announcement:n,ariaLiveType:r="assertive"}=t;const s={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return he.createElement("div",{id:e,style:s,role:"status","aria-live":r,"aria-atomic":!0},n)}function ffe(){const[t,e]=b.useState("");return{announce:b.useCallback(r=>{r!=null&&e(r)},[]),announcement:t}}const yF=b.createContext(null);function mfe(t){const e=b.useContext(yF);b.useEffect(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of ");return e(t)},[t,e])}function pfe(){const[t]=b.useState(()=>new Set),e=b.useCallback(r=>(t.add(r),()=>t.delete(r)),[t]);return[b.useCallback(r=>{let{type:s,event:i}=r;t.forEach(a=>{var o;return(o=a[s])==null?void 0:o.call(a,i)})},[t]),e]}const gfe={draggable:` +reaction = "${T.reaction}"`;return l.jsxs(ul,{children:[l.jsx(dl,{asChild:!0,children:l.jsxs(de,{variant:"outline",size:"sm",children:[l.jsx(oa,{className:"h-4 w-4 mr-1"}),"预览"]})}),l.jsx(Ea,{className:"w-[95vw] sm:w-[500px]",children:l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),l.jsx(hn,{className:"h-60 rounded-md bg-muted p-3",children:l.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap break-all",children:_})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})};return l.jsxs("div",{className:"space-y-6",children:[l.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[l.jsxs("div",{children:[l.jsx("h3",{className:"text-lg font-semibold mb-2",children:"关键词反应配置"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"配置触发特定反应的关键词和正则表达式规则"})]}),l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{children:[l.jsx("h4",{className:"text-base font-semibold",children:"正则表达式规则"}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"使用正则表达式匹配消息内容"})]}),l.jsxs(de,{onClick:c,size:"sm",variant:"outline",children:[l.jsx(ws,{className:"h-4 w-4 mr-1"}),"添加正则规则"]})]}),l.jsxs("div",{className:"space-y-3",children:[t.regex_rules.map((T,_)=>l.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("span",{className:"text-sm font-medium",children:["正则规则 ",_+1]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(m,{regex:T.regex&&T.regex[0]||"",reaction:T.reaction,onRegexChange:E=>f(_,"regex",E),onReactionChange:E=>f(_,"reaction",E)}),l.jsx(N,{rule:T}),l.jsxs(Nn,{children:[l.jsx(Qr,{asChild:!0,children:l.jsx(de,{size:"sm",variant:"ghost",children:l.jsx(fn,{className:"h-4 w-4"})})}),l.jsxs(gn,{children:[l.jsxs(xn,{children:[l.jsx(yn,{children:"确认删除"}),l.jsxs(bn,{children:["确定要删除正则规则 ",_+1," 吗?此操作无法撤销。"]})]}),l.jsxs(vn,{children:[l.jsx(Sn,{children:"取消"}),l.jsx(wn,{onClick:()=>h(_),children:"删除"})]})]})]})]})]}),l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ue,{className:"text-xs font-medium",children:"正则表达式(Python 语法)"}),l.jsx(Pe,{value:T.regex&&T.regex[0]||"",onChange:E=>f(_,"regex",E.target.value),placeholder:"例如:^(?P\\\\S{1,20})是这样的$ (点击正则编辑器按钮可视化构建)",className:"font-mono text-sm"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:'支持命名捕获组 (?Ppattern),可在 reaction 中使用 [name] 引用。点击"正则编辑器"可视化构建和测试!'})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ue,{className:"text-xs font-medium",children:"反应内容"}),l.jsx(pr,{value:T.reaction,onChange:E=>f(_,"reaction",E.target.value),placeholder:`触发后麦麦的反应... +可以使用 [捕获组名] 来引用正则表达式中的内容`,rows:3,className:"text-sm"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"使用 [捕获组名] 引用正则表达式中的命名捕获组,例如 [n] 会被替换为捕获的内容"})]})]})]},_)),t.regex_rules.length===0&&l.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无正则规则,点击"添加正则规则"开始配置'})]})]}),l.jsxs("div",{className:"space-y-4 border-t pt-6",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{children:[l.jsx("h4",{className:"text-base font-semibold",children:"关键词规则"}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"使用关键词列表匹配消息内容"})]}),l.jsxs(de,{onClick:g,size:"sm",variant:"outline",children:[l.jsx(ws,{className:"h-4 w-4 mr-1"}),"添加关键词规则"]})]}),l.jsxs("div",{className:"space-y-3",children:[t.keyword_rules.map((T,_)=>l.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("span",{className:"text-sm font-medium",children:["关键词规则 ",_+1]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(C,{rule:T}),l.jsxs(Nn,{children:[l.jsx(Qr,{asChild:!0,children:l.jsx(de,{size:"sm",variant:"ghost",children:l.jsx(fn,{className:"h-4 w-4"})})}),l.jsxs(gn,{children:[l.jsxs(xn,{children:[l.jsx(yn,{children:"确认删除"}),l.jsxs(bn,{children:["确定要删除关键词规则 ",_+1," 吗?此操作无法撤销。"]})]}),l.jsxs(vn,{children:[l.jsx(Sn,{children:"取消"}),l.jsx(wn,{onClick:()=>x(_),children:"删除"})]})]})]})]})]}),l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx(ue,{className:"text-xs font-medium",children:"关键词列表"}),l.jsxs(de,{onClick:()=>w(_),size:"sm",variant:"ghost",children:[l.jsx(ws,{className:"h-3 w-3 mr-1"}),"添加关键词"]})]}),l.jsxs("div",{className:"space-y-2",children:[(T.keywords||[]).map((E,M)=>l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Pe,{value:E,onChange:L=>k(_,M,L.target.value),placeholder:"关键词",className:"flex-1"}),l.jsx(de,{onClick:()=>S(_,M),size:"sm",variant:"ghost",children:l.jsx(fn,{className:"h-4 w-4"})})]},M)),(!T.keywords||T.keywords.length===0)&&l.jsx("p",{className:"text-xs text-muted-foreground text-center py-2",children:'暂无关键词,点击"添加关键词"开始配置'})]})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ue,{className:"text-xs font-medium",children:"反应内容"}),l.jsx(pr,{value:T.reaction,onChange:E=>y(_,"reaction",E.target.value),placeholder:"触发后麦麦的反应...",rows:3,className:"text-sm"})]})]})]},_)),t.keyword_rules.length===0&&l.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无关键词规则,点击"添加关键词规则"开始配置'})]})]})]}),l.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[l.jsxs("div",{children:[l.jsx("h3",{className:"text-lg font-semibold mb-4",children:"回复后处理配置"}),l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(Pt,{id:"enable_response_post_process",checked:e.enable_response_post_process,onCheckedChange:T=>i({...e,enable_response_post_process:T})}),l.jsx(ue,{htmlFor:"enable_response_post_process",className:"cursor-pointer",children:"启用回复后处理"})]}),l.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"包括错别字生成器和回复分割器"})]}),e.enable_response_post_process&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"border-t pt-6 space-y-4",children:l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center space-x-2 mb-4",children:[l.jsx(Pt,{id:"enable_chinese_typo",checked:n.enable,onCheckedChange:T=>a({...n,enable:T})}),l.jsx(ue,{htmlFor:"enable_chinese_typo",className:"cursor-pointer font-semibold",children:"中文错别字生成器"})]}),l.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"为回复添加随机错别字,让麦麦的回复更自然"}),n.enable&&l.jsxs("div",{className:"grid gap-4 pl-6 border-l-2 border-primary/20",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ue,{htmlFor:"error_rate",className:"text-xs font-medium",children:"单字替换概率"}),l.jsx(Pe,{id:"error_rate",type:"number",step:"0.001",min:"0",max:"1",value:n.error_rate,onChange:T=>a({...n,error_rate:parseFloat(T.target.value)})})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ue,{htmlFor:"min_freq",className:"text-xs font-medium",children:"最小字频阈值"}),l.jsx(Pe,{id:"min_freq",type:"number",min:"0",value:n.min_freq,onChange:T=>a({...n,min_freq:parseInt(T.target.value)})})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ue,{htmlFor:"tone_error_rate",className:"text-xs font-medium",children:"声调错误概率"}),l.jsx(Pe,{id:"tone_error_rate",type:"number",step:"0.01",min:"0",max:"1",value:n.tone_error_rate,onChange:T=>a({...n,tone_error_rate:parseFloat(T.target.value)})})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ue,{htmlFor:"word_replace_rate",className:"text-xs font-medium",children:"整词替换概率"}),l.jsx(Pe,{id:"word_replace_rate",type:"number",step:"0.001",min:"0",max:"1",value:n.word_replace_rate,onChange:T=>a({...n,word_replace_rate:parseFloat(T.target.value)})})]})]})]})}),l.jsx("div",{className:"border-t pt-6 space-y-4",children:l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center space-x-2 mb-4",children:[l.jsx(Pt,{id:"enable_response_splitter",checked:r.enable,onCheckedChange:T=>o({...r,enable:T})}),l.jsx(ue,{htmlFor:"enable_response_splitter",className:"cursor-pointer font-semibold",children:"回复分割器"})]}),l.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"控制回复的长度和句子数量"}),r.enable&&l.jsxs("div",{className:"grid gap-4 pl-6 border-l-2 border-primary/20",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ue,{htmlFor:"max_length",className:"text-xs font-medium",children:"最大长度"}),l.jsx(Pe,{id:"max_length",type:"number",min:"1",value:r.max_length,onChange:T=>o({...r,max_length:parseInt(T.target.value)})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"回复允许的最大字符数"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ue,{htmlFor:"max_sentence_num",className:"text-xs font-medium",children:"最大句子数"}),l.jsx(Pe,{id:"max_sentence_num",type:"number",min:"1",value:r.max_sentence_num,onChange:T=>o({...r,max_sentence_num:parseInt(T.target.value)})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"回复允许的最大句子数量"})]}),l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(Pt,{id:"enable_kaomoji_protection",checked:r.enable_kaomoji_protection,onCheckedChange:T=>o({...r,enable_kaomoji_protection:T})}),l.jsx(ue,{htmlFor:"enable_kaomoji_protection",className:"cursor-pointer",children:"启用颜文字保护"})]}),l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(Pt,{id:"enable_overflow_return_all",checked:r.enable_overflow_return_all,onCheckedChange:T=>o({...r,enable_overflow_return_all:T})}),l.jsx(ue,{htmlFor:"enable_overflow_return_all",className:"cursor-pointer",children:"超出时一次性返回全部"})]}),l.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"当句子数量超出限制时,合并后一次性返回所有内容"})]})]})})]})]})]})}function Nhe({config:t,onChange:e}){return l.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[l.jsx("h3",{className:"text-lg font-semibold",children:"情绪设置"}),l.jsxs("div",{className:"grid gap-4",children:[l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(Pt,{checked:t.enable_mood,onCheckedChange:n=>e({...t,enable_mood:n})}),l.jsx(ue,{className:"cursor-pointer",children:"启用情绪系统"})]}),t.enable_mood&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ue,{children:"情绪更新阈值"}),l.jsx(Pe,{type:"number",min:"1",value:t.mood_update_threshold,onChange:n=>e({...t,mood_update_threshold:parseInt(n.target.value)})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"越高,更新越慢"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ue,{children:"情感特征"}),l.jsx(pr,{value:t.emotion_style,onChange:n=>e({...t,emotion_style:n.target.value}),placeholder:"影响情绪的变化情况",rows:2})]})]})]})]})}function Che({config:t,onChange:e}){return l.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[l.jsx("h3",{className:"text-lg font-semibold",children:"语音设置"}),l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(Pt,{checked:t.enable_asr,onCheckedChange:n=>e({...t,enable_asr:n})}),l.jsx(ue,{className:"cursor-pointer",children:"启用语音识别"})]}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"启用后麦麦可以识别语音消息,需要配置语音识别模型"})]})}function The({config:t,onChange:e}){return l.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[l.jsx("h3",{className:"text-lg font-semibold",children:"LPMM 知识库设置"}),l.jsxs("div",{className:"grid gap-4",children:[l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(Pt,{checked:t.enable,onCheckedChange:n=>e({...t,enable:n})}),l.jsx(ue,{className:"cursor-pointer",children:"启用 LPMM 知识库"})]}),t.enable&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ue,{children:"LPMM 模式"}),l.jsxs(qt,{value:t.lpmm_mode,onValueChange:n=>e({...t,lpmm_mode:n}),children:[l.jsx(It,{children:l.jsx(Ft,{placeholder:"选择 LPMM 模式"})}),l.jsxs(Bt,{children:[l.jsx(De,{value:"classic",children:"经典模式"}),l.jsx(De,{value:"agent",children:"Agent 模式"})]})]})]}),l.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ue,{children:"同义词搜索 TopK"}),l.jsx(Pe,{type:"number",min:"1",value:t.rag_synonym_search_top_k,onChange:n=>e({...t,rag_synonym_search_top_k:parseInt(n.target.value)})})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ue,{children:"同义词阈值"}),l.jsx(Pe,{type:"number",step:"0.1",min:"0",max:"1",value:t.rag_synonym_threshold,onChange:n=>e({...t,rag_synonym_threshold:parseFloat(n.target.value)})})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ue,{children:"实体提取线程数"}),l.jsx(Pe,{type:"number",min:"1",value:t.info_extraction_workers,onChange:n=>e({...t,info_extraction_workers:parseInt(n.target.value)})})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ue,{children:"嵌入向量维度"}),l.jsx(Pe,{type:"number",min:"1",value:t.embedding_dimension,onChange:n=>e({...t,embedding_dimension:parseInt(n.target.value)})})]})]})]})]})]})}function Ehe({config:t,onChange:e}){const[n,r]=b.useState(""),[s,i]=b.useState("WARNING"),a=()=>{n&&!t.suppress_libraries.includes(n)&&(e({...t,suppress_libraries:[...t.suppress_libraries,n]}),r(""))},o=x=>{e({...t,suppress_libraries:t.suppress_libraries.filter(y=>y!==x)})},c=()=>{n&&!t.library_log_levels[n]&&(e({...t,library_log_levels:{...t.library_log_levels,[n]:s}}),r(""),i("WARNING"))},h=x=>{const y={...t.library_log_levels};delete y[x],e({...t,library_log_levels:y})},f=["DEBUG","INFO","WARNING","ERROR","CRITICAL"],m=["FULL","compact","lite"],g=["none","title","full"];return l.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:[l.jsxs("div",{children:[l.jsx("h3",{className:"text-lg font-semibold mb-4",children:"日志配置"}),l.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ue,{children:"日期格式"}),l.jsx(Pe,{value:t.date_style,onChange:x=>e({...t,date_style:x.target.value}),placeholder:"例如: m-d H:i:s"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"m=月, d=日, H=时, i=分, s=秒"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ue,{children:"日志级别样式"}),l.jsxs(qt,{value:t.log_level_style,onValueChange:x=>e({...t,log_level_style:x}),children:[l.jsx(It,{children:l.jsx(Ft,{})}),l.jsx(Bt,{children:m.map(x=>l.jsx(De,{value:x,children:x},x))})]})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ue,{children:"日志文本颜色"}),l.jsxs(qt,{value:t.color_text,onValueChange:x=>e({...t,color_text:x}),children:[l.jsx(It,{children:l.jsx(Ft,{})}),l.jsx(Bt,{children:g.map(x=>l.jsx(De,{value:x,children:x},x))})]})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ue,{children:"全局日志级别"}),l.jsxs(qt,{value:t.log_level,onValueChange:x=>e({...t,log_level:x}),children:[l.jsx(It,{children:l.jsx(Ft,{})}),l.jsx(Bt,{children:f.map(x=>l.jsx(De,{value:x,children:x},x))})]})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ue,{children:"控制台日志级别"}),l.jsxs(qt,{value:t.console_log_level,onValueChange:x=>e({...t,console_log_level:x}),children:[l.jsx(It,{children:l.jsx(Ft,{})}),l.jsx(Bt,{children:f.map(x=>l.jsx(De,{value:x,children:x},x))})]})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ue,{children:"文件日志级别"}),l.jsxs(qt,{value:t.file_log_level,onValueChange:x=>e({...t,file_log_level:x}),children:[l.jsx(It,{children:l.jsx(Ft,{})}),l.jsx(Bt,{children:f.map(x=>l.jsx(De,{value:x,children:x},x))})]})]})]})]}),l.jsxs("div",{children:[l.jsx(ue,{className:"mb-2 block",children:"完全屏蔽的库"}),l.jsxs("div",{className:"flex gap-2 mb-2",children:[l.jsx(Pe,{value:n,onChange:x=>r(x.target.value),placeholder:"输入库名",className:"flex-1",onKeyDown:x=>{x.key==="Enter"&&(x.preventDefault(),a())}}),l.jsx(de,{onClick:a,size:"sm",className:"flex-shrink-0",children:l.jsx(ws,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),l.jsx("div",{className:"flex flex-wrap gap-2",children:t.suppress_libraries.map(x=>l.jsxs("div",{className:"flex items-center gap-1 bg-secondary px-3 py-1 rounded-md",children:[l.jsx("span",{className:"text-sm",children:x}),l.jsx(de,{variant:"ghost",size:"sm",className:"h-5 w-5 p-0",onClick:()=>o(x),children:l.jsx(fn,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]},x))})]}),l.jsxs("div",{children:[l.jsx(ue,{className:"mb-2 block",children:"特定库的日志级别"}),l.jsxs("div",{className:"flex gap-2 mb-2",children:[l.jsx(Pe,{value:n,onChange:x=>r(x.target.value),placeholder:"输入库名",className:"flex-1"}),l.jsxs(qt,{value:s,onValueChange:i,children:[l.jsx(It,{className:"w-32",children:l.jsx(Ft,{})}),l.jsx(Bt,{children:f.map(x=>l.jsx(De,{value:x,children:x},x))})]}),l.jsx(de,{onClick:c,size:"sm",children:l.jsx(ws,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),l.jsx("div",{className:"space-y-2",children:Object.entries(t.library_log_levels).map(([x,y])=>l.jsxs("div",{className:"flex items-center justify-between bg-secondary px-3 py-2 rounded-md",children:[l.jsx("span",{className:"text-sm font-medium",children:x}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-sm text-muted-foreground",children:y}),l.jsx(de,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>h(x),children:l.jsx(fn,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]})]},x))})]})]})}function _he({config:t,onChange:e}){return l.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[l.jsx("h3",{className:"text-lg font-semibold",children:"调试配置"}),l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"space-y-0.5",children:[l.jsx(ue,{children:"显示 Prompt"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"是否在日志中显示提示词"})]}),l.jsx(Pt,{checked:t.show_prompt,onCheckedChange:n=>e({...t,show_prompt:n})})]}),l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"space-y-0.5",children:[l.jsx(ue,{children:"显示回复器 Prompt"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示回复器的提示词"})]}),l.jsx(Pt,{checked:t.show_replyer_prompt,onCheckedChange:n=>e({...t,show_replyer_prompt:n})})]}),l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"space-y-0.5",children:[l.jsx(ue,{children:"显示回复器推理"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示回复器的推理过程"})]}),l.jsx(Pt,{checked:t.show_replyer_reasoning,onCheckedChange:n=>e({...t,show_replyer_reasoning:n})})]}),l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"space-y-0.5",children:[l.jsx(ue,{children:"显示 Jargon Prompt"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示术语相关的提示词"})]}),l.jsx(Pt,{checked:t.show_jargon_prompt,onCheckedChange:n=>e({...t,show_jargon_prompt:n})})]}),l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"space-y-0.5",children:[l.jsx(ue,{children:"显示记忆检索 Prompt"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示记忆检索相关的提示词"})]}),l.jsx(Pt,{checked:t.show_memory_prompt,onCheckedChange:n=>e({...t,show_memory_prompt:n})})]}),l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"space-y-0.5",children:[l.jsx(ue,{children:"显示 Planner Prompt"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示 Planner 的提示词和原始返回结果"})]}),l.jsx(Pt,{checked:t.show_planner_prompt,onCheckedChange:n=>e({...t,show_planner_prompt:n})})]}),l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"space-y-0.5",children:[l.jsx(ue,{children:"显示 LPMM 相关文段"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示 LPMM 知识库找到的相关文段日志"})]}),l.jsx(Pt,{checked:t.show_lpmm_paragraph,onCheckedChange:n=>e({...t,show_lpmm_paragraph:n})})]})]})]})}function Mhe({config:t,onChange:e}){const[n,r]=b.useState(""),s=()=>{n&&!t.auth_token.includes(n)&&(e({...t,auth_token:[...t.auth_token,n]}),r(""))},i=a=>{e({...t,auth_token:t.auth_token.filter((o,c)=>c!==a)})};return l.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[l.jsxs("div",{children:[l.jsx("h3",{className:"text-lg font-semibold mb-4",children:"MaimMessage 服务配置"}),l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"space-y-0.5",children:[l.jsx(ue,{children:"启用自定义服务器"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"是否使用自定义的 MaimMessage 服务器"})]}),l.jsx(Pt,{checked:t.use_custom,onCheckedChange:a=>e({...t,use_custom:a})})]}),t.use_custom&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ue,{children:"主机地址"}),l.jsx(Pe,{value:t.host,onChange:a=>e({...t,host:a.target.value}),placeholder:"127.0.0.1"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ue,{children:"端口号"}),l.jsx(Pe,{type:"number",value:t.port,onChange:a=>e({...t,port:parseInt(a.target.value)}),placeholder:"8090"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ue,{children:"连接模式"}),l.jsxs(qt,{value:t.mode,onValueChange:a=>e({...t,mode:a}),children:[l.jsx(It,{children:l.jsx(Ft,{})}),l.jsxs(Bt,{children:[l.jsx(De,{value:"ws",children:"WebSocket (ws)"}),l.jsx(De,{value:"tcp",children:"TCP"})]})]})]}),l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(Pt,{checked:t.use_wss,onCheckedChange:a=>e({...t,use_wss:a}),disabled:t.mode!=="ws"}),l.jsx(ue,{children:"使用 WSS 安全连接"})]})]}),t.use_wss&&t.mode==="ws"&&l.jsxs("div",{className:"grid gap-4",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ue,{children:"SSL 证书文件路径"}),l.jsx(Pe,{value:t.cert_file,onChange:a=>e({...t,cert_file:a.target.value}),placeholder:"cert.pem"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ue,{children:"SSL 密钥文件路径"}),l.jsx(Pe,{value:t.key_file,onChange:a=>e({...t,key_file:a.target.value}),placeholder:"key.pem"})]})]})]})]})]}),l.jsxs("div",{children:[l.jsx(ue,{className:"mb-2 block",children:"认证令牌"}),l.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"用于 API 验证,为空则不启用验证"}),l.jsxs("div",{className:"flex gap-2 mb-2",children:[l.jsx(Pe,{value:n,onChange:a=>r(a.target.value),placeholder:"输入认证令牌",onKeyDown:a=>{a.key==="Enter"&&(a.preventDefault(),s())}}),l.jsx(de,{onClick:s,size:"sm",children:l.jsx(ws,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),l.jsx("div",{className:"space-y-2",children:t.auth_token.map((a,o)=>l.jsxs("div",{className:"flex items-center justify-between bg-secondary px-3 py-2 rounded-md",children:[l.jsx("span",{className:"text-sm font-mono",children:a}),l.jsx(de,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>i(o),children:l.jsx(fn,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]},o))})]})]})}function Ahe({config:t,onChange:e}){return l.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[l.jsx("h3",{className:"text-lg font-semibold",children:"统计信息"}),l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"space-y-0.5",children:[l.jsx(ue,{children:"启用统计信息发送"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"发送匿名统计信息,帮助我们了解全球有多少只麦麦在运行"})]}),l.jsx(Pt,{checked:t.enable,onCheckedChange:n=>e({...t,enable:n})})]})]})}const Vh=b.forwardRef(({className:t,...e},n)=>l.jsx("div",{className:"relative w-full overflow-auto",children:l.jsx("table",{ref:n,className:ve("w-full caption-bottom text-sm",t),...e})}));Vh.displayName="Table";const Uh=b.forwardRef(({className:t,...e},n)=>l.jsx("thead",{ref:n,className:ve("[&_tr]:border-b",t),...e}));Uh.displayName="TableHeader";const Wh=b.forwardRef(({className:t,...e},n)=>l.jsx("tbody",{ref:n,className:ve("[&_tr:last-child]:border-0",t),...e}));Wh.displayName="TableBody";const Rhe=b.forwardRef(({className:t,...e},n)=>l.jsx("tfoot",{ref:n,className:ve("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",t),...e}));Rhe.displayName="TableFooter";const bs=b.forwardRef(({className:t,...e},n)=>l.jsx("tr",{ref:n,className:ve("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",t),...e}));bs.displayName="TableRow";const ln=b.forwardRef(({className:t,...e},n)=>l.jsx("th",{ref:n,className:ve("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...e}));ln.displayName="TableHead";const Qt=b.forwardRef(({className:t,...e},n)=>l.jsx("td",{ref:n,className:ve("px-4 py-3 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...e}));Qt.displayName="TableCell";const Dhe=b.forwardRef(({className:t,...e},n)=>l.jsx("caption",{ref:n,className:ve("mt-4 text-sm text-muted-foreground",t),...e}));Dhe.displayName="TableCaption";var PE=1,zhe=.9,Phe=.8,Lhe=.17,Zw=.1,Jw=.999,Ihe=.9999,Bhe=.99,qhe=/[\\\/_+.#"@\[\(\{&]/,Fhe=/[\\\/_+.#"@\[\(\{&]/g,$he=/[\s-]/,dF=/[\s-]/g;function WS(t,e,n,r,s,i,a){if(i===e.length)return s===t.length?PE:Bhe;var o=`${s},${i}`;if(a[o]!==void 0)return a[o];for(var c=r.charAt(i),h=n.indexOf(c,s),f=0,m,g,x,y;h>=0;)m=WS(t,e,n,r,h+1,i+1,a),m>f&&(h===s?m*=PE:qhe.test(t.charAt(h-1))?(m*=Phe,x=t.slice(s,h-1).match(Fhe),x&&s>0&&(m*=Math.pow(Jw,x.length))):$he.test(t.charAt(h-1))?(m*=zhe,y=t.slice(s,h-1).match(dF),y&&s>0&&(m*=Math.pow(Jw,y.length))):(m*=Lhe,s>0&&(m*=Math.pow(Jw,h-s))),t.charAt(h)!==e.charAt(i)&&(m*=Ihe)),(mm&&(m=g*Zw)),m>f&&(f=m),h=n.indexOf(c,h+1);return a[o]=f,f}function LE(t){return t.toLowerCase().replace(dF," ")}function Qhe(t,e,n){return t=n&&n.length>0?`${t+" "+n.join(" ")}`:t,WS(t,e,LE(t),LE(e),0,0,{})}var Hhe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Dc=Hhe.reduce((t,e)=>{const n=Kk(`Primitive.${e}`),r=b.forwardRef((s,i)=>{const{asChild:a,...o}=s,c=a?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(c,{...o,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),rm='[cmdk-group=""]',e4='[cmdk-group-items=""]',Vhe='[cmdk-group-heading=""]',hF='[cmdk-item=""]',IE=`${hF}:not([aria-disabled="true"])`,GS="cmdk-item-select",Qd="data-value",Uhe=(t,e,n)=>Qhe(t,e,n),fF=b.createContext(void 0),ip=()=>b.useContext(fF),mF=b.createContext(void 0),gj=()=>b.useContext(mF),pF=b.createContext(void 0),gF=b.forwardRef((t,e)=>{let n=Hd(()=>{var W,F;return{search:"",value:(F=(W=t.value)!=null?W:t.defaultValue)!=null?F:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=Hd(()=>new Set),s=Hd(()=>new Map),i=Hd(()=>new Map),a=Hd(()=>new Set),o=xF(t),{label:c,children:h,value:f,onValueChange:m,filter:g,shouldFilter:x,loop:y,disablePointerSelection:w=!1,vimBindings:S=!0,...k}=t,N=_i(),C=_i(),T=_i(),_=b.useRef(null),E=rfe();Lu(()=>{if(f!==void 0){let W=f.trim();n.current.value=W,M.emit()}},[f]),Lu(()=>{E(6,ee)},[]);let M=b.useMemo(()=>({subscribe:W=>(a.current.add(W),()=>a.current.delete(W)),snapshot:()=>n.current,setState:(W,F,V)=>{var te,ne,K,ie;if(!Object.is(n.current[W],F)){if(n.current[W]=F,W==="search")U(),I(),E(1,Q);else if(W==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let re=document.getElementById(T);re?re.focus():(te=document.getElementById(N))==null||te.focus()}if(E(7,()=>{var re;n.current.selectedItemId=(re=z())==null?void 0:re.id,M.emit()}),V||E(5,ee),((ne=o.current)==null?void 0:ne.value)!==void 0){let re=F??"";(ie=(K=o.current).onValueChange)==null||ie.call(K,re);return}}M.emit()}},emit:()=>{a.current.forEach(W=>W())}}),[]),L=b.useMemo(()=>({value:(W,F,V)=>{var te;F!==((te=i.current.get(W))==null?void 0:te.value)&&(i.current.set(W,{value:F,keywords:V}),n.current.filtered.items.set(W,P(F,V)),E(2,()=>{I(),M.emit()}))},item:(W,F)=>(r.current.add(W),F&&(s.current.has(F)?s.current.get(F).add(W):s.current.set(F,new Set([W]))),E(3,()=>{U(),I(),n.current.value||Q(),M.emit()}),()=>{i.current.delete(W),r.current.delete(W),n.current.filtered.items.delete(W);let V=z();E(4,()=>{U(),V?.getAttribute("id")===W&&Q(),M.emit()})}),group:W=>(s.current.has(W)||s.current.set(W,new Set),()=>{i.current.delete(W),s.current.delete(W)}),filter:()=>o.current.shouldFilter,label:c||t["aria-label"],getDisablePointerSelection:()=>o.current.disablePointerSelection,listId:N,inputId:T,labelId:C,listInnerRef:_}),[]);function P(W,F){var V,te;let ne=(te=(V=o.current)==null?void 0:V.filter)!=null?te:Uhe;return W?ne(W,n.current.search,F):0}function I(){if(!n.current.search||o.current.shouldFilter===!1)return;let W=n.current.filtered.items,F=[];n.current.filtered.groups.forEach(te=>{let ne=s.current.get(te),K=0;ne.forEach(ie=>{let re=W.get(ie);K=Math.max(re,K)}),F.push([te,K])});let V=_.current;H().sort((te,ne)=>{var K,ie;let re=te.getAttribute("id"),ae=ne.getAttribute("id");return((K=W.get(ae))!=null?K:0)-((ie=W.get(re))!=null?ie:0)}).forEach(te=>{let ne=te.closest(e4);ne?ne.appendChild(te.parentElement===ne?te:te.closest(`${e4} > *`)):V.appendChild(te.parentElement===V?te:te.closest(`${e4} > *`))}),F.sort((te,ne)=>ne[1]-te[1]).forEach(te=>{var ne;let K=(ne=_.current)==null?void 0:ne.querySelector(`${rm}[${Qd}="${encodeURIComponent(te[0])}"]`);K?.parentElement.appendChild(K)})}function Q(){let W=H().find(V=>V.getAttribute("aria-disabled")!=="true"),F=W?.getAttribute(Qd);M.setState("value",F||void 0)}function U(){var W,F,V,te;if(!n.current.search||o.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let ne=0;for(let K of r.current){let ie=(F=(W=i.current.get(K))==null?void 0:W.value)!=null?F:"",re=(te=(V=i.current.get(K))==null?void 0:V.keywords)!=null?te:[],ae=P(ie,re);n.current.filtered.items.set(K,ae),ae>0&&ne++}for(let[K,ie]of s.current)for(let re of ie)if(n.current.filtered.items.get(re)>0){n.current.filtered.groups.add(K);break}n.current.filtered.count=ne}function ee(){var W,F,V;let te=z();te&&(((W=te.parentElement)==null?void 0:W.firstChild)===te&&((V=(F=te.closest(rm))==null?void 0:F.querySelector(Vhe))==null||V.scrollIntoView({block:"nearest"})),te.scrollIntoView({block:"nearest"}))}function z(){var W;return(W=_.current)==null?void 0:W.querySelector(`${hF}[aria-selected="true"]`)}function H(){var W;return Array.from(((W=_.current)==null?void 0:W.querySelectorAll(IE))||[])}function B(W){let F=H()[W];F&&M.setState("value",F.getAttribute(Qd))}function X(W){var F;let V=z(),te=H(),ne=te.findIndex(ie=>ie===V),K=te[ne+W];(F=o.current)!=null&&F.loop&&(K=ne+W<0?te[te.length-1]:ne+W===te.length?te[0]:te[ne+W]),K&&M.setState("value",K.getAttribute(Qd))}function J(W){let F=z(),V=F?.closest(rm),te;for(;V&&!te;)V=W>0?tfe(V,rm):nfe(V,rm),te=V?.querySelector(IE);te?M.setState("value",te.getAttribute(Qd)):X(W)}let G=()=>B(H().length-1),R=W=>{W.preventDefault(),W.metaKey?G():W.altKey?J(1):X(1)},se=W=>{W.preventDefault(),W.metaKey?B(0):W.altKey?J(-1):X(-1)};return b.createElement(Dc.div,{ref:e,tabIndex:-1,...k,"cmdk-root":"",onKeyDown:W=>{var F;(F=k.onKeyDown)==null||F.call(k,W);let V=W.nativeEvent.isComposing||W.keyCode===229;if(!(W.defaultPrevented||V))switch(W.key){case"n":case"j":{S&&W.ctrlKey&&R(W);break}case"ArrowDown":{R(W);break}case"p":case"k":{S&&W.ctrlKey&&se(W);break}case"ArrowUp":{se(W);break}case"Home":{W.preventDefault(),B(0);break}case"End":{W.preventDefault(),G();break}case"Enter":{W.preventDefault();let te=z();if(te){let ne=new Event(GS);te.dispatchEvent(ne)}}}}},b.createElement("label",{"cmdk-label":"",htmlFor:L.inputId,id:L.labelId,style:ife},c),uy(t,W=>b.createElement(mF.Provider,{value:M},b.createElement(fF.Provider,{value:L},W))))}),Whe=b.forwardRef((t,e)=>{var n,r;let s=_i(),i=b.useRef(null),a=b.useContext(pF),o=ip(),c=xF(t),h=(r=(n=c.current)==null?void 0:n.forceMount)!=null?r:a?.forceMount;Lu(()=>{if(!h)return o.item(s,a?.id)},[h]);let f=vF(s,i,[t.value,t.children,i],t.keywords),m=gj(),g=jc(E=>E.value&&E.value===f.current),x=jc(E=>h||o.filter()===!1?!0:E.search?E.filtered.items.get(s)>0:!0);b.useEffect(()=>{let E=i.current;if(!(!E||t.disabled))return E.addEventListener(GS,y),()=>E.removeEventListener(GS,y)},[x,t.onSelect,t.disabled]);function y(){var E,M;w(),(M=(E=c.current).onSelect)==null||M.call(E,f.current)}function w(){m.setState("value",f.current,!0)}if(!x)return null;let{disabled:S,value:k,onSelect:N,forceMount:C,keywords:T,..._}=t;return b.createElement(Dc.div,{ref:gc(i,e),..._,id:s,"cmdk-item":"",role:"option","aria-disabled":!!S,"aria-selected":!!g,"data-disabled":!!S,"data-selected":!!g,onPointerMove:S||o.getDisablePointerSelection()?void 0:w,onClick:S?void 0:y},t.children)}),Ghe=b.forwardRef((t,e)=>{let{heading:n,children:r,forceMount:s,...i}=t,a=_i(),o=b.useRef(null),c=b.useRef(null),h=_i(),f=ip(),m=jc(x=>s||f.filter()===!1?!0:x.search?x.filtered.groups.has(a):!0);Lu(()=>f.group(a),[]),vF(a,o,[t.value,t.heading,c]);let g=b.useMemo(()=>({id:a,forceMount:s}),[s]);return b.createElement(Dc.div,{ref:gc(o,e),...i,"cmdk-group":"",role:"presentation",hidden:m?void 0:!0},n&&b.createElement("div",{ref:c,"cmdk-group-heading":"","aria-hidden":!0,id:h},n),uy(t,x=>b.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?h:void 0},b.createElement(pF.Provider,{value:g},x))))}),Xhe=b.forwardRef((t,e)=>{let{alwaysRender:n,...r}=t,s=b.useRef(null),i=jc(a=>!a.search);return!n&&!i?null:b.createElement(Dc.div,{ref:gc(s,e),...r,"cmdk-separator":"",role:"separator"})}),Yhe=b.forwardRef((t,e)=>{let{onValueChange:n,...r}=t,s=t.value!=null,i=gj(),a=jc(h=>h.search),o=jc(h=>h.selectedItemId),c=ip();return b.useEffect(()=>{t.value!=null&&i.setState("search",t.value)},[t.value]),b.createElement(Dc.input,{ref:e,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":o,id:c.inputId,type:"text",value:s?t.value:a,onChange:h=>{s||i.setState("search",h.target.value),n?.(h.target.value)}})}),Khe=b.forwardRef((t,e)=>{let{children:n,label:r="Suggestions",...s}=t,i=b.useRef(null),a=b.useRef(null),o=jc(h=>h.selectedItemId),c=ip();return b.useEffect(()=>{if(a.current&&i.current){let h=a.current,f=i.current,m,g=new ResizeObserver(()=>{m=requestAnimationFrame(()=>{let x=h.offsetHeight;f.style.setProperty("--cmdk-list-height",x.toFixed(1)+"px")})});return g.observe(h),()=>{cancelAnimationFrame(m),g.unobserve(h)}}},[]),b.createElement(Dc.div,{ref:gc(i,e),...s,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":o,"aria-label":r,id:c.listId},uy(t,h=>b.createElement("div",{ref:gc(a,c.listInnerRef),"cmdk-list-sizer":""},h)))}),Zhe=b.forwardRef((t,e)=>{let{open:n,onOpenChange:r,overlayClassName:s,contentClassName:i,container:a,...o}=t;return b.createElement(t6,{open:n,onOpenChange:r},b.createElement(Zk,{container:a},b.createElement(Tv,{"cmdk-overlay":"",className:s}),b.createElement(Ev,{"aria-label":t.label,"cmdk-dialog":"",className:i},b.createElement(gF,{ref:e,...o}))))}),Jhe=b.forwardRef((t,e)=>jc(n=>n.filtered.count===0)?b.createElement(Dc.div,{ref:e,...t,"cmdk-empty":"",role:"presentation"}):null),efe=b.forwardRef((t,e)=>{let{progress:n,children:r,label:s="Loading...",...i}=t;return b.createElement(Dc.div,{ref:e,...i,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":s},uy(t,a=>b.createElement("div",{"aria-hidden":!0},a)))}),ui=Object.assign(gF,{List:Khe,Item:Whe,Input:Yhe,Group:Ghe,Separator:Xhe,Dialog:Zhe,Empty:Jhe,Loading:efe});function tfe(t,e){let n=t.nextElementSibling;for(;n;){if(n.matches(e))return n;n=n.nextElementSibling}}function nfe(t,e){let n=t.previousElementSibling;for(;n;){if(n.matches(e))return n;n=n.previousElementSibling}}function xF(t){let e=b.useRef(t);return Lu(()=>{e.current=t}),e}var Lu=typeof window>"u"?b.useEffect:b.useLayoutEffect;function Hd(t){let e=b.useRef();return e.current===void 0&&(e.current=t()),e}function jc(t){let e=gj(),n=()=>t(e.snapshot());return b.useSyncExternalStore(e.subscribe,n,n)}function vF(t,e,n,r=[]){let s=b.useRef(),i=ip();return Lu(()=>{var a;let o=(()=>{var h;for(let f of n){if(typeof f=="string")return f.trim();if(typeof f=="object"&&"current"in f)return f.current?(h=f.current.textContent)==null?void 0:h.trim():s.current}})(),c=r.map(h=>h.trim());i.value(t,o,c),(a=e.current)==null||a.setAttribute(Qd,o),s.current=o}),s}var rfe=()=>{let[t,e]=b.useState(),n=Hd(()=>new Map);return Lu(()=>{n.current.forEach(r=>r()),n.current=new Map},[t]),(r,s)=>{n.current.set(r,s),e({})}};function sfe(t){let e=t.type;return typeof e=="function"?e(t.props):"render"in e?e.render(t.props):t}function uy({asChild:t,children:e},n){return t&&b.isValidElement(e)?b.cloneElement(sfe(e),{ref:e.ref},n(e.props.children)):n(e)}var ife={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const dy=b.forwardRef(({className:t,...e},n)=>l.jsx(ui,{ref:n,className:ve("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",t),...e}));dy.displayName=ui.displayName;const hy=b.forwardRef(({className:t,...e},n)=>l.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[l.jsx(ci,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),l.jsx(ui.Input,{ref:n,className:ve("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",t),...e})]}));hy.displayName=ui.Input.displayName;const fy=b.forwardRef(({className:t,...e},n)=>l.jsx(ui.List,{ref:n,className:ve("max-h-[300px] overflow-y-auto overflow-x-hidden",t),...e}));fy.displayName=ui.List.displayName;const my=b.forwardRef((t,e)=>l.jsx(ui.Empty,{ref:e,className:"py-6 text-center text-sm",...t}));my.displayName=ui.Empty.displayName;const f0=b.forwardRef(({className:t,...e},n)=>l.jsx(ui.Group,{ref:n,className:ve("overflow-hidden p-1 text-foreground [&_[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",t),...e}));f0.displayName=ui.Group.displayName;const afe=b.forwardRef(({className:t,...e},n)=>l.jsx(ui.Separator,{ref:n,className:ve("-mx-1 h-px bg-border",t),...e}));afe.displayName=ui.Separator.displayName;const m0=b.forwardRef(({className:t,...e},n)=>l.jsx(ui.Item,{ref:n,className:ve("relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",t),...e}));m0.displayName=ui.Item.displayName;const li=b.forwardRef(({className:t,...e},n)=>l.jsx(tz,{ref:n,className:ve("grid place-content-center peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",t),...e,children:l.jsx(jK,{className:ve("grid place-content-center text-current"),children:l.jsx(ol,{className:"h-4 w-4"})})}));li.displayName=tz.displayName;const vm=[{id:"siliconflow",name:"SiliconFlow",base_url:"https://api.siliconflow.cn/v1",client_type:"openai",display_name:"硅基流动 (SiliconFlow)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"deepseek",name:"DeepSeek",base_url:"https://api.deepseek.com",client_type:"openai",display_name:"DeepSeek",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"rinkoai",name:"RinkoAI",base_url:"https://rinkoai.com/v1",client_type:"openai",display_name:"RinkoAI",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"zhipu",name:"ZhipuAI",base_url:"https://open.bigmodel.cn/api/paas/v4",client_type:"openai",display_name:"智谱 AI (ZhipuAI / GLM)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"moonshot",name:"Moonshot",base_url:"https://api.moonshot.cn/v1",client_type:"openai",display_name:"月之暗面 (Moonshot / Kimi)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"doubao",name:"Doubao",base_url:"https://ark.cn-beijing.volces.com/api/v3",client_type:"openai",display_name:"字节豆包 (Doubao)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"alibaba",name:"Alibaba",base_url:"https://dashscope.aliyuncs.com/compatible-mode/v1",client_type:"openai",display_name:"阿里云百炼 (Alibaba Qwen)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"baichuan",name:"Baichuan",base_url:"https://api.baichuan-ai.com/v1",client_type:"openai",display_name:"百川智能 (Baichuan)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"minimax",name:"MiniMax",base_url:"https://api.minimax.chat/v1",client_type:"openai",display_name:"MiniMax (海螺 AI)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"stepfun",name:"StepFun",base_url:"https://api.stepfun.com/v1",client_type:"openai",display_name:"阶跃星辰 (StepFun)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"lingyi",name:"Lingyi",base_url:"https://api.lingyiwanwu.com/v1",client_type:"openai",display_name:"零一万物 (Lingyi / Yi)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"openai",name:"OpenAI",base_url:"https://api.openai.com/v1",client_type:"openai",display_name:"OpenAI",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"xai",name:"xAI",base_url:"https://api.x.ai/v1",client_type:"openai",display_name:"xAI (Grok)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"anthropic",name:"Anthropic",base_url:"https://api.anthropic.com/v1",client_type:"openai",display_name:"Anthropic (Claude)"},{id:"gemini",name:"Gemini",base_url:"https://generativelanguage.googleapis.com/v1beta",client_type:"gemini",display_name:"Google Gemini",modelFetcher:{endpoint:"/models",parser:"gemini"}},{id:"cohere",name:"Cohere",base_url:"https://api.cohere.ai/v1",client_type:"openai",display_name:"Cohere"},{id:"groq",name:"Groq",base_url:"https://api.groq.com/openai/v1",client_type:"openai",display_name:"Groq",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"together",name:"Together AI",base_url:"https://api.together.xyz/v1",client_type:"openai",display_name:"Together AI",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"fireworks",name:"Fireworks",base_url:"https://api.fireworks.ai/inference/v1",client_type:"openai",display_name:"Fireworks AI",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"mistral",name:"Mistral",base_url:"https://api.mistral.ai/v1",client_type:"openai",display_name:"Mistral AI",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"perplexity",name:"Perplexity",base_url:"https://api.perplexity.ai",client_type:"openai",display_name:"Perplexity AI"},{id:"custom",name:"",base_url:"",client_type:"openai",display_name:"自定义"}];function BE(t){return t?t.replace(/\/+$/,"").toLowerCase():""}function lfe(t){if(!t)return null;const e=BE(t);return vm.find(n=>n.id!=="custom"&&BE(n.base_url)===e)||null}function ofe(){const[t,e]=b.useState([]),[n,r]=b.useState(!0),[s,i]=b.useState(!1),[a,o]=b.useState(!1),[c,h]=b.useState(!1),[f,m]=b.useState(!1),[g,x]=b.useState(!1),[y,w]=b.useState(!1),[S,k]=b.useState(null),[N,C]=b.useState(null),[T,_]=b.useState("custom"),[E,M]=b.useState(!1),[L,P]=b.useState(!1),[I,Q]=b.useState(null),[U,ee]=b.useState(!1),[z,H]=b.useState(""),[B,X]=b.useState(new Set),[J,G]=b.useState(!1),[R,se]=b.useState(1),[W,F]=b.useState(20),[V,te]=b.useState(""),{toast:ne}=ts(),K=b.useRef(null),ie=b.useRef(!0);b.useEffect(()=>{re()},[]);const re=async()=>{try{r(!0);const ke=await th();e(ke.api_providers||[]),h(!1),ie.current=!1}catch(ke){console.error("加载配置失败:",ke)}finally{r(!1)}},ae=async()=>{try{m(!0),Uv().catch(()=>{}),x(!0)}catch(ke){console.error("重启失败:",ke),x(!1),ne({title:"重启失败",description:"无法发送重启请求,请手动重启",variant:"destructive"}),m(!1)}},_e=async()=>{try{i(!0),K.current&&clearTimeout(K.current);const ke=await th();ke.api_providers=t,await R1(ke),h(!1),ne({title:"保存成功",description:"正在重启麦麦..."}),await ae()}catch(ke){console.error("保存配置失败:",ke),ne({title:"保存失败",description:ke.message,variant:"destructive"}),i(!1)}},Ue=()=>{localStorage.removeItem("access-token"),window.location.href="/auth"},Xe=()=>{x(!1),m(!1),ne({title:"重启超时",description:"服务未能在预期时间内恢复,请手动检查或刷新页面",variant:"destructive"})},Ze=b.useCallback(async ke=>{if(!ie.current)try{o(!0),await X3("api_providers",ke),h(!1)}catch(Te){console.error("自动保存失败:",Te),h(!0)}finally{o(!1)}},[]);b.useEffect(()=>{if(!ie.current)return h(!0),K.current&&clearTimeout(K.current),K.current=setTimeout(()=>{Ze(t)},2e3),()=>{K.current&&clearTimeout(K.current)}},[t,Ze]);const Oe=async()=>{try{i(!0),K.current&&clearTimeout(K.current);const ke=await th();ke.api_providers=t,await R1(ke),h(!1),ne({title:"保存成功",description:"模型提供商配置已保存"})}catch(ke){console.error("保存配置失败:",ke),ne({title:"保存失败",description:ke.message,variant:"destructive"})}finally{i(!1)}},He=(ke,Te)=>{if(ke){const qe=vm.find(Rt=>Rt.base_url===ke.base_url&&Rt.client_type===ke.client_type);_(qe?.id||"custom"),k(ke)}else _("custom"),k({name:"",base_url:"",api_key:"",client_type:"openai",max_retry:2,timeout:30,retry_interval:10});C(Te),ee(!1),w(!0)},Ve=ke=>{_(ke),M(!1);const Te=vm.find(qe=>qe.id===ke);Te&&Te.id!=="custom"?k(qe=>({...qe,name:Te.name,base_url:Te.base_url,client_type:Te.client_type})):Te?.id==="custom"&&k(qe=>({...qe,name:"",base_url:"",client_type:"openai"}))},Be=b.useMemo(()=>T!=="custom",[T]),ut=async()=>{if(S?.api_key)try{await navigator.clipboard.writeText(S.api_key),ne({title:"复制成功",description:"API Key 已复制到剪贴板"})}catch{ne({title:"复制失败",description:"无法访问剪贴板",variant:"destructive"})}},rt=()=>{if(!S)return;const ke={...S,max_retry:S.max_retry??2,timeout:S.timeout??30,retry_interval:S.retry_interval??10};if(N!==null){const Te=[...t];Te[N]=ke,e(Te)}else e([...t,ke]);w(!1),k(null),C(null)},rn=ke=>{if(!ke&&S){const Te={...S,max_retry:S.max_retry??2,timeout:S.timeout??30,retry_interval:S.retry_interval??10};k(Te)}w(ke)},Rn=ke=>{Q(ke),P(!0)},Tn=()=>{if(I!==null){const ke=t.filter((Te,qe)=>qe!==I);e(ke),ne({title:"删除成功",description:"提供商已从列表中移除"})}P(!1),Q(null)},Mt=ke=>{const Te=new Set(B);Te.has(ke)?Te.delete(ke):Te.add(ke),X(Te)},vt=()=>{if(B.size===Ge.length)X(new Set);else{const ke=Ge.map((Te,qe)=>t.findIndex(Rt=>Rt===Ge[qe]));X(new Set(ke))}},Ce=()=>{if(B.size===0){ne({title:"提示",description:"请先选择要删除的提供商",variant:"default"});return}G(!0)},Le=()=>{const ke=t.filter((Te,qe)=>!B.has(qe));e(ke),X(new Set),G(!1),ne({title:"批量删除成功",description:`已删除 ${B.size} 个提供商`})},Ge=t.filter(ke=>{if(!z)return!0;const Te=z.toLowerCase();return ke.name.toLowerCase().includes(Te)||ke.base_url.toLowerCase().includes(Te)||ke.client_type.toLowerCase().includes(Te)}),lt=Math.ceil(Ge.length/W),jt=Ge.slice((R-1)*W,R*W),Tt=()=>{const ke=parseInt(V);ke>=1&&ke<=lt&&(se(ke),te(""))};return n?l.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:l.jsx("div",{className:"flex items-center justify-center h-64",children:l.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})}):l.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[l.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[l.jsxs("div",{children:[l.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"AI模型厂商配置"}),l.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理 AI 模型厂商的 API 配置"})]}),l.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[B.size>0&&l.jsxs(de,{onClick:Ce,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[l.jsx(fn,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"批量删除 (",B.size,")"]}),l.jsxs(de,{onClick:()=>He(null,null),size:"sm",className:"w-full sm:w-auto",children:[l.jsx(ws,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"添加提供商"]}),l.jsxs(de,{onClick:Oe,disabled:s||a||!c||f,size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[l.jsx(zv,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),s?"保存中...":a?"自动保存中...":c?"保存配置":"已保存"]}),l.jsxs(Nn,{children:[l.jsx(Qr,{asChild:!0,children:l.jsxs(de,{disabled:s||a||f,size:"sm",className:"w-full sm:w-auto",children:[l.jsx(a6,{className:"mr-2 h-4 w-4"}),f?"重启中...":c?"保存并重启":"重启麦麦"]})}),l.jsxs(gn,{children:[l.jsxs(xn,{children:[l.jsx(yn,{children:"确认重启麦麦?"}),l.jsx(bn,{className:"space-y-3",asChild:!0,children:l.jsxs("div",{children:[l.jsx("p",{children:c?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"}),l.jsxs(Na,{className:"border-yellow-500/50 bg-yellow-500/10",children:[l.jsx(ra,{className:"h-4 w-4 text-yellow-600"}),l.jsxs(Ca,{className:"text-yellow-900 dark:text-yellow-100",children:[l.jsx("strong",{children:"重要提示:"}),"由于技术原因,使用重启功能后,将无法再使用 ",l.jsx("code",{className:"px-1 py-0.5 bg-yellow-200 dark:bg-yellow-900 rounded",children:"Ctrl+C"})," 结束程序。",l.jsxs(xr,{children:[l.jsx(Bh,{asChild:!0,children:l.jsxs("button",{className:"ml-1 text-yellow-700 dark:text-yellow-300 underline hover:text-yellow-800 dark:hover:text-yellow-200 inline-flex items-center gap-1",children:[l.jsx(Dv,{className:"h-3 w-3"}),"如何结束程序?"]})}),l.jsxs(lr,{className:"max-w-2xl",children:[l.jsxs(or,{children:[l.jsx(cr,{children:"如何结束使用重启功能后的麦麦程序"}),l.jsx(Hr,{children:"由于重启功能会使程序脱离终端控制,需要通过系统命令来结束进程"})]}),l.jsxs(sa,{defaultValue:"windows",className:"w-full",children:[l.jsxs(Mi,{className:"grid w-full grid-cols-3",children:[l.jsx(zt,{value:"windows",children:"Windows"}),l.jsx(zt,{value:"macos",children:"macOS"}),l.jsx(zt,{value:"linux",children:"Linux"})]}),l.jsxs(tn,{value:"windows",className:"space-y-4 mt-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"font-semibold",children:"方法一:使用任务管理器"}),l.jsxs("ol",{className:"list-decimal list-inside space-y-1 text-sm text-muted-foreground",children:[l.jsxs("li",{children:["按 ",l.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"Ctrl + Shift + Esc"})," 打开任务管理器"]}),l.jsxs("li",{children:["在“进程”或“详细信息”标签页中找到 ",l.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"python.exe"})]}),l.jsx("li",{children:"右键点击并选择“结束任务”"})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"font-semibold",children:"方法二:使用命令行"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"打开 PowerShell 或命令提示符,执行以下命令:"}),l.jsxs("div",{className:"bg-muted p-3 rounded-md font-mono text-sm",children:[l.jsx("p",{children:"# 查找麦麦进程"}),l.jsx("p",{children:'Get-Process python | Where-Object {$_.MainWindowTitle -eq ""}'}),l.jsx("p",{className:"mt-2",children:"# 结束所有 Python 进程(谨慎使用)"}),l.jsx("p",{children:"Stop-Process -Name python -Force"})]})]})]}),l.jsxs(tn,{value:"macos",className:"space-y-4 mt-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"font-semibold",children:"方法一:使用活动监视器"}),l.jsxs("ol",{className:"list-decimal list-inside space-y-1 text-sm text-muted-foreground",children:[l.jsxs("li",{children:["按 ",l.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"Cmd + Space"})," 打开 Spotlight,搜索“活动监视器”"]}),l.jsxs("li",{children:["在进程列表中找到 ",l.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"Python"})]}),l.jsx("li",{children:"选中后点击左上角的 X 按钮结束进程"})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"font-semibold",children:"方法二:使用终端"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"打开终端,执行以下命令:"}),l.jsxs("div",{className:"bg-muted p-3 rounded-md font-mono text-sm",children:[l.jsx("p",{children:"# 查找麦麦进程"}),l.jsx("p",{children:"ps aux | grep python | grep -v grep"}),l.jsx("p",{className:"mt-2",children:"# 结束指定 PID 的进程"}),l.jsx("p",{children:"kill -9 "}),l.jsx("p",{className:"mt-2",children:"# 或结束所有 Python 进程(谨慎使用)"}),l.jsx("p",{children:"pkill -9 python"})]})]})]}),l.jsxs(tn,{value:"linux",className:"space-y-4 mt-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"font-semibold",children:"使用终端命令"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"打开终端,执行以下命令:"}),l.jsxs("div",{className:"bg-muted p-3 rounded-md font-mono text-sm",children:[l.jsx("p",{children:"# 查找麦麦进程"}),l.jsx("p",{children:"ps aux | grep python | grep -v grep"}),l.jsx("p",{className:"mt-2",children:"# 结束指定 PID 的进程"}),l.jsx("p",{children:"kill -9 "}),l.jsx("p",{className:"mt-2",children:"# 或使用 pkill 按名称结束"}),l.jsx("p",{children:'pkill -9 -f "bot.py"'}),l.jsx("p",{className:"mt-2",children:"# 或结束所有 Python 进程(谨慎使用)"}),l.jsx("p",{children:"pkill -9 python"})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"font-semibold",children:"使用 htop(如已安装)"}),l.jsxs("ol",{className:"list-decimal list-inside space-y-1 text-sm text-muted-foreground",children:[l.jsxs("li",{children:["在终端输入 ",l.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"htop"})]}),l.jsxs("li",{children:["按 ",l.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"F3"})," 搜索 python"]}),l.jsxs("li",{children:["按 ",l.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"F9"})," 发送信号,选择 SIGKILL"]})]})]})]})]}),l.jsx(as,{children:l.jsx(k6,{asChild:!0,children:l.jsx(de,{variant:"outline",children:"关闭"})})})]})]})]})]})]})})]}),l.jsxs(vn,{children:[l.jsx(Sn,{children:"取消"}),l.jsx(wn,{onClick:c?_e:ae,children:c?"保存并重启":"确认重启"})]})]})]})]})]}),l.jsxs(Na,{children:[l.jsx(ra,{className:"h-4 w-4"}),l.jsxs(Ca,{children:["配置更新后需要",l.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),l.jsxs(hn,{className:"h-[calc(100vh-260px)]",children:[l.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-2 mb-4",children:[l.jsxs("div",{className:"relative w-full sm:flex-1 sm:max-w-sm",children:[l.jsx(ci,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),l.jsx(Pe,{placeholder:"搜索提供商名称、URL 或类型...",value:z,onChange:ke=>H(ke.target.value),className:"pl-9"})]}),z&&l.jsxs("p",{className:"text-sm text-muted-foreground whitespace-nowrap",children:["找到 ",Ge.length," 个结果"]})]}),l.jsx("div",{className:"md:hidden space-y-3",children:Ge.length===0?l.jsx("div",{className:"text-center text-muted-foreground py-8 rounded-lg border bg-card",children:z?"未找到匹配的提供商":'暂无提供商配置,点击"添加提供商"开始配置'}):jt.map((ke,Te)=>{const qe=t.findIndex(Rt=>Rt===ke);return l.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[l.jsxs("div",{className:"flex items-start justify-between gap-2",children:[l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("h3",{className:"font-semibold text-base truncate",children:ke.name}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1 break-all",children:ke.base_url})]}),l.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[l.jsxs(de,{variant:"default",size:"sm",onClick:()=>He(ke,qe),children:[l.jsx(wu,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),l.jsxs(de,{size:"sm",onClick:()=>Rn(qe),className:"bg-red-600 hover:bg-red-700 text-white",children:[l.jsx(fn,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})]}),l.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[l.jsxs("div",{children:[l.jsx("span",{className:"text-muted-foreground text-xs",children:"客户端类型"}),l.jsx("p",{className:"font-medium",children:ke.client_type})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-muted-foreground text-xs",children:"最大重试"}),l.jsx("p",{className:"font-medium",children:ke.max_retry})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-muted-foreground text-xs",children:"超时(秒)"}),l.jsx("p",{className:"font-medium",children:ke.timeout})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-muted-foreground text-xs",children:"重试间隔(秒)"}),l.jsx("p",{className:"font-medium",children:ke.retry_interval})]})]})]},Te)})}),l.jsx("div",{className:"hidden md:block rounded-lg border bg-card overflow-hidden",children:l.jsx("div",{className:"overflow-x-auto",children:l.jsxs(Vh,{children:[l.jsx(Uh,{children:l.jsxs(bs,{children:[l.jsx(ln,{className:"w-12",children:l.jsx(li,{checked:B.size===Ge.length&&Ge.length>0,onCheckedChange:vt})}),l.jsx(ln,{children:"名称"}),l.jsx(ln,{children:"基础URL"}),l.jsx(ln,{children:"客户端类型"}),l.jsx(ln,{className:"text-right",children:"最大重试"}),l.jsx(ln,{className:"text-right",children:"超时(秒)"}),l.jsx(ln,{className:"text-right",children:"重试间隔(秒)"}),l.jsx(ln,{className:"text-right",children:"操作"})]})}),l.jsx(Wh,{children:jt.length===0?l.jsx(bs,{children:l.jsx(Qt,{colSpan:8,className:"text-center text-muted-foreground py-8",children:z?"未找到匹配的提供商":'暂无提供商配置,点击"添加提供商"开始配置'})}):jt.map((ke,Te)=>{const qe=t.findIndex(Rt=>Rt===ke);return l.jsxs(bs,{children:[l.jsx(Qt,{children:l.jsx(li,{checked:B.has(qe),onCheckedChange:()=>Mt(qe)})}),l.jsx(Qt,{className:"font-medium",children:ke.name}),l.jsx(Qt,{className:"max-w-xs truncate",title:ke.base_url,children:ke.base_url}),l.jsx(Qt,{children:ke.client_type}),l.jsx(Qt,{className:"text-right",children:ke.max_retry}),l.jsx(Qt,{className:"text-right",children:ke.timeout}),l.jsx(Qt,{className:"text-right",children:ke.retry_interval}),l.jsx(Qt,{className:"text-right",children:l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsxs(de,{variant:"default",size:"sm",onClick:()=>He(ke,qe),children:[l.jsx(wu,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),l.jsxs(de,{size:"sm",onClick:()=>Rn(qe),className:"bg-red-600 hover:bg-red-700 text-white",children:[l.jsx(fn,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})})]},Te)})})]})})}),Ge.length>0&&l.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(ue,{htmlFor:"page-size-provider",className:"text-sm whitespace-nowrap",children:"每页显示"}),l.jsxs(qt,{value:W.toString(),onValueChange:ke=>{F(parseInt(ke)),se(1),X(new Set)},children:[l.jsx(It,{id:"page-size-provider",className:"w-20",children:l.jsx(Ft,{})}),l.jsxs(Bt,{children:[l.jsx(De,{value:"10",children:"10"}),l.jsx(De,{value:"20",children:"20"}),l.jsx(De,{value:"50",children:"50"}),l.jsx(De,{value:"100",children:"100"})]})]}),l.jsxs("span",{className:"text-sm text-muted-foreground",children:["显示 ",(R-1)*W+1," 到"," ",Math.min(R*W,Ge.length)," 条,共 ",Ge.length," 条"]})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(de,{variant:"outline",size:"sm",onClick:()=>se(1),disabled:R===1,className:"hidden sm:flex",children:l.jsx(L0,{className:"h-4 w-4"})}),l.jsxs(de,{variant:"outline",size:"sm",onClick:()=>se(ke=>Math.max(1,ke-1)),disabled:R===1,children:[l.jsx($u,{className:"h-4 w-4 sm:mr-1"}),l.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Pe,{type:"number",value:V,onChange:ke=>te(ke.target.value),onKeyDown:ke=>ke.key==="Enter"&&Tt(),placeholder:R.toString(),className:"w-16 h-8 text-center",min:1,max:lt}),l.jsx(de,{variant:"outline",size:"sm",onClick:Tt,disabled:!V,className:"h-8",children:"跳转"})]}),l.jsxs(de,{variant:"outline",size:"sm",onClick:()=>se(ke=>ke+1),disabled:R>=lt,children:[l.jsx("span",{className:"hidden sm:inline",children:"下一页"}),l.jsx(Qu,{className:"h-4 w-4 sm:ml-1"})]}),l.jsx(de,{variant:"outline",size:"sm",onClick:()=>se(lt),disabled:R>=lt,className:"hidden sm:flex",children:l.jsx(I0,{className:"h-4 w-4"})})]})]})]}),l.jsx(xr,{open:y,onOpenChange:rn,children:l.jsxs(lr,{className:"max-w-[95vw] sm:max-w-2xl max-h-[90vh] overflow-y-auto",children:[l.jsxs(or,{children:[l.jsx(cr,{children:N!==null?"编辑提供商":"添加提供商"}),l.jsx(Hr,{children:"配置 API 提供商的连接信息和参数"})]}),l.jsxs("form",{onSubmit:ke=>{ke.preventDefault(),rt()},autoComplete:"off",children:[l.jsxs("div",{className:"grid gap-4 py-4",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ue,{htmlFor:"template",children:"提供商模板"}),l.jsxs(ul,{open:E,onOpenChange:M,children:[l.jsx(dl,{asChild:!0,children:l.jsxs(de,{variant:"outline",role:"combobox","aria-expanded":E,className:"w-full justify-between",children:[T?vm.find(ke=>ke.id===T)?.display_name:"选择提供商模板...",l.jsx(l6,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),l.jsx(Ea,{className:"p-0",align:"start",style:{width:"var(--radix-popover-trigger-width)"},children:l.jsxs(dy,{children:[l.jsx(hy,{placeholder:"搜索提供商模板..."}),l.jsx(hn,{className:"h-[300px]",children:l.jsxs(fy,{className:"max-h-none overflow-visible",children:[l.jsx(my,{children:"未找到匹配的模板"}),l.jsx(f0,{children:vm.map(ke=>l.jsxs(m0,{value:ke.display_name,onSelect:()=>Ve(ke.id),children:[l.jsx(ol,{className:`mr-2 h-4 w-4 ${T===ke.id?"opacity-100":"opacity-0"}`}),ke.display_name]},ke.id))})]})})]})})]}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"选择预设模板可自动填充 URL 和客户端类型,支持搜索"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ue,{htmlFor:"name",children:"名称 *"}),l.jsx(Pe,{id:"name",value:S?.name||"",onChange:ke=>k(Te=>Te?{...Te,name:ke.target.value}:null),placeholder:"例如: DeepSeek, SiliconFlow"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ue,{htmlFor:"base_url",children:"基础 URL *"}),l.jsx(Pe,{id:"base_url",value:S?.base_url||"",onChange:ke=>k(Te=>Te?{...Te,base_url:ke.target.value}:null),placeholder:"https://api.example.com/v1",disabled:Be,className:Be?"bg-muted cursor-not-allowed":""}),Be&&l.jsx("p",{className:"text-xs text-muted-foreground",children:'使用模板时 URL 不可编辑,切换到"自定义"以手动配置'})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ue,{htmlFor:"api_key",children:"API Key *"}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx(Pe,{id:"api_key",type:U?"text":"password",value:S?.api_key||"",onChange:ke=>k(Te=>Te?{...Te,api_key:ke.target.value}:null),placeholder:"sk-...",className:"flex-1"}),l.jsx(de,{type:"button",variant:"outline",size:"icon",onClick:()=>ee(!U),title:U?"隐藏密钥":"显示密钥",children:U?l.jsx(N1,{className:"h-4 w-4"}):l.jsx(oa,{className:"h-4 w-4"})}),l.jsx(de,{type:"button",variant:"outline",size:"icon",onClick:ut,title:"复制密钥",children:l.jsx(O1,{className:"h-4 w-4"})})]})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ue,{htmlFor:"client_type",children:"客户端类型"}),l.jsxs(qt,{value:S?.client_type||"openai",onValueChange:ke=>k(Te=>Te?{...Te,client_type:ke}:null),disabled:Be,children:[l.jsx(It,{id:"client_type",className:Be?"bg-muted cursor-not-allowed":"",children:l.jsx(Ft,{placeholder:"选择客户端类型"})}),l.jsxs(Bt,{children:[l.jsx(De,{value:"openai",children:"OpenAI"}),l.jsx(De,{value:"gemini",children:"Gemini"})]})]}),Be&&l.jsx("p",{className:"text-xs text-muted-foreground",children:'使用模板时客户端类型不可编辑,切换到"自定义"以手动配置'})]}),l.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ue,{htmlFor:"max_retry",children:"最大重试"}),l.jsx(Pe,{id:"max_retry",type:"number",min:"0",value:S?.max_retry??"",onChange:ke=>{const Te=ke.target.value===""?null:parseInt(ke.target.value);k(qe=>qe?{...qe,max_retry:Te}:null)},placeholder:"默认: 2"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ue,{htmlFor:"timeout",children:"超时(秒)"}),l.jsx(Pe,{id:"timeout",type:"number",min:"1",value:S?.timeout??"",onChange:ke=>{const Te=ke.target.value===""?null:parseInt(ke.target.value);k(qe=>qe?{...qe,timeout:Te}:null)},placeholder:"默认: 30"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ue,{htmlFor:"retry_interval",children:"重试间隔(秒)"}),l.jsx(Pe,{id:"retry_interval",type:"number",min:"1",value:S?.retry_interval??"",onChange:ke=>{const Te=ke.target.value===""?null:parseInt(ke.target.value);k(qe=>qe?{...qe,retry_interval:Te}:null)},placeholder:"默认: 10"})]})]})]}),l.jsxs(as,{children:[l.jsx(de,{type:"button",variant:"outline",onClick:()=>w(!1),children:"取消"}),l.jsx(de,{type:"submit",children:"保存"})]})]})]})}),l.jsx(Nn,{open:L,onOpenChange:P,children:l.jsxs(gn,{children:[l.jsxs(xn,{children:[l.jsx(yn,{children:"确认删除"}),l.jsxs(bn,{children:['确定要删除提供商 "',I!==null?t[I]?.name:"",'" 吗? 此操作无法撤销。']})]}),l.jsxs(vn,{children:[l.jsx(Sn,{children:"取消"}),l.jsx(wn,{onClick:Tn,children:"删除"})]})]})}),l.jsx(Nn,{open:J,onOpenChange:G,children:l.jsxs(gn,{children:[l.jsxs(xn,{children:[l.jsx(yn,{children:"确认批量删除"}),l.jsxs(bn,{children:["确定要删除选中的 ",B.size," 个提供商吗? 此操作无法撤销。"]})]}),l.jsxs(vn,{children:[l.jsx(Sn,{children:"取消"}),l.jsx(wn,{onClick:Le,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})}),g&&l.jsx(N6,{onRestartComplete:Ue,onRestartFailed:Xe})]})}function cfe(){for(var t=arguments.length,e=new Array(t),n=0;nr=>{e.forEach(s=>s(r))},e)}const py=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Gh(t){const e=Object.prototype.toString.call(t);return e==="[object Window]"||e==="[object global]"}function xj(t){return"nodeType"in t}function di(t){var e,n;return t?Gh(t)?t:xj(t)&&(e=(n=t.ownerDocument)==null?void 0:n.defaultView)!=null?e:window:window}function vj(t){const{Document:e}=di(t);return t instanceof e}function ap(t){return Gh(t)?!1:t instanceof di(t).HTMLElement}function yF(t){return t instanceof di(t).SVGElement}function Xh(t){return t?Gh(t)?t.document:xj(t)?vj(t)?t:ap(t)||yF(t)?t.ownerDocument:document:document:document}const fl=py?b.useLayoutEffect:b.useEffect;function yj(t){const e=b.useRef(t);return fl(()=>{e.current=t}),b.useCallback(function(){for(var n=arguments.length,r=new Array(n),s=0;s{t.current=setInterval(r,s)},[]),n=b.useCallback(()=>{t.current!==null&&(clearInterval(t.current),t.current=null)},[]);return[e,n]}function p0(t,e){e===void 0&&(e=[t]);const n=b.useRef(t);return fl(()=>{n.current!==t&&(n.current=t)},e),n}function lp(t,e){const n=b.useRef();return b.useMemo(()=>{const r=t(n.current);return n.current=r,r},[...e])}function nv(t){const e=yj(t),n=b.useRef(null),r=b.useCallback(s=>{s!==n.current&&e?.(s,n.current),n.current=s},[]);return[n,r]}function XS(t){const e=b.useRef();return b.useEffect(()=>{e.current=t},[t]),e.current}let t4={};function op(t,e){return b.useMemo(()=>{if(e)return e;const n=t4[t]==null?0:t4[t]+1;return t4[t]=n,t+"-"+n},[t,e])}function bF(t){return function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s{const o=Object.entries(a);for(const[c,h]of o){const f=i[c];f!=null&&(i[c]=f+t*h)}return i},{...e})}}const oh=bF(1),g0=bF(-1);function dfe(t){return"clientX"in t&&"clientY"in t}function bj(t){if(!t)return!1;const{KeyboardEvent:e}=di(t.target);return e&&t instanceof e}function hfe(t){if(!t)return!1;const{TouchEvent:e}=di(t.target);return e&&t instanceof e}function YS(t){if(hfe(t)){if(t.touches&&t.touches.length){const{clientX:e,clientY:n}=t.touches[0];return{x:e,y:n}}else if(t.changedTouches&&t.changedTouches.length){const{clientX:e,clientY:n}=t.changedTouches[0];return{x:e,y:n}}}return dfe(t)?{x:t.clientX,y:t.clientY}:null}const x0=Object.freeze({Translate:{toString(t){if(!t)return;const{x:e,y:n}=t;return"translate3d("+(e?Math.round(e):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(t){if(!t)return;const{scaleX:e,scaleY:n}=t;return"scaleX("+e+") scaleY("+n+")"}},Transform:{toString(t){if(t)return[x0.Translate.toString(t),x0.Scale.toString(t)].join(" ")}},Transition:{toString(t){let{property:e,duration:n,easing:r}=t;return e+" "+n+"ms "+r}}}),qE="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function ffe(t){return t.matches(qE)?t:t.querySelector(qE)}const mfe={display:"none"};function pfe(t){let{id:e,value:n}=t;return he.createElement("div",{id:e,style:mfe},n)}function gfe(t){let{id:e,announcement:n,ariaLiveType:r="assertive"}=t;const s={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return he.createElement("div",{id:e,style:s,role:"status","aria-live":r,"aria-atomic":!0},n)}function xfe(){const[t,e]=b.useState("");return{announce:b.useCallback(r=>{r!=null&&e(r)},[]),announcement:t}}const wF=b.createContext(null);function vfe(t){const e=b.useContext(wF);b.useEffect(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of ");return e(t)},[t,e])}function yfe(){const[t]=b.useState(()=>new Set),e=b.useCallback(r=>(t.add(r),()=>t.delete(r)),[t]);return[b.useCallback(r=>{let{type:s,event:i}=r;t.forEach(a=>{var o;return(o=a[s])==null?void 0:o.call(a,i)})},[t]),e]}const bfe={draggable:` To pick up a draggable item, press the space bar. While dragging, use the arrow keys to move the item. Press space again to drop the item in its new position, or press escape to cancel. - `},xfe={onDragStart(t){let{active:e}=t;return"Picked up draggable item "+e.id+"."},onDragOver(t){let{active:e,over:n}=t;return n?"Draggable item "+e.id+" was moved over droppable area "+n.id+".":"Draggable item "+e.id+" is no longer over a droppable area."},onDragEnd(t){let{active:e,over:n}=t;return n?"Draggable item "+e.id+" was dropped over droppable area "+n.id:"Draggable item "+e.id+" was dropped."},onDragCancel(t){let{active:e}=t;return"Dragging was cancelled. Draggable item "+e.id+" was dropped."}};function vfe(t){let{announcements:e=xfe,container:n,hiddenTextDescribedById:r,screenReaderInstructions:s=gfe}=t;const{announce:i,announcement:a}=ffe(),o=ip("DndLiveRegion"),[c,h]=b.useState(!1);if(b.useEffect(()=>{h(!0)},[]),mfe(b.useMemo(()=>({onDragStart(m){let{active:g}=m;i(e.onDragStart({active:g}))},onDragMove(m){let{active:g,over:x}=m;e.onDragMove&&i(e.onDragMove({active:g,over:x}))},onDragOver(m){let{active:g,over:x}=m;i(e.onDragOver({active:g,over:x}))},onDragEnd(m){let{active:g,over:x}=m;i(e.onDragEnd({active:g,over:x}))},onDragCancel(m){let{active:g,over:x}=m;i(e.onDragCancel({active:g,over:x}))}}),[i,e])),!c)return null;const f=he.createElement(he.Fragment,null,he.createElement(dfe,{id:r,value:s.draggable}),he.createElement(hfe,{id:o,announcement:a}));return n?hu.createPortal(f,n):f}var Vr;(function(t){t.DragStart="dragStart",t.DragMove="dragMove",t.DragEnd="dragEnd",t.DragCancel="dragCancel",t.DragOver="dragOver",t.RegisterDroppable="registerDroppable",t.SetDroppableDisabled="setDroppableDisabled",t.UnregisterDroppable="unregisterDroppable"})(Vr||(Vr={}));function tv(){}function BE(t,e){return b.useMemo(()=>({sensor:t,options:e??{}}),[t,e])}function yfe(){for(var t=arguments.length,e=new Array(t),n=0;n[...e].filter(r=>r!=null),[...e])}const Ea=Object.freeze({x:0,y:0});function bF(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function wF(t,e){let{data:{value:n}}=t,{data:{value:r}}=e;return n-r}function bfe(t,e){let{data:{value:n}}=t,{data:{value:r}}=e;return r-n}function qE(t){let{left:e,top:n,height:r,width:s}=t;return[{x:e,y:n},{x:e+s,y:n},{x:e,y:n+r},{x:e+s,y:n+r}]}function SF(t,e){if(!t||t.length===0)return null;const[n]=t;return n[e]}function FE(t,e,n){return e===void 0&&(e=t.left),n===void 0&&(n=t.top),{x:e+t.width*.5,y:n+t.height*.5}}const wfe=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:r}=t;const s=FE(e,e.left,e.top),i=[];for(const a of r){const{id:o}=a,c=n.get(o);if(c){const h=bF(FE(c),s);i.push({id:o,data:{droppableContainer:a,value:h}})}}return i.sort(wF)},Sfe=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:r}=t;const s=qE(e),i=[];for(const a of r){const{id:o}=a,c=n.get(o);if(c){const h=qE(c),f=s.reduce((g,x,y)=>g+bF(h[y],x),0),m=Number((f/4).toFixed(4));i.push({id:o,data:{droppableContainer:a,value:m}})}}return i.sort(wF)};function kfe(t,e){const n=Math.max(e.top,t.top),r=Math.max(e.left,t.left),s=Math.min(e.left+e.width,t.left+t.width),i=Math.min(e.top+e.height,t.top+t.height),a=s-r,o=i-n;if(r{let{collisionRect:e,droppableRects:n,droppableContainers:r}=t;const s=[];for(const i of r){const{id:a}=i,o=n.get(a);if(o){const c=kfe(o,e);c>0&&s.push({id:a,data:{droppableContainer:i,value:c}})}}return s.sort(bfe)};function jfe(t,e,n){return{...t,scaleX:e&&n?e.width/n.width:1,scaleY:e&&n?e.height/n.height:1}}function kF(t,e){return t&&e?{x:t.left-e.left,y:t.top-e.top}:Ea}function Nfe(t){return function(n){for(var r=arguments.length,s=new Array(r>1?r-1:0),i=1;i({...a,top:a.top+t*o.y,bottom:a.bottom+t*o.y,left:a.left+t*o.x,right:a.right+t*o.x}),{...n})}}const Cfe=Nfe(1);function Tfe(t){if(t.startsWith("matrix3d(")){const e=t.slice(9,-1).split(/, /);return{x:+e[12],y:+e[13],scaleX:+e[0],scaleY:+e[5]}}else if(t.startsWith("matrix(")){const e=t.slice(7,-1).split(/, /);return{x:+e[4],y:+e[5],scaleX:+e[0],scaleY:+e[3]}}return null}function Efe(t,e,n){const r=Tfe(e);if(!r)return t;const{scaleX:s,scaleY:i,x:a,y:o}=r,c=t.left-a-(1-s)*parseFloat(n),h=t.top-o-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),f=s?t.width/s:t.width,m=i?t.height/i:t.height;return{width:f,height:m,top:h,right:c+f,bottom:h+m,left:c}}const _fe={ignoreTransform:!1};function Yh(t,e){e===void 0&&(e=_fe);let n=t.getBoundingClientRect();if(e.ignoreTransform){const{transform:h,transformOrigin:f}=ci(t).getComputedStyle(t);h&&(n=Efe(n,h,f))}const{top:r,left:s,width:i,height:a,bottom:o,right:c}=n;return{top:r,left:s,width:i,height:a,bottom:o,right:c}}function $E(t){return Yh(t,{ignoreTransform:!0})}function Mfe(t){const e=t.innerWidth,n=t.innerHeight;return{top:0,left:0,right:e,bottom:n,width:e,height:n}}function Afe(t,e){return e===void 0&&(e=ci(t).getComputedStyle(t)),e.position==="fixed"}function Rfe(t,e){e===void 0&&(e=ci(t).getComputedStyle(t));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(s=>{const i=e[s];return typeof i=="string"?n.test(i):!1})}function uy(t,e){const n=[];function r(s){if(e!=null&&n.length>=e||!s)return n;if(xO(s)&&s.scrollingElement!=null&&!n.includes(s.scrollingElement))return n.push(s.scrollingElement),n;if(!rp(s)||xF(s)||n.includes(s))return n;const i=ci(t).getComputedStyle(s);return s!==t&&Rfe(s,i)&&n.push(s),Afe(s,i)?n:r(s.parentNode)}return t?r(t):n}function OF(t){const[e]=uy(t,1);return e??null}function Yw(t){return!cy||!t?null:Gh(t)?t:gO(t)?xO(t)||t===Xh(t).scrollingElement?window:rp(t)?t:null:null}function jF(t){return Gh(t)?t.scrollX:t.scrollLeft}function NF(t){return Gh(t)?t.scrollY:t.scrollTop}function VS(t){return{x:jF(t),y:NF(t)}}var Jr;(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})(Jr||(Jr={}));function CF(t){return!cy||!t?!1:t===document.scrollingElement}function TF(t){const e={x:0,y:0},n=CF(t)?{height:window.innerHeight,width:window.innerWidth}:{height:t.clientHeight,width:t.clientWidth},r={x:t.scrollWidth-n.width,y:t.scrollHeight-n.height},s=t.scrollTop<=e.y,i=t.scrollLeft<=e.x,a=t.scrollTop>=r.y,o=t.scrollLeft>=r.x;return{isTop:s,isLeft:i,isBottom:a,isRight:o,maxScroll:r,minScroll:e}}const Dfe={x:.2,y:.2};function zfe(t,e,n,r,s){let{top:i,left:a,right:o,bottom:c}=n;r===void 0&&(r=10),s===void 0&&(s=Dfe);const{isTop:h,isBottom:f,isLeft:m,isRight:g}=TF(t),x={x:0,y:0},y={x:0,y:0},w={height:e.height*s.y,width:e.width*s.x};return!h&&i<=e.top+w.height?(x.y=Jr.Backward,y.y=r*Math.abs((e.top+w.height-i)/w.height)):!f&&c>=e.bottom-w.height&&(x.y=Jr.Forward,y.y=r*Math.abs((e.bottom-w.height-c)/w.height)),!g&&o>=e.right-w.width?(x.x=Jr.Forward,y.x=r*Math.abs((e.right-w.width-o)/w.width)):!m&&a<=e.left+w.width&&(x.x=Jr.Backward,y.x=r*Math.abs((e.left+w.width-a)/w.width)),{direction:x,speed:y}}function Pfe(t){if(t===document.scrollingElement){const{innerWidth:i,innerHeight:a}=window;return{top:0,left:0,right:i,bottom:a,width:i,height:a}}const{top:e,left:n,right:r,bottom:s}=t.getBoundingClientRect();return{top:e,left:n,right:r,bottom:s,width:t.clientWidth,height:t.clientHeight}}function EF(t){return t.reduce((e,n)=>ah(e,VS(n)),Ea)}function Lfe(t){return t.reduce((e,n)=>e+jF(n),0)}function Ife(t){return t.reduce((e,n)=>e+NF(n),0)}function Bfe(t,e){if(e===void 0&&(e=Yh),!t)return;const{top:n,left:r,bottom:s,right:i}=e(t);OF(t)&&(s<=0||i<=0||n>=window.innerHeight||r>=window.innerWidth)&&t.scrollIntoView({block:"center",inline:"center"})}const qfe=[["x",["left","right"],Lfe],["y",["top","bottom"],Ife]];class bO{constructor(e,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=uy(n),s=EF(r);this.rect={...e},this.width=e.width,this.height=e.height;for(const[i,a,o]of qfe)for(const c of a)Object.defineProperty(this,c,{get:()=>{const h=o(r),f=s[i]-h;return this.rect[c]+f},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Rm{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=e}add(e,n,r){var s;(s=this.target)==null||s.addEventListener(e,n,r),this.listeners.push([e,n,r])}}function Ffe(t){const{EventTarget:e}=ci(t);return t instanceof e?t:Xh(t)}function Kw(t,e){const n=Math.abs(t.x),r=Math.abs(t.y);return typeof e=="number"?Math.sqrt(n**2+r**2)>e:"x"in e&&"y"in e?n>e.x&&r>e.y:"x"in e?n>e.x:"y"in e?r>e.y:!1}var Wi;(function(t){t.Click="click",t.DragStart="dragstart",t.Keydown="keydown",t.ContextMenu="contextmenu",t.Resize="resize",t.SelectionChange="selectionchange",t.VisibilityChange="visibilitychange"})(Wi||(Wi={}));function QE(t){t.preventDefault()}function $fe(t){t.stopPropagation()}var sn;(function(t){t.Space="Space",t.Down="ArrowDown",t.Right="ArrowRight",t.Left="ArrowLeft",t.Up="ArrowUp",t.Esc="Escape",t.Enter="Enter",t.Tab="Tab"})(sn||(sn={}));const _F={start:[sn.Space,sn.Enter],cancel:[sn.Esc],end:[sn.Space,sn.Enter,sn.Tab]},Qfe=(t,e)=>{let{currentCoordinates:n}=e;switch(t.code){case sn.Right:return{...n,x:n.x+25};case sn.Left:return{...n,x:n.x-25};case sn.Down:return{...n,y:n.y+25};case sn.Up:return{...n,y:n.y-25}}};class wO{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:n}}=e;this.props=e,this.listeners=new Rm(Xh(n)),this.windowListeners=new Rm(ci(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Wi.Resize,this.handleCancel),this.windowListeners.add(Wi.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Wi.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:n}=this.props,r=e.node.current;r&&Bfe(r),n(Ea)}handleKeyDown(e){if(yO(e)){const{active:n,context:r,options:s}=this.props,{keyboardCodes:i=_F,coordinateGetter:a=Qfe,scrollBehavior:o="smooth"}=s,{code:c}=e;if(i.end.includes(c)){this.handleEnd(e);return}if(i.cancel.includes(c)){this.handleCancel(e);return}const{collisionRect:h}=r.current,f=h?{x:h.left,y:h.top}:Ea;this.referenceCoordinates||(this.referenceCoordinates=f);const m=a(e,{active:n,context:r.current,currentCoordinates:f});if(m){const g=f0(m,f),x={x:0,y:0},{scrollableAncestors:y}=r.current;for(const w of y){const S=e.code,{isTop:k,isRight:N,isLeft:C,isBottom:T,maxScroll:_,minScroll:E}=TF(w),M=Pfe(w),q={x:Math.min(S===sn.Right?M.right-M.width/2:M.right,Math.max(S===sn.Right?M.left:M.left+M.width/2,m.x)),y:Math.min(S===sn.Down?M.bottom-M.height/2:M.bottom,Math.max(S===sn.Down?M.top:M.top+M.height/2,m.y))},L=S===sn.Right&&!N||S===sn.Left&&!C,I=S===sn.Down&&!T||S===sn.Up&&!k;if(L&&q.x!==m.x){const $=w.scrollLeft+g.x,V=S===sn.Right&&$<=_.x||S===sn.Left&&$>=E.x;if(V&&!g.y){w.scrollTo({left:$,behavior:o});return}V?x.x=w.scrollLeft-$:x.x=S===sn.Right?w.scrollLeft-_.x:w.scrollLeft-E.x,x.x&&w.scrollBy({left:-x.x,behavior:o});break}else if(I&&q.y!==m.y){const $=w.scrollTop+g.y,V=S===sn.Down&&$<=_.y||S===sn.Up&&$>=E.y;if(V&&!g.x){w.scrollTo({top:$,behavior:o});return}V?x.y=w.scrollTop-$:x.y=S===sn.Down?w.scrollTop-_.y:w.scrollTop-E.y,x.y&&w.scrollBy({top:-x.y,behavior:o});break}}this.handleMove(e,ah(f0(m,this.referenceCoordinates),x))}}}handleMove(e,n){const{onMove:r}=this.props;e.preventDefault(),r(n)}handleEnd(e){const{onEnd:n}=this.props;e.preventDefault(),this.detach(),n()}handleCancel(e){const{onCancel:n}=this.props;e.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}wO.activators=[{eventName:"onKeyDown",handler:(t,e,n)=>{let{keyboardCodes:r=_F,onActivation:s}=e,{active:i}=n;const{code:a}=t.nativeEvent;if(r.start.includes(a)){const o=i.activatorNode.current;return o&&t.target!==o?!1:(t.preventDefault(),s?.({event:t.nativeEvent}),!0)}return!1}}];function HE(t){return!!(t&&"distance"in t)}function VE(t){return!!(t&&"delay"in t)}class SO{constructor(e,n,r){var s;r===void 0&&(r=Ffe(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=n;const{event:i}=e,{target:a}=i;this.props=e,this.events=n,this.document=Xh(a),this.documentListeners=new Rm(this.document),this.listeners=new Rm(r),this.windowListeners=new Rm(ci(a)),this.initialCoordinates=(s=HS(i))!=null?s:Ea,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:e,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(Wi.Resize,this.handleCancel),this.windowListeners.add(Wi.DragStart,QE),this.windowListeners.add(Wi.VisibilityChange,this.handleCancel),this.windowListeners.add(Wi.ContextMenu,QE),this.documentListeners.add(Wi.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(VE(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(HE(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,n){const{active:r,onPending:s}=this.props;s(r,e,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:e}=this,{onStart:n}=this.props;e&&(this.activated=!0,this.documentListeners.add(Wi.Click,$fe,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Wi.SelectionChange,this.removeTextSelection),n(e))}handleMove(e){var n;const{activated:r,initialCoordinates:s,props:i}=this,{onMove:a,options:{activationConstraint:o}}=i;if(!s)return;const c=(n=HS(e))!=null?n:Ea,h=f0(s,c);if(!r&&o){if(HE(o)){if(o.tolerance!=null&&Kw(h,o.tolerance))return this.handleCancel();if(Kw(h,o.distance))return this.handleStart()}if(VE(o)&&Kw(h,o.tolerance))return this.handleCancel();this.handlePending(o,h);return}e.cancelable&&e.preventDefault(),a(c)}handleEnd(){const{onAbort:e,onEnd:n}=this.props;this.detach(),this.activated||e(this.props.active),n()}handleCancel(){const{onAbort:e,onCancel:n}=this.props;this.detach(),this.activated||e(this.props.active),n()}handleKeydown(e){e.code===sn.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}}const Hfe={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class kO extends SO{constructor(e){const{event:n}=e,r=Xh(n.target);super(e,Hfe,r)}}kO.activators=[{eventName:"onPointerDown",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:r}=e;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];const Vfe={move:{name:"mousemove"},end:{name:"mouseup"}};var US;(function(t){t[t.RightClick=2]="RightClick"})(US||(US={}));class Ufe extends SO{constructor(e){super(e,Vfe,Xh(e.event.target))}}Ufe.activators=[{eventName:"onMouseDown",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:r}=e;return n.button===US.RightClick?!1:(r?.({event:n}),!0)}}];const Zw={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Wfe extends SO{constructor(e){super(e,Zw)}static setup(){return window.addEventListener(Zw.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(Zw.move.name,e)};function e(){}}}Wfe.activators=[{eventName:"onTouchStart",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:r}=e;const{touches:s}=n;return s.length>1?!1:(r?.({event:n}),!0)}}];var Dm;(function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"})(Dm||(Dm={}));var nv;(function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"})(nv||(nv={}));function Gfe(t){let{acceleration:e,activator:n=Dm.Pointer,canScroll:r,draggingRect:s,enabled:i,interval:a=5,order:o=nv.TreeOrder,pointerCoordinates:c,scrollableAncestors:h,scrollableAncestorRects:f,delta:m,threshold:g}=t;const x=Yfe({delta:m,disabled:!i}),[y,w]=afe(),S=b.useRef({x:0,y:0}),k=b.useRef({x:0,y:0}),N=b.useMemo(()=>{switch(n){case Dm.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case Dm.DraggableRect:return s}},[n,s,c]),C=b.useRef(null),T=b.useCallback(()=>{const E=C.current;if(!E)return;const M=S.current.x*k.current.x,q=S.current.y*k.current.y;E.scrollBy(M,q)},[]),_=b.useMemo(()=>o===nv.TreeOrder?[...h].reverse():h,[o,h]);b.useEffect(()=>{if(!i||!h.length||!N){w();return}for(const E of _){if(r?.(E)===!1)continue;const M=h.indexOf(E),q=f[M];if(!q)continue;const{direction:L,speed:I}=zfe(E,q,N,e,g);for(const $ of["x","y"])x[$][L[$]]||(I[$]=0,L[$]=0);if(I.x>0||I.y>0){w(),C.current=E,y(T,a),S.current=I,k.current=L;return}}S.current={x:0,y:0},k.current={x:0,y:0},w()},[e,T,r,w,i,a,JSON.stringify(N),JSON.stringify(x),y,h,_,f,JSON.stringify(g)])}const Xfe={x:{[Jr.Backward]:!1,[Jr.Forward]:!1},y:{[Jr.Backward]:!1,[Jr.Forward]:!1}};function Yfe(t){let{delta:e,disabled:n}=t;const r=QS(e);return sp(s=>{if(n||!r||!s)return Xfe;const i={x:Math.sign(e.x-r.x),y:Math.sign(e.y-r.y)};return{x:{[Jr.Backward]:s.x[Jr.Backward]||i.x===-1,[Jr.Forward]:s.x[Jr.Forward]||i.x===1},y:{[Jr.Backward]:s.y[Jr.Backward]||i.y===-1,[Jr.Forward]:s.y[Jr.Forward]||i.y===1}}},[n,e,r])}function Kfe(t,e){const n=e!=null?t.get(e):void 0,r=n?n.node.current:null;return sp(s=>{var i;return e==null?null:(i=r??s)!=null?i:null},[r,e])}function Zfe(t,e){return b.useMemo(()=>t.reduce((n,r)=>{const{sensor:s}=r,i=s.activators.map(a=>({eventName:a.eventName,handler:e(a.handler,r)}));return[...n,...i]},[]),[t,e])}var p0;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(p0||(p0={}));var WS;(function(t){t.Optimized="optimized"})(WS||(WS={}));const UE=new Map;function Jfe(t,e){let{dragging:n,dependencies:r,config:s}=e;const[i,a]=b.useState(null),{frequency:o,measure:c,strategy:h}=s,f=b.useRef(t),m=S(),g=h0(m),x=b.useCallback(function(k){k===void 0&&(k=[]),!g.current&&a(N=>N===null?k:N.concat(k.filter(C=>!N.includes(C))))},[g]),y=b.useRef(null),w=sp(k=>{if(m&&!n)return UE;if(!k||k===UE||f.current!==t||i!=null){const N=new Map;for(let C of t){if(!C)continue;if(i&&i.length>0&&!i.includes(C.id)&&C.rect.current){N.set(C.id,C.rect.current);continue}const T=C.node.current,_=T?new bO(c(T),T):null;C.rect.current=_,_&&N.set(C.id,_)}return N}return k},[t,i,n,m,c]);return b.useEffect(()=>{f.current=t},[t]),b.useEffect(()=>{m||x()},[n,m]),b.useEffect(()=>{i&&i.length>0&&a(null)},[JSON.stringify(i)]),b.useEffect(()=>{m||typeof o!="number"||y.current!==null||(y.current=setTimeout(()=>{x(),y.current=null},o))},[o,m,x,...r]),{droppableRects:w,measureDroppableContainers:x,measuringScheduled:i!=null};function S(){switch(h){case p0.Always:return!1;case p0.BeforeDragging:return n;default:return!n}}}function MF(t,e){return sp(n=>t?n||(typeof e=="function"?e(t):t):null,[e,t])}function eme(t,e){return MF(t,e)}function tme(t){let{callback:e,disabled:n}=t;const r=vO(e),s=b.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(r)},[r,n]);return b.useEffect(()=>()=>s?.disconnect(),[s]),s}function dy(t){let{callback:e,disabled:n}=t;const r=vO(e),s=b.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(r)},[n]);return b.useEffect(()=>()=>s?.disconnect(),[s]),s}function nme(t){return new bO(Yh(t),t)}function WE(t,e,n){e===void 0&&(e=nme);const[r,s]=b.useState(null);function i(){s(c=>{if(!t)return null;if(t.isConnected===!1){var h;return(h=c??n)!=null?h:null}const f=e(t);return JSON.stringify(c)===JSON.stringify(f)?c:f})}const a=tme({callback(c){if(t)for(const h of c){const{type:f,target:m}=h;if(f==="childList"&&m instanceof HTMLElement&&m.contains(t)){i();break}}}}),o=dy({callback:i});return ul(()=>{i(),t?(o?.observe(t),a?.observe(document.body,{childList:!0,subtree:!0})):(o?.disconnect(),a?.disconnect())},[t]),r}function rme(t){const e=MF(t);return kF(t,e)}const GE=[];function sme(t){const e=b.useRef(t),n=sp(r=>t?r&&r!==GE&&t&&e.current&&t.parentNode===e.current.parentNode?r:uy(t):GE,[t]);return b.useEffect(()=>{e.current=t},[t]),n}function ime(t){const[e,n]=b.useState(null),r=b.useRef(t),s=b.useCallback(i=>{const a=Yw(i.target);a&&n(o=>o?(o.set(a,VS(a)),new Map(o)):null)},[]);return b.useEffect(()=>{const i=r.current;if(t!==i){a(i);const o=t.map(c=>{const h=Yw(c);return h?(h.addEventListener("scroll",s,{passive:!0}),[h,VS(h)]):null}).filter(c=>c!=null);n(o.length?new Map(o):null),r.current=t}return()=>{a(t),a(i)};function a(o){o.forEach(c=>{const h=Yw(c);h?.removeEventListener("scroll",s)})}},[s,t]),b.useMemo(()=>t.length?e?Array.from(e.values()).reduce((i,a)=>ah(i,a),Ea):EF(t):Ea,[t,e])}function XE(t,e){e===void 0&&(e=[]);const n=b.useRef(null);return b.useEffect(()=>{n.current=null},e),b.useEffect(()=>{const r=t!==Ea;r&&!n.current&&(n.current=t),!r&&n.current&&(n.current=null)},[t]),n.current?f0(t,n.current):Ea}function ame(t){b.useEffect(()=>{if(!cy)return;const e=t.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of e)n?.()}},t.map(e=>{let{sensor:n}=e;return n}))}function lme(t,e){return b.useMemo(()=>t.reduce((n,r)=>{let{eventName:s,handler:i}=r;return n[s]=a=>{i(a,e)},n},{}),[t,e])}function AF(t){return b.useMemo(()=>t?Mfe(t):null,[t])}const YE=[];function ome(t,e){e===void 0&&(e=Yh);const[n]=t,r=AF(n?ci(n):null),[s,i]=b.useState(YE);function a(){i(()=>t.length?t.map(c=>CF(c)?r:new bO(e(c),c)):YE)}const o=dy({callback:a});return ul(()=>{o?.disconnect(),a(),t.forEach(c=>o?.observe(c))},[t]),s}function cme(t){if(!t)return null;if(t.children.length>1)return t;const e=t.children[0];return rp(e)?e:t}function ume(t){let{measure:e}=t;const[n,r]=b.useState(null),s=b.useCallback(h=>{for(const{target:f}of h)if(rp(f)){r(m=>{const g=e(f);return m?{...m,width:g.width,height:g.height}:g});break}},[e]),i=dy({callback:s}),a=b.useCallback(h=>{const f=cme(h);i?.disconnect(),f&&i?.observe(f),r(f?e(f):null)},[e,i]),[o,c]=ev(a);return b.useMemo(()=>({nodeRef:o,rect:n,setRef:c}),[n,o,c])}const dme=[{sensor:kO,options:{}},{sensor:wO,options:{}}],hme={current:{}},m1={draggable:{measure:$E},droppable:{measure:$E,strategy:p0.WhileDragging,frequency:WS.Optimized},dragOverlay:{measure:Yh}};class zm extends Map{get(e){var n;return e!=null&&(n=super.get(e))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:n}=e;return!n})}getNodeFor(e){var n,r;return(n=(r=this.get(e))==null?void 0:r.node.current)!=null?n:void 0}}const fme={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new zm,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:tv},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:m1,measureDroppableContainers:tv,windowRect:null,measuringScheduled:!1},mme={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:tv,draggableNodes:new Map,over:null,measureDroppableContainers:tv},hy=b.createContext(mme),RF=b.createContext(fme);function pme(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new zm}}}function gme(t,e){switch(e.type){case Vr.DragStart:return{...t,draggable:{...t.draggable,initialCoordinates:e.initialCoordinates,active:e.active}};case Vr.DragMove:return t.draggable.active==null?t:{...t,draggable:{...t.draggable,translate:{x:e.coordinates.x-t.draggable.initialCoordinates.x,y:e.coordinates.y-t.draggable.initialCoordinates.y}}};case Vr.DragEnd:case Vr.DragCancel:return{...t,draggable:{...t.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Vr.RegisterDroppable:{const{element:n}=e,{id:r}=n,s=new zm(t.droppable.containers);return s.set(r,n),{...t,droppable:{...t.droppable,containers:s}}}case Vr.SetDroppableDisabled:{const{id:n,key:r,disabled:s}=e,i=t.droppable.containers.get(n);if(!i||r!==i.key)return t;const a=new zm(t.droppable.containers);return a.set(n,{...i,disabled:s}),{...t,droppable:{...t.droppable,containers:a}}}case Vr.UnregisterDroppable:{const{id:n,key:r}=e,s=t.droppable.containers.get(n);if(!s||r!==s.key)return t;const i=new zm(t.droppable.containers);return i.delete(n),{...t,droppable:{...t.droppable,containers:i}}}default:return t}}function xme(t){let{disabled:e}=t;const{active:n,activatorEvent:r,draggableNodes:s}=b.useContext(hy),i=QS(r),a=QS(n?.id);return b.useEffect(()=>{if(!e&&!r&&i&&a!=null){if(!yO(i)||document.activeElement===i.target)return;const o=s.get(a);if(!o)return;const{activatorNode:c,node:h}=o;if(!c.current&&!h.current)return;requestAnimationFrame(()=>{for(const f of[c.current,h.current]){if(!f)continue;const m=cfe(f);if(m){m.focus();break}}})}},[r,e,s,a,i]),null}function vme(t,e){let{transform:n,...r}=e;return t!=null&&t.length?t.reduce((s,i)=>i({transform:s,...r}),n):n}function yme(t){return b.useMemo(()=>({draggable:{...m1.draggable,...t?.draggable},droppable:{...m1.droppable,...t?.droppable},dragOverlay:{...m1.dragOverlay,...t?.dragOverlay}}),[t?.draggable,t?.droppable,t?.dragOverlay])}function bme(t){let{activeNode:e,measure:n,initialRect:r,config:s=!0}=t;const i=b.useRef(!1),{x:a,y:o}=typeof s=="boolean"?{x:s,y:s}:s;ul(()=>{if(!a&&!o||!e){i.current=!1;return}if(i.current||!r)return;const h=e?.node.current;if(!h||h.isConnected===!1)return;const f=n(h),m=kF(f,r);if(a||(m.x=0),o||(m.y=0),i.current=!0,Math.abs(m.x)>0||Math.abs(m.y)>0){const g=OF(h);g&&g.scrollBy({top:m.y,left:m.x})}},[e,a,o,r,n])}const DF=b.createContext({...Ea,scaleX:1,scaleY:1});var lc;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})(lc||(lc={}));const wme=b.memo(function(e){var n,r,s,i;let{id:a,accessibility:o,autoScroll:c=!0,children:h,sensors:f=dme,collisionDetection:m=Ofe,measuring:g,modifiers:x,...y}=e;const w=b.useReducer(gme,void 0,pme),[S,k]=w,[N,C]=pfe(),[T,_]=b.useState(lc.Uninitialized),E=T===lc.Initialized,{draggable:{active:M,nodes:q,translate:L},droppable:{containers:I}}=S,$=M!=null?q.get(M):null,V=b.useRef({initial:null,translated:null}),ee=b.useMemo(()=>{var Vt;return M!=null?{id:M,data:(Vt=$?.data)!=null?Vt:hme,rect:V}:null},[M,$]),z=b.useRef(null),[H,P]=b.useState(null),[W,J]=b.useState(null),X=h0(y,Object.values(y)),R=ip("DndDescribedBy",a),se=b.useMemo(()=>I.getEnabled(),[I]),G=yme(g),{droppableRects:F,measureDroppableContainers:U,measuringScheduled:te}=Jfe(se,{dragging:E,dependencies:[L.x,L.y],config:G.droppable}),ne=Kfe(q,M),Y=b.useMemo(()=>W?HS(W):null,[W]),ae=Gt(),re=eme(ne,G.draggable.measure);bme({activeNode:M!=null?q.get(M):null,config:ae.layoutShiftCompensation,initialRect:re,measure:G.draggable.measure});const le=WE(ne,G.draggable.measure,re),_e=WE(ne?ne.parentElement:null),Ge=b.useRef({activatorEvent:null,active:null,activeNode:ne,collisionRect:null,collisions:null,droppableRects:F,draggableNodes:q,draggingNode:null,draggingNodeRect:null,droppableContainers:I,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),tt=I.getNodeFor((n=Ge.current.over)==null?void 0:n.id),Xe=ume({measure:G.dragOverlay.measure}),je=(r=Xe.nodeRef.current)!=null?r:ne,Qe=E?(s=Xe.rect)!=null?s:le:null,He=!!(Xe.nodeRef.current&&Xe.rect),$e=rme(He?null:le),bt=AF(je?ci(je):null),lt=sme(E?tt??ne:null),xn=ome(lt),_n=vme(x,{transform:{x:L.x-$e.x,y:L.y-$e.y,scaleX:1,scaleY:1},activatorEvent:W,active:ee,activeNodeRect:le,containerNodeRect:_e,draggingNodeRect:Qe,over:Ge.current.over,overlayNodeRect:Xe.rect,scrollableAncestors:lt,scrollableAncestorRects:xn,windowRect:bt}),Cn=Y?ah(Y,L):null,Dt=ime(lt),xt=XE(Dt),Te=XE(Dt,[le]),Re=ah(_n,xt),qe=Qe?Cfe(Qe,_n):null,rt=ee&&qe?m({active:ee,collisionRect:qe,droppableRects:F,droppableContainers:se,pointerCoordinates:Cn}):null,wt=SF(rt,"id"),[jt,Ne]=b.useState(null),ie=He?_n:ah(_n,Te),xe=jfe(ie,(i=jt?.rect)!=null?i:null,le),Je=b.useRef(null),dt=b.useCallback((Vt,ot)=>{let{sensor:mr,options:Yr}=ot;if(z.current==null)return;const Kr=q.get(z.current);if(!Kr)return;const pr=Vt.nativeEvent,Cr=new mr({active:z.current,activeNode:Kr,event:pr,options:Yr,context:Ge,onAbort(wr){if(!q.get(wr))return;const{onDragAbort:Cs}=X.current,qs={id:wr};Cs?.(qs),N({type:"onDragAbort",event:qs})},onPending(wr,hi,Cs,qs){if(!q.get(wr))return;const{onDragPending:pa}=X.current,fi={id:wr,constraint:hi,initialCoordinates:Cs,offset:qs};pa?.(fi),N({type:"onDragPending",event:fi})},onStart(wr){const hi=z.current;if(hi==null)return;const Cs=q.get(hi);if(!Cs)return;const{onDragStart:qs}=X.current,ma={activatorEvent:pr,active:{id:hi,data:Cs.data,rect:V}};hu.unstable_batchedUpdates(()=>{qs?.(ma),_(lc.Initializing),k({type:Vr.DragStart,initialCoordinates:wr,active:hi}),N({type:"onDragStart",event:ma}),P(Je.current),J(pr)})},onMove(wr){k({type:Vr.DragMove,coordinates:wr})},onEnd:Bs(Vr.DragEnd),onCancel:Bs(Vr.DragCancel)});Je.current=Cr;function Bs(wr){return async function(){const{active:Cs,collisions:qs,over:ma,scrollAdjustedTranslate:pa}=Ge.current;let fi=null;if(Cs&&pa){const{cancelDrop:Pa}=X.current;fi={activatorEvent:pr,active:Cs,collisions:qs,delta:pa,over:ma},wr===Vr.DragEnd&&typeof Pa=="function"&&await Promise.resolve(Pa(fi))&&(wr=Vr.DragCancel)}z.current=null,hu.unstable_batchedUpdates(()=>{k({type:wr}),_(lc.Uninitialized),Ne(null),P(null),J(null),Je.current=null;const Pa=wr===Vr.DragEnd?"onDragEnd":"onDragCancel";if(fi){const Fs=X.current[Pa];Fs?.(fi),N({type:Pa,event:fi})}})}}},[q]),er=b.useCallback((Vt,ot)=>(mr,Yr)=>{const Kr=mr.nativeEvent,pr=q.get(Yr);if(z.current!==null||!pr||Kr.dndKit||Kr.defaultPrevented)return;const Cr={active:pr};Vt(mr,ot.options,Cr)===!0&&(Kr.dndKit={capturedBy:ot.sensor},z.current=Yr,dt(mr,ot))},[q,dt]),pt=Zfe(f,er);ame(f),ul(()=>{le&&T===lc.Initializing&&_(lc.Initialized)},[le,T]),b.useEffect(()=>{const{onDragMove:Vt}=X.current,{active:ot,activatorEvent:mr,collisions:Yr,over:Kr}=Ge.current;if(!ot||!mr)return;const pr={active:ot,activatorEvent:mr,collisions:Yr,delta:{x:Re.x,y:Re.y},over:Kr};hu.unstable_batchedUpdates(()=>{Vt?.(pr),N({type:"onDragMove",event:pr})})},[Re.x,Re.y]),b.useEffect(()=>{const{active:Vt,activatorEvent:ot,collisions:mr,droppableContainers:Yr,scrollAdjustedTranslate:Kr}=Ge.current;if(!Vt||z.current==null||!ot||!Kr)return;const{onDragOver:pr}=X.current,Cr=Yr.get(wt),Bs=Cr&&Cr.rect.current?{id:Cr.id,rect:Cr.rect.current,data:Cr.data,disabled:Cr.disabled}:null,wr={active:Vt,activatorEvent:ot,collisions:mr,delta:{x:Kr.x,y:Kr.y},over:Bs};hu.unstable_batchedUpdates(()=>{Ne(Bs),pr?.(wr),N({type:"onDragOver",event:wr})})},[wt]),ul(()=>{Ge.current={activatorEvent:W,active:ee,activeNode:ne,collisionRect:qe,collisions:rt,droppableRects:F,draggableNodes:q,draggingNode:je,draggingNodeRect:Qe,droppableContainers:I,over:jt,scrollableAncestors:lt,scrollAdjustedTranslate:Re},V.current={initial:Qe,translated:qe}},[ee,ne,rt,qe,q,je,Qe,F,I,jt,lt,Re]),Gfe({...ae,delta:L,draggingRect:qe,pointerCoordinates:Cn,scrollableAncestors:lt,scrollableAncestorRects:xn});const kn=b.useMemo(()=>({active:ee,activeNode:ne,activeNodeRect:le,activatorEvent:W,collisions:rt,containerNodeRect:_e,dragOverlay:Xe,draggableNodes:q,droppableContainers:I,droppableRects:F,over:jt,measureDroppableContainers:U,scrollableAncestors:lt,scrollableAncestorRects:xn,measuringConfiguration:G,measuringScheduled:te,windowRect:bt}),[ee,ne,le,W,rt,_e,Xe,q,I,F,jt,U,lt,xn,G,te,bt]),vt=b.useMemo(()=>({activatorEvent:W,activators:pt,active:ee,activeNodeRect:le,ariaDescribedById:{draggable:R},dispatch:k,draggableNodes:q,over:jt,measureDroppableContainers:U}),[W,pt,ee,le,k,R,q,jt,U]);return he.createElement(yF.Provider,{value:C},he.createElement(hy.Provider,{value:vt},he.createElement(RF.Provider,{value:kn},he.createElement(DF.Provider,{value:xe},h)),he.createElement(xme,{disabled:o?.restoreFocus===!1})),he.createElement(vfe,{...o,hiddenTextDescribedById:R}));function Gt(){const Vt=H?.autoScrollEnabled===!1,ot=typeof c=="object"?c.enabled===!1:c===!1,mr=E&&!Vt&&!ot;return typeof c=="object"?{...c,enabled:mr}:{enabled:mr}}}),Sme=b.createContext(null),KE="button",kme="Draggable";function Ome(t){let{id:e,data:n,disabled:r=!1,attributes:s}=t;const i=ip(kme),{activators:a,activatorEvent:o,active:c,activeNodeRect:h,ariaDescribedById:f,draggableNodes:m,over:g}=b.useContext(hy),{role:x=KE,roleDescription:y="draggable",tabIndex:w=0}=s??{},S=c?.id===e,k=b.useContext(S?DF:Sme),[N,C]=ev(),[T,_]=ev(),E=lme(a,e),M=h0(n);ul(()=>(m.set(e,{id:e,key:i,node:N,activatorNode:T,data:M}),()=>{const L=m.get(e);L&&L.key===i&&m.delete(e)}),[m,e]);const q=b.useMemo(()=>({role:x,tabIndex:w,"aria-disabled":r,"aria-pressed":S&&x===KE?!0:void 0,"aria-roledescription":y,"aria-describedby":f.draggable}),[r,x,w,S,y,f.draggable]);return{active:c,activatorEvent:o,activeNodeRect:h,attributes:q,isDragging:S,listeners:r?void 0:E,node:N,over:g,setNodeRef:C,setActivatorNodeRef:_,transform:k}}function jme(){return b.useContext(RF)}const Nme="Droppable",Cme={timeout:25};function Tme(t){let{data:e,disabled:n=!1,id:r,resizeObserverConfig:s}=t;const i=ip(Nme),{active:a,dispatch:o,over:c,measureDroppableContainers:h}=b.useContext(hy),f=b.useRef({disabled:n}),m=b.useRef(!1),g=b.useRef(null),x=b.useRef(null),{disabled:y,updateMeasurementsFor:w,timeout:S}={...Cme,...s},k=h0(w??r),N=b.useCallback(()=>{if(!m.current){m.current=!0;return}x.current!=null&&clearTimeout(x.current),x.current=setTimeout(()=>{h(Array.isArray(k.current)?k.current:[k.current]),x.current=null},S)},[S]),C=dy({callback:N,disabled:y||!a}),T=b.useCallback((q,L)=>{C&&(L&&(C.unobserve(L),m.current=!1),q&&C.observe(q))},[C]),[_,E]=ev(T),M=h0(e);return b.useEffect(()=>{!C||!_.current||(C.disconnect(),m.current=!1,C.observe(_.current))},[_,C]),b.useEffect(()=>(o({type:Vr.RegisterDroppable,element:{id:r,key:i,disabled:n,node:_,rect:g,data:M}}),()=>o({type:Vr.UnregisterDroppable,key:i,id:r})),[r]),b.useEffect(()=>{n!==f.current.disabled&&(o({type:Vr.SetDroppableDisabled,id:r,key:i,disabled:n}),f.current.disabled=n)},[r,i,n,o]),{active:a,rect:g,isOver:c?.id===r,node:_,over:c,setNodeRef:E}}function OO(t,e,n){const r=t.slice();return r.splice(n<0?r.length+n:n,0,r.splice(e,1)[0]),r}function Eme(t,e){return t.reduce((n,r,s)=>{const i=e.get(r);return i&&(n[s]=i),n},Array(t.length))}function wx(t){return t!==null&&t>=0}function _me(t,e){if(t===e)return!0;if(t.length!==e.length)return!1;for(let n=0;n{var e;let{rects:n,activeNodeRect:r,activeIndex:s,overIndex:i,index:a}=t;const o=(e=n[s])!=null?e:r;if(!o)return null;const c=Rme(n,a,s);if(a===s){const h=n[i];return h?{x:ss&&a<=i?{x:-o.width-c,y:0,...Sx}:a=i?{x:o.width+c,y:0,...Sx}:{x:0,y:0,...Sx}};function Rme(t,e,n){const r=t[e],s=t[e-1],i=t[e+1];return!r||!s&&!i?0:n{let{rects:e,activeIndex:n,overIndex:r,index:s}=t;const i=OO(e,r,n),a=e[s],o=i[s];return!o||!a?null:{x:o.left-a.left,y:o.top-a.top,scaleX:o.width/a.width,scaleY:o.height/a.height}},PF="Sortable",LF=he.createContext({activeIndex:-1,containerId:PF,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:zF,disabled:{draggable:!1,droppable:!1}});function Dme(t){let{children:e,id:n,items:r,strategy:s=zF,disabled:i=!1}=t;const{active:a,dragOverlay:o,droppableRects:c,over:h,measureDroppableContainers:f}=jme(),m=ip(PF,n),g=o.rect!==null,x=b.useMemo(()=>r.map(E=>typeof E=="object"&&"id"in E?E.id:E),[r]),y=a!=null,w=a?x.indexOf(a.id):-1,S=h?x.indexOf(h.id):-1,k=b.useRef(x),N=!_me(x,k.current),C=S!==-1&&w===-1||N,T=Mme(i);ul(()=>{N&&y&&f(x)},[N,x,y,f]),b.useEffect(()=>{k.current=x},[x]);const _=b.useMemo(()=>({activeIndex:w,containerId:m,disabled:T,disableTransforms:C,items:x,overIndex:S,useDragOverlay:g,sortedRects:Eme(x,c),strategy:s}),[w,m,T.draggable,T.droppable,C,x,S,c,g,s]);return he.createElement(LF.Provider,{value:_},e)}const zme=t=>{let{id:e,items:n,activeIndex:r,overIndex:s}=t;return OO(n,r,s).indexOf(e)},Pme=t=>{let{containerId:e,isSorting:n,wasDragging:r,index:s,items:i,newIndex:a,previousItems:o,previousContainerId:c,transition:h}=t;return!h||!r||o!==i&&s===a?!1:n?!0:a!==s&&e===c},Lme={duration:200,easing:"ease"},IF="transform",Ime=m0.Transition.toString({property:IF,duration:0,easing:"linear"}),Bme={roleDescription:"sortable"};function qme(t){let{disabled:e,index:n,node:r,rect:s}=t;const[i,a]=b.useState(null),o=b.useRef(n);return ul(()=>{if(!e&&n!==o.current&&r.current){const c=s.current;if(c){const h=Yh(r.current,{ignoreTransform:!0}),f={x:c.left-h.left,y:c.top-h.top,scaleX:c.width/h.width,scaleY:c.height/h.height};(f.x||f.y)&&a(f)}}n!==o.current&&(o.current=n)},[e,n,r,s]),b.useEffect(()=>{i&&a(null)},[i]),i}function Fme(t){let{animateLayoutChanges:e=Pme,attributes:n,disabled:r,data:s,getNewIndex:i=zme,id:a,strategy:o,resizeObserverConfig:c,transition:h=Lme}=t;const{items:f,containerId:m,activeIndex:g,disabled:x,disableTransforms:y,sortedRects:w,overIndex:S,useDragOverlay:k,strategy:N}=b.useContext(LF),C=$me(r,x),T=f.indexOf(a),_=b.useMemo(()=>({sortable:{containerId:m,index:T,items:f},...s}),[m,s,T,f]),E=b.useMemo(()=>f.slice(f.indexOf(a)),[f,a]),{rect:M,node:q,isOver:L,setNodeRef:I}=Tme({id:a,data:_,disabled:C.droppable,resizeObserverConfig:{updateMeasurementsFor:E,...c}}),{active:$,activatorEvent:V,activeNodeRect:ee,attributes:z,setNodeRef:H,listeners:P,isDragging:W,over:J,setActivatorNodeRef:X,transform:R}=Ome({id:a,data:_,attributes:{...Bme,...n},disabled:C.draggable}),se=ife(I,H),G=!!$,F=G&&!y&&wx(g)&&wx(S),U=!k&&W,te=U&&F?R:null,Y=F?te??(o??N)({rects:w,activeNodeRect:ee,activeIndex:g,overIndex:S,index:T}):null,ae=wx(g)&&wx(S)?i({id:a,items:f,activeIndex:g,overIndex:S}):T,re=$?.id,le=b.useRef({activeId:re,items:f,newIndex:ae,containerId:m}),_e=f!==le.current.items,Ge=e({active:$,containerId:m,isDragging:W,isSorting:G,id:a,index:T,items:f,newIndex:le.current.newIndex,previousItems:le.current.items,previousContainerId:le.current.containerId,transition:h,wasDragging:le.current.activeId!=null}),tt=qme({disabled:!Ge,index:T,node:q,rect:M});return b.useEffect(()=>{G&&le.current.newIndex!==ae&&(le.current.newIndex=ae),m!==le.current.containerId&&(le.current.containerId=m),f!==le.current.items&&(le.current.items=f)},[G,ae,m,f]),b.useEffect(()=>{if(re===le.current.activeId)return;if(re!=null&&le.current.activeId==null){le.current.activeId=re;return}const je=setTimeout(()=>{le.current.activeId=re},50);return()=>clearTimeout(je)},[re]),{active:$,activeIndex:g,attributes:z,data:_,rect:M,index:T,newIndex:ae,items:f,isOver:L,isSorting:G,isDragging:W,listeners:P,node:q,overIndex:S,over:J,setNodeRef:se,setActivatorNodeRef:X,setDroppableNodeRef:I,setDraggableNodeRef:H,transform:tt??Y,transition:Xe()};function Xe(){if(tt||_e&&le.current.newIndex===T)return Ime;if(!(U&&!yO(V)||!h)&&(G||Ge))return m0.Transition.toString({...h,property:IF})}}function $me(t,e){var n,r;return typeof t=="boolean"?{draggable:t,droppable:!1}:{draggable:(n=t?.draggable)!=null?n:e.draggable,droppable:(r=t?.droppable)!=null?r:e.droppable}}function rv(t){if(!t)return!1;const e=t.data.current;return!!(e&&"sortable"in e&&typeof e.sortable=="object"&&"containerId"in e.sortable&&"items"in e.sortable&&"index"in e.sortable)}const Qme=[sn.Down,sn.Right,sn.Up,sn.Left],Hme=(t,e)=>{let{context:{active:n,collisionRect:r,droppableRects:s,droppableContainers:i,over:a,scrollableAncestors:o}}=e;if(Qme.includes(t.code)){if(t.preventDefault(),!n||!r)return;const c=[];i.getEnabled().forEach(m=>{if(!m||m!=null&&m.disabled)return;const g=s.get(m.id);if(g)switch(t.code){case sn.Down:r.topg.top&&c.push(m);break;case sn.Left:r.left>g.left&&c.push(m);break;case sn.Right:r.left1&&(f=h[1].id),f!=null){const m=i.get(n.id),g=i.get(f),x=g?s.get(g.id):null,y=g?.node.current;if(y&&x&&m&&g){const S=uy(y).some((E,M)=>o[M]!==E),k=BF(m,g),N=Vme(m,g),C=S||!k?{x:0,y:0}:{x:N?r.width-x.width:0,y:N?r.height-x.height:0},T={x:x.left,y:x.top};return C.x&&C.y?T:f0(T,C)}}}};function BF(t,e){return!rv(t)||!rv(e)?!1:t.data.current.sortable.containerId===e.data.current.sortable.containerId}function Vme(t,e){return!rv(t)||!rv(e)||!BF(t,e)?!1:t.data.current.sortable.index{f.stopPropagation(),n(t)}})]})})}function Wme({options:t,selected:e,onChange:n,placeholder:r="选择选项...",emptyText:s="未找到选项",className:i}){const[a,o]=b.useState(!1),c=yfe(BE(kO,{activationConstraint:{distance:8}}),BE(wO,{coordinateGetter:Hme})),h=g=>{e.includes(g)?n(e.filter(x=>x!==g)):n([...e,g])},f=g=>{n(e.filter(x=>x!==g))},m=g=>{const{active:x,over:y}=g;if(y&&x.id!==y.id){const w=e.indexOf(x.id),S=e.indexOf(y.id);n(OO(e,w,S))}};return l.jsxs(uo,{open:a,onOpenChange:o,children:[l.jsx(ho,{asChild:!0,children:l.jsxs(fe,{variant:"outline",role:"combobox","aria-expanded":a,className:ye("w-full justify-between min-h-10 h-auto",i),children:[l.jsx(wme,{sensors:c,collisionDetection:wfe,onDragEnd:m,children:l.jsx(Dme,{items:e,strategy:Ame,children:l.jsx("div",{className:"flex gap-1 flex-wrap flex-1",children:e.length===0?l.jsx("span",{className:"text-muted-foreground",children:r}):e.map(g=>{const x=t.find(y=>y.value===g);return l.jsx(Ume,{value:g,label:x?.label||g,onRemove:f},g)})})})}),l.jsx(iz,{className:"ml-2 h-4 w-4 shrink-0 opacity-50",strokeWidth:2,fill:"none"})]})}),l.jsx(ol,{className:"w-full p-0",align:"start",children:l.jsxs(uO,{children:[l.jsx(dO,{placeholder:"搜索...",className:"h-9"}),l.jsxs(hO,{children:[l.jsx(fO,{children:s}),l.jsx(mO,{children:t.map(g=>{const x=e.includes(g.value);return l.jsxs(pO,{value:g.value,onSelect:()=>h(g.value),children:[l.jsx("div",{className:ye("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",x?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:l.jsx(so,{className:"h-3 w-3",strokeWidth:2,fill:"none"})}),l.jsx("span",{children:g.label})]},g.value)})})]})]})})]})}function Gme(){const[t,e]=b.useState([]),[n,r]=b.useState([]),[s,i]=b.useState([]),[a,o]=b.useState(null),[c,h]=b.useState(!0),[f,m]=b.useState(!1),[g,x]=b.useState(!1),[y,w]=b.useState(!1),[S,k]=b.useState(!1),[N,C]=b.useState(!1),[T,_]=b.useState(!1),[E,M]=b.useState(null),[q,L]=b.useState(null),[I,$]=b.useState(!1),[V,ee]=b.useState(null),[z,H]=b.useState(""),[P,W]=b.useState(new Set),[J,X]=b.useState(!1),[R,se]=b.useState(1),[G,F]=b.useState(20),[U,te]=b.useState(""),{toast:ne}=Gr(),Y=b.useRef(null),ae=b.useRef(null),re=b.useRef(!0);b.useEffect(()=>{le()},[]);const le=async()=>{try{h(!0);const ie=await Jd(),xe=ie.models||[];e(xe),i(xe.map(dt=>dt.name));const Je=ie.api_providers||[];r(Je.map(dt=>dt.name)),o(ie.model_task_config||null),w(!1),re.current=!1}catch(ie){console.error("加载配置失败:",ie)}finally{h(!1)}},_e=async()=>{try{k(!0),Hv().catch(()=>{}),C(!0)}catch(ie){console.error("重启失败:",ie),C(!1),ne({title:"重启失败",description:"无法发送重启请求,请手动重启",variant:"destructive"}),k(!1)}},Ge=async()=>{try{m(!0),Y.current&&clearTimeout(Y.current),ae.current&&clearTimeout(ae.current);const ie=await Jd();ie.models=t,ie.model_task_config=a,await M1(ie),w(!1),ne({title:"保存成功",description:"正在重启麦麦..."}),await _e()}catch(ie){console.error("保存配置失败:",ie),ne({title:"保存失败",description:ie.message,variant:"destructive"}),m(!1)}},tt=()=>{localStorage.removeItem("access-token"),window.location.href="/auth"},Xe=()=>{C(!1),k(!1),ne({title:"重启超时",description:"服务未能在预期时间内恢复,请手动检查或刷新页面",variant:"destructive"})},je=b.useCallback(async ie=>{if(!re.current)try{x(!0),await Q3("models",ie),w(!1)}catch(xe){console.error("自动保存模型列表失败:",xe),w(!0)}finally{x(!1)}},[]),Qe=b.useCallback(async ie=>{if(!re.current)try{x(!0),await Q3("model_task_config",ie),w(!1)}catch(xe){console.error("自动保存任务配置失败:",xe),w(!0)}finally{x(!1)}},[]);b.useEffect(()=>{if(!re.current)return w(!0),Y.current&&clearTimeout(Y.current),Y.current=setTimeout(()=>{je(t)},2e3),()=>{Y.current&&clearTimeout(Y.current)}},[t,je]),b.useEffect(()=>{if(!(re.current||!a))return w(!0),ae.current&&clearTimeout(ae.current),ae.current=setTimeout(()=>{Qe(a)},2e3),()=>{ae.current&&clearTimeout(ae.current)}},[a,Qe]);const He=async()=>{try{m(!0),Y.current&&clearTimeout(Y.current),ae.current&&clearTimeout(ae.current);const ie=await Jd();ie.models=t,ie.model_task_config=a,await M1(ie),w(!1),ne({title:"保存成功",description:"模型配置已保存"}),await le()}catch(ie){console.error("保存配置失败:",ie),ne({title:"保存失败",description:ie.message,variant:"destructive"})}finally{m(!1)}},$e=(ie,xe)=>{M(ie||{model_identifier:"",name:"",api_provider:n[0]||"",price_in:0,price_out:0,force_stream_mode:!1,extra_params:{}}),L(xe),_(!0)},bt=()=>{if(!E)return;const ie={...E,price_in:E.price_in??0,price_out:E.price_out??0};let xe;q!==null?(xe=[...t],xe[q]=ie):xe=[...t,ie],e(xe),i(xe.map(Je=>Je.name)),_(!1),M(null),L(null)},lt=ie=>{if(!ie&&E){const xe={...E,price_in:E.price_in??0,price_out:E.price_out??0};M(xe)}_(ie)},xn=ie=>{ee(ie),$(!0)},_n=()=>{if(V!==null){const ie=t.filter((xe,Je)=>Je!==V);e(ie),i(ie.map(xe=>xe.name)),ne({title:"删除成功",description:"模型已从列表中移除"})}$(!1),ee(null)},Cn=ie=>{const xe=new Set(P);xe.has(ie)?xe.delete(ie):xe.add(ie),W(xe)},Dt=()=>{if(P.size===qe.length)W(new Set);else{const ie=qe.map((xe,Je)=>t.findIndex(dt=>dt===qe[Je]));W(new Set(ie))}},xt=()=>{if(P.size===0){ne({title:"提示",description:"请先选择要删除的模型",variant:"default"});return}X(!0)},Te=()=>{const ie=t.filter((xe,Je)=>!P.has(Je));e(ie),i(ie.map(xe=>xe.name)),W(new Set),X(!1),ne({title:"批量删除成功",description:`已删除 ${P.size} 个模型`})},Re=(ie,xe,Je)=>{a&&o({...a,[ie]:{...a[ie],[xe]:Je}})},qe=t.filter(ie=>{if(!z)return!0;const xe=z.toLowerCase();return ie.name.toLowerCase().includes(xe)||ie.model_identifier.toLowerCase().includes(xe)||ie.api_provider.toLowerCase().includes(xe)}),rt=Math.ceil(qe.length/G),wt=qe.slice((R-1)*G,R*G),jt=()=>{const ie=parseInt(U);ie>=1&&ie<=rt&&(se(ie),te(""))},Ne=ie=>a?[a.utils?.model_list||[],a.utils_small?.model_list||[],a.tool_use?.model_list||[],a.replyer?.model_list||[],a.planner?.model_list||[],a.vlm?.model_list||[],a.voice?.model_list||[],a.embedding?.model_list||[],a.lpmm_entity_extract?.model_list||[],a.lpmm_rdf_build?.model_list||[],a.lpmm_qa?.model_list||[]].some(Je=>Je.includes(ie)):!1;return c?l.jsx(on,{className:"h-full",children:l.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:l.jsx("div",{className:"flex items-center justify-center h-64",children:l.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})})}):l.jsx(on,{className:"h-full",children:l.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[l.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[l.jsxs("div",{children:[l.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"模型管理与分配"}),l.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"添加模型并为模型分配功能"})]}),l.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[l.jsxs(fe,{onClick:He,disabled:f||g||!y||S,size:"sm",variant:"outline",className:"flex-1 sm:flex-none",children:[l.jsx(Rv,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),f?"保存中...":g?"自动保存中...":y?"保存配置":"已保存"]}),l.jsxs(wn,{children:[l.jsx(Lr,{asChild:!0,children:l.jsxs(fe,{disabled:f||g||S,size:"sm",className:"flex-1 sm:flex-none",children:[l.jsx(e6,{className:"mr-2 h-4 w-4"}),S?"重启中...":y?"保存并重启":"重启麦麦"]})}),l.jsxs(un,{children:[l.jsxs(dn,{children:[l.jsx(fn,{children:"确认重启麦麦?"}),l.jsx(mn,{className:"space-y-3",asChild:!0,children:l.jsxs("div",{children:[l.jsx("p",{children:y?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"}),l.jsxs(il,{className:"border-yellow-500/50 bg-yellow-500/10",children:[l.jsx(Oa,{className:"h-4 w-4 text-yellow-600"}),l.jsxs(al,{className:"text-yellow-900 dark:text-yellow-100",children:[l.jsx("strong",{children:"重要提示:"}),"由于技术原因,使用重启功能后,将无法再使用 ",l.jsx("code",{className:"px-1 py-0.5 bg-yellow-200 dark:bg-yellow-900 rounded",children:"Ctrl+C"})," 结束程序。",l.jsxs(fr,{children:[l.jsx(Bh,{asChild:!0,children:l.jsxs("button",{className:"ml-1 text-yellow-700 dark:text-yellow-300 underline hover:text-yellow-800 dark:hover:text-yellow-200 inline-flex items-center gap-1",children:[l.jsx(Av,{className:"h-3 w-3"}),"如何结束程序?"]})}),l.jsxs(rr,{className:"max-w-2xl",children:[l.jsxs(sr,{children:[l.jsx(ir,{children:"如何结束使用重启功能后的麦麦程序"}),l.jsx(Ir,{children:"由于重启功能会使程序脱离终端控制,需要通过系统命令来结束进程"})]}),l.jsxs(na,{defaultValue:"windows",className:"w-full",children:[l.jsxs(_i,{className:"grid w-full grid-cols-3",children:[l.jsx(Et,{value:"windows",children:"Windows"}),l.jsx(Et,{value:"macos",children:"macOS"}),l.jsx(Et,{value:"linux",children:"Linux"})]}),l.jsxs(Kt,{value:"windows",className:"space-y-4 mt-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"font-semibold",children:"方法一:使用任务管理器"}),l.jsxs("ol",{className:"list-decimal list-inside space-y-1 text-sm text-muted-foreground",children:[l.jsxs("li",{children:["按 ",l.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"Ctrl + Shift + Esc"})," 打开任务管理器"]}),l.jsxs("li",{children:['在"进程"或"详细信息"标签页中找到 ',l.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"python.exe"})]}),l.jsx("li",{children:'右键点击并选择"结束任务"'})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"font-semibold",children:"方法二:使用命令行"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"打开 PowerShell 或命令提示符,执行以下命令:"}),l.jsxs("div",{className:"bg-muted p-3 rounded-md font-mono text-sm",children:[l.jsx("p",{children:"# 查找麦麦进程"}),l.jsx("p",{children:'Get-Process python | Where-Object {$_.MainWindowTitle -eq ""}'}),l.jsx("p",{className:"mt-2",children:"# 结束所有 Python 进程(谨慎使用)"}),l.jsx("p",{children:"Stop-Process -Name python -Force"})]})]})]}),l.jsxs(Kt,{value:"macos",className:"space-y-4 mt-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"font-semibold",children:"方法一:使用活动监视器"}),l.jsxs("ol",{className:"list-decimal list-inside space-y-1 text-sm text-muted-foreground",children:[l.jsxs("li",{children:["按 ",l.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"Cmd + Space"}),' 打开 Spotlight,搜索"活动监视器"']}),l.jsxs("li",{children:["在进程列表中找到 ",l.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"Python"})]}),l.jsx("li",{children:"选中后点击左上角的 X 按钮结束进程"})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"font-semibold",children:"方法二:使用终端"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"打开终端,执行以下命令:"}),l.jsxs("div",{className:"bg-muted p-3 rounded-md font-mono text-sm",children:[l.jsx("p",{children:"# 查找麦麦进程"}),l.jsx("p",{children:"ps aux | grep python | grep -v grep"}),l.jsx("p",{className:"mt-2",children:"# 结束指定 PID 的进程"}),l.jsx("p",{children:"kill -9 "}),l.jsx("p",{className:"mt-2",children:"# 或结束所有 Python 进程(谨慎使用)"}),l.jsx("p",{children:"pkill -9 python"})]})]})]}),l.jsxs(Kt,{value:"linux",className:"space-y-4 mt-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"font-semibold",children:"使用终端命令"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"打开终端,执行以下命令:"}),l.jsxs("div",{className:"bg-muted p-3 rounded-md font-mono text-sm",children:[l.jsx("p",{children:"# 查找麦麦进程"}),l.jsx("p",{children:"ps aux | grep python | grep -v grep"}),l.jsx("p",{className:"mt-2",children:"# 结束指定 PID 的进程"}),l.jsx("p",{children:"kill -9 "}),l.jsx("p",{className:"mt-2",children:"# 或使用 pkill 按名称结束"}),l.jsx("p",{children:'pkill -9 -f "bot.py"'}),l.jsx("p",{className:"mt-2",children:"# 或结束所有 Python 进程(谨慎使用)"}),l.jsx("p",{children:"pkill -9 python"})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"font-semibold",children:"使用 htop(如已安装)"}),l.jsxs("ol",{className:"list-decimal list-inside space-y-1 text-sm text-muted-foreground",children:[l.jsxs("li",{children:["在终端输入 ",l.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"htop"})]}),l.jsxs("li",{children:["按 ",l.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"F3"})," 搜索 python"]}),l.jsxs("li",{children:["按 ",l.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"F9"})," 发送信号,选择 SIGKILL"]})]})]})]})]}),l.jsx(ts,{children:l.jsx(g6,{asChild:!0,children:l.jsx(fe,{variant:"outline",children:"关闭"})})})]})]})]})]})]})})]}),l.jsxs(hn,{children:[l.jsx(gn,{children:"取消"}),l.jsx(pn,{onClick:y?Ge:_e,children:y?"保存并重启":"确认重启"})]})]})]})]})]}),l.jsxs(il,{children:[l.jsx(Oa,{className:"h-4 w-4"}),l.jsxs(al,{children:["配置更新后需要",l.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),l.jsxs(na,{defaultValue:"models",className:"w-full",children:[l.jsxs(_i,{className:"grid w-full max-w-full sm:max-w-md grid-cols-2",children:[l.jsx(Et,{value:"models",children:"添加模型"}),l.jsx(Et,{value:"tasks",children:"为模型分配功能"})]}),l.jsxs(Kt,{value:"models",className:"space-y-4 mt-0",children:[l.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-2",children:[l.jsx("p",{className:"text-sm text-muted-foreground",children:"配置可用的模型列表"}),l.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[P.size>0&&l.jsxs(fe,{onClick:xt,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[l.jsx(ln,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"批量删除 (",P.size,")"]}),l.jsxs(fe,{onClick:()=>$e(null,null),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[l.jsx(gs,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"添加模型"]})]})]}),l.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-2",children:[l.jsxs("div",{className:"relative w-full sm:flex-1 sm:max-w-sm",children:[l.jsx(li,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),l.jsx(Pe,{placeholder:"搜索模型名称、标识符或提供商...",value:z,onChange:ie=>H(ie.target.value),className:"pl-9"})]}),z&&l.jsxs("p",{className:"text-sm text-muted-foreground whitespace-nowrap",children:["找到 ",qe.length," 个结果"]})]}),l.jsx("div",{className:"md:hidden space-y-3",children:wt.length===0?l.jsx("div",{className:"text-center text-muted-foreground py-8 rounded-lg border bg-card",children:z?"未找到匹配的模型":"暂无模型配置"}):wt.map((ie,xe)=>{const Je=t.findIndex(er=>er===ie),dt=Ne(ie.name);return l.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[l.jsxs("div",{className:"flex items-start justify-between gap-2",children:[l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[l.jsx("h3",{className:"font-semibold text-base",children:ie.name}),l.jsx(In,{variant:dt?"default":"secondary",className:dt?"bg-green-600 hover:bg-green-700":"",children:dt?"已使用":"未使用"})]}),l.jsx("p",{className:"text-xs text-muted-foreground break-all",title:ie.model_identifier,children:ie.model_identifier})]}),l.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[l.jsxs(fe,{variant:"default",size:"sm",onClick:()=>$e(ie,Je),children:[l.jsx(fh,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),l.jsxs(fe,{size:"sm",onClick:()=>xn(Je),className:"bg-red-600 hover:bg-red-700 text-white",children:[l.jsx(ln,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})]}),l.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[l.jsxs("div",{children:[l.jsx("span",{className:"text-muted-foreground text-xs",children:"提供商"}),l.jsx("p",{className:"font-medium",children:ie.api_provider})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-muted-foreground text-xs",children:"强制流式"}),l.jsx("p",{className:"font-medium",children:ie.force_stream_mode?"是":"否"})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-muted-foreground text-xs",children:"输入价格"}),l.jsxs("p",{className:"font-medium",children:["¥",ie.price_in,"/M"]})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-muted-foreground text-xs",children:"输出价格"}),l.jsxs("p",{className:"font-medium",children:["¥",ie.price_out,"/M"]})]})]})]},xe)})}),l.jsx("div",{className:"hidden md:block rounded-lg border bg-card overflow-hidden",children:l.jsx("div",{className:"overflow-x-auto",children:l.jsxs(Vh,{children:[l.jsx(Uh,{children:l.jsxs(ps,{children:[l.jsx(tn,{className:"w-12",children:l.jsx(ii,{checked:P.size===qe.length&&qe.length>0,onCheckedChange:Dt})}),l.jsx(tn,{className:"w-24",children:"使用状态"}),l.jsx(tn,{children:"模型名称"}),l.jsx(tn,{children:"模型标识符"}),l.jsx(tn,{children:"提供商"}),l.jsx(tn,{className:"text-right",children:"输入价格"}),l.jsx(tn,{className:"text-right",children:"输出价格"}),l.jsx(tn,{className:"text-center",children:"强制流式"}),l.jsx(tn,{className:"text-right",children:"操作"})]})}),l.jsx(Wh,{children:wt.length===0?l.jsx(ps,{children:l.jsx(It,{colSpan:9,className:"text-center text-muted-foreground py-8",children:z?"未找到匹配的模型":"暂无模型配置"})}):wt.map((ie,xe)=>{const Je=t.findIndex(er=>er===ie),dt=Ne(ie.name);return l.jsxs(ps,{children:[l.jsx(It,{children:l.jsx(ii,{checked:P.has(Je),onCheckedChange:()=>Cn(Je)})}),l.jsx(It,{children:l.jsx(In,{variant:dt?"default":"secondary",className:dt?"bg-green-600 hover:bg-green-700":"",children:dt?"已使用":"未使用"})}),l.jsx(It,{className:"font-medium",children:ie.name}),l.jsx(It,{className:"max-w-xs truncate",title:ie.model_identifier,children:ie.model_identifier}),l.jsx(It,{children:ie.api_provider}),l.jsxs(It,{className:"text-right",children:["¥",ie.price_in,"/M"]}),l.jsxs(It,{className:"text-right",children:["¥",ie.price_out,"/M"]}),l.jsx(It,{className:"text-center",children:ie.force_stream_mode?"是":"否"}),l.jsx(It,{className:"text-right",children:l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsxs(fe,{variant:"default",size:"sm",onClick:()=>$e(ie,Je),children:[l.jsx(fh,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),l.jsxs(fe,{size:"sm",onClick:()=>xn(Je),className:"bg-red-600 hover:bg-red-700 text-white",children:[l.jsx(ln,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})})]},xe)})})]})})}),qe.length>0&&l.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(de,{htmlFor:"page-size-model",className:"text-sm whitespace-nowrap",children:"每页显示"}),l.jsxs(zt,{value:G.toString(),onValueChange:ie=>{F(parseInt(ie)),se(1),W(new Set)},children:[l.jsx(At,{id:"page-size-model",className:"w-20",children:l.jsx(Pt,{})}),l.jsxs(Rt,{children:[l.jsx(ze,{value:"10",children:"10"}),l.jsx(ze,{value:"20",children:"20"}),l.jsx(ze,{value:"50",children:"50"}),l.jsx(ze,{value:"100",children:"100"})]})]}),l.jsxs("span",{className:"text-sm text-muted-foreground",children:["显示 ",(R-1)*G+1," 到"," ",Math.min(R*G,qe.length)," 条,共 ",qe.length," 条"]})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(fe,{variant:"outline",size:"sm",onClick:()=>se(1),disabled:R===1,className:"hidden sm:flex",children:l.jsx(D0,{className:"h-4 w-4"})}),l.jsxs(fe,{variant:"outline",size:"sm",onClick:()=>se(ie=>Math.max(1,ie-1)),disabled:R===1,children:[l.jsx(qu,{className:"h-4 w-4 sm:mr-1"}),l.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Pe,{type:"number",value:U,onChange:ie=>te(ie.target.value),onKeyDown:ie=>ie.key==="Enter"&&jt(),placeholder:R.toString(),className:"w-16 h-8 text-center",min:1,max:rt}),l.jsx(fe,{variant:"outline",size:"sm",onClick:jt,disabled:!U,className:"h-8",children:"跳转"})]}),l.jsxs(fe,{variant:"outline",size:"sm",onClick:()=>se(ie=>ie+1),disabled:R>=rt,children:[l.jsx("span",{className:"hidden sm:inline",children:"下一页"}),l.jsx(Fu,{className:"h-4 w-4 sm:ml-1"})]}),l.jsx(fe,{variant:"outline",size:"sm",onClick:()=>se(rt),disabled:R>=rt,className:"hidden sm:flex",children:l.jsx(z0,{className:"h-4 w-4"})})]})]})]}),l.jsxs(Kt,{value:"tasks",className:"space-y-6 mt-0",children:[l.jsx("p",{className:"text-sm text-muted-foreground",children:"为不同的任务配置使用的模型和参数"}),a&&l.jsxs("div",{className:"grid gap-4 sm:gap-6",children:[l.jsx(ya,{title:"组件模型 (utils)",description:"用于表情包、取名、关系、情绪变化等组件",taskConfig:a.utils,modelNames:s,onChange:(ie,xe)=>Re("utils",ie,xe)}),l.jsx(ya,{title:"组件小模型 (utils_small)",description:"消耗量较大的组件,建议使用速度较快的小模型",taskConfig:a.utils_small,modelNames:s,onChange:(ie,xe)=>Re("utils_small",ie,xe)}),l.jsx(ya,{title:"工具调用模型 (tool_use)",description:"需要使用支持工具调用的模型",taskConfig:a.tool_use,modelNames:s,onChange:(ie,xe)=>Re("tool_use",ie,xe)}),l.jsx(ya,{title:"首要回复模型 (replyer)",description:"用于表达器和表达方式学习",taskConfig:a.replyer,modelNames:s,onChange:(ie,xe)=>Re("replyer",ie,xe)}),l.jsx(ya,{title:"决策模型 (planner)",description:"负责决定麦麦该什么时候回复",taskConfig:a.planner,modelNames:s,onChange:(ie,xe)=>Re("planner",ie,xe)}),l.jsx(ya,{title:"图像识别模型 (vlm)",description:"视觉语言模型",taskConfig:a.vlm,modelNames:s,onChange:(ie,xe)=>Re("vlm",ie,xe),hideTemperature:!0}),l.jsx(ya,{title:"语音识别模型 (voice)",description:"语音转文字",taskConfig:a.voice,modelNames:s,onChange:(ie,xe)=>Re("voice",ie,xe),hideTemperature:!0,hideMaxTokens:!0}),l.jsx(ya,{title:"嵌入模型 (embedding)",description:"用于向量化",taskConfig:a.embedding,modelNames:s,onChange:(ie,xe)=>Re("embedding",ie,xe),hideTemperature:!0,hideMaxTokens:!0}),l.jsxs("div",{className:"space-y-4",children:[l.jsx("h3",{className:"text-lg font-semibold",children:"LPMM 知识库模型"}),l.jsx(ya,{title:"实体提取模型 (lpmm_entity_extract)",description:"从文本中提取实体",taskConfig:a.lpmm_entity_extract,modelNames:s,onChange:(ie,xe)=>Re("lpmm_entity_extract",ie,xe)}),l.jsx(ya,{title:"RDF 构建模型 (lpmm_rdf_build)",description:"构建知识图谱",taskConfig:a.lpmm_rdf_build,modelNames:s,onChange:(ie,xe)=>Re("lpmm_rdf_build",ie,xe)}),l.jsx(ya,{title:"问答模型 (lpmm_qa)",description:"知识库问答",taskConfig:a.lpmm_qa,modelNames:s,onChange:(ie,xe)=>Re("lpmm_qa",ie,xe)})]})]})]})]}),l.jsx(fr,{open:T,onOpenChange:lt,children:l.jsxs(rr,{className:"max-w-[95vw] sm:max-w-2xl max-h-[90vh] overflow-y-auto",children:[l.jsxs(sr,{children:[l.jsx(ir,{children:q!==null?"编辑模型":"添加模型"}),l.jsx(Ir,{children:"配置模型的基本信息和参数"})]}),l.jsxs("div",{className:"grid gap-4 py-4",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"model_name",children:"模型名称 *"}),l.jsx(Pe,{id:"model_name",value:E?.name||"",onChange:ie=>M(xe=>xe?{...xe,name:ie.target.value}:null),placeholder:"例如: qwen3-30b"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"用于在任务配置中引用此模型"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"model_identifier",children:"模型标识符 *"}),l.jsx(Pe,{id:"model_identifier",value:E?.model_identifier||"",onChange:ie=>M(xe=>xe?{...xe,model_identifier:ie.target.value}:null),placeholder:"Qwen/Qwen3-30B-A3B-Instruct-2507"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"API 提供商提供的模型 ID"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"api_provider",children:"API 提供商 *"}),l.jsxs(zt,{value:E?.api_provider||"",onValueChange:ie=>M(xe=>xe?{...xe,api_provider:ie}:null),children:[l.jsx(At,{id:"api_provider",children:l.jsx(Pt,{placeholder:"选择提供商"})}),l.jsx(Rt,{children:n.map(ie=>l.jsx(ze,{value:ie,children:ie},ie))})]})]}),l.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"price_in",children:"输入价格 (¥/M token)"}),l.jsx(Pe,{id:"price_in",type:"number",step:"0.1",min:"0",value:E?.price_in??"",onChange:ie=>{const xe=ie.target.value===""?null:parseFloat(ie.target.value);M(Je=>Je?{...Je,price_in:xe}:null)},placeholder:"默认: 0"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"price_out",children:"输出价格 (¥/M token)"}),l.jsx(Pe,{id:"price_out",type:"number",step:"0.1",min:"0",value:E?.price_out??"",onChange:ie=>{const xe=ie.target.value===""?null:parseFloat(ie.target.value);M(Je=>Je?{...Je,price_out:xe}:null)},placeholder:"默认: 0"})]})]}),l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(_t,{id:"force_stream_mode",checked:E?.force_stream_mode||!1,onCheckedChange:ie=>M(xe=>xe?{...xe,force_stream_mode:ie}:null)}),l.jsx(de,{htmlFor:"force_stream_mode",className:"cursor-pointer",children:"强制流式输出模式"})]})]}),l.jsxs(ts,{children:[l.jsx(fe,{variant:"outline",onClick:()=>_(!1),children:"取消"}),l.jsx(fe,{onClick:bt,children:"保存"})]})]})}),l.jsx(wn,{open:I,onOpenChange:$,children:l.jsxs(un,{children:[l.jsxs(dn,{children:[l.jsx(fn,{children:"确认删除"}),l.jsxs(mn,{children:['确定要删除模型 "',V!==null?t[V]?.name:"",'" 吗? 此操作无法撤销。']})]}),l.jsxs(hn,{children:[l.jsx(gn,{children:"取消"}),l.jsx(pn,{onClick:_n,children:"删除"})]})]})}),l.jsx(wn,{open:J,onOpenChange:X,children:l.jsxs(un,{children:[l.jsxs(dn,{children:[l.jsx(fn,{children:"确认批量删除"}),l.jsxs(mn,{children:["确定要删除选中的 ",P.size," 个模型吗? 此操作无法撤销。"]})]}),l.jsxs(hn,{children:[l.jsx(gn,{children:"取消"}),l.jsx(pn,{onClick:Te,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})}),N&&l.jsx(y6,{onRestartComplete:tt,onRestartFailed:Xe})]})})}function ya({title:t,description:e,taskConfig:n,modelNames:r,onChange:s,hideTemperature:i=!1,hideMaxTokens:a=!1}){const o=c=>{s("model_list",c)};return l.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:[l.jsxs("div",{children:[l.jsx("h4",{className:"font-semibold text-base sm:text-lg",children:t}),l.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mt-1",children:e})]}),l.jsxs("div",{className:"grid gap-4",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{children:"模型列表"}),l.jsx(Wme,{options:r.map(c=>({label:c,value:c})),selected:n.model_list||[],onChange:o,placeholder:"选择模型...",emptyText:"暂无可用模型"})]}),l.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[!i&&l.jsxs("div",{className:"grid gap-3",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx(de,{children:"温度"}),l.jsx(Pe,{type:"number",step:"0.1",min:"0",max:"1",value:n.temperature??.3,onChange:c=>{const h=parseFloat(c.target.value);!isNaN(h)&&h>=0&&h<=1&&s("temperature",h)},className:"w-20 h-8 text-sm"})]}),l.jsx($0,{value:[n.temperature??.3],onValueChange:c=>s("temperature",c[0]),min:0,max:1,step:.1,className:"w-full"})]}),!a&&l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{children:"最大 Token"}),l.jsx(Pe,{type:"number",step:"1",min:"1",value:n.max_tokens??1024,onChange:c=>s("max_tokens",parseInt(c.target.value))})]})]})]})]})}const fy="/api/webui/config";async function Xme(){const e=await(await mt(`${fy}/adapter-config/path`)).json();return!e.success||!e.path?null:{path:e.path,lastModified:e.lastModified}}async function ZE(t){const n=await(await mt(`${fy}/adapter-config/path`,{method:"POST",headers:Nt(),body:JSON.stringify({path:t})})).json();if(!n.success)throw new Error(n.message||"保存路径失败")}async function JE(t){const n=await(await mt(`${fy}/adapter-config?path=${encodeURIComponent(t)}`)).json();if(!n.success)throw new Error("读取配置文件失败");return n.content}async function e_(t,e){const r=await(await mt(`${fy}/adapter-config`,{method:"POST",headers:Nt(),body:JSON.stringify({path:t,content:e})})).json();if(!r.success)throw new Error(r.message||"保存配置失败")}const ki={inner:{version:"0.1.2"},nickname:{nickname:""},napcat_server:{host:"localhost",port:8095,token:"",heartbeat_interval:30},maibot_server:{host:"localhost",port:8e3},chat:{group_list_type:"whitelist",group_list:[],private_list_type:"whitelist",private_list:[],ban_user_id:[],ban_qq_bot:!1,enable_poke:!0},voice:{use_tts:!1},debug:{level:"INFO"}},Jw={oneclick:{name:"一键包",description:"使用一键包部署的适配器配置",path:"../MaiBot-Napcat-Adapter/config.toml",icon:mh},docker:{name:"Docker",description:"Docker Compose 部署的适配器配置",path:"./docker-config/adapters/config.toml",icon:qK}};function Yme(){const[t,e]=b.useState("upload"),[n,r]=b.useState(null),[s,i]=b.useState(""),[a,o]=b.useState(""),[c,h]=b.useState("oneclick"),[f,m]=b.useState(""),[g,x]=b.useState(!1),[y,w]=b.useState(!1),[S,k]=b.useState(!1),[N,C]=b.useState(!1),[T,_]=b.useState(null),E=b.useRef(null),{toast:M}=Gr(),q=b.useRef(null),L=Y=>{if(!Y.trim())return{valid:!1,error:"路径不能为空"};if(!Y.toLowerCase().endsWith(".toml"))return{valid:!1,error:"文件必须是 .toml 格式"};const ae=/^([a-zA-Z]:\\|\\\\[^\\]+\\[^\\]+\\).+\.toml$/i,re=/^(\/|~\/).+\.toml$/i,le=/^(\.{1,2}[\\/]|[^:\\/]).+\.toml$/i,_e=ae.test(Y),Ge=re.test(Y),tt=le.test(Y);return!_e&&!Ge&&!tt?{valid:!1,error:"路径格式错误"}:/[<>"|?*\x00-\x1F]/.test(Y)?{valid:!1,error:"路径包含非法字符"}:{valid:!0,error:""}},I=Y=>{if(o(Y),Y.trim()){const ae=L(Y);m(ae.error)}else m("")},$=b.useCallback(async Y=>{const ae=Jw[Y];w(!0);try{const re=await JE(ae.path),le=G(re);r(le),h(Y),o(ae.path),await ZE(ae.path),M({title:"加载成功",description:`已从${ae.name}预设加载配置`})}catch(re){console.error("加载预设配置失败:",re),M({title:"加载失败",description:re instanceof Error?re.message:"无法读取预设配置文件",variant:"destructive"})}finally{w(!1)}},[M]),V=b.useCallback(async Y=>{const ae=L(Y);if(!ae.valid){m(ae.error),M({title:"路径无效",description:ae.error,variant:"destructive"});return}m(""),w(!0);try{const re=await JE(Y),le=G(re);r(le),o(Y),await ZE(Y),M({title:"加载成功",description:"已从配置文件加载"})}catch(re){console.error("加载配置失败:",re),M({title:"加载失败",description:re instanceof Error?re.message:"无法读取配置文件",variant:"destructive"})}finally{w(!1)}},[M]);b.useEffect(()=>{(async()=>{try{const ae=await Xme();if(ae&&ae.path){o(ae.path);const re=Object.entries(Jw).find(([,le])=>le.path===ae.path);re?(e("preset"),h(re[0]),await $(re[0])):(e("path"),await V(ae.path))}}catch(ae){console.error("加载保存的路径失败:",ae)}})()},[V,$]);const ee=b.useCallback(Y=>{t!=="path"&&t!=="preset"||!a||(q.current&&clearTimeout(q.current),q.current=setTimeout(async()=>{x(!0);try{const ae=F(Y);await e_(a,ae),M({title:"自动保存成功",description:"配置已保存到文件"})}catch(ae){console.error("自动保存失败:",ae),M({title:"自动保存失败",description:ae instanceof Error?ae.message:"保存配置失败",variant:"destructive"})}finally{x(!1)}},1e3))},[t,a,M]),z=async()=>{if(!n||!a)return;const Y=L(a);if(!Y.valid){M({title:"保存失败",description:Y.error,variant:"destructive"});return}x(!0);try{const ae=F(n);await e_(a,ae),M({title:"保存成功",description:"配置已保存到文件"})}catch(ae){console.error("保存失败:",ae),M({title:"保存失败",description:ae instanceof Error?ae.message:"保存配置失败",variant:"destructive"})}finally{x(!1)}},H=async()=>{a&&await V(a)},P=Y=>{if(Y!==t){if(n){_(Y),k(!0);return}W(Y)}},W=Y=>{r(null),i(""),m(""),e(Y),Y==="preset"&&$("oneclick"),M({title:"已切换模式",description:{upload:"现在可以上传配置文件",path:"现在可以指定配置文件路径",preset:"现在可以使用预设配置"}[Y]})},J=()=>{T&&(W(T),_(null)),k(!1)},X=()=>{if(n){C(!0);return}R()},R=()=>{o(""),r(null),m(""),M({title:"已清空",description:"路径和配置已清空"})},se=()=>{R(),C(!1)},G=Y=>{const ae=JSON.parse(JSON.stringify(ki)),re=Y.split(` -`);let le="";for(const _e of re){const Ge=_e.trim();if(!Ge||Ge.startsWith("#"))continue;const tt=Ge.match(/^\[(\w+)\]/);if(tt){le=tt[1];continue}const Xe=Ge.match(/^(\w+)\s*=\s*(.+)$/);if(Xe&&le){const[,je,Qe]=Xe;let He=Qe.trim();const $e=He.match(/^("[^"]*")/);if($e)He=$e[1];else{const lt=He.indexOf("#");lt!==-1&&(He=He.substring(0,lt).trim())}let bt;if(He==="true")bt=!0;else if(He==="false")bt=!1;else if(He.startsWith("[")&&He.endsWith("]")){const lt=He.slice(1,-1).trim();if(lt){const xn=lt.split(",").map(Cn=>{const Dt=Cn.trim();return isNaN(Number(Dt))?Dt.replace(/"/g,""):Number(Dt)}),_n=typeof xn[0];bt=xn.every(Cn=>typeof Cn===_n)?xn:xn.filter(Cn=>typeof Cn=="number")}else bt=[]}else He.startsWith('"')&&He.endsWith('"')?bt=He.slice(1,-1):isNaN(Number(He))?bt=He.replace(/"/g,""):bt=Number(He);if(le in ae){const lt=ae[le];lt[je]=bt}}}return ae},F=Y=>{const ae=[],re=(le,_e)=>le===""||le===null||le===void 0?_e:le;return ae.push("[inner]"),ae.push(`version = "${re(Y.inner.version,ki.inner.version)}" # 版本号`),ae.push("# 请勿修改版本号,除非你知道自己在做什么"),ae.push(""),ae.push("[nickname] # 现在没用"),ae.push(`nickname = "${re(Y.nickname.nickname,ki.nickname.nickname)}"`),ae.push(""),ae.push("[napcat_server] # Napcat连接的ws服务设置"),ae.push(`host = "${re(Y.napcat_server.host,ki.napcat_server.host)}" # Napcat设定的主机地址`),ae.push(`port = ${re(Y.napcat_server.port||0,ki.napcat_server.port)} # Napcat设定的端口`),ae.push(`token = "${re(Y.napcat_server.token,ki.napcat_server.token)}" # Napcat设定的访问令牌,若无则留空`),ae.push(`heartbeat_interval = ${re(Y.napcat_server.heartbeat_interval||0,ki.napcat_server.heartbeat_interval)} # 与Napcat设置的心跳相同(按秒计)`),ae.push(""),ae.push("[maibot_server] # 连接麦麦的ws服务设置"),ae.push(`host = "${re(Y.maibot_server.host,ki.maibot_server.host)}" # 麦麦在.env文件中设置的主机地址,即HOST字段`),ae.push(`port = ${re(Y.maibot_server.port||0,ki.maibot_server.port)} # 麦麦在.env文件中设置的端口,即PORT字段`),ae.push(""),ae.push("[chat] # 黑白名单功能"),ae.push(`group_list_type = "${re(Y.chat.group_list_type,ki.chat.group_list_type)}" # 群组名单类型,可选为:whitelist, blacklist`),ae.push(`group_list = [${Y.chat.group_list.join(", ")}] # 群组名单`),ae.push("# 当group_list_type为whitelist时,只有群组名单中的群组可以聊天"),ae.push("# 当group_list_type为blacklist时,群组名单中的任何群组无法聊天"),ae.push(`private_list_type = "${re(Y.chat.private_list_type,ki.chat.private_list_type)}" # 私聊名单类型,可选为:whitelist, blacklist`),ae.push(`private_list = [${Y.chat.private_list.join(", ")}] # 私聊名单`),ae.push("# 当private_list_type为whitelist时,只有私聊名单中的用户可以聊天"),ae.push("# 当private_list_type为blacklist时,私聊名单中的任何用户无法聊天"),ae.push(`ban_user_id = [${Y.chat.ban_user_id.join(", ")}] # 全局禁止名单(全局禁止名单中的用户无法进行任何聊天)`),ae.push(`ban_qq_bot = ${Y.chat.ban_qq_bot} # 是否屏蔽QQ官方机器人`),ae.push(`enable_poke = ${Y.chat.enable_poke} # 是否启用戳一戳功能`),ae.push(""),ae.push("[voice] # 发送语音设置"),ae.push(`use_tts = ${Y.voice.use_tts} # 是否使用tts语音(请确保你配置了tts并有对应的adapter)`),ae.push(""),ae.push("[debug]"),ae.push(`level = "${re(Y.debug.level,ki.debug.level)}" # 日志等级(DEBUG, INFO, WARNING, ERROR, CRITICAL)`),ae.join(` -`)},U=Y=>{const ae=Y.target.files?.[0];if(!ae)return;const re=new FileReader;re.onload=le=>{try{const _e=le.target?.result,Ge=G(_e);r(Ge),i(ae.name),M({title:"上传成功",description:`已加载配置文件:${ae.name}`})}catch(_e){console.error("解析配置文件失败:",_e),M({title:"解析失败",description:"配置文件格式错误,请检查文件内容",variant:"destructive"})}},re.readAsText(ae)},te=()=>{if(!n)return;const Y=F(n),ae=new Blob([Y],{type:"text/plain;charset=utf-8"}),re=URL.createObjectURL(ae),le=document.createElement("a");le.href=re,le.download=s||"config.toml",document.body.appendChild(le),le.click(),document.body.removeChild(le),URL.revokeObjectURL(re),M({title:"下载成功",description:"配置文件已下载,请手动覆盖并重启适配器"})},ne=()=>{r(JSON.parse(JSON.stringify(ki))),i("config.toml"),M({title:"已加载默认配置",description:"可以开始编辑配置"})};return l.jsx(on,{className:"h-full",children:l.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[l.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:l.jsxs("div",{children:[l.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"麦麦适配器配置"}),l.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理麦麦的 QQ 适配器的配置文件"})]})}),l.jsxs(Tt,{children:[l.jsxs(vn,{children:[l.jsx(yn,{children:"工作模式"}),l.jsx(zr,{children:"选择配置文件的管理方式"})]}),l.jsxs(En,{className:"space-y-4",children:[l.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3 md:gap-4",children:[l.jsx("div",{className:`border-2 rounded-lg p-3 md:p-4 cursor-pointer transition-all ${t==="preset"?"border-primary bg-primary/5":"border-muted hover:border-primary/50 active:border-primary/70"}`,onClick:()=>P("preset"),children:l.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[l.jsx(mh,{className:"h-4 w-4 md:h-5 md:w-5 mt-0.5 flex-shrink-0"}),l.jsxs("div",{className:"min-w-0",children:[l.jsx("h3",{className:"font-semibold text-sm md:text-base",children:"预设模式"}),l.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-1 line-clamp-2",children:"使用预设的部署配置"})]})]})}),l.jsx("div",{className:`border-2 rounded-lg p-3 md:p-4 cursor-pointer transition-all ${t==="upload"?"border-primary bg-primary/5":"border-muted hover:border-primary/50 active:border-primary/70"}`,onClick:()=>P("upload"),children:l.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[l.jsx(LC,{className:"h-4 w-4 md:h-5 md:w-5 mt-0.5 flex-shrink-0"}),l.jsxs("div",{className:"min-w-0",children:[l.jsx("h3",{className:"font-semibold text-sm md:text-base",children:"上传文件模式"}),l.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-1 line-clamp-2",children:"上传配置文件,编辑后下载并手动覆盖"})]})]})}),l.jsx("div",{className:`border-2 rounded-lg p-3 md:p-4 cursor-pointer transition-all ${t==="path"?"border-primary bg-primary/5":"border-muted hover:border-primary/50 active:border-primary/70"}`,onClick:()=>P("path"),children:l.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[l.jsx(FK,{className:"h-4 w-4 md:h-5 md:w-5 mt-0.5 flex-shrink-0"}),l.jsxs("div",{className:"min-w-0",children:[l.jsx("h3",{className:"font-semibold text-sm md:text-base",children:"指定路径模式"}),l.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-1 line-clamp-2",children:"指定配置文件路径,自动加载和保存"})]})]})})]}),t==="preset"&&l.jsxs("div",{className:"space-y-3 pt-2 border-t",children:[l.jsx(de,{className:"text-sm md:text-base",children:"选择部署方式"}),l.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:Object.entries(Jw).map(([Y,ae])=>{const re=ae.icon,le=c===Y;return l.jsx("div",{className:`border-2 rounded-lg p-3 cursor-pointer transition-all ${le?"border-primary bg-primary/5":"border-muted hover:border-primary/50"}`,onClick:()=>{h(Y),$(Y)},children:l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx(re,{className:"h-5 w-5 mt-0.5 flex-shrink-0"}),l.jsxs("div",{className:"min-w-0 flex-1",children:[l.jsx("h4",{className:"font-semibold text-sm",children:ae.name}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:ae.description}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1 font-mono break-all",children:ae.path})]})]})},Y)})})]}),t==="path"&&l.jsxs("div",{className:"space-y-3 pt-2 border-t",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(de,{htmlFor:"config-path",className:"text-sm md:text-base",children:"配置文件路径"}),l.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[l.jsxs("div",{className:"flex-1 space-y-1",children:[l.jsx(Pe,{id:"config-path",value:a,onChange:Y=>I(Y.target.value),placeholder:"例: C:\\Adapter\\config.toml",className:`text-sm ${f?"border-destructive":""}`}),f&&l.jsx("p",{className:"text-xs text-destructive",children:f})]}),l.jsx(fe,{onClick:()=>V(a),disabled:y||!a||!!f,className:"w-full sm:w-auto",children:y?l.jsxs(l.Fragment,{children:[l.jsx(ti,{className:"h-4 w-4 animate-spin mr-2"}),l.jsx("span",{className:"sm:hidden",children:"加载中..."})]}):l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"sm:hidden",children:"加载配置"}),l.jsx("span",{className:"hidden sm:inline",children:"加载"})]})})]})]}),l.jsxs("details",{className:"rounded-lg bg-muted/50 p-3 group",children:[l.jsxs("summary",{className:"text-xs font-medium cursor-pointer select-none list-none flex items-center justify-between",children:[l.jsx("span",{children:"路径格式说明"}),l.jsx("svg",{className:"h-4 w-4 transition-transform group-open:rotate-180",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),l.jsxs("div",{className:"mt-2 space-y-2 text-xs text-muted-foreground",children:[l.jsxs("div",{className:"space-y-1",children:[l.jsx("div",{className:"flex items-center gap-2",children:l.jsx("span",{className:"font-mono bg-background px-1.5 py-0.5 rounded text-[10px] md:text-xs whitespace-nowrap",children:"Windows"})}),l.jsxs("div",{className:"pl-2 space-y-0.5 text-[10px] md:text-xs break-all",children:[l.jsx("div",{children:"C:\\Adapter\\config.toml"}),l.jsx("div",{className:"hidden sm:block",children:"D:\\MaiBot\\adapter\\config.toml"}),l.jsx("div",{className:"hidden sm:block",children:"\\\\server\\share\\config.toml"})]})]}),l.jsxs("div",{className:"space-y-1",children:[l.jsx("div",{className:"flex items-center gap-2",children:l.jsx("span",{className:"font-mono bg-background px-1.5 py-0.5 rounded text-[10px] md:text-xs whitespace-nowrap",children:"Linux"})}),l.jsxs("div",{className:"pl-2 space-y-0.5 text-[10px] md:text-xs break-all",children:[l.jsx("div",{children:"/opt/adapter/config.toml"}),l.jsx("div",{className:"hidden sm:block",children:"/home/user/adapter/config.toml"}),l.jsx("div",{className:"hidden sm:block",children:"~/adapter/config.toml"})]})]}),l.jsx("p",{className:"pt-1 border-t text-[10px] md:text-xs",children:"💡 配置会自动保存到指定文件,修改后 1 秒自动保存"})]})]})]})]})]}),l.jsxs(il,{children:[l.jsx(Oa,{className:"h-4 w-4"}),l.jsx(al,{children:t==="preset"?l.jsxs(l.Fragment,{children:[l.jsx("strong",{children:"预设模式:"}),"选择预设的部署方式,配置会自动加载,修改后 1 秒自动保存",g&&" (正在保存...)"]}):t==="upload"?l.jsxs(l.Fragment,{children:[l.jsx("strong",{children:"上传文件模式:"}),"上传配置文件 → 在线编辑 → 下载文件 → 手动覆盖并重启适配器"]}):l.jsxs(l.Fragment,{children:[l.jsx("strong",{children:"指定路径模式:"}),"指定配置文件路径后,配置会自动加载,修改后 1 秒自动保存",g&&" (正在保存...)"]})})]}),t==="upload"&&!n&&l.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 w-full",children:[l.jsx("input",{ref:E,type:"file",accept:".toml",className:"hidden",onChange:U}),l.jsxs(fe,{onClick:()=>E.current?.click(),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[l.jsx(LC,{className:"mr-2 h-4 w-4"}),"上传配置"]}),l.jsxs(fe,{onClick:ne,size:"sm",className:"w-full sm:w-auto",children:[l.jsx(io,{className:"mr-2 h-4 w-4"}),"使用默认配置"]})]}),t==="upload"&&n&&l.jsx("div",{className:"flex gap-2",children:l.jsxs(fe,{onClick:te,size:"sm",className:"w-full sm:w-auto",children:[l.jsx(bu,{className:"mr-2 h-4 w-4"}),"下载配置"]})}),(t==="preset"||t==="path")&&n&&l.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[l.jsxs(fe,{onClick:z,size:"sm",disabled:g||!!f,className:"w-full sm:w-auto",children:[l.jsx(Rv,{className:"mr-2 h-4 w-4"}),g?"保存中...":"立即保存"]}),l.jsxs(fe,{onClick:H,size:"sm",variant:"outline",disabled:y,className:"w-full sm:w-auto",children:[l.jsx(ti,{className:`mr-2 h-4 w-4 ${y?"animate-spin":""}`}),"刷新"]}),t==="path"&&l.jsxs(fe,{onClick:X,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[l.jsx(ln,{className:"mr-2 h-4 w-4"}),"清空路径"]})]}),n?l.jsxs(na,{defaultValue:"napcat",className:"w-full",children:[l.jsx("div",{className:"overflow-x-auto -mx-4 px-4 sm:mx-0 sm:px-0",children:l.jsxs(_i,{className:"inline-flex w-auto min-w-full sm:grid sm:w-full sm:grid-cols-5",children:[l.jsxs(Et,{value:"napcat",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[l.jsx("span",{className:"hidden sm:inline",children:"Napcat 连接"}),l.jsx("span",{className:"sm:hidden",children:"Napcat"})]}),l.jsxs(Et,{value:"maibot",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[l.jsx("span",{className:"hidden sm:inline",children:"麦麦连接"}),l.jsx("span",{className:"sm:hidden",children:"麦麦"})]}),l.jsxs(Et,{value:"chat",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[l.jsx("span",{className:"hidden sm:inline",children:"聊天控制"}),l.jsx("span",{className:"sm:hidden",children:"聊天"})]}),l.jsxs(Et,{value:"voice",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[l.jsx("span",{className:"hidden sm:inline",children:"语音设置"}),l.jsx("span",{className:"sm:hidden",children:"语音"})]}),l.jsx(Et,{value:"debug",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:"调试"})]})}),l.jsx(Kt,{value:"napcat",className:"space-y-4",children:l.jsx(Kme,{config:n,onChange:Y=>{r(Y),ee(Y)}})}),l.jsx(Kt,{value:"maibot",className:"space-y-4",children:l.jsx(Zme,{config:n,onChange:Y=>{r(Y),ee(Y)}})}),l.jsx(Kt,{value:"chat",className:"space-y-4",children:l.jsx(Jme,{config:n,onChange:Y=>{r(Y),ee(Y)}})}),l.jsx(Kt,{value:"voice",className:"space-y-4",children:l.jsx(e0e,{config:n,onChange:Y=>{r(Y),ee(Y)}})}),l.jsx(Kt,{value:"debug",className:"space-y-4",children:l.jsx(t0e,{config:n,onChange:Y=>{r(Y),ee(Y)}})})]}):l.jsx("div",{className:"rounded-lg border bg-card p-6 md:p-12",children:l.jsxs("div",{className:"text-center space-y-3 md:space-y-4",children:[l.jsx(io,{className:"h-12 w-12 md:h-16 md:w-16 mx-auto text-muted-foreground"}),l.jsxs("div",{children:[l.jsx("h3",{className:"text-base md:text-lg font-semibold",children:"尚未加载配置"}),l.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-2 px-4",children:t==="preset"?"请选择预设的部署方式":t==="upload"?"请上传现有配置文件,或使用默认配置开始编辑":"请指定配置文件路径并点击加载按钮"})]})]})}),l.jsx(wn,{open:S,onOpenChange:k,children:l.jsxs(un,{children:[l.jsxs(dn,{children:[l.jsx(fn,{children:"确认切换模式"}),l.jsxs(mn,{children:["切换模式将清空当前配置,确定要继续吗?",l.jsx("br",{}),l.jsx("span",{className:"text-destructive font-medium",children:"请确保已保存重要配置"})]})]}),l.jsxs(hn,{children:[l.jsx(gn,{onClick:()=>{k(!1),_(null)},children:"取消"}),l.jsx(pn,{onClick:J,children:"确认切换"})]})]})}),l.jsx(wn,{open:N,onOpenChange:C,children:l.jsxs(un,{children:[l.jsxs(dn,{children:[l.jsx(fn,{children:"确认清空路径"}),l.jsxs(mn,{children:["清空路径将清除当前配置,确定要继续吗?",l.jsx("br",{}),l.jsx("span",{className:"text-muted-foreground text-sm",children:"此操作不会删除配置文件,只是清除界面中的配置"})]})]}),l.jsxs(hn,{children:[l.jsx(gn,{onClick:()=>C(!1),children:"取消"}),l.jsx(pn,{onClick:se,className:"bg-destructive hover:bg-destructive/90",children:"确认清空"})]})]})})]})})}function Kme({config:t,onChange:e}){return l.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:l.jsxs("div",{children:[l.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"Napcat WebSocket 服务设置"}),l.jsxs("div",{className:"grid gap-3 md:gap-4",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"napcat-host",className:"text-sm md:text-base",children:"主机地址"}),l.jsx(Pe,{id:"napcat-host",value:t.napcat_server.host,onChange:n=>e({...t,napcat_server:{...t.napcat_server,host:n.target.value}}),placeholder:"localhost",className:"text-sm md:text-base"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的主机地址"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"napcat-port",className:"text-sm md:text-base",children:"端口"}),l.jsx(Pe,{id:"napcat-port",type:"number",value:t.napcat_server.port||"",onChange:n=>e({...t,napcat_server:{...t.napcat_server,port:n.target.value?parseInt(n.target.value):0}}),placeholder:"8095",className:"text-sm md:text-base"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的端口(留空使用默认值 8095)"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"napcat-token",className:"text-sm md:text-base",children:"访问令牌(Token)"}),l.jsx(Pe,{id:"napcat-token",type:"password",value:t.napcat_server.token,onChange:n=>e({...t,napcat_server:{...t.napcat_server,token:n.target.value}}),placeholder:"留空表示无需令牌",className:"text-sm md:text-base"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的访问令牌,若无则留空"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"napcat-heartbeat",className:"text-sm md:text-base",children:"心跳间隔(秒)"}),l.jsx(Pe,{id:"napcat-heartbeat",type:"number",value:t.napcat_server.heartbeat_interval||"",onChange:n=>e({...t,napcat_server:{...t.napcat_server,heartbeat_interval:n.target.value?parseInt(n.target.value):0}}),placeholder:"30",className:"text-sm md:text-base"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"与 Napcat 设置的心跳间隔保持一致(留空使用默认值 30)"})]})]})]})})}function Zme({config:t,onChange:e}){return l.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:l.jsxs("div",{children:[l.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"麦麦 WebSocket 服务设置"}),l.jsxs("div",{className:"grid gap-3 md:gap-4",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"maibot-host",className:"text-sm md:text-base",children:"主机地址"}),l.jsx(Pe,{id:"maibot-host",value:t.maibot_server.host,onChange:n=>e({...t,maibot_server:{...t.maibot_server,host:n.target.value}}),placeholder:"localhost",className:"text-sm md:text-base"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦在 .env 文件中设置的 HOST 字段"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"maibot-port",className:"text-sm md:text-base",children:"端口"}),l.jsx(Pe,{id:"maibot-port",type:"number",value:t.maibot_server.port||"",onChange:n=>e({...t,maibot_server:{...t.maibot_server,port:n.target.value?parseInt(n.target.value):0}}),placeholder:"8000",className:"text-sm md:text-base"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦在 .env 文件中设置的 PORT 字段(留空使用默认值 8000)"})]})]})]})})}function Jme({config:t,onChange:e}){const n=i=>{const a={...t};i==="group"?a.chat.group_list=[...a.chat.group_list,0]:i==="private"?a.chat.private_list=[...a.chat.private_list,0]:a.chat.ban_user_id=[...a.chat.ban_user_id,0],e(a)},r=(i,a)=>{const o={...t};i==="group"?o.chat.group_list=o.chat.group_list.filter((c,h)=>h!==a):i==="private"?o.chat.private_list=o.chat.private_list.filter((c,h)=>h!==a):o.chat.ban_user_id=o.chat.ban_user_id.filter((c,h)=>h!==a),e(o)},s=(i,a,o)=>{const c={...t};i==="group"?c.chat.group_list[a]=o:i==="private"?c.chat.private_list[a]=o:c.chat.ban_user_id[a]=o,e(c)};return l.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:l.jsxs("div",{children:[l.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"聊天黑白名单功能"}),l.jsxs("div",{className:"grid gap-4 md:gap-6",children:[l.jsxs("div",{className:"space-y-3 md:space-y-4",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{className:"text-sm md:text-base",children:"群组名单类型"}),l.jsxs(zt,{value:t.chat.group_list_type,onValueChange:i=>e({...t,chat:{...t.chat,group_list_type:i}}),children:[l.jsx(At,{children:l.jsx(Pt,{})}),l.jsxs(Rt,{children:[l.jsx(ze,{value:"whitelist",children:"白名单(仅名单内可聊天)"}),l.jsx(ze,{value:"blacklist",children:"黑名单(名单内禁止聊天)"})]})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[l.jsx(de,{className:"text-sm md:text-base",children:"群组列表"}),l.jsxs(fe,{onClick:()=>n("group"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[l.jsx(io,{className:"mr-1 h-4 w-4"}),"添加群号"]})]}),t.chat.group_list.map((i,a)=>l.jsxs("div",{className:"flex gap-2",children:[l.jsx(Pe,{type:"number",value:i,onChange:o=>s("group",a,parseInt(o.target.value)||0),placeholder:"输入群号",className:"text-sm md:text-base"}),l.jsxs(wn,{children:[l.jsx(Lr,{asChild:!0,children:l.jsx(fe,{size:"icon",variant:"outline",children:l.jsx(ln,{className:"h-4 w-4"})})}),l.jsxs(un,{children:[l.jsxs(dn,{children:[l.jsx(fn,{children:"确认删除"}),l.jsxs(mn,{children:["确定要删除群号 ",i," 吗?此操作无法撤销。"]})]}),l.jsxs(hn,{children:[l.jsx(gn,{children:"取消"}),l.jsx(pn,{onClick:()=>r("group",a),children:"删除"})]})]})]})]},a)),t.chat.group_list.length===0&&l.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无群组"})]})]}),l.jsxs("div",{className:"space-y-3 md:space-y-4",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{className:"text-sm md:text-base",children:"私聊名单类型"}),l.jsxs(zt,{value:t.chat.private_list_type,onValueChange:i=>e({...t,chat:{...t.chat,private_list_type:i}}),children:[l.jsx(At,{children:l.jsx(Pt,{})}),l.jsxs(Rt,{children:[l.jsx(ze,{value:"whitelist",children:"白名单(仅名单内可聊天)"}),l.jsx(ze,{value:"blacklist",children:"黑名单(名单内禁止聊天)"})]})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[l.jsx(de,{className:"text-sm md:text-base",children:"私聊列表"}),l.jsxs(fe,{onClick:()=>n("private"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[l.jsx(io,{className:"mr-1 h-4 w-4"}),"添加用户"]})]}),t.chat.private_list.map((i,a)=>l.jsxs("div",{className:"flex gap-2",children:[l.jsx(Pe,{type:"number",value:i,onChange:o=>s("private",a,parseInt(o.target.value)||0),placeholder:"输入QQ号",className:"text-sm md:text-base"}),l.jsxs(wn,{children:[l.jsx(Lr,{asChild:!0,children:l.jsx(fe,{size:"icon",variant:"outline",children:l.jsx(ln,{className:"h-4 w-4"})})}),l.jsxs(un,{children:[l.jsxs(dn,{children:[l.jsx(fn,{children:"确认删除"}),l.jsxs(mn,{children:["确定要删除用户 ",i," 吗?此操作无法撤销。"]})]}),l.jsxs(hn,{children:[l.jsx(gn,{children:"取消"}),l.jsx(pn,{onClick:()=>r("private",a),children:"删除"})]})]})]})]},a)),t.chat.private_list.length===0&&l.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无用户"})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[l.jsxs("div",{children:[l.jsx(de,{className:"text-sm md:text-base",children:"全局禁止名单"}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"名单中的用户无法进行任何聊天"})]}),l.jsxs(fe,{onClick:()=>n("ban"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[l.jsx(io,{className:"mr-1 h-4 w-4"}),"添加用户"]})]}),t.chat.ban_user_id.map((i,a)=>l.jsxs("div",{className:"flex gap-2",children:[l.jsx(Pe,{type:"number",value:i,onChange:o=>s("ban",a,parseInt(o.target.value)||0),placeholder:"输入QQ号",className:"text-sm md:text-base"}),l.jsxs(wn,{children:[l.jsx(Lr,{asChild:!0,children:l.jsx(fe,{size:"icon",variant:"outline",children:l.jsx(ln,{className:"h-4 w-4"})})}),l.jsxs(un,{children:[l.jsxs(dn,{children:[l.jsx(fn,{children:"确认删除"}),l.jsxs(mn,{children:["确定要从全局禁止名单中删除用户 ",i," 吗?此操作无法撤销。"]})]}),l.jsxs(hn,{children:[l.jsx(gn,{children:"取消"}),l.jsx(pn,{onClick:()=>r("ban",a),children:"删除"})]})]})]})]},a)),t.chat.ban_user_id.length===0&&l.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无禁止用户"})]}),l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{children:[l.jsx(de,{className:"text-sm md:text-base",children:"屏蔽QQ官方机器人"}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"是否屏蔽来自QQ官方机器人的消息"})]}),l.jsx(_t,{checked:t.chat.ban_qq_bot,onCheckedChange:i=>e({...t,chat:{...t.chat,ban_qq_bot:i}})})]}),l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{children:[l.jsx(de,{className:"text-sm md:text-base",children:"启用戳一戳功能"}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"是否响应戳一戳消息"})]}),l.jsx(_t,{checked:t.chat.enable_poke,onCheckedChange:i=>e({...t,chat:{...t.chat,enable_poke:i}})})]})]})]})})}function e0e({config:t,onChange:e}){return l.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:l.jsxs("div",{children:[l.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"发送语音设置"}),l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{children:[l.jsx(de,{className:"text-sm md:text-base",children:"使用 TTS 语音"}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"请确保已配置 TTS 并有对应的适配器"})]}),l.jsx(_t,{checked:t.voice.use_tts,onCheckedChange:n=>e({...t,voice:{use_tts:n}})})]})]})})}function t0e({config:t,onChange:e}){return l.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:l.jsxs("div",{children:[l.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"调试设置"}),l.jsx("div",{className:"grid gap-3 md:gap-4",children:l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{className:"text-sm md:text-base",children:"日志等级"}),l.jsxs(zt,{value:t.debug.level,onValueChange:n=>e({...t,debug:{level:n}}),children:[l.jsx(At,{children:l.jsx(Pt,{})}),l.jsxs(Rt,{children:[l.jsx(ze,{value:"DEBUG",children:"DEBUG(调试)"}),l.jsx(ze,{value:"INFO",children:"INFO(信息)"}),l.jsx(ze,{value:"WARNING",children:"WARNING(警告)"}),l.jsx(ze,{value:"ERROR",children:"ERROR(错误)"}),l.jsx(ze,{value:"CRITICAL",children:"CRITICAL(严重)"})]})]}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"设置适配器的日志输出等级"})]})})]})})}function t_(t){const e=[],n=String(t||"");let r=n.indexOf(","),s=0,i=!1;for(;!i;){r===-1&&(r=n.length,i=!0);const a=n.slice(s,r).trim();(a||!i)&&e.push(a),s=r+1,r=n.indexOf(",",s)}return e}function n0e(t,e){const n={};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const r0e=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,s0e=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,i0e={};function n_(t,e){return(i0e.jsx?s0e:r0e).test(t)}const a0e=/[ \t\n\f\r]/g;function l0e(t){return typeof t=="object"?t.type==="text"?r_(t.value):!1:r_(t)}function r_(t){return t.replace(a0e,"")===""}class ap{constructor(e,n,r){this.normal=n,this.property=e,r&&(this.space=r)}}ap.prototype.normal={};ap.prototype.property={};ap.prototype.space=void 0;function qF(t,e){const n={},r={};for(const s of t)Object.assign(n,s.property),Object.assign(r,s.normal);return new ap(n,r,e)}function g0(t){return t.toLowerCase()}class ui{constructor(e,n){this.attribute=n,this.property=e}}ui.prototype.attribute="";ui.prototype.booleanish=!1;ui.prototype.boolean=!1;ui.prototype.commaOrSpaceSeparated=!1;ui.prototype.commaSeparated=!1;ui.prototype.defined=!1;ui.prototype.mustUseProperty=!1;ui.prototype.number=!1;ui.prototype.overloadedBoolean=!1;ui.prototype.property="";ui.prototype.spaceSeparated=!1;ui.prototype.space=void 0;let o0e=0;const Ft=$u(),Rr=$u(),GS=$u(),Fe=$u(),Wn=$u(),lh=$u(),Oi=$u();function $u(){return 2**++o0e}const XS=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ft,booleanish:Rr,commaOrSpaceSeparated:Oi,commaSeparated:lh,number:Fe,overloadedBoolean:GS,spaceSeparated:Wn},Symbol.toStringTag,{value:"Module"})),e4=Object.keys(XS);class jO extends ui{constructor(e,n,r,s){let i=-1;if(super(e,n),s_(this,"space",s),typeof r=="number")for(;++i4&&n.slice(0,4)==="data"&&f0e.test(e)){if(e.charAt(4)==="-"){const i=e.slice(5).replace(i_,p0e);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=e.slice(4);if(!i_.test(i)){let a=i.replace(h0e,m0e);a.charAt(0)!=="-"&&(a="-"+a),e="data"+a}}s=jO}return new s(r,e)}function m0e(t){return"-"+t.toLowerCase()}function p0e(t){return t.charAt(1).toUpperCase()}const GF=qF([FF,c0e,HF,VF,UF],"html"),my=qF([FF,u0e,HF,VF,UF],"svg");function a_(t){const e=String(t||"").trim();return e?e.split(/[ \t\n\r\f]+/g):[]}function g0e(t){return t.join(" ").trim()}var Cd={},t4,l_;function x0e(){if(l_)return t4;l_=1;var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,e=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,i=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,a=/^[;\s]*/,o=/^\s+|\s+$/g,c=` -`,h="/",f="*",m="",g="comment",x="declaration";function y(S,k){if(typeof S!="string")throw new TypeError("First argument must be a string");if(!S)return[];k=k||{};var N=1,C=1;function T(z){var H=z.match(e);H&&(N+=H.length);var P=z.lastIndexOf(c);C=~P?z.length-P:C+z.length}function _(){var z={line:N,column:C};return function(H){return H.position=new E(z),L(),H}}function E(z){this.start=z,this.end={line:N,column:C},this.source=k.source}E.prototype.content=S;function M(z){var H=new Error(k.source+":"+N+":"+C+": "+z);if(H.reason=z,H.filename=k.source,H.line=N,H.column=C,H.source=S,!k.silent)throw H}function q(z){var H=z.exec(S);if(H){var P=H[0];return T(P),S=S.slice(P.length),H}}function L(){q(n)}function I(z){var H;for(z=z||[];H=$();)H!==!1&&z.push(H);return z}function $(){var z=_();if(!(h!=S.charAt(0)||f!=S.charAt(1))){for(var H=2;m!=S.charAt(H)&&(f!=S.charAt(H)||h!=S.charAt(H+1));)++H;if(H+=2,m===S.charAt(H-1))return M("End of comment missing");var P=S.slice(2,H-2);return C+=2,T(P),S=S.slice(H),C+=2,z({type:g,comment:P})}}function V(){var z=_(),H=q(r);if(H){if($(),!q(s))return M("property missing ':'");var P=q(i),W=z({type:x,property:w(H[0].replace(t,m)),value:P?w(P[0].replace(t,m)):m});return q(a),W}}function ee(){var z=[];I(z);for(var H;H=V();)H!==!1&&(z.push(H),I(z));return z}return L(),ee()}function w(S){return S?S.replace(o,m):m}return t4=y,t4}var o_;function v0e(){if(o_)return Cd;o_=1;var t=Cd&&Cd.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Cd,"__esModule",{value:!0}),Cd.default=n;const e=t(x0e());function n(r,s){let i=null;if(!r||typeof r!="string")return i;const a=(0,e.default)(r),o=typeof s=="function";return a.forEach(c=>{if(c.type!=="declaration")return;const{property:h,value:f}=c;o?s(h,f,c):f&&(i=i||{},i[h]=f)}),i}return Cd}var sm={},c_;function y0e(){if(c_)return sm;c_=1,Object.defineProperty(sm,"__esModule",{value:!0}),sm.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,e=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,s=/^-(ms)-/,i=function(h){return!h||n.test(h)||t.test(h)},a=function(h,f){return f.toUpperCase()},o=function(h,f){return"".concat(f,"-")},c=function(h,f){return f===void 0&&(f={}),i(h)?h:(h=h.toLowerCase(),f.reactCompat?h=h.replace(s,o):h=h.replace(r,o),h.replace(e,a))};return sm.camelCase=c,sm}var im,u_;function b0e(){if(u_)return im;u_=1;var t=im&&im.__importDefault||function(s){return s&&s.__esModule?s:{default:s}},e=t(v0e()),n=y0e();function r(s,i){var a={};return!s||typeof s!="string"||(0,e.default)(s,function(o,c){o&&c&&(a[(0,n.camelCase)(o,i)]=c)}),a}return r.default=r,im=r,im}var w0e=b0e();const S0e=zk(w0e),XF=YF("end"),NO=YF("start");function YF(t){return e;function e(n){const r=n&&n.position&&n.position[t]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function k0e(t){const e=NO(t),n=XF(t);if(e&&n)return{start:e,end:n}}function Pm(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?d_(t.position):"start"in t||"end"in t?d_(t):"line"in t||"column"in t?YS(t):""}function YS(t){return h_(t&&t.line)+":"+h_(t&&t.column)}function d_(t){return YS(t&&t.start)+"-"+YS(t&&t.end)}function h_(t){return t&&typeof t=="number"?t:1}class js extends Error{constructor(e,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let s="",i={},a=!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 e=="string"?s=e:!i.cause&&e&&(a=!0,s=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof r=="string"){const c=r.indexOf(":");c===-1?i.ruleId=r:(i.source=r.slice(0,c),i.ruleId=r.slice(c+1))}if(!i.place&&i.ancestors&&i.ancestors){const c=i.ancestors[i.ancestors.length-1];c&&(i.place=c.position)}const o=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=o?o.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=o?o.line:void 0,this.name=Pm(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=a&&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}}js.prototype.file="";js.prototype.name="";js.prototype.reason="";js.prototype.message="";js.prototype.stack="";js.prototype.column=void 0;js.prototype.line=void 0;js.prototype.ancestors=void 0;js.prototype.cause=void 0;js.prototype.fatal=void 0;js.prototype.place=void 0;js.prototype.ruleId=void 0;js.prototype.source=void 0;const CO={}.hasOwnProperty,O0e=new Map,j0e=/[A-Z]/g,N0e=new Set(["table","tbody","thead","tfoot","tr"]),C0e=new Set(["td","th"]),KF="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function T0e(t,e){if(!e||e.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=e.filePath||void 0;let r;if(e.development){if(typeof e.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=P0e(n,e.jsxDEV)}else{if(typeof e.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof e.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=z0e(n,e.jsx,e.jsxs)}const s={Fragment:e.Fragment,ancestors:[],components:e.components||{},create:r,elementAttributeNameCase:e.elementAttributeNameCase||"react",evaluater:e.createEvaluater?e.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:e.ignoreInvalidStyle||!1,passKeys:e.passKeys!==!1,passNode:e.passNode||!1,schema:e.space==="svg"?my:GF,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},i=ZF(s,t,void 0);return i&&typeof i!="string"?i:s.create(t,s.Fragment,{children:i||void 0},void 0)}function ZF(t,e,n){if(e.type==="element")return E0e(t,e,n);if(e.type==="mdxFlowExpression"||e.type==="mdxTextExpression")return _0e(t,e);if(e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement")return A0e(t,e,n);if(e.type==="mdxjsEsm")return M0e(t,e);if(e.type==="root")return R0e(t,e,n);if(e.type==="text")return D0e(t,e)}function E0e(t,e,n){const r=t.schema;let s=r;e.tagName.toLowerCase()==="svg"&&r.space==="html"&&(s=my,t.schema=s),t.ancestors.push(e);const i=e$(t,e.tagName,!1),a=L0e(t,e);let o=EO(t,e);return N0e.has(e.tagName)&&(o=o.filter(function(c){return typeof c=="string"?!l0e(c):!0})),JF(t,a,i,e),TO(a,o),t.ancestors.pop(),t.schema=r,t.create(e,i,a,n)}function _0e(t,e){if(e.data&&e.data.estree&&t.evaluater){const r=e.data.estree.body[0];return r.type,t.evaluater.evaluateExpression(r.expression)}x0(t,e.position)}function M0e(t,e){if(e.data&&e.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(e.data.estree);x0(t,e.position)}function A0e(t,e,n){const r=t.schema;let s=r;e.name==="svg"&&r.space==="html"&&(s=my,t.schema=s),t.ancestors.push(e);const i=e.name===null?t.Fragment:e$(t,e.name,!0),a=I0e(t,e),o=EO(t,e);return JF(t,a,i,e),TO(a,o),t.ancestors.pop(),t.schema=r,t.create(e,i,a,n)}function R0e(t,e,n){const r={};return TO(r,EO(t,e)),t.create(e,t.Fragment,r,n)}function D0e(t,e){return e.value}function JF(t,e,n,r){typeof n!="string"&&n!==t.Fragment&&t.passNode&&(e.node=r)}function TO(t,e){if(e.length>0){const n=e.length>1?e:e[0];n&&(t.children=n)}}function z0e(t,e,n){return r;function r(s,i,a,o){const h=Array.isArray(a.children)?n:e;return o?h(i,a,o):h(i,a)}}function P0e(t,e){return n;function n(r,s,i,a){const o=Array.isArray(i.children),c=NO(r);return e(s,i,a,o,{columnNumber:c?c.column-1:void 0,fileName:t,lineNumber:c?c.line:void 0},void 0)}}function L0e(t,e){const n={};let r,s;for(s in e.properties)if(s!=="children"&&CO.call(e.properties,s)){const i=B0e(t,s,e.properties[s]);if(i){const[a,o]=i;t.tableCellAlignToStyle&&a==="align"&&typeof o=="string"&&C0e.has(e.tagName)?r=o:n[a]=o}}if(r){const i=n.style||(n.style={});i[t.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function I0e(t,e){const n={};for(const r of e.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&t.evaluater){const i=r.data.estree.body[0];i.type;const a=i.expression;a.type;const o=a.properties[0];o.type,Object.assign(n,t.evaluater.evaluateExpression(o.argument))}else x0(t,e.position);else{const s=r.name;let i;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&t.evaluater){const o=r.value.data.estree.body[0];o.type,i=t.evaluater.evaluateExpression(o.expression)}else x0(t,e.position);else i=r.value===null?!0:r.value;n[s]=i}return n}function EO(t,e){const n=[];let r=-1;const s=t.passKeys?new Map:O0e;for(;++rs?0:s+e:e=e>s?s:e,n=n>0?n:0,r.length<1e4)a=Array.from(r),a.unshift(e,n),t.splice(...a);else for(n&&t.splice(e,n);i0?(Mi(t,t.length,0,e),t):e}const p_={}.hasOwnProperty;function n$(t){const e={};let n=-1;for(;++n13&&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 Na(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Ms=Dc(/[A-Za-z]/),ks=Dc(/[\dA-Za-z]/),G0e=Dc(/[#-'*+\--9=?A-Z^-~]/);function sv(t){return t!==null&&(t<32||t===127)}const KS=Dc(/\d/),X0e=Dc(/[\dA-Fa-f]/),Y0e=Dc(/[!-/:-@[-`{-~]/);function ut(t){return t!==null&&t<-2}function Vn(t){return t!==null&&(t<0||t===32)}function Zt(t){return t===-2||t===-1||t===32}const py=Dc(new RegExp("\\p{P}|\\p{S}","u")),Pu=Dc(/\s/);function Dc(t){return e;function e(n){return n!==null&&n>-1&&t.test(String.fromCharCode(n))}}function Zh(t){const e=[];let n=-1,r=0,s=0;for(;++n55295&&i<57344){const o=t.charCodeAt(n+1);i<56320&&o>56319&&o<57344?(a=String.fromCharCode(i,o),s=1):a="�"}else a=String.fromCharCode(i);a&&(e.push(t.slice(r,n),encodeURIComponent(a)),r=n+s+1,a=""),s&&(n+=s,s=0)}return e.join("")+t.slice(r)}function Wt(t,e,n,r){const s=r?r-1:Number.POSITIVE_INFINITY;let i=0;return a;function a(c){return Zt(c)?(t.enter(n),o(c)):e(c)}function o(c){return Zt(c)&&i++a))return;const M=e.events.length;let q=M,L,I;for(;q--;)if(e.events[q][0]==="exit"&&e.events[q][1].type==="chunkFlow"){if(L){I=e.events[q][1].end;break}L=!0}for(k(r),E=M;EC;){const _=n[T];e.containerState=_[1],_[0].exit.call(e,t)}n.length=C}function N(){s.write([null]),i=void 0,s=void 0,e.containerState._closeFlow=void 0}}function tpe(t,e,n){return Wt(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Ch(t){if(t===null||Vn(t)||Pu(t))return 1;if(py(t))return 2}function gy(t,e,n){const r=[];let s=-1;for(;++s1&&t[n][1].end.offset-t[n][1].start.offset>1?2:1;const m={...t[r][1].end},g={...t[n][1].start};x_(m,-c),x_(g,c),a={type:c>1?"strongSequence":"emphasisSequence",start:m,end:{...t[r][1].end}},o={type:c>1?"strongSequence":"emphasisSequence",start:{...t[n][1].start},end:g},i={type:c>1?"strongText":"emphasisText",start:{...t[r][1].end},end:{...t[n][1].start}},s={type:c>1?"strong":"emphasis",start:{...a.start},end:{...o.end}},t[r][1].end={...a.start},t[n][1].start={...o.end},h=[],t[r][1].end.offset-t[r][1].start.offset&&(h=Xi(h,[["enter",t[r][1],e],["exit",t[r][1],e]])),h=Xi(h,[["enter",s,e],["enter",a,e],["exit",a,e],["enter",i,e]]),h=Xi(h,gy(e.parser.constructs.insideSpan.null,t.slice(r+1,n),e)),h=Xi(h,[["exit",i,e],["enter",o,e],["exit",o,e],["exit",s,e]]),t[n][1].end.offset-t[n][1].start.offset?(f=2,h=Xi(h,[["enter",t[n][1],e],["exit",t[n][1],e]])):f=0,Mi(t,r-1,n-r+3,h),n=r+h.length-f-2;break}}for(n=-1;++n0&&Zt(E)?Wt(t,N,"linePrefix",i+1)(E):N(E)}function N(E){return E===null||ut(E)?t.check(v_,w,T)(E):(t.enter("codeFlowValue"),C(E))}function C(E){return E===null||ut(E)?(t.exit("codeFlowValue"),N(E)):(t.consume(E),C)}function T(E){return t.exit("codeFenced"),e(E)}function _(E,M,q){let L=0;return I;function I(H){return E.enter("lineEnding"),E.consume(H),E.exit("lineEnding"),$}function $(H){return E.enter("codeFencedFence"),Zt(H)?Wt(E,V,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(H):V(H)}function V(H){return H===o?(E.enter("codeFencedFenceSequence"),ee(H)):q(H)}function ee(H){return H===o?(L++,E.consume(H),ee):L>=a?(E.exit("codeFencedFenceSequence"),Zt(H)?Wt(E,z,"whitespace")(H):z(H)):q(H)}function z(H){return H===null||ut(H)?(E.exit("codeFencedFence"),M(H)):q(H)}}}function fpe(t,e,n){const r=this;return s;function s(a){return a===null?n(a):(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),i)}function i(a){return r.parser.lazy[r.now().line]?n(a):e(a)}}const r4={name:"codeIndented",tokenize:ppe},mpe={partial:!0,tokenize:gpe};function ppe(t,e,n){const r=this;return s;function s(h){return t.enter("codeIndented"),Wt(t,i,"linePrefix",5)(h)}function i(h){const f=r.events[r.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?a(h):n(h)}function a(h){return h===null?c(h):ut(h)?t.attempt(mpe,a,c)(h):(t.enter("codeFlowValue"),o(h))}function o(h){return h===null||ut(h)?(t.exit("codeFlowValue"),a(h)):(t.consume(h),o)}function c(h){return t.exit("codeIndented"),e(h)}}function gpe(t,e,n){const r=this;return s;function s(a){return r.parser.lazy[r.now().line]?n(a):ut(a)?(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),s):Wt(t,i,"linePrefix",5)(a)}function i(a){const o=r.events[r.events.length-1];return o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?e(a):ut(a)?s(a):n(a)}}const xpe={name:"codeText",previous:ype,resolve:vpe,tokenize:bpe};function vpe(t){let e=t.length-4,n=3,r,s;if((t[n][1].type==="lineEnding"||t[n][1].type==="space")&&(t[e][1].type==="lineEnding"||t[e][1].type==="space")){for(r=n;++r=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return ethis.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(e,n,r){const s=n||0;this.setCursor(Math.trunc(e));const i=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return r&&am(this.left,r),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),am(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),am(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e=4?e(a):t.interrupt(r.parser.constructs.flow,n,e)(a)}}function o$(t,e,n,r,s,i,a,o,c){const h=c||Number.POSITIVE_INFINITY;let f=0;return m;function m(k){return k===60?(t.enter(r),t.enter(s),t.enter(i),t.consume(k),t.exit(i),g):k===null||k===32||k===41||sv(k)?n(k):(t.enter(r),t.enter(a),t.enter(o),t.enter("chunkString",{contentType:"string"}),w(k))}function g(k){return k===62?(t.enter(i),t.consume(k),t.exit(i),t.exit(s),t.exit(r),e):(t.enter(o),t.enter("chunkString",{contentType:"string"}),x(k))}function x(k){return k===62?(t.exit("chunkString"),t.exit(o),g(k)):k===null||k===60||ut(k)?n(k):(t.consume(k),k===92?y:x)}function y(k){return k===60||k===62||k===92?(t.consume(k),x):x(k)}function w(k){return!f&&(k===null||k===41||Vn(k))?(t.exit("chunkString"),t.exit(o),t.exit(a),t.exit(r),e(k)):f999||x===null||x===91||x===93&&!c||x===94&&!o&&"_hiddenFootnoteSupport"in a.parser.constructs?n(x):x===93?(t.exit(i),t.enter(s),t.consume(x),t.exit(s),t.exit(r),e):ut(x)?(t.enter("lineEnding"),t.consume(x),t.exit("lineEnding"),f):(t.enter("chunkString",{contentType:"string"}),m(x))}function m(x){return x===null||x===91||x===93||ut(x)||o++>999?(t.exit("chunkString"),f(x)):(t.consume(x),c||(c=!Zt(x)),x===92?g:m)}function g(x){return x===91||x===92||x===93?(t.consume(x),o++,m):m(x)}}function u$(t,e,n,r,s,i){let a;return o;function o(g){return g===34||g===39||g===40?(t.enter(r),t.enter(s),t.consume(g),t.exit(s),a=g===40?41:g,c):n(g)}function c(g){return g===a?(t.enter(s),t.consume(g),t.exit(s),t.exit(r),e):(t.enter(i),h(g))}function h(g){return g===a?(t.exit(i),c(a)):g===null?n(g):ut(g)?(t.enter("lineEnding"),t.consume(g),t.exit("lineEnding"),Wt(t,h,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),f(g))}function f(g){return g===a||g===null||ut(g)?(t.exit("chunkString"),h(g)):(t.consume(g),g===92?m:f)}function m(g){return g===a||g===92?(t.consume(g),f):f(g)}}function Lm(t,e){let n;return r;function r(s){return ut(s)?(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),n=!0,r):Zt(s)?Wt(t,r,n?"linePrefix":"lineSuffix")(s):e(s)}}const Tpe={name:"definition",tokenize:_pe},Epe={partial:!0,tokenize:Mpe};function _pe(t,e,n){const r=this;let s;return i;function i(x){return t.enter("definition"),a(x)}function a(x){return c$.call(r,t,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(x)}function o(x){return s=Na(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),x===58?(t.enter("definitionMarker"),t.consume(x),t.exit("definitionMarker"),c):n(x)}function c(x){return Vn(x)?Lm(t,h)(x):h(x)}function h(x){return o$(t,f,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(x)}function f(x){return t.attempt(Epe,m,m)(x)}function m(x){return Zt(x)?Wt(t,g,"whitespace")(x):g(x)}function g(x){return x===null||ut(x)?(t.exit("definition"),r.parser.defined.push(s),e(x)):n(x)}}function Mpe(t,e,n){return r;function r(o){return Vn(o)?Lm(t,s)(o):n(o)}function s(o){return u$(t,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function i(o){return Zt(o)?Wt(t,a,"whitespace")(o):a(o)}function a(o){return o===null||ut(o)?e(o):n(o)}}const Ape={name:"hardBreakEscape",tokenize:Rpe};function Rpe(t,e,n){return r;function r(i){return t.enter("hardBreakEscape"),t.consume(i),s}function s(i){return ut(i)?(t.exit("hardBreakEscape"),e(i)):n(i)}}const Dpe={name:"headingAtx",resolve:zpe,tokenize:Ppe};function zpe(t,e){let n=t.length-2,r=3,s,i;return t[r][1].type==="whitespace"&&(r+=2),n-2>r&&t[n][1].type==="whitespace"&&(n-=2),t[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&t[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(s={type:"atxHeadingText",start:t[r][1].start,end:t[n][1].end},i={type:"chunkText",start:t[r][1].start,end:t[n][1].end,contentType:"text"},Mi(t,r,n-r+1,[["enter",s,e],["enter",i,e],["exit",i,e],["exit",s,e]])),t}function Ppe(t,e,n){let r=0;return s;function s(f){return t.enter("atxHeading"),i(f)}function i(f){return t.enter("atxHeadingSequence"),a(f)}function a(f){return f===35&&r++<6?(t.consume(f),a):f===null||Vn(f)?(t.exit("atxHeadingSequence"),o(f)):n(f)}function o(f){return f===35?(t.enter("atxHeadingSequence"),c(f)):f===null||ut(f)?(t.exit("atxHeading"),e(f)):Zt(f)?Wt(t,o,"whitespace")(f):(t.enter("atxHeadingText"),h(f))}function c(f){return f===35?(t.consume(f),c):(t.exit("atxHeadingSequence"),o(f))}function h(f){return f===null||f===35||Vn(f)?(t.exit("atxHeadingText"),o(f)):(t.consume(f),h)}}const Lpe=["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"],b_=["pre","script","style","textarea"],Ipe={concrete:!0,name:"htmlFlow",resolveTo:Fpe,tokenize:$pe},Bpe={partial:!0,tokenize:Hpe},qpe={partial:!0,tokenize:Qpe};function Fpe(t){let e=t.length;for(;e--&&!(t[e][0]==="enter"&&t[e][1].type==="htmlFlow"););return e>1&&t[e-2][1].type==="linePrefix"&&(t[e][1].start=t[e-2][1].start,t[e+1][1].start=t[e-2][1].start,t.splice(e-2,2)),t}function $pe(t,e,n){const r=this;let s,i,a,o,c;return h;function h(F){return f(F)}function f(F){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(F),m}function m(F){return F===33?(t.consume(F),g):F===47?(t.consume(F),i=!0,w):F===63?(t.consume(F),s=3,r.interrupt?e:R):Ms(F)?(t.consume(F),a=String.fromCharCode(F),S):n(F)}function g(F){return F===45?(t.consume(F),s=2,x):F===91?(t.consume(F),s=5,o=0,y):Ms(F)?(t.consume(F),s=4,r.interrupt?e:R):n(F)}function x(F){return F===45?(t.consume(F),r.interrupt?e:R):n(F)}function y(F){const U="CDATA[";return F===U.charCodeAt(o++)?(t.consume(F),o===U.length?r.interrupt?e:V:y):n(F)}function w(F){return Ms(F)?(t.consume(F),a=String.fromCharCode(F),S):n(F)}function S(F){if(F===null||F===47||F===62||Vn(F)){const U=F===47,te=a.toLowerCase();return!U&&!i&&b_.includes(te)?(s=1,r.interrupt?e(F):V(F)):Lpe.includes(a.toLowerCase())?(s=6,U?(t.consume(F),k):r.interrupt?e(F):V(F)):(s=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(F):i?N(F):C(F))}return F===45||ks(F)?(t.consume(F),a+=String.fromCharCode(F),S):n(F)}function k(F){return F===62?(t.consume(F),r.interrupt?e:V):n(F)}function N(F){return Zt(F)?(t.consume(F),N):I(F)}function C(F){return F===47?(t.consume(F),I):F===58||F===95||Ms(F)?(t.consume(F),T):Zt(F)?(t.consume(F),C):I(F)}function T(F){return F===45||F===46||F===58||F===95||ks(F)?(t.consume(F),T):_(F)}function _(F){return F===61?(t.consume(F),E):Zt(F)?(t.consume(F),_):C(F)}function E(F){return F===null||F===60||F===61||F===62||F===96?n(F):F===34||F===39?(t.consume(F),c=F,M):Zt(F)?(t.consume(F),E):q(F)}function M(F){return F===c?(t.consume(F),c=null,L):F===null||ut(F)?n(F):(t.consume(F),M)}function q(F){return F===null||F===34||F===39||F===47||F===60||F===61||F===62||F===96||Vn(F)?_(F):(t.consume(F),q)}function L(F){return F===47||F===62||Zt(F)?C(F):n(F)}function I(F){return F===62?(t.consume(F),$):n(F)}function $(F){return F===null||ut(F)?V(F):Zt(F)?(t.consume(F),$):n(F)}function V(F){return F===45&&s===2?(t.consume(F),P):F===60&&s===1?(t.consume(F),W):F===62&&s===4?(t.consume(F),se):F===63&&s===3?(t.consume(F),R):F===93&&s===5?(t.consume(F),X):ut(F)&&(s===6||s===7)?(t.exit("htmlFlowData"),t.check(Bpe,G,ee)(F)):F===null||ut(F)?(t.exit("htmlFlowData"),ee(F)):(t.consume(F),V)}function ee(F){return t.check(qpe,z,G)(F)}function z(F){return t.enter("lineEnding"),t.consume(F),t.exit("lineEnding"),H}function H(F){return F===null||ut(F)?ee(F):(t.enter("htmlFlowData"),V(F))}function P(F){return F===45?(t.consume(F),R):V(F)}function W(F){return F===47?(t.consume(F),a="",J):V(F)}function J(F){if(F===62){const U=a.toLowerCase();return b_.includes(U)?(t.consume(F),se):V(F)}return Ms(F)&&a.length<8?(t.consume(F),a+=String.fromCharCode(F),J):V(F)}function X(F){return F===93?(t.consume(F),R):V(F)}function R(F){return F===62?(t.consume(F),se):F===45&&s===2?(t.consume(F),R):V(F)}function se(F){return F===null||ut(F)?(t.exit("htmlFlowData"),G(F)):(t.consume(F),se)}function G(F){return t.exit("htmlFlow"),e(F)}}function Qpe(t,e,n){const r=this;return s;function s(a){return ut(a)?(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),i):n(a)}function i(a){return r.parser.lazy[r.now().line]?n(a):e(a)}}function Hpe(t,e,n){return r;function r(s){return t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),t.attempt(lp,e,n)}}const Vpe={name:"htmlText",tokenize:Upe};function Upe(t,e,n){const r=this;let s,i,a;return o;function o(R){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(R),c}function c(R){return R===33?(t.consume(R),h):R===47?(t.consume(R),_):R===63?(t.consume(R),C):Ms(R)?(t.consume(R),q):n(R)}function h(R){return R===45?(t.consume(R),f):R===91?(t.consume(R),i=0,y):Ms(R)?(t.consume(R),N):n(R)}function f(R){return R===45?(t.consume(R),x):n(R)}function m(R){return R===null?n(R):R===45?(t.consume(R),g):ut(R)?(a=m,W(R)):(t.consume(R),m)}function g(R){return R===45?(t.consume(R),x):m(R)}function x(R){return R===62?P(R):R===45?g(R):m(R)}function y(R){const se="CDATA[";return R===se.charCodeAt(i++)?(t.consume(R),i===se.length?w:y):n(R)}function w(R){return R===null?n(R):R===93?(t.consume(R),S):ut(R)?(a=w,W(R)):(t.consume(R),w)}function S(R){return R===93?(t.consume(R),k):w(R)}function k(R){return R===62?P(R):R===93?(t.consume(R),k):w(R)}function N(R){return R===null||R===62?P(R):ut(R)?(a=N,W(R)):(t.consume(R),N)}function C(R){return R===null?n(R):R===63?(t.consume(R),T):ut(R)?(a=C,W(R)):(t.consume(R),C)}function T(R){return R===62?P(R):C(R)}function _(R){return Ms(R)?(t.consume(R),E):n(R)}function E(R){return R===45||ks(R)?(t.consume(R),E):M(R)}function M(R){return ut(R)?(a=M,W(R)):Zt(R)?(t.consume(R),M):P(R)}function q(R){return R===45||ks(R)?(t.consume(R),q):R===47||R===62||Vn(R)?L(R):n(R)}function L(R){return R===47?(t.consume(R),P):R===58||R===95||Ms(R)?(t.consume(R),I):ut(R)?(a=L,W(R)):Zt(R)?(t.consume(R),L):P(R)}function I(R){return R===45||R===46||R===58||R===95||ks(R)?(t.consume(R),I):$(R)}function $(R){return R===61?(t.consume(R),V):ut(R)?(a=$,W(R)):Zt(R)?(t.consume(R),$):L(R)}function V(R){return R===null||R===60||R===61||R===62||R===96?n(R):R===34||R===39?(t.consume(R),s=R,ee):ut(R)?(a=V,W(R)):Zt(R)?(t.consume(R),V):(t.consume(R),z)}function ee(R){return R===s?(t.consume(R),s=void 0,H):R===null?n(R):ut(R)?(a=ee,W(R)):(t.consume(R),ee)}function z(R){return R===null||R===34||R===39||R===60||R===61||R===96?n(R):R===47||R===62||Vn(R)?L(R):(t.consume(R),z)}function H(R){return R===47||R===62||Vn(R)?L(R):n(R)}function P(R){return R===62?(t.consume(R),t.exit("htmlTextData"),t.exit("htmlText"),e):n(R)}function W(R){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(R),t.exit("lineEnding"),J}function J(R){return Zt(R)?Wt(t,X,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):X(R)}function X(R){return t.enter("htmlTextData"),a(R)}}const AO={name:"labelEnd",resolveAll:Ype,resolveTo:Kpe,tokenize:Zpe},Wpe={tokenize:Jpe},Gpe={tokenize:ege},Xpe={tokenize:tge};function Ype(t){let e=-1;const n=[];for(;++e=3&&(h===null||ut(h))?(t.exit("thematicBreak"),e(h)):n(h)}function c(h){return h===s?(t.consume(h),r++,c):(t.exit("thematicBreakSequence"),Zt(h)?Wt(t,o,"whitespace")(h):o(h))}}const Gs={continuation:{tokenize:dge},exit:fge,name:"list",tokenize:uge},oge={partial:!0,tokenize:mge},cge={partial:!0,tokenize:hge};function uge(t,e,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,a=0;return o;function o(x){const y=r.containerState.type||(x===42||x===43||x===45?"listUnordered":"listOrdered");if(y==="listUnordered"?!r.containerState.marker||x===r.containerState.marker:KS(x)){if(r.containerState.type||(r.containerState.type=y,t.enter(y,{_container:!0})),y==="listUnordered")return t.enter("listItemPrefix"),x===42||x===45?t.check(p1,n,h)(x):h(x);if(!r.interrupt||x===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),c(x)}return n(x)}function c(x){return KS(x)&&++a<10?(t.consume(x),c):(!r.interrupt||a<2)&&(r.containerState.marker?x===r.containerState.marker:x===41||x===46)?(t.exit("listItemValue"),h(x)):n(x)}function h(x){return t.enter("listItemMarker"),t.consume(x),t.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||x,t.check(lp,r.interrupt?n:f,t.attempt(oge,g,m))}function f(x){return r.containerState.initialBlankLine=!0,i++,g(x)}function m(x){return Zt(x)?(t.enter("listItemPrefixWhitespace"),t.consume(x),t.exit("listItemPrefixWhitespace"),g):n(x)}function g(x){return r.containerState.size=i+r.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(x)}}function dge(t,e,n){const r=this;return r.containerState._closeFlow=void 0,t.check(lp,s,i);function s(o){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Wt(t,e,"listItemIndent",r.containerState.size+1)(o)}function i(o){return r.containerState.furtherBlankLines||!Zt(o)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,a(o)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,t.attempt(cge,e,a)(o))}function a(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,Wt(t,t.attempt(Gs,e,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function hge(t,e,n){const r=this;return Wt(t,s,"listItemIndent",r.containerState.size+1);function s(i){const a=r.events[r.events.length-1];return a&&a[1].type==="listItemIndent"&&a[2].sliceSerialize(a[1],!0).length===r.containerState.size?e(i):n(i)}}function fge(t){t.exit(this.containerState.type)}function mge(t,e,n){const r=this;return Wt(t,s,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(i){const a=r.events[r.events.length-1];return!Zt(i)&&a&&a[1].type==="listItemPrefixWhitespace"?e(i):n(i)}}const w_={name:"setextUnderline",resolveTo:pge,tokenize:gge};function pge(t,e){let n=t.length,r,s,i;for(;n--;)if(t[n][0]==="enter"){if(t[n][1].type==="content"){r=n;break}t[n][1].type==="paragraph"&&(s=n)}else t[n][1].type==="content"&&t.splice(n,1),!i&&t[n][1].type==="definition"&&(i=n);const a={type:"setextHeading",start:{...t[r][1].start},end:{...t[t.length-1][1].end}};return t[s][1].type="setextHeadingText",i?(t.splice(s,0,["enter",a,e]),t.splice(i+1,0,["exit",t[r][1],e]),t[r][1].end={...t[i][1].end}):t[r][1]=a,t.push(["exit",a,e]),t}function gge(t,e,n){const r=this;let s;return i;function i(h){let f=r.events.length,m;for(;f--;)if(r.events[f][1].type!=="lineEnding"&&r.events[f][1].type!=="linePrefix"&&r.events[f][1].type!=="content"){m=r.events[f][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||m)?(t.enter("setextHeadingLine"),s=h,a(h)):n(h)}function a(h){return t.enter("setextHeadingLineSequence"),o(h)}function o(h){return h===s?(t.consume(h),o):(t.exit("setextHeadingLineSequence"),Zt(h)?Wt(t,c,"lineSuffix")(h):c(h))}function c(h){return h===null||ut(h)?(t.exit("setextHeadingLine"),e(h)):n(h)}}const xge={tokenize:vge};function vge(t){const e=this,n=t.attempt(lp,r,t.attempt(this.parser.constructs.flowInitial,s,Wt(t,t.attempt(this.parser.constructs.flow,s,t.attempt(kpe,s)),"linePrefix")));return n;function r(i){if(i===null){t.consume(i);return}return t.enter("lineEndingBlank"),t.consume(i),t.exit("lineEndingBlank"),e.currentConstruct=void 0,n}function s(i){if(i===null){t.consume(i);return}return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),e.currentConstruct=void 0,n}}const yge={resolveAll:h$()},bge=d$("string"),wge=d$("text");function d$(t){return{resolveAll:h$(t==="text"?Sge:void 0),tokenize:e};function e(n){const r=this,s=this.parser.constructs[t],i=n.attempt(s,a,o);return a;function a(f){return h(f)?i(f):o(f)}function o(f){if(f===null){n.consume(f);return}return n.enter("data"),n.consume(f),c}function c(f){return h(f)?(n.exit("data"),i(f)):(n.consume(f),c)}function h(f){if(f===null)return!0;const m=s[f];let g=-1;if(m)for(;++g-1){const o=a[0];typeof o=="string"?a[0]=o.slice(r):a.shift()}i>0&&a.push(t[s].slice(0,i))}return a}function zge(t,e){let n=-1;const r=[];let s;for(;++n{h(!0)},[]),vfe(b.useMemo(()=>({onDragStart(m){let{active:g}=m;i(e.onDragStart({active:g}))},onDragMove(m){let{active:g,over:x}=m;e.onDragMove&&i(e.onDragMove({active:g,over:x}))},onDragOver(m){let{active:g,over:x}=m;i(e.onDragOver({active:g,over:x}))},onDragEnd(m){let{active:g,over:x}=m;i(e.onDragEnd({active:g,over:x}))},onDragCancel(m){let{active:g,over:x}=m;i(e.onDragCancel({active:g,over:x}))}}),[i,e])),!c)return null;const f=he.createElement(he.Fragment,null,he.createElement(pfe,{id:r,value:s.draggable}),he.createElement(gfe,{id:o,announcement:a}));return n?fu.createPortal(f,n):f}var Zr;(function(t){t.DragStart="dragStart",t.DragMove="dragMove",t.DragEnd="dragEnd",t.DragCancel="dragCancel",t.DragOver="dragOver",t.RegisterDroppable="registerDroppable",t.SetDroppableDisabled="setDroppableDisabled",t.UnregisterDroppable="unregisterDroppable"})(Zr||(Zr={}));function rv(){}function FE(t,e){return b.useMemo(()=>({sensor:t,options:e??{}}),[t,e])}function kfe(){for(var t=arguments.length,e=new Array(t),n=0;n[...e].filter(r=>r!=null),[...e])}const Aa=Object.freeze({x:0,y:0});function SF(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function kF(t,e){let{data:{value:n}}=t,{data:{value:r}}=e;return n-r}function jfe(t,e){let{data:{value:n}}=t,{data:{value:r}}=e;return r-n}function $E(t){let{left:e,top:n,height:r,width:s}=t;return[{x:e,y:n},{x:e+s,y:n},{x:e,y:n+r},{x:e+s,y:n+r}]}function jF(t,e){if(!t||t.length===0)return null;const[n]=t;return n[e]}function QE(t,e,n){return e===void 0&&(e=t.left),n===void 0&&(n=t.top),{x:e+t.width*.5,y:n+t.height*.5}}const Ofe=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:r}=t;const s=QE(e,e.left,e.top),i=[];for(const a of r){const{id:o}=a,c=n.get(o);if(c){const h=SF(QE(c),s);i.push({id:o,data:{droppableContainer:a,value:h}})}}return i.sort(kF)},Nfe=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:r}=t;const s=$E(e),i=[];for(const a of r){const{id:o}=a,c=n.get(o);if(c){const h=$E(c),f=s.reduce((g,x,y)=>g+SF(h[y],x),0),m=Number((f/4).toFixed(4));i.push({id:o,data:{droppableContainer:a,value:m}})}}return i.sort(kF)};function Cfe(t,e){const n=Math.max(e.top,t.top),r=Math.max(e.left,t.left),s=Math.min(e.left+e.width,t.left+t.width),i=Math.min(e.top+e.height,t.top+t.height),a=s-r,o=i-n;if(r{let{collisionRect:e,droppableRects:n,droppableContainers:r}=t;const s=[];for(const i of r){const{id:a}=i,o=n.get(a);if(o){const c=Cfe(o,e);c>0&&s.push({id:a,data:{droppableContainer:i,value:c}})}}return s.sort(jfe)};function Efe(t,e,n){return{...t,scaleX:e&&n?e.width/n.width:1,scaleY:e&&n?e.height/n.height:1}}function OF(t,e){return t&&e?{x:t.left-e.left,y:t.top-e.top}:Aa}function _fe(t){return function(n){for(var r=arguments.length,s=new Array(r>1?r-1:0),i=1;i({...a,top:a.top+t*o.y,bottom:a.bottom+t*o.y,left:a.left+t*o.x,right:a.right+t*o.x}),{...n})}}const Mfe=_fe(1);function Afe(t){if(t.startsWith("matrix3d(")){const e=t.slice(9,-1).split(/, /);return{x:+e[12],y:+e[13],scaleX:+e[0],scaleY:+e[5]}}else if(t.startsWith("matrix(")){const e=t.slice(7,-1).split(/, /);return{x:+e[4],y:+e[5],scaleX:+e[0],scaleY:+e[3]}}return null}function Rfe(t,e,n){const r=Afe(e);if(!r)return t;const{scaleX:s,scaleY:i,x:a,y:o}=r,c=t.left-a-(1-s)*parseFloat(n),h=t.top-o-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),f=s?t.width/s:t.width,m=i?t.height/i:t.height;return{width:f,height:m,top:h,right:c+f,bottom:h+m,left:c}}const Dfe={ignoreTransform:!1};function Yh(t,e){e===void 0&&(e=Dfe);let n=t.getBoundingClientRect();if(e.ignoreTransform){const{transform:h,transformOrigin:f}=di(t).getComputedStyle(t);h&&(n=Rfe(n,h,f))}const{top:r,left:s,width:i,height:a,bottom:o,right:c}=n;return{top:r,left:s,width:i,height:a,bottom:o,right:c}}function HE(t){return Yh(t,{ignoreTransform:!0})}function zfe(t){const e=t.innerWidth,n=t.innerHeight;return{top:0,left:0,right:e,bottom:n,width:e,height:n}}function Pfe(t,e){return e===void 0&&(e=di(t).getComputedStyle(t)),e.position==="fixed"}function Lfe(t,e){e===void 0&&(e=di(t).getComputedStyle(t));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(s=>{const i=e[s];return typeof i=="string"?n.test(i):!1})}function gy(t,e){const n=[];function r(s){if(e!=null&&n.length>=e||!s)return n;if(vj(s)&&s.scrollingElement!=null&&!n.includes(s.scrollingElement))return n.push(s.scrollingElement),n;if(!ap(s)||yF(s)||n.includes(s))return n;const i=di(t).getComputedStyle(s);return s!==t&&Lfe(s,i)&&n.push(s),Pfe(s,i)?n:r(s.parentNode)}return t?r(t):n}function NF(t){const[e]=gy(t,1);return e??null}function n4(t){return!py||!t?null:Gh(t)?t:xj(t)?vj(t)||t===Xh(t).scrollingElement?window:ap(t)?t:null:null}function CF(t){return Gh(t)?t.scrollX:t.scrollLeft}function TF(t){return Gh(t)?t.scrollY:t.scrollTop}function KS(t){return{x:CF(t),y:TF(t)}}var ss;(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})(ss||(ss={}));function EF(t){return!py||!t?!1:t===document.scrollingElement}function _F(t){const e={x:0,y:0},n=EF(t)?{height:window.innerHeight,width:window.innerWidth}:{height:t.clientHeight,width:t.clientWidth},r={x:t.scrollWidth-n.width,y:t.scrollHeight-n.height},s=t.scrollTop<=e.y,i=t.scrollLeft<=e.x,a=t.scrollTop>=r.y,o=t.scrollLeft>=r.x;return{isTop:s,isLeft:i,isBottom:a,isRight:o,maxScroll:r,minScroll:e}}const Ife={x:.2,y:.2};function Bfe(t,e,n,r,s){let{top:i,left:a,right:o,bottom:c}=n;r===void 0&&(r=10),s===void 0&&(s=Ife);const{isTop:h,isBottom:f,isLeft:m,isRight:g}=_F(t),x={x:0,y:0},y={x:0,y:0},w={height:e.height*s.y,width:e.width*s.x};return!h&&i<=e.top+w.height?(x.y=ss.Backward,y.y=r*Math.abs((e.top+w.height-i)/w.height)):!f&&c>=e.bottom-w.height&&(x.y=ss.Forward,y.y=r*Math.abs((e.bottom-w.height-c)/w.height)),!g&&o>=e.right-w.width?(x.x=ss.Forward,y.x=r*Math.abs((e.right-w.width-o)/w.width)):!m&&a<=e.left+w.width&&(x.x=ss.Backward,y.x=r*Math.abs((e.left+w.width-a)/w.width)),{direction:x,speed:y}}function qfe(t){if(t===document.scrollingElement){const{innerWidth:i,innerHeight:a}=window;return{top:0,left:0,right:i,bottom:a,width:i,height:a}}const{top:e,left:n,right:r,bottom:s}=t.getBoundingClientRect();return{top:e,left:n,right:r,bottom:s,width:t.clientWidth,height:t.clientHeight}}function MF(t){return t.reduce((e,n)=>oh(e,KS(n)),Aa)}function Ffe(t){return t.reduce((e,n)=>e+CF(n),0)}function $fe(t){return t.reduce((e,n)=>e+TF(n),0)}function Qfe(t,e){if(e===void 0&&(e=Yh),!t)return;const{top:n,left:r,bottom:s,right:i}=e(t);NF(t)&&(s<=0||i<=0||n>=window.innerHeight||r>=window.innerWidth)&&t.scrollIntoView({block:"center",inline:"center"})}const Hfe=[["x",["left","right"],Ffe],["y",["top","bottom"],$fe]];class wj{constructor(e,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=gy(n),s=MF(r);this.rect={...e},this.width=e.width,this.height=e.height;for(const[i,a,o]of Hfe)for(const c of a)Object.defineProperty(this,c,{get:()=>{const h=o(r),f=s[i]-h;return this.rect[c]+f},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Dm{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=e}add(e,n,r){var s;(s=this.target)==null||s.addEventListener(e,n,r),this.listeners.push([e,n,r])}}function Vfe(t){const{EventTarget:e}=di(t);return t instanceof e?t:Xh(t)}function r4(t,e){const n=Math.abs(t.x),r=Math.abs(t.y);return typeof e=="number"?Math.sqrt(n**2+r**2)>e:"x"in e&&"y"in e?n>e.x&&r>e.y:"x"in e?n>e.x:"y"in e?r>e.y:!1}var Gi;(function(t){t.Click="click",t.DragStart="dragstart",t.Keydown="keydown",t.ContextMenu="contextmenu",t.Resize="resize",t.SelectionChange="selectionchange",t.VisibilityChange="visibilitychange"})(Gi||(Gi={}));function VE(t){t.preventDefault()}function Ufe(t){t.stopPropagation()}var un;(function(t){t.Space="Space",t.Down="ArrowDown",t.Right="ArrowRight",t.Left="ArrowLeft",t.Up="ArrowUp",t.Esc="Escape",t.Enter="Enter",t.Tab="Tab"})(un||(un={}));const AF={start:[un.Space,un.Enter],cancel:[un.Esc],end:[un.Space,un.Enter,un.Tab]},Wfe=(t,e)=>{let{currentCoordinates:n}=e;switch(t.code){case un.Right:return{...n,x:n.x+25};case un.Left:return{...n,x:n.x-25};case un.Down:return{...n,y:n.y+25};case un.Up:return{...n,y:n.y-25}}};class Sj{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:n}}=e;this.props=e,this.listeners=new Dm(Xh(n)),this.windowListeners=new Dm(di(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Gi.Resize,this.handleCancel),this.windowListeners.add(Gi.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Gi.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:n}=this.props,r=e.node.current;r&&Qfe(r),n(Aa)}handleKeyDown(e){if(bj(e)){const{active:n,context:r,options:s}=this.props,{keyboardCodes:i=AF,coordinateGetter:a=Wfe,scrollBehavior:o="smooth"}=s,{code:c}=e;if(i.end.includes(c)){this.handleEnd(e);return}if(i.cancel.includes(c)){this.handleCancel(e);return}const{collisionRect:h}=r.current,f=h?{x:h.left,y:h.top}:Aa;this.referenceCoordinates||(this.referenceCoordinates=f);const m=a(e,{active:n,context:r.current,currentCoordinates:f});if(m){const g=g0(m,f),x={x:0,y:0},{scrollableAncestors:y}=r.current;for(const w of y){const S=e.code,{isTop:k,isRight:N,isLeft:C,isBottom:T,maxScroll:_,minScroll:E}=_F(w),M=qfe(w),L={x:Math.min(S===un.Right?M.right-M.width/2:M.right,Math.max(S===un.Right?M.left:M.left+M.width/2,m.x)),y:Math.min(S===un.Down?M.bottom-M.height/2:M.bottom,Math.max(S===un.Down?M.top:M.top+M.height/2,m.y))},P=S===un.Right&&!N||S===un.Left&&!C,I=S===un.Down&&!T||S===un.Up&&!k;if(P&&L.x!==m.x){const Q=w.scrollLeft+g.x,U=S===un.Right&&Q<=_.x||S===un.Left&&Q>=E.x;if(U&&!g.y){w.scrollTo({left:Q,behavior:o});return}U?x.x=w.scrollLeft-Q:x.x=S===un.Right?w.scrollLeft-_.x:w.scrollLeft-E.x,x.x&&w.scrollBy({left:-x.x,behavior:o});break}else if(I&&L.y!==m.y){const Q=w.scrollTop+g.y,U=S===un.Down&&Q<=_.y||S===un.Up&&Q>=E.y;if(U&&!g.x){w.scrollTo({top:Q,behavior:o});return}U?x.y=w.scrollTop-Q:x.y=S===un.Down?w.scrollTop-_.y:w.scrollTop-E.y,x.y&&w.scrollBy({top:-x.y,behavior:o});break}}this.handleMove(e,oh(g0(m,this.referenceCoordinates),x))}}}handleMove(e,n){const{onMove:r}=this.props;e.preventDefault(),r(n)}handleEnd(e){const{onEnd:n}=this.props;e.preventDefault(),this.detach(),n()}handleCancel(e){const{onCancel:n}=this.props;e.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}Sj.activators=[{eventName:"onKeyDown",handler:(t,e,n)=>{let{keyboardCodes:r=AF,onActivation:s}=e,{active:i}=n;const{code:a}=t.nativeEvent;if(r.start.includes(a)){const o=i.activatorNode.current;return o&&t.target!==o?!1:(t.preventDefault(),s?.({event:t.nativeEvent}),!0)}return!1}}];function UE(t){return!!(t&&"distance"in t)}function WE(t){return!!(t&&"delay"in t)}class kj{constructor(e,n,r){var s;r===void 0&&(r=Vfe(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=n;const{event:i}=e,{target:a}=i;this.props=e,this.events=n,this.document=Xh(a),this.documentListeners=new Dm(this.document),this.listeners=new Dm(r),this.windowListeners=new Dm(di(a)),this.initialCoordinates=(s=YS(i))!=null?s:Aa,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:e,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(Gi.Resize,this.handleCancel),this.windowListeners.add(Gi.DragStart,VE),this.windowListeners.add(Gi.VisibilityChange,this.handleCancel),this.windowListeners.add(Gi.ContextMenu,VE),this.documentListeners.add(Gi.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(WE(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(UE(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,n){const{active:r,onPending:s}=this.props;s(r,e,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:e}=this,{onStart:n}=this.props;e&&(this.activated=!0,this.documentListeners.add(Gi.Click,Ufe,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Gi.SelectionChange,this.removeTextSelection),n(e))}handleMove(e){var n;const{activated:r,initialCoordinates:s,props:i}=this,{onMove:a,options:{activationConstraint:o}}=i;if(!s)return;const c=(n=YS(e))!=null?n:Aa,h=g0(s,c);if(!r&&o){if(UE(o)){if(o.tolerance!=null&&r4(h,o.tolerance))return this.handleCancel();if(r4(h,o.distance))return this.handleStart()}if(WE(o)&&r4(h,o.tolerance))return this.handleCancel();this.handlePending(o,h);return}e.cancelable&&e.preventDefault(),a(c)}handleEnd(){const{onAbort:e,onEnd:n}=this.props;this.detach(),this.activated||e(this.props.active),n()}handleCancel(){const{onAbort:e,onCancel:n}=this.props;this.detach(),this.activated||e(this.props.active),n()}handleKeydown(e){e.code===un.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}}const Gfe={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class jj extends kj{constructor(e){const{event:n}=e,r=Xh(n.target);super(e,Gfe,r)}}jj.activators=[{eventName:"onPointerDown",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:r}=e;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];const Xfe={move:{name:"mousemove"},end:{name:"mouseup"}};var ZS;(function(t){t[t.RightClick=2]="RightClick"})(ZS||(ZS={}));class Yfe extends kj{constructor(e){super(e,Xfe,Xh(e.event.target))}}Yfe.activators=[{eventName:"onMouseDown",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:r}=e;return n.button===ZS.RightClick?!1:(r?.({event:n}),!0)}}];const s4={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Kfe extends kj{constructor(e){super(e,s4)}static setup(){return window.addEventListener(s4.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(s4.move.name,e)};function e(){}}}Kfe.activators=[{eventName:"onTouchStart",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:r}=e;const{touches:s}=n;return s.length>1?!1:(r?.({event:n}),!0)}}];var zm;(function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"})(zm||(zm={}));var sv;(function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"})(sv||(sv={}));function Zfe(t){let{acceleration:e,activator:n=zm.Pointer,canScroll:r,draggingRect:s,enabled:i,interval:a=5,order:o=sv.TreeOrder,pointerCoordinates:c,scrollableAncestors:h,scrollableAncestorRects:f,delta:m,threshold:g}=t;const x=eme({delta:m,disabled:!i}),[y,w]=ufe(),S=b.useRef({x:0,y:0}),k=b.useRef({x:0,y:0}),N=b.useMemo(()=>{switch(n){case zm.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case zm.DraggableRect:return s}},[n,s,c]),C=b.useRef(null),T=b.useCallback(()=>{const E=C.current;if(!E)return;const M=S.current.x*k.current.x,L=S.current.y*k.current.y;E.scrollBy(M,L)},[]),_=b.useMemo(()=>o===sv.TreeOrder?[...h].reverse():h,[o,h]);b.useEffect(()=>{if(!i||!h.length||!N){w();return}for(const E of _){if(r?.(E)===!1)continue;const M=h.indexOf(E),L=f[M];if(!L)continue;const{direction:P,speed:I}=Bfe(E,L,N,e,g);for(const Q of["x","y"])x[Q][P[Q]]||(I[Q]=0,P[Q]=0);if(I.x>0||I.y>0){w(),C.current=E,y(T,a),S.current=I,k.current=P;return}}S.current={x:0,y:0},k.current={x:0,y:0},w()},[e,T,r,w,i,a,JSON.stringify(N),JSON.stringify(x),y,h,_,f,JSON.stringify(g)])}const Jfe={x:{[ss.Backward]:!1,[ss.Forward]:!1},y:{[ss.Backward]:!1,[ss.Forward]:!1}};function eme(t){let{delta:e,disabled:n}=t;const r=XS(e);return lp(s=>{if(n||!r||!s)return Jfe;const i={x:Math.sign(e.x-r.x),y:Math.sign(e.y-r.y)};return{x:{[ss.Backward]:s.x[ss.Backward]||i.x===-1,[ss.Forward]:s.x[ss.Forward]||i.x===1},y:{[ss.Backward]:s.y[ss.Backward]||i.y===-1,[ss.Forward]:s.y[ss.Forward]||i.y===1}}},[n,e,r])}function tme(t,e){const n=e!=null?t.get(e):void 0,r=n?n.node.current:null;return lp(s=>{var i;return e==null?null:(i=r??s)!=null?i:null},[r,e])}function nme(t,e){return b.useMemo(()=>t.reduce((n,r)=>{const{sensor:s}=r,i=s.activators.map(a=>({eventName:a.eventName,handler:e(a.handler,r)}));return[...n,...i]},[]),[t,e])}var v0;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(v0||(v0={}));var JS;(function(t){t.Optimized="optimized"})(JS||(JS={}));const GE=new Map;function rme(t,e){let{dragging:n,dependencies:r,config:s}=e;const[i,a]=b.useState(null),{frequency:o,measure:c,strategy:h}=s,f=b.useRef(t),m=S(),g=p0(m),x=b.useCallback(function(k){k===void 0&&(k=[]),!g.current&&a(N=>N===null?k:N.concat(k.filter(C=>!N.includes(C))))},[g]),y=b.useRef(null),w=lp(k=>{if(m&&!n)return GE;if(!k||k===GE||f.current!==t||i!=null){const N=new Map;for(let C of t){if(!C)continue;if(i&&i.length>0&&!i.includes(C.id)&&C.rect.current){N.set(C.id,C.rect.current);continue}const T=C.node.current,_=T?new wj(c(T),T):null;C.rect.current=_,_&&N.set(C.id,_)}return N}return k},[t,i,n,m,c]);return b.useEffect(()=>{f.current=t},[t]),b.useEffect(()=>{m||x()},[n,m]),b.useEffect(()=>{i&&i.length>0&&a(null)},[JSON.stringify(i)]),b.useEffect(()=>{m||typeof o!="number"||y.current!==null||(y.current=setTimeout(()=>{x(),y.current=null},o))},[o,m,x,...r]),{droppableRects:w,measureDroppableContainers:x,measuringScheduled:i!=null};function S(){switch(h){case v0.Always:return!1;case v0.BeforeDragging:return n;default:return!n}}}function RF(t,e){return lp(n=>t?n||(typeof e=="function"?e(t):t):null,[e,t])}function sme(t,e){return RF(t,e)}function ime(t){let{callback:e,disabled:n}=t;const r=yj(e),s=b.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(r)},[r,n]);return b.useEffect(()=>()=>s?.disconnect(),[s]),s}function xy(t){let{callback:e,disabled:n}=t;const r=yj(e),s=b.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(r)},[n]);return b.useEffect(()=>()=>s?.disconnect(),[s]),s}function ame(t){return new wj(Yh(t),t)}function XE(t,e,n){e===void 0&&(e=ame);const[r,s]=b.useState(null);function i(){s(c=>{if(!t)return null;if(t.isConnected===!1){var h;return(h=c??n)!=null?h:null}const f=e(t);return JSON.stringify(c)===JSON.stringify(f)?c:f})}const a=ime({callback(c){if(t)for(const h of c){const{type:f,target:m}=h;if(f==="childList"&&m instanceof HTMLElement&&m.contains(t)){i();break}}}}),o=xy({callback:i});return fl(()=>{i(),t?(o?.observe(t),a?.observe(document.body,{childList:!0,subtree:!0})):(o?.disconnect(),a?.disconnect())},[t]),r}function lme(t){const e=RF(t);return OF(t,e)}const YE=[];function ome(t){const e=b.useRef(t),n=lp(r=>t?r&&r!==YE&&t&&e.current&&t.parentNode===e.current.parentNode?r:gy(t):YE,[t]);return b.useEffect(()=>{e.current=t},[t]),n}function cme(t){const[e,n]=b.useState(null),r=b.useRef(t),s=b.useCallback(i=>{const a=n4(i.target);a&&n(o=>o?(o.set(a,KS(a)),new Map(o)):null)},[]);return b.useEffect(()=>{const i=r.current;if(t!==i){a(i);const o=t.map(c=>{const h=n4(c);return h?(h.addEventListener("scroll",s,{passive:!0}),[h,KS(h)]):null}).filter(c=>c!=null);n(o.length?new Map(o):null),r.current=t}return()=>{a(t),a(i)};function a(o){o.forEach(c=>{const h=n4(c);h?.removeEventListener("scroll",s)})}},[s,t]),b.useMemo(()=>t.length?e?Array.from(e.values()).reduce((i,a)=>oh(i,a),Aa):MF(t):Aa,[t,e])}function KE(t,e){e===void 0&&(e=[]);const n=b.useRef(null);return b.useEffect(()=>{n.current=null},e),b.useEffect(()=>{const r=t!==Aa;r&&!n.current&&(n.current=t),!r&&n.current&&(n.current=null)},[t]),n.current?g0(t,n.current):Aa}function ume(t){b.useEffect(()=>{if(!py)return;const e=t.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of e)n?.()}},t.map(e=>{let{sensor:n}=e;return n}))}function dme(t,e){return b.useMemo(()=>t.reduce((n,r)=>{let{eventName:s,handler:i}=r;return n[s]=a=>{i(a,e)},n},{}),[t,e])}function DF(t){return b.useMemo(()=>t?zfe(t):null,[t])}const ZE=[];function hme(t,e){e===void 0&&(e=Yh);const[n]=t,r=DF(n?di(n):null),[s,i]=b.useState(ZE);function a(){i(()=>t.length?t.map(c=>EF(c)?r:new wj(e(c),c)):ZE)}const o=xy({callback:a});return fl(()=>{o?.disconnect(),a(),t.forEach(c=>o?.observe(c))},[t]),s}function fme(t){if(!t)return null;if(t.children.length>1)return t;const e=t.children[0];return ap(e)?e:t}function mme(t){let{measure:e}=t;const[n,r]=b.useState(null),s=b.useCallback(h=>{for(const{target:f}of h)if(ap(f)){r(m=>{const g=e(f);return m?{...m,width:g.width,height:g.height}:g});break}},[e]),i=xy({callback:s}),a=b.useCallback(h=>{const f=fme(h);i?.disconnect(),f&&i?.observe(f),r(f?e(f):null)},[e,i]),[o,c]=nv(a);return b.useMemo(()=>({nodeRef:o,rect:n,setRef:c}),[n,o,c])}const pme=[{sensor:jj,options:{}},{sensor:Sj,options:{}}],gme={current:{}},g1={draggable:{measure:HE},droppable:{measure:HE,strategy:v0.WhileDragging,frequency:JS.Optimized},dragOverlay:{measure:Yh}};class Pm extends Map{get(e){var n;return e!=null&&(n=super.get(e))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:n}=e;return!n})}getNodeFor(e){var n,r;return(n=(r=this.get(e))==null?void 0:r.node.current)!=null?n:void 0}}const xme={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Pm,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:rv},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:g1,measureDroppableContainers:rv,windowRect:null,measuringScheduled:!1},vme={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:rv,draggableNodes:new Map,over:null,measureDroppableContainers:rv},vy=b.createContext(vme),zF=b.createContext(xme);function yme(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Pm}}}function bme(t,e){switch(e.type){case Zr.DragStart:return{...t,draggable:{...t.draggable,initialCoordinates:e.initialCoordinates,active:e.active}};case Zr.DragMove:return t.draggable.active==null?t:{...t,draggable:{...t.draggable,translate:{x:e.coordinates.x-t.draggable.initialCoordinates.x,y:e.coordinates.y-t.draggable.initialCoordinates.y}}};case Zr.DragEnd:case Zr.DragCancel:return{...t,draggable:{...t.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Zr.RegisterDroppable:{const{element:n}=e,{id:r}=n,s=new Pm(t.droppable.containers);return s.set(r,n),{...t,droppable:{...t.droppable,containers:s}}}case Zr.SetDroppableDisabled:{const{id:n,key:r,disabled:s}=e,i=t.droppable.containers.get(n);if(!i||r!==i.key)return t;const a=new Pm(t.droppable.containers);return a.set(n,{...i,disabled:s}),{...t,droppable:{...t.droppable,containers:a}}}case Zr.UnregisterDroppable:{const{id:n,key:r}=e,s=t.droppable.containers.get(n);if(!s||r!==s.key)return t;const i=new Pm(t.droppable.containers);return i.delete(n),{...t,droppable:{...t.droppable,containers:i}}}default:return t}}function wme(t){let{disabled:e}=t;const{active:n,activatorEvent:r,draggableNodes:s}=b.useContext(vy),i=XS(r),a=XS(n?.id);return b.useEffect(()=>{if(!e&&!r&&i&&a!=null){if(!bj(i)||document.activeElement===i.target)return;const o=s.get(a);if(!o)return;const{activatorNode:c,node:h}=o;if(!c.current&&!h.current)return;requestAnimationFrame(()=>{for(const f of[c.current,h.current]){if(!f)continue;const m=ffe(f);if(m){m.focus();break}}})}},[r,e,s,a,i]),null}function Sme(t,e){let{transform:n,...r}=e;return t!=null&&t.length?t.reduce((s,i)=>i({transform:s,...r}),n):n}function kme(t){return b.useMemo(()=>({draggable:{...g1.draggable,...t?.draggable},droppable:{...g1.droppable,...t?.droppable},dragOverlay:{...g1.dragOverlay,...t?.dragOverlay}}),[t?.draggable,t?.droppable,t?.dragOverlay])}function jme(t){let{activeNode:e,measure:n,initialRect:r,config:s=!0}=t;const i=b.useRef(!1),{x:a,y:o}=typeof s=="boolean"?{x:s,y:s}:s;fl(()=>{if(!a&&!o||!e){i.current=!1;return}if(i.current||!r)return;const h=e?.node.current;if(!h||h.isConnected===!1)return;const f=n(h),m=OF(f,r);if(a||(m.x=0),o||(m.y=0),i.current=!0,Math.abs(m.x)>0||Math.abs(m.y)>0){const g=NF(h);g&&g.scrollBy({top:m.y,left:m.x})}},[e,a,o,r,n])}const PF=b.createContext({...Aa,scaleX:1,scaleY:1});var lc;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})(lc||(lc={}));const Ome=b.memo(function(e){var n,r,s,i;let{id:a,accessibility:o,autoScroll:c=!0,children:h,sensors:f=pme,collisionDetection:m=Tfe,measuring:g,modifiers:x,...y}=e;const w=b.useReducer(bme,void 0,yme),[S,k]=w,[N,C]=yfe(),[T,_]=b.useState(lc.Uninitialized),E=T===lc.Initialized,{draggable:{active:M,nodes:L,translate:P},droppable:{containers:I}}=S,Q=M!=null?L.get(M):null,U=b.useRef({initial:null,translated:null}),ee=b.useMemo(()=>{var Ot;return M!=null?{id:M,data:(Ot=Q?.data)!=null?Ot:gme,rect:U}:null},[M,Q]),z=b.useRef(null),[H,B]=b.useState(null),[X,J]=b.useState(null),G=p0(y,Object.values(y)),R=op("DndDescribedBy",a),se=b.useMemo(()=>I.getEnabled(),[I]),W=kme(g),{droppableRects:F,measureDroppableContainers:V,measuringScheduled:te}=rme(se,{dragging:E,dependencies:[P.x,P.y],config:W.droppable}),ne=tme(L,M),K=b.useMemo(()=>X?YS(X):null,[X]),ie=Nt(),re=sme(ne,W.draggable.measure);jme({activeNode:M!=null?L.get(M):null,config:ie.layoutShiftCompensation,initialRect:re,measure:W.draggable.measure});const ae=XE(ne,W.draggable.measure,re),_e=XE(ne?ne.parentElement:null),Ue=b.useRef({activatorEvent:null,active:null,activeNode:ne,collisionRect:null,collisions:null,droppableRects:F,draggableNodes:L,draggingNode:null,draggingNodeRect:null,droppableContainers:I,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Xe=I.getNodeFor((n=Ue.current.over)==null?void 0:n.id),Ze=mme({measure:W.dragOverlay.measure}),Oe=(r=Ze.nodeRef.current)!=null?r:ne,He=E?(s=Ze.rect)!=null?s:ae:null,Ve=!!(Ze.nodeRef.current&&Ze.rect),Be=lme(Ve?null:ae),ut=DF(Oe?di(Oe):null),rt=ome(E?Xe??ne:null),rn=hme(rt),Rn=Sme(x,{transform:{x:P.x-Be.x,y:P.y-Be.y,scaleX:1,scaleY:1},activatorEvent:X,active:ee,activeNodeRect:ae,containerNodeRect:_e,draggingNodeRect:He,over:Ue.current.over,overlayNodeRect:Ze.rect,scrollableAncestors:rt,scrollableAncestorRects:rn,windowRect:ut}),Tn=K?oh(K,P):null,Mt=cme(rt),vt=KE(Mt),Ce=KE(Mt,[ae]),Le=oh(Rn,vt),Ge=He?Mfe(He,Rn):null,lt=ee&&Ge?m({active:ee,collisionRect:Ge,droppableRects:F,droppableContainers:se,pointerCoordinates:Tn}):null,jt=jF(lt,"id"),[Tt,ke]=b.useState(null),Te=Ve?Rn:oh(Rn,Ce),qe=Efe(Te,(i=Tt?.rect)!=null?i:null,ae),Rt=b.useRef(null),At=b.useCallback((Ot,it)=>{let{sensor:Vn,options:jr}=it;if(z.current==null)return;const Or=L.get(z.current);if(!Or)return;const ge=Ot.nativeEvent,ze=new Vn({active:z.current,activeNode:Or,event:ge,options:jr,context:Ue,onAbort(Gt){if(!L.get(Gt))return;const{onDragAbort:Wr}=G.current,Ar={id:Gt};Wr?.(Ar),N({type:"onDragAbort",event:Ar})},onPending(Gt,Mr,Wr,Ar){if(!L.get(Gt))return;const{onDragPending:ga}=G.current,mi={id:Gt,constraint:Mr,initialCoordinates:Wr,offset:Ar};ga?.(mi),N({type:"onDragPending",event:mi})},onStart(Gt){const Mr=z.current;if(Mr==null)return;const Wr=L.get(Mr);if(!Wr)return;const{onDragStart:Ar}=G.current,Rr={activatorEvent:ge,active:{id:Mr,data:Wr.data,rect:U}};fu.unstable_batchedUpdates(()=>{Ar?.(Rr),_(lc.Initializing),k({type:Zr.DragStart,initialCoordinates:Gt,active:Mr}),N({type:"onDragStart",event:Rr}),B(Rt.current),J(ge)})},onMove(Gt){k({type:Zr.DragMove,coordinates:Gt})},onEnd:Et(Zr.DragEnd),onCancel:Et(Zr.DragCancel)});Rt.current=ze;function Et(Gt){return async function(){const{active:Wr,collisions:Ar,over:Rr,scrollAdjustedTranslate:ga}=Ue.current;let mi=null;if(Wr&&ga){const{cancelDrop:Ba}=G.current;mi={activatorEvent:ge,active:Wr,collisions:Ar,delta:ga,over:Rr},Gt===Zr.DragEnd&&typeof Ba=="function"&&await Promise.resolve(Ba(mi))&&(Gt=Zr.DragCancel)}z.current=null,fu.unstable_batchedUpdates(()=>{k({type:Gt}),_(lc.Uninitialized),ke(null),B(null),J(null),Rt.current=null;const Ba=Gt===Zr.DragEnd?"onDragEnd":"onDragCancel";if(mi){const Hs=G.current[Ba];Hs?.(mi),N({type:Ba,event:mi})}})}}},[L]),vr=b.useCallback((Ot,it)=>(Vn,jr)=>{const Or=Vn.nativeEvent,ge=L.get(jr);if(z.current!==null||!ge||Or.dndKit||Or.defaultPrevented)return;const ze={active:ge};Ot(Vn,it.options,ze)===!0&&(Or.dndKit={capturedBy:it.sensor},z.current=jr,At(Vn,it))},[L,At]),ft=nme(f,vr);ume(f),fl(()=>{ae&&T===lc.Initializing&&_(lc.Initialized)},[ae,T]),b.useEffect(()=>{const{onDragMove:Ot}=G.current,{active:it,activatorEvent:Vn,collisions:jr,over:Or}=Ue.current;if(!it||!Vn)return;const ge={active:it,activatorEvent:Vn,collisions:jr,delta:{x:Le.x,y:Le.y},over:Or};fu.unstable_batchedUpdates(()=>{Ot?.(ge),N({type:"onDragMove",event:ge})})},[Le.x,Le.y]),b.useEffect(()=>{const{active:Ot,activatorEvent:it,collisions:Vn,droppableContainers:jr,scrollAdjustedTranslate:Or}=Ue.current;if(!Ot||z.current==null||!it||!Or)return;const{onDragOver:ge}=G.current,ze=jr.get(jt),Et=ze&&ze.rect.current?{id:ze.id,rect:ze.rect.current,data:ze.data,disabled:ze.disabled}:null,Gt={active:Ot,activatorEvent:it,collisions:Vn,delta:{x:Or.x,y:Or.y},over:Et};fu.unstable_batchedUpdates(()=>{ke(Et),ge?.(Gt),N({type:"onDragOver",event:Gt})})},[jt]),fl(()=>{Ue.current={activatorEvent:X,active:ee,activeNode:ne,collisionRect:Ge,collisions:lt,droppableRects:F,draggableNodes:L,draggingNode:Oe,draggingNodeRect:He,droppableContainers:I,over:Tt,scrollableAncestors:rt,scrollAdjustedTranslate:Le},U.current={initial:He,translated:Ge}},[ee,ne,lt,Ge,L,Oe,He,F,I,Tt,rt,Le]),Zfe({...ie,delta:P,draggingRect:Ge,pointerCoordinates:Tn,scrollableAncestors:rt,scrollableAncestorRects:rn});const mn=b.useMemo(()=>({active:ee,activeNode:ne,activeNodeRect:ae,activatorEvent:X,collisions:lt,containerNodeRect:_e,dragOverlay:Ze,draggableNodes:L,droppableContainers:I,droppableRects:F,over:Tt,measureDroppableContainers:V,scrollableAncestors:rt,scrollableAncestorRects:rn,measuringConfiguration:W,measuringScheduled:te,windowRect:ut}),[ee,ne,ae,X,lt,_e,Ze,L,I,F,Tt,V,rt,rn,W,te,ut]),gt=b.useMemo(()=>({activatorEvent:X,activators:ft,active:ee,activeNodeRect:ae,ariaDescribedById:{draggable:R},dispatch:k,draggableNodes:L,over:Tt,measureDroppableContainers:V}),[X,ft,ee,ae,k,R,L,Tt,V]);return he.createElement(wF.Provider,{value:C},he.createElement(vy.Provider,{value:gt},he.createElement(zF.Provider,{value:mn},he.createElement(PF.Provider,{value:qe},h)),he.createElement(wme,{disabled:o?.restoreFocus===!1})),he.createElement(Sfe,{...o,hiddenTextDescribedById:R}));function Nt(){const Ot=H?.autoScrollEnabled===!1,it=typeof c=="object"?c.enabled===!1:c===!1,Vn=E&&!Ot&&!it;return typeof c=="object"?{...c,enabled:Vn}:{enabled:Vn}}}),Nme=b.createContext(null),JE="button",Cme="Draggable";function Tme(t){let{id:e,data:n,disabled:r=!1,attributes:s}=t;const i=op(Cme),{activators:a,activatorEvent:o,active:c,activeNodeRect:h,ariaDescribedById:f,draggableNodes:m,over:g}=b.useContext(vy),{role:x=JE,roleDescription:y="draggable",tabIndex:w=0}=s??{},S=c?.id===e,k=b.useContext(S?PF:Nme),[N,C]=nv(),[T,_]=nv(),E=dme(a,e),M=p0(n);fl(()=>(m.set(e,{id:e,key:i,node:N,activatorNode:T,data:M}),()=>{const P=m.get(e);P&&P.key===i&&m.delete(e)}),[m,e]);const L=b.useMemo(()=>({role:x,tabIndex:w,"aria-disabled":r,"aria-pressed":S&&x===JE?!0:void 0,"aria-roledescription":y,"aria-describedby":f.draggable}),[r,x,w,S,y,f.draggable]);return{active:c,activatorEvent:o,activeNodeRect:h,attributes:L,isDragging:S,listeners:r?void 0:E,node:N,over:g,setNodeRef:C,setActivatorNodeRef:_,transform:k}}function Eme(){return b.useContext(zF)}const _me="Droppable",Mme={timeout:25};function Ame(t){let{data:e,disabled:n=!1,id:r,resizeObserverConfig:s}=t;const i=op(_me),{active:a,dispatch:o,over:c,measureDroppableContainers:h}=b.useContext(vy),f=b.useRef({disabled:n}),m=b.useRef(!1),g=b.useRef(null),x=b.useRef(null),{disabled:y,updateMeasurementsFor:w,timeout:S}={...Mme,...s},k=p0(w??r),N=b.useCallback(()=>{if(!m.current){m.current=!0;return}x.current!=null&&clearTimeout(x.current),x.current=setTimeout(()=>{h(Array.isArray(k.current)?k.current:[k.current]),x.current=null},S)},[S]),C=xy({callback:N,disabled:y||!a}),T=b.useCallback((L,P)=>{C&&(P&&(C.unobserve(P),m.current=!1),L&&C.observe(L))},[C]),[_,E]=nv(T),M=p0(e);return b.useEffect(()=>{!C||!_.current||(C.disconnect(),m.current=!1,C.observe(_.current))},[_,C]),b.useEffect(()=>(o({type:Zr.RegisterDroppable,element:{id:r,key:i,disabled:n,node:_,rect:g,data:M}}),()=>o({type:Zr.UnregisterDroppable,key:i,id:r})),[r]),b.useEffect(()=>{n!==f.current.disabled&&(o({type:Zr.SetDroppableDisabled,id:r,key:i,disabled:n}),f.current.disabled=n)},[r,i,n,o]),{active:a,rect:g,isOver:c?.id===r,node:_,over:c,setNodeRef:E}}function Oj(t,e,n){const r=t.slice();return r.splice(n<0?r.length+n:n,0,r.splice(e,1)[0]),r}function Rme(t,e){return t.reduce((n,r,s)=>{const i=e.get(r);return i&&(n[s]=i),n},Array(t.length))}function kx(t){return t!==null&&t>=0}function Dme(t,e){if(t===e)return!0;if(t.length!==e.length)return!1;for(let n=0;n{var e;let{rects:n,activeNodeRect:r,activeIndex:s,overIndex:i,index:a}=t;const o=(e=n[s])!=null?e:r;if(!o)return null;const c=Lme(n,a,s);if(a===s){const h=n[i];return h?{x:ss&&a<=i?{x:-o.width-c,y:0,...jx}:a=i?{x:o.width+c,y:0,...jx}:{x:0,y:0,...jx}};function Lme(t,e,n){const r=t[e],s=t[e-1],i=t[e+1];return!r||!s&&!i?0:n{let{rects:e,activeIndex:n,overIndex:r,index:s}=t;const i=Oj(e,r,n),a=e[s],o=i[s];return!o||!a?null:{x:o.left-a.left,y:o.top-a.top,scaleX:o.width/a.width,scaleY:o.height/a.height}},IF="Sortable",BF=he.createContext({activeIndex:-1,containerId:IF,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:LF,disabled:{draggable:!1,droppable:!1}});function Ime(t){let{children:e,id:n,items:r,strategy:s=LF,disabled:i=!1}=t;const{active:a,dragOverlay:o,droppableRects:c,over:h,measureDroppableContainers:f}=Eme(),m=op(IF,n),g=o.rect!==null,x=b.useMemo(()=>r.map(E=>typeof E=="object"&&"id"in E?E.id:E),[r]),y=a!=null,w=a?x.indexOf(a.id):-1,S=h?x.indexOf(h.id):-1,k=b.useRef(x),N=!Dme(x,k.current),C=S!==-1&&w===-1||N,T=zme(i);fl(()=>{N&&y&&f(x)},[N,x,y,f]),b.useEffect(()=>{k.current=x},[x]);const _=b.useMemo(()=>({activeIndex:w,containerId:m,disabled:T,disableTransforms:C,items:x,overIndex:S,useDragOverlay:g,sortedRects:Rme(x,c),strategy:s}),[w,m,T.draggable,T.droppable,C,x,S,c,g,s]);return he.createElement(BF.Provider,{value:_},e)}const Bme=t=>{let{id:e,items:n,activeIndex:r,overIndex:s}=t;return Oj(n,r,s).indexOf(e)},qme=t=>{let{containerId:e,isSorting:n,wasDragging:r,index:s,items:i,newIndex:a,previousItems:o,previousContainerId:c,transition:h}=t;return!h||!r||o!==i&&s===a?!1:n?!0:a!==s&&e===c},Fme={duration:200,easing:"ease"},qF="transform",$me=x0.Transition.toString({property:qF,duration:0,easing:"linear"}),Qme={roleDescription:"sortable"};function Hme(t){let{disabled:e,index:n,node:r,rect:s}=t;const[i,a]=b.useState(null),o=b.useRef(n);return fl(()=>{if(!e&&n!==o.current&&r.current){const c=s.current;if(c){const h=Yh(r.current,{ignoreTransform:!0}),f={x:c.left-h.left,y:c.top-h.top,scaleX:c.width/h.width,scaleY:c.height/h.height};(f.x||f.y)&&a(f)}}n!==o.current&&(o.current=n)},[e,n,r,s]),b.useEffect(()=>{i&&a(null)},[i]),i}function Vme(t){let{animateLayoutChanges:e=qme,attributes:n,disabled:r,data:s,getNewIndex:i=Bme,id:a,strategy:o,resizeObserverConfig:c,transition:h=Fme}=t;const{items:f,containerId:m,activeIndex:g,disabled:x,disableTransforms:y,sortedRects:w,overIndex:S,useDragOverlay:k,strategy:N}=b.useContext(BF),C=Ume(r,x),T=f.indexOf(a),_=b.useMemo(()=>({sortable:{containerId:m,index:T,items:f},...s}),[m,s,T,f]),E=b.useMemo(()=>f.slice(f.indexOf(a)),[f,a]),{rect:M,node:L,isOver:P,setNodeRef:I}=Ame({id:a,data:_,disabled:C.droppable,resizeObserverConfig:{updateMeasurementsFor:E,...c}}),{active:Q,activatorEvent:U,activeNodeRect:ee,attributes:z,setNodeRef:H,listeners:B,isDragging:X,over:J,setActivatorNodeRef:G,transform:R}=Tme({id:a,data:_,attributes:{...Qme,...n},disabled:C.draggable}),se=cfe(I,H),W=!!Q,F=W&&!y&&kx(g)&&kx(S),V=!k&&X,te=V&&F?R:null,K=F?te??(o??N)({rects:w,activeNodeRect:ee,activeIndex:g,overIndex:S,index:T}):null,ie=kx(g)&&kx(S)?i({id:a,items:f,activeIndex:g,overIndex:S}):T,re=Q?.id,ae=b.useRef({activeId:re,items:f,newIndex:ie,containerId:m}),_e=f!==ae.current.items,Ue=e({active:Q,containerId:m,isDragging:X,isSorting:W,id:a,index:T,items:f,newIndex:ae.current.newIndex,previousItems:ae.current.items,previousContainerId:ae.current.containerId,transition:h,wasDragging:ae.current.activeId!=null}),Xe=Hme({disabled:!Ue,index:T,node:L,rect:M});return b.useEffect(()=>{W&&ae.current.newIndex!==ie&&(ae.current.newIndex=ie),m!==ae.current.containerId&&(ae.current.containerId=m),f!==ae.current.items&&(ae.current.items=f)},[W,ie,m,f]),b.useEffect(()=>{if(re===ae.current.activeId)return;if(re!=null&&ae.current.activeId==null){ae.current.activeId=re;return}const Oe=setTimeout(()=>{ae.current.activeId=re},50);return()=>clearTimeout(Oe)},[re]),{active:Q,activeIndex:g,attributes:z,data:_,rect:M,index:T,newIndex:ie,items:f,isOver:P,isSorting:W,isDragging:X,listeners:B,node:L,overIndex:S,over:J,setNodeRef:se,setActivatorNodeRef:G,setDroppableNodeRef:I,setDraggableNodeRef:H,transform:Xe??K,transition:Ze()};function Ze(){if(Xe||_e&&ae.current.newIndex===T)return $me;if(!(V&&!bj(U)||!h)&&(W||Ue))return x0.Transition.toString({...h,property:qF})}}function Ume(t,e){var n,r;return typeof t=="boolean"?{draggable:t,droppable:!1}:{draggable:(n=t?.draggable)!=null?n:e.draggable,droppable:(r=t?.droppable)!=null?r:e.droppable}}function iv(t){if(!t)return!1;const e=t.data.current;return!!(e&&"sortable"in e&&typeof e.sortable=="object"&&"containerId"in e.sortable&&"items"in e.sortable&&"index"in e.sortable)}const Wme=[un.Down,un.Right,un.Up,un.Left],Gme=(t,e)=>{let{context:{active:n,collisionRect:r,droppableRects:s,droppableContainers:i,over:a,scrollableAncestors:o}}=e;if(Wme.includes(t.code)){if(t.preventDefault(),!n||!r)return;const c=[];i.getEnabled().forEach(m=>{if(!m||m!=null&&m.disabled)return;const g=s.get(m.id);if(g)switch(t.code){case un.Down:r.topg.top&&c.push(m);break;case un.Left:r.left>g.left&&c.push(m);break;case un.Right:r.left1&&(f=h[1].id),f!=null){const m=i.get(n.id),g=i.get(f),x=g?s.get(g.id):null,y=g?.node.current;if(y&&x&&m&&g){const S=gy(y).some((E,M)=>o[M]!==E),k=FF(m,g),N=Xme(m,g),C=S||!k?{x:0,y:0}:{x:N?r.width-x.width:0,y:N?r.height-x.height:0},T={x:x.left,y:x.top};return C.x&&C.y?T:g0(T,C)}}}};function FF(t,e){return!iv(t)||!iv(e)?!1:t.data.current.sortable.containerId===e.data.current.sortable.containerId}function Xme(t,e){return!iv(t)||!iv(e)||!FF(t,e)?!1:t.data.current.sortable.index{f.stopPropagation(),n(t)}})]})})}function Kme({options:t,selected:e,onChange:n,placeholder:r="选择选项...",emptyText:s="未找到选项",className:i}){const[a,o]=b.useState(!1),c=kfe(FE(jj,{activationConstraint:{distance:8}}),FE(Sj,{coordinateGetter:Gme})),h=g=>{e.includes(g)?n(e.filter(x=>x!==g)):n([...e,g])},f=g=>{n(e.filter(x=>x!==g))},m=g=>{const{active:x,over:y}=g;if(y&&x.id!==y.id){const w=e.indexOf(x.id),S=e.indexOf(y.id);n(Oj(e,w,S))}};return l.jsxs(ul,{open:a,onOpenChange:o,children:[l.jsx(dl,{asChild:!0,children:l.jsxs(de,{variant:"outline",role:"combobox","aria-expanded":a,className:ve("w-full justify-between min-h-10 h-auto",i),children:[l.jsx(Ome,{sensors:c,collisionDetection:Ofe,onDragEnd:m,children:l.jsx(Ime,{items:e,strategy:Pme,children:l.jsx("div",{className:"flex gap-1 flex-wrap flex-1",children:e.length===0?l.jsx("span",{className:"text-muted-foreground",children:r}):e.map(g=>{const x=t.find(y=>y.value===g);return l.jsx(Yme,{value:g,label:x?.label||g,onRemove:f},g)})})})}),l.jsx(l6,{className:"ml-2 h-4 w-4 shrink-0 opacity-50",strokeWidth:2,fill:"none"})]})}),l.jsx(Ea,{className:"w-full p-0",align:"start",children:l.jsxs(dy,{children:[l.jsx(hy,{placeholder:"搜索...",className:"h-9"}),l.jsxs(fy,{children:[l.jsx(my,{children:s}),l.jsx(f0,{children:t.map(g=>{const x=e.includes(g.value);return l.jsxs(m0,{value:g.value,onSelect:()=>h(g.value),children:[l.jsx("div",{className:ve("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",x?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:l.jsx(ol,{className:"h-3 w-3",strokeWidth:2,fill:"none"})}),l.jsx("span",{children:g.label})]},g.value)})})]})]})})]})}const e_=new Map,Zme=300*1e3;function Jme(){const[t,e]=b.useState([]),[n,r]=b.useState([]),[s,i]=b.useState([]),[a,o]=b.useState([]),[c,h]=b.useState(null),[f,m]=b.useState(!0),[g,x]=b.useState(!1),[y,w]=b.useState(!1),[S,k]=b.useState(!1),[N,C]=b.useState(!1),[T,_]=b.useState(!1),[E,M]=b.useState(!1),[L,P]=b.useState(null),[I,Q]=b.useState(null),[U,ee]=b.useState(!1),[z,H]=b.useState(null),[B,X]=b.useState(""),[J,G]=b.useState(new Set),[R,se]=b.useState(!1),[W,F]=b.useState(1),[V,te]=b.useState(20),[ne,K]=b.useState(""),[ie,re]=b.useState([]),[ae,_e]=b.useState(!1),[Ue,Xe]=b.useState(null),[Ze,Oe]=b.useState(!1),[He,Ve]=b.useState(null),{toast:Be}=ts(),ut=b.useRef(null),rt=b.useRef(null),rn=b.useRef(!0);b.useEffect(()=>{Rn()},[]);const Rn=async()=>{try{m(!0);const ge=await th(),ze=ge.models||[];e(ze),o(ze.map(Gt=>Gt.name));const Et=ge.api_providers||[];r(Et.map(Gt=>Gt.name)),i(Et),h(ge.model_task_config||null),k(!1),rn.current=!1}catch(ge){console.error("加载配置失败:",ge)}finally{m(!1)}},Tn=b.useCallback(ge=>s.find(ze=>ze.name===ge),[s]),Mt=b.useCallback(async(ge,ze=!1)=>{const Et=Tn(ge);if(!Et?.base_url){re([]),Ve(null),Xe('提供商配置不完整,请先在"模型提供商配置"中配置');return}if(!Et.api_key){re([]),Ve(null),Xe('该提供商未配置 API Key,请先在"模型提供商配置"中填写');return}const Gt=lfe(Et.base_url);if(Ve(Gt),!Gt?.modelFetcher){re([]),Xe(null);return}const Mr=`${ge}:${Et.base_url}`,Wr=e_.get(Mr);if(!ze&&Wr&&Date.now()-Wr.timestamp{E&&L?.api_provider&&Mt(L.api_provider)},[E,L?.api_provider,Mt]);const vt=async()=>{try{C(!0),Uv().catch(()=>{}),_(!0)}catch(ge){console.error("重启失败:",ge),_(!1),Be({title:"重启失败",description:"无法发送重启请求,请手动重启",variant:"destructive"}),C(!1)}},Ce=async()=>{try{x(!0),ut.current&&clearTimeout(ut.current),rt.current&&clearTimeout(rt.current);const ge=await th();ge.models=t,ge.model_task_config=c,await R1(ge),k(!1),Be({title:"保存成功",description:"正在重启麦麦..."}),await vt()}catch(ge){console.error("保存配置失败:",ge),Be({title:"保存失败",description:ge.message,variant:"destructive"}),x(!1)}},Le=()=>{localStorage.removeItem("access-token"),window.location.href="/auth"},Ge=()=>{_(!1),C(!1),Be({title:"重启超时",description:"服务未能在预期时间内恢复,请手动检查或刷新页面",variant:"destructive"})},lt=b.useCallback(async ge=>{if(!rn.current)try{w(!0),await X3("models",ge),k(!1)}catch(ze){console.error("自动保存模型列表失败:",ze),k(!0)}finally{w(!1)}},[]),jt=b.useCallback(async ge=>{if(!rn.current)try{w(!0),await X3("model_task_config",ge),k(!1)}catch(ze){console.error("自动保存任务配置失败:",ze),k(!0)}finally{w(!1)}},[]);b.useEffect(()=>{if(!rn.current)return k(!0),ut.current&&clearTimeout(ut.current),ut.current=setTimeout(()=>{lt(t)},2e3),()=>{ut.current&&clearTimeout(ut.current)}},[t,lt]),b.useEffect(()=>{if(!(rn.current||!c))return k(!0),rt.current&&clearTimeout(rt.current),rt.current=setTimeout(()=>{jt(c)},2e3),()=>{rt.current&&clearTimeout(rt.current)}},[c,jt]);const Tt=async()=>{try{x(!0),ut.current&&clearTimeout(ut.current),rt.current&&clearTimeout(rt.current);const ge=await th();ge.models=t,ge.model_task_config=c,await R1(ge),k(!1),Be({title:"保存成功",description:"模型配置已保存"}),await Rn()}catch(ge){console.error("保存配置失败:",ge),Be({title:"保存失败",description:ge.message,variant:"destructive"})}finally{x(!1)}},ke=(ge,ze)=>{P(ge||{model_identifier:"",name:"",api_provider:n[0]||"",price_in:0,price_out:0,force_stream_mode:!1,extra_params:{}}),Q(ze),M(!0)},Te=()=>{if(!L)return;const ge={...L,price_in:L.price_in??0,price_out:L.price_out??0};let ze;I!==null?(ze=[...t],ze[I]=ge):ze=[...t,ge],e(ze),o(ze.map(Et=>Et.name)),M(!1),P(null),Q(null)},qe=ge=>{if(!ge&&L){const ze={...L,price_in:L.price_in??0,price_out:L.price_out??0};P(ze)}M(ge)},Rt=ge=>{H(ge),ee(!0)},At=()=>{if(z!==null){const ge=t.filter((ze,Et)=>Et!==z);e(ge),o(ge.map(ze=>ze.name)),Be({title:"删除成功",description:"模型已从列表中移除"})}ee(!1),H(null)},vr=ge=>{const ze=new Set(J);ze.has(ge)?ze.delete(ge):ze.add(ge),G(ze)},ft=()=>{if(J.size===Ot.length)G(new Set);else{const ge=Ot.map((ze,Et)=>t.findIndex(Gt=>Gt===Ot[Et]));G(new Set(ge))}},mn=()=>{if(J.size===0){Be({title:"提示",description:"请先选择要删除的模型",variant:"default"});return}se(!0)},gt=()=>{const ge=t.filter((ze,Et)=>!J.has(Et));e(ge),o(ge.map(ze=>ze.name)),G(new Set),se(!1),Be({title:"批量删除成功",description:`已删除 ${J.size} 个模型`})},Nt=(ge,ze,Et)=>{c&&h({...c,[ge]:{...c[ge],[ze]:Et}})},Ot=t.filter(ge=>{if(!B)return!0;const ze=B.toLowerCase();return ge.name.toLowerCase().includes(ze)||ge.model_identifier.toLowerCase().includes(ze)||ge.api_provider.toLowerCase().includes(ze)}),it=Math.ceil(Ot.length/V),Vn=Ot.slice((W-1)*V,W*V),jr=()=>{const ge=parseInt(ne);ge>=1&&ge<=it&&(F(ge),K(""))},Or=ge=>c?[c.utils?.model_list||[],c.utils_small?.model_list||[],c.tool_use?.model_list||[],c.replyer?.model_list||[],c.planner?.model_list||[],c.vlm?.model_list||[],c.voice?.model_list||[],c.embedding?.model_list||[],c.lpmm_entity_extract?.model_list||[],c.lpmm_rdf_build?.model_list||[],c.lpmm_qa?.model_list||[]].some(Et=>Et.includes(ge)):!1;return f?l.jsx(hn,{className:"h-full",children:l.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:l.jsx("div",{className:"flex items-center justify-center h-64",children:l.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})})}):l.jsx(hn,{className:"h-full",children:l.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[l.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[l.jsxs("div",{children:[l.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"模型管理与分配"}),l.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"添加模型并为模型分配功能"})]}),l.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[l.jsxs(de,{onClick:Tt,disabled:g||y||!S||N,size:"sm",variant:"outline",className:"flex-1 sm:flex-none",children:[l.jsx(zv,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),g?"保存中...":y?"自动保存中...":S?"保存配置":"已保存"]}),l.jsxs(Nn,{children:[l.jsx(Qr,{asChild:!0,children:l.jsxs(de,{disabled:g||y||N,size:"sm",className:"flex-1 sm:flex-none",children:[l.jsx(a6,{className:"mr-2 h-4 w-4"}),N?"重启中...":S?"保存并重启":"重启麦麦"]})}),l.jsxs(gn,{children:[l.jsxs(xn,{children:[l.jsx(yn,{children:"确认重启麦麦?"}),l.jsx(bn,{className:"space-y-3",asChild:!0,children:l.jsxs("div",{children:[l.jsx("p",{children:S?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"}),l.jsxs(Na,{className:"border-yellow-500/50 bg-yellow-500/10",children:[l.jsx(ra,{className:"h-4 w-4 text-yellow-600"}),l.jsxs(Ca,{className:"text-yellow-900 dark:text-yellow-100",children:[l.jsx("strong",{children:"重要提示:"}),"由于技术原因,使用重启功能后,将无法再使用 ",l.jsx("code",{className:"px-1 py-0.5 bg-yellow-200 dark:bg-yellow-900 rounded",children:"Ctrl+C"})," 结束程序。",l.jsxs(xr,{children:[l.jsx(Bh,{asChild:!0,children:l.jsxs("button",{className:"ml-1 text-yellow-700 dark:text-yellow-300 underline hover:text-yellow-800 dark:hover:text-yellow-200 inline-flex items-center gap-1",children:[l.jsx(Dv,{className:"h-3 w-3"}),"如何结束程序?"]})}),l.jsxs(lr,{className:"max-w-2xl",children:[l.jsxs(or,{children:[l.jsx(cr,{children:"如何结束使用重启功能后的麦麦程序"}),l.jsx(Hr,{children:"由于重启功能会使程序脱离终端控制,需要通过系统命令来结束进程"})]}),l.jsxs(sa,{defaultValue:"windows",className:"w-full",children:[l.jsxs(Mi,{className:"grid w-full grid-cols-3",children:[l.jsx(zt,{value:"windows",children:"Windows"}),l.jsx(zt,{value:"macos",children:"macOS"}),l.jsx(zt,{value:"linux",children:"Linux"})]}),l.jsxs(tn,{value:"windows",className:"space-y-4 mt-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"font-semibold",children:"方法一:使用任务管理器"}),l.jsxs("ol",{className:"list-decimal list-inside space-y-1 text-sm text-muted-foreground",children:[l.jsxs("li",{children:["按 ",l.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"Ctrl + Shift + Esc"})," 打开任务管理器"]}),l.jsxs("li",{children:['在"进程"或"详细信息"标签页中找到 ',l.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"python.exe"})]}),l.jsx("li",{children:'右键点击并选择"结束任务"'})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"font-semibold",children:"方法二:使用命令行"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"打开 PowerShell 或命令提示符,执行以下命令:"}),l.jsxs("div",{className:"bg-muted p-3 rounded-md font-mono text-sm",children:[l.jsx("p",{children:"# 查找麦麦进程"}),l.jsx("p",{children:'Get-Process python | Where-Object {$_.MainWindowTitle -eq ""}'}),l.jsx("p",{className:"mt-2",children:"# 结束所有 Python 进程(谨慎使用)"}),l.jsx("p",{children:"Stop-Process -Name python -Force"})]})]})]}),l.jsxs(tn,{value:"macos",className:"space-y-4 mt-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"font-semibold",children:"方法一:使用活动监视器"}),l.jsxs("ol",{className:"list-decimal list-inside space-y-1 text-sm text-muted-foreground",children:[l.jsxs("li",{children:["按 ",l.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"Cmd + Space"}),' 打开 Spotlight,搜索"活动监视器"']}),l.jsxs("li",{children:["在进程列表中找到 ",l.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"Python"})]}),l.jsx("li",{children:"选中后点击左上角的 X 按钮结束进程"})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"font-semibold",children:"方法二:使用终端"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"打开终端,执行以下命令:"}),l.jsxs("div",{className:"bg-muted p-3 rounded-md font-mono text-sm",children:[l.jsx("p",{children:"# 查找麦麦进程"}),l.jsx("p",{children:"ps aux | grep python | grep -v grep"}),l.jsx("p",{className:"mt-2",children:"# 结束指定 PID 的进程"}),l.jsx("p",{children:"kill -9 "}),l.jsx("p",{className:"mt-2",children:"# 或结束所有 Python 进程(谨慎使用)"}),l.jsx("p",{children:"pkill -9 python"})]})]})]}),l.jsxs(tn,{value:"linux",className:"space-y-4 mt-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"font-semibold",children:"使用终端命令"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"打开终端,执行以下命令:"}),l.jsxs("div",{className:"bg-muted p-3 rounded-md font-mono text-sm",children:[l.jsx("p",{children:"# 查找麦麦进程"}),l.jsx("p",{children:"ps aux | grep python | grep -v grep"}),l.jsx("p",{className:"mt-2",children:"# 结束指定 PID 的进程"}),l.jsx("p",{children:"kill -9 "}),l.jsx("p",{className:"mt-2",children:"# 或使用 pkill 按名称结束"}),l.jsx("p",{children:'pkill -9 -f "bot.py"'}),l.jsx("p",{className:"mt-2",children:"# 或结束所有 Python 进程(谨慎使用)"}),l.jsx("p",{children:"pkill -9 python"})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"font-semibold",children:"使用 htop(如已安装)"}),l.jsxs("ol",{className:"list-decimal list-inside space-y-1 text-sm text-muted-foreground",children:[l.jsxs("li",{children:["在终端输入 ",l.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"htop"})]}),l.jsxs("li",{children:["按 ",l.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"F3"})," 搜索 python"]}),l.jsxs("li",{children:["按 ",l.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"F9"})," 发送信号,选择 SIGKILL"]})]})]})]})]}),l.jsx(as,{children:l.jsx(k6,{asChild:!0,children:l.jsx(de,{variant:"outline",children:"关闭"})})})]})]})]})]})]})})]}),l.jsxs(vn,{children:[l.jsx(Sn,{children:"取消"}),l.jsx(wn,{onClick:S?Ce:vt,children:S?"保存并重启":"确认重启"})]})]})]})]})]}),l.jsxs(Na,{children:[l.jsx(ra,{className:"h-4 w-4"}),l.jsxs(Ca,{children:["配置更新后需要",l.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),l.jsxs(sa,{defaultValue:"models",className:"w-full",children:[l.jsxs(Mi,{className:"grid w-full max-w-full sm:max-w-md grid-cols-2",children:[l.jsx(zt,{value:"models",children:"添加模型"}),l.jsx(zt,{value:"tasks",children:"为模型分配功能"})]}),l.jsxs(tn,{value:"models",className:"space-y-4 mt-0",children:[l.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-2",children:[l.jsx("p",{className:"text-sm text-muted-foreground",children:"配置可用的模型列表"}),l.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[J.size>0&&l.jsxs(de,{onClick:mn,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[l.jsx(fn,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"批量删除 (",J.size,")"]}),l.jsxs(de,{onClick:()=>ke(null,null),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[l.jsx(ws,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"添加模型"]})]})]}),l.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-2",children:[l.jsxs("div",{className:"relative w-full sm:flex-1 sm:max-w-sm",children:[l.jsx(ci,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),l.jsx(Pe,{placeholder:"搜索模型名称、标识符或提供商...",value:B,onChange:ge=>X(ge.target.value),className:"pl-9"})]}),B&&l.jsxs("p",{className:"text-sm text-muted-foreground whitespace-nowrap",children:["找到 ",Ot.length," 个结果"]})]}),l.jsx("div",{className:"md:hidden space-y-3",children:Vn.length===0?l.jsx("div",{className:"text-center text-muted-foreground py-8 rounded-lg border bg-card",children:B?"未找到匹配的模型":"暂无模型配置"}):Vn.map((ge,ze)=>{const Et=t.findIndex(Mr=>Mr===ge),Gt=Or(ge.name);return l.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[l.jsxs("div",{className:"flex items-start justify-between gap-2",children:[l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[l.jsx("h3",{className:"font-semibold text-base",children:ge.name}),l.jsx(In,{variant:Gt?"default":"secondary",className:Gt?"bg-green-600 hover:bg-green-700":"",children:Gt?"已使用":"未使用"})]}),l.jsx("p",{className:"text-xs text-muted-foreground break-all",title:ge.model_identifier,children:ge.model_identifier})]}),l.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[l.jsxs(de,{variant:"default",size:"sm",onClick:()=>ke(ge,Et),children:[l.jsx(wu,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),l.jsxs(de,{size:"sm",onClick:()=>Rt(Et),className:"bg-red-600 hover:bg-red-700 text-white",children:[l.jsx(fn,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})]}),l.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[l.jsxs("div",{children:[l.jsx("span",{className:"text-muted-foreground text-xs",children:"提供商"}),l.jsx("p",{className:"font-medium",children:ge.api_provider})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-muted-foreground text-xs",children:"强制流式"}),l.jsx("p",{className:"font-medium",children:ge.force_stream_mode?"是":"否"})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-muted-foreground text-xs",children:"输入价格"}),l.jsxs("p",{className:"font-medium",children:["¥",ge.price_in,"/M"]})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-muted-foreground text-xs",children:"输出价格"}),l.jsxs("p",{className:"font-medium",children:["¥",ge.price_out,"/M"]})]})]})]},ze)})}),l.jsx("div",{className:"hidden md:block rounded-lg border bg-card overflow-hidden",children:l.jsx("div",{className:"overflow-x-auto",children:l.jsxs(Vh,{children:[l.jsx(Uh,{children:l.jsxs(bs,{children:[l.jsx(ln,{className:"w-12",children:l.jsx(li,{checked:J.size===Ot.length&&Ot.length>0,onCheckedChange:ft})}),l.jsx(ln,{className:"w-24",children:"使用状态"}),l.jsx(ln,{children:"模型名称"}),l.jsx(ln,{children:"模型标识符"}),l.jsx(ln,{children:"提供商"}),l.jsx(ln,{className:"text-right",children:"输入价格"}),l.jsx(ln,{className:"text-right",children:"输出价格"}),l.jsx(ln,{className:"text-center",children:"强制流式"}),l.jsx(ln,{className:"text-right",children:"操作"})]})}),l.jsx(Wh,{children:Vn.length===0?l.jsx(bs,{children:l.jsx(Qt,{colSpan:9,className:"text-center text-muted-foreground py-8",children:B?"未找到匹配的模型":"暂无模型配置"})}):Vn.map((ge,ze)=>{const Et=t.findIndex(Mr=>Mr===ge),Gt=Or(ge.name);return l.jsxs(bs,{children:[l.jsx(Qt,{children:l.jsx(li,{checked:J.has(Et),onCheckedChange:()=>vr(Et)})}),l.jsx(Qt,{children:l.jsx(In,{variant:Gt?"default":"secondary",className:Gt?"bg-green-600 hover:bg-green-700":"",children:Gt?"已使用":"未使用"})}),l.jsx(Qt,{className:"font-medium",children:ge.name}),l.jsx(Qt,{className:"max-w-xs truncate",title:ge.model_identifier,children:ge.model_identifier}),l.jsx(Qt,{children:ge.api_provider}),l.jsxs(Qt,{className:"text-right",children:["¥",ge.price_in,"/M"]}),l.jsxs(Qt,{className:"text-right",children:["¥",ge.price_out,"/M"]}),l.jsx(Qt,{className:"text-center",children:ge.force_stream_mode?"是":"否"}),l.jsx(Qt,{className:"text-right",children:l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsxs(de,{variant:"default",size:"sm",onClick:()=>ke(ge,Et),children:[l.jsx(wu,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),l.jsxs(de,{size:"sm",onClick:()=>Rt(Et),className:"bg-red-600 hover:bg-red-700 text-white",children:[l.jsx(fn,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})})]},ze)})})]})})}),Ot.length>0&&l.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(ue,{htmlFor:"page-size-model",className:"text-sm whitespace-nowrap",children:"每页显示"}),l.jsxs(qt,{value:V.toString(),onValueChange:ge=>{te(parseInt(ge)),F(1),G(new Set)},children:[l.jsx(It,{id:"page-size-model",className:"w-20",children:l.jsx(Ft,{})}),l.jsxs(Bt,{children:[l.jsx(De,{value:"10",children:"10"}),l.jsx(De,{value:"20",children:"20"}),l.jsx(De,{value:"50",children:"50"}),l.jsx(De,{value:"100",children:"100"})]})]}),l.jsxs("span",{className:"text-sm text-muted-foreground",children:["显示 ",(W-1)*V+1," 到"," ",Math.min(W*V,Ot.length)," 条,共 ",Ot.length," 条"]})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(de,{variant:"outline",size:"sm",onClick:()=>F(1),disabled:W===1,className:"hidden sm:flex",children:l.jsx(L0,{className:"h-4 w-4"})}),l.jsxs(de,{variant:"outline",size:"sm",onClick:()=>F(ge=>Math.max(1,ge-1)),disabled:W===1,children:[l.jsx($u,{className:"h-4 w-4 sm:mr-1"}),l.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Pe,{type:"number",value:ne,onChange:ge=>K(ge.target.value),onKeyDown:ge=>ge.key==="Enter"&&jr(),placeholder:W.toString(),className:"w-16 h-8 text-center",min:1,max:it}),l.jsx(de,{variant:"outline",size:"sm",onClick:jr,disabled:!ne,className:"h-8",children:"跳转"})]}),l.jsxs(de,{variant:"outline",size:"sm",onClick:()=>F(ge=>ge+1),disabled:W>=it,children:[l.jsx("span",{className:"hidden sm:inline",children:"下一页"}),l.jsx(Qu,{className:"h-4 w-4 sm:ml-1"})]}),l.jsx(de,{variant:"outline",size:"sm",onClick:()=>F(it),disabled:W>=it,className:"hidden sm:flex",children:l.jsx(I0,{className:"h-4 w-4"})})]})]})]}),l.jsxs(tn,{value:"tasks",className:"space-y-6 mt-0",children:[l.jsx("p",{className:"text-sm text-muted-foreground",children:"为不同的任务配置使用的模型和参数"}),c&&l.jsxs("div",{className:"grid gap-4 sm:gap-6",children:[l.jsx(ba,{title:"组件模型 (utils)",description:"用于表情包、取名、关系、情绪变化等组件",taskConfig:c.utils,modelNames:a,onChange:(ge,ze)=>Nt("utils",ge,ze)}),l.jsx(ba,{title:"组件小模型 (utils_small)",description:"消耗量较大的组件,建议使用速度较快的小模型",taskConfig:c.utils_small,modelNames:a,onChange:(ge,ze)=>Nt("utils_small",ge,ze)}),l.jsx(ba,{title:"工具调用模型 (tool_use)",description:"需要使用支持工具调用的模型",taskConfig:c.tool_use,modelNames:a,onChange:(ge,ze)=>Nt("tool_use",ge,ze)}),l.jsx(ba,{title:"首要回复模型 (replyer)",description:"用于表达器和表达方式学习",taskConfig:c.replyer,modelNames:a,onChange:(ge,ze)=>Nt("replyer",ge,ze)}),l.jsx(ba,{title:"决策模型 (planner)",description:"负责决定麦麦该什么时候回复",taskConfig:c.planner,modelNames:a,onChange:(ge,ze)=>Nt("planner",ge,ze)}),l.jsx(ba,{title:"图像识别模型 (vlm)",description:"视觉语言模型",taskConfig:c.vlm,modelNames:a,onChange:(ge,ze)=>Nt("vlm",ge,ze),hideTemperature:!0}),l.jsx(ba,{title:"语音识别模型 (voice)",description:"语音转文字",taskConfig:c.voice,modelNames:a,onChange:(ge,ze)=>Nt("voice",ge,ze),hideTemperature:!0,hideMaxTokens:!0}),l.jsx(ba,{title:"嵌入模型 (embedding)",description:"用于向量化",taskConfig:c.embedding,modelNames:a,onChange:(ge,ze)=>Nt("embedding",ge,ze),hideTemperature:!0,hideMaxTokens:!0}),l.jsxs("div",{className:"space-y-4",children:[l.jsx("h3",{className:"text-lg font-semibold",children:"LPMM 知识库模型"}),l.jsx(ba,{title:"实体提取模型 (lpmm_entity_extract)",description:"从文本中提取实体",taskConfig:c.lpmm_entity_extract,modelNames:a,onChange:(ge,ze)=>Nt("lpmm_entity_extract",ge,ze)}),l.jsx(ba,{title:"RDF 构建模型 (lpmm_rdf_build)",description:"构建知识图谱",taskConfig:c.lpmm_rdf_build,modelNames:a,onChange:(ge,ze)=>Nt("lpmm_rdf_build",ge,ze)}),l.jsx(ba,{title:"问答模型 (lpmm_qa)",description:"知识库问答",taskConfig:c.lpmm_qa,modelNames:a,onChange:(ge,ze)=>Nt("lpmm_qa",ge,ze)})]})]})]})]}),l.jsx(xr,{open:E,onOpenChange:qe,children:l.jsxs(lr,{className:"max-w-[95vw] sm:max-w-2xl max-h-[90vh] overflow-y-auto",children:[l.jsxs(or,{children:[l.jsx(cr,{children:I!==null?"编辑模型":"添加模型"}),l.jsx(Hr,{children:"配置模型的基本信息和参数"})]}),l.jsxs("div",{className:"grid gap-4 py-4",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ue,{htmlFor:"model_name",children:"模型名称 *"}),l.jsx(Pe,{id:"model_name",value:L?.name||"",onChange:ge=>P(ze=>ze?{...ze,name:ge.target.value}:null),placeholder:"例如: qwen3-30b"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"用于在任务配置中引用此模型"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ue,{htmlFor:"api_provider",children:"API 提供商 *"}),l.jsxs(qt,{value:L?.api_provider||"",onValueChange:ge=>{P(ze=>ze?{...ze,api_provider:ge}:null),re([]),Xe(null)},children:[l.jsx(It,{id:"api_provider",children:l.jsx(Ft,{placeholder:"选择提供商"})}),l.jsx(Bt,{children:n.map(ge=>l.jsx(De,{value:ge,children:ge},ge))})]})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx(ue,{htmlFor:"model_identifier",children:"模型标识符 *"}),He?.modelFetcher&&l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(In,{variant:"secondary",className:"text-xs",children:He.display_name}),l.jsx(de,{variant:"ghost",size:"sm",className:"h-6 px-2",onClick:()=>L?.api_provider&&Mt(L.api_provider,!0),disabled:ae,children:ae?l.jsx(vc,{className:"h-3 w-3 animate-spin"}):l.jsx(Ls,{className:"h-3 w-3"})})]})]}),He?.modelFetcher?l.jsxs(ul,{open:Ze,onOpenChange:Oe,children:[l.jsx(dl,{asChild:!0,children:l.jsxs(de,{variant:"outline",role:"combobox","aria-expanded":Ze,className:"w-full justify-between font-normal",disabled:ae||!!Ue,children:[ae?l.jsxs("span",{className:"flex items-center gap-2 text-muted-foreground",children:[l.jsx(vc,{className:"h-4 w-4 animate-spin"}),"正在获取模型列表..."]}):Ue?l.jsx("span",{className:"text-muted-foreground text-sm",children:"点击下方输入框手动填写"}):L?.model_identifier?l.jsx("span",{className:"truncate",children:L.model_identifier}):l.jsx("span",{className:"text-muted-foreground",children:"搜索或选择模型..."}),l.jsx(l6,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),l.jsx(Ea,{className:"p-0",align:"start",style:{width:"var(--radix-popover-trigger-width)"},children:l.jsxs(dy,{children:[l.jsx(hy,{placeholder:"搜索模型..."}),l.jsx(hn,{className:"h-[300px]",children:l.jsxs(fy,{className:"max-h-none overflow-visible",children:[l.jsx(my,{children:Ue?l.jsxs("div",{className:"py-4 px-2 text-center space-y-2",children:[l.jsx("p",{className:"text-sm text-destructive",children:Ue}),!Ue.includes("API Key")&&l.jsx(de,{variant:"link",size:"sm",onClick:()=>L?.api_provider&&Mt(L.api_provider,!0),children:"重试"})]}):"未找到匹配的模型"}),l.jsx(f0,{heading:"可用模型",children:ie.map(ge=>l.jsxs(m0,{value:ge.id,onSelect:()=>{P(ze=>ze?{...ze,model_identifier:ge.id}:null),Oe(!1)},children:[l.jsx(ol,{className:`mr-2 h-4 w-4 ${L?.model_identifier===ge.id?"opacity-100":"opacity-0"}`}),l.jsxs("div",{className:"flex flex-col",children:[l.jsx("span",{children:ge.id}),ge.name!==ge.id&&l.jsx("span",{className:"text-xs text-muted-foreground",children:ge.name})]})]},ge.id))}),l.jsx(f0,{heading:"手动输入",children:l.jsxs(m0,{value:"__manual_input__",onSelect:()=>{Oe(!1)},children:[l.jsx(wu,{className:"mr-2 h-4 w-4"}),"手动输入模型标识符..."]})})]})})]})})]}):l.jsx(Pe,{id:"model_identifier",value:L?.model_identifier||"",onChange:ge=>P(ze=>ze?{...ze,model_identifier:ge.target.value}:null),placeholder:"Qwen/Qwen3-30B-A3B-Instruct-2507"}),Ue&&He?.modelFetcher&&l.jsxs(Na,{variant:"destructive",className:"mt-2 py-2",children:[l.jsx(ra,{className:"h-4 w-4"}),l.jsx(Ca,{className:"text-xs",children:Ue})]}),He?.modelFetcher&&l.jsx(Pe,{value:L?.model_identifier||"",onChange:ge=>P(ze=>ze?{...ze,model_identifier:ge.target.value}:null),placeholder:"或手动输入模型标识符",className:"mt-2"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:Ue?'请手动输入模型标识符,或前往"模型提供商配置"检查 API Key':He?.modelFetcher?`已识别为 ${He.display_name},支持自动获取模型列表`:"API 提供商提供的模型 ID"})]}),l.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ue,{htmlFor:"price_in",children:"输入价格 (¥/M token)"}),l.jsx(Pe,{id:"price_in",type:"number",step:"0.1",min:"0",value:L?.price_in??"",onChange:ge=>{const ze=ge.target.value===""?null:parseFloat(ge.target.value);P(Et=>Et?{...Et,price_in:ze}:null)},placeholder:"默认: 0"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ue,{htmlFor:"price_out",children:"输出价格 (¥/M token)"}),l.jsx(Pe,{id:"price_out",type:"number",step:"0.1",min:"0",value:L?.price_out??"",onChange:ge=>{const ze=ge.target.value===""?null:parseFloat(ge.target.value);P(Et=>Et?{...Et,price_out:ze}:null)},placeholder:"默认: 0"})]})]}),l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(Pt,{id:"force_stream_mode",checked:L?.force_stream_mode||!1,onCheckedChange:ge=>P(ze=>ze?{...ze,force_stream_mode:ge}:null)}),l.jsx(ue,{htmlFor:"force_stream_mode",className:"cursor-pointer",children:"强制流式输出模式"})]})]}),l.jsxs(as,{children:[l.jsx(de,{variant:"outline",onClick:()=>M(!1),children:"取消"}),l.jsx(de,{onClick:Te,children:"保存"})]})]})}),l.jsx(Nn,{open:U,onOpenChange:ee,children:l.jsxs(gn,{children:[l.jsxs(xn,{children:[l.jsx(yn,{children:"确认删除"}),l.jsxs(bn,{children:['确定要删除模型 "',z!==null?t[z]?.name:"",'" 吗? 此操作无法撤销。']})]}),l.jsxs(vn,{children:[l.jsx(Sn,{children:"取消"}),l.jsx(wn,{onClick:At,children:"删除"})]})]})}),l.jsx(Nn,{open:R,onOpenChange:se,children:l.jsxs(gn,{children:[l.jsxs(xn,{children:[l.jsx(yn,{children:"确认批量删除"}),l.jsxs(bn,{children:["确定要删除选中的 ",J.size," 个模型吗? 此操作无法撤销。"]})]}),l.jsxs(vn,{children:[l.jsx(Sn,{children:"取消"}),l.jsx(wn,{onClick:gt,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})}),T&&l.jsx(N6,{onRestartComplete:Le,onRestartFailed:Ge})]})})}function ba({title:t,description:e,taskConfig:n,modelNames:r,onChange:s,hideTemperature:i=!1,hideMaxTokens:a=!1}){const o=c=>{s("model_list",c)};return l.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:[l.jsxs("div",{children:[l.jsx("h4",{className:"font-semibold text-base sm:text-lg",children:t}),l.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mt-1",children:e})]}),l.jsxs("div",{className:"grid gap-4",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ue,{children:"模型列表"}),l.jsx(Kme,{options:r.map(c=>({label:c,value:c})),selected:n.model_list||[],onChange:o,placeholder:"选择模型...",emptyText:"暂无可用模型"})]}),l.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[!i&&l.jsxs("div",{className:"grid gap-3",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx(ue,{children:"温度"}),l.jsx(Pe,{type:"number",step:"0.1",min:"0",max:"1",value:n.temperature??.3,onChange:c=>{const h=parseFloat(c.target.value);!isNaN(h)&&h>=0&&h<=1&&s("temperature",h)},className:"w-20 h-8 text-sm"})]}),l.jsx(V0,{value:[n.temperature??.3],onValueChange:c=>s("temperature",c[0]),min:0,max:1,step:.1,className:"w-full"})]}),!a&&l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ue,{children:"最大 Token"}),l.jsx(Pe,{type:"number",step:"1",min:"1",value:n.max_tokens??1024,onChange:c=>s("max_tokens",parseInt(c.target.value))})]})]})]})]})}const yy="/api/webui/config";async function e0e(){const e=await(await pt(`${yy}/adapter-config/path`)).json();return!e.success||!e.path?null:{path:e.path,lastModified:e.lastModified}}async function t_(t){const n=await(await pt(`${yy}/adapter-config/path`,{method:"POST",headers:Ct(),body:JSON.stringify({path:t})})).json();if(!n.success)throw new Error(n.message||"保存路径失败")}async function n_(t){const n=await(await pt(`${yy}/adapter-config?path=${encodeURIComponent(t)}`)).json();if(!n.success)throw new Error("读取配置文件失败");return n.content}async function r_(t,e){const r=await(await pt(`${yy}/adapter-config`,{method:"POST",headers:Ct(),body:JSON.stringify({path:t,content:e})})).json();if(!r.success)throw new Error(r.message||"保存配置失败")}const ji={inner:{version:"0.1.2"},nickname:{nickname:""},napcat_server:{host:"localhost",port:8095,token:"",heartbeat_interval:30},maibot_server:{host:"localhost",port:8e3},chat:{group_list_type:"whitelist",group_list:[],private_list_type:"whitelist",private_list:[],ban_user_id:[],ban_qq_bot:!1,enable_poke:!0},voice:{use_tts:!1},debug:{level:"INFO"}},i4={oneclick:{name:"一键包",description:"使用一键包部署的适配器配置",path:"../MaiBot-Napcat-Adapter/config.toml",icon:mh},docker:{name:"Docker",description:"Docker Compose 部署的适配器配置",path:"./docker-config/adapters/config.toml",icon:$K}};function t0e(){const[t,e]=b.useState("upload"),[n,r]=b.useState(null),[s,i]=b.useState(""),[a,o]=b.useState(""),[c,h]=b.useState("oneclick"),[f,m]=b.useState(""),[g,x]=b.useState(!1),[y,w]=b.useState(!1),[S,k]=b.useState(!1),[N,C]=b.useState(!1),[T,_]=b.useState(null),E=b.useRef(null),{toast:M}=ts(),L=b.useRef(null),P=K=>{if(!K.trim())return{valid:!1,error:"路径不能为空"};if(!K.toLowerCase().endsWith(".toml"))return{valid:!1,error:"文件必须是 .toml 格式"};const ie=/^([a-zA-Z]:\\|\\\\[^\\]+\\[^\\]+\\).+\.toml$/i,re=/^(\/|~\/).+\.toml$/i,ae=/^(\.{1,2}[\\/]|[^:\\/]).+\.toml$/i,_e=ie.test(K),Ue=re.test(K),Xe=ae.test(K);return!_e&&!Ue&&!Xe?{valid:!1,error:"路径格式错误"}:/[<>"|?*\x00-\x1F]/.test(K)?{valid:!1,error:"路径包含非法字符"}:{valid:!0,error:""}},I=K=>{if(o(K),K.trim()){const ie=P(K);m(ie.error)}else m("")},Q=b.useCallback(async K=>{const ie=i4[K];w(!0);try{const re=await n_(ie.path),ae=W(re);r(ae),h(K),o(ie.path),await t_(ie.path),M({title:"加载成功",description:`已从${ie.name}预设加载配置`})}catch(re){console.error("加载预设配置失败:",re),M({title:"加载失败",description:re instanceof Error?re.message:"无法读取预设配置文件",variant:"destructive"})}finally{w(!1)}},[M]),U=b.useCallback(async K=>{const ie=P(K);if(!ie.valid){m(ie.error),M({title:"路径无效",description:ie.error,variant:"destructive"});return}m(""),w(!0);try{const re=await n_(K),ae=W(re);r(ae),o(K),await t_(K),M({title:"加载成功",description:"已从配置文件加载"})}catch(re){console.error("加载配置失败:",re),M({title:"加载失败",description:re instanceof Error?re.message:"无法读取配置文件",variant:"destructive"})}finally{w(!1)}},[M]);b.useEffect(()=>{(async()=>{try{const ie=await e0e();if(ie&&ie.path){o(ie.path);const re=Object.entries(i4).find(([,ae])=>ae.path===ie.path);re?(e("preset"),h(re[0]),await Q(re[0])):(e("path"),await U(ie.path))}}catch(ie){console.error("加载保存的路径失败:",ie)}})()},[U,Q]);const ee=b.useCallback(K=>{t!=="path"&&t!=="preset"||!a||(L.current&&clearTimeout(L.current),L.current=setTimeout(async()=>{x(!0);try{const ie=F(K);await r_(a,ie),M({title:"自动保存成功",description:"配置已保存到文件"})}catch(ie){console.error("自动保存失败:",ie),M({title:"自动保存失败",description:ie instanceof Error?ie.message:"保存配置失败",variant:"destructive"})}finally{x(!1)}},1e3))},[t,a,M]),z=async()=>{if(!n||!a)return;const K=P(a);if(!K.valid){M({title:"保存失败",description:K.error,variant:"destructive"});return}x(!0);try{const ie=F(n);await r_(a,ie),M({title:"保存成功",description:"配置已保存到文件"})}catch(ie){console.error("保存失败:",ie),M({title:"保存失败",description:ie instanceof Error?ie.message:"保存配置失败",variant:"destructive"})}finally{x(!1)}},H=async()=>{a&&await U(a)},B=K=>{if(K!==t){if(n){_(K),k(!0);return}X(K)}},X=K=>{r(null),i(""),m(""),e(K),K==="preset"&&Q("oneclick"),M({title:"已切换模式",description:{upload:"现在可以上传配置文件",path:"现在可以指定配置文件路径",preset:"现在可以使用预设配置"}[K]})},J=()=>{T&&(X(T),_(null)),k(!1)},G=()=>{if(n){C(!0);return}R()},R=()=>{o(""),r(null),m(""),M({title:"已清空",description:"路径和配置已清空"})},se=()=>{R(),C(!1)},W=K=>{const ie=JSON.parse(JSON.stringify(ji)),re=K.split(` +`);let ae="";for(const _e of re){const Ue=_e.trim();if(!Ue||Ue.startsWith("#"))continue;const Xe=Ue.match(/^\[(\w+)\]/);if(Xe){ae=Xe[1];continue}const Ze=Ue.match(/^(\w+)\s*=\s*(.+)$/);if(Ze&&ae){const[,Oe,He]=Ze;let Ve=He.trim();const Be=Ve.match(/^("[^"]*")/);if(Be)Ve=Be[1];else{const rt=Ve.indexOf("#");rt!==-1&&(Ve=Ve.substring(0,rt).trim())}let ut;if(Ve==="true")ut=!0;else if(Ve==="false")ut=!1;else if(Ve.startsWith("[")&&Ve.endsWith("]")){const rt=Ve.slice(1,-1).trim();if(rt){const rn=rt.split(",").map(Tn=>{const Mt=Tn.trim();return isNaN(Number(Mt))?Mt.replace(/"/g,""):Number(Mt)}),Rn=typeof rn[0];ut=rn.every(Tn=>typeof Tn===Rn)?rn:rn.filter(Tn=>typeof Tn=="number")}else ut=[]}else Ve.startsWith('"')&&Ve.endsWith('"')?ut=Ve.slice(1,-1):isNaN(Number(Ve))?ut=Ve.replace(/"/g,""):ut=Number(Ve);if(ae in ie){const rt=ie[ae];rt[Oe]=ut}}}return ie},F=K=>{const ie=[],re=(ae,_e)=>ae===""||ae===null||ae===void 0?_e:ae;return ie.push("[inner]"),ie.push(`version = "${re(K.inner.version,ji.inner.version)}" # 版本号`),ie.push("# 请勿修改版本号,除非你知道自己在做什么"),ie.push(""),ie.push("[nickname] # 现在没用"),ie.push(`nickname = "${re(K.nickname.nickname,ji.nickname.nickname)}"`),ie.push(""),ie.push("[napcat_server] # Napcat连接的ws服务设置"),ie.push(`host = "${re(K.napcat_server.host,ji.napcat_server.host)}" # Napcat设定的主机地址`),ie.push(`port = ${re(K.napcat_server.port||0,ji.napcat_server.port)} # Napcat设定的端口`),ie.push(`token = "${re(K.napcat_server.token,ji.napcat_server.token)}" # Napcat设定的访问令牌,若无则留空`),ie.push(`heartbeat_interval = ${re(K.napcat_server.heartbeat_interval||0,ji.napcat_server.heartbeat_interval)} # 与Napcat设置的心跳相同(按秒计)`),ie.push(""),ie.push("[maibot_server] # 连接麦麦的ws服务设置"),ie.push(`host = "${re(K.maibot_server.host,ji.maibot_server.host)}" # 麦麦在.env文件中设置的主机地址,即HOST字段`),ie.push(`port = ${re(K.maibot_server.port||0,ji.maibot_server.port)} # 麦麦在.env文件中设置的端口,即PORT字段`),ie.push(""),ie.push("[chat] # 黑白名单功能"),ie.push(`group_list_type = "${re(K.chat.group_list_type,ji.chat.group_list_type)}" # 群组名单类型,可选为:whitelist, blacklist`),ie.push(`group_list = [${K.chat.group_list.join(", ")}] # 群组名单`),ie.push("# 当group_list_type为whitelist时,只有群组名单中的群组可以聊天"),ie.push("# 当group_list_type为blacklist时,群组名单中的任何群组无法聊天"),ie.push(`private_list_type = "${re(K.chat.private_list_type,ji.chat.private_list_type)}" # 私聊名单类型,可选为:whitelist, blacklist`),ie.push(`private_list = [${K.chat.private_list.join(", ")}] # 私聊名单`),ie.push("# 当private_list_type为whitelist时,只有私聊名单中的用户可以聊天"),ie.push("# 当private_list_type为blacklist时,私聊名单中的任何用户无法聊天"),ie.push(`ban_user_id = [${K.chat.ban_user_id.join(", ")}] # 全局禁止名单(全局禁止名单中的用户无法进行任何聊天)`),ie.push(`ban_qq_bot = ${K.chat.ban_qq_bot} # 是否屏蔽QQ官方机器人`),ie.push(`enable_poke = ${K.chat.enable_poke} # 是否启用戳一戳功能`),ie.push(""),ie.push("[voice] # 发送语音设置"),ie.push(`use_tts = ${K.voice.use_tts} # 是否使用tts语音(请确保你配置了tts并有对应的adapter)`),ie.push(""),ie.push("[debug]"),ie.push(`level = "${re(K.debug.level,ji.debug.level)}" # 日志等级(DEBUG, INFO, WARNING, ERROR, CRITICAL)`),ie.join(` +`)},V=K=>{const ie=K.target.files?.[0];if(!ie)return;const re=new FileReader;re.onload=ae=>{try{const _e=ae.target?.result,Ue=W(_e);r(Ue),i(ie.name),M({title:"上传成功",description:`已加载配置文件:${ie.name}`})}catch(_e){console.error("解析配置文件失败:",_e),M({title:"解析失败",description:"配置文件格式错误,请检查文件内容",variant:"destructive"})}},re.readAsText(ie)},te=()=>{if(!n)return;const K=F(n),ie=new Blob([K],{type:"text/plain;charset=utf-8"}),re=URL.createObjectURL(ie),ae=document.createElement("a");ae.href=re,ae.download=s||"config.toml",document.body.appendChild(ae),ae.click(),document.body.removeChild(ae),URL.revokeObjectURL(re),M({title:"下载成功",description:"配置文件已下载,请手动覆盖并重启适配器"})},ne=()=>{r(JSON.parse(JSON.stringify(ji))),i("config.toml"),M({title:"已加载默认配置",description:"可以开始编辑配置"})};return l.jsx(hn,{className:"h-full",children:l.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[l.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:l.jsxs("div",{children:[l.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"麦麦适配器配置"}),l.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理麦麦的 QQ 适配器的配置文件"})]})}),l.jsxs(Dt,{children:[l.jsxs(kn,{children:[l.jsx(jn,{children:"工作模式"}),l.jsx(Fr,{children:"选择配置文件的管理方式"})]}),l.jsxs(Dn,{className:"space-y-4",children:[l.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3 md:gap-4",children:[l.jsx("div",{className:`border-2 rounded-lg p-3 md:p-4 cursor-pointer transition-all ${t==="preset"?"border-primary bg-primary/5":"border-muted hover:border-primary/50 active:border-primary/70"}`,onClick:()=>B("preset"),children:l.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[l.jsx(mh,{className:"h-4 w-4 md:h-5 md:w-5 mt-0.5 flex-shrink-0"}),l.jsxs("div",{className:"min-w-0",children:[l.jsx("h3",{className:"font-semibold text-sm md:text-base",children:"预设模式"}),l.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-1 line-clamp-2",children:"使用预设的部署配置"})]})]})}),l.jsx("div",{className:`border-2 rounded-lg p-3 md:p-4 cursor-pointer transition-all ${t==="upload"?"border-primary bg-primary/5":"border-muted hover:border-primary/50 active:border-primary/70"}`,onClick:()=>B("upload"),children:l.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[l.jsx(IC,{className:"h-4 w-4 md:h-5 md:w-5 mt-0.5 flex-shrink-0"}),l.jsxs("div",{className:"min-w-0",children:[l.jsx("h3",{className:"font-semibold text-sm md:text-base",children:"上传文件模式"}),l.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-1 line-clamp-2",children:"上传配置文件,编辑后下载并手动覆盖"})]})]})}),l.jsx("div",{className:`border-2 rounded-lg p-3 md:p-4 cursor-pointer transition-all ${t==="path"?"border-primary bg-primary/5":"border-muted hover:border-primary/50 active:border-primary/70"}`,onClick:()=>B("path"),children:l.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[l.jsx(QK,{className:"h-4 w-4 md:h-5 md:w-5 mt-0.5 flex-shrink-0"}),l.jsxs("div",{className:"min-w-0",children:[l.jsx("h3",{className:"font-semibold text-sm md:text-base",children:"指定路径模式"}),l.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-1 line-clamp-2",children:"指定配置文件路径,自动加载和保存"})]})]})})]}),t==="preset"&&l.jsxs("div",{className:"space-y-3 pt-2 border-t",children:[l.jsx(ue,{className:"text-sm md:text-base",children:"选择部署方式"}),l.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:Object.entries(i4).map(([K,ie])=>{const re=ie.icon,ae=c===K;return l.jsx("div",{className:`border-2 rounded-lg p-3 cursor-pointer transition-all ${ae?"border-primary bg-primary/5":"border-muted hover:border-primary/50"}`,onClick:()=>{h(K),Q(K)},children:l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx(re,{className:"h-5 w-5 mt-0.5 flex-shrink-0"}),l.jsxs("div",{className:"min-w-0 flex-1",children:[l.jsx("h4",{className:"font-semibold text-sm",children:ie.name}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:ie.description}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1 font-mono break-all",children:ie.path})]})]})},K)})})]}),t==="path"&&l.jsxs("div",{className:"space-y-3 pt-2 border-t",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{htmlFor:"config-path",className:"text-sm md:text-base",children:"配置文件路径"}),l.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[l.jsxs("div",{className:"flex-1 space-y-1",children:[l.jsx(Pe,{id:"config-path",value:a,onChange:K=>I(K.target.value),placeholder:"例: C:\\Adapter\\config.toml",className:`text-sm ${f?"border-destructive":""}`}),f&&l.jsx("p",{className:"text-xs text-destructive",children:f})]}),l.jsx(de,{onClick:()=>U(a),disabled:y||!a||!!f,className:"w-full sm:w-auto",children:y?l.jsxs(l.Fragment,{children:[l.jsx(Ls,{className:"h-4 w-4 animate-spin mr-2"}),l.jsx("span",{className:"sm:hidden",children:"加载中..."})]}):l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"sm:hidden",children:"加载配置"}),l.jsx("span",{className:"hidden sm:inline",children:"加载"})]})})]})]}),l.jsxs("details",{className:"rounded-lg bg-muted/50 p-3 group",children:[l.jsxs("summary",{className:"text-xs font-medium cursor-pointer select-none list-none flex items-center justify-between",children:[l.jsx("span",{children:"路径格式说明"}),l.jsx("svg",{className:"h-4 w-4 transition-transform group-open:rotate-180",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),l.jsxs("div",{className:"mt-2 space-y-2 text-xs text-muted-foreground",children:[l.jsxs("div",{className:"space-y-1",children:[l.jsx("div",{className:"flex items-center gap-2",children:l.jsx("span",{className:"font-mono bg-background px-1.5 py-0.5 rounded text-[10px] md:text-xs whitespace-nowrap",children:"Windows"})}),l.jsxs("div",{className:"pl-2 space-y-0.5 text-[10px] md:text-xs break-all",children:[l.jsx("div",{children:"C:\\Adapter\\config.toml"}),l.jsx("div",{className:"hidden sm:block",children:"D:\\MaiBot\\adapter\\config.toml"}),l.jsx("div",{className:"hidden sm:block",children:"\\\\server\\share\\config.toml"})]})]}),l.jsxs("div",{className:"space-y-1",children:[l.jsx("div",{className:"flex items-center gap-2",children:l.jsx("span",{className:"font-mono bg-background px-1.5 py-0.5 rounded text-[10px] md:text-xs whitespace-nowrap",children:"Linux"})}),l.jsxs("div",{className:"pl-2 space-y-0.5 text-[10px] md:text-xs break-all",children:[l.jsx("div",{children:"/opt/adapter/config.toml"}),l.jsx("div",{className:"hidden sm:block",children:"/home/user/adapter/config.toml"}),l.jsx("div",{className:"hidden sm:block",children:"~/adapter/config.toml"})]})]}),l.jsx("p",{className:"pt-1 border-t text-[10px] md:text-xs",children:"💡 配置会自动保存到指定文件,修改后 1 秒自动保存"})]})]})]})]})]}),l.jsxs(Na,{children:[l.jsx(ra,{className:"h-4 w-4"}),l.jsx(Ca,{children:t==="preset"?l.jsxs(l.Fragment,{children:[l.jsx("strong",{children:"预设模式:"}),"选择预设的部署方式,配置会自动加载,修改后 1 秒自动保存",g&&" (正在保存...)"]}):t==="upload"?l.jsxs(l.Fragment,{children:[l.jsx("strong",{children:"上传文件模式:"}),"上传配置文件 → 在线编辑 → 下载文件 → 手动覆盖并重启适配器"]}):l.jsxs(l.Fragment,{children:[l.jsx("strong",{children:"指定路径模式:"}),"指定配置文件路径后,配置会自动加载,修改后 1 秒自动保存",g&&" (正在保存...)"]})})]}),t==="upload"&&!n&&l.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 w-full",children:[l.jsx("input",{ref:E,type:"file",accept:".toml",className:"hidden",onChange:V}),l.jsxs(de,{onClick:()=>E.current?.click(),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[l.jsx(IC,{className:"mr-2 h-4 w-4"}),"上传配置"]}),l.jsxs(de,{onClick:ne,size:"sm",className:"w-full sm:w-auto",children:[l.jsx(lo,{className:"mr-2 h-4 w-4"}),"使用默认配置"]})]}),t==="upload"&&n&&l.jsx("div",{className:"flex gap-2",children:l.jsxs(de,{onClick:te,size:"sm",className:"w-full sm:w-auto",children:[l.jsx(Su,{className:"mr-2 h-4 w-4"}),"下载配置"]})}),(t==="preset"||t==="path")&&n&&l.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[l.jsxs(de,{onClick:z,size:"sm",disabled:g||!!f,className:"w-full sm:w-auto",children:[l.jsx(zv,{className:"mr-2 h-4 w-4"}),g?"保存中...":"立即保存"]}),l.jsxs(de,{onClick:H,size:"sm",variant:"outline",disabled:y,className:"w-full sm:w-auto",children:[l.jsx(Ls,{className:`mr-2 h-4 w-4 ${y?"animate-spin":""}`}),"刷新"]}),t==="path"&&l.jsxs(de,{onClick:G,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[l.jsx(fn,{className:"mr-2 h-4 w-4"}),"清空路径"]})]}),n?l.jsxs(sa,{defaultValue:"napcat",className:"w-full",children:[l.jsx("div",{className:"overflow-x-auto -mx-4 px-4 sm:mx-0 sm:px-0",children:l.jsxs(Mi,{className:"inline-flex w-auto min-w-full sm:grid sm:w-full sm:grid-cols-5",children:[l.jsxs(zt,{value:"napcat",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[l.jsx("span",{className:"hidden sm:inline",children:"Napcat 连接"}),l.jsx("span",{className:"sm:hidden",children:"Napcat"})]}),l.jsxs(zt,{value:"maibot",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[l.jsx("span",{className:"hidden sm:inline",children:"麦麦连接"}),l.jsx("span",{className:"sm:hidden",children:"麦麦"})]}),l.jsxs(zt,{value:"chat",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[l.jsx("span",{className:"hidden sm:inline",children:"聊天控制"}),l.jsx("span",{className:"sm:hidden",children:"聊天"})]}),l.jsxs(zt,{value:"voice",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[l.jsx("span",{className:"hidden sm:inline",children:"语音设置"}),l.jsx("span",{className:"sm:hidden",children:"语音"})]}),l.jsx(zt,{value:"debug",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:"调试"})]})}),l.jsx(tn,{value:"napcat",className:"space-y-4",children:l.jsx(n0e,{config:n,onChange:K=>{r(K),ee(K)}})}),l.jsx(tn,{value:"maibot",className:"space-y-4",children:l.jsx(r0e,{config:n,onChange:K=>{r(K),ee(K)}})}),l.jsx(tn,{value:"chat",className:"space-y-4",children:l.jsx(s0e,{config:n,onChange:K=>{r(K),ee(K)}})}),l.jsx(tn,{value:"voice",className:"space-y-4",children:l.jsx(i0e,{config:n,onChange:K=>{r(K),ee(K)}})}),l.jsx(tn,{value:"debug",className:"space-y-4",children:l.jsx(a0e,{config:n,onChange:K=>{r(K),ee(K)}})})]}):l.jsx("div",{className:"rounded-lg border bg-card p-6 md:p-12",children:l.jsxs("div",{className:"text-center space-y-3 md:space-y-4",children:[l.jsx(lo,{className:"h-12 w-12 md:h-16 md:w-16 mx-auto text-muted-foreground"}),l.jsxs("div",{children:[l.jsx("h3",{className:"text-base md:text-lg font-semibold",children:"尚未加载配置"}),l.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-2 px-4",children:t==="preset"?"请选择预设的部署方式":t==="upload"?"请上传现有配置文件,或使用默认配置开始编辑":"请指定配置文件路径并点击加载按钮"})]})]})}),l.jsx(Nn,{open:S,onOpenChange:k,children:l.jsxs(gn,{children:[l.jsxs(xn,{children:[l.jsx(yn,{children:"确认切换模式"}),l.jsxs(bn,{children:["切换模式将清空当前配置,确定要继续吗?",l.jsx("br",{}),l.jsx("span",{className:"text-destructive font-medium",children:"请确保已保存重要配置"})]})]}),l.jsxs(vn,{children:[l.jsx(Sn,{onClick:()=>{k(!1),_(null)},children:"取消"}),l.jsx(wn,{onClick:J,children:"确认切换"})]})]})}),l.jsx(Nn,{open:N,onOpenChange:C,children:l.jsxs(gn,{children:[l.jsxs(xn,{children:[l.jsx(yn,{children:"确认清空路径"}),l.jsxs(bn,{children:["清空路径将清除当前配置,确定要继续吗?",l.jsx("br",{}),l.jsx("span",{className:"text-muted-foreground text-sm",children:"此操作不会删除配置文件,只是清除界面中的配置"})]})]}),l.jsxs(vn,{children:[l.jsx(Sn,{onClick:()=>C(!1),children:"取消"}),l.jsx(wn,{onClick:se,className:"bg-destructive hover:bg-destructive/90",children:"确认清空"})]})]})})]})})}function n0e({config:t,onChange:e}){return l.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:l.jsxs("div",{children:[l.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"Napcat WebSocket 服务设置"}),l.jsxs("div",{className:"grid gap-3 md:gap-4",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ue,{htmlFor:"napcat-host",className:"text-sm md:text-base",children:"主机地址"}),l.jsx(Pe,{id:"napcat-host",value:t.napcat_server.host,onChange:n=>e({...t,napcat_server:{...t.napcat_server,host:n.target.value}}),placeholder:"localhost",className:"text-sm md:text-base"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的主机地址"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ue,{htmlFor:"napcat-port",className:"text-sm md:text-base",children:"端口"}),l.jsx(Pe,{id:"napcat-port",type:"number",value:t.napcat_server.port||"",onChange:n=>e({...t,napcat_server:{...t.napcat_server,port:n.target.value?parseInt(n.target.value):0}}),placeholder:"8095",className:"text-sm md:text-base"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的端口(留空使用默认值 8095)"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ue,{htmlFor:"napcat-token",className:"text-sm md:text-base",children:"访问令牌(Token)"}),l.jsx(Pe,{id:"napcat-token",type:"password",value:t.napcat_server.token,onChange:n=>e({...t,napcat_server:{...t.napcat_server,token:n.target.value}}),placeholder:"留空表示无需令牌",className:"text-sm md:text-base"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的访问令牌,若无则留空"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ue,{htmlFor:"napcat-heartbeat",className:"text-sm md:text-base",children:"心跳间隔(秒)"}),l.jsx(Pe,{id:"napcat-heartbeat",type:"number",value:t.napcat_server.heartbeat_interval||"",onChange:n=>e({...t,napcat_server:{...t.napcat_server,heartbeat_interval:n.target.value?parseInt(n.target.value):0}}),placeholder:"30",className:"text-sm md:text-base"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"与 Napcat 设置的心跳间隔保持一致(留空使用默认值 30)"})]})]})]})})}function r0e({config:t,onChange:e}){return l.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:l.jsxs("div",{children:[l.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"麦麦 WebSocket 服务设置"}),l.jsxs("div",{className:"grid gap-3 md:gap-4",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ue,{htmlFor:"maibot-host",className:"text-sm md:text-base",children:"主机地址"}),l.jsx(Pe,{id:"maibot-host",value:t.maibot_server.host,onChange:n=>e({...t,maibot_server:{...t.maibot_server,host:n.target.value}}),placeholder:"localhost",className:"text-sm md:text-base"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦在 .env 文件中设置的 HOST 字段"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ue,{htmlFor:"maibot-port",className:"text-sm md:text-base",children:"端口"}),l.jsx(Pe,{id:"maibot-port",type:"number",value:t.maibot_server.port||"",onChange:n=>e({...t,maibot_server:{...t.maibot_server,port:n.target.value?parseInt(n.target.value):0}}),placeholder:"8000",className:"text-sm md:text-base"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦在 .env 文件中设置的 PORT 字段(留空使用默认值 8000)"})]})]})]})})}function s0e({config:t,onChange:e}){const n=i=>{const a={...t};i==="group"?a.chat.group_list=[...a.chat.group_list,0]:i==="private"?a.chat.private_list=[...a.chat.private_list,0]:a.chat.ban_user_id=[...a.chat.ban_user_id,0],e(a)},r=(i,a)=>{const o={...t};i==="group"?o.chat.group_list=o.chat.group_list.filter((c,h)=>h!==a):i==="private"?o.chat.private_list=o.chat.private_list.filter((c,h)=>h!==a):o.chat.ban_user_id=o.chat.ban_user_id.filter((c,h)=>h!==a),e(o)},s=(i,a,o)=>{const c={...t};i==="group"?c.chat.group_list[a]=o:i==="private"?c.chat.private_list[a]=o:c.chat.ban_user_id[a]=o,e(c)};return l.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:l.jsxs("div",{children:[l.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"聊天黑白名单功能"}),l.jsxs("div",{className:"grid gap-4 md:gap-6",children:[l.jsxs("div",{className:"space-y-3 md:space-y-4",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ue,{className:"text-sm md:text-base",children:"群组名单类型"}),l.jsxs(qt,{value:t.chat.group_list_type,onValueChange:i=>e({...t,chat:{...t.chat,group_list_type:i}}),children:[l.jsx(It,{children:l.jsx(Ft,{})}),l.jsxs(Bt,{children:[l.jsx(De,{value:"whitelist",children:"白名单(仅名单内可聊天)"}),l.jsx(De,{value:"blacklist",children:"黑名单(名单内禁止聊天)"})]})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[l.jsx(ue,{className:"text-sm md:text-base",children:"群组列表"}),l.jsxs(de,{onClick:()=>n("group"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[l.jsx(lo,{className:"mr-1 h-4 w-4"}),"添加群号"]})]}),t.chat.group_list.map((i,a)=>l.jsxs("div",{className:"flex gap-2",children:[l.jsx(Pe,{type:"number",value:i,onChange:o=>s("group",a,parseInt(o.target.value)||0),placeholder:"输入群号",className:"text-sm md:text-base"}),l.jsxs(Nn,{children:[l.jsx(Qr,{asChild:!0,children:l.jsx(de,{size:"icon",variant:"outline",children:l.jsx(fn,{className:"h-4 w-4"})})}),l.jsxs(gn,{children:[l.jsxs(xn,{children:[l.jsx(yn,{children:"确认删除"}),l.jsxs(bn,{children:["确定要删除群号 ",i," 吗?此操作无法撤销。"]})]}),l.jsxs(vn,{children:[l.jsx(Sn,{children:"取消"}),l.jsx(wn,{onClick:()=>r("group",a),children:"删除"})]})]})]})]},a)),t.chat.group_list.length===0&&l.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无群组"})]})]}),l.jsxs("div",{className:"space-y-3 md:space-y-4",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ue,{className:"text-sm md:text-base",children:"私聊名单类型"}),l.jsxs(qt,{value:t.chat.private_list_type,onValueChange:i=>e({...t,chat:{...t.chat,private_list_type:i}}),children:[l.jsx(It,{children:l.jsx(Ft,{})}),l.jsxs(Bt,{children:[l.jsx(De,{value:"whitelist",children:"白名单(仅名单内可聊天)"}),l.jsx(De,{value:"blacklist",children:"黑名单(名单内禁止聊天)"})]})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[l.jsx(ue,{className:"text-sm md:text-base",children:"私聊列表"}),l.jsxs(de,{onClick:()=>n("private"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[l.jsx(lo,{className:"mr-1 h-4 w-4"}),"添加用户"]})]}),t.chat.private_list.map((i,a)=>l.jsxs("div",{className:"flex gap-2",children:[l.jsx(Pe,{type:"number",value:i,onChange:o=>s("private",a,parseInt(o.target.value)||0),placeholder:"输入QQ号",className:"text-sm md:text-base"}),l.jsxs(Nn,{children:[l.jsx(Qr,{asChild:!0,children:l.jsx(de,{size:"icon",variant:"outline",children:l.jsx(fn,{className:"h-4 w-4"})})}),l.jsxs(gn,{children:[l.jsxs(xn,{children:[l.jsx(yn,{children:"确认删除"}),l.jsxs(bn,{children:["确定要删除用户 ",i," 吗?此操作无法撤销。"]})]}),l.jsxs(vn,{children:[l.jsx(Sn,{children:"取消"}),l.jsx(wn,{onClick:()=>r("private",a),children:"删除"})]})]})]})]},a)),t.chat.private_list.length===0&&l.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无用户"})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[l.jsxs("div",{children:[l.jsx(ue,{className:"text-sm md:text-base",children:"全局禁止名单"}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"名单中的用户无法进行任何聊天"})]}),l.jsxs(de,{onClick:()=>n("ban"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[l.jsx(lo,{className:"mr-1 h-4 w-4"}),"添加用户"]})]}),t.chat.ban_user_id.map((i,a)=>l.jsxs("div",{className:"flex gap-2",children:[l.jsx(Pe,{type:"number",value:i,onChange:o=>s("ban",a,parseInt(o.target.value)||0),placeholder:"输入QQ号",className:"text-sm md:text-base"}),l.jsxs(Nn,{children:[l.jsx(Qr,{asChild:!0,children:l.jsx(de,{size:"icon",variant:"outline",children:l.jsx(fn,{className:"h-4 w-4"})})}),l.jsxs(gn,{children:[l.jsxs(xn,{children:[l.jsx(yn,{children:"确认删除"}),l.jsxs(bn,{children:["确定要从全局禁止名单中删除用户 ",i," 吗?此操作无法撤销。"]})]}),l.jsxs(vn,{children:[l.jsx(Sn,{children:"取消"}),l.jsx(wn,{onClick:()=>r("ban",a),children:"删除"})]})]})]})]},a)),t.chat.ban_user_id.length===0&&l.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无禁止用户"})]}),l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{children:[l.jsx(ue,{className:"text-sm md:text-base",children:"屏蔽QQ官方机器人"}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"是否屏蔽来自QQ官方机器人的消息"})]}),l.jsx(Pt,{checked:t.chat.ban_qq_bot,onCheckedChange:i=>e({...t,chat:{...t.chat,ban_qq_bot:i}})})]}),l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{children:[l.jsx(ue,{className:"text-sm md:text-base",children:"启用戳一戳功能"}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"是否响应戳一戳消息"})]}),l.jsx(Pt,{checked:t.chat.enable_poke,onCheckedChange:i=>e({...t,chat:{...t.chat,enable_poke:i}})})]})]})]})})}function i0e({config:t,onChange:e}){return l.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:l.jsxs("div",{children:[l.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"发送语音设置"}),l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{children:[l.jsx(ue,{className:"text-sm md:text-base",children:"使用 TTS 语音"}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"请确保已配置 TTS 并有对应的适配器"})]}),l.jsx(Pt,{checked:t.voice.use_tts,onCheckedChange:n=>e({...t,voice:{use_tts:n}})})]})]})})}function a0e({config:t,onChange:e}){return l.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:l.jsxs("div",{children:[l.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"调试设置"}),l.jsx("div",{className:"grid gap-3 md:gap-4",children:l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ue,{className:"text-sm md:text-base",children:"日志等级"}),l.jsxs(qt,{value:t.debug.level,onValueChange:n=>e({...t,debug:{level:n}}),children:[l.jsx(It,{children:l.jsx(Ft,{})}),l.jsxs(Bt,{children:[l.jsx(De,{value:"DEBUG",children:"DEBUG(调试)"}),l.jsx(De,{value:"INFO",children:"INFO(信息)"}),l.jsx(De,{value:"WARNING",children:"WARNING(警告)"}),l.jsx(De,{value:"ERROR",children:"ERROR(错误)"}),l.jsx(De,{value:"CRITICAL",children:"CRITICAL(严重)"})]})]}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"设置适配器的日志输出等级"})]})})]})})}function s_(t){const e=[],n=String(t||"");let r=n.indexOf(","),s=0,i=!1;for(;!i;){r===-1&&(r=n.length,i=!0);const a=n.slice(s,r).trim();(a||!i)&&e.push(a),s=r+1,r=n.indexOf(",",s)}return e}function l0e(t,e){const n={};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const o0e=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,c0e=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,u0e={};function i_(t,e){return(u0e.jsx?c0e:o0e).test(t)}const d0e=/[ \t\n\f\r]/g;function h0e(t){return typeof t=="object"?t.type==="text"?a_(t.value):!1:a_(t)}function a_(t){return t.replace(d0e,"")===""}class cp{constructor(e,n,r){this.normal=n,this.property=e,r&&(this.space=r)}}cp.prototype.normal={};cp.prototype.property={};cp.prototype.space=void 0;function $F(t,e){const n={},r={};for(const s of t)Object.assign(n,s.property),Object.assign(r,s.normal);return new cp(n,r,e)}function y0(t){return t.toLowerCase()}class hi{constructor(e,n){this.attribute=n,this.property=e}}hi.prototype.attribute="";hi.prototype.booleanish=!1;hi.prototype.boolean=!1;hi.prototype.commaOrSpaceSeparated=!1;hi.prototype.commaSeparated=!1;hi.prototype.defined=!1;hi.prototype.mustUseProperty=!1;hi.prototype.number=!1;hi.prototype.overloadedBoolean=!1;hi.prototype.property="";hi.prototype.spaceSeparated=!1;hi.prototype.space=void 0;let f0e=0;const Ut=Hu(),Br=Hu(),ek=Hu(),Qe=Hu(),Zn=Hu(),ch=Hu(),Oi=Hu();function Hu(){return 2**++f0e}const tk=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ut,booleanish:Br,commaOrSpaceSeparated:Oi,commaSeparated:ch,number:Qe,overloadedBoolean:ek,spaceSeparated:Zn},Symbol.toStringTag,{value:"Module"})),a4=Object.keys(tk);class Nj extends hi{constructor(e,n,r,s){let i=-1;if(super(e,n),l_(this,"space",s),typeof r=="number")for(;++i4&&n.slice(0,4)==="data"&&v0e.test(e)){if(e.charAt(4)==="-"){const i=e.slice(5).replace(o_,b0e);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=e.slice(4);if(!o_.test(i)){let a=i.replace(x0e,y0e);a.charAt(0)!=="-"&&(a="-"+a),e="data"+a}}s=Nj}return new s(r,e)}function y0e(t){return"-"+t.toLowerCase()}function b0e(t){return t.charAt(1).toUpperCase()}const YF=$F([QF,m0e,UF,WF,GF],"html"),by=$F([QF,p0e,UF,WF,GF],"svg");function c_(t){const e=String(t||"").trim();return e?e.split(/[ \t\n\r\f]+/g):[]}function w0e(t){return t.join(" ").trim()}var Ed={},l4,u_;function S0e(){if(u_)return l4;u_=1;var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,e=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,i=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,a=/^[;\s]*/,o=/^\s+|\s+$/g,c=` +`,h="/",f="*",m="",g="comment",x="declaration";function y(S,k){if(typeof S!="string")throw new TypeError("First argument must be a string");if(!S)return[];k=k||{};var N=1,C=1;function T(z){var H=z.match(e);H&&(N+=H.length);var B=z.lastIndexOf(c);C=~B?z.length-B:C+z.length}function _(){var z={line:N,column:C};return function(H){return H.position=new E(z),P(),H}}function E(z){this.start=z,this.end={line:N,column:C},this.source=k.source}E.prototype.content=S;function M(z){var H=new Error(k.source+":"+N+":"+C+": "+z);if(H.reason=z,H.filename=k.source,H.line=N,H.column=C,H.source=S,!k.silent)throw H}function L(z){var H=z.exec(S);if(H){var B=H[0];return T(B),S=S.slice(B.length),H}}function P(){L(n)}function I(z){var H;for(z=z||[];H=Q();)H!==!1&&z.push(H);return z}function Q(){var z=_();if(!(h!=S.charAt(0)||f!=S.charAt(1))){for(var H=2;m!=S.charAt(H)&&(f!=S.charAt(H)||h!=S.charAt(H+1));)++H;if(H+=2,m===S.charAt(H-1))return M("End of comment missing");var B=S.slice(2,H-2);return C+=2,T(B),S=S.slice(H),C+=2,z({type:g,comment:B})}}function U(){var z=_(),H=L(r);if(H){if(Q(),!L(s))return M("property missing ':'");var B=L(i),X=z({type:x,property:w(H[0].replace(t,m)),value:B?w(B[0].replace(t,m)):m});return L(a),X}}function ee(){var z=[];I(z);for(var H;H=U();)H!==!1&&(z.push(H),I(z));return z}return P(),ee()}function w(S){return S?S.replace(o,m):m}return l4=y,l4}var d_;function k0e(){if(d_)return Ed;d_=1;var t=Ed&&Ed.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Ed,"__esModule",{value:!0}),Ed.default=n;const e=t(S0e());function n(r,s){let i=null;if(!r||typeof r!="string")return i;const a=(0,e.default)(r),o=typeof s=="function";return a.forEach(c=>{if(c.type!=="declaration")return;const{property:h,value:f}=c;o?s(h,f,c):f&&(i=i||{},i[h]=f)}),i}return Ed}var sm={},h_;function j0e(){if(h_)return sm;h_=1,Object.defineProperty(sm,"__esModule",{value:!0}),sm.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,e=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,s=/^-(ms)-/,i=function(h){return!h||n.test(h)||t.test(h)},a=function(h,f){return f.toUpperCase()},o=function(h,f){return"".concat(f,"-")},c=function(h,f){return f===void 0&&(f={}),i(h)?h:(h=h.toLowerCase(),f.reactCompat?h=h.replace(s,o):h=h.replace(r,o),h.replace(e,a))};return sm.camelCase=c,sm}var im,f_;function O0e(){if(f_)return im;f_=1;var t=im&&im.__importDefault||function(s){return s&&s.__esModule?s:{default:s}},e=t(k0e()),n=j0e();function r(s,i){var a={};return!s||typeof s!="string"||(0,e.default)(s,function(o,c){o&&c&&(a[(0,n.camelCase)(o,i)]=c)}),a}return r.default=r,im=r,im}var N0e=O0e();const C0e=Fk(N0e),KF=ZF("end"),Cj=ZF("start");function ZF(t){return e;function e(n){const r=n&&n.position&&n.position[t]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function T0e(t){const e=Cj(t),n=KF(t);if(e&&n)return{start:e,end:n}}function Lm(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?m_(t.position):"start"in t||"end"in t?m_(t):"line"in t||"column"in t?nk(t):""}function nk(t){return p_(t&&t.line)+":"+p_(t&&t.column)}function m_(t){return nk(t&&t.start)+"-"+nk(t&&t.end)}function p_(t){return t&&typeof t=="number"?t:1}class _s extends Error{constructor(e,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let s="",i={},a=!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 e=="string"?s=e:!i.cause&&e&&(a=!0,s=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof r=="string"){const c=r.indexOf(":");c===-1?i.ruleId=r:(i.source=r.slice(0,c),i.ruleId=r.slice(c+1))}if(!i.place&&i.ancestors&&i.ancestors){const c=i.ancestors[i.ancestors.length-1];c&&(i.place=c.position)}const o=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=o?o.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=o?o.line:void 0,this.name=Lm(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=a&&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}}_s.prototype.file="";_s.prototype.name="";_s.prototype.reason="";_s.prototype.message="";_s.prototype.stack="";_s.prototype.column=void 0;_s.prototype.line=void 0;_s.prototype.ancestors=void 0;_s.prototype.cause=void 0;_s.prototype.fatal=void 0;_s.prototype.place=void 0;_s.prototype.ruleId=void 0;_s.prototype.source=void 0;const Tj={}.hasOwnProperty,E0e=new Map,_0e=/[A-Z]/g,M0e=new Set(["table","tbody","thead","tfoot","tr"]),A0e=new Set(["td","th"]),JF="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function R0e(t,e){if(!e||e.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=e.filePath||void 0;let r;if(e.development){if(typeof e.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=F0e(n,e.jsxDEV)}else{if(typeof e.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof e.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=q0e(n,e.jsx,e.jsxs)}const s={Fragment:e.Fragment,ancestors:[],components:e.components||{},create:r,elementAttributeNameCase:e.elementAttributeNameCase||"react",evaluater:e.createEvaluater?e.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:e.ignoreInvalidStyle||!1,passKeys:e.passKeys!==!1,passNode:e.passNode||!1,schema:e.space==="svg"?by:YF,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},i=e$(s,t,void 0);return i&&typeof i!="string"?i:s.create(t,s.Fragment,{children:i||void 0},void 0)}function e$(t,e,n){if(e.type==="element")return D0e(t,e,n);if(e.type==="mdxFlowExpression"||e.type==="mdxTextExpression")return z0e(t,e);if(e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement")return L0e(t,e,n);if(e.type==="mdxjsEsm")return P0e(t,e);if(e.type==="root")return I0e(t,e,n);if(e.type==="text")return B0e(t,e)}function D0e(t,e,n){const r=t.schema;let s=r;e.tagName.toLowerCase()==="svg"&&r.space==="html"&&(s=by,t.schema=s),t.ancestors.push(e);const i=n$(t,e.tagName,!1),a=$0e(t,e);let o=_j(t,e);return M0e.has(e.tagName)&&(o=o.filter(function(c){return typeof c=="string"?!h0e(c):!0})),t$(t,a,i,e),Ej(a,o),t.ancestors.pop(),t.schema=r,t.create(e,i,a,n)}function z0e(t,e){if(e.data&&e.data.estree&&t.evaluater){const r=e.data.estree.body[0];return r.type,t.evaluater.evaluateExpression(r.expression)}b0(t,e.position)}function P0e(t,e){if(e.data&&e.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(e.data.estree);b0(t,e.position)}function L0e(t,e,n){const r=t.schema;let s=r;e.name==="svg"&&r.space==="html"&&(s=by,t.schema=s),t.ancestors.push(e);const i=e.name===null?t.Fragment:n$(t,e.name,!0),a=Q0e(t,e),o=_j(t,e);return t$(t,a,i,e),Ej(a,o),t.ancestors.pop(),t.schema=r,t.create(e,i,a,n)}function I0e(t,e,n){const r={};return Ej(r,_j(t,e)),t.create(e,t.Fragment,r,n)}function B0e(t,e){return e.value}function t$(t,e,n,r){typeof n!="string"&&n!==t.Fragment&&t.passNode&&(e.node=r)}function Ej(t,e){if(e.length>0){const n=e.length>1?e:e[0];n&&(t.children=n)}}function q0e(t,e,n){return r;function r(s,i,a,o){const h=Array.isArray(a.children)?n:e;return o?h(i,a,o):h(i,a)}}function F0e(t,e){return n;function n(r,s,i,a){const o=Array.isArray(i.children),c=Cj(r);return e(s,i,a,o,{columnNumber:c?c.column-1:void 0,fileName:t,lineNumber:c?c.line:void 0},void 0)}}function $0e(t,e){const n={};let r,s;for(s in e.properties)if(s!=="children"&&Tj.call(e.properties,s)){const i=H0e(t,s,e.properties[s]);if(i){const[a,o]=i;t.tableCellAlignToStyle&&a==="align"&&typeof o=="string"&&A0e.has(e.tagName)?r=o:n[a]=o}}if(r){const i=n.style||(n.style={});i[t.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function Q0e(t,e){const n={};for(const r of e.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&t.evaluater){const i=r.data.estree.body[0];i.type;const a=i.expression;a.type;const o=a.properties[0];o.type,Object.assign(n,t.evaluater.evaluateExpression(o.argument))}else b0(t,e.position);else{const s=r.name;let i;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&t.evaluater){const o=r.value.data.estree.body[0];o.type,i=t.evaluater.evaluateExpression(o.expression)}else b0(t,e.position);else i=r.value===null?!0:r.value;n[s]=i}return n}function _j(t,e){const n=[];let r=-1;const s=t.passKeys?new Map:E0e;for(;++rs?0:s+e:e=e>s?s:e,n=n>0?n:0,r.length<1e4)a=Array.from(r),a.unshift(e,n),t.splice(...a);else for(n&&t.splice(e,n);i0?(Ai(t,t.length,0,e),t):e}const v_={}.hasOwnProperty;function s$(t){const e={};let n=-1;for(;++n13&&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 Ta(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const zs=zc(/[A-Za-z]/),Ts=zc(/[\dA-Za-z]/),J0e=zc(/[#-'*+\--9=?A-Z^-~]/);function av(t){return t!==null&&(t<32||t===127)}const rk=zc(/\d/),epe=zc(/[\dA-Fa-f]/),tpe=zc(/[!-/:-@[-`{-~]/);function ht(t){return t!==null&&t<-2}function Yn(t){return t!==null&&(t<0||t===32)}function nn(t){return t===-2||t===-1||t===32}const wy=zc(new RegExp("\\p{P}|\\p{S}","u")),Iu=zc(/\s/);function zc(t){return e;function e(n){return n!==null&&n>-1&&t.test(String.fromCharCode(n))}}function Zh(t){const e=[];let n=-1,r=0,s=0;for(;++n55295&&i<57344){const o=t.charCodeAt(n+1);i<56320&&o>56319&&o<57344?(a=String.fromCharCode(i,o),s=1):a="�"}else a=String.fromCharCode(i);a&&(e.push(t.slice(r,n),encodeURIComponent(a)),r=n+s+1,a=""),s&&(n+=s,s=0)}return e.join("")+t.slice(r)}function Zt(t,e,n,r){const s=r?r-1:Number.POSITIVE_INFINITY;let i=0;return a;function a(c){return nn(c)?(t.enter(n),o(c)):e(c)}function o(c){return nn(c)&&i++a))return;const M=e.events.length;let L=M,P,I;for(;L--;)if(e.events[L][0]==="exit"&&e.events[L][1].type==="chunkFlow"){if(P){I=e.events[L][1].end;break}P=!0}for(k(r),E=M;EC;){const _=n[T];e.containerState=_[1],_[0].exit.call(e,t)}n.length=C}function N(){s.write([null]),i=void 0,s=void 0,e.containerState._closeFlow=void 0}}function ape(t,e,n){return Zt(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Ch(t){if(t===null||Yn(t)||Iu(t))return 1;if(wy(t))return 2}function Sy(t,e,n){const r=[];let s=-1;for(;++s1&&t[n][1].end.offset-t[n][1].start.offset>1?2:1;const m={...t[r][1].end},g={...t[n][1].start};b_(m,-c),b_(g,c),a={type:c>1?"strongSequence":"emphasisSequence",start:m,end:{...t[r][1].end}},o={type:c>1?"strongSequence":"emphasisSequence",start:{...t[n][1].start},end:g},i={type:c>1?"strongText":"emphasisText",start:{...t[r][1].end},end:{...t[n][1].start}},s={type:c>1?"strong":"emphasis",start:{...a.start},end:{...o.end}},t[r][1].end={...a.start},t[n][1].start={...o.end},h=[],t[r][1].end.offset-t[r][1].start.offset&&(h=Yi(h,[["enter",t[r][1],e],["exit",t[r][1],e]])),h=Yi(h,[["enter",s,e],["enter",a,e],["exit",a,e],["enter",i,e]]),h=Yi(h,Sy(e.parser.constructs.insideSpan.null,t.slice(r+1,n),e)),h=Yi(h,[["exit",i,e],["enter",o,e],["exit",o,e],["exit",s,e]]),t[n][1].end.offset-t[n][1].start.offset?(f=2,h=Yi(h,[["enter",t[n][1],e],["exit",t[n][1],e]])):f=0,Ai(t,r-1,n-r+3,h),n=r+h.length-f-2;break}}for(n=-1;++n0&&nn(E)?Zt(t,N,"linePrefix",i+1)(E):N(E)}function N(E){return E===null||ht(E)?t.check(w_,w,T)(E):(t.enter("codeFlowValue"),C(E))}function C(E){return E===null||ht(E)?(t.exit("codeFlowValue"),N(E)):(t.consume(E),C)}function T(E){return t.exit("codeFenced"),e(E)}function _(E,M,L){let P=0;return I;function I(H){return E.enter("lineEnding"),E.consume(H),E.exit("lineEnding"),Q}function Q(H){return E.enter("codeFencedFence"),nn(H)?Zt(E,U,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(H):U(H)}function U(H){return H===o?(E.enter("codeFencedFenceSequence"),ee(H)):L(H)}function ee(H){return H===o?(P++,E.consume(H),ee):P>=a?(E.exit("codeFencedFenceSequence"),nn(H)?Zt(E,z,"whitespace")(H):z(H)):L(H)}function z(H){return H===null||ht(H)?(E.exit("codeFencedFence"),M(H)):L(H)}}}function vpe(t,e,n){const r=this;return s;function s(a){return a===null?n(a):(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),i)}function i(a){return r.parser.lazy[r.now().line]?n(a):e(a)}}const c4={name:"codeIndented",tokenize:bpe},ype={partial:!0,tokenize:wpe};function bpe(t,e,n){const r=this;return s;function s(h){return t.enter("codeIndented"),Zt(t,i,"linePrefix",5)(h)}function i(h){const f=r.events[r.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?a(h):n(h)}function a(h){return h===null?c(h):ht(h)?t.attempt(ype,a,c)(h):(t.enter("codeFlowValue"),o(h))}function o(h){return h===null||ht(h)?(t.exit("codeFlowValue"),a(h)):(t.consume(h),o)}function c(h){return t.exit("codeIndented"),e(h)}}function wpe(t,e,n){const r=this;return s;function s(a){return r.parser.lazy[r.now().line]?n(a):ht(a)?(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),s):Zt(t,i,"linePrefix",5)(a)}function i(a){const o=r.events[r.events.length-1];return o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?e(a):ht(a)?s(a):n(a)}}const Spe={name:"codeText",previous:jpe,resolve:kpe,tokenize:Ope};function kpe(t){let e=t.length-4,n=3,r,s;if((t[n][1].type==="lineEnding"||t[n][1].type==="space")&&(t[e][1].type==="lineEnding"||t[e][1].type==="space")){for(r=n;++r=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return ethis.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(e,n,r){const s=n||0;this.setCursor(Math.trunc(e));const i=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return r&&am(this.left,r),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),am(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),am(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e=4?e(a):t.interrupt(r.parser.constructs.flow,n,e)(a)}}function u$(t,e,n,r,s,i,a,o,c){const h=c||Number.POSITIVE_INFINITY;let f=0;return m;function m(k){return k===60?(t.enter(r),t.enter(s),t.enter(i),t.consume(k),t.exit(i),g):k===null||k===32||k===41||av(k)?n(k):(t.enter(r),t.enter(a),t.enter(o),t.enter("chunkString",{contentType:"string"}),w(k))}function g(k){return k===62?(t.enter(i),t.consume(k),t.exit(i),t.exit(s),t.exit(r),e):(t.enter(o),t.enter("chunkString",{contentType:"string"}),x(k))}function x(k){return k===62?(t.exit("chunkString"),t.exit(o),g(k)):k===null||k===60||ht(k)?n(k):(t.consume(k),k===92?y:x)}function y(k){return k===60||k===62||k===92?(t.consume(k),x):x(k)}function w(k){return!f&&(k===null||k===41||Yn(k))?(t.exit("chunkString"),t.exit(o),t.exit(a),t.exit(r),e(k)):f999||x===null||x===91||x===93&&!c||x===94&&!o&&"_hiddenFootnoteSupport"in a.parser.constructs?n(x):x===93?(t.exit(i),t.enter(s),t.consume(x),t.exit(s),t.exit(r),e):ht(x)?(t.enter("lineEnding"),t.consume(x),t.exit("lineEnding"),f):(t.enter("chunkString",{contentType:"string"}),m(x))}function m(x){return x===null||x===91||x===93||ht(x)||o++>999?(t.exit("chunkString"),f(x)):(t.consume(x),c||(c=!nn(x)),x===92?g:m)}function g(x){return x===91||x===92||x===93?(t.consume(x),o++,m):m(x)}}function h$(t,e,n,r,s,i){let a;return o;function o(g){return g===34||g===39||g===40?(t.enter(r),t.enter(s),t.consume(g),t.exit(s),a=g===40?41:g,c):n(g)}function c(g){return g===a?(t.enter(s),t.consume(g),t.exit(s),t.exit(r),e):(t.enter(i),h(g))}function h(g){return g===a?(t.exit(i),c(a)):g===null?n(g):ht(g)?(t.enter("lineEnding"),t.consume(g),t.exit("lineEnding"),Zt(t,h,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),f(g))}function f(g){return g===a||g===null||ht(g)?(t.exit("chunkString"),h(g)):(t.consume(g),g===92?m:f)}function m(g){return g===a||g===92?(t.consume(g),f):f(g)}}function Im(t,e){let n;return r;function r(s){return ht(s)?(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),n=!0,r):nn(s)?Zt(t,r,n?"linePrefix":"lineSuffix")(s):e(s)}}const Rpe={name:"definition",tokenize:zpe},Dpe={partial:!0,tokenize:Ppe};function zpe(t,e,n){const r=this;let s;return i;function i(x){return t.enter("definition"),a(x)}function a(x){return d$.call(r,t,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(x)}function o(x){return s=Ta(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),x===58?(t.enter("definitionMarker"),t.consume(x),t.exit("definitionMarker"),c):n(x)}function c(x){return Yn(x)?Im(t,h)(x):h(x)}function h(x){return u$(t,f,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(x)}function f(x){return t.attempt(Dpe,m,m)(x)}function m(x){return nn(x)?Zt(t,g,"whitespace")(x):g(x)}function g(x){return x===null||ht(x)?(t.exit("definition"),r.parser.defined.push(s),e(x)):n(x)}}function Ppe(t,e,n){return r;function r(o){return Yn(o)?Im(t,s)(o):n(o)}function s(o){return h$(t,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function i(o){return nn(o)?Zt(t,a,"whitespace")(o):a(o)}function a(o){return o===null||ht(o)?e(o):n(o)}}const Lpe={name:"hardBreakEscape",tokenize:Ipe};function Ipe(t,e,n){return r;function r(i){return t.enter("hardBreakEscape"),t.consume(i),s}function s(i){return ht(i)?(t.exit("hardBreakEscape"),e(i)):n(i)}}const Bpe={name:"headingAtx",resolve:qpe,tokenize:Fpe};function qpe(t,e){let n=t.length-2,r=3,s,i;return t[r][1].type==="whitespace"&&(r+=2),n-2>r&&t[n][1].type==="whitespace"&&(n-=2),t[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&t[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(s={type:"atxHeadingText",start:t[r][1].start,end:t[n][1].end},i={type:"chunkText",start:t[r][1].start,end:t[n][1].end,contentType:"text"},Ai(t,r,n-r+1,[["enter",s,e],["enter",i,e],["exit",i,e],["exit",s,e]])),t}function Fpe(t,e,n){let r=0;return s;function s(f){return t.enter("atxHeading"),i(f)}function i(f){return t.enter("atxHeadingSequence"),a(f)}function a(f){return f===35&&r++<6?(t.consume(f),a):f===null||Yn(f)?(t.exit("atxHeadingSequence"),o(f)):n(f)}function o(f){return f===35?(t.enter("atxHeadingSequence"),c(f)):f===null||ht(f)?(t.exit("atxHeading"),e(f)):nn(f)?Zt(t,o,"whitespace")(f):(t.enter("atxHeadingText"),h(f))}function c(f){return f===35?(t.consume(f),c):(t.exit("atxHeadingSequence"),o(f))}function h(f){return f===null||f===35||Yn(f)?(t.exit("atxHeadingText"),o(f)):(t.consume(f),h)}}const $pe=["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"],k_=["pre","script","style","textarea"],Qpe={concrete:!0,name:"htmlFlow",resolveTo:Upe,tokenize:Wpe},Hpe={partial:!0,tokenize:Xpe},Vpe={partial:!0,tokenize:Gpe};function Upe(t){let e=t.length;for(;e--&&!(t[e][0]==="enter"&&t[e][1].type==="htmlFlow"););return e>1&&t[e-2][1].type==="linePrefix"&&(t[e][1].start=t[e-2][1].start,t[e+1][1].start=t[e-2][1].start,t.splice(e-2,2)),t}function Wpe(t,e,n){const r=this;let s,i,a,o,c;return h;function h(F){return f(F)}function f(F){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(F),m}function m(F){return F===33?(t.consume(F),g):F===47?(t.consume(F),i=!0,w):F===63?(t.consume(F),s=3,r.interrupt?e:R):zs(F)?(t.consume(F),a=String.fromCharCode(F),S):n(F)}function g(F){return F===45?(t.consume(F),s=2,x):F===91?(t.consume(F),s=5,o=0,y):zs(F)?(t.consume(F),s=4,r.interrupt?e:R):n(F)}function x(F){return F===45?(t.consume(F),r.interrupt?e:R):n(F)}function y(F){const V="CDATA[";return F===V.charCodeAt(o++)?(t.consume(F),o===V.length?r.interrupt?e:U:y):n(F)}function w(F){return zs(F)?(t.consume(F),a=String.fromCharCode(F),S):n(F)}function S(F){if(F===null||F===47||F===62||Yn(F)){const V=F===47,te=a.toLowerCase();return!V&&!i&&k_.includes(te)?(s=1,r.interrupt?e(F):U(F)):$pe.includes(a.toLowerCase())?(s=6,V?(t.consume(F),k):r.interrupt?e(F):U(F)):(s=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(F):i?N(F):C(F))}return F===45||Ts(F)?(t.consume(F),a+=String.fromCharCode(F),S):n(F)}function k(F){return F===62?(t.consume(F),r.interrupt?e:U):n(F)}function N(F){return nn(F)?(t.consume(F),N):I(F)}function C(F){return F===47?(t.consume(F),I):F===58||F===95||zs(F)?(t.consume(F),T):nn(F)?(t.consume(F),C):I(F)}function T(F){return F===45||F===46||F===58||F===95||Ts(F)?(t.consume(F),T):_(F)}function _(F){return F===61?(t.consume(F),E):nn(F)?(t.consume(F),_):C(F)}function E(F){return F===null||F===60||F===61||F===62||F===96?n(F):F===34||F===39?(t.consume(F),c=F,M):nn(F)?(t.consume(F),E):L(F)}function M(F){return F===c?(t.consume(F),c=null,P):F===null||ht(F)?n(F):(t.consume(F),M)}function L(F){return F===null||F===34||F===39||F===47||F===60||F===61||F===62||F===96||Yn(F)?_(F):(t.consume(F),L)}function P(F){return F===47||F===62||nn(F)?C(F):n(F)}function I(F){return F===62?(t.consume(F),Q):n(F)}function Q(F){return F===null||ht(F)?U(F):nn(F)?(t.consume(F),Q):n(F)}function U(F){return F===45&&s===2?(t.consume(F),B):F===60&&s===1?(t.consume(F),X):F===62&&s===4?(t.consume(F),se):F===63&&s===3?(t.consume(F),R):F===93&&s===5?(t.consume(F),G):ht(F)&&(s===6||s===7)?(t.exit("htmlFlowData"),t.check(Hpe,W,ee)(F)):F===null||ht(F)?(t.exit("htmlFlowData"),ee(F)):(t.consume(F),U)}function ee(F){return t.check(Vpe,z,W)(F)}function z(F){return t.enter("lineEnding"),t.consume(F),t.exit("lineEnding"),H}function H(F){return F===null||ht(F)?ee(F):(t.enter("htmlFlowData"),U(F))}function B(F){return F===45?(t.consume(F),R):U(F)}function X(F){return F===47?(t.consume(F),a="",J):U(F)}function J(F){if(F===62){const V=a.toLowerCase();return k_.includes(V)?(t.consume(F),se):U(F)}return zs(F)&&a.length<8?(t.consume(F),a+=String.fromCharCode(F),J):U(F)}function G(F){return F===93?(t.consume(F),R):U(F)}function R(F){return F===62?(t.consume(F),se):F===45&&s===2?(t.consume(F),R):U(F)}function se(F){return F===null||ht(F)?(t.exit("htmlFlowData"),W(F)):(t.consume(F),se)}function W(F){return t.exit("htmlFlow"),e(F)}}function Gpe(t,e,n){const r=this;return s;function s(a){return ht(a)?(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),i):n(a)}function i(a){return r.parser.lazy[r.now().line]?n(a):e(a)}}function Xpe(t,e,n){return r;function r(s){return t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),t.attempt(up,e,n)}}const Ype={name:"htmlText",tokenize:Kpe};function Kpe(t,e,n){const r=this;let s,i,a;return o;function o(R){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(R),c}function c(R){return R===33?(t.consume(R),h):R===47?(t.consume(R),_):R===63?(t.consume(R),C):zs(R)?(t.consume(R),L):n(R)}function h(R){return R===45?(t.consume(R),f):R===91?(t.consume(R),i=0,y):zs(R)?(t.consume(R),N):n(R)}function f(R){return R===45?(t.consume(R),x):n(R)}function m(R){return R===null?n(R):R===45?(t.consume(R),g):ht(R)?(a=m,X(R)):(t.consume(R),m)}function g(R){return R===45?(t.consume(R),x):m(R)}function x(R){return R===62?B(R):R===45?g(R):m(R)}function y(R){const se="CDATA[";return R===se.charCodeAt(i++)?(t.consume(R),i===se.length?w:y):n(R)}function w(R){return R===null?n(R):R===93?(t.consume(R),S):ht(R)?(a=w,X(R)):(t.consume(R),w)}function S(R){return R===93?(t.consume(R),k):w(R)}function k(R){return R===62?B(R):R===93?(t.consume(R),k):w(R)}function N(R){return R===null||R===62?B(R):ht(R)?(a=N,X(R)):(t.consume(R),N)}function C(R){return R===null?n(R):R===63?(t.consume(R),T):ht(R)?(a=C,X(R)):(t.consume(R),C)}function T(R){return R===62?B(R):C(R)}function _(R){return zs(R)?(t.consume(R),E):n(R)}function E(R){return R===45||Ts(R)?(t.consume(R),E):M(R)}function M(R){return ht(R)?(a=M,X(R)):nn(R)?(t.consume(R),M):B(R)}function L(R){return R===45||Ts(R)?(t.consume(R),L):R===47||R===62||Yn(R)?P(R):n(R)}function P(R){return R===47?(t.consume(R),B):R===58||R===95||zs(R)?(t.consume(R),I):ht(R)?(a=P,X(R)):nn(R)?(t.consume(R),P):B(R)}function I(R){return R===45||R===46||R===58||R===95||Ts(R)?(t.consume(R),I):Q(R)}function Q(R){return R===61?(t.consume(R),U):ht(R)?(a=Q,X(R)):nn(R)?(t.consume(R),Q):P(R)}function U(R){return R===null||R===60||R===61||R===62||R===96?n(R):R===34||R===39?(t.consume(R),s=R,ee):ht(R)?(a=U,X(R)):nn(R)?(t.consume(R),U):(t.consume(R),z)}function ee(R){return R===s?(t.consume(R),s=void 0,H):R===null?n(R):ht(R)?(a=ee,X(R)):(t.consume(R),ee)}function z(R){return R===null||R===34||R===39||R===60||R===61||R===96?n(R):R===47||R===62||Yn(R)?P(R):(t.consume(R),z)}function H(R){return R===47||R===62||Yn(R)?P(R):n(R)}function B(R){return R===62?(t.consume(R),t.exit("htmlTextData"),t.exit("htmlText"),e):n(R)}function X(R){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(R),t.exit("lineEnding"),J}function J(R){return nn(R)?Zt(t,G,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):G(R)}function G(R){return t.enter("htmlTextData"),a(R)}}const Rj={name:"labelEnd",resolveAll:tge,resolveTo:nge,tokenize:rge},Zpe={tokenize:sge},Jpe={tokenize:ige},ege={tokenize:age};function tge(t){let e=-1;const n=[];for(;++e=3&&(h===null||ht(h))?(t.exit("thematicBreak"),e(h)):n(h)}function c(h){return h===s?(t.consume(h),r++,c):(t.exit("thematicBreakSequence"),nn(h)?Zt(t,o,"whitespace")(h):o(h))}}const Ks={continuation:{tokenize:gge},exit:vge,name:"list",tokenize:pge},fge={partial:!0,tokenize:yge},mge={partial:!0,tokenize:xge};function pge(t,e,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,a=0;return o;function o(x){const y=r.containerState.type||(x===42||x===43||x===45?"listUnordered":"listOrdered");if(y==="listUnordered"?!r.containerState.marker||x===r.containerState.marker:rk(x)){if(r.containerState.type||(r.containerState.type=y,t.enter(y,{_container:!0})),y==="listUnordered")return t.enter("listItemPrefix"),x===42||x===45?t.check(x1,n,h)(x):h(x);if(!r.interrupt||x===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),c(x)}return n(x)}function c(x){return rk(x)&&++a<10?(t.consume(x),c):(!r.interrupt||a<2)&&(r.containerState.marker?x===r.containerState.marker:x===41||x===46)?(t.exit("listItemValue"),h(x)):n(x)}function h(x){return t.enter("listItemMarker"),t.consume(x),t.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||x,t.check(up,r.interrupt?n:f,t.attempt(fge,g,m))}function f(x){return r.containerState.initialBlankLine=!0,i++,g(x)}function m(x){return nn(x)?(t.enter("listItemPrefixWhitespace"),t.consume(x),t.exit("listItemPrefixWhitespace"),g):n(x)}function g(x){return r.containerState.size=i+r.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(x)}}function gge(t,e,n){const r=this;return r.containerState._closeFlow=void 0,t.check(up,s,i);function s(o){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Zt(t,e,"listItemIndent",r.containerState.size+1)(o)}function i(o){return r.containerState.furtherBlankLines||!nn(o)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,a(o)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,t.attempt(mge,e,a)(o))}function a(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,Zt(t,t.attempt(Ks,e,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function xge(t,e,n){const r=this;return Zt(t,s,"listItemIndent",r.containerState.size+1);function s(i){const a=r.events[r.events.length-1];return a&&a[1].type==="listItemIndent"&&a[2].sliceSerialize(a[1],!0).length===r.containerState.size?e(i):n(i)}}function vge(t){t.exit(this.containerState.type)}function yge(t,e,n){const r=this;return Zt(t,s,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(i){const a=r.events[r.events.length-1];return!nn(i)&&a&&a[1].type==="listItemPrefixWhitespace"?e(i):n(i)}}const j_={name:"setextUnderline",resolveTo:bge,tokenize:wge};function bge(t,e){let n=t.length,r,s,i;for(;n--;)if(t[n][0]==="enter"){if(t[n][1].type==="content"){r=n;break}t[n][1].type==="paragraph"&&(s=n)}else t[n][1].type==="content"&&t.splice(n,1),!i&&t[n][1].type==="definition"&&(i=n);const a={type:"setextHeading",start:{...t[r][1].start},end:{...t[t.length-1][1].end}};return t[s][1].type="setextHeadingText",i?(t.splice(s,0,["enter",a,e]),t.splice(i+1,0,["exit",t[r][1],e]),t[r][1].end={...t[i][1].end}):t[r][1]=a,t.push(["exit",a,e]),t}function wge(t,e,n){const r=this;let s;return i;function i(h){let f=r.events.length,m;for(;f--;)if(r.events[f][1].type!=="lineEnding"&&r.events[f][1].type!=="linePrefix"&&r.events[f][1].type!=="content"){m=r.events[f][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||m)?(t.enter("setextHeadingLine"),s=h,a(h)):n(h)}function a(h){return t.enter("setextHeadingLineSequence"),o(h)}function o(h){return h===s?(t.consume(h),o):(t.exit("setextHeadingLineSequence"),nn(h)?Zt(t,c,"lineSuffix")(h):c(h))}function c(h){return h===null||ht(h)?(t.exit("setextHeadingLine"),e(h)):n(h)}}const Sge={tokenize:kge};function kge(t){const e=this,n=t.attempt(up,r,t.attempt(this.parser.constructs.flowInitial,s,Zt(t,t.attempt(this.parser.constructs.flow,s,t.attempt(Tpe,s)),"linePrefix")));return n;function r(i){if(i===null){t.consume(i);return}return t.enter("lineEndingBlank"),t.consume(i),t.exit("lineEndingBlank"),e.currentConstruct=void 0,n}function s(i){if(i===null){t.consume(i);return}return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),e.currentConstruct=void 0,n}}const jge={resolveAll:m$()},Oge=f$("string"),Nge=f$("text");function f$(t){return{resolveAll:m$(t==="text"?Cge:void 0),tokenize:e};function e(n){const r=this,s=this.parser.constructs[t],i=n.attempt(s,a,o);return a;function a(f){return h(f)?i(f):o(f)}function o(f){if(f===null){n.consume(f);return}return n.enter("data"),n.consume(f),c}function c(f){return h(f)?(n.exit("data"),i(f)):(n.consume(f),c)}function h(f){if(f===null)return!0;const m=s[f];let g=-1;if(m)for(;++g-1){const o=a[0];typeof o=="string"?a[0]=o.slice(r):a.shift()}i>0&&a.push(t[s].slice(0,i))}return a}function qge(t,e){let n=-1;const r=[];let s;for(;++n0){const jt=qe.tokenStack[qe.tokenStack.length-1];(jt[1]||k_).call(qe,void 0,jt[0])}for(Re.position={start:Jo(Te.length>0?Te[0][1].start:{line:1,column:1,offset:0}),end:Jo(Te.length>0?Te[Te.length-2][1].end:{line:1,column:1,offset:0})},wt=-1;++wt1?"-"+o:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(a)}]};t.patch(e,c);const h={type:"element",tagName:"sup",properties:{},children:[c]};return t.patch(e,h),t.applyData(e,h)}function Zge(t,e){const n={type:"element",tagName:"h"+e.depth,properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function Jge(t,e){if(t.options.allowDangerousHtml){const n={type:"raw",value:e.value};return t.patch(e,n),t.applyData(e,n)}}function p$(t,e){const n=e.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(e.label||e.identifier)+"]"),e.type==="imageReference")return[{type:"text",value:"!["+e.alt+r}];const s=t.all(e),i=s[0];i&&i.type==="text"?i.value="["+i.value:s.unshift({type:"text",value:"["});const a=s[s.length-1];return a&&a.type==="text"?a.value+=r:s.push({type:"text",value:r}),s}function exe(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return p$(t,e);const s={src:Zh(r.url||""),alt:e.alt};r.title!==null&&r.title!==void 0&&(s.title=r.title);const i={type:"element",tagName:"img",properties:s,children:[]};return t.patch(e,i),t.applyData(e,i)}function txe(t,e){const n={src:Zh(e.url)};e.alt!==null&&e.alt!==void 0&&(n.alt=e.alt),e.title!==null&&e.title!==void 0&&(n.title=e.title);const r={type:"element",tagName:"img",properties:n,children:[]};return t.patch(e,r),t.applyData(e,r)}function nxe(t,e){const n={type:"text",value:e.value.replace(/\r?\n|\r/g," ")};t.patch(e,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return t.patch(e,r),t.applyData(e,r)}function rxe(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return p$(t,e);const s={href:Zh(r.url||"")};r.title!==null&&r.title!==void 0&&(s.title=r.title);const i={type:"element",tagName:"a",properties:s,children:t.all(e)};return t.patch(e,i),t.applyData(e,i)}function sxe(t,e){const n={href:Zh(e.url)};e.title!==null&&e.title!==void 0&&(n.title=e.title);const r={type:"element",tagName:"a",properties:n,children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function ixe(t,e,n){const r=t.all(e),s=n?axe(n):g$(e),i={},a=[];if(typeof e.checked=="boolean"){const f=r[0];let m;f&&f.type==="element"&&f.tagName==="p"?m=f:(m={type:"element",tagName:"p",properties:{},children:[]},r.unshift(m)),m.children.length>0&&m.children.unshift({type:"text",value:" "}),m.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:e.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let o=-1;for(;++o0){const Tt=Ge.tokenStack[Ge.tokenStack.length-1];(Tt[1]||N_).call(Ge,void 0,Tt[0])}for(Le.position={start:Jo(Ce.length>0?Ce[0][1].start:{line:1,column:1,offset:0}),end:Jo(Ce.length>0?Ce[Ce.length-2][1].end:{line:1,column:1,offset:0})},jt=-1;++jt1?"-"+o:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(a)}]};t.patch(e,c);const h={type:"element",tagName:"sup",properties:{},children:[c]};return t.patch(e,h),t.applyData(e,h)}function rxe(t,e){const n={type:"element",tagName:"h"+e.depth,properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function sxe(t,e){if(t.options.allowDangerousHtml){const n={type:"raw",value:e.value};return t.patch(e,n),t.applyData(e,n)}}function x$(t,e){const n=e.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(e.label||e.identifier)+"]"),e.type==="imageReference")return[{type:"text",value:"!["+e.alt+r}];const s=t.all(e),i=s[0];i&&i.type==="text"?i.value="["+i.value:s.unshift({type:"text",value:"["});const a=s[s.length-1];return a&&a.type==="text"?a.value+=r:s.push({type:"text",value:r}),s}function ixe(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return x$(t,e);const s={src:Zh(r.url||""),alt:e.alt};r.title!==null&&r.title!==void 0&&(s.title=r.title);const i={type:"element",tagName:"img",properties:s,children:[]};return t.patch(e,i),t.applyData(e,i)}function axe(t,e){const n={src:Zh(e.url)};e.alt!==null&&e.alt!==void 0&&(n.alt=e.alt),e.title!==null&&e.title!==void 0&&(n.title=e.title);const r={type:"element",tagName:"img",properties:n,children:[]};return t.patch(e,r),t.applyData(e,r)}function lxe(t,e){const n={type:"text",value:e.value.replace(/\r?\n|\r/g," ")};t.patch(e,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return t.patch(e,r),t.applyData(e,r)}function oxe(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return x$(t,e);const s={href:Zh(r.url||"")};r.title!==null&&r.title!==void 0&&(s.title=r.title);const i={type:"element",tagName:"a",properties:s,children:t.all(e)};return t.patch(e,i),t.applyData(e,i)}function cxe(t,e){const n={href:Zh(e.url)};e.title!==null&&e.title!==void 0&&(n.title=e.title);const r={type:"element",tagName:"a",properties:n,children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function uxe(t,e,n){const r=t.all(e),s=n?dxe(n):v$(e),i={},a=[];if(typeof e.checked=="boolean"){const f=r[0];let m;f&&f.type==="element"&&f.tagName==="p"?m=f:(m={type:"element",tagName:"p",properties:{},children:[]},r.unshift(m)),m.children.length>0&&m.children.unshift({type:"text",value:" "}),m.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:e.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let o=-1;for(;++o1}function lxe(t,e){const n={},r=t.all(e);let s=-1;for(typeof e.start=="number"&&e.start!==1&&(n.start=e.start);++s0){const a={type:"element",tagName:"tbody",properties:{},children:t.wrap(n,!0)},o=NO(e.children[1]),c=XF(e.children[e.children.length-1]);o&&c&&(a.position={start:o,end:c}),s.push(a)}const i={type:"element",tagName:"table",properties:{},children:t.wrap(s,!0)};return t.patch(e,i),t.applyData(e,i)}function hxe(t,e,n){const r=n?n.children:void 0,i=(r?r.indexOf(e):1)===0?"th":"td",a=n&&n.type==="table"?n.align:void 0,o=a?a.length:e.children.length;let c=-1;const h=[];for(;++c0,!0),r[0]),s=r.index+r[0].length,r=n.exec(e);return i.push(N_(e.slice(s),s>0,!1)),i.join("")}function N_(t,e,n){let r=0,s=t.length;if(e){let i=t.codePointAt(r);for(;i===O_||i===j_;)r++,i=t.codePointAt(r)}if(n){let i=t.codePointAt(s-1);for(;i===O_||i===j_;)s--,i=t.codePointAt(s-1)}return s>r?t.slice(r,s):""}function pxe(t,e){const n={type:"text",value:mxe(String(e.value))};return t.patch(e,n),t.applyData(e,n)}function gxe(t,e){const n={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(e,n),t.applyData(e,n)}const xxe={blockquote:Uge,break:Wge,code:Gge,delete:Xge,emphasis:Yge,footnoteReference:Kge,heading:Zge,html:Jge,imageReference:exe,image:txe,inlineCode:nxe,linkReference:rxe,link:sxe,listItem:ixe,list:lxe,paragraph:oxe,root:cxe,strong:uxe,table:dxe,tableCell:fxe,tableRow:hxe,text:pxe,thematicBreak:gxe,toml:kx,yaml:kx,definition:kx,footnoteDefinition:kx};function kx(){}const x$=-1,xy=0,Im=1,iv=2,RO=3,DO=4,zO=5,PO=6,v$=7,y$=8,C_=typeof self=="object"?self:globalThis,vxe=(t,e)=>{const n=(s,i)=>(t.set(i,s),s),r=s=>{if(t.has(s))return t.get(s);const[i,a]=e[s];switch(i){case xy:case x$:return n(a,s);case Im:{const o=n([],s);for(const c of a)o.push(r(c));return o}case iv:{const o=n({},s);for(const[c,h]of a)o[r(c)]=r(h);return o}case RO:return n(new Date(a),s);case DO:{const{source:o,flags:c}=a;return n(new RegExp(o,c),s)}case zO:{const o=n(new Map,s);for(const[c,h]of a)o.set(r(c),r(h));return o}case PO:{const o=n(new Set,s);for(const c of a)o.add(r(c));return o}case v$:{const{name:o,message:c}=a;return n(new C_[o](c),s)}case y$:return n(BigInt(a),s);case"BigInt":return n(Object(BigInt(a)),s);case"ArrayBuffer":return n(new Uint8Array(a).buffer,a);case"DataView":{const{buffer:o}=new Uint8Array(a);return n(new DataView(o),a)}}return n(new C_[i](a),s)};return r},T_=t=>vxe(new Map,t)(0),Td="",{toString:yxe}={},{keys:bxe}=Object,lm=t=>{const e=typeof t;if(e!=="object"||!t)return[xy,e];const n=yxe.call(t).slice(8,-1);switch(n){case"Array":return[Im,Td];case"Object":return[iv,Td];case"Date":return[RO,Td];case"RegExp":return[DO,Td];case"Map":return[zO,Td];case"Set":return[PO,Td];case"DataView":return[Im,n]}return n.includes("Array")?[Im,n]:n.includes("Error")?[v$,n]:[iv,n]},Ox=([t,e])=>t===xy&&(e==="function"||e==="symbol"),wxe=(t,e,n,r)=>{const s=(a,o)=>{const c=r.push(a)-1;return n.set(o,c),c},i=a=>{if(n.has(a))return n.get(a);let[o,c]=lm(a);switch(o){case xy:{let f=a;switch(c){case"bigint":o=y$,f=a.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+c);f=null;break;case"undefined":return s([x$],a)}return s([o,f],a)}case Im:{if(c){let g=a;return c==="DataView"?g=new Uint8Array(a.buffer):c==="ArrayBuffer"&&(g=new Uint8Array(a)),s([c,[...g]],a)}const f=[],m=s([o,f],a);for(const g of a)f.push(i(g));return m}case iv:{if(c)switch(c){case"BigInt":return s([c,a.toString()],a);case"Boolean":case"Number":case"String":return s([c,a.valueOf()],a)}if(e&&"toJSON"in a)return i(a.toJSON());const f=[],m=s([o,f],a);for(const g of bxe(a))(t||!Ox(lm(a[g])))&&f.push([i(g),i(a[g])]);return m}case RO:return s([o,a.toISOString()],a);case DO:{const{source:f,flags:m}=a;return s([o,{source:f,flags:m}],a)}case zO:{const f=[],m=s([o,f],a);for(const[g,x]of a)(t||!(Ox(lm(g))||Ox(lm(x))))&&f.push([i(g),i(x)]);return m}case PO:{const f=[],m=s([o,f],a);for(const g of a)(t||!Ox(lm(g)))&&f.push(i(g));return m}}const{message:h}=a;return s([o,{name:c,message:h}],a)};return i},E_=(t,{json:e,lossy:n}={})=>{const r=[];return wxe(!(e||n),!!e,new Map,r)(t),r},av=typeof structuredClone=="function"?(t,e)=>e&&("json"in e||"lossy"in e)?T_(E_(t,e)):structuredClone(t):(t,e)=>T_(E_(t,e));function Sxe(t,e){const n=[{type:"text",value:"↩"}];return e>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(e)}]}),n}function kxe(t,e){return"Back to reference "+(t+1)+(e>1?"-"+e:"")}function Oxe(t){const e=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",n=t.options.footnoteBackContent||Sxe,r=t.options.footnoteBackLabel||kxe,s=t.options.footnoteLabel||"Footnotes",i=t.options.footnoteLabelTagName||"h2",a=t.options.footnoteLabelProperties||{className:["sr-only"]},o=[];let c=-1;for(;++c0&&y.push({type:"text",value:" "});let N=typeof n=="string"?n:n(c,x);typeof N=="string"&&(N={type:"text",value:N}),y.push({type:"element",tagName:"a",properties:{href:"#"+e+"fnref-"+g+(x>1?"-"+x:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(c,x),className:["data-footnote-backref"]},children:Array.isArray(N)?N:[N]})}const S=f[f.length-1];if(S&&S.type==="element"&&S.tagName==="p"){const N=S.children[S.children.length-1];N&&N.type==="text"?N.value+=" ":S.children.push({type:"text",value:" "}),S.children.push(...y)}else f.push(...y);const k={type:"element",tagName:"li",properties:{id:e+"fn-"+g},children:t.wrap(f,!0)};t.patch(h,k),o.push(k)}if(o.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...av(a),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:` +`});const h={type:"element",tagName:"li",properties:i,children:a};return t.patch(e,h),t.applyData(e,h)}function dxe(t){let e=!1;if(t.type==="list"){e=t.spread||!1;const n=t.children;let r=-1;for(;!e&&++r1}function hxe(t,e){const n={},r=t.all(e);let s=-1;for(typeof e.start=="number"&&e.start!==1&&(n.start=e.start);++s0){const a={type:"element",tagName:"tbody",properties:{},children:t.wrap(n,!0)},o=Cj(e.children[1]),c=KF(e.children[e.children.length-1]);o&&c&&(a.position={start:o,end:c}),s.push(a)}const i={type:"element",tagName:"table",properties:{},children:t.wrap(s,!0)};return t.patch(e,i),t.applyData(e,i)}function xxe(t,e,n){const r=n?n.children:void 0,i=(r?r.indexOf(e):1)===0?"th":"td",a=n&&n.type==="table"?n.align:void 0,o=a?a.length:e.children.length;let c=-1;const h=[];for(;++c0,!0),r[0]),s=r.index+r[0].length,r=n.exec(e);return i.push(E_(e.slice(s),s>0,!1)),i.join("")}function E_(t,e,n){let r=0,s=t.length;if(e){let i=t.codePointAt(r);for(;i===C_||i===T_;)r++,i=t.codePointAt(r)}if(n){let i=t.codePointAt(s-1);for(;i===C_||i===T_;)s--,i=t.codePointAt(s-1)}return s>r?t.slice(r,s):""}function bxe(t,e){const n={type:"text",value:yxe(String(e.value))};return t.patch(e,n),t.applyData(e,n)}function wxe(t,e){const n={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(e,n),t.applyData(e,n)}const Sxe={blockquote:Kge,break:Zge,code:Jge,delete:exe,emphasis:txe,footnoteReference:nxe,heading:rxe,html:sxe,imageReference:ixe,image:axe,inlineCode:lxe,linkReference:oxe,link:cxe,listItem:uxe,list:hxe,paragraph:fxe,root:mxe,strong:pxe,table:gxe,tableCell:vxe,tableRow:xxe,text:bxe,thematicBreak:wxe,toml:Ox,yaml:Ox,definition:Ox,footnoteDefinition:Ox};function Ox(){}const y$=-1,ky=0,Bm=1,lv=2,Dj=3,zj=4,Pj=5,Lj=6,b$=7,w$=8,__=typeof self=="object"?self:globalThis,kxe=(t,e)=>{const n=(s,i)=>(t.set(i,s),s),r=s=>{if(t.has(s))return t.get(s);const[i,a]=e[s];switch(i){case ky:case y$:return n(a,s);case Bm:{const o=n([],s);for(const c of a)o.push(r(c));return o}case lv:{const o=n({},s);for(const[c,h]of a)o[r(c)]=r(h);return o}case Dj:return n(new Date(a),s);case zj:{const{source:o,flags:c}=a;return n(new RegExp(o,c),s)}case Pj:{const o=n(new Map,s);for(const[c,h]of a)o.set(r(c),r(h));return o}case Lj:{const o=n(new Set,s);for(const c of a)o.add(r(c));return o}case b$:{const{name:o,message:c}=a;return n(new __[o](c),s)}case w$:return n(BigInt(a),s);case"BigInt":return n(Object(BigInt(a)),s);case"ArrayBuffer":return n(new Uint8Array(a).buffer,a);case"DataView":{const{buffer:o}=new Uint8Array(a);return n(new DataView(o),a)}}return n(new __[i](a),s)};return r},M_=t=>kxe(new Map,t)(0),_d="",{toString:jxe}={},{keys:Oxe}=Object,lm=t=>{const e=typeof t;if(e!=="object"||!t)return[ky,e];const n=jxe.call(t).slice(8,-1);switch(n){case"Array":return[Bm,_d];case"Object":return[lv,_d];case"Date":return[Dj,_d];case"RegExp":return[zj,_d];case"Map":return[Pj,_d];case"Set":return[Lj,_d];case"DataView":return[Bm,n]}return n.includes("Array")?[Bm,n]:n.includes("Error")?[b$,n]:[lv,n]},Nx=([t,e])=>t===ky&&(e==="function"||e==="symbol"),Nxe=(t,e,n,r)=>{const s=(a,o)=>{const c=r.push(a)-1;return n.set(o,c),c},i=a=>{if(n.has(a))return n.get(a);let[o,c]=lm(a);switch(o){case ky:{let f=a;switch(c){case"bigint":o=w$,f=a.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+c);f=null;break;case"undefined":return s([y$],a)}return s([o,f],a)}case Bm:{if(c){let g=a;return c==="DataView"?g=new Uint8Array(a.buffer):c==="ArrayBuffer"&&(g=new Uint8Array(a)),s([c,[...g]],a)}const f=[],m=s([o,f],a);for(const g of a)f.push(i(g));return m}case lv:{if(c)switch(c){case"BigInt":return s([c,a.toString()],a);case"Boolean":case"Number":case"String":return s([c,a.valueOf()],a)}if(e&&"toJSON"in a)return i(a.toJSON());const f=[],m=s([o,f],a);for(const g of Oxe(a))(t||!Nx(lm(a[g])))&&f.push([i(g),i(a[g])]);return m}case Dj:return s([o,a.toISOString()],a);case zj:{const{source:f,flags:m}=a;return s([o,{source:f,flags:m}],a)}case Pj:{const f=[],m=s([o,f],a);for(const[g,x]of a)(t||!(Nx(lm(g))||Nx(lm(x))))&&f.push([i(g),i(x)]);return m}case Lj:{const f=[],m=s([o,f],a);for(const g of a)(t||!Nx(lm(g)))&&f.push(i(g));return m}}const{message:h}=a;return s([o,{name:c,message:h}],a)};return i},A_=(t,{json:e,lossy:n}={})=>{const r=[];return Nxe(!(e||n),!!e,new Map,r)(t),r},ov=typeof structuredClone=="function"?(t,e)=>e&&("json"in e||"lossy"in e)?M_(A_(t,e)):structuredClone(t):(t,e)=>M_(A_(t,e));function Cxe(t,e){const n=[{type:"text",value:"↩"}];return e>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(e)}]}),n}function Txe(t,e){return"Back to reference "+(t+1)+(e>1?"-"+e:"")}function Exe(t){const e=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",n=t.options.footnoteBackContent||Cxe,r=t.options.footnoteBackLabel||Txe,s=t.options.footnoteLabel||"Footnotes",i=t.options.footnoteLabelTagName||"h2",a=t.options.footnoteLabelProperties||{className:["sr-only"]},o=[];let c=-1;for(;++c0&&y.push({type:"text",value:" "});let N=typeof n=="string"?n:n(c,x);typeof N=="string"&&(N={type:"text",value:N}),y.push({type:"element",tagName:"a",properties:{href:"#"+e+"fnref-"+g+(x>1?"-"+x:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(c,x),className:["data-footnote-backref"]},children:Array.isArray(N)?N:[N]})}const S=f[f.length-1];if(S&&S.type==="element"&&S.tagName==="p"){const N=S.children[S.children.length-1];N&&N.type==="text"?N.value+=" ":S.children.push({type:"text",value:" "}),S.children.push(...y)}else f.push(...y);const k={type:"element",tagName:"li",properties:{id:e+"fn-"+g},children:t.wrap(f,!0)};t.patch(h,k),o.push(k)}if(o.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...ov(a),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:` `},{type:"element",tagName:"ol",properties:{},children:t.wrap(o,!0)},{type:"text",value:` -`}]}}const op=(function(t){if(t==null)return Txe;if(typeof t=="function")return vy(t);if(typeof t=="object")return Array.isArray(t)?jxe(t):Nxe(t);if(typeof t=="string")return Cxe(t);throw new Error("Expected function, string, or object as test")});function jxe(t){const e=[];let n=-1;for(;++n":""))+")"})}return g;function g(){let x=b$,y,w,S;if((!e||i(c,h,f[f.length-1]||void 0))&&(x=Mxe(n(c,f)),x[0]===JS))return x;if("children"in c&&c.children){const k=c;if(k.children&&x[0]!==w$)for(w=(r?k.children.length:-1)+a,S=f.concat(k);w>-1&&w":""))+")"})}return g;function g(){let x=S$,y,w,S;if((!e||i(c,h,f[f.length-1]||void 0))&&(x=Pxe(n(c,f)),x[0]===ik))return x;if("children"in c&&c.children){const k=c;if(k.children&&x[0]!==k$)for(w=(r?k.children.length:-1)+a,S=f.concat(k);w>-1&&w0&&n.push({type:"text",value:` -`}),n}function __(t){let e=0,n=t.charCodeAt(e);for(;n===9||n===32;)e++,n=t.charCodeAt(e);return t.slice(e)}function M_(t,e){const n=Rxe(t,e),r=n.one(t,void 0),s=Oxe(n),i=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return s&&i.children.push({type:"text",value:` -`},s),i}function Ixe(t,e){return t&&"run"in t?async function(n,r){const s=M_(n,{file:r,...e});await t.run(s,r)}:function(n,r){return M_(n,{file:r,...t||e})}}function A_(t){if(t)throw t}var i4,R_;function Bxe(){if(R_)return i4;R_=1;var t=Object.prototype.hasOwnProperty,e=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,s=function(h){return typeof Array.isArray=="function"?Array.isArray(h):e.call(h)==="[object Array]"},i=function(h){if(!h||e.call(h)!=="[object Object]")return!1;var f=t.call(h,"constructor"),m=h.constructor&&h.constructor.prototype&&t.call(h.constructor.prototype,"isPrototypeOf");if(h.constructor&&!f&&!m)return!1;var g;for(g in h);return typeof g>"u"||t.call(h,g)},a=function(h,f){n&&f.name==="__proto__"?n(h,f.name,{enumerable:!0,configurable:!0,value:f.newValue,writable:!0}):h[f.name]=f.newValue},o=function(h,f){if(f==="__proto__")if(t.call(h,f)){if(r)return r(h,f).value}else return;return h[f]};return i4=function c(){var h,f,m,g,x,y,w=arguments[0],S=1,k=arguments.length,N=!1;for(typeof w=="boolean"&&(N=w,w=arguments[1]||{},S=2),(w==null||typeof w!="object"&&typeof w!="function")&&(w={});Sa.length;let c;o&&a.push(s);try{c=t.apply(this,a)}catch(h){const f=h;if(o&&n)throw f;return s(f)}o||(c&&c.then&&typeof c.then=="function"?c.then(i,s):c instanceof Error?s(c):i(c))}function s(a,...o){n||(n=!0,e(a,...o))}function i(a){s(null,a)}}const Ua={basename:Qxe,dirname:Hxe,extname:Vxe,join:Uxe,sep:"/"};function Qxe(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');cp(t);let n=0,r=-1,s=t.length,i;if(e===void 0||e.length===0||e.length>t.length){for(;s--;)if(t.codePointAt(s)===47){if(i){n=s+1;break}}else r<0&&(i=!0,r=s+1);return r<0?"":t.slice(n,r)}if(e===t)return"";let a=-1,o=e.length-1;for(;s--;)if(t.codePointAt(s)===47){if(i){n=s+1;break}}else a<0&&(i=!0,a=s+1),o>-1&&(t.codePointAt(s)===e.codePointAt(o--)?o<0&&(r=s):(o=-1,r=a));return n===r?r=a:r<0&&(r=t.length),t.slice(n,r)}function Hxe(t){if(cp(t),t.length===0)return".";let e=-1,n=t.length,r;for(;--n;)if(t.codePointAt(n)===47){if(r){e=n;break}}else r||(r=!0);return e<0?t.codePointAt(0)===47?"/":".":e===1&&t.codePointAt(0)===47?"//":t.slice(0,e)}function Vxe(t){cp(t);let e=t.length,n=-1,r=0,s=-1,i=0,a;for(;e--;){const o=t.codePointAt(e);if(o===47){if(a){r=e+1;break}continue}n<0&&(a=!0,n=e+1),o===46?s<0?s=e:i!==1&&(i=1):s>-1&&(i=-1)}return s<0||n<0||i===0||i===1&&s===n-1&&s===r+1?"":t.slice(s,n)}function Uxe(...t){let e=-1,n;for(;++e0&&t.codePointAt(t.length-1)===47&&(n+="/"),e?"/"+n:n}function Gxe(t,e){let n="",r=0,s=-1,i=0,a=-1,o,c;for(;++a<=t.length;){if(a2){if(c=n.lastIndexOf("/"),c!==n.length-1){c<0?(n="",r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf("/")),s=a,i=0;continue}}else if(n.length>0){n="",r=0,s=a,i=0;continue}}e&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+t.slice(s+1,a):n=t.slice(s+1,a),r=a-s-1;s=a,i=0}else o===46&&i>-1?i++:i=-1}return n}function cp(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const Xxe={cwd:Yxe};function Yxe(){return"/"}function nk(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function Kxe(t){if(typeof t=="string")t=new URL(t);else if(!nk(t)){const e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(t.protocol!=="file:"){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return Zxe(t)}function Zxe(t){if(t.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const e=t.pathname;let n=-1;for(;++n0){let[x,...y]=f;const w=r[g][1];tk(w)&&tk(x)&&(x=a4(!0,w,x)),r[g]=[h,x,...y]}}}}const n1e=new BO().freeze();function u4(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function d4(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function h4(t,e){if(e)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function z_(t){if(!tk(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function P_(t,e,n){if(!n)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function jx(t){return r1e(t)?t:new S$(t)}function r1e(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function s1e(t){return typeof t=="string"||i1e(t)}function i1e(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const a1e="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",L_=[],I_={allowDangerousHtml:!0},l1e=/^(https?|ircs?|mailto|xmpp)$/i,o1e=[{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 c1e(t){const e=u1e(t),n=d1e(t);return h1e(e.runSync(e.parse(n),n),t)}function u1e(t){const e=t.rehypePlugins||L_,n=t.remarkPlugins||L_,r=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...I_}:I_;return n1e().use(Vge).use(n).use(Ixe,r).use(e)}function d1e(t){const e=t.children||"",n=new S$;return typeof e=="string"&&(n.value=e),n}function h1e(t,e){const n=e.allowedElements,r=e.allowElement,s=e.components,i=e.disallowedElements,a=e.skipHtml,o=e.unwrapDisallowed,c=e.urlTransform||f1e;for(const f of o1e)Object.hasOwn(e,f.from)&&(""+f.from+(f.to?"use `"+f.to+"` instead":"remove it")+a1e+f.id,void 0);return IO(t,h),T0e(t,{Fragment:l.Fragment,components:s,ignoreInvalidStyle:!0,jsx:l.jsx,jsxs:l.jsxs,passKeys:!0,passNode:!0});function h(f,m,g){if(f.type==="raw"&&g&&typeof m=="number")return a?g.children.splice(m,1):g.children[m]={type:"text",value:f.value},m;if(f.type==="element"){let x;for(x in n4)if(Object.hasOwn(n4,x)&&Object.hasOwn(f.properties,x)){const y=f.properties[x],w=n4[x];(w===null||w.includes(f.tagName))&&(f.properties[x]=c(String(y||""),x,f))}}if(f.type==="element"){let x=n?!n.includes(f.tagName):i?i.includes(f.tagName):!1;if(!x&&r&&typeof m=="number"&&(x=!r(f,m,g)),x&&g&&typeof m=="number")return o&&f.children?g.children.splice(m,1,...f.children):g.children.splice(m,1),m}}}function f1e(t){const e=t.indexOf(":"),n=t.indexOf("?"),r=t.indexOf("#"),s=t.indexOf("/");return e===-1||s!==-1&&e>s||n!==-1&&e>n||r!==-1&&e>r||l1e.test(t.slice(0,e))?t:""}function B_(t,e){const n=String(t);if(typeof e!="string")throw new TypeError("Expected character");let r=0,s=n.indexOf(e);for(;s!==-1;)r++,s=n.indexOf(e,s+e.length);return r}function m1e(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function p1e(t,e,n){const s=op((n||{}).ignore||[]),i=g1e(e);let a=-1;for(;++a0?{type:"text",value:E}:void 0),E===!1?g.lastIndex=T+1:(y!==T&&N.push({type:"text",value:h.value.slice(y,T)}),Array.isArray(E)?N.push(...E):E&&N.push(E),y=T+C[0].length,k=!0),!g.global)break;C=g.exec(h.value)}return k?(y?\]}]+$/.exec(t);if(!e)return[t,void 0];t=t.slice(0,e.index);let n=e[0],r=n.indexOf(")");const s=B_(t,"(");let i=B_(t,")");for(;r!==-1&&s>i;)t+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),i++;return[t,n]}function k$(t,e){const n=t.input.charCodeAt(t.index-1);return(t.index===0||Pu(n)||py(n))&&(!e||n!==47)}O$.peek=B1e;function M1e(){this.buffer()}function A1e(t){this.enter({type:"footnoteReference",identifier:"",label:""},t)}function R1e(){this.buffer()}function D1e(t){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},t)}function z1e(t){const e=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Na(this.sliceSerialize(t)).toLowerCase(),n.label=e}function P1e(t){this.exit(t)}function L1e(t){const e=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Na(this.sliceSerialize(t)).toLowerCase(),n.label=e}function I1e(t){this.exit(t)}function B1e(){return"["}function O$(t,e,n,r){const s=n.createTracker(r);let i=s.move("[^");const a=n.enter("footnoteReference"),o=n.enter("reference");return i+=s.move(n.safe(n.associationId(t),{after:"]",before:i})),o(),a(),i+=s.move("]"),i}function q1e(){return{enter:{gfmFootnoteCallString:M1e,gfmFootnoteCall:A1e,gfmFootnoteDefinitionLabelString:R1e,gfmFootnoteDefinition:D1e},exit:{gfmFootnoteCallString:z1e,gfmFootnoteCall:P1e,gfmFootnoteDefinitionLabelString:L1e,gfmFootnoteDefinition:I1e}}}function F1e(t){let e=!1;return t&&t.firstLineBlank&&(e=!0),{handlers:{footnoteDefinition:n,footnoteReference:O$},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,s,i,a){const o=i.createTracker(a);let c=o.move("[^");const h=i.enter("footnoteDefinition"),f=i.enter("label");return c+=o.move(i.safe(i.associationId(r),{before:c,after:"]"})),f(),c+=o.move("]:"),r.children&&r.children.length>0&&(o.shift(4),c+=o.move((e?` -`:" ")+i.indentLines(i.containerFlow(r,o.current()),e?j$:$1e))),h(),c}}function $1e(t,e,n){return e===0?t:j$(t,e,n)}function j$(t,e,n){return(n?"":" ")+t}const Q1e=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];N$.peek=G1e;function H1e(){return{canContainEols:["delete"],enter:{strikethrough:U1e},exit:{strikethrough:W1e}}}function V1e(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:Q1e}],handlers:{delete:N$}}}function U1e(t){this.enter({type:"delete",children:[]},t)}function W1e(t){this.exit(t)}function N$(t,e,n,r){const s=n.createTracker(r),i=n.enter("strikethrough");let a=s.move("~~");return a+=n.containerPhrasing(t,{...s.current(),before:a,after:"~"}),a+=s.move("~~"),i(),a}function G1e(){return"~"}function X1e(t){return t.length}function Y1e(t,e){const n=e||{},r=(n.align||[]).concat(),s=n.stringLength||X1e,i=[],a=[],o=[],c=[];let h=0,f=-1;for(;++fh&&(h=t[f].length);++kc[k])&&(c[k]=C)}w.push(N)}a[f]=w,o[f]=S}let m=-1;if(typeof r=="object"&&"length"in r)for(;++mc[m]&&(c[m]=N),x[m]=N),g[m]=C}a.splice(1,0,g),o.splice(1,0,x),f=-1;const y=[];for(;++f "),i.shift(2);const a=n.indentLines(n.containerFlow(t,i.current()),J1e);return s(),a}function J1e(t,e,n){return">"+(n?"":" ")+t}function eve(t,e){return F_(t,e.inConstruct,!0)&&!F_(t,e.notInConstruct,!1)}function F_(t,e,n){if(typeof e=="string"&&(e=[e]),!e||e.length===0)return n;let r=-1;for(;++ra&&(a=i):i=1,s=r+e.length,r=n.indexOf(e,s);return a}function tve(t,e){return!!(e.options.fences===!1&&t.value&&!t.lang&&/[^ \r\n]/.test(t.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(t.value))}function nve(t){const e=t.options.fence||"`";if(e!=="`"&&e!=="~")throw new Error("Cannot serialize code with `"+e+"` for `options.fence`, expected `` ` `` or `~`");return e}function rve(t,e,n,r){const s=nve(n),i=t.value||"",a=s==="`"?"GraveAccent":"Tilde";if(tve(t,n)){const m=n.enter("codeIndented"),g=n.indentLines(i,sve);return m(),g}const o=n.createTracker(r),c=s.repeat(Math.max(C$(i,s)+1,3)),h=n.enter("codeFenced");let f=o.move(c);if(t.lang){const m=n.enter(`codeFencedLang${a}`);f+=o.move(n.safe(t.lang,{before:f,after:" ",encode:["`"],...o.current()})),m()}if(t.lang&&t.meta){const m=n.enter(`codeFencedMeta${a}`);f+=o.move(" "),f+=o.move(n.safe(t.meta,{before:f,after:` +`}),n}function R_(t){let e=0,n=t.charCodeAt(e);for(;n===9||n===32;)e++,n=t.charCodeAt(e);return t.slice(e)}function D_(t,e){const n=Ixe(t,e),r=n.one(t,void 0),s=Exe(n),i=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return s&&i.children.push({type:"text",value:` +`},s),i}function Qxe(t,e){return t&&"run"in t?async function(n,r){const s=D_(n,{file:r,...e});await t.run(s,r)}:function(n,r){return D_(n,{file:r,...t||e})}}function z_(t){if(t)throw t}var d4,P_;function Hxe(){if(P_)return d4;P_=1;var t=Object.prototype.hasOwnProperty,e=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,s=function(h){return typeof Array.isArray=="function"?Array.isArray(h):e.call(h)==="[object Array]"},i=function(h){if(!h||e.call(h)!=="[object Object]")return!1;var f=t.call(h,"constructor"),m=h.constructor&&h.constructor.prototype&&t.call(h.constructor.prototype,"isPrototypeOf");if(h.constructor&&!f&&!m)return!1;var g;for(g in h);return typeof g>"u"||t.call(h,g)},a=function(h,f){n&&f.name==="__proto__"?n(h,f.name,{enumerable:!0,configurable:!0,value:f.newValue,writable:!0}):h[f.name]=f.newValue},o=function(h,f){if(f==="__proto__")if(t.call(h,f)){if(r)return r(h,f).value}else return;return h[f]};return d4=function c(){var h,f,m,g,x,y,w=arguments[0],S=1,k=arguments.length,N=!1;for(typeof w=="boolean"&&(N=w,w=arguments[1]||{},S=2),(w==null||typeof w!="object"&&typeof w!="function")&&(w={});Sa.length;let c;o&&a.push(s);try{c=t.apply(this,a)}catch(h){const f=h;if(o&&n)throw f;return s(f)}o||(c&&c.then&&typeof c.then=="function"?c.then(i,s):c instanceof Error?s(c):i(c))}function s(a,...o){n||(n=!0,e(a,...o))}function i(a){s(null,a)}}const Xa={basename:Gxe,dirname:Xxe,extname:Yxe,join:Kxe,sep:"/"};function Gxe(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');hp(t);let n=0,r=-1,s=t.length,i;if(e===void 0||e.length===0||e.length>t.length){for(;s--;)if(t.codePointAt(s)===47){if(i){n=s+1;break}}else r<0&&(i=!0,r=s+1);return r<0?"":t.slice(n,r)}if(e===t)return"";let a=-1,o=e.length-1;for(;s--;)if(t.codePointAt(s)===47){if(i){n=s+1;break}}else a<0&&(i=!0,a=s+1),o>-1&&(t.codePointAt(s)===e.codePointAt(o--)?o<0&&(r=s):(o=-1,r=a));return n===r?r=a:r<0&&(r=t.length),t.slice(n,r)}function Xxe(t){if(hp(t),t.length===0)return".";let e=-1,n=t.length,r;for(;--n;)if(t.codePointAt(n)===47){if(r){e=n;break}}else r||(r=!0);return e<0?t.codePointAt(0)===47?"/":".":e===1&&t.codePointAt(0)===47?"//":t.slice(0,e)}function Yxe(t){hp(t);let e=t.length,n=-1,r=0,s=-1,i=0,a;for(;e--;){const o=t.codePointAt(e);if(o===47){if(a){r=e+1;break}continue}n<0&&(a=!0,n=e+1),o===46?s<0?s=e:i!==1&&(i=1):s>-1&&(i=-1)}return s<0||n<0||i===0||i===1&&s===n-1&&s===r+1?"":t.slice(s,n)}function Kxe(...t){let e=-1,n;for(;++e0&&t.codePointAt(t.length-1)===47&&(n+="/"),e?"/"+n:n}function Jxe(t,e){let n="",r=0,s=-1,i=0,a=-1,o,c;for(;++a<=t.length;){if(a2){if(c=n.lastIndexOf("/"),c!==n.length-1){c<0?(n="",r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf("/")),s=a,i=0;continue}}else if(n.length>0){n="",r=0,s=a,i=0;continue}}e&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+t.slice(s+1,a):n=t.slice(s+1,a),r=a-s-1;s=a,i=0}else o===46&&i>-1?i++:i=-1}return n}function hp(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const e1e={cwd:t1e};function t1e(){return"/"}function ok(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function n1e(t){if(typeof t=="string")t=new URL(t);else if(!ok(t)){const e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(t.protocol!=="file:"){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return r1e(t)}function r1e(t){if(t.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const e=t.pathname;let n=-1;for(;++n0){let[x,...y]=f;const w=r[g][1];lk(w)&&lk(x)&&(x=h4(!0,w,x)),r[g]=[h,x,...y]}}}}const l1e=new qj().freeze();function g4(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function x4(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function v4(t,e){if(e)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function I_(t){if(!lk(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function B_(t,e,n){if(!n)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function Cx(t){return o1e(t)?t:new j$(t)}function o1e(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function c1e(t){return typeof t=="string"||u1e(t)}function u1e(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const d1e="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",q_=[],F_={allowDangerousHtml:!0},h1e=/^(https?|ircs?|mailto|xmpp)$/i,f1e=[{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 m1e(t){const e=p1e(t),n=g1e(t);return x1e(e.runSync(e.parse(n),n),t)}function p1e(t){const e=t.rehypePlugins||q_,n=t.remarkPlugins||q_,r=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...F_}:F_;return l1e().use(Yge).use(n).use(Qxe,r).use(e)}function g1e(t){const e=t.children||"",n=new j$;return typeof e=="string"&&(n.value=e),n}function x1e(t,e){const n=e.allowedElements,r=e.allowElement,s=e.components,i=e.disallowedElements,a=e.skipHtml,o=e.unwrapDisallowed,c=e.urlTransform||v1e;for(const f of f1e)Object.hasOwn(e,f.from)&&(""+f.from+(f.to?"use `"+f.to+"` instead":"remove it")+d1e+f.id,void 0);return Bj(t,h),R0e(t,{Fragment:l.Fragment,components:s,ignoreInvalidStyle:!0,jsx:l.jsx,jsxs:l.jsxs,passKeys:!0,passNode:!0});function h(f,m,g){if(f.type==="raw"&&g&&typeof m=="number")return a?g.children.splice(m,1):g.children[m]={type:"text",value:f.value},m;if(f.type==="element"){let x;for(x in o4)if(Object.hasOwn(o4,x)&&Object.hasOwn(f.properties,x)){const y=f.properties[x],w=o4[x];(w===null||w.includes(f.tagName))&&(f.properties[x]=c(String(y||""),x,f))}}if(f.type==="element"){let x=n?!n.includes(f.tagName):i?i.includes(f.tagName):!1;if(!x&&r&&typeof m=="number"&&(x=!r(f,m,g)),x&&g&&typeof m=="number")return o&&f.children?g.children.splice(m,1,...f.children):g.children.splice(m,1),m}}}function v1e(t){const e=t.indexOf(":"),n=t.indexOf("?"),r=t.indexOf("#"),s=t.indexOf("/");return e===-1||s!==-1&&e>s||n!==-1&&e>n||r!==-1&&e>r||h1e.test(t.slice(0,e))?t:""}function $_(t,e){const n=String(t);if(typeof e!="string")throw new TypeError("Expected character");let r=0,s=n.indexOf(e);for(;s!==-1;)r++,s=n.indexOf(e,s+e.length);return r}function y1e(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function b1e(t,e,n){const s=dp((n||{}).ignore||[]),i=w1e(e);let a=-1;for(;++a0?{type:"text",value:E}:void 0),E===!1?g.lastIndex=T+1:(y!==T&&N.push({type:"text",value:h.value.slice(y,T)}),Array.isArray(E)?N.push(...E):E&&N.push(E),y=T+C[0].length,k=!0),!g.global)break;C=g.exec(h.value)}return k?(y?\]}]+$/.exec(t);if(!e)return[t,void 0];t=t.slice(0,e.index);let n=e[0],r=n.indexOf(")");const s=$_(t,"(");let i=$_(t,")");for(;r!==-1&&s>i;)t+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),i++;return[t,n]}function O$(t,e){const n=t.input.charCodeAt(t.index-1);return(t.index===0||Iu(n)||wy(n))&&(!e||n!==47)}N$.peek=H1e;function P1e(){this.buffer()}function L1e(t){this.enter({type:"footnoteReference",identifier:"",label:""},t)}function I1e(){this.buffer()}function B1e(t){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},t)}function q1e(t){const e=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Ta(this.sliceSerialize(t)).toLowerCase(),n.label=e}function F1e(t){this.exit(t)}function $1e(t){const e=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Ta(this.sliceSerialize(t)).toLowerCase(),n.label=e}function Q1e(t){this.exit(t)}function H1e(){return"["}function N$(t,e,n,r){const s=n.createTracker(r);let i=s.move("[^");const a=n.enter("footnoteReference"),o=n.enter("reference");return i+=s.move(n.safe(n.associationId(t),{after:"]",before:i})),o(),a(),i+=s.move("]"),i}function V1e(){return{enter:{gfmFootnoteCallString:P1e,gfmFootnoteCall:L1e,gfmFootnoteDefinitionLabelString:I1e,gfmFootnoteDefinition:B1e},exit:{gfmFootnoteCallString:q1e,gfmFootnoteCall:F1e,gfmFootnoteDefinitionLabelString:$1e,gfmFootnoteDefinition:Q1e}}}function U1e(t){let e=!1;return t&&t.firstLineBlank&&(e=!0),{handlers:{footnoteDefinition:n,footnoteReference:N$},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,s,i,a){const o=i.createTracker(a);let c=o.move("[^");const h=i.enter("footnoteDefinition"),f=i.enter("label");return c+=o.move(i.safe(i.associationId(r),{before:c,after:"]"})),f(),c+=o.move("]:"),r.children&&r.children.length>0&&(o.shift(4),c+=o.move((e?` +`:" ")+i.indentLines(i.containerFlow(r,o.current()),e?C$:W1e))),h(),c}}function W1e(t,e,n){return e===0?t:C$(t,e,n)}function C$(t,e,n){return(n?"":" ")+t}const G1e=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];T$.peek=J1e;function X1e(){return{canContainEols:["delete"],enter:{strikethrough:K1e},exit:{strikethrough:Z1e}}}function Y1e(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:G1e}],handlers:{delete:T$}}}function K1e(t){this.enter({type:"delete",children:[]},t)}function Z1e(t){this.exit(t)}function T$(t,e,n,r){const s=n.createTracker(r),i=n.enter("strikethrough");let a=s.move("~~");return a+=n.containerPhrasing(t,{...s.current(),before:a,after:"~"}),a+=s.move("~~"),i(),a}function J1e(){return"~"}function eve(t){return t.length}function tve(t,e){const n=e||{},r=(n.align||[]).concat(),s=n.stringLength||eve,i=[],a=[],o=[],c=[];let h=0,f=-1;for(;++fh&&(h=t[f].length);++kc[k])&&(c[k]=C)}w.push(N)}a[f]=w,o[f]=S}let m=-1;if(typeof r=="object"&&"length"in r)for(;++mc[m]&&(c[m]=N),x[m]=N),g[m]=C}a.splice(1,0,g),o.splice(1,0,x),f=-1;const y=[];for(;++f "),i.shift(2);const a=n.indentLines(n.containerFlow(t,i.current()),sve);return s(),a}function sve(t,e,n){return">"+(n?"":" ")+t}function ive(t,e){return H_(t,e.inConstruct,!0)&&!H_(t,e.notInConstruct,!1)}function H_(t,e,n){if(typeof e=="string"&&(e=[e]),!e||e.length===0)return n;let r=-1;for(;++ra&&(a=i):i=1,s=r+e.length,r=n.indexOf(e,s);return a}function ave(t,e){return!!(e.options.fences===!1&&t.value&&!t.lang&&/[^ \r\n]/.test(t.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(t.value))}function lve(t){const e=t.options.fence||"`";if(e!=="`"&&e!=="~")throw new Error("Cannot serialize code with `"+e+"` for `options.fence`, expected `` ` `` or `~`");return e}function ove(t,e,n,r){const s=lve(n),i=t.value||"",a=s==="`"?"GraveAccent":"Tilde";if(ave(t,n)){const m=n.enter("codeIndented"),g=n.indentLines(i,cve);return m(),g}const o=n.createTracker(r),c=s.repeat(Math.max(E$(i,s)+1,3)),h=n.enter("codeFenced");let f=o.move(c);if(t.lang){const m=n.enter(`codeFencedLang${a}`);f+=o.move(n.safe(t.lang,{before:f,after:" ",encode:["`"],...o.current()})),m()}if(t.lang&&t.meta){const m=n.enter(`codeFencedMeta${a}`);f+=o.move(" "),f+=o.move(n.safe(t.meta,{before:f,after:` `,encode:["`"],...o.current()})),m()}return f+=o.move(` `),i&&(f+=o.move(i+` -`)),f+=o.move(c),h(),f}function sve(t,e,n){return(n?"":" ")+t}function qO(t){const e=t.options.quote||'"';if(e!=='"'&&e!=="'")throw new Error("Cannot serialize title with `"+e+"` for `options.quote`, expected `\"`, or `'`");return e}function ive(t,e,n,r){const s=qO(n),i=s==='"'?"Quote":"Apostrophe",a=n.enter("definition");let o=n.enter("label");const c=n.createTracker(r);let h=c.move("[");return h+=c.move(n.safe(n.associationId(t),{before:h,after:"]",...c.current()})),h+=c.move("]: "),o(),!t.url||/[\0- \u007F]/.test(t.url)?(o=n.enter("destinationLiteral"),h+=c.move("<"),h+=c.move(n.safe(t.url,{before:h,after:">",...c.current()})),h+=c.move(">")):(o=n.enter("destinationRaw"),h+=c.move(n.safe(t.url,{before:h,after:t.title?" ":` -`,...c.current()}))),o(),t.title&&(o=n.enter(`title${i}`),h+=c.move(" "+s),h+=c.move(n.safe(t.title,{before:h,after:s,...c.current()})),h+=c.move(s),o()),a(),h}function ave(t){const e=t.options.emphasis||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize emphasis with `"+e+"` for `options.emphasis`, expected `*`, or `_`");return e}function v0(t){return"&#x"+t.toString(16).toUpperCase()+";"}function lv(t,e,n){const r=Ch(t),s=Ch(e);return r===void 0?s===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}T$.peek=lve;function T$(t,e,n,r){const s=ave(n),i=n.enter("emphasis"),a=n.createTracker(r),o=a.move(s);let c=a.move(n.containerPhrasing(t,{after:s,before:o,...a.current()}));const h=c.charCodeAt(0),f=lv(r.before.charCodeAt(r.before.length-1),h,s);f.inside&&(c=v0(h)+c.slice(1));const m=c.charCodeAt(c.length-1),g=lv(r.after.charCodeAt(0),m,s);g.inside&&(c=c.slice(0,-1)+v0(m));const x=a.move(s);return i(),n.attentionEncodeSurroundingInfo={after:g.outside,before:f.outside},o+c+x}function lve(t,e,n){return n.options.emphasis||"*"}function ove(t,e){let n=!1;return IO(t,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,JS}),!!((!t.depth||t.depth<3)&&_O(t)&&(e.options.setext||n))}function cve(t,e,n,r){const s=Math.max(Math.min(6,t.depth||1),1),i=n.createTracker(r);if(ove(t,n)){const f=n.enter("headingSetext"),m=n.enter("phrasing"),g=n.containerPhrasing(t,{...i.current(),before:` +`)),f+=o.move(c),h(),f}function cve(t,e,n){return(n?"":" ")+t}function Fj(t){const e=t.options.quote||'"';if(e!=='"'&&e!=="'")throw new Error("Cannot serialize title with `"+e+"` for `options.quote`, expected `\"`, or `'`");return e}function uve(t,e,n,r){const s=Fj(n),i=s==='"'?"Quote":"Apostrophe",a=n.enter("definition");let o=n.enter("label");const c=n.createTracker(r);let h=c.move("[");return h+=c.move(n.safe(n.associationId(t),{before:h,after:"]",...c.current()})),h+=c.move("]: "),o(),!t.url||/[\0- \u007F]/.test(t.url)?(o=n.enter("destinationLiteral"),h+=c.move("<"),h+=c.move(n.safe(t.url,{before:h,after:">",...c.current()})),h+=c.move(">")):(o=n.enter("destinationRaw"),h+=c.move(n.safe(t.url,{before:h,after:t.title?" ":` +`,...c.current()}))),o(),t.title&&(o=n.enter(`title${i}`),h+=c.move(" "+s),h+=c.move(n.safe(t.title,{before:h,after:s,...c.current()})),h+=c.move(s),o()),a(),h}function dve(t){const e=t.options.emphasis||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize emphasis with `"+e+"` for `options.emphasis`, expected `*`, or `_`");return e}function w0(t){return"&#x"+t.toString(16).toUpperCase()+";"}function cv(t,e,n){const r=Ch(t),s=Ch(e);return r===void 0?s===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}_$.peek=hve;function _$(t,e,n,r){const s=dve(n),i=n.enter("emphasis"),a=n.createTracker(r),o=a.move(s);let c=a.move(n.containerPhrasing(t,{after:s,before:o,...a.current()}));const h=c.charCodeAt(0),f=cv(r.before.charCodeAt(r.before.length-1),h,s);f.inside&&(c=w0(h)+c.slice(1));const m=c.charCodeAt(c.length-1),g=cv(r.after.charCodeAt(0),m,s);g.inside&&(c=c.slice(0,-1)+w0(m));const x=a.move(s);return i(),n.attentionEncodeSurroundingInfo={after:g.outside,before:f.outside},o+c+x}function hve(t,e,n){return n.options.emphasis||"*"}function fve(t,e){let n=!1;return Bj(t,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,ik}),!!((!t.depth||t.depth<3)&&Mj(t)&&(e.options.setext||n))}function mve(t,e,n,r){const s=Math.max(Math.min(6,t.depth||1),1),i=n.createTracker(r);if(fve(t,n)){const f=n.enter("headingSetext"),m=n.enter("phrasing"),g=n.containerPhrasing(t,{...i.current(),before:` `,after:` `});return m(),f(),g+` `+(s===1?"=":"-").repeat(g.length-(Math.max(g.lastIndexOf("\r"),g.lastIndexOf(` `))+1))}const a="#".repeat(s),o=n.enter("headingAtx"),c=n.enter("phrasing");i.move(a+" ");let h=n.containerPhrasing(t,{before:"# ",after:` -`,...i.current()});return/^[\t ]/.test(h)&&(h=v0(h.charCodeAt(0))+h.slice(1)),h=h?a+" "+h:a,n.options.closeAtx&&(h+=" "+a),c(),o(),h}E$.peek=uve;function E$(t){return t.value||""}function uve(){return"<"}_$.peek=dve;function _$(t,e,n,r){const s=qO(n),i=s==='"'?"Quote":"Apostrophe",a=n.enter("image");let o=n.enter("label");const c=n.createTracker(r);let h=c.move("![");return h+=c.move(n.safe(t.alt,{before:h,after:"]",...c.current()})),h+=c.move("]("),o(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(o=n.enter("destinationLiteral"),h+=c.move("<"),h+=c.move(n.safe(t.url,{before:h,after:">",...c.current()})),h+=c.move(">")):(o=n.enter("destinationRaw"),h+=c.move(n.safe(t.url,{before:h,after:t.title?" ":")",...c.current()}))),o(),t.title&&(o=n.enter(`title${i}`),h+=c.move(" "+s),h+=c.move(n.safe(t.title,{before:h,after:s,...c.current()})),h+=c.move(s),o()),h+=c.move(")"),a(),h}function dve(){return"!"}M$.peek=hve;function M$(t,e,n,r){const s=t.referenceType,i=n.enter("imageReference");let a=n.enter("label");const o=n.createTracker(r);let c=o.move("![");const h=n.safe(t.alt,{before:c,after:"]",...o.current()});c+=o.move(h+"]["),a();const f=n.stack;n.stack=[],a=n.enter("reference");const m=n.safe(n.associationId(t),{before:c,after:"]",...o.current()});return a(),n.stack=f,i(),s==="full"||!h||h!==m?c+=o.move(m+"]"):s==="shortcut"?c=c.slice(0,-1):c+=o.move("]"),c}function hve(){return"!"}A$.peek=fve;function A$(t,e,n){let r=t.value||"",s="`",i=-1;for(;new RegExp("(^|[^`])"+s+"([^`]|$)").test(r);)s+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++i\u007F]/.test(t.url))}D$.peek=mve;function D$(t,e,n,r){const s=qO(n),i=s==='"'?"Quote":"Apostrophe",a=n.createTracker(r);let o,c;if(R$(t,n)){const f=n.stack;n.stack=[],o=n.enter("autolink");let m=a.move("<");return m+=a.move(n.containerPhrasing(t,{before:m,after:">",...a.current()})),m+=a.move(">"),o(),n.stack=f,m}o=n.enter("link"),c=n.enter("label");let h=a.move("[");return h+=a.move(n.containerPhrasing(t,{before:h,after:"](",...a.current()})),h+=a.move("]("),c(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(c=n.enter("destinationLiteral"),h+=a.move("<"),h+=a.move(n.safe(t.url,{before:h,after:">",...a.current()})),h+=a.move(">")):(c=n.enter("destinationRaw"),h+=a.move(n.safe(t.url,{before:h,after:t.title?" ":")",...a.current()}))),c(),t.title&&(c=n.enter(`title${i}`),h+=a.move(" "+s),h+=a.move(n.safe(t.title,{before:h,after:s,...a.current()})),h+=a.move(s),c()),h+=a.move(")"),o(),h}function mve(t,e,n){return R$(t,n)?"<":"["}z$.peek=pve;function z$(t,e,n,r){const s=t.referenceType,i=n.enter("linkReference");let a=n.enter("label");const o=n.createTracker(r);let c=o.move("[");const h=n.containerPhrasing(t,{before:c,after:"]",...o.current()});c+=o.move(h+"]["),a();const f=n.stack;n.stack=[],a=n.enter("reference");const m=n.safe(n.associationId(t),{before:c,after:"]",...o.current()});return a(),n.stack=f,i(),s==="full"||!h||h!==m?c+=o.move(m+"]"):s==="shortcut"?c=c.slice(0,-1):c+=o.move("]"),c}function pve(){return"["}function FO(t){const e=t.options.bullet||"*";if(e!=="*"&&e!=="+"&&e!=="-")throw new Error("Cannot serialize items with `"+e+"` for `options.bullet`, expected `*`, `+`, or `-`");return e}function gve(t){const e=FO(t),n=t.options.bulletOther;if(!n)return e==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===e)throw new Error("Expected `bullet` (`"+e+"`) and `bulletOther` (`"+n+"`) to be different");return n}function xve(t){const e=t.options.bulletOrdered||".";if(e!=="."&&e!==")")throw new Error("Cannot serialize items with `"+e+"` for `options.bulletOrdered`, expected `.` or `)`");return e}function P$(t){const e=t.options.rule||"*";if(e!=="*"&&e!=="-"&&e!=="_")throw new Error("Cannot serialize rules with `"+e+"` for `options.rule`, expected `*`, `-`, or `_`");return e}function vve(t,e,n,r){const s=n.enter("list"),i=n.bulletCurrent;let a=t.ordered?xve(n):FO(n);const o=t.ordered?a==="."?")":".":gve(n);let c=e&&n.bulletLastUsed?a===n.bulletLastUsed:!1;if(!t.ordered){const f=t.children?t.children[0]:void 0;if((a==="*"||a==="-")&&f&&(!f.children||!f.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(c=!0),P$(n)===a&&f){let m=-1;for(;++m-1?e.start:1)+(n.options.incrementListMarker===!1?0:e.children.indexOf(t))+i);let a=i.length+1;(s==="tab"||s==="mixed"&&(e&&e.type==="list"&&e.spread||t.spread))&&(a=Math.ceil(a/4)*4);const o=n.createTracker(r);o.move(i+" ".repeat(a-i.length)),o.shift(a);const c=n.enter("listItem"),h=n.indentLines(n.containerFlow(t,o.current()),f);return c(),h;function f(m,g,x){return g?(x?"":" ".repeat(a))+m:(x?i:i+" ".repeat(a-i.length))+m}}function wve(t,e,n,r){const s=n.enter("paragraph"),i=n.enter("phrasing"),a=n.containerPhrasing(t,r);return i(),s(),a}const Sve=op(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function kve(t,e,n,r){return(t.children.some(function(a){return Sve(a)})?n.containerPhrasing:n.containerFlow).call(n,t,r)}function Ove(t){const e=t.options.strong||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize strong with `"+e+"` for `options.strong`, expected `*`, or `_`");return e}L$.peek=jve;function L$(t,e,n,r){const s=Ove(n),i=n.enter("strong"),a=n.createTracker(r),o=a.move(s+s);let c=a.move(n.containerPhrasing(t,{after:s,before:o,...a.current()}));const h=c.charCodeAt(0),f=lv(r.before.charCodeAt(r.before.length-1),h,s);f.inside&&(c=v0(h)+c.slice(1));const m=c.charCodeAt(c.length-1),g=lv(r.after.charCodeAt(0),m,s);g.inside&&(c=c.slice(0,-1)+v0(m));const x=a.move(s+s);return i(),n.attentionEncodeSurroundingInfo={after:g.outside,before:f.outside},o+c+x}function jve(t,e,n){return n.options.strong||"*"}function Nve(t,e,n,r){return n.safe(t.value,r)}function Cve(t){const e=t.options.ruleRepetition||3;if(e<3)throw new Error("Cannot serialize rules with repetition `"+e+"` for `options.ruleRepetition`, expected `3` or more");return e}function Tve(t,e,n){const r=(P$(n)+(n.options.ruleSpaces?" ":"")).repeat(Cve(n));return n.options.ruleSpaces?r.slice(0,-1):r}const I$={blockquote:Z1e,break:$_,code:rve,definition:ive,emphasis:T$,hardBreak:$_,heading:cve,html:E$,image:_$,imageReference:M$,inlineCode:A$,link:D$,linkReference:z$,list:vve,listItem:bve,paragraph:wve,root:kve,strong:L$,text:Nve,thematicBreak:Tve};function Eve(){return{enter:{table:_ve,tableData:Q_,tableHeader:Q_,tableRow:Ave},exit:{codeText:Rve,table:Mve,tableData:g4,tableHeader:g4,tableRow:g4}}}function _ve(t){const e=t._align;this.enter({type:"table",align:e.map(function(n){return n==="none"?null:n}),children:[]},t),this.data.inTable=!0}function Mve(t){this.exit(t),this.data.inTable=void 0}function Ave(t){this.enter({type:"tableRow",children:[]},t)}function g4(t){this.exit(t)}function Q_(t){this.enter({type:"tableCell",children:[]},t)}function Rve(t){let e=this.resume();this.data.inTable&&(e=e.replace(/\\([\\|])/g,Dve));const n=this.stack[this.stack.length-1];n.type,n.value=e,this.exit(t)}function Dve(t,e){return e==="|"?e:t}function zve(t){const e=t||{},n=e.tableCellPadding,r=e.tablePipeAlign,s=e.stringLength,i=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:` +`,...i.current()});return/^[\t ]/.test(h)&&(h=w0(h.charCodeAt(0))+h.slice(1)),h=h?a+" "+h:a,n.options.closeAtx&&(h+=" "+a),c(),o(),h}M$.peek=pve;function M$(t){return t.value||""}function pve(){return"<"}A$.peek=gve;function A$(t,e,n,r){const s=Fj(n),i=s==='"'?"Quote":"Apostrophe",a=n.enter("image");let o=n.enter("label");const c=n.createTracker(r);let h=c.move("![");return h+=c.move(n.safe(t.alt,{before:h,after:"]",...c.current()})),h+=c.move("]("),o(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(o=n.enter("destinationLiteral"),h+=c.move("<"),h+=c.move(n.safe(t.url,{before:h,after:">",...c.current()})),h+=c.move(">")):(o=n.enter("destinationRaw"),h+=c.move(n.safe(t.url,{before:h,after:t.title?" ":")",...c.current()}))),o(),t.title&&(o=n.enter(`title${i}`),h+=c.move(" "+s),h+=c.move(n.safe(t.title,{before:h,after:s,...c.current()})),h+=c.move(s),o()),h+=c.move(")"),a(),h}function gve(){return"!"}R$.peek=xve;function R$(t,e,n,r){const s=t.referenceType,i=n.enter("imageReference");let a=n.enter("label");const o=n.createTracker(r);let c=o.move("![");const h=n.safe(t.alt,{before:c,after:"]",...o.current()});c+=o.move(h+"]["),a();const f=n.stack;n.stack=[],a=n.enter("reference");const m=n.safe(n.associationId(t),{before:c,after:"]",...o.current()});return a(),n.stack=f,i(),s==="full"||!h||h!==m?c+=o.move(m+"]"):s==="shortcut"?c=c.slice(0,-1):c+=o.move("]"),c}function xve(){return"!"}D$.peek=vve;function D$(t,e,n){let r=t.value||"",s="`",i=-1;for(;new RegExp("(^|[^`])"+s+"([^`]|$)").test(r);)s+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++i\u007F]/.test(t.url))}P$.peek=yve;function P$(t,e,n,r){const s=Fj(n),i=s==='"'?"Quote":"Apostrophe",a=n.createTracker(r);let o,c;if(z$(t,n)){const f=n.stack;n.stack=[],o=n.enter("autolink");let m=a.move("<");return m+=a.move(n.containerPhrasing(t,{before:m,after:">",...a.current()})),m+=a.move(">"),o(),n.stack=f,m}o=n.enter("link"),c=n.enter("label");let h=a.move("[");return h+=a.move(n.containerPhrasing(t,{before:h,after:"](",...a.current()})),h+=a.move("]("),c(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(c=n.enter("destinationLiteral"),h+=a.move("<"),h+=a.move(n.safe(t.url,{before:h,after:">",...a.current()})),h+=a.move(">")):(c=n.enter("destinationRaw"),h+=a.move(n.safe(t.url,{before:h,after:t.title?" ":")",...a.current()}))),c(),t.title&&(c=n.enter(`title${i}`),h+=a.move(" "+s),h+=a.move(n.safe(t.title,{before:h,after:s,...a.current()})),h+=a.move(s),c()),h+=a.move(")"),o(),h}function yve(t,e,n){return z$(t,n)?"<":"["}L$.peek=bve;function L$(t,e,n,r){const s=t.referenceType,i=n.enter("linkReference");let a=n.enter("label");const o=n.createTracker(r);let c=o.move("[");const h=n.containerPhrasing(t,{before:c,after:"]",...o.current()});c+=o.move(h+"]["),a();const f=n.stack;n.stack=[],a=n.enter("reference");const m=n.safe(n.associationId(t),{before:c,after:"]",...o.current()});return a(),n.stack=f,i(),s==="full"||!h||h!==m?c+=o.move(m+"]"):s==="shortcut"?c=c.slice(0,-1):c+=o.move("]"),c}function bve(){return"["}function $j(t){const e=t.options.bullet||"*";if(e!=="*"&&e!=="+"&&e!=="-")throw new Error("Cannot serialize items with `"+e+"` for `options.bullet`, expected `*`, `+`, or `-`");return e}function wve(t){const e=$j(t),n=t.options.bulletOther;if(!n)return e==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===e)throw new Error("Expected `bullet` (`"+e+"`) and `bulletOther` (`"+n+"`) to be different");return n}function Sve(t){const e=t.options.bulletOrdered||".";if(e!=="."&&e!==")")throw new Error("Cannot serialize items with `"+e+"` for `options.bulletOrdered`, expected `.` or `)`");return e}function I$(t){const e=t.options.rule||"*";if(e!=="*"&&e!=="-"&&e!=="_")throw new Error("Cannot serialize rules with `"+e+"` for `options.rule`, expected `*`, `-`, or `_`");return e}function kve(t,e,n,r){const s=n.enter("list"),i=n.bulletCurrent;let a=t.ordered?Sve(n):$j(n);const o=t.ordered?a==="."?")":".":wve(n);let c=e&&n.bulletLastUsed?a===n.bulletLastUsed:!1;if(!t.ordered){const f=t.children?t.children[0]:void 0;if((a==="*"||a==="-")&&f&&(!f.children||!f.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(c=!0),I$(n)===a&&f){let m=-1;for(;++m-1?e.start:1)+(n.options.incrementListMarker===!1?0:e.children.indexOf(t))+i);let a=i.length+1;(s==="tab"||s==="mixed"&&(e&&e.type==="list"&&e.spread||t.spread))&&(a=Math.ceil(a/4)*4);const o=n.createTracker(r);o.move(i+" ".repeat(a-i.length)),o.shift(a);const c=n.enter("listItem"),h=n.indentLines(n.containerFlow(t,o.current()),f);return c(),h;function f(m,g,x){return g?(x?"":" ".repeat(a))+m:(x?i:i+" ".repeat(a-i.length))+m}}function Nve(t,e,n,r){const s=n.enter("paragraph"),i=n.enter("phrasing"),a=n.containerPhrasing(t,r);return i(),s(),a}const Cve=dp(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function Tve(t,e,n,r){return(t.children.some(function(a){return Cve(a)})?n.containerPhrasing:n.containerFlow).call(n,t,r)}function Eve(t){const e=t.options.strong||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize strong with `"+e+"` for `options.strong`, expected `*`, or `_`");return e}B$.peek=_ve;function B$(t,e,n,r){const s=Eve(n),i=n.enter("strong"),a=n.createTracker(r),o=a.move(s+s);let c=a.move(n.containerPhrasing(t,{after:s,before:o,...a.current()}));const h=c.charCodeAt(0),f=cv(r.before.charCodeAt(r.before.length-1),h,s);f.inside&&(c=w0(h)+c.slice(1));const m=c.charCodeAt(c.length-1),g=cv(r.after.charCodeAt(0),m,s);g.inside&&(c=c.slice(0,-1)+w0(m));const x=a.move(s+s);return i(),n.attentionEncodeSurroundingInfo={after:g.outside,before:f.outside},o+c+x}function _ve(t,e,n){return n.options.strong||"*"}function Mve(t,e,n,r){return n.safe(t.value,r)}function Ave(t){const e=t.options.ruleRepetition||3;if(e<3)throw new Error("Cannot serialize rules with repetition `"+e+"` for `options.ruleRepetition`, expected `3` or more");return e}function Rve(t,e,n){const r=(I$(n)+(n.options.ruleSpaces?" ":"")).repeat(Ave(n));return n.options.ruleSpaces?r.slice(0,-1):r}const q$={blockquote:rve,break:V_,code:ove,definition:uve,emphasis:_$,hardBreak:V_,heading:mve,html:M$,image:A$,imageReference:R$,inlineCode:D$,link:P$,linkReference:L$,list:kve,listItem:Ove,paragraph:Nve,root:Tve,strong:B$,text:Mve,thematicBreak:Rve};function Dve(){return{enter:{table:zve,tableData:U_,tableHeader:U_,tableRow:Lve},exit:{codeText:Ive,table:Pve,tableData:S4,tableHeader:S4,tableRow:S4}}}function zve(t){const e=t._align;this.enter({type:"table",align:e.map(function(n){return n==="none"?null:n}),children:[]},t),this.data.inTable=!0}function Pve(t){this.exit(t),this.data.inTable=void 0}function Lve(t){this.enter({type:"tableRow",children:[]},t)}function S4(t){this.exit(t)}function U_(t){this.enter({type:"tableCell",children:[]},t)}function Ive(t){let e=this.resume();this.data.inTable&&(e=e.replace(/\\([\\|])/g,Bve));const n=this.stack[this.stack.length-1];n.type,n.value=e,this.exit(t)}function Bve(t,e){return e==="|"?e:t}function qve(t){const e=t||{},n=e.tableCellPadding,r=e.tablePipeAlign,s=e.stringLength,i=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:` `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:g,table:a,tableCell:c,tableRow:o}};function a(x,y,w,S){return h(f(x,w,S),x.align)}function o(x,y,w,S){const k=m(x,w,S),N=h([k]);return N.slice(0,N.indexOf(` -`))}function c(x,y,w,S){const k=w.enter("tableCell"),N=w.enter("phrasing"),C=w.containerPhrasing(x,{...S,before:i,after:i});return N(),k(),C}function h(x,y){return Y1e(x,{align:y,alignDelimiters:r,padding:n,stringLength:s})}function f(x,y,w){const S=x.children;let k=-1;const N=[],C=y.enter("table");for(;++k0&&!n&&(t[t.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const Jve={tokenize:lye,partial:!0};function eye(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:sye,continuation:{tokenize:iye},exit:aye}},text:{91:{name:"gfmFootnoteCall",tokenize:rye},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:tye,resolveTo:nye}}}}function tye(t,e,n){const r=this;let s=r.events.length;const i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a;for(;s--;){const c=r.events[s][1];if(c.type==="labelImage"){a=c;break}if(c.type==="gfmFootnoteCall"||c.type==="labelLink"||c.type==="label"||c.type==="image"||c.type==="link")break}return o;function o(c){if(!a||!a._balanced)return n(c);const h=Na(r.sliceSerialize({start:a.end,end:r.now()}));return h.codePointAt(0)!==94||!i.includes(h.slice(1))?n(c):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(c),t.exit("gfmFootnoteCallLabelMarker"),e(c))}}function nye(t,e){let n=t.length;for(;n--;)if(t[n][1].type==="labelImage"&&t[n][0]==="enter"){t[n][1];break}t[n+1][1].type="data",t[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},t[n+3][1].start),end:Object.assign({},t[t.length-1][1].end)},s={type:"gfmFootnoteCallMarker",start:Object.assign({},t[n+3][1].end),end:Object.assign({},t[n+3][1].end)};s.end.column++,s.end.offset++,s.end._bufferIndex++;const i={type:"gfmFootnoteCallString",start:Object.assign({},s.end),end:Object.assign({},t[t.length-1][1].start)},a={type:"chunkString",contentType:"string",start:Object.assign({},i.start),end:Object.assign({},i.end)},o=[t[n+1],t[n+2],["enter",r,e],t[n+3],t[n+4],["enter",s,e],["exit",s,e],["enter",i,e],["enter",a,e],["exit",a,e],["exit",i,e],t[t.length-2],t[t.length-1],["exit",r,e]];return t.splice(n,t.length-n+1,...o),t}function rye(t,e,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i=0,a;return o;function o(m){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(m),t.exit("gfmFootnoteCallLabelMarker"),c}function c(m){return m!==94?n(m):(t.enter("gfmFootnoteCallMarker"),t.consume(m),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",h)}function h(m){if(i>999||m===93&&!a||m===null||m===91||Vn(m))return n(m);if(m===93){t.exit("chunkString");const g=t.exit("gfmFootnoteCallString");return s.includes(Na(r.sliceSerialize(g)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(m),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),e):n(m)}return Vn(m)||(a=!0),i++,t.consume(m),m===92?f:h}function f(m){return m===91||m===92||m===93?(t.consume(m),i++,h):h(m)}}function sye(t,e,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i,a=0,o;return c;function c(y){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(y),t.exit("gfmFootnoteDefinitionLabelMarker"),h}function h(y){return y===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(y),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",f):n(y)}function f(y){if(a>999||y===93&&!o||y===null||y===91||Vn(y))return n(y);if(y===93){t.exit("chunkString");const w=t.exit("gfmFootnoteDefinitionLabelString");return i=Na(r.sliceSerialize(w)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(y),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),g}return Vn(y)||(o=!0),a++,t.consume(y),y===92?m:f}function m(y){return y===91||y===92||y===93?(t.consume(y),a++,f):f(y)}function g(y){return y===58?(t.enter("definitionMarker"),t.consume(y),t.exit("definitionMarker"),s.includes(i)||s.push(i),Wt(t,x,"gfmFootnoteDefinitionWhitespace")):n(y)}function x(y){return e(y)}}function iye(t,e,n){return t.check(lp,e,t.attempt(Jve,e,n))}function aye(t){t.exit("gfmFootnoteDefinition")}function lye(t,e,n){const r=this;return Wt(t,s,"gfmFootnoteDefinitionIndent",5);function s(i){const a=r.events[r.events.length-1];return a&&a[1].type==="gfmFootnoteDefinitionIndent"&&a[2].sliceSerialize(a[1],!0).length===4?e(i):n(i)}}function oye(t){let n=(t||{}).singleTilde;const r={name:"strikethrough",tokenize:i,resolveAll:s};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function s(a,o){let c=-1;for(;++c1?c(y):(a.consume(y),m++,x);if(m<2&&!n)return c(y);const S=a.exit("strikethroughSequenceTemporary"),k=Ch(y);return S._open=!k||k===2&&!!w,S._close=!w||w===2&&!!k,o(y)}}}class cye{constructor(){this.map=[]}add(e,n,r){uye(this,e,n,r)}consume(e){if(this.map.sort(function(i,a){return i[0]-a[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(e.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),e.length=this.map[n][0];r.push(e.slice()),e.length=0;let s=r.pop();for(;s;){for(const i of s)e.push(i);s=r.pop()}this.map.length=0}}function uye(t,e,n,r){let s=0;if(!(n===0&&r.length===0)){for(;s-1;){const z=r.events[$][1].type;if(z==="lineEnding"||z==="linePrefix")$--;else break}const V=$>-1?r.events[$][1].type:null,ee=V==="tableHead"||V==="tableRow"?E:c;return ee===E&&r.parser.lazy[r.now().line]?n(I):ee(I)}function c(I){return t.enter("tableHead"),t.enter("tableRow"),h(I)}function h(I){return I===124||(a=!0,i+=1),f(I)}function f(I){return I===null?n(I):ut(I)?i>1?(i=0,r.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(I),t.exit("lineEnding"),x):n(I):Zt(I)?Wt(t,f,"whitespace")(I):(i+=1,a&&(a=!1,s+=1),I===124?(t.enter("tableCellDivider"),t.consume(I),t.exit("tableCellDivider"),a=!0,f):(t.enter("data"),m(I)))}function m(I){return I===null||I===124||Vn(I)?(t.exit("data"),f(I)):(t.consume(I),I===92?g:m)}function g(I){return I===92||I===124?(t.consume(I),m):m(I)}function x(I){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(I):(t.enter("tableDelimiterRow"),a=!1,Zt(I)?Wt(t,y,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):y(I))}function y(I){return I===45||I===58?S(I):I===124?(a=!0,t.enter("tableCellDivider"),t.consume(I),t.exit("tableCellDivider"),w):_(I)}function w(I){return Zt(I)?Wt(t,S,"whitespace")(I):S(I)}function S(I){return I===58?(i+=1,a=!0,t.enter("tableDelimiterMarker"),t.consume(I),t.exit("tableDelimiterMarker"),k):I===45?(i+=1,k(I)):I===null||ut(I)?T(I):_(I)}function k(I){return I===45?(t.enter("tableDelimiterFiller"),N(I)):_(I)}function N(I){return I===45?(t.consume(I),N):I===58?(a=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(I),t.exit("tableDelimiterMarker"),C):(t.exit("tableDelimiterFiller"),C(I))}function C(I){return Zt(I)?Wt(t,T,"whitespace")(I):T(I)}function T(I){return I===124?y(I):I===null||ut(I)?!a||s!==i?_(I):(t.exit("tableDelimiterRow"),t.exit("tableHead"),e(I)):_(I)}function _(I){return n(I)}function E(I){return t.enter("tableRow"),M(I)}function M(I){return I===124?(t.enter("tableCellDivider"),t.consume(I),t.exit("tableCellDivider"),M):I===null||ut(I)?(t.exit("tableRow"),e(I)):Zt(I)?Wt(t,M,"whitespace")(I):(t.enter("data"),q(I))}function q(I){return I===null||I===124||Vn(I)?(t.exit("data"),M(I)):(t.consume(I),I===92?L:q)}function L(I){return I===92||I===124?(t.consume(I),q):q(I)}}function mye(t,e){let n=-1,r=!0,s=0,i=[0,0,0,0],a=[0,0,0,0],o=!1,c=0,h,f,m;const g=new cye;for(;++nn[2]+1){const y=n[2]+1,w=n[3]-n[2]-1;t.add(y,w,[])}}t.add(n[3]+1,0,[["exit",m,e]])}return s!==void 0&&(i.end=Object.assign({},Qd(e.events,s)),t.add(s,0,[["exit",i,e]]),i=void 0),i}function V_(t,e,n,r,s){const i=[],a=Qd(e.events,n);s&&(s.end=Object.assign({},a),i.push(["exit",s,e])),r.end=Object.assign({},a),i.push(["exit",r,e]),t.add(n+1,0,i)}function Qd(t,e){const n=t[e],r=n[0]==="enter"?"start":"end";return n[1][r]}const pye={name:"tasklistCheck",tokenize:xye};function gye(){return{text:{91:pye}}}function xye(t,e,n){const r=this;return s;function s(c){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(c):(t.enter("taskListCheck"),t.enter("taskListCheckMarker"),t.consume(c),t.exit("taskListCheckMarker"),i)}function i(c){return Vn(c)?(t.enter("taskListCheckValueUnchecked"),t.consume(c),t.exit("taskListCheckValueUnchecked"),a):c===88||c===120?(t.enter("taskListCheckValueChecked"),t.consume(c),t.exit("taskListCheckValueChecked"),a):n(c)}function a(c){return c===93?(t.enter("taskListCheckMarker"),t.consume(c),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),o):n(c)}function o(c){return ut(c)?e(c):Zt(c)?t.check({tokenize:vye},e,n)(c):n(c)}}function vye(t,e,n){return Wt(t,r,"whitespace");function r(s){return s===null?n(s):e(s)}}function yye(t){return n$([Hve(),eye(),oye(t),hye(),gye()])}const bye={};function wye(t){const e=this,n=t||bye,r=e.data(),s=r.micromarkExtensions||(r.micromarkExtensions=[]),i=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),a=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);s.push(yye(n)),i.push(qve()),a.push(Fve(n))}function Sye(){return{enter:{mathFlow:t,mathFlowFenceMeta:e,mathText:i},exit:{mathFlow:s,mathFlowFence:r,mathFlowFenceMeta:n,mathFlowValue:o,mathText:a,mathTextData:o}};function t(c){const h={type:"element",tagName:"code",properties:{className:["language-math","math-display"]},children:[]};this.enter({type:"math",meta:null,value:"",data:{hName:"pre",hChildren:[h]}},c)}function e(){this.buffer()}function n(){const c=this.resume(),h=this.stack[this.stack.length-1];h.type,h.meta=c}function r(){this.data.mathFlowInside||(this.buffer(),this.data.mathFlowInside=!0)}function s(c){const h=this.resume().replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),f=this.stack[this.stack.length-1];f.type,this.exit(c),f.value=h;const m=f.data.hChildren[0];m.type,m.tagName,m.children.push({type:"text",value:h}),this.data.mathFlowInside=void 0}function i(c){this.enter({type:"inlineMath",value:"",data:{hName:"code",hProperties:{className:["language-math","math-inline"]},hChildren:[]}},c),this.buffer()}function a(c){const h=this.resume(),f=this.stack[this.stack.length-1];f.type,this.exit(c),f.value=h,f.data.hChildren.push({type:"text",value:h})}function o(c){this.config.enter.data.call(this,c),this.config.exit.data.call(this,c)}}function kye(t){let e=(t||{}).singleDollarTextMath;return e==null&&(e=!0),r.peek=s,{unsafe:[{character:"\r",inConstruct:"mathFlowMeta"},{character:` -`,inConstruct:"mathFlowMeta"},{character:"$",after:e?void 0:"\\$",inConstruct:"phrasing"},{character:"$",inConstruct:"mathFlowMeta"},{atBreak:!0,character:"$",after:"\\$"}],handlers:{math:n,inlineMath:r}};function n(i,a,o,c){const h=i.value||"",f=o.createTracker(c),m="$".repeat(Math.max(C$(h,"$")+1,2)),g=o.enter("mathFlow");let x=f.move(m);if(i.meta){const y=o.enter("mathFlowMeta");x+=f.move(o.safe(i.meta,{after:` +`))}function c(x,y,w,S){const k=w.enter("tableCell"),N=w.enter("phrasing"),C=w.containerPhrasing(x,{...S,before:i,after:i});return N(),k(),C}function h(x,y){return tve(x,{align:y,alignDelimiters:r,padding:n,stringLength:s})}function f(x,y,w){const S=x.children;let k=-1;const N=[],C=y.enter("table");for(;++k0&&!n&&(t[t.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const sye={tokenize:hye,partial:!0};function iye(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:cye,continuation:{tokenize:uye},exit:dye}},text:{91:{name:"gfmFootnoteCall",tokenize:oye},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:aye,resolveTo:lye}}}}function aye(t,e,n){const r=this;let s=r.events.length;const i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a;for(;s--;){const c=r.events[s][1];if(c.type==="labelImage"){a=c;break}if(c.type==="gfmFootnoteCall"||c.type==="labelLink"||c.type==="label"||c.type==="image"||c.type==="link")break}return o;function o(c){if(!a||!a._balanced)return n(c);const h=Ta(r.sliceSerialize({start:a.end,end:r.now()}));return h.codePointAt(0)!==94||!i.includes(h.slice(1))?n(c):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(c),t.exit("gfmFootnoteCallLabelMarker"),e(c))}}function lye(t,e){let n=t.length;for(;n--;)if(t[n][1].type==="labelImage"&&t[n][0]==="enter"){t[n][1];break}t[n+1][1].type="data",t[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},t[n+3][1].start),end:Object.assign({},t[t.length-1][1].end)},s={type:"gfmFootnoteCallMarker",start:Object.assign({},t[n+3][1].end),end:Object.assign({},t[n+3][1].end)};s.end.column++,s.end.offset++,s.end._bufferIndex++;const i={type:"gfmFootnoteCallString",start:Object.assign({},s.end),end:Object.assign({},t[t.length-1][1].start)},a={type:"chunkString",contentType:"string",start:Object.assign({},i.start),end:Object.assign({},i.end)},o=[t[n+1],t[n+2],["enter",r,e],t[n+3],t[n+4],["enter",s,e],["exit",s,e],["enter",i,e],["enter",a,e],["exit",a,e],["exit",i,e],t[t.length-2],t[t.length-1],["exit",r,e]];return t.splice(n,t.length-n+1,...o),t}function oye(t,e,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i=0,a;return o;function o(m){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(m),t.exit("gfmFootnoteCallLabelMarker"),c}function c(m){return m!==94?n(m):(t.enter("gfmFootnoteCallMarker"),t.consume(m),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",h)}function h(m){if(i>999||m===93&&!a||m===null||m===91||Yn(m))return n(m);if(m===93){t.exit("chunkString");const g=t.exit("gfmFootnoteCallString");return s.includes(Ta(r.sliceSerialize(g)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(m),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),e):n(m)}return Yn(m)||(a=!0),i++,t.consume(m),m===92?f:h}function f(m){return m===91||m===92||m===93?(t.consume(m),i++,h):h(m)}}function cye(t,e,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i,a=0,o;return c;function c(y){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(y),t.exit("gfmFootnoteDefinitionLabelMarker"),h}function h(y){return y===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(y),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",f):n(y)}function f(y){if(a>999||y===93&&!o||y===null||y===91||Yn(y))return n(y);if(y===93){t.exit("chunkString");const w=t.exit("gfmFootnoteDefinitionLabelString");return i=Ta(r.sliceSerialize(w)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(y),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),g}return Yn(y)||(o=!0),a++,t.consume(y),y===92?m:f}function m(y){return y===91||y===92||y===93?(t.consume(y),a++,f):f(y)}function g(y){return y===58?(t.enter("definitionMarker"),t.consume(y),t.exit("definitionMarker"),s.includes(i)||s.push(i),Zt(t,x,"gfmFootnoteDefinitionWhitespace")):n(y)}function x(y){return e(y)}}function uye(t,e,n){return t.check(up,e,t.attempt(sye,e,n))}function dye(t){t.exit("gfmFootnoteDefinition")}function hye(t,e,n){const r=this;return Zt(t,s,"gfmFootnoteDefinitionIndent",5);function s(i){const a=r.events[r.events.length-1];return a&&a[1].type==="gfmFootnoteDefinitionIndent"&&a[2].sliceSerialize(a[1],!0).length===4?e(i):n(i)}}function fye(t){let n=(t||{}).singleTilde;const r={name:"strikethrough",tokenize:i,resolveAll:s};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function s(a,o){let c=-1;for(;++c1?c(y):(a.consume(y),m++,x);if(m<2&&!n)return c(y);const S=a.exit("strikethroughSequenceTemporary"),k=Ch(y);return S._open=!k||k===2&&!!w,S._close=!w||w===2&&!!k,o(y)}}}class mye{constructor(){this.map=[]}add(e,n,r){pye(this,e,n,r)}consume(e){if(this.map.sort(function(i,a){return i[0]-a[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(e.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),e.length=this.map[n][0];r.push(e.slice()),e.length=0;let s=r.pop();for(;s;){for(const i of s)e.push(i);s=r.pop()}this.map.length=0}}function pye(t,e,n,r){let s=0;if(!(n===0&&r.length===0)){for(;s-1;){const z=r.events[Q][1].type;if(z==="lineEnding"||z==="linePrefix")Q--;else break}const U=Q>-1?r.events[Q][1].type:null,ee=U==="tableHead"||U==="tableRow"?E:c;return ee===E&&r.parser.lazy[r.now().line]?n(I):ee(I)}function c(I){return t.enter("tableHead"),t.enter("tableRow"),h(I)}function h(I){return I===124||(a=!0,i+=1),f(I)}function f(I){return I===null?n(I):ht(I)?i>1?(i=0,r.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(I),t.exit("lineEnding"),x):n(I):nn(I)?Zt(t,f,"whitespace")(I):(i+=1,a&&(a=!1,s+=1),I===124?(t.enter("tableCellDivider"),t.consume(I),t.exit("tableCellDivider"),a=!0,f):(t.enter("data"),m(I)))}function m(I){return I===null||I===124||Yn(I)?(t.exit("data"),f(I)):(t.consume(I),I===92?g:m)}function g(I){return I===92||I===124?(t.consume(I),m):m(I)}function x(I){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(I):(t.enter("tableDelimiterRow"),a=!1,nn(I)?Zt(t,y,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):y(I))}function y(I){return I===45||I===58?S(I):I===124?(a=!0,t.enter("tableCellDivider"),t.consume(I),t.exit("tableCellDivider"),w):_(I)}function w(I){return nn(I)?Zt(t,S,"whitespace")(I):S(I)}function S(I){return I===58?(i+=1,a=!0,t.enter("tableDelimiterMarker"),t.consume(I),t.exit("tableDelimiterMarker"),k):I===45?(i+=1,k(I)):I===null||ht(I)?T(I):_(I)}function k(I){return I===45?(t.enter("tableDelimiterFiller"),N(I)):_(I)}function N(I){return I===45?(t.consume(I),N):I===58?(a=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(I),t.exit("tableDelimiterMarker"),C):(t.exit("tableDelimiterFiller"),C(I))}function C(I){return nn(I)?Zt(t,T,"whitespace")(I):T(I)}function T(I){return I===124?y(I):I===null||ht(I)?!a||s!==i?_(I):(t.exit("tableDelimiterRow"),t.exit("tableHead"),e(I)):_(I)}function _(I){return n(I)}function E(I){return t.enter("tableRow"),M(I)}function M(I){return I===124?(t.enter("tableCellDivider"),t.consume(I),t.exit("tableCellDivider"),M):I===null||ht(I)?(t.exit("tableRow"),e(I)):nn(I)?Zt(t,M,"whitespace")(I):(t.enter("data"),L(I))}function L(I){return I===null||I===124||Yn(I)?(t.exit("data"),M(I)):(t.consume(I),I===92?P:L)}function P(I){return I===92||I===124?(t.consume(I),L):L(I)}}function yye(t,e){let n=-1,r=!0,s=0,i=[0,0,0,0],a=[0,0,0,0],o=!1,c=0,h,f,m;const g=new mye;for(;++nn[2]+1){const y=n[2]+1,w=n[3]-n[2]-1;t.add(y,w,[])}}t.add(n[3]+1,0,[["exit",m,e]])}return s!==void 0&&(i.end=Object.assign({},Vd(e.events,s)),t.add(s,0,[["exit",i,e]]),i=void 0),i}function G_(t,e,n,r,s){const i=[],a=Vd(e.events,n);s&&(s.end=Object.assign({},a),i.push(["exit",s,e])),r.end=Object.assign({},a),i.push(["exit",r,e]),t.add(n+1,0,i)}function Vd(t,e){const n=t[e],r=n[0]==="enter"?"start":"end";return n[1][r]}const bye={name:"tasklistCheck",tokenize:Sye};function wye(){return{text:{91:bye}}}function Sye(t,e,n){const r=this;return s;function s(c){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(c):(t.enter("taskListCheck"),t.enter("taskListCheckMarker"),t.consume(c),t.exit("taskListCheckMarker"),i)}function i(c){return Yn(c)?(t.enter("taskListCheckValueUnchecked"),t.consume(c),t.exit("taskListCheckValueUnchecked"),a):c===88||c===120?(t.enter("taskListCheckValueChecked"),t.consume(c),t.exit("taskListCheckValueChecked"),a):n(c)}function a(c){return c===93?(t.enter("taskListCheckMarker"),t.consume(c),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),o):n(c)}function o(c){return ht(c)?e(c):nn(c)?t.check({tokenize:kye},e,n)(c):n(c)}}function kye(t,e,n){return Zt(t,r,"whitespace");function r(s){return s===null?n(s):e(s)}}function jye(t){return s$([Xve(),iye(),fye(t),xye(),wye()])}const Oye={};function Nye(t){const e=this,n=t||Oye,r=e.data(),s=r.micromarkExtensions||(r.micromarkExtensions=[]),i=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),a=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);s.push(jye(n)),i.push(Vve()),a.push(Uve(n))}function Cye(){return{enter:{mathFlow:t,mathFlowFenceMeta:e,mathText:i},exit:{mathFlow:s,mathFlowFence:r,mathFlowFenceMeta:n,mathFlowValue:o,mathText:a,mathTextData:o}};function t(c){const h={type:"element",tagName:"code",properties:{className:["language-math","math-display"]},children:[]};this.enter({type:"math",meta:null,value:"",data:{hName:"pre",hChildren:[h]}},c)}function e(){this.buffer()}function n(){const c=this.resume(),h=this.stack[this.stack.length-1];h.type,h.meta=c}function r(){this.data.mathFlowInside||(this.buffer(),this.data.mathFlowInside=!0)}function s(c){const h=this.resume().replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),f=this.stack[this.stack.length-1];f.type,this.exit(c),f.value=h;const m=f.data.hChildren[0];m.type,m.tagName,m.children.push({type:"text",value:h}),this.data.mathFlowInside=void 0}function i(c){this.enter({type:"inlineMath",value:"",data:{hName:"code",hProperties:{className:["language-math","math-inline"]},hChildren:[]}},c),this.buffer()}function a(c){const h=this.resume(),f=this.stack[this.stack.length-1];f.type,this.exit(c),f.value=h,f.data.hChildren.push({type:"text",value:h})}function o(c){this.config.enter.data.call(this,c),this.config.exit.data.call(this,c)}}function Tye(t){let e=(t||{}).singleDollarTextMath;return e==null&&(e=!0),r.peek=s,{unsafe:[{character:"\r",inConstruct:"mathFlowMeta"},{character:` +`,inConstruct:"mathFlowMeta"},{character:"$",after:e?void 0:"\\$",inConstruct:"phrasing"},{character:"$",inConstruct:"mathFlowMeta"},{atBreak:!0,character:"$",after:"\\$"}],handlers:{math:n,inlineMath:r}};function n(i,a,o,c){const h=i.value||"",f=o.createTracker(c),m="$".repeat(Math.max(E$(h,"$")+1,2)),g=o.enter("mathFlow");let x=f.move(m);if(i.meta){const y=o.enter("mathFlowMeta");x+=f.move(o.safe(i.meta,{after:` `,before:x,encode:["$"],...f.current()})),y()}return x+=f.move(` `),h&&(x+=f.move(h+` -`)),x+=f.move(m),g(),x}function r(i,a,o){let c=i.value||"",h=1;for(e||h++;new RegExp("(^|[^$])"+"\\$".repeat(h)+"([^$]|$)").test(c);)h++;const f="$".repeat(h);/[^ \r\n]/.test(c)&&(/^[ \r\n]/.test(c)&&/[ \r\n]$/.test(c)||/^\$|\$$/.test(c))&&(c=" "+c+" ");let m=-1;for(;++m15?h="…"+o.slice(s-15,s):h=o.slice(0,s);var f;i+15":">","<":"<",'"':""","'":"'"},zye=/[&><"']/g;function Pye(t){return String(t).replace(zye,e=>Dye[e])}var W$=function t(e){return e.type==="ordgroup"||e.type==="color"?e.body.length===1?t(e.body[0]):e:e.type==="font"?t(e.body):e},Lye=function(e){var n=W$(e);return n.type==="mathord"||n.type==="textord"||n.type==="atom"},Iye=function(e){if(!e)throw new Error("Expected non-null, but got "+String(e));return e},Bye=function(e){var n=/^[\x00-\x20]*([^\\/#?]*?)(:|�*58|�*3a|&colon)/i.exec(e);return n?n[2]!==":"||!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(n[1])?null:n[1].toLowerCase():"_relative"},Nn={deflt:Mye,escape:Pye,hyphenate:Rye,getBaseElem:W$,isCharacterBox:Lye,protocolFromUrl:Bye},g1={displayMode:{type:"boolean",description:"Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.",cli:"-d, --display-mode"},output:{type:{enum:["htmlAndMathml","html","mathml"]},description:"Determines the markup language of the output.",cli:"-F, --format "},leqno:{type:"boolean",description:"Render display math in leqno style (left-justified tags)."},fleqn:{type:"boolean",description:"Render display math flush left."},throwOnError:{type:"boolean",default:!0,cli:"-t, --no-throw-on-error",cliDescription:"Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error."},errorColor:{type:"string",default:"#cc0000",cli:"-c, --error-color ",cliDescription:"A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.",cliProcessor:t=>"#"+t},macros:{type:"object",cli:"-m, --macro ",cliDescription:"Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).",cliDefault:[],cliProcessor:(t,e)=>(e.push(t),e)},minRuleThickness:{type:"number",description:"Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.",processor:t=>Math.max(0,t),cli:"--min-rule-thickness ",cliProcessor:parseFloat},colorIsTextColor:{type:"boolean",description:"Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.",cli:"-b, --color-is-text-color"},strict:{type:[{enum:["warn","ignore","error"]},"boolean","function"],description:"Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.",cli:"-S, --strict",cliDefault:!1},trust:{type:["boolean","function"],description:"Trust the input, enabling all HTML features such as \\url.",cli:"-T, --trust"},maxSize:{type:"number",default:1/0,description:"If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large",processor:t=>Math.max(0,t),cli:"-s, --max-size ",cliProcessor:parseInt},maxExpand:{type:"number",default:1e3,description:"Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.",processor:t=>Math.max(0,t),cli:"-e, --max-expand ",cliProcessor:t=>t==="Infinity"?1/0:parseInt(t)},globalGroup:{type:"boolean",cli:!1}};function qye(t){if(t.default)return t.default;var e=t.type,n=Array.isArray(e)?e[0]:e;if(typeof n!="string")return n.enum[0];switch(n){case"boolean":return!1;case"string":return"";case"number":return 0;case"object":return{}}}class QO{constructor(e){this.displayMode=void 0,this.output=void 0,this.leqno=void 0,this.fleqn=void 0,this.throwOnError=void 0,this.errorColor=void 0,this.macros=void 0,this.minRuleThickness=void 0,this.colorIsTextColor=void 0,this.strict=void 0,this.trust=void 0,this.maxSize=void 0,this.maxExpand=void 0,this.globalGroup=void 0,e=e||{};for(var n in g1)if(g1.hasOwnProperty(n)){var r=g1[n];this[n]=e[n]!==void 0?r.processor?r.processor(e[n]):e[n]:qye(r)}}reportNonstrict(e,n,r){var s=this.strict;if(typeof s=="function"&&(s=s(e,n,r)),!(!s||s==="ignore")){if(s===!0||s==="error")throw new Be("LaTeX-incompatible input and strict mode is set to 'error': "+(n+" ["+e+"]"),r);s==="warn"?typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(n+" ["+e+"]")):typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+s+"': "+n+" ["+e+"]"))}}useStrictBehavior(e,n,r){var s=this.strict;if(typeof s=="function")try{s=s(e,n,r)}catch{s="error"}return!s||s==="ignore"?!1:s===!0||s==="error"?!0:s==="warn"?(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(n+" ["+e+"]")),!1):(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+s+"': "+n+" ["+e+"]")),!1)}isTrusted(e){if(e.url&&!e.protocol){var n=Nn.protocolFromUrl(e.url);if(n==null)return!1;e.protocol=n}var r=typeof this.trust=="function"?this.trust(e):this.trust;return!!r}}class ec{constructor(e,n,r){this.id=void 0,this.size=void 0,this.cramped=void 0,this.id=e,this.size=n,this.cramped=r}sup(){return Ga[Fye[this.id]]}sub(){return Ga[$ye[this.id]]}fracNum(){return Ga[Qye[this.id]]}fracDen(){return Ga[Hye[this.id]]}cramp(){return Ga[Vye[this.id]]}text(){return Ga[Uye[this.id]]}isTight(){return this.size>=2}}var HO=0,ov=1,oh=2,lo=3,y0=4,ea=5,Th=6,As=7,Ga=[new ec(HO,0,!1),new ec(ov,0,!0),new ec(oh,1,!1),new ec(lo,1,!0),new ec(y0,2,!1),new ec(ea,2,!0),new ec(Th,3,!1),new ec(As,3,!0)],Fye=[y0,ea,y0,ea,Th,As,Th,As],$ye=[ea,ea,ea,ea,As,As,As,As],Qye=[oh,lo,y0,ea,Th,As,Th,As],Hye=[lo,lo,ea,ea,As,As,As,As],Vye=[ov,ov,lo,lo,ea,ea,As,As],Uye=[HO,ov,oh,lo,oh,lo,oh,lo],kt={DISPLAY:Ga[HO],TEXT:Ga[oh],SCRIPT:Ga[y0],SCRIPTSCRIPT:Ga[Th]},sk=[{name:"latin",blocks:[[256,591],[768,879]]},{name:"cyrillic",blocks:[[1024,1279]]},{name:"armenian",blocks:[[1328,1423]]},{name:"brahmic",blocks:[[2304,4255]]},{name:"georgian",blocks:[[4256,4351]]},{name:"cjk",blocks:[[12288,12543],[19968,40879],[65280,65376]]},{name:"hangul",blocks:[[44032,55215]]}];function Wye(t){for(var e=0;e=s[0]&&t<=s[1])return n.name}return null}var x1=[];sk.forEach(t=>t.blocks.forEach(e=>x1.push(...e)));function G$(t){for(var e=0;e=x1[e]&&t<=x1[e+1])return!0;return!1}var Ed=80,Gye=function(e,n){return"M95,"+(622+e+n)+` +`)),x+=f.move(m),g(),x}function r(i,a,o){let c=i.value||"",h=1;for(e||h++;new RegExp("(^|[^$])"+"\\$".repeat(h)+"([^$]|$)").test(c);)h++;const f="$".repeat(h);/[^ \r\n]/.test(c)&&(/^[ \r\n]/.test(c)&&/[ \r\n]$/.test(c)||/^\$|\$$/.test(c))&&(c=" "+c+" ");let m=-1;for(;++m15?h="…"+o.slice(s-15,s):h=o.slice(0,s);var f;i+15":">","<":"<",'"':""","'":"'"},qye=/[&><"']/g;function Fye(t){return String(t).replace(qye,e=>Bye[e])}var X$=function t(e){return e.type==="ordgroup"||e.type==="color"?e.body.length===1?t(e.body[0]):e:e.type==="font"?t(e.body):e},$ye=function(e){var n=X$(e);return n.type==="mathord"||n.type==="textord"||n.type==="atom"},Qye=function(e){if(!e)throw new Error("Expected non-null, but got "+String(e));return e},Hye=function(e){var n=/^[\x00-\x20]*([^\\/#?]*?)(:|�*58|�*3a|&colon)/i.exec(e);return n?n[2]!==":"||!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(n[1])?null:n[1].toLowerCase():"_relative"},Mn={deflt:Pye,escape:Fye,hyphenate:Iye,getBaseElem:X$,isCharacterBox:$ye,protocolFromUrl:Hye},v1={displayMode:{type:"boolean",description:"Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.",cli:"-d, --display-mode"},output:{type:{enum:["htmlAndMathml","html","mathml"]},description:"Determines the markup language of the output.",cli:"-F, --format "},leqno:{type:"boolean",description:"Render display math in leqno style (left-justified tags)."},fleqn:{type:"boolean",description:"Render display math flush left."},throwOnError:{type:"boolean",default:!0,cli:"-t, --no-throw-on-error",cliDescription:"Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error."},errorColor:{type:"string",default:"#cc0000",cli:"-c, --error-color ",cliDescription:"A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.",cliProcessor:t=>"#"+t},macros:{type:"object",cli:"-m, --macro ",cliDescription:"Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).",cliDefault:[],cliProcessor:(t,e)=>(e.push(t),e)},minRuleThickness:{type:"number",description:"Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.",processor:t=>Math.max(0,t),cli:"--min-rule-thickness ",cliProcessor:parseFloat},colorIsTextColor:{type:"boolean",description:"Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.",cli:"-b, --color-is-text-color"},strict:{type:[{enum:["warn","ignore","error"]},"boolean","function"],description:"Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.",cli:"-S, --strict",cliDefault:!1},trust:{type:["boolean","function"],description:"Trust the input, enabling all HTML features such as \\url.",cli:"-T, --trust"},maxSize:{type:"number",default:1/0,description:"If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large",processor:t=>Math.max(0,t),cli:"-s, --max-size ",cliProcessor:parseInt},maxExpand:{type:"number",default:1e3,description:"Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.",processor:t=>Math.max(0,t),cli:"-e, --max-expand ",cliProcessor:t=>t==="Infinity"?1/0:parseInt(t)},globalGroup:{type:"boolean",cli:!1}};function Vye(t){if(t.default)return t.default;var e=t.type,n=Array.isArray(e)?e[0]:e;if(typeof n!="string")return n.enum[0];switch(n){case"boolean":return!1;case"string":return"";case"number":return 0;case"object":return{}}}class Hj{constructor(e){this.displayMode=void 0,this.output=void 0,this.leqno=void 0,this.fleqn=void 0,this.throwOnError=void 0,this.errorColor=void 0,this.macros=void 0,this.minRuleThickness=void 0,this.colorIsTextColor=void 0,this.strict=void 0,this.trust=void 0,this.maxSize=void 0,this.maxExpand=void 0,this.globalGroup=void 0,e=e||{};for(var n in v1)if(v1.hasOwnProperty(n)){var r=v1[n];this[n]=e[n]!==void 0?r.processor?r.processor(e[n]):e[n]:Vye(r)}}reportNonstrict(e,n,r){var s=this.strict;if(typeof s=="function"&&(s=s(e,n,r)),!(!s||s==="ignore")){if(s===!0||s==="error")throw new $e("LaTeX-incompatible input and strict mode is set to 'error': "+(n+" ["+e+"]"),r);s==="warn"?typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(n+" ["+e+"]")):typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+s+"': "+n+" ["+e+"]"))}}useStrictBehavior(e,n,r){var s=this.strict;if(typeof s=="function")try{s=s(e,n,r)}catch{s="error"}return!s||s==="ignore"?!1:s===!0||s==="error"?!0:s==="warn"?(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(n+" ["+e+"]")),!1):(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+s+"': "+n+" ["+e+"]")),!1)}isTrusted(e){if(e.url&&!e.protocol){var n=Mn.protocolFromUrl(e.url);if(n==null)return!1;e.protocol=n}var r=typeof this.trust=="function"?this.trust(e):this.trust;return!!r}}class ec{constructor(e,n,r){this.id=void 0,this.size=void 0,this.cramped=void 0,this.id=e,this.size=n,this.cramped=r}sup(){return Ka[Uye[this.id]]}sub(){return Ka[Wye[this.id]]}fracNum(){return Ka[Gye[this.id]]}fracDen(){return Ka[Xye[this.id]]}cramp(){return Ka[Yye[this.id]]}text(){return Ka[Kye[this.id]]}isTight(){return this.size>=2}}var Vj=0,uv=1,uh=2,co=3,S0=4,ta=5,Th=6,Ps=7,Ka=[new ec(Vj,0,!1),new ec(uv,0,!0),new ec(uh,1,!1),new ec(co,1,!0),new ec(S0,2,!1),new ec(ta,2,!0),new ec(Th,3,!1),new ec(Ps,3,!0)],Uye=[S0,ta,S0,ta,Th,Ps,Th,Ps],Wye=[ta,ta,ta,ta,Ps,Ps,Ps,Ps],Gye=[uh,co,S0,ta,Th,Ps,Th,Ps],Xye=[co,co,ta,ta,Ps,Ps,Ps,Ps],Yye=[uv,uv,co,co,ta,ta,Ps,Ps],Kye=[Vj,uv,uh,co,uh,co,uh,co],St={DISPLAY:Ka[Vj],TEXT:Ka[uh],SCRIPT:Ka[S0],SCRIPTSCRIPT:Ka[Th]},uk=[{name:"latin",blocks:[[256,591],[768,879]]},{name:"cyrillic",blocks:[[1024,1279]]},{name:"armenian",blocks:[[1328,1423]]},{name:"brahmic",blocks:[[2304,4255]]},{name:"georgian",blocks:[[4256,4351]]},{name:"cjk",blocks:[[12288,12543],[19968,40879],[65280,65376]]},{name:"hangul",blocks:[[44032,55215]]}];function Zye(t){for(var e=0;e=s[0]&&t<=s[1])return n.name}return null}var y1=[];uk.forEach(t=>t.blocks.forEach(e=>y1.push(...e)));function Y$(t){for(var e=0;e=y1[e]&&t<=y1[e+1])return!0;return!1}var Md=80,Jye=function(e,n){return"M95,"+(622+e+n)+` c-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14 c0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54 c44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10 @@ -108,7 +108,7 @@ c5.3,-9.3,12,-14,20,-14 H400000v`+(40+e)+`H845.2724 s-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7 c-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z -M`+(834+e)+" "+n+"h400000v"+(40+e)+"h-400000z"},Xye=function(e,n){return"M263,"+(601+e+n)+`c0.7,0,18,39.7,52,119 +M`+(834+e)+" "+n+"h400000v"+(40+e)+"h-400000z"},ebe=function(e,n){return"M263,"+(601+e+n)+`c0.7,0,18,39.7,52,119 c34,79.3,68.167,158.7,102.5,238c34.3,79.3,51.8,119.3,52.5,120 c340,-704.7,510.7,-1060.3,512,-1067 l`+e/2.084+" -"+e+` @@ -118,7 +118,7 @@ s-271.3,567,-271.3,567c-38.7,80.7,-84,175,-136,283c-52,108,-89.167,185.3,-111.5, c-22.3,46.7,-33.8,70.3,-34.5,71c-4.7,4.7,-12.3,7,-23,7s-12,-1,-12,-1 s-109,-253,-109,-253c-72.7,-168,-109.3,-252,-110,-252c-10.7,8,-22,16.7,-34,26 c-22,17.3,-33.3,26,-34,26s-26,-26,-26,-26s76,-59,76,-59s76,-60,76,-60z -M`+(1001+e)+" "+n+"h400000v"+(40+e)+"h-400000z"},Yye=function(e,n){return"M983 "+(10+e+n)+` +M`+(1001+e)+" "+n+"h400000v"+(40+e)+"h-400000z"},tbe=function(e,n){return"M983 "+(10+e+n)+` l`+e/3.13+" -"+e+` c4,-6.7,10,-10,18,-10 H400000v`+(40+e)+` H1013.1s-83.4,268,-264.1,840c-180.7,572,-277,876.3,-289,913c-4.7,4.7,-12.7,7,-24,7 @@ -127,7 +127,7 @@ c-10,12,-21,25,-33,39s-32,39,-32,39c-6,-5.3,-15,-14,-27,-26s25,-30,25,-30 c26.7,-32.7,52,-63,76,-91s52,-60,52,-60s208,722,208,722 c56,-175.3,126.3,-397.3,211,-666c84.7,-268.7,153.8,-488.2,207.5,-658.5 c53.7,-170.3,84.5,-266.8,92.5,-289.5z -M`+(1001+e)+" "+n+"h400000v"+(40+e)+"h-400000z"},Kye=function(e,n){return"M424,"+(2398+e+n)+` +M`+(1001+e)+" "+n+"h400000v"+(40+e)+"h-400000z"},nbe=function(e,n){return"M424,"+(2398+e+n)+` c-1.3,-0.7,-38.5,-172,-111.5,-514c-73,-342,-109.8,-513.3,-110.5,-514 c0,-2,-10.7,14.3,-32,49c-4.7,7.3,-9.8,15.7,-15.5,25c-5.7,9.3,-9.8,16,-12.5,20 s-5,7,-5,7c-4,-3.3,-8.3,-7.7,-13,-13s-13,-13,-13,-13s76,-122,76,-122s77,-121,77,-121 @@ -137,18 +137,18 @@ v`+(40+e)+`H1014.6 s-87.3,378.7,-272.6,1166c-185.3,787.3,-279.3,1182.3,-282,1185 c-2,6,-10,9,-24,9 c-8,0,-12,-0.7,-12,-2z M`+(1001+e)+" "+n+` -h400000v`+(40+e)+"h-400000z"},Zye=function(e,n){return"M473,"+(2713+e+n)+` +h400000v`+(40+e)+"h-400000z"},rbe=function(e,n){return"M473,"+(2713+e+n)+` c339.3,-1799.3,509.3,-2700,510,-2702 l`+e/5.298+" -"+e+` c3.3,-7.3,9.3,-11,18,-11 H400000v`+(40+e)+`H1017.7 s-90.5,478,-276.2,1466c-185.7,988,-279.5,1483,-281.5,1485c-2,6,-10,9,-24,9 c-8,0,-12,-0.7,-12,-2c0,-1.3,-5.3,-32,-16,-92c-50.7,-293.3,-119.7,-693.3,-207,-1200 c0,-1.3,-5.3,8.7,-16,30c-10.7,21.3,-21.3,42.7,-32,64s-16,33,-16,33s-26,-26,-26,-26 s76,-153,76,-153s77,-151,77,-151c0.7,0.7,35.7,202,105,604c67.3,400.7,102,602.7,104, -606zM`+(1001+e)+" "+n+"h400000v"+(40+e)+"H1017.7z"},Jye=function(e){var n=e/2;return"M400000 "+e+" H0 L"+n+" 0 l65 45 L145 "+(e-80)+" H400000z"},ebe=function(e,n,r){var s=r-54-n-e;return"M702 "+(e+n)+"H400000"+(40+e)+` +606zM`+(1001+e)+" "+n+"h400000v"+(40+e)+"H1017.7z"},sbe=function(e){var n=e/2;return"M400000 "+e+" H0 L"+n+" 0 l65 45 L145 "+(e-80)+" H400000z"},ibe=function(e,n,r){var s=r-54-n-e;return"M702 "+(e+n)+"H400000"+(40+e)+` H742v`+s+`l-4 4-4 4c-.667.7 -2 1.5-4 2.5s-4.167 1.833-6.5 2.5-5.5 1-9.5 1 h-12l-28-84c-16.667-52-96.667 -294.333-240-727l-212 -643 -85 170 c-4-3.333-8.333-7.667-13 -13l-13-13l77-155 77-156c66 199.333 139 419.667 -219 661 l218 661zM702 `+n+"H400000v"+(40+e)+"H742z"},tbe=function(e,n,r){n=1e3*n;var s="";switch(e){case"sqrtMain":s=Gye(n,Ed);break;case"sqrtSize1":s=Xye(n,Ed);break;case"sqrtSize2":s=Yye(n,Ed);break;case"sqrtSize3":s=Kye(n,Ed);break;case"sqrtSize4":s=Zye(n,Ed);break;case"sqrtTall":s=ebe(n,Ed,r)}return s},nbe=function(e,n){switch(e){case"⎜":return"M291 0 H417 V"+n+" H291z M291 0 H417 V"+n+" H291z";case"∣":return"M145 0 H188 V"+n+" H145z M145 0 H188 V"+n+" H145z";case"∥":return"M145 0 H188 V"+n+" H145z M145 0 H188 V"+n+" H145z"+("M367 0 H410 V"+n+" H367z M367 0 H410 V"+n+" H367z");case"⎟":return"M457 0 H583 V"+n+" H457z M457 0 H583 V"+n+" H457z";case"⎢":return"M319 0 H403 V"+n+" H319z M319 0 H403 V"+n+" H319z";case"⎥":return"M263 0 H347 V"+n+" H263z M263 0 H347 V"+n+" H263z";case"⎪":return"M384 0 H504 V"+n+" H384z M384 0 H504 V"+n+" H384z";case"⏐":return"M312 0 H355 V"+n+" H312z M312 0 H355 V"+n+" H312z";case"‖":return"M257 0 H300 V"+n+" H257z M257 0 H300 V"+n+" H257z"+("M478 0 H521 V"+n+" H478z M478 0 H521 V"+n+" H478z");default:return""}},W_={doubleleftarrow:`M262 157 +219 661 l218 661zM702 `+n+"H400000v"+(40+e)+"H742z"},abe=function(e,n,r){n=1e3*n;var s="";switch(e){case"sqrtMain":s=Jye(n,Md);break;case"sqrtSize1":s=ebe(n,Md);break;case"sqrtSize2":s=tbe(n,Md);break;case"sqrtSize3":s=nbe(n,Md);break;case"sqrtSize4":s=rbe(n,Md);break;case"sqrtTall":s=ibe(n,Md,r)}return s},lbe=function(e,n){switch(e){case"⎜":return"M291 0 H417 V"+n+" H291z M291 0 H417 V"+n+" H291z";case"∣":return"M145 0 H188 V"+n+" H145z M145 0 H188 V"+n+" H145z";case"∥":return"M145 0 H188 V"+n+" H145z M145 0 H188 V"+n+" H145z"+("M367 0 H410 V"+n+" H367z M367 0 H410 V"+n+" H367z");case"⎟":return"M457 0 H583 V"+n+" H457z M457 0 H583 V"+n+" H457z";case"⎢":return"M319 0 H403 V"+n+" H319z M319 0 H403 V"+n+" H319z";case"⎥":return"M263 0 H347 V"+n+" H263z M263 0 H347 V"+n+" H263z";case"⎪":return"M384 0 H504 V"+n+" H384z M384 0 H504 V"+n+" H384z";case"⏐":return"M312 0 H355 V"+n+" H312z M312 0 H355 V"+n+" H312z";case"‖":return"M257 0 H300 V"+n+" H257z M257 0 H300 V"+n+" H257z"+("M478 0 H521 V"+n+" H478z M478 0 H521 V"+n+" H478z");default:return""}},Y_={doubleleftarrow:`M262 157 l10-10c34-36 62.7-77 86-123 3.3-8 5-13.3 5-16 0-5.3-6.7-8-20-8-7.3 0-12.2.5-14.5 1.5-2.3 1-4.8 4.5-7.5 10.5-49.3 97.3-121.7 169.3-217 216-28 14-57.3 25-88 33-6.7 2-11 3.8-13 5.5-2 1.7-3 4.2-3 7.5s1 5.8 3 7.5 @@ -323,7 +323,7 @@ M93 435 v40 H400000 v-40z M500 241 v40 H400000 v-40z M500 241 v40 H400000 v-40z` c4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199, -231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6 c-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z -M500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z`},rbe=function(e,n){switch(e){case"lbrack":return"M403 1759 V84 H666 V0 H319 V1759 v"+n+` v1759 h347 v-84 +M500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z`},obe=function(e,n){switch(e){case"lbrack":return"M403 1759 V84 H666 V0 H319 V1759 v"+n+` v1759 h347 v-84 H403z M403 1759 V0 H319 V1759 v`+n+" v1759 h84z";case"rbrack":return"M347 1759 V0 H0 V84 H263 V1759 v"+n+` v1759 H0 v84 H347z M347 1759 V0 H263 V1759 v`+n+" v1759 h84z";case"vert":return"M145 15 v585 v"+n+` v585 c2.667,10,9.667,15,21,15 c10,0,16.667,-5,20,-15 v-585 v`+-n+` v-585 c-2.667,-10,-9.667,-15,-21,-15 @@ -351,21 +351,21 @@ c-55.7,194.7,-131.8,370.3,-228.5,527c-20.7,34.7,-41.7,66.3,-63,95c-2,3.3,-4,7,-6 c0,7.3,5.7,11,17,11c0,0,11,0,11,0c9.3,0,14.3,-0.3,15,-1c5.3,-5.3,10.3,-11,15,-17 c242.7,-294.7,395.3,-681.7,458,-1161c21.3,-164.7,33.3,-350.7,36,-558 l0,-`+(n+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7, --470,-1265c-4.7,-6,-9.7,-11.7,-15,-17c-0.7,-0.7,-6.7,-1,-18,-1z`;default:throw new Error("Unknown stretchy delimiter.")}};class up{constructor(e){this.children=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.children=e,this.classes=[],this.height=0,this.depth=0,this.maxFontSize=0,this.style={}}hasClass(e){return this.classes.includes(e)}toNode(){for(var e=document.createDocumentFragment(),n=0;nn.toText();return this.children.map(e).join("")}}var nl={"AMS-Regular":{32:[0,0,0,0,.25],65:[0,.68889,0,0,.72222],66:[0,.68889,0,0,.66667],67:[0,.68889,0,0,.72222],68:[0,.68889,0,0,.72222],69:[0,.68889,0,0,.66667],70:[0,.68889,0,0,.61111],71:[0,.68889,0,0,.77778],72:[0,.68889,0,0,.77778],73:[0,.68889,0,0,.38889],74:[.16667,.68889,0,0,.5],75:[0,.68889,0,0,.77778],76:[0,.68889,0,0,.66667],77:[0,.68889,0,0,.94445],78:[0,.68889,0,0,.72222],79:[.16667,.68889,0,0,.77778],80:[0,.68889,0,0,.61111],81:[.16667,.68889,0,0,.77778],82:[0,.68889,0,0,.72222],83:[0,.68889,0,0,.55556],84:[0,.68889,0,0,.66667],85:[0,.68889,0,0,.72222],86:[0,.68889,0,0,.72222],87:[0,.68889,0,0,1],88:[0,.68889,0,0,.72222],89:[0,.68889,0,0,.72222],90:[0,.68889,0,0,.66667],107:[0,.68889,0,0,.55556],160:[0,0,0,0,.25],165:[0,.675,.025,0,.75],174:[.15559,.69224,0,0,.94666],240:[0,.68889,0,0,.55556],295:[0,.68889,0,0,.54028],710:[0,.825,0,0,2.33334],732:[0,.9,0,0,2.33334],770:[0,.825,0,0,2.33334],771:[0,.9,0,0,2.33334],989:[.08167,.58167,0,0,.77778],1008:[0,.43056,.04028,0,.66667],8245:[0,.54986,0,0,.275],8463:[0,.68889,0,0,.54028],8487:[0,.68889,0,0,.72222],8498:[0,.68889,0,0,.55556],8502:[0,.68889,0,0,.66667],8503:[0,.68889,0,0,.44445],8504:[0,.68889,0,0,.66667],8513:[0,.68889,0,0,.63889],8592:[-.03598,.46402,0,0,.5],8594:[-.03598,.46402,0,0,.5],8602:[-.13313,.36687,0,0,1],8603:[-.13313,.36687,0,0,1],8606:[.01354,.52239,0,0,1],8608:[.01354,.52239,0,0,1],8610:[.01354,.52239,0,0,1.11111],8611:[.01354,.52239,0,0,1.11111],8619:[0,.54986,0,0,1],8620:[0,.54986,0,0,1],8621:[-.13313,.37788,0,0,1.38889],8622:[-.13313,.36687,0,0,1],8624:[0,.69224,0,0,.5],8625:[0,.69224,0,0,.5],8630:[0,.43056,0,0,1],8631:[0,.43056,0,0,1],8634:[.08198,.58198,0,0,.77778],8635:[.08198,.58198,0,0,.77778],8638:[.19444,.69224,0,0,.41667],8639:[.19444,.69224,0,0,.41667],8642:[.19444,.69224,0,0,.41667],8643:[.19444,.69224,0,0,.41667],8644:[.1808,.675,0,0,1],8646:[.1808,.675,0,0,1],8647:[.1808,.675,0,0,1],8648:[.19444,.69224,0,0,.83334],8649:[.1808,.675,0,0,1],8650:[.19444,.69224,0,0,.83334],8651:[.01354,.52239,0,0,1],8652:[.01354,.52239,0,0,1],8653:[-.13313,.36687,0,0,1],8654:[-.13313,.36687,0,0,1],8655:[-.13313,.36687,0,0,1],8666:[.13667,.63667,0,0,1],8667:[.13667,.63667,0,0,1],8669:[-.13313,.37788,0,0,1],8672:[-.064,.437,0,0,1.334],8674:[-.064,.437,0,0,1.334],8705:[0,.825,0,0,.5],8708:[0,.68889,0,0,.55556],8709:[.08167,.58167,0,0,.77778],8717:[0,.43056,0,0,.42917],8722:[-.03598,.46402,0,0,.5],8724:[.08198,.69224,0,0,.77778],8726:[.08167,.58167,0,0,.77778],8733:[0,.69224,0,0,.77778],8736:[0,.69224,0,0,.72222],8737:[0,.69224,0,0,.72222],8738:[.03517,.52239,0,0,.72222],8739:[.08167,.58167,0,0,.22222],8740:[.25142,.74111,0,0,.27778],8741:[.08167,.58167,0,0,.38889],8742:[.25142,.74111,0,0,.5],8756:[0,.69224,0,0,.66667],8757:[0,.69224,0,0,.66667],8764:[-.13313,.36687,0,0,.77778],8765:[-.13313,.37788,0,0,.77778],8769:[-.13313,.36687,0,0,.77778],8770:[-.03625,.46375,0,0,.77778],8774:[.30274,.79383,0,0,.77778],8776:[-.01688,.48312,0,0,.77778],8778:[.08167,.58167,0,0,.77778],8782:[.06062,.54986,0,0,.77778],8783:[.06062,.54986,0,0,.77778],8785:[.08198,.58198,0,0,.77778],8786:[.08198,.58198,0,0,.77778],8787:[.08198,.58198,0,0,.77778],8790:[0,.69224,0,0,.77778],8791:[.22958,.72958,0,0,.77778],8796:[.08198,.91667,0,0,.77778],8806:[.25583,.75583,0,0,.77778],8807:[.25583,.75583,0,0,.77778],8808:[.25142,.75726,0,0,.77778],8809:[.25142,.75726,0,0,.77778],8812:[.25583,.75583,0,0,.5],8814:[.20576,.70576,0,0,.77778],8815:[.20576,.70576,0,0,.77778],8816:[.30274,.79383,0,0,.77778],8817:[.30274,.79383,0,0,.77778],8818:[.22958,.72958,0,0,.77778],8819:[.22958,.72958,0,0,.77778],8822:[.1808,.675,0,0,.77778],8823:[.1808,.675,0,0,.77778],8828:[.13667,.63667,0,0,.77778],8829:[.13667,.63667,0,0,.77778],8830:[.22958,.72958,0,0,.77778],8831:[.22958,.72958,0,0,.77778],8832:[.20576,.70576,0,0,.77778],8833:[.20576,.70576,0,0,.77778],8840:[.30274,.79383,0,0,.77778],8841:[.30274,.79383,0,0,.77778],8842:[.13597,.63597,0,0,.77778],8843:[.13597,.63597,0,0,.77778],8847:[.03517,.54986,0,0,.77778],8848:[.03517,.54986,0,0,.77778],8858:[.08198,.58198,0,0,.77778],8859:[.08198,.58198,0,0,.77778],8861:[.08198,.58198,0,0,.77778],8862:[0,.675,0,0,.77778],8863:[0,.675,0,0,.77778],8864:[0,.675,0,0,.77778],8865:[0,.675,0,0,.77778],8872:[0,.69224,0,0,.61111],8873:[0,.69224,0,0,.72222],8874:[0,.69224,0,0,.88889],8876:[0,.68889,0,0,.61111],8877:[0,.68889,0,0,.61111],8878:[0,.68889,0,0,.72222],8879:[0,.68889,0,0,.72222],8882:[.03517,.54986,0,0,.77778],8883:[.03517,.54986,0,0,.77778],8884:[.13667,.63667,0,0,.77778],8885:[.13667,.63667,0,0,.77778],8888:[0,.54986,0,0,1.11111],8890:[.19444,.43056,0,0,.55556],8891:[.19444,.69224,0,0,.61111],8892:[.19444,.69224,0,0,.61111],8901:[0,.54986,0,0,.27778],8903:[.08167,.58167,0,0,.77778],8905:[.08167,.58167,0,0,.77778],8906:[.08167,.58167,0,0,.77778],8907:[0,.69224,0,0,.77778],8908:[0,.69224,0,0,.77778],8909:[-.03598,.46402,0,0,.77778],8910:[0,.54986,0,0,.76042],8911:[0,.54986,0,0,.76042],8912:[.03517,.54986,0,0,.77778],8913:[.03517,.54986,0,0,.77778],8914:[0,.54986,0,0,.66667],8915:[0,.54986,0,0,.66667],8916:[0,.69224,0,0,.66667],8918:[.0391,.5391,0,0,.77778],8919:[.0391,.5391,0,0,.77778],8920:[.03517,.54986,0,0,1.33334],8921:[.03517,.54986,0,0,1.33334],8922:[.38569,.88569,0,0,.77778],8923:[.38569,.88569,0,0,.77778],8926:[.13667,.63667,0,0,.77778],8927:[.13667,.63667,0,0,.77778],8928:[.30274,.79383,0,0,.77778],8929:[.30274,.79383,0,0,.77778],8934:[.23222,.74111,0,0,.77778],8935:[.23222,.74111,0,0,.77778],8936:[.23222,.74111,0,0,.77778],8937:[.23222,.74111,0,0,.77778],8938:[.20576,.70576,0,0,.77778],8939:[.20576,.70576,0,0,.77778],8940:[.30274,.79383,0,0,.77778],8941:[.30274,.79383,0,0,.77778],8994:[.19444,.69224,0,0,.77778],8995:[.19444,.69224,0,0,.77778],9416:[.15559,.69224,0,0,.90222],9484:[0,.69224,0,0,.5],9488:[0,.69224,0,0,.5],9492:[0,.37788,0,0,.5],9496:[0,.37788,0,0,.5],9585:[.19444,.68889,0,0,.88889],9586:[.19444,.74111,0,0,.88889],9632:[0,.675,0,0,.77778],9633:[0,.675,0,0,.77778],9650:[0,.54986,0,0,.72222],9651:[0,.54986,0,0,.72222],9654:[.03517,.54986,0,0,.77778],9660:[0,.54986,0,0,.72222],9661:[0,.54986,0,0,.72222],9664:[.03517,.54986,0,0,.77778],9674:[.11111,.69224,0,0,.66667],9733:[.19444,.69224,0,0,.94445],10003:[0,.69224,0,0,.83334],10016:[0,.69224,0,0,.83334],10731:[.11111,.69224,0,0,.66667],10846:[.19444,.75583,0,0,.61111],10877:[.13667,.63667,0,0,.77778],10878:[.13667,.63667,0,0,.77778],10885:[.25583,.75583,0,0,.77778],10886:[.25583,.75583,0,0,.77778],10887:[.13597,.63597,0,0,.77778],10888:[.13597,.63597,0,0,.77778],10889:[.26167,.75726,0,0,.77778],10890:[.26167,.75726,0,0,.77778],10891:[.48256,.98256,0,0,.77778],10892:[.48256,.98256,0,0,.77778],10901:[.13667,.63667,0,0,.77778],10902:[.13667,.63667,0,0,.77778],10933:[.25142,.75726,0,0,.77778],10934:[.25142,.75726,0,0,.77778],10935:[.26167,.75726,0,0,.77778],10936:[.26167,.75726,0,0,.77778],10937:[.26167,.75726,0,0,.77778],10938:[.26167,.75726,0,0,.77778],10949:[.25583,.75583,0,0,.77778],10950:[.25583,.75583,0,0,.77778],10955:[.28481,.79383,0,0,.77778],10956:[.28481,.79383,0,0,.77778],57350:[.08167,.58167,0,0,.22222],57351:[.08167,.58167,0,0,.38889],57352:[.08167,.58167,0,0,.77778],57353:[0,.43056,.04028,0,.66667],57356:[.25142,.75726,0,0,.77778],57357:[.25142,.75726,0,0,.77778],57358:[.41951,.91951,0,0,.77778],57359:[.30274,.79383,0,0,.77778],57360:[.30274,.79383,0,0,.77778],57361:[.41951,.91951,0,0,.77778],57366:[.25142,.75726,0,0,.77778],57367:[.25142,.75726,0,0,.77778],57368:[.25142,.75726,0,0,.77778],57369:[.25142,.75726,0,0,.77778],57370:[.13597,.63597,0,0,.77778],57371:[.13597,.63597,0,0,.77778]},"Caligraphic-Regular":{32:[0,0,0,0,.25],65:[0,.68333,0,.19445,.79847],66:[0,.68333,.03041,.13889,.65681],67:[0,.68333,.05834,.13889,.52653],68:[0,.68333,.02778,.08334,.77139],69:[0,.68333,.08944,.11111,.52778],70:[0,.68333,.09931,.11111,.71875],71:[.09722,.68333,.0593,.11111,.59487],72:[0,.68333,.00965,.11111,.84452],73:[0,.68333,.07382,0,.54452],74:[.09722,.68333,.18472,.16667,.67778],75:[0,.68333,.01445,.05556,.76195],76:[0,.68333,0,.13889,.68972],77:[0,.68333,0,.13889,1.2009],78:[0,.68333,.14736,.08334,.82049],79:[0,.68333,.02778,.11111,.79611],80:[0,.68333,.08222,.08334,.69556],81:[.09722,.68333,0,.11111,.81667],82:[0,.68333,0,.08334,.8475],83:[0,.68333,.075,.13889,.60556],84:[0,.68333,.25417,0,.54464],85:[0,.68333,.09931,.08334,.62583],86:[0,.68333,.08222,0,.61278],87:[0,.68333,.08222,.08334,.98778],88:[0,.68333,.14643,.13889,.7133],89:[.09722,.68333,.08222,.08334,.66834],90:[0,.68333,.07944,.13889,.72473],160:[0,0,0,0,.25]},"Fraktur-Regular":{32:[0,0,0,0,.25],33:[0,.69141,0,0,.29574],34:[0,.69141,0,0,.21471],38:[0,.69141,0,0,.73786],39:[0,.69141,0,0,.21201],40:[.24982,.74947,0,0,.38865],41:[.24982,.74947,0,0,.38865],42:[0,.62119,0,0,.27764],43:[.08319,.58283,0,0,.75623],44:[0,.10803,0,0,.27764],45:[.08319,.58283,0,0,.75623],46:[0,.10803,0,0,.27764],47:[.24982,.74947,0,0,.50181],48:[0,.47534,0,0,.50181],49:[0,.47534,0,0,.50181],50:[0,.47534,0,0,.50181],51:[.18906,.47534,0,0,.50181],52:[.18906,.47534,0,0,.50181],53:[.18906,.47534,0,0,.50181],54:[0,.69141,0,0,.50181],55:[.18906,.47534,0,0,.50181],56:[0,.69141,0,0,.50181],57:[.18906,.47534,0,0,.50181],58:[0,.47534,0,0,.21606],59:[.12604,.47534,0,0,.21606],61:[-.13099,.36866,0,0,.75623],63:[0,.69141,0,0,.36245],65:[0,.69141,0,0,.7176],66:[0,.69141,0,0,.88397],67:[0,.69141,0,0,.61254],68:[0,.69141,0,0,.83158],69:[0,.69141,0,0,.66278],70:[.12604,.69141,0,0,.61119],71:[0,.69141,0,0,.78539],72:[.06302,.69141,0,0,.7203],73:[0,.69141,0,0,.55448],74:[.12604,.69141,0,0,.55231],75:[0,.69141,0,0,.66845],76:[0,.69141,0,0,.66602],77:[0,.69141,0,0,1.04953],78:[0,.69141,0,0,.83212],79:[0,.69141,0,0,.82699],80:[.18906,.69141,0,0,.82753],81:[.03781,.69141,0,0,.82699],82:[0,.69141,0,0,.82807],83:[0,.69141,0,0,.82861],84:[0,.69141,0,0,.66899],85:[0,.69141,0,0,.64576],86:[0,.69141,0,0,.83131],87:[0,.69141,0,0,1.04602],88:[0,.69141,0,0,.71922],89:[.18906,.69141,0,0,.83293],90:[.12604,.69141,0,0,.60201],91:[.24982,.74947,0,0,.27764],93:[.24982,.74947,0,0,.27764],94:[0,.69141,0,0,.49965],97:[0,.47534,0,0,.50046],98:[0,.69141,0,0,.51315],99:[0,.47534,0,0,.38946],100:[0,.62119,0,0,.49857],101:[0,.47534,0,0,.40053],102:[.18906,.69141,0,0,.32626],103:[.18906,.47534,0,0,.5037],104:[.18906,.69141,0,0,.52126],105:[0,.69141,0,0,.27899],106:[0,.69141,0,0,.28088],107:[0,.69141,0,0,.38946],108:[0,.69141,0,0,.27953],109:[0,.47534,0,0,.76676],110:[0,.47534,0,0,.52666],111:[0,.47534,0,0,.48885],112:[.18906,.52396,0,0,.50046],113:[.18906,.47534,0,0,.48912],114:[0,.47534,0,0,.38919],115:[0,.47534,0,0,.44266],116:[0,.62119,0,0,.33301],117:[0,.47534,0,0,.5172],118:[0,.52396,0,0,.5118],119:[0,.52396,0,0,.77351],120:[.18906,.47534,0,0,.38865],121:[.18906,.47534,0,0,.49884],122:[.18906,.47534,0,0,.39054],160:[0,0,0,0,.25],8216:[0,.69141,0,0,.21471],8217:[0,.69141,0,0,.21471],58112:[0,.62119,0,0,.49749],58113:[0,.62119,0,0,.4983],58114:[.18906,.69141,0,0,.33328],58115:[.18906,.69141,0,0,.32923],58116:[.18906,.47534,0,0,.50343],58117:[0,.69141,0,0,.33301],58118:[0,.62119,0,0,.33409],58119:[0,.47534,0,0,.50073]},"Main-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.35],34:[0,.69444,0,0,.60278],35:[.19444,.69444,0,0,.95833],36:[.05556,.75,0,0,.575],37:[.05556,.75,0,0,.95833],38:[0,.69444,0,0,.89444],39:[0,.69444,0,0,.31944],40:[.25,.75,0,0,.44722],41:[.25,.75,0,0,.44722],42:[0,.75,0,0,.575],43:[.13333,.63333,0,0,.89444],44:[.19444,.15556,0,0,.31944],45:[0,.44444,0,0,.38333],46:[0,.15556,0,0,.31944],47:[.25,.75,0,0,.575],48:[0,.64444,0,0,.575],49:[0,.64444,0,0,.575],50:[0,.64444,0,0,.575],51:[0,.64444,0,0,.575],52:[0,.64444,0,0,.575],53:[0,.64444,0,0,.575],54:[0,.64444,0,0,.575],55:[0,.64444,0,0,.575],56:[0,.64444,0,0,.575],57:[0,.64444,0,0,.575],58:[0,.44444,0,0,.31944],59:[.19444,.44444,0,0,.31944],60:[.08556,.58556,0,0,.89444],61:[-.10889,.39111,0,0,.89444],62:[.08556,.58556,0,0,.89444],63:[0,.69444,0,0,.54305],64:[0,.69444,0,0,.89444],65:[0,.68611,0,0,.86944],66:[0,.68611,0,0,.81805],67:[0,.68611,0,0,.83055],68:[0,.68611,0,0,.88194],69:[0,.68611,0,0,.75555],70:[0,.68611,0,0,.72361],71:[0,.68611,0,0,.90416],72:[0,.68611,0,0,.9],73:[0,.68611,0,0,.43611],74:[0,.68611,0,0,.59444],75:[0,.68611,0,0,.90138],76:[0,.68611,0,0,.69166],77:[0,.68611,0,0,1.09166],78:[0,.68611,0,0,.9],79:[0,.68611,0,0,.86388],80:[0,.68611,0,0,.78611],81:[.19444,.68611,0,0,.86388],82:[0,.68611,0,0,.8625],83:[0,.68611,0,0,.63889],84:[0,.68611,0,0,.8],85:[0,.68611,0,0,.88472],86:[0,.68611,.01597,0,.86944],87:[0,.68611,.01597,0,1.18888],88:[0,.68611,0,0,.86944],89:[0,.68611,.02875,0,.86944],90:[0,.68611,0,0,.70277],91:[.25,.75,0,0,.31944],92:[.25,.75,0,0,.575],93:[.25,.75,0,0,.31944],94:[0,.69444,0,0,.575],95:[.31,.13444,.03194,0,.575],97:[0,.44444,0,0,.55902],98:[0,.69444,0,0,.63889],99:[0,.44444,0,0,.51111],100:[0,.69444,0,0,.63889],101:[0,.44444,0,0,.52708],102:[0,.69444,.10903,0,.35139],103:[.19444,.44444,.01597,0,.575],104:[0,.69444,0,0,.63889],105:[0,.69444,0,0,.31944],106:[.19444,.69444,0,0,.35139],107:[0,.69444,0,0,.60694],108:[0,.69444,0,0,.31944],109:[0,.44444,0,0,.95833],110:[0,.44444,0,0,.63889],111:[0,.44444,0,0,.575],112:[.19444,.44444,0,0,.63889],113:[.19444,.44444,0,0,.60694],114:[0,.44444,0,0,.47361],115:[0,.44444,0,0,.45361],116:[0,.63492,0,0,.44722],117:[0,.44444,0,0,.63889],118:[0,.44444,.01597,0,.60694],119:[0,.44444,.01597,0,.83055],120:[0,.44444,0,0,.60694],121:[.19444,.44444,.01597,0,.60694],122:[0,.44444,0,0,.51111],123:[.25,.75,0,0,.575],124:[.25,.75,0,0,.31944],125:[.25,.75,0,0,.575],126:[.35,.34444,0,0,.575],160:[0,0,0,0,.25],163:[0,.69444,0,0,.86853],168:[0,.69444,0,0,.575],172:[0,.44444,0,0,.76666],176:[0,.69444,0,0,.86944],177:[.13333,.63333,0,0,.89444],184:[.17014,0,0,0,.51111],198:[0,.68611,0,0,1.04166],215:[.13333,.63333,0,0,.89444],216:[.04861,.73472,0,0,.89444],223:[0,.69444,0,0,.59722],230:[0,.44444,0,0,.83055],247:[.13333,.63333,0,0,.89444],248:[.09722,.54167,0,0,.575],305:[0,.44444,0,0,.31944],338:[0,.68611,0,0,1.16944],339:[0,.44444,0,0,.89444],567:[.19444,.44444,0,0,.35139],710:[0,.69444,0,0,.575],711:[0,.63194,0,0,.575],713:[0,.59611,0,0,.575],714:[0,.69444,0,0,.575],715:[0,.69444,0,0,.575],728:[0,.69444,0,0,.575],729:[0,.69444,0,0,.31944],730:[0,.69444,0,0,.86944],732:[0,.69444,0,0,.575],733:[0,.69444,0,0,.575],915:[0,.68611,0,0,.69166],916:[0,.68611,0,0,.95833],920:[0,.68611,0,0,.89444],923:[0,.68611,0,0,.80555],926:[0,.68611,0,0,.76666],928:[0,.68611,0,0,.9],931:[0,.68611,0,0,.83055],933:[0,.68611,0,0,.89444],934:[0,.68611,0,0,.83055],936:[0,.68611,0,0,.89444],937:[0,.68611,0,0,.83055],8211:[0,.44444,.03194,0,.575],8212:[0,.44444,.03194,0,1.14999],8216:[0,.69444,0,0,.31944],8217:[0,.69444,0,0,.31944],8220:[0,.69444,0,0,.60278],8221:[0,.69444,0,0,.60278],8224:[.19444,.69444,0,0,.51111],8225:[.19444,.69444,0,0,.51111],8242:[0,.55556,0,0,.34444],8407:[0,.72444,.15486,0,.575],8463:[0,.69444,0,0,.66759],8465:[0,.69444,0,0,.83055],8467:[0,.69444,0,0,.47361],8472:[.19444,.44444,0,0,.74027],8476:[0,.69444,0,0,.83055],8501:[0,.69444,0,0,.70277],8592:[-.10889,.39111,0,0,1.14999],8593:[.19444,.69444,0,0,.575],8594:[-.10889,.39111,0,0,1.14999],8595:[.19444,.69444,0,0,.575],8596:[-.10889,.39111,0,0,1.14999],8597:[.25,.75,0,0,.575],8598:[.19444,.69444,0,0,1.14999],8599:[.19444,.69444,0,0,1.14999],8600:[.19444,.69444,0,0,1.14999],8601:[.19444,.69444,0,0,1.14999],8636:[-.10889,.39111,0,0,1.14999],8637:[-.10889,.39111,0,0,1.14999],8640:[-.10889,.39111,0,0,1.14999],8641:[-.10889,.39111,0,0,1.14999],8656:[-.10889,.39111,0,0,1.14999],8657:[.19444,.69444,0,0,.70277],8658:[-.10889,.39111,0,0,1.14999],8659:[.19444,.69444,0,0,.70277],8660:[-.10889,.39111,0,0,1.14999],8661:[.25,.75,0,0,.70277],8704:[0,.69444,0,0,.63889],8706:[0,.69444,.06389,0,.62847],8707:[0,.69444,0,0,.63889],8709:[.05556,.75,0,0,.575],8711:[0,.68611,0,0,.95833],8712:[.08556,.58556,0,0,.76666],8715:[.08556,.58556,0,0,.76666],8722:[.13333,.63333,0,0,.89444],8723:[.13333,.63333,0,0,.89444],8725:[.25,.75,0,0,.575],8726:[.25,.75,0,0,.575],8727:[-.02778,.47222,0,0,.575],8728:[-.02639,.47361,0,0,.575],8729:[-.02639,.47361,0,0,.575],8730:[.18,.82,0,0,.95833],8733:[0,.44444,0,0,.89444],8734:[0,.44444,0,0,1.14999],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.31944],8741:[.25,.75,0,0,.575],8743:[0,.55556,0,0,.76666],8744:[0,.55556,0,0,.76666],8745:[0,.55556,0,0,.76666],8746:[0,.55556,0,0,.76666],8747:[.19444,.69444,.12778,0,.56875],8764:[-.10889,.39111,0,0,.89444],8768:[.19444,.69444,0,0,.31944],8771:[.00222,.50222,0,0,.89444],8773:[.027,.638,0,0,.894],8776:[.02444,.52444,0,0,.89444],8781:[.00222,.50222,0,0,.89444],8801:[.00222,.50222,0,0,.89444],8804:[.19667,.69667,0,0,.89444],8805:[.19667,.69667,0,0,.89444],8810:[.08556,.58556,0,0,1.14999],8811:[.08556,.58556,0,0,1.14999],8826:[.08556,.58556,0,0,.89444],8827:[.08556,.58556,0,0,.89444],8834:[.08556,.58556,0,0,.89444],8835:[.08556,.58556,0,0,.89444],8838:[.19667,.69667,0,0,.89444],8839:[.19667,.69667,0,0,.89444],8846:[0,.55556,0,0,.76666],8849:[.19667,.69667,0,0,.89444],8850:[.19667,.69667,0,0,.89444],8851:[0,.55556,0,0,.76666],8852:[0,.55556,0,0,.76666],8853:[.13333,.63333,0,0,.89444],8854:[.13333,.63333,0,0,.89444],8855:[.13333,.63333,0,0,.89444],8856:[.13333,.63333,0,0,.89444],8857:[.13333,.63333,0,0,.89444],8866:[0,.69444,0,0,.70277],8867:[0,.69444,0,0,.70277],8868:[0,.69444,0,0,.89444],8869:[0,.69444,0,0,.89444],8900:[-.02639,.47361,0,0,.575],8901:[-.02639,.47361,0,0,.31944],8902:[-.02778,.47222,0,0,.575],8968:[.25,.75,0,0,.51111],8969:[.25,.75,0,0,.51111],8970:[.25,.75,0,0,.51111],8971:[.25,.75,0,0,.51111],8994:[-.13889,.36111,0,0,1.14999],8995:[-.13889,.36111,0,0,1.14999],9651:[.19444,.69444,0,0,1.02222],9657:[-.02778,.47222,0,0,.575],9661:[.19444,.69444,0,0,1.02222],9667:[-.02778,.47222,0,0,.575],9711:[.19444,.69444,0,0,1.14999],9824:[.12963,.69444,0,0,.89444],9825:[.12963,.69444,0,0,.89444],9826:[.12963,.69444,0,0,.89444],9827:[.12963,.69444,0,0,.89444],9837:[0,.75,0,0,.44722],9838:[.19444,.69444,0,0,.44722],9839:[.19444,.69444,0,0,.44722],10216:[.25,.75,0,0,.44722],10217:[.25,.75,0,0,.44722],10815:[0,.68611,0,0,.9],10927:[.19667,.69667,0,0,.89444],10928:[.19667,.69667,0,0,.89444],57376:[.19444,.69444,0,0,0]},"Main-BoldItalic":{32:[0,0,0,0,.25],33:[0,.69444,.11417,0,.38611],34:[0,.69444,.07939,0,.62055],35:[.19444,.69444,.06833,0,.94444],37:[.05556,.75,.12861,0,.94444],38:[0,.69444,.08528,0,.88555],39:[0,.69444,.12945,0,.35555],40:[.25,.75,.15806,0,.47333],41:[.25,.75,.03306,0,.47333],42:[0,.75,.14333,0,.59111],43:[.10333,.60333,.03306,0,.88555],44:[.19444,.14722,0,0,.35555],45:[0,.44444,.02611,0,.41444],46:[0,.14722,0,0,.35555],47:[.25,.75,.15806,0,.59111],48:[0,.64444,.13167,0,.59111],49:[0,.64444,.13167,0,.59111],50:[0,.64444,.13167,0,.59111],51:[0,.64444,.13167,0,.59111],52:[.19444,.64444,.13167,0,.59111],53:[0,.64444,.13167,0,.59111],54:[0,.64444,.13167,0,.59111],55:[.19444,.64444,.13167,0,.59111],56:[0,.64444,.13167,0,.59111],57:[0,.64444,.13167,0,.59111],58:[0,.44444,.06695,0,.35555],59:[.19444,.44444,.06695,0,.35555],61:[-.10889,.39111,.06833,0,.88555],63:[0,.69444,.11472,0,.59111],64:[0,.69444,.09208,0,.88555],65:[0,.68611,0,0,.86555],66:[0,.68611,.0992,0,.81666],67:[0,.68611,.14208,0,.82666],68:[0,.68611,.09062,0,.87555],69:[0,.68611,.11431,0,.75666],70:[0,.68611,.12903,0,.72722],71:[0,.68611,.07347,0,.89527],72:[0,.68611,.17208,0,.8961],73:[0,.68611,.15681,0,.47166],74:[0,.68611,.145,0,.61055],75:[0,.68611,.14208,0,.89499],76:[0,.68611,0,0,.69777],77:[0,.68611,.17208,0,1.07277],78:[0,.68611,.17208,0,.8961],79:[0,.68611,.09062,0,.85499],80:[0,.68611,.0992,0,.78721],81:[.19444,.68611,.09062,0,.85499],82:[0,.68611,.02559,0,.85944],83:[0,.68611,.11264,0,.64999],84:[0,.68611,.12903,0,.7961],85:[0,.68611,.17208,0,.88083],86:[0,.68611,.18625,0,.86555],87:[0,.68611,.18625,0,1.15999],88:[0,.68611,.15681,0,.86555],89:[0,.68611,.19803,0,.86555],90:[0,.68611,.14208,0,.70888],91:[.25,.75,.1875,0,.35611],93:[.25,.75,.09972,0,.35611],94:[0,.69444,.06709,0,.59111],95:[.31,.13444,.09811,0,.59111],97:[0,.44444,.09426,0,.59111],98:[0,.69444,.07861,0,.53222],99:[0,.44444,.05222,0,.53222],100:[0,.69444,.10861,0,.59111],101:[0,.44444,.085,0,.53222],102:[.19444,.69444,.21778,0,.4],103:[.19444,.44444,.105,0,.53222],104:[0,.69444,.09426,0,.59111],105:[0,.69326,.11387,0,.35555],106:[.19444,.69326,.1672,0,.35555],107:[0,.69444,.11111,0,.53222],108:[0,.69444,.10861,0,.29666],109:[0,.44444,.09426,0,.94444],110:[0,.44444,.09426,0,.64999],111:[0,.44444,.07861,0,.59111],112:[.19444,.44444,.07861,0,.59111],113:[.19444,.44444,.105,0,.53222],114:[0,.44444,.11111,0,.50167],115:[0,.44444,.08167,0,.48694],116:[0,.63492,.09639,0,.385],117:[0,.44444,.09426,0,.62055],118:[0,.44444,.11111,0,.53222],119:[0,.44444,.11111,0,.76777],120:[0,.44444,.12583,0,.56055],121:[.19444,.44444,.105,0,.56166],122:[0,.44444,.13889,0,.49055],126:[.35,.34444,.11472,0,.59111],160:[0,0,0,0,.25],168:[0,.69444,.11473,0,.59111],176:[0,.69444,0,0,.94888],184:[.17014,0,0,0,.53222],198:[0,.68611,.11431,0,1.02277],216:[.04861,.73472,.09062,0,.88555],223:[.19444,.69444,.09736,0,.665],230:[0,.44444,.085,0,.82666],248:[.09722,.54167,.09458,0,.59111],305:[0,.44444,.09426,0,.35555],338:[0,.68611,.11431,0,1.14054],339:[0,.44444,.085,0,.82666],567:[.19444,.44444,.04611,0,.385],710:[0,.69444,.06709,0,.59111],711:[0,.63194,.08271,0,.59111],713:[0,.59444,.10444,0,.59111],714:[0,.69444,.08528,0,.59111],715:[0,.69444,0,0,.59111],728:[0,.69444,.10333,0,.59111],729:[0,.69444,.12945,0,.35555],730:[0,.69444,0,0,.94888],732:[0,.69444,.11472,0,.59111],733:[0,.69444,.11472,0,.59111],915:[0,.68611,.12903,0,.69777],916:[0,.68611,0,0,.94444],920:[0,.68611,.09062,0,.88555],923:[0,.68611,0,0,.80666],926:[0,.68611,.15092,0,.76777],928:[0,.68611,.17208,0,.8961],931:[0,.68611,.11431,0,.82666],933:[0,.68611,.10778,0,.88555],934:[0,.68611,.05632,0,.82666],936:[0,.68611,.10778,0,.88555],937:[0,.68611,.0992,0,.82666],8211:[0,.44444,.09811,0,.59111],8212:[0,.44444,.09811,0,1.18221],8216:[0,.69444,.12945,0,.35555],8217:[0,.69444,.12945,0,.35555],8220:[0,.69444,.16772,0,.62055],8221:[0,.69444,.07939,0,.62055]},"Main-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.12417,0,.30667],34:[0,.69444,.06961,0,.51444],35:[.19444,.69444,.06616,0,.81777],37:[.05556,.75,.13639,0,.81777],38:[0,.69444,.09694,0,.76666],39:[0,.69444,.12417,0,.30667],40:[.25,.75,.16194,0,.40889],41:[.25,.75,.03694,0,.40889],42:[0,.75,.14917,0,.51111],43:[.05667,.56167,.03694,0,.76666],44:[.19444,.10556,0,0,.30667],45:[0,.43056,.02826,0,.35778],46:[0,.10556,0,0,.30667],47:[.25,.75,.16194,0,.51111],48:[0,.64444,.13556,0,.51111],49:[0,.64444,.13556,0,.51111],50:[0,.64444,.13556,0,.51111],51:[0,.64444,.13556,0,.51111],52:[.19444,.64444,.13556,0,.51111],53:[0,.64444,.13556,0,.51111],54:[0,.64444,.13556,0,.51111],55:[.19444,.64444,.13556,0,.51111],56:[0,.64444,.13556,0,.51111],57:[0,.64444,.13556,0,.51111],58:[0,.43056,.0582,0,.30667],59:[.19444,.43056,.0582,0,.30667],61:[-.13313,.36687,.06616,0,.76666],63:[0,.69444,.1225,0,.51111],64:[0,.69444,.09597,0,.76666],65:[0,.68333,0,0,.74333],66:[0,.68333,.10257,0,.70389],67:[0,.68333,.14528,0,.71555],68:[0,.68333,.09403,0,.755],69:[0,.68333,.12028,0,.67833],70:[0,.68333,.13305,0,.65277],71:[0,.68333,.08722,0,.77361],72:[0,.68333,.16389,0,.74333],73:[0,.68333,.15806,0,.38555],74:[0,.68333,.14028,0,.525],75:[0,.68333,.14528,0,.76888],76:[0,.68333,0,0,.62722],77:[0,.68333,.16389,0,.89666],78:[0,.68333,.16389,0,.74333],79:[0,.68333,.09403,0,.76666],80:[0,.68333,.10257,0,.67833],81:[.19444,.68333,.09403,0,.76666],82:[0,.68333,.03868,0,.72944],83:[0,.68333,.11972,0,.56222],84:[0,.68333,.13305,0,.71555],85:[0,.68333,.16389,0,.74333],86:[0,.68333,.18361,0,.74333],87:[0,.68333,.18361,0,.99888],88:[0,.68333,.15806,0,.74333],89:[0,.68333,.19383,0,.74333],90:[0,.68333,.14528,0,.61333],91:[.25,.75,.1875,0,.30667],93:[.25,.75,.10528,0,.30667],94:[0,.69444,.06646,0,.51111],95:[.31,.12056,.09208,0,.51111],97:[0,.43056,.07671,0,.51111],98:[0,.69444,.06312,0,.46],99:[0,.43056,.05653,0,.46],100:[0,.69444,.10333,0,.51111],101:[0,.43056,.07514,0,.46],102:[.19444,.69444,.21194,0,.30667],103:[.19444,.43056,.08847,0,.46],104:[0,.69444,.07671,0,.51111],105:[0,.65536,.1019,0,.30667],106:[.19444,.65536,.14467,0,.30667],107:[0,.69444,.10764,0,.46],108:[0,.69444,.10333,0,.25555],109:[0,.43056,.07671,0,.81777],110:[0,.43056,.07671,0,.56222],111:[0,.43056,.06312,0,.51111],112:[.19444,.43056,.06312,0,.51111],113:[.19444,.43056,.08847,0,.46],114:[0,.43056,.10764,0,.42166],115:[0,.43056,.08208,0,.40889],116:[0,.61508,.09486,0,.33222],117:[0,.43056,.07671,0,.53666],118:[0,.43056,.10764,0,.46],119:[0,.43056,.10764,0,.66444],120:[0,.43056,.12042,0,.46389],121:[.19444,.43056,.08847,0,.48555],122:[0,.43056,.12292,0,.40889],126:[.35,.31786,.11585,0,.51111],160:[0,0,0,0,.25],168:[0,.66786,.10474,0,.51111],176:[0,.69444,0,0,.83129],184:[.17014,0,0,0,.46],198:[0,.68333,.12028,0,.88277],216:[.04861,.73194,.09403,0,.76666],223:[.19444,.69444,.10514,0,.53666],230:[0,.43056,.07514,0,.71555],248:[.09722,.52778,.09194,0,.51111],338:[0,.68333,.12028,0,.98499],339:[0,.43056,.07514,0,.71555],710:[0,.69444,.06646,0,.51111],711:[0,.62847,.08295,0,.51111],713:[0,.56167,.10333,0,.51111],714:[0,.69444,.09694,0,.51111],715:[0,.69444,0,0,.51111],728:[0,.69444,.10806,0,.51111],729:[0,.66786,.11752,0,.30667],730:[0,.69444,0,0,.83129],732:[0,.66786,.11585,0,.51111],733:[0,.69444,.1225,0,.51111],915:[0,.68333,.13305,0,.62722],916:[0,.68333,0,0,.81777],920:[0,.68333,.09403,0,.76666],923:[0,.68333,0,0,.69222],926:[0,.68333,.15294,0,.66444],928:[0,.68333,.16389,0,.74333],931:[0,.68333,.12028,0,.71555],933:[0,.68333,.11111,0,.76666],934:[0,.68333,.05986,0,.71555],936:[0,.68333,.11111,0,.76666],937:[0,.68333,.10257,0,.71555],8211:[0,.43056,.09208,0,.51111],8212:[0,.43056,.09208,0,1.02222],8216:[0,.69444,.12417,0,.30667],8217:[0,.69444,.12417,0,.30667],8220:[0,.69444,.1685,0,.51444],8221:[0,.69444,.06961,0,.51444],8463:[0,.68889,0,0,.54028]},"Main-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.27778],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.77778],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.19444,.10556,0,0,.27778],45:[0,.43056,0,0,.33333],46:[0,.10556,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.64444,0,0,.5],49:[0,.64444,0,0,.5],50:[0,.64444,0,0,.5],51:[0,.64444,0,0,.5],52:[0,.64444,0,0,.5],53:[0,.64444,0,0,.5],54:[0,.64444,0,0,.5],55:[0,.64444,0,0,.5],56:[0,.64444,0,0,.5],57:[0,.64444,0,0,.5],58:[0,.43056,0,0,.27778],59:[.19444,.43056,0,0,.27778],60:[.0391,.5391,0,0,.77778],61:[-.13313,.36687,0,0,.77778],62:[.0391,.5391,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.77778],65:[0,.68333,0,0,.75],66:[0,.68333,0,0,.70834],67:[0,.68333,0,0,.72222],68:[0,.68333,0,0,.76389],69:[0,.68333,0,0,.68056],70:[0,.68333,0,0,.65278],71:[0,.68333,0,0,.78472],72:[0,.68333,0,0,.75],73:[0,.68333,0,0,.36111],74:[0,.68333,0,0,.51389],75:[0,.68333,0,0,.77778],76:[0,.68333,0,0,.625],77:[0,.68333,0,0,.91667],78:[0,.68333,0,0,.75],79:[0,.68333,0,0,.77778],80:[0,.68333,0,0,.68056],81:[.19444,.68333,0,0,.77778],82:[0,.68333,0,0,.73611],83:[0,.68333,0,0,.55556],84:[0,.68333,0,0,.72222],85:[0,.68333,0,0,.75],86:[0,.68333,.01389,0,.75],87:[0,.68333,.01389,0,1.02778],88:[0,.68333,0,0,.75],89:[0,.68333,.025,0,.75],90:[0,.68333,0,0,.61111],91:[.25,.75,0,0,.27778],92:[.25,.75,0,0,.5],93:[.25,.75,0,0,.27778],94:[0,.69444,0,0,.5],95:[.31,.12056,.02778,0,.5],97:[0,.43056,0,0,.5],98:[0,.69444,0,0,.55556],99:[0,.43056,0,0,.44445],100:[0,.69444,0,0,.55556],101:[0,.43056,0,0,.44445],102:[0,.69444,.07778,0,.30556],103:[.19444,.43056,.01389,0,.5],104:[0,.69444,0,0,.55556],105:[0,.66786,0,0,.27778],106:[.19444,.66786,0,0,.30556],107:[0,.69444,0,0,.52778],108:[0,.69444,0,0,.27778],109:[0,.43056,0,0,.83334],110:[0,.43056,0,0,.55556],111:[0,.43056,0,0,.5],112:[.19444,.43056,0,0,.55556],113:[.19444,.43056,0,0,.52778],114:[0,.43056,0,0,.39167],115:[0,.43056,0,0,.39445],116:[0,.61508,0,0,.38889],117:[0,.43056,0,0,.55556],118:[0,.43056,.01389,0,.52778],119:[0,.43056,.01389,0,.72222],120:[0,.43056,0,0,.52778],121:[.19444,.43056,.01389,0,.52778],122:[0,.43056,0,0,.44445],123:[.25,.75,0,0,.5],124:[.25,.75,0,0,.27778],125:[.25,.75,0,0,.5],126:[.35,.31786,0,0,.5],160:[0,0,0,0,.25],163:[0,.69444,0,0,.76909],167:[.19444,.69444,0,0,.44445],168:[0,.66786,0,0,.5],172:[0,.43056,0,0,.66667],176:[0,.69444,0,0,.75],177:[.08333,.58333,0,0,.77778],182:[.19444,.69444,0,0,.61111],184:[.17014,0,0,0,.44445],198:[0,.68333,0,0,.90278],215:[.08333,.58333,0,0,.77778],216:[.04861,.73194,0,0,.77778],223:[0,.69444,0,0,.5],230:[0,.43056,0,0,.72222],247:[.08333,.58333,0,0,.77778],248:[.09722,.52778,0,0,.5],305:[0,.43056,0,0,.27778],338:[0,.68333,0,0,1.01389],339:[0,.43056,0,0,.77778],567:[.19444,.43056,0,0,.30556],710:[0,.69444,0,0,.5],711:[0,.62847,0,0,.5],713:[0,.56778,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.66786,0,0,.27778],730:[0,.69444,0,0,.75],732:[0,.66786,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.68333,0,0,.625],916:[0,.68333,0,0,.83334],920:[0,.68333,0,0,.77778],923:[0,.68333,0,0,.69445],926:[0,.68333,0,0,.66667],928:[0,.68333,0,0,.75],931:[0,.68333,0,0,.72222],933:[0,.68333,0,0,.77778],934:[0,.68333,0,0,.72222],936:[0,.68333,0,0,.77778],937:[0,.68333,0,0,.72222],8211:[0,.43056,.02778,0,.5],8212:[0,.43056,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5],8224:[.19444,.69444,0,0,.44445],8225:[.19444,.69444,0,0,.44445],8230:[0,.123,0,0,1.172],8242:[0,.55556,0,0,.275],8407:[0,.71444,.15382,0,.5],8463:[0,.68889,0,0,.54028],8465:[0,.69444,0,0,.72222],8467:[0,.69444,0,.11111,.41667],8472:[.19444,.43056,0,.11111,.63646],8476:[0,.69444,0,0,.72222],8501:[0,.69444,0,0,.61111],8592:[-.13313,.36687,0,0,1],8593:[.19444,.69444,0,0,.5],8594:[-.13313,.36687,0,0,1],8595:[.19444,.69444,0,0,.5],8596:[-.13313,.36687,0,0,1],8597:[.25,.75,0,0,.5],8598:[.19444,.69444,0,0,1],8599:[.19444,.69444,0,0,1],8600:[.19444,.69444,0,0,1],8601:[.19444,.69444,0,0,1],8614:[.011,.511,0,0,1],8617:[.011,.511,0,0,1.126],8618:[.011,.511,0,0,1.126],8636:[-.13313,.36687,0,0,1],8637:[-.13313,.36687,0,0,1],8640:[-.13313,.36687,0,0,1],8641:[-.13313,.36687,0,0,1],8652:[.011,.671,0,0,1],8656:[-.13313,.36687,0,0,1],8657:[.19444,.69444,0,0,.61111],8658:[-.13313,.36687,0,0,1],8659:[.19444,.69444,0,0,.61111],8660:[-.13313,.36687,0,0,1],8661:[.25,.75,0,0,.61111],8704:[0,.69444,0,0,.55556],8706:[0,.69444,.05556,.08334,.5309],8707:[0,.69444,0,0,.55556],8709:[.05556,.75,0,0,.5],8711:[0,.68333,0,0,.83334],8712:[.0391,.5391,0,0,.66667],8715:[.0391,.5391,0,0,.66667],8722:[.08333,.58333,0,0,.77778],8723:[.08333,.58333,0,0,.77778],8725:[.25,.75,0,0,.5],8726:[.25,.75,0,0,.5],8727:[-.03472,.46528,0,0,.5],8728:[-.05555,.44445,0,0,.5],8729:[-.05555,.44445,0,0,.5],8730:[.2,.8,0,0,.83334],8733:[0,.43056,0,0,.77778],8734:[0,.43056,0,0,1],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.27778],8741:[.25,.75,0,0,.5],8743:[0,.55556,0,0,.66667],8744:[0,.55556,0,0,.66667],8745:[0,.55556,0,0,.66667],8746:[0,.55556,0,0,.66667],8747:[.19444,.69444,.11111,0,.41667],8764:[-.13313,.36687,0,0,.77778],8768:[.19444,.69444,0,0,.27778],8771:[-.03625,.46375,0,0,.77778],8773:[-.022,.589,0,0,.778],8776:[-.01688,.48312,0,0,.77778],8781:[-.03625,.46375,0,0,.77778],8784:[-.133,.673,0,0,.778],8801:[-.03625,.46375,0,0,.77778],8804:[.13597,.63597,0,0,.77778],8805:[.13597,.63597,0,0,.77778],8810:[.0391,.5391,0,0,1],8811:[.0391,.5391,0,0,1],8826:[.0391,.5391,0,0,.77778],8827:[.0391,.5391,0,0,.77778],8834:[.0391,.5391,0,0,.77778],8835:[.0391,.5391,0,0,.77778],8838:[.13597,.63597,0,0,.77778],8839:[.13597,.63597,0,0,.77778],8846:[0,.55556,0,0,.66667],8849:[.13597,.63597,0,0,.77778],8850:[.13597,.63597,0,0,.77778],8851:[0,.55556,0,0,.66667],8852:[0,.55556,0,0,.66667],8853:[.08333,.58333,0,0,.77778],8854:[.08333,.58333,0,0,.77778],8855:[.08333,.58333,0,0,.77778],8856:[.08333,.58333,0,0,.77778],8857:[.08333,.58333,0,0,.77778],8866:[0,.69444,0,0,.61111],8867:[0,.69444,0,0,.61111],8868:[0,.69444,0,0,.77778],8869:[0,.69444,0,0,.77778],8872:[.249,.75,0,0,.867],8900:[-.05555,.44445,0,0,.5],8901:[-.05555,.44445,0,0,.27778],8902:[-.03472,.46528,0,0,.5],8904:[.005,.505,0,0,.9],8942:[.03,.903,0,0,.278],8943:[-.19,.313,0,0,1.172],8945:[-.1,.823,0,0,1.282],8968:[.25,.75,0,0,.44445],8969:[.25,.75,0,0,.44445],8970:[.25,.75,0,0,.44445],8971:[.25,.75,0,0,.44445],8994:[-.14236,.35764,0,0,1],8995:[-.14236,.35764,0,0,1],9136:[.244,.744,0,0,.412],9137:[.244,.745,0,0,.412],9651:[.19444,.69444,0,0,.88889],9657:[-.03472,.46528,0,0,.5],9661:[.19444,.69444,0,0,.88889],9667:[-.03472,.46528,0,0,.5],9711:[.19444,.69444,0,0,1],9824:[.12963,.69444,0,0,.77778],9825:[.12963,.69444,0,0,.77778],9826:[.12963,.69444,0,0,.77778],9827:[.12963,.69444,0,0,.77778],9837:[0,.75,0,0,.38889],9838:[.19444,.69444,0,0,.38889],9839:[.19444,.69444,0,0,.38889],10216:[.25,.75,0,0,.38889],10217:[.25,.75,0,0,.38889],10222:[.244,.744,0,0,.412],10223:[.244,.745,0,0,.412],10229:[.011,.511,0,0,1.609],10230:[.011,.511,0,0,1.638],10231:[.011,.511,0,0,1.859],10232:[.024,.525,0,0,1.609],10233:[.024,.525,0,0,1.638],10234:[.024,.525,0,0,1.858],10236:[.011,.511,0,0,1.638],10815:[0,.68333,0,0,.75],10927:[.13597,.63597,0,0,.77778],10928:[.13597,.63597,0,0,.77778],57376:[.19444,.69444,0,0,0]},"Math-BoldItalic":{32:[0,0,0,0,.25],48:[0,.44444,0,0,.575],49:[0,.44444,0,0,.575],50:[0,.44444,0,0,.575],51:[.19444,.44444,0,0,.575],52:[.19444,.44444,0,0,.575],53:[.19444,.44444,0,0,.575],54:[0,.64444,0,0,.575],55:[.19444,.44444,0,0,.575],56:[0,.64444,0,0,.575],57:[.19444,.44444,0,0,.575],65:[0,.68611,0,0,.86944],66:[0,.68611,.04835,0,.8664],67:[0,.68611,.06979,0,.81694],68:[0,.68611,.03194,0,.93812],69:[0,.68611,.05451,0,.81007],70:[0,.68611,.15972,0,.68889],71:[0,.68611,0,0,.88673],72:[0,.68611,.08229,0,.98229],73:[0,.68611,.07778,0,.51111],74:[0,.68611,.10069,0,.63125],75:[0,.68611,.06979,0,.97118],76:[0,.68611,0,0,.75555],77:[0,.68611,.11424,0,1.14201],78:[0,.68611,.11424,0,.95034],79:[0,.68611,.03194,0,.83666],80:[0,.68611,.15972,0,.72309],81:[.19444,.68611,0,0,.86861],82:[0,.68611,.00421,0,.87235],83:[0,.68611,.05382,0,.69271],84:[0,.68611,.15972,0,.63663],85:[0,.68611,.11424,0,.80027],86:[0,.68611,.25555,0,.67778],87:[0,.68611,.15972,0,1.09305],88:[0,.68611,.07778,0,.94722],89:[0,.68611,.25555,0,.67458],90:[0,.68611,.06979,0,.77257],97:[0,.44444,0,0,.63287],98:[0,.69444,0,0,.52083],99:[0,.44444,0,0,.51342],100:[0,.69444,0,0,.60972],101:[0,.44444,0,0,.55361],102:[.19444,.69444,.11042,0,.56806],103:[.19444,.44444,.03704,0,.5449],104:[0,.69444,0,0,.66759],105:[0,.69326,0,0,.4048],106:[.19444,.69326,.0622,0,.47083],107:[0,.69444,.01852,0,.6037],108:[0,.69444,.0088,0,.34815],109:[0,.44444,0,0,1.0324],110:[0,.44444,0,0,.71296],111:[0,.44444,0,0,.58472],112:[.19444,.44444,0,0,.60092],113:[.19444,.44444,.03704,0,.54213],114:[0,.44444,.03194,0,.5287],115:[0,.44444,0,0,.53125],116:[0,.63492,0,0,.41528],117:[0,.44444,0,0,.68102],118:[0,.44444,.03704,0,.56666],119:[0,.44444,.02778,0,.83148],120:[0,.44444,0,0,.65903],121:[.19444,.44444,.03704,0,.59028],122:[0,.44444,.04213,0,.55509],160:[0,0,0,0,.25],915:[0,.68611,.15972,0,.65694],916:[0,.68611,0,0,.95833],920:[0,.68611,.03194,0,.86722],923:[0,.68611,0,0,.80555],926:[0,.68611,.07458,0,.84125],928:[0,.68611,.08229,0,.98229],931:[0,.68611,.05451,0,.88507],933:[0,.68611,.15972,0,.67083],934:[0,.68611,0,0,.76666],936:[0,.68611,.11653,0,.71402],937:[0,.68611,.04835,0,.8789],945:[0,.44444,0,0,.76064],946:[.19444,.69444,.03403,0,.65972],947:[.19444,.44444,.06389,0,.59003],948:[0,.69444,.03819,0,.52222],949:[0,.44444,0,0,.52882],950:[.19444,.69444,.06215,0,.50833],951:[.19444,.44444,.03704,0,.6],952:[0,.69444,.03194,0,.5618],953:[0,.44444,0,0,.41204],954:[0,.44444,0,0,.66759],955:[0,.69444,0,0,.67083],956:[.19444,.44444,0,0,.70787],957:[0,.44444,.06898,0,.57685],958:[.19444,.69444,.03021,0,.50833],959:[0,.44444,0,0,.58472],960:[0,.44444,.03704,0,.68241],961:[.19444,.44444,0,0,.6118],962:[.09722,.44444,.07917,0,.42361],963:[0,.44444,.03704,0,.68588],964:[0,.44444,.13472,0,.52083],965:[0,.44444,.03704,0,.63055],966:[.19444,.44444,0,0,.74722],967:[.19444,.44444,0,0,.71805],968:[.19444,.69444,.03704,0,.75833],969:[0,.44444,.03704,0,.71782],977:[0,.69444,0,0,.69155],981:[.19444,.69444,0,0,.7125],982:[0,.44444,.03194,0,.975],1009:[.19444,.44444,0,0,.6118],1013:[0,.44444,0,0,.48333],57649:[0,.44444,0,0,.39352],57911:[.19444,.44444,0,0,.43889]},"Math-Italic":{32:[0,0,0,0,.25],48:[0,.43056,0,0,.5],49:[0,.43056,0,0,.5],50:[0,.43056,0,0,.5],51:[.19444,.43056,0,0,.5],52:[.19444,.43056,0,0,.5],53:[.19444,.43056,0,0,.5],54:[0,.64444,0,0,.5],55:[.19444,.43056,0,0,.5],56:[0,.64444,0,0,.5],57:[.19444,.43056,0,0,.5],65:[0,.68333,0,.13889,.75],66:[0,.68333,.05017,.08334,.75851],67:[0,.68333,.07153,.08334,.71472],68:[0,.68333,.02778,.05556,.82792],69:[0,.68333,.05764,.08334,.7382],70:[0,.68333,.13889,.08334,.64306],71:[0,.68333,0,.08334,.78625],72:[0,.68333,.08125,.05556,.83125],73:[0,.68333,.07847,.11111,.43958],74:[0,.68333,.09618,.16667,.55451],75:[0,.68333,.07153,.05556,.84931],76:[0,.68333,0,.02778,.68056],77:[0,.68333,.10903,.08334,.97014],78:[0,.68333,.10903,.08334,.80347],79:[0,.68333,.02778,.08334,.76278],80:[0,.68333,.13889,.08334,.64201],81:[.19444,.68333,0,.08334,.79056],82:[0,.68333,.00773,.08334,.75929],83:[0,.68333,.05764,.08334,.6132],84:[0,.68333,.13889,.08334,.58438],85:[0,.68333,.10903,.02778,.68278],86:[0,.68333,.22222,0,.58333],87:[0,.68333,.13889,0,.94445],88:[0,.68333,.07847,.08334,.82847],89:[0,.68333,.22222,0,.58056],90:[0,.68333,.07153,.08334,.68264],97:[0,.43056,0,0,.52859],98:[0,.69444,0,0,.42917],99:[0,.43056,0,.05556,.43276],100:[0,.69444,0,.16667,.52049],101:[0,.43056,0,.05556,.46563],102:[.19444,.69444,.10764,.16667,.48959],103:[.19444,.43056,.03588,.02778,.47697],104:[0,.69444,0,0,.57616],105:[0,.65952,0,0,.34451],106:[.19444,.65952,.05724,0,.41181],107:[0,.69444,.03148,0,.5206],108:[0,.69444,.01968,.08334,.29838],109:[0,.43056,0,0,.87801],110:[0,.43056,0,0,.60023],111:[0,.43056,0,.05556,.48472],112:[.19444,.43056,0,.08334,.50313],113:[.19444,.43056,.03588,.08334,.44641],114:[0,.43056,.02778,.05556,.45116],115:[0,.43056,0,.05556,.46875],116:[0,.61508,0,.08334,.36111],117:[0,.43056,0,.02778,.57246],118:[0,.43056,.03588,.02778,.48472],119:[0,.43056,.02691,.08334,.71592],120:[0,.43056,0,.02778,.57153],121:[.19444,.43056,.03588,.05556,.49028],122:[0,.43056,.04398,.05556,.46505],160:[0,0,0,0,.25],915:[0,.68333,.13889,.08334,.61528],916:[0,.68333,0,.16667,.83334],920:[0,.68333,.02778,.08334,.76278],923:[0,.68333,0,.16667,.69445],926:[0,.68333,.07569,.08334,.74236],928:[0,.68333,.08125,.05556,.83125],931:[0,.68333,.05764,.08334,.77986],933:[0,.68333,.13889,.05556,.58333],934:[0,.68333,0,.08334,.66667],936:[0,.68333,.11,.05556,.61222],937:[0,.68333,.05017,.08334,.7724],945:[0,.43056,.0037,.02778,.6397],946:[.19444,.69444,.05278,.08334,.56563],947:[.19444,.43056,.05556,0,.51773],948:[0,.69444,.03785,.05556,.44444],949:[0,.43056,0,.08334,.46632],950:[.19444,.69444,.07378,.08334,.4375],951:[.19444,.43056,.03588,.05556,.49653],952:[0,.69444,.02778,.08334,.46944],953:[0,.43056,0,.05556,.35394],954:[0,.43056,0,0,.57616],955:[0,.69444,0,0,.58334],956:[.19444,.43056,0,.02778,.60255],957:[0,.43056,.06366,.02778,.49398],958:[.19444,.69444,.04601,.11111,.4375],959:[0,.43056,0,.05556,.48472],960:[0,.43056,.03588,0,.57003],961:[.19444,.43056,0,.08334,.51702],962:[.09722,.43056,.07986,.08334,.36285],963:[0,.43056,.03588,0,.57141],964:[0,.43056,.1132,.02778,.43715],965:[0,.43056,.03588,.02778,.54028],966:[.19444,.43056,0,.08334,.65417],967:[.19444,.43056,0,.05556,.62569],968:[.19444,.69444,.03588,.11111,.65139],969:[0,.43056,.03588,0,.62245],977:[0,.69444,0,.08334,.59144],981:[.19444,.69444,0,.08334,.59583],982:[0,.43056,.02778,0,.82813],1009:[.19444,.43056,0,.08334,.51702],1013:[0,.43056,0,.05556,.4059],57649:[0,.43056,0,.02778,.32246],57911:[.19444,.43056,0,.08334,.38403]},"SansSerif-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.36667],34:[0,.69444,0,0,.55834],35:[.19444,.69444,0,0,.91667],36:[.05556,.75,0,0,.55],37:[.05556,.75,0,0,1.02912],38:[0,.69444,0,0,.83056],39:[0,.69444,0,0,.30556],40:[.25,.75,0,0,.42778],41:[.25,.75,0,0,.42778],42:[0,.75,0,0,.55],43:[.11667,.61667,0,0,.85556],44:[.10556,.13056,0,0,.30556],45:[0,.45833,0,0,.36667],46:[0,.13056,0,0,.30556],47:[.25,.75,0,0,.55],48:[0,.69444,0,0,.55],49:[0,.69444,0,0,.55],50:[0,.69444,0,0,.55],51:[0,.69444,0,0,.55],52:[0,.69444,0,0,.55],53:[0,.69444,0,0,.55],54:[0,.69444,0,0,.55],55:[0,.69444,0,0,.55],56:[0,.69444,0,0,.55],57:[0,.69444,0,0,.55],58:[0,.45833,0,0,.30556],59:[.10556,.45833,0,0,.30556],61:[-.09375,.40625,0,0,.85556],63:[0,.69444,0,0,.51945],64:[0,.69444,0,0,.73334],65:[0,.69444,0,0,.73334],66:[0,.69444,0,0,.73334],67:[0,.69444,0,0,.70278],68:[0,.69444,0,0,.79445],69:[0,.69444,0,0,.64167],70:[0,.69444,0,0,.61111],71:[0,.69444,0,0,.73334],72:[0,.69444,0,0,.79445],73:[0,.69444,0,0,.33056],74:[0,.69444,0,0,.51945],75:[0,.69444,0,0,.76389],76:[0,.69444,0,0,.58056],77:[0,.69444,0,0,.97778],78:[0,.69444,0,0,.79445],79:[0,.69444,0,0,.79445],80:[0,.69444,0,0,.70278],81:[.10556,.69444,0,0,.79445],82:[0,.69444,0,0,.70278],83:[0,.69444,0,0,.61111],84:[0,.69444,0,0,.73334],85:[0,.69444,0,0,.76389],86:[0,.69444,.01528,0,.73334],87:[0,.69444,.01528,0,1.03889],88:[0,.69444,0,0,.73334],89:[0,.69444,.0275,0,.73334],90:[0,.69444,0,0,.67223],91:[.25,.75,0,0,.34306],93:[.25,.75,0,0,.34306],94:[0,.69444,0,0,.55],95:[.35,.10833,.03056,0,.55],97:[0,.45833,0,0,.525],98:[0,.69444,0,0,.56111],99:[0,.45833,0,0,.48889],100:[0,.69444,0,0,.56111],101:[0,.45833,0,0,.51111],102:[0,.69444,.07639,0,.33611],103:[.19444,.45833,.01528,0,.55],104:[0,.69444,0,0,.56111],105:[0,.69444,0,0,.25556],106:[.19444,.69444,0,0,.28611],107:[0,.69444,0,0,.53056],108:[0,.69444,0,0,.25556],109:[0,.45833,0,0,.86667],110:[0,.45833,0,0,.56111],111:[0,.45833,0,0,.55],112:[.19444,.45833,0,0,.56111],113:[.19444,.45833,0,0,.56111],114:[0,.45833,.01528,0,.37222],115:[0,.45833,0,0,.42167],116:[0,.58929,0,0,.40417],117:[0,.45833,0,0,.56111],118:[0,.45833,.01528,0,.5],119:[0,.45833,.01528,0,.74445],120:[0,.45833,0,0,.5],121:[.19444,.45833,.01528,0,.5],122:[0,.45833,0,0,.47639],126:[.35,.34444,0,0,.55],160:[0,0,0,0,.25],168:[0,.69444,0,0,.55],176:[0,.69444,0,0,.73334],180:[0,.69444,0,0,.55],184:[.17014,0,0,0,.48889],305:[0,.45833,0,0,.25556],567:[.19444,.45833,0,0,.28611],710:[0,.69444,0,0,.55],711:[0,.63542,0,0,.55],713:[0,.63778,0,0,.55],728:[0,.69444,0,0,.55],729:[0,.69444,0,0,.30556],730:[0,.69444,0,0,.73334],732:[0,.69444,0,0,.55],733:[0,.69444,0,0,.55],915:[0,.69444,0,0,.58056],916:[0,.69444,0,0,.91667],920:[0,.69444,0,0,.85556],923:[0,.69444,0,0,.67223],926:[0,.69444,0,0,.73334],928:[0,.69444,0,0,.79445],931:[0,.69444,0,0,.79445],933:[0,.69444,0,0,.85556],934:[0,.69444,0,0,.79445],936:[0,.69444,0,0,.85556],937:[0,.69444,0,0,.79445],8211:[0,.45833,.03056,0,.55],8212:[0,.45833,.03056,0,1.10001],8216:[0,.69444,0,0,.30556],8217:[0,.69444,0,0,.30556],8220:[0,.69444,0,0,.55834],8221:[0,.69444,0,0,.55834]},"SansSerif-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.05733,0,.31945],34:[0,.69444,.00316,0,.5],35:[.19444,.69444,.05087,0,.83334],36:[.05556,.75,.11156,0,.5],37:[.05556,.75,.03126,0,.83334],38:[0,.69444,.03058,0,.75834],39:[0,.69444,.07816,0,.27778],40:[.25,.75,.13164,0,.38889],41:[.25,.75,.02536,0,.38889],42:[0,.75,.11775,0,.5],43:[.08333,.58333,.02536,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,.01946,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,.13164,0,.5],48:[0,.65556,.11156,0,.5],49:[0,.65556,.11156,0,.5],50:[0,.65556,.11156,0,.5],51:[0,.65556,.11156,0,.5],52:[0,.65556,.11156,0,.5],53:[0,.65556,.11156,0,.5],54:[0,.65556,.11156,0,.5],55:[0,.65556,.11156,0,.5],56:[0,.65556,.11156,0,.5],57:[0,.65556,.11156,0,.5],58:[0,.44444,.02502,0,.27778],59:[.125,.44444,.02502,0,.27778],61:[-.13,.37,.05087,0,.77778],63:[0,.69444,.11809,0,.47222],64:[0,.69444,.07555,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,.08293,0,.66667],67:[0,.69444,.11983,0,.63889],68:[0,.69444,.07555,0,.72223],69:[0,.69444,.11983,0,.59722],70:[0,.69444,.13372,0,.56945],71:[0,.69444,.11983,0,.66667],72:[0,.69444,.08094,0,.70834],73:[0,.69444,.13372,0,.27778],74:[0,.69444,.08094,0,.47222],75:[0,.69444,.11983,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,.08094,0,.875],78:[0,.69444,.08094,0,.70834],79:[0,.69444,.07555,0,.73611],80:[0,.69444,.08293,0,.63889],81:[.125,.69444,.07555,0,.73611],82:[0,.69444,.08293,0,.64584],83:[0,.69444,.09205,0,.55556],84:[0,.69444,.13372,0,.68056],85:[0,.69444,.08094,0,.6875],86:[0,.69444,.1615,0,.66667],87:[0,.69444,.1615,0,.94445],88:[0,.69444,.13372,0,.66667],89:[0,.69444,.17261,0,.66667],90:[0,.69444,.11983,0,.61111],91:[.25,.75,.15942,0,.28889],93:[.25,.75,.08719,0,.28889],94:[0,.69444,.0799,0,.5],95:[.35,.09444,.08616,0,.5],97:[0,.44444,.00981,0,.48056],98:[0,.69444,.03057,0,.51667],99:[0,.44444,.08336,0,.44445],100:[0,.69444,.09483,0,.51667],101:[0,.44444,.06778,0,.44445],102:[0,.69444,.21705,0,.30556],103:[.19444,.44444,.10836,0,.5],104:[0,.69444,.01778,0,.51667],105:[0,.67937,.09718,0,.23889],106:[.19444,.67937,.09162,0,.26667],107:[0,.69444,.08336,0,.48889],108:[0,.69444,.09483,0,.23889],109:[0,.44444,.01778,0,.79445],110:[0,.44444,.01778,0,.51667],111:[0,.44444,.06613,0,.5],112:[.19444,.44444,.0389,0,.51667],113:[.19444,.44444,.04169,0,.51667],114:[0,.44444,.10836,0,.34167],115:[0,.44444,.0778,0,.38333],116:[0,.57143,.07225,0,.36111],117:[0,.44444,.04169,0,.51667],118:[0,.44444,.10836,0,.46111],119:[0,.44444,.10836,0,.68334],120:[0,.44444,.09169,0,.46111],121:[.19444,.44444,.10836,0,.46111],122:[0,.44444,.08752,0,.43472],126:[.35,.32659,.08826,0,.5],160:[0,0,0,0,.25],168:[0,.67937,.06385,0,.5],176:[0,.69444,0,0,.73752],184:[.17014,0,0,0,.44445],305:[0,.44444,.04169,0,.23889],567:[.19444,.44444,.04169,0,.26667],710:[0,.69444,.0799,0,.5],711:[0,.63194,.08432,0,.5],713:[0,.60889,.08776,0,.5],714:[0,.69444,.09205,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,.09483,0,.5],729:[0,.67937,.07774,0,.27778],730:[0,.69444,0,0,.73752],732:[0,.67659,.08826,0,.5],733:[0,.69444,.09205,0,.5],915:[0,.69444,.13372,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,.07555,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,.12816,0,.66667],928:[0,.69444,.08094,0,.70834],931:[0,.69444,.11983,0,.72222],933:[0,.69444,.09031,0,.77778],934:[0,.69444,.04603,0,.72222],936:[0,.69444,.09031,0,.77778],937:[0,.69444,.08293,0,.72222],8211:[0,.44444,.08616,0,.5],8212:[0,.44444,.08616,0,1],8216:[0,.69444,.07816,0,.27778],8217:[0,.69444,.07816,0,.27778],8220:[0,.69444,.14205,0,.5],8221:[0,.69444,.00316,0,.5]},"SansSerif-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.31945],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.75834],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,0,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.65556,0,0,.5],49:[0,.65556,0,0,.5],50:[0,.65556,0,0,.5],51:[0,.65556,0,0,.5],52:[0,.65556,0,0,.5],53:[0,.65556,0,0,.5],54:[0,.65556,0,0,.5],55:[0,.65556,0,0,.5],56:[0,.65556,0,0,.5],57:[0,.65556,0,0,.5],58:[0,.44444,0,0,.27778],59:[.125,.44444,0,0,.27778],61:[-.13,.37,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,0,0,.66667],67:[0,.69444,0,0,.63889],68:[0,.69444,0,0,.72223],69:[0,.69444,0,0,.59722],70:[0,.69444,0,0,.56945],71:[0,.69444,0,0,.66667],72:[0,.69444,0,0,.70834],73:[0,.69444,0,0,.27778],74:[0,.69444,0,0,.47222],75:[0,.69444,0,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,0,0,.875],78:[0,.69444,0,0,.70834],79:[0,.69444,0,0,.73611],80:[0,.69444,0,0,.63889],81:[.125,.69444,0,0,.73611],82:[0,.69444,0,0,.64584],83:[0,.69444,0,0,.55556],84:[0,.69444,0,0,.68056],85:[0,.69444,0,0,.6875],86:[0,.69444,.01389,0,.66667],87:[0,.69444,.01389,0,.94445],88:[0,.69444,0,0,.66667],89:[0,.69444,.025,0,.66667],90:[0,.69444,0,0,.61111],91:[.25,.75,0,0,.28889],93:[.25,.75,0,0,.28889],94:[0,.69444,0,0,.5],95:[.35,.09444,.02778,0,.5],97:[0,.44444,0,0,.48056],98:[0,.69444,0,0,.51667],99:[0,.44444,0,0,.44445],100:[0,.69444,0,0,.51667],101:[0,.44444,0,0,.44445],102:[0,.69444,.06944,0,.30556],103:[.19444,.44444,.01389,0,.5],104:[0,.69444,0,0,.51667],105:[0,.67937,0,0,.23889],106:[.19444,.67937,0,0,.26667],107:[0,.69444,0,0,.48889],108:[0,.69444,0,0,.23889],109:[0,.44444,0,0,.79445],110:[0,.44444,0,0,.51667],111:[0,.44444,0,0,.5],112:[.19444,.44444,0,0,.51667],113:[.19444,.44444,0,0,.51667],114:[0,.44444,.01389,0,.34167],115:[0,.44444,0,0,.38333],116:[0,.57143,0,0,.36111],117:[0,.44444,0,0,.51667],118:[0,.44444,.01389,0,.46111],119:[0,.44444,.01389,0,.68334],120:[0,.44444,0,0,.46111],121:[.19444,.44444,.01389,0,.46111],122:[0,.44444,0,0,.43472],126:[.35,.32659,0,0,.5],160:[0,0,0,0,.25],168:[0,.67937,0,0,.5],176:[0,.69444,0,0,.66667],184:[.17014,0,0,0,.44445],305:[0,.44444,0,0,.23889],567:[.19444,.44444,0,0,.26667],710:[0,.69444,0,0,.5],711:[0,.63194,0,0,.5],713:[0,.60889,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.67937,0,0,.27778],730:[0,.69444,0,0,.66667],732:[0,.67659,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.69444,0,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,0,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,0,0,.66667],928:[0,.69444,0,0,.70834],931:[0,.69444,0,0,.72222],933:[0,.69444,0,0,.77778],934:[0,.69444,0,0,.72222],936:[0,.69444,0,0,.77778],937:[0,.69444,0,0,.72222],8211:[0,.44444,.02778,0,.5],8212:[0,.44444,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5]},"Script-Regular":{32:[0,0,0,0,.25],65:[0,.7,.22925,0,.80253],66:[0,.7,.04087,0,.90757],67:[0,.7,.1689,0,.66619],68:[0,.7,.09371,0,.77443],69:[0,.7,.18583,0,.56162],70:[0,.7,.13634,0,.89544],71:[0,.7,.17322,0,.60961],72:[0,.7,.29694,0,.96919],73:[0,.7,.19189,0,.80907],74:[.27778,.7,.19189,0,1.05159],75:[0,.7,.31259,0,.91364],76:[0,.7,.19189,0,.87373],77:[0,.7,.15981,0,1.08031],78:[0,.7,.3525,0,.9015],79:[0,.7,.08078,0,.73787],80:[0,.7,.08078,0,1.01262],81:[0,.7,.03305,0,.88282],82:[0,.7,.06259,0,.85],83:[0,.7,.19189,0,.86767],84:[0,.7,.29087,0,.74697],85:[0,.7,.25815,0,.79996],86:[0,.7,.27523,0,.62204],87:[0,.7,.27523,0,.80532],88:[0,.7,.26006,0,.94445],89:[0,.7,.2939,0,.70961],90:[0,.7,.24037,0,.8212],160:[0,0,0,0,.25]},"Size1-Regular":{32:[0,0,0,0,.25],40:[.35001,.85,0,0,.45834],41:[.35001,.85,0,0,.45834],47:[.35001,.85,0,0,.57778],91:[.35001,.85,0,0,.41667],92:[.35001,.85,0,0,.57778],93:[.35001,.85,0,0,.41667],123:[.35001,.85,0,0,.58334],125:[.35001,.85,0,0,.58334],160:[0,0,0,0,.25],710:[0,.72222,0,0,.55556],732:[0,.72222,0,0,.55556],770:[0,.72222,0,0,.55556],771:[0,.72222,0,0,.55556],8214:[-99e-5,.601,0,0,.77778],8593:[1e-5,.6,0,0,.66667],8595:[1e-5,.6,0,0,.66667],8657:[1e-5,.6,0,0,.77778],8659:[1e-5,.6,0,0,.77778],8719:[.25001,.75,0,0,.94445],8720:[.25001,.75,0,0,.94445],8721:[.25001,.75,0,0,1.05556],8730:[.35001,.85,0,0,1],8739:[-.00599,.606,0,0,.33333],8741:[-.00599,.606,0,0,.55556],8747:[.30612,.805,.19445,0,.47222],8748:[.306,.805,.19445,0,.47222],8749:[.306,.805,.19445,0,.47222],8750:[.30612,.805,.19445,0,.47222],8896:[.25001,.75,0,0,.83334],8897:[.25001,.75,0,0,.83334],8898:[.25001,.75,0,0,.83334],8899:[.25001,.75,0,0,.83334],8968:[.35001,.85,0,0,.47222],8969:[.35001,.85,0,0,.47222],8970:[.35001,.85,0,0,.47222],8971:[.35001,.85,0,0,.47222],9168:[-99e-5,.601,0,0,.66667],10216:[.35001,.85,0,0,.47222],10217:[.35001,.85,0,0,.47222],10752:[.25001,.75,0,0,1.11111],10753:[.25001,.75,0,0,1.11111],10754:[.25001,.75,0,0,1.11111],10756:[.25001,.75,0,0,.83334],10758:[.25001,.75,0,0,.83334]},"Size2-Regular":{32:[0,0,0,0,.25],40:[.65002,1.15,0,0,.59722],41:[.65002,1.15,0,0,.59722],47:[.65002,1.15,0,0,.81111],91:[.65002,1.15,0,0,.47222],92:[.65002,1.15,0,0,.81111],93:[.65002,1.15,0,0,.47222],123:[.65002,1.15,0,0,.66667],125:[.65002,1.15,0,0,.66667],160:[0,0,0,0,.25],710:[0,.75,0,0,1],732:[0,.75,0,0,1],770:[0,.75,0,0,1],771:[0,.75,0,0,1],8719:[.55001,1.05,0,0,1.27778],8720:[.55001,1.05,0,0,1.27778],8721:[.55001,1.05,0,0,1.44445],8730:[.65002,1.15,0,0,1],8747:[.86225,1.36,.44445,0,.55556],8748:[.862,1.36,.44445,0,.55556],8749:[.862,1.36,.44445,0,.55556],8750:[.86225,1.36,.44445,0,.55556],8896:[.55001,1.05,0,0,1.11111],8897:[.55001,1.05,0,0,1.11111],8898:[.55001,1.05,0,0,1.11111],8899:[.55001,1.05,0,0,1.11111],8968:[.65002,1.15,0,0,.52778],8969:[.65002,1.15,0,0,.52778],8970:[.65002,1.15,0,0,.52778],8971:[.65002,1.15,0,0,.52778],10216:[.65002,1.15,0,0,.61111],10217:[.65002,1.15,0,0,.61111],10752:[.55001,1.05,0,0,1.51112],10753:[.55001,1.05,0,0,1.51112],10754:[.55001,1.05,0,0,1.51112],10756:[.55001,1.05,0,0,1.11111],10758:[.55001,1.05,0,0,1.11111]},"Size3-Regular":{32:[0,0,0,0,.25],40:[.95003,1.45,0,0,.73611],41:[.95003,1.45,0,0,.73611],47:[.95003,1.45,0,0,1.04445],91:[.95003,1.45,0,0,.52778],92:[.95003,1.45,0,0,1.04445],93:[.95003,1.45,0,0,.52778],123:[.95003,1.45,0,0,.75],125:[.95003,1.45,0,0,.75],160:[0,0,0,0,.25],710:[0,.75,0,0,1.44445],732:[0,.75,0,0,1.44445],770:[0,.75,0,0,1.44445],771:[0,.75,0,0,1.44445],8730:[.95003,1.45,0,0,1],8968:[.95003,1.45,0,0,.58334],8969:[.95003,1.45,0,0,.58334],8970:[.95003,1.45,0,0,.58334],8971:[.95003,1.45,0,0,.58334],10216:[.95003,1.45,0,0,.75],10217:[.95003,1.45,0,0,.75]},"Size4-Regular":{32:[0,0,0,0,.25],40:[1.25003,1.75,0,0,.79167],41:[1.25003,1.75,0,0,.79167],47:[1.25003,1.75,0,0,1.27778],91:[1.25003,1.75,0,0,.58334],92:[1.25003,1.75,0,0,1.27778],93:[1.25003,1.75,0,0,.58334],123:[1.25003,1.75,0,0,.80556],125:[1.25003,1.75,0,0,.80556],160:[0,0,0,0,.25],710:[0,.825,0,0,1.8889],732:[0,.825,0,0,1.8889],770:[0,.825,0,0,1.8889],771:[0,.825,0,0,1.8889],8730:[1.25003,1.75,0,0,1],8968:[1.25003,1.75,0,0,.63889],8969:[1.25003,1.75,0,0,.63889],8970:[1.25003,1.75,0,0,.63889],8971:[1.25003,1.75,0,0,.63889],9115:[.64502,1.155,0,0,.875],9116:[1e-5,.6,0,0,.875],9117:[.64502,1.155,0,0,.875],9118:[.64502,1.155,0,0,.875],9119:[1e-5,.6,0,0,.875],9120:[.64502,1.155,0,0,.875],9121:[.64502,1.155,0,0,.66667],9122:[-99e-5,.601,0,0,.66667],9123:[.64502,1.155,0,0,.66667],9124:[.64502,1.155,0,0,.66667],9125:[-99e-5,.601,0,0,.66667],9126:[.64502,1.155,0,0,.66667],9127:[1e-5,.9,0,0,.88889],9128:[.65002,1.15,0,0,.88889],9129:[.90001,0,0,0,.88889],9130:[0,.3,0,0,.88889],9131:[1e-5,.9,0,0,.88889],9132:[.65002,1.15,0,0,.88889],9133:[.90001,0,0,0,.88889],9143:[.88502,.915,0,0,1.05556],10216:[1.25003,1.75,0,0,.80556],10217:[1.25003,1.75,0,0,.80556],57344:[-.00499,.605,0,0,1.05556],57345:[-.00499,.605,0,0,1.05556],57680:[0,.12,0,0,.45],57681:[0,.12,0,0,.45],57682:[0,.12,0,0,.45],57683:[0,.12,0,0,.45]},"Typewriter-Regular":{32:[0,0,0,0,.525],33:[0,.61111,0,0,.525],34:[0,.61111,0,0,.525],35:[0,.61111,0,0,.525],36:[.08333,.69444,0,0,.525],37:[.08333,.69444,0,0,.525],38:[0,.61111,0,0,.525],39:[0,.61111,0,0,.525],40:[.08333,.69444,0,0,.525],41:[.08333,.69444,0,0,.525],42:[0,.52083,0,0,.525],43:[-.08056,.53055,0,0,.525],44:[.13889,.125,0,0,.525],45:[-.08056,.53055,0,0,.525],46:[0,.125,0,0,.525],47:[.08333,.69444,0,0,.525],48:[0,.61111,0,0,.525],49:[0,.61111,0,0,.525],50:[0,.61111,0,0,.525],51:[0,.61111,0,0,.525],52:[0,.61111,0,0,.525],53:[0,.61111,0,0,.525],54:[0,.61111,0,0,.525],55:[0,.61111,0,0,.525],56:[0,.61111,0,0,.525],57:[0,.61111,0,0,.525],58:[0,.43056,0,0,.525],59:[.13889,.43056,0,0,.525],60:[-.05556,.55556,0,0,.525],61:[-.19549,.41562,0,0,.525],62:[-.05556,.55556,0,0,.525],63:[0,.61111,0,0,.525],64:[0,.61111,0,0,.525],65:[0,.61111,0,0,.525],66:[0,.61111,0,0,.525],67:[0,.61111,0,0,.525],68:[0,.61111,0,0,.525],69:[0,.61111,0,0,.525],70:[0,.61111,0,0,.525],71:[0,.61111,0,0,.525],72:[0,.61111,0,0,.525],73:[0,.61111,0,0,.525],74:[0,.61111,0,0,.525],75:[0,.61111,0,0,.525],76:[0,.61111,0,0,.525],77:[0,.61111,0,0,.525],78:[0,.61111,0,0,.525],79:[0,.61111,0,0,.525],80:[0,.61111,0,0,.525],81:[.13889,.61111,0,0,.525],82:[0,.61111,0,0,.525],83:[0,.61111,0,0,.525],84:[0,.61111,0,0,.525],85:[0,.61111,0,0,.525],86:[0,.61111,0,0,.525],87:[0,.61111,0,0,.525],88:[0,.61111,0,0,.525],89:[0,.61111,0,0,.525],90:[0,.61111,0,0,.525],91:[.08333,.69444,0,0,.525],92:[.08333,.69444,0,0,.525],93:[.08333,.69444,0,0,.525],94:[0,.61111,0,0,.525],95:[.09514,0,0,0,.525],96:[0,.61111,0,0,.525],97:[0,.43056,0,0,.525],98:[0,.61111,0,0,.525],99:[0,.43056,0,0,.525],100:[0,.61111,0,0,.525],101:[0,.43056,0,0,.525],102:[0,.61111,0,0,.525],103:[.22222,.43056,0,0,.525],104:[0,.61111,0,0,.525],105:[0,.61111,0,0,.525],106:[.22222,.61111,0,0,.525],107:[0,.61111,0,0,.525],108:[0,.61111,0,0,.525],109:[0,.43056,0,0,.525],110:[0,.43056,0,0,.525],111:[0,.43056,0,0,.525],112:[.22222,.43056,0,0,.525],113:[.22222,.43056,0,0,.525],114:[0,.43056,0,0,.525],115:[0,.43056,0,0,.525],116:[0,.55358,0,0,.525],117:[0,.43056,0,0,.525],118:[0,.43056,0,0,.525],119:[0,.43056,0,0,.525],120:[0,.43056,0,0,.525],121:[.22222,.43056,0,0,.525],122:[0,.43056,0,0,.525],123:[.08333,.69444,0,0,.525],124:[.08333,.69444,0,0,.525],125:[.08333,.69444,0,0,.525],126:[0,.61111,0,0,.525],127:[0,.61111,0,0,.525],160:[0,0,0,0,.525],176:[0,.61111,0,0,.525],184:[.19445,0,0,0,.525],305:[0,.43056,0,0,.525],567:[.22222,.43056,0,0,.525],711:[0,.56597,0,0,.525],713:[0,.56555,0,0,.525],714:[0,.61111,0,0,.525],715:[0,.61111,0,0,.525],728:[0,.61111,0,0,.525],730:[0,.61111,0,0,.525],770:[0,.61111,0,0,.525],771:[0,.61111,0,0,.525],776:[0,.61111,0,0,.525],915:[0,.61111,0,0,.525],916:[0,.61111,0,0,.525],920:[0,.61111,0,0,.525],923:[0,.61111,0,0,.525],926:[0,.61111,0,0,.525],928:[0,.61111,0,0,.525],931:[0,.61111,0,0,.525],933:[0,.61111,0,0,.525],934:[0,.61111,0,0,.525],936:[0,.61111,0,0,.525],937:[0,.61111,0,0,.525],8216:[0,.61111,0,0,.525],8217:[0,.61111,0,0,.525],8242:[0,.61111,0,0,.525],9251:[.11111,.21944,0,0,.525]}},Cx={slant:[.25,.25,.25],space:[0,0,0],stretch:[0,0,0],shrink:[0,0,0],xHeight:[.431,.431,.431],quad:[1,1.171,1.472],extraSpace:[0,0,0],num1:[.677,.732,.925],num2:[.394,.384,.387],num3:[.444,.471,.504],denom1:[.686,.752,1.025],denom2:[.345,.344,.532],sup1:[.413,.503,.504],sup2:[.363,.431,.404],sup3:[.289,.286,.294],sub1:[.15,.143,.2],sub2:[.247,.286,.4],supDrop:[.386,.353,.494],subDrop:[.05,.071,.1],delim1:[2.39,1.7,1.98],delim2:[1.01,1.157,1.42],axisHeight:[.25,.25,.25],defaultRuleThickness:[.04,.049,.049],bigOpSpacing1:[.111,.111,.111],bigOpSpacing2:[.166,.166,.166],bigOpSpacing3:[.2,.2,.2],bigOpSpacing4:[.6,.611,.611],bigOpSpacing5:[.1,.143,.143],sqrtRuleThickness:[.04,.04,.04],ptPerEm:[10,10,10],doubleRuleSep:[.2,.2,.2],arrayRuleWidth:[.04,.04,.04],fboxsep:[.3,.3,.3],fboxrule:[.04,.04,.04]},G_={Å:"A",Ð:"D",Þ:"o",å:"a",ð:"d",þ:"o",А:"A",Б:"B",В:"B",Г:"F",Д:"A",Е:"E",Ж:"K",З:"3",И:"N",Й:"N",К:"K",Л:"N",М:"M",Н:"H",О:"O",П:"N",Р:"P",С:"C",Т:"T",У:"y",Ф:"O",Х:"X",Ц:"U",Ч:"h",Ш:"W",Щ:"W",Ъ:"B",Ы:"X",Ь:"B",Э:"3",Ю:"X",Я:"R",а:"a",б:"b",в:"a",г:"r",д:"y",е:"e",ж:"m",з:"e",и:"n",й:"n",к:"n",л:"n",м:"m",н:"n",о:"o",п:"n",р:"p",с:"c",т:"o",у:"y",ф:"b",х:"x",ц:"n",ч:"n",ш:"w",щ:"w",ъ:"a",ы:"m",ь:"a",э:"e",ю:"m",я:"r"};function sbe(t,e){nl[t]=e}function VO(t,e,n){if(!nl[e])throw new Error("Font metrics not found for font: "+e+".");var r=t.charCodeAt(0),s=nl[e][r];if(!s&&t[0]in G_&&(r=G_[t[0]].charCodeAt(0),s=nl[e][r]),!s&&n==="text"&&G$(r)&&(s=nl[e][77]),s)return{depth:s[0],height:s[1],italic:s[2],skew:s[3],width:s[4]}}var x4={};function ibe(t){var e;if(t>=5?e=0:t>=3?e=1:e=2,!x4[e]){var n=x4[e]={cssEmPerMu:Cx.quad[e]/18};for(var r in Cx)Cx.hasOwnProperty(r)&&(n[r]=Cx[r][e])}return x4[e]}var abe=[[1,1,1],[2,1,1],[3,1,1],[4,2,1],[5,2,1],[6,3,1],[7,4,2],[8,6,3],[9,7,6],[10,8,7],[11,10,9]],X_=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],Y_=function(e,n){return n.size<2?e:abe[e-1][n.size-1]};class Zl{constructor(e){this.style=void 0,this.color=void 0,this.size=void 0,this.textSize=void 0,this.phantom=void 0,this.font=void 0,this.fontFamily=void 0,this.fontWeight=void 0,this.fontShape=void 0,this.sizeMultiplier=void 0,this.maxSize=void 0,this.minRuleThickness=void 0,this._fontMetrics=void 0,this.style=e.style,this.color=e.color,this.size=e.size||Zl.BASESIZE,this.textSize=e.textSize||this.size,this.phantom=!!e.phantom,this.font=e.font||"",this.fontFamily=e.fontFamily||"",this.fontWeight=e.fontWeight||"",this.fontShape=e.fontShape||"",this.sizeMultiplier=X_[this.size-1],this.maxSize=e.maxSize,this.minRuleThickness=e.minRuleThickness,this._fontMetrics=void 0}extend(e){var n={style:this.style,size:this.size,textSize:this.textSize,color:this.color,phantom:this.phantom,font:this.font,fontFamily:this.fontFamily,fontWeight:this.fontWeight,fontShape:this.fontShape,maxSize:this.maxSize,minRuleThickness:this.minRuleThickness};for(var r in e)e.hasOwnProperty(r)&&(n[r]=e[r]);return new Zl(n)}havingStyle(e){return this.style===e?this:this.extend({style:e,size:Y_(this.textSize,e)})}havingCrampedStyle(){return this.havingStyle(this.style.cramp())}havingSize(e){return this.size===e&&this.textSize===e?this:this.extend({style:this.style.text(),size:e,textSize:e,sizeMultiplier:X_[e-1]})}havingBaseStyle(e){e=e||this.style.text();var n=Y_(Zl.BASESIZE,e);return this.size===n&&this.textSize===Zl.BASESIZE&&this.style===e?this:this.extend({style:e,size:n})}havingBaseSizing(){var e;switch(this.style.id){case 4:case 5:e=3;break;case 6:case 7:e=1;break;default:e=6}return this.extend({style:this.style.text(),size:e})}withColor(e){return this.extend({color:e})}withPhantom(){return this.extend({phantom:!0})}withFont(e){return this.extend({font:e})}withTextFontFamily(e){return this.extend({fontFamily:e,font:""})}withTextFontWeight(e){return this.extend({fontWeight:e,font:""})}withTextFontShape(e){return this.extend({fontShape:e,font:""})}sizingClasses(e){return e.size!==this.size?["sizing","reset-size"+e.size,"size"+this.size]:[]}baseSizingClasses(){return this.size!==Zl.BASESIZE?["sizing","reset-size"+this.size,"size"+Zl.BASESIZE]:[]}fontMetrics(){return this._fontMetrics||(this._fontMetrics=ibe(this.size)),this._fontMetrics}getColor(){return this.phantom?"transparent":this.color}}Zl.BASESIZE=6;var ik={pt:1,mm:7227/2540,cm:7227/254,in:72.27,bp:803/800,pc:12,dd:1238/1157,cc:14856/1157,nd:685/642,nc:1370/107,sp:1/65536,px:803/800},lbe={ex:!0,em:!0,mu:!0},X$=function(e){return typeof e!="string"&&(e=e.unit),e in ik||e in lbe||e==="ex"},hr=function(e,n){var r;if(e.unit in ik)r=ik[e.unit]/n.fontMetrics().ptPerEm/n.sizeMultiplier;else if(e.unit==="mu")r=n.fontMetrics().cssEmPerMu;else{var s;if(n.style.isTight()?s=n.havingStyle(n.style.text()):s=n,e.unit==="ex")r=s.fontMetrics().xHeight;else if(e.unit==="em")r=s.fontMetrics().quad;else throw new Be("Invalid unit: '"+e.unit+"'");s!==n&&(r*=s.sizeMultiplier/n.sizeMultiplier)}return Math.min(e.number*r,n.maxSize)},Ve=function(e){return+e.toFixed(4)+"em"},Oc=function(e){return e.filter(n=>n).join(" ")},Y$=function(e,n,r){if(this.classes=e||[],this.attributes={},this.height=0,this.depth=0,this.maxFontSize=0,this.style=r||{},n){n.style.isTight()&&this.classes.push("mtight");var s=n.getColor();s&&(this.style.color=s)}},K$=function(e){var n=document.createElement(e);n.className=Oc(this.classes);for(var r in this.style)this.style.hasOwnProperty(r)&&(n.style[r]=this.style[r]);for(var s in this.attributes)this.attributes.hasOwnProperty(s)&&n.setAttribute(s,this.attributes[s]);for(var i=0;i/=\x00-\x1f]/,Z$=function(e){var n="<"+e;this.classes.length&&(n+=' class="'+Nn.escape(Oc(this.classes))+'"');var r="";for(var s in this.style)this.style.hasOwnProperty(s)&&(r+=Nn.hyphenate(s)+":"+this.style[s]+";");r&&(n+=' style="'+Nn.escape(r)+'"');for(var i in this.attributes)if(this.attributes.hasOwnProperty(i)){if(obe.test(i))throw new Be("Invalid attribute name '"+i+"'");n+=" "+i+'="'+Nn.escape(this.attributes[i])+'"'}n+=">";for(var a=0;a",n};class dp{constructor(e,n,r,s){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.width=void 0,this.maxFontSize=void 0,this.style=void 0,Y$.call(this,e,r,s),this.children=n||[]}setAttribute(e,n){this.attributes[e]=n}hasClass(e){return this.classes.includes(e)}toNode(){return K$.call(this,"span")}toMarkup(){return Z$.call(this,"span")}}class UO{constructor(e,n,r,s){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,Y$.call(this,n,s),this.children=r||[],this.setAttribute("href",e)}setAttribute(e,n){this.attributes[e]=n}hasClass(e){return this.classes.includes(e)}toNode(){return K$.call(this,"a")}toMarkup(){return Z$.call(this,"a")}}class cbe{constructor(e,n,r){this.src=void 0,this.alt=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.alt=n,this.src=e,this.classes=["mord"],this.style=r}hasClass(e){return this.classes.includes(e)}toNode(){var e=document.createElement("img");e.src=this.src,e.alt=this.alt,e.className="mord";for(var n in this.style)this.style.hasOwnProperty(n)&&(e.style[n]=this.style[n]);return e}toMarkup(){var e=''+Nn.escape(this.alt)+'0&&(n=document.createElement("span"),n.style.marginRight=Ve(this.italic)),this.classes.length>0&&(n=n||document.createElement("span"),n.className=Oc(this.classes));for(var r in this.style)this.style.hasOwnProperty(r)&&(n=n||document.createElement("span"),n.style[r]=this.style[r]);return n?(n.appendChild(e),n):e}toMarkup(){var e=!1,n="0&&(r+="margin-right:"+this.italic+"em;");for(var s in this.style)this.style.hasOwnProperty(s)&&(r+=Nn.hyphenate(s)+":"+this.style[s]+";");r&&(e=!0,n+=' style="'+Nn.escape(r)+'"');var i=Nn.escape(this.text);return e?(n+=">",n+=i,n+="",n):i}}class go{constructor(e,n){this.children=void 0,this.attributes=void 0,this.children=e||[],this.attributes=n||{}}toNode(){var e="http://www.w3.org/2000/svg",n=document.createElementNS(e,"svg");for(var r in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,r)&&n.setAttribute(r,this.attributes[r]);for(var s=0;s':''}}class ak{constructor(e){this.attributes=void 0,this.attributes=e||{}}toNode(){var e="http://www.w3.org/2000/svg",n=document.createElementNS(e,"line");for(var r in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,r)&&n.setAttribute(r,this.attributes[r]);return n}toMarkup(){var e=" but got "+String(t)+".")}var hbe={bin:1,close:1,inner:1,open:1,punct:1,rel:1},fbe={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1},Gn={math:{},text:{}};function A(t,e,n,r,s,i){Gn[t][s]={font:e,group:n,replace:r},i&&r&&(Gn[t][r]=Gn[t][s])}var D="math",Le="text",Q="main",oe="ams",ar="accent-token",nt="bin",Ls="close",Jh="inner",St="mathord",qr="op-token",zi="open",yy="punct",ce="rel",Oo="spacing",pe="textord";A(D,Q,ce,"≡","\\equiv",!0);A(D,Q,ce,"≺","\\prec",!0);A(D,Q,ce,"≻","\\succ",!0);A(D,Q,ce,"∼","\\sim",!0);A(D,Q,ce,"⊥","\\perp");A(D,Q,ce,"⪯","\\preceq",!0);A(D,Q,ce,"⪰","\\succeq",!0);A(D,Q,ce,"≃","\\simeq",!0);A(D,Q,ce,"∣","\\mid",!0);A(D,Q,ce,"≪","\\ll",!0);A(D,Q,ce,"≫","\\gg",!0);A(D,Q,ce,"≍","\\asymp",!0);A(D,Q,ce,"∥","\\parallel");A(D,Q,ce,"⋈","\\bowtie",!0);A(D,Q,ce,"⌣","\\smile",!0);A(D,Q,ce,"⊑","\\sqsubseteq",!0);A(D,Q,ce,"⊒","\\sqsupseteq",!0);A(D,Q,ce,"≐","\\doteq",!0);A(D,Q,ce,"⌢","\\frown",!0);A(D,Q,ce,"∋","\\ni",!0);A(D,Q,ce,"∝","\\propto",!0);A(D,Q,ce,"⊢","\\vdash",!0);A(D,Q,ce,"⊣","\\dashv",!0);A(D,Q,ce,"∋","\\owns");A(D,Q,yy,".","\\ldotp");A(D,Q,yy,"⋅","\\cdotp");A(D,Q,pe,"#","\\#");A(Le,Q,pe,"#","\\#");A(D,Q,pe,"&","\\&");A(Le,Q,pe,"&","\\&");A(D,Q,pe,"ℵ","\\aleph",!0);A(D,Q,pe,"∀","\\forall",!0);A(D,Q,pe,"ℏ","\\hbar",!0);A(D,Q,pe,"∃","\\exists",!0);A(D,Q,pe,"∇","\\nabla",!0);A(D,Q,pe,"♭","\\flat",!0);A(D,Q,pe,"ℓ","\\ell",!0);A(D,Q,pe,"♮","\\natural",!0);A(D,Q,pe,"♣","\\clubsuit",!0);A(D,Q,pe,"℘","\\wp",!0);A(D,Q,pe,"♯","\\sharp",!0);A(D,Q,pe,"♢","\\diamondsuit",!0);A(D,Q,pe,"ℜ","\\Re",!0);A(D,Q,pe,"♡","\\heartsuit",!0);A(D,Q,pe,"ℑ","\\Im",!0);A(D,Q,pe,"♠","\\spadesuit",!0);A(D,Q,pe,"§","\\S",!0);A(Le,Q,pe,"§","\\S");A(D,Q,pe,"¶","\\P",!0);A(Le,Q,pe,"¶","\\P");A(D,Q,pe,"†","\\dag");A(Le,Q,pe,"†","\\dag");A(Le,Q,pe,"†","\\textdagger");A(D,Q,pe,"‡","\\ddag");A(Le,Q,pe,"‡","\\ddag");A(Le,Q,pe,"‡","\\textdaggerdbl");A(D,Q,Ls,"⎱","\\rmoustache",!0);A(D,Q,zi,"⎰","\\lmoustache",!0);A(D,Q,Ls,"⟯","\\rgroup",!0);A(D,Q,zi,"⟮","\\lgroup",!0);A(D,Q,nt,"∓","\\mp",!0);A(D,Q,nt,"⊖","\\ominus",!0);A(D,Q,nt,"⊎","\\uplus",!0);A(D,Q,nt,"⊓","\\sqcap",!0);A(D,Q,nt,"∗","\\ast");A(D,Q,nt,"⊔","\\sqcup",!0);A(D,Q,nt,"◯","\\bigcirc",!0);A(D,Q,nt,"∙","\\bullet",!0);A(D,Q,nt,"‡","\\ddagger");A(D,Q,nt,"≀","\\wr",!0);A(D,Q,nt,"⨿","\\amalg");A(D,Q,nt,"&","\\And");A(D,Q,ce,"⟵","\\longleftarrow",!0);A(D,Q,ce,"⇐","\\Leftarrow",!0);A(D,Q,ce,"⟸","\\Longleftarrow",!0);A(D,Q,ce,"⟶","\\longrightarrow",!0);A(D,Q,ce,"⇒","\\Rightarrow",!0);A(D,Q,ce,"⟹","\\Longrightarrow",!0);A(D,Q,ce,"↔","\\leftrightarrow",!0);A(D,Q,ce,"⟷","\\longleftrightarrow",!0);A(D,Q,ce,"⇔","\\Leftrightarrow",!0);A(D,Q,ce,"⟺","\\Longleftrightarrow",!0);A(D,Q,ce,"↦","\\mapsto",!0);A(D,Q,ce,"⟼","\\longmapsto",!0);A(D,Q,ce,"↗","\\nearrow",!0);A(D,Q,ce,"↩","\\hookleftarrow",!0);A(D,Q,ce,"↪","\\hookrightarrow",!0);A(D,Q,ce,"↘","\\searrow",!0);A(D,Q,ce,"↼","\\leftharpoonup",!0);A(D,Q,ce,"⇀","\\rightharpoonup",!0);A(D,Q,ce,"↙","\\swarrow",!0);A(D,Q,ce,"↽","\\leftharpoondown",!0);A(D,Q,ce,"⇁","\\rightharpoondown",!0);A(D,Q,ce,"↖","\\nwarrow",!0);A(D,Q,ce,"⇌","\\rightleftharpoons",!0);A(D,oe,ce,"≮","\\nless",!0);A(D,oe,ce,"","\\@nleqslant");A(D,oe,ce,"","\\@nleqq");A(D,oe,ce,"⪇","\\lneq",!0);A(D,oe,ce,"≨","\\lneqq",!0);A(D,oe,ce,"","\\@lvertneqq");A(D,oe,ce,"⋦","\\lnsim",!0);A(D,oe,ce,"⪉","\\lnapprox",!0);A(D,oe,ce,"⊀","\\nprec",!0);A(D,oe,ce,"⋠","\\npreceq",!0);A(D,oe,ce,"⋨","\\precnsim",!0);A(D,oe,ce,"⪹","\\precnapprox",!0);A(D,oe,ce,"≁","\\nsim",!0);A(D,oe,ce,"","\\@nshortmid");A(D,oe,ce,"∤","\\nmid",!0);A(D,oe,ce,"⊬","\\nvdash",!0);A(D,oe,ce,"⊭","\\nvDash",!0);A(D,oe,ce,"⋪","\\ntriangleleft");A(D,oe,ce,"⋬","\\ntrianglelefteq",!0);A(D,oe,ce,"⊊","\\subsetneq",!0);A(D,oe,ce,"","\\@varsubsetneq");A(D,oe,ce,"⫋","\\subsetneqq",!0);A(D,oe,ce,"","\\@varsubsetneqq");A(D,oe,ce,"≯","\\ngtr",!0);A(D,oe,ce,"","\\@ngeqslant");A(D,oe,ce,"","\\@ngeqq");A(D,oe,ce,"⪈","\\gneq",!0);A(D,oe,ce,"≩","\\gneqq",!0);A(D,oe,ce,"","\\@gvertneqq");A(D,oe,ce,"⋧","\\gnsim",!0);A(D,oe,ce,"⪊","\\gnapprox",!0);A(D,oe,ce,"⊁","\\nsucc",!0);A(D,oe,ce,"⋡","\\nsucceq",!0);A(D,oe,ce,"⋩","\\succnsim",!0);A(D,oe,ce,"⪺","\\succnapprox",!0);A(D,oe,ce,"≆","\\ncong",!0);A(D,oe,ce,"","\\@nshortparallel");A(D,oe,ce,"∦","\\nparallel",!0);A(D,oe,ce,"⊯","\\nVDash",!0);A(D,oe,ce,"⋫","\\ntriangleright");A(D,oe,ce,"⋭","\\ntrianglerighteq",!0);A(D,oe,ce,"","\\@nsupseteqq");A(D,oe,ce,"⊋","\\supsetneq",!0);A(D,oe,ce,"","\\@varsupsetneq");A(D,oe,ce,"⫌","\\supsetneqq",!0);A(D,oe,ce,"","\\@varsupsetneqq");A(D,oe,ce,"⊮","\\nVdash",!0);A(D,oe,ce,"⪵","\\precneqq",!0);A(D,oe,ce,"⪶","\\succneqq",!0);A(D,oe,ce,"","\\@nsubseteqq");A(D,oe,nt,"⊴","\\unlhd");A(D,oe,nt,"⊵","\\unrhd");A(D,oe,ce,"↚","\\nleftarrow",!0);A(D,oe,ce,"↛","\\nrightarrow",!0);A(D,oe,ce,"⇍","\\nLeftarrow",!0);A(D,oe,ce,"⇏","\\nRightarrow",!0);A(D,oe,ce,"↮","\\nleftrightarrow",!0);A(D,oe,ce,"⇎","\\nLeftrightarrow",!0);A(D,oe,ce,"△","\\vartriangle");A(D,oe,pe,"ℏ","\\hslash");A(D,oe,pe,"▽","\\triangledown");A(D,oe,pe,"◊","\\lozenge");A(D,oe,pe,"Ⓢ","\\circledS");A(D,oe,pe,"®","\\circledR");A(Le,oe,pe,"®","\\circledR");A(D,oe,pe,"∡","\\measuredangle",!0);A(D,oe,pe,"∄","\\nexists");A(D,oe,pe,"℧","\\mho");A(D,oe,pe,"Ⅎ","\\Finv",!0);A(D,oe,pe,"⅁","\\Game",!0);A(D,oe,pe,"‵","\\backprime");A(D,oe,pe,"▲","\\blacktriangle");A(D,oe,pe,"▼","\\blacktriangledown");A(D,oe,pe,"■","\\blacksquare");A(D,oe,pe,"⧫","\\blacklozenge");A(D,oe,pe,"★","\\bigstar");A(D,oe,pe,"∢","\\sphericalangle",!0);A(D,oe,pe,"∁","\\complement",!0);A(D,oe,pe,"ð","\\eth",!0);A(Le,Q,pe,"ð","ð");A(D,oe,pe,"╱","\\diagup");A(D,oe,pe,"╲","\\diagdown");A(D,oe,pe,"□","\\square");A(D,oe,pe,"□","\\Box");A(D,oe,pe,"◊","\\Diamond");A(D,oe,pe,"¥","\\yen",!0);A(Le,oe,pe,"¥","\\yen",!0);A(D,oe,pe,"✓","\\checkmark",!0);A(Le,oe,pe,"✓","\\checkmark");A(D,oe,pe,"ℶ","\\beth",!0);A(D,oe,pe,"ℸ","\\daleth",!0);A(D,oe,pe,"ℷ","\\gimel",!0);A(D,oe,pe,"ϝ","\\digamma",!0);A(D,oe,pe,"ϰ","\\varkappa");A(D,oe,zi,"┌","\\@ulcorner",!0);A(D,oe,Ls,"┐","\\@urcorner",!0);A(D,oe,zi,"└","\\@llcorner",!0);A(D,oe,Ls,"┘","\\@lrcorner",!0);A(D,oe,ce,"≦","\\leqq",!0);A(D,oe,ce,"⩽","\\leqslant",!0);A(D,oe,ce,"⪕","\\eqslantless",!0);A(D,oe,ce,"≲","\\lesssim",!0);A(D,oe,ce,"⪅","\\lessapprox",!0);A(D,oe,ce,"≊","\\approxeq",!0);A(D,oe,nt,"⋖","\\lessdot");A(D,oe,ce,"⋘","\\lll",!0);A(D,oe,ce,"≶","\\lessgtr",!0);A(D,oe,ce,"⋚","\\lesseqgtr",!0);A(D,oe,ce,"⪋","\\lesseqqgtr",!0);A(D,oe,ce,"≑","\\doteqdot");A(D,oe,ce,"≓","\\risingdotseq",!0);A(D,oe,ce,"≒","\\fallingdotseq",!0);A(D,oe,ce,"∽","\\backsim",!0);A(D,oe,ce,"⋍","\\backsimeq",!0);A(D,oe,ce,"⫅","\\subseteqq",!0);A(D,oe,ce,"⋐","\\Subset",!0);A(D,oe,ce,"⊏","\\sqsubset",!0);A(D,oe,ce,"≼","\\preccurlyeq",!0);A(D,oe,ce,"⋞","\\curlyeqprec",!0);A(D,oe,ce,"≾","\\precsim",!0);A(D,oe,ce,"⪷","\\precapprox",!0);A(D,oe,ce,"⊲","\\vartriangleleft");A(D,oe,ce,"⊴","\\trianglelefteq");A(D,oe,ce,"⊨","\\vDash",!0);A(D,oe,ce,"⊪","\\Vvdash",!0);A(D,oe,ce,"⌣","\\smallsmile");A(D,oe,ce,"⌢","\\smallfrown");A(D,oe,ce,"≏","\\bumpeq",!0);A(D,oe,ce,"≎","\\Bumpeq",!0);A(D,oe,ce,"≧","\\geqq",!0);A(D,oe,ce,"⩾","\\geqslant",!0);A(D,oe,ce,"⪖","\\eqslantgtr",!0);A(D,oe,ce,"≳","\\gtrsim",!0);A(D,oe,ce,"⪆","\\gtrapprox",!0);A(D,oe,nt,"⋗","\\gtrdot");A(D,oe,ce,"⋙","\\ggg",!0);A(D,oe,ce,"≷","\\gtrless",!0);A(D,oe,ce,"⋛","\\gtreqless",!0);A(D,oe,ce,"⪌","\\gtreqqless",!0);A(D,oe,ce,"≖","\\eqcirc",!0);A(D,oe,ce,"≗","\\circeq",!0);A(D,oe,ce,"≜","\\triangleq",!0);A(D,oe,ce,"∼","\\thicksim");A(D,oe,ce,"≈","\\thickapprox");A(D,oe,ce,"⫆","\\supseteqq",!0);A(D,oe,ce,"⋑","\\Supset",!0);A(D,oe,ce,"⊐","\\sqsupset",!0);A(D,oe,ce,"≽","\\succcurlyeq",!0);A(D,oe,ce,"⋟","\\curlyeqsucc",!0);A(D,oe,ce,"≿","\\succsim",!0);A(D,oe,ce,"⪸","\\succapprox",!0);A(D,oe,ce,"⊳","\\vartriangleright");A(D,oe,ce,"⊵","\\trianglerighteq");A(D,oe,ce,"⊩","\\Vdash",!0);A(D,oe,ce,"∣","\\shortmid");A(D,oe,ce,"∥","\\shortparallel");A(D,oe,ce,"≬","\\between",!0);A(D,oe,ce,"⋔","\\pitchfork",!0);A(D,oe,ce,"∝","\\varpropto");A(D,oe,ce,"◀","\\blacktriangleleft");A(D,oe,ce,"∴","\\therefore",!0);A(D,oe,ce,"∍","\\backepsilon");A(D,oe,ce,"▶","\\blacktriangleright");A(D,oe,ce,"∵","\\because",!0);A(D,oe,ce,"⋘","\\llless");A(D,oe,ce,"⋙","\\gggtr");A(D,oe,nt,"⊲","\\lhd");A(D,oe,nt,"⊳","\\rhd");A(D,oe,ce,"≂","\\eqsim",!0);A(D,Q,ce,"⋈","\\Join");A(D,oe,ce,"≑","\\Doteq",!0);A(D,oe,nt,"∔","\\dotplus",!0);A(D,oe,nt,"∖","\\smallsetminus");A(D,oe,nt,"⋒","\\Cap",!0);A(D,oe,nt,"⋓","\\Cup",!0);A(D,oe,nt,"⩞","\\doublebarwedge",!0);A(D,oe,nt,"⊟","\\boxminus",!0);A(D,oe,nt,"⊞","\\boxplus",!0);A(D,oe,nt,"⋇","\\divideontimes",!0);A(D,oe,nt,"⋉","\\ltimes",!0);A(D,oe,nt,"⋊","\\rtimes",!0);A(D,oe,nt,"⋋","\\leftthreetimes",!0);A(D,oe,nt,"⋌","\\rightthreetimes",!0);A(D,oe,nt,"⋏","\\curlywedge",!0);A(D,oe,nt,"⋎","\\curlyvee",!0);A(D,oe,nt,"⊝","\\circleddash",!0);A(D,oe,nt,"⊛","\\circledast",!0);A(D,oe,nt,"⋅","\\centerdot");A(D,oe,nt,"⊺","\\intercal",!0);A(D,oe,nt,"⋒","\\doublecap");A(D,oe,nt,"⋓","\\doublecup");A(D,oe,nt,"⊠","\\boxtimes",!0);A(D,oe,ce,"⇢","\\dashrightarrow",!0);A(D,oe,ce,"⇠","\\dashleftarrow",!0);A(D,oe,ce,"⇇","\\leftleftarrows",!0);A(D,oe,ce,"⇆","\\leftrightarrows",!0);A(D,oe,ce,"⇚","\\Lleftarrow",!0);A(D,oe,ce,"↞","\\twoheadleftarrow",!0);A(D,oe,ce,"↢","\\leftarrowtail",!0);A(D,oe,ce,"↫","\\looparrowleft",!0);A(D,oe,ce,"⇋","\\leftrightharpoons",!0);A(D,oe,ce,"↶","\\curvearrowleft",!0);A(D,oe,ce,"↺","\\circlearrowleft",!0);A(D,oe,ce,"↰","\\Lsh",!0);A(D,oe,ce,"⇈","\\upuparrows",!0);A(D,oe,ce,"↿","\\upharpoonleft",!0);A(D,oe,ce,"⇃","\\downharpoonleft",!0);A(D,Q,ce,"⊶","\\origof",!0);A(D,Q,ce,"⊷","\\imageof",!0);A(D,oe,ce,"⊸","\\multimap",!0);A(D,oe,ce,"↭","\\leftrightsquigarrow",!0);A(D,oe,ce,"⇉","\\rightrightarrows",!0);A(D,oe,ce,"⇄","\\rightleftarrows",!0);A(D,oe,ce,"↠","\\twoheadrightarrow",!0);A(D,oe,ce,"↣","\\rightarrowtail",!0);A(D,oe,ce,"↬","\\looparrowright",!0);A(D,oe,ce,"↷","\\curvearrowright",!0);A(D,oe,ce,"↻","\\circlearrowright",!0);A(D,oe,ce,"↱","\\Rsh",!0);A(D,oe,ce,"⇊","\\downdownarrows",!0);A(D,oe,ce,"↾","\\upharpoonright",!0);A(D,oe,ce,"⇂","\\downharpoonright",!0);A(D,oe,ce,"⇝","\\rightsquigarrow",!0);A(D,oe,ce,"⇝","\\leadsto");A(D,oe,ce,"⇛","\\Rrightarrow",!0);A(D,oe,ce,"↾","\\restriction");A(D,Q,pe,"‘","`");A(D,Q,pe,"$","\\$");A(Le,Q,pe,"$","\\$");A(Le,Q,pe,"$","\\textdollar");A(D,Q,pe,"%","\\%");A(Le,Q,pe,"%","\\%");A(D,Q,pe,"_","\\_");A(Le,Q,pe,"_","\\_");A(Le,Q,pe,"_","\\textunderscore");A(D,Q,pe,"∠","\\angle",!0);A(D,Q,pe,"∞","\\infty",!0);A(D,Q,pe,"′","\\prime");A(D,Q,pe,"△","\\triangle");A(D,Q,pe,"Γ","\\Gamma",!0);A(D,Q,pe,"Δ","\\Delta",!0);A(D,Q,pe,"Θ","\\Theta",!0);A(D,Q,pe,"Λ","\\Lambda",!0);A(D,Q,pe,"Ξ","\\Xi",!0);A(D,Q,pe,"Π","\\Pi",!0);A(D,Q,pe,"Σ","\\Sigma",!0);A(D,Q,pe,"Υ","\\Upsilon",!0);A(D,Q,pe,"Φ","\\Phi",!0);A(D,Q,pe,"Ψ","\\Psi",!0);A(D,Q,pe,"Ω","\\Omega",!0);A(D,Q,pe,"A","Α");A(D,Q,pe,"B","Β");A(D,Q,pe,"E","Ε");A(D,Q,pe,"Z","Ζ");A(D,Q,pe,"H","Η");A(D,Q,pe,"I","Ι");A(D,Q,pe,"K","Κ");A(D,Q,pe,"M","Μ");A(D,Q,pe,"N","Ν");A(D,Q,pe,"O","Ο");A(D,Q,pe,"P","Ρ");A(D,Q,pe,"T","Τ");A(D,Q,pe,"X","Χ");A(D,Q,pe,"¬","\\neg",!0);A(D,Q,pe,"¬","\\lnot");A(D,Q,pe,"⊤","\\top");A(D,Q,pe,"⊥","\\bot");A(D,Q,pe,"∅","\\emptyset");A(D,oe,pe,"∅","\\varnothing");A(D,Q,St,"α","\\alpha",!0);A(D,Q,St,"β","\\beta",!0);A(D,Q,St,"γ","\\gamma",!0);A(D,Q,St,"δ","\\delta",!0);A(D,Q,St,"ϵ","\\epsilon",!0);A(D,Q,St,"ζ","\\zeta",!0);A(D,Q,St,"η","\\eta",!0);A(D,Q,St,"θ","\\theta",!0);A(D,Q,St,"ι","\\iota",!0);A(D,Q,St,"κ","\\kappa",!0);A(D,Q,St,"λ","\\lambda",!0);A(D,Q,St,"μ","\\mu",!0);A(D,Q,St,"ν","\\nu",!0);A(D,Q,St,"ξ","\\xi",!0);A(D,Q,St,"ο","\\omicron",!0);A(D,Q,St,"π","\\pi",!0);A(D,Q,St,"ρ","\\rho",!0);A(D,Q,St,"σ","\\sigma",!0);A(D,Q,St,"τ","\\tau",!0);A(D,Q,St,"υ","\\upsilon",!0);A(D,Q,St,"ϕ","\\phi",!0);A(D,Q,St,"χ","\\chi",!0);A(D,Q,St,"ψ","\\psi",!0);A(D,Q,St,"ω","\\omega",!0);A(D,Q,St,"ε","\\varepsilon",!0);A(D,Q,St,"ϑ","\\vartheta",!0);A(D,Q,St,"ϖ","\\varpi",!0);A(D,Q,St,"ϱ","\\varrho",!0);A(D,Q,St,"ς","\\varsigma",!0);A(D,Q,St,"φ","\\varphi",!0);A(D,Q,nt,"∗","*",!0);A(D,Q,nt,"+","+");A(D,Q,nt,"−","-",!0);A(D,Q,nt,"⋅","\\cdot",!0);A(D,Q,nt,"∘","\\circ",!0);A(D,Q,nt,"÷","\\div",!0);A(D,Q,nt,"±","\\pm",!0);A(D,Q,nt,"×","\\times",!0);A(D,Q,nt,"∩","\\cap",!0);A(D,Q,nt,"∪","\\cup",!0);A(D,Q,nt,"∖","\\setminus",!0);A(D,Q,nt,"∧","\\land");A(D,Q,nt,"∨","\\lor");A(D,Q,nt,"∧","\\wedge",!0);A(D,Q,nt,"∨","\\vee",!0);A(D,Q,pe,"√","\\surd");A(D,Q,zi,"⟨","\\langle",!0);A(D,Q,zi,"∣","\\lvert");A(D,Q,zi,"∥","\\lVert");A(D,Q,Ls,"?","?");A(D,Q,Ls,"!","!");A(D,Q,Ls,"⟩","\\rangle",!0);A(D,Q,Ls,"∣","\\rvert");A(D,Q,Ls,"∥","\\rVert");A(D,Q,ce,"=","=");A(D,Q,ce,":",":");A(D,Q,ce,"≈","\\approx",!0);A(D,Q,ce,"≅","\\cong",!0);A(D,Q,ce,"≥","\\ge");A(D,Q,ce,"≥","\\geq",!0);A(D,Q,ce,"←","\\gets");A(D,Q,ce,">","\\gt",!0);A(D,Q,ce,"∈","\\in",!0);A(D,Q,ce,"","\\@not");A(D,Q,ce,"⊂","\\subset",!0);A(D,Q,ce,"⊃","\\supset",!0);A(D,Q,ce,"⊆","\\subseteq",!0);A(D,Q,ce,"⊇","\\supseteq",!0);A(D,oe,ce,"⊈","\\nsubseteq",!0);A(D,oe,ce,"⊉","\\nsupseteq",!0);A(D,Q,ce,"⊨","\\models");A(D,Q,ce,"←","\\leftarrow",!0);A(D,Q,ce,"≤","\\le");A(D,Q,ce,"≤","\\leq",!0);A(D,Q,ce,"<","\\lt",!0);A(D,Q,ce,"→","\\rightarrow",!0);A(D,Q,ce,"→","\\to");A(D,oe,ce,"≱","\\ngeq",!0);A(D,oe,ce,"≰","\\nleq",!0);A(D,Q,Oo," ","\\ ");A(D,Q,Oo," ","\\space");A(D,Q,Oo," ","\\nobreakspace");A(Le,Q,Oo," ","\\ ");A(Le,Q,Oo," "," ");A(Le,Q,Oo," ","\\space");A(Le,Q,Oo," ","\\nobreakspace");A(D,Q,Oo,null,"\\nobreak");A(D,Q,Oo,null,"\\allowbreak");A(D,Q,yy,",",",");A(D,Q,yy,";",";");A(D,oe,nt,"⊼","\\barwedge",!0);A(D,oe,nt,"⊻","\\veebar",!0);A(D,Q,nt,"⊙","\\odot",!0);A(D,Q,nt,"⊕","\\oplus",!0);A(D,Q,nt,"⊗","\\otimes",!0);A(D,Q,pe,"∂","\\partial",!0);A(D,Q,nt,"⊘","\\oslash",!0);A(D,oe,nt,"⊚","\\circledcirc",!0);A(D,oe,nt,"⊡","\\boxdot",!0);A(D,Q,nt,"△","\\bigtriangleup");A(D,Q,nt,"▽","\\bigtriangledown");A(D,Q,nt,"†","\\dagger");A(D,Q,nt,"⋄","\\diamond");A(D,Q,nt,"⋆","\\star");A(D,Q,nt,"◃","\\triangleleft");A(D,Q,nt,"▹","\\triangleright");A(D,Q,zi,"{","\\{");A(Le,Q,pe,"{","\\{");A(Le,Q,pe,"{","\\textbraceleft");A(D,Q,Ls,"}","\\}");A(Le,Q,pe,"}","\\}");A(Le,Q,pe,"}","\\textbraceright");A(D,Q,zi,"{","\\lbrace");A(D,Q,Ls,"}","\\rbrace");A(D,Q,zi,"[","\\lbrack",!0);A(Le,Q,pe,"[","\\lbrack",!0);A(D,Q,Ls,"]","\\rbrack",!0);A(Le,Q,pe,"]","\\rbrack",!0);A(D,Q,zi,"(","\\lparen",!0);A(D,Q,Ls,")","\\rparen",!0);A(Le,Q,pe,"<","\\textless",!0);A(Le,Q,pe,">","\\textgreater",!0);A(D,Q,zi,"⌊","\\lfloor",!0);A(D,Q,Ls,"⌋","\\rfloor",!0);A(D,Q,zi,"⌈","\\lceil",!0);A(D,Q,Ls,"⌉","\\rceil",!0);A(D,Q,pe,"\\","\\backslash");A(D,Q,pe,"∣","|");A(D,Q,pe,"∣","\\vert");A(Le,Q,pe,"|","\\textbar",!0);A(D,Q,pe,"∥","\\|");A(D,Q,pe,"∥","\\Vert");A(Le,Q,pe,"∥","\\textbardbl");A(Le,Q,pe,"~","\\textasciitilde");A(Le,Q,pe,"\\","\\textbackslash");A(Le,Q,pe,"^","\\textasciicircum");A(D,Q,ce,"↑","\\uparrow",!0);A(D,Q,ce,"⇑","\\Uparrow",!0);A(D,Q,ce,"↓","\\downarrow",!0);A(D,Q,ce,"⇓","\\Downarrow",!0);A(D,Q,ce,"↕","\\updownarrow",!0);A(D,Q,ce,"⇕","\\Updownarrow",!0);A(D,Q,qr,"∐","\\coprod");A(D,Q,qr,"⋁","\\bigvee");A(D,Q,qr,"⋀","\\bigwedge");A(D,Q,qr,"⨄","\\biguplus");A(D,Q,qr,"⋂","\\bigcap");A(D,Q,qr,"⋃","\\bigcup");A(D,Q,qr,"∫","\\int");A(D,Q,qr,"∫","\\intop");A(D,Q,qr,"∬","\\iint");A(D,Q,qr,"∭","\\iiint");A(D,Q,qr,"∏","\\prod");A(D,Q,qr,"∑","\\sum");A(D,Q,qr,"⨂","\\bigotimes");A(D,Q,qr,"⨁","\\bigoplus");A(D,Q,qr,"⨀","\\bigodot");A(D,Q,qr,"∮","\\oint");A(D,Q,qr,"∯","\\oiint");A(D,Q,qr,"∰","\\oiiint");A(D,Q,qr,"⨆","\\bigsqcup");A(D,Q,qr,"∫","\\smallint");A(Le,Q,Jh,"…","\\textellipsis");A(D,Q,Jh,"…","\\mathellipsis");A(Le,Q,Jh,"…","\\ldots",!0);A(D,Q,Jh,"…","\\ldots",!0);A(D,Q,Jh,"⋯","\\@cdots",!0);A(D,Q,Jh,"⋱","\\ddots",!0);A(D,Q,pe,"⋮","\\varvdots");A(Le,Q,pe,"⋮","\\varvdots");A(D,Q,ar,"ˊ","\\acute");A(D,Q,ar,"ˋ","\\grave");A(D,Q,ar,"¨","\\ddot");A(D,Q,ar,"~","\\tilde");A(D,Q,ar,"ˉ","\\bar");A(D,Q,ar,"˘","\\breve");A(D,Q,ar,"ˇ","\\check");A(D,Q,ar,"^","\\hat");A(D,Q,ar,"⃗","\\vec");A(D,Q,ar,"˙","\\dot");A(D,Q,ar,"˚","\\mathring");A(D,Q,St,"","\\@imath");A(D,Q,St,"","\\@jmath");A(D,Q,pe,"ı","ı");A(D,Q,pe,"ȷ","ȷ");A(Le,Q,pe,"ı","\\i",!0);A(Le,Q,pe,"ȷ","\\j",!0);A(Le,Q,pe,"ß","\\ss",!0);A(Le,Q,pe,"æ","\\ae",!0);A(Le,Q,pe,"œ","\\oe",!0);A(Le,Q,pe,"ø","\\o",!0);A(Le,Q,pe,"Æ","\\AE",!0);A(Le,Q,pe,"Œ","\\OE",!0);A(Le,Q,pe,"Ø","\\O",!0);A(Le,Q,ar,"ˊ","\\'");A(Le,Q,ar,"ˋ","\\`");A(Le,Q,ar,"ˆ","\\^");A(Le,Q,ar,"˜","\\~");A(Le,Q,ar,"ˉ","\\=");A(Le,Q,ar,"˘","\\u");A(Le,Q,ar,"˙","\\.");A(Le,Q,ar,"¸","\\c");A(Le,Q,ar,"˚","\\r");A(Le,Q,ar,"ˇ","\\v");A(Le,Q,ar,"¨",'\\"');A(Le,Q,ar,"˝","\\H");A(Le,Q,ar,"◯","\\textcircled");var J$={"--":!0,"---":!0,"``":!0,"''":!0};A(Le,Q,pe,"–","--",!0);A(Le,Q,pe,"–","\\textendash");A(Le,Q,pe,"—","---",!0);A(Le,Q,pe,"—","\\textemdash");A(Le,Q,pe,"‘","`",!0);A(Le,Q,pe,"‘","\\textquoteleft");A(Le,Q,pe,"’","'",!0);A(Le,Q,pe,"’","\\textquoteright");A(Le,Q,pe,"“","``",!0);A(Le,Q,pe,"“","\\textquotedblleft");A(Le,Q,pe,"”","''",!0);A(Le,Q,pe,"”","\\textquotedblright");A(D,Q,pe,"°","\\degree",!0);A(Le,Q,pe,"°","\\degree");A(Le,Q,pe,"°","\\textdegree",!0);A(D,Q,pe,"£","\\pounds");A(D,Q,pe,"£","\\mathsterling",!0);A(Le,Q,pe,"£","\\pounds");A(Le,Q,pe,"£","\\textsterling",!0);A(D,oe,pe,"✠","\\maltese");A(Le,oe,pe,"✠","\\maltese");var Z_='0123456789/@."';for(var v4=0;v40)return wa(i,h,s,n,a.concat(f));if(c){var m,g;if(c==="boldsymbol"){var x=gbe(i,s,n,a,r);m=x.fontName,g=[x.fontClass]}else o?(m=nQ[c].fontName,g=[c]):(m=Mx(c,n.fontWeight,n.fontShape),g=[c,n.fontWeight,n.fontShape]);if(by(i,m,s).metrics)return wa(i,m,s,n,a.concat(g));if(J$.hasOwnProperty(i)&&m.slice(0,10)==="Typewriter"){for(var y=[],w=0;w{if(Oc(t.classes)!==Oc(e.classes)||t.skew!==e.skew||t.maxFontSize!==e.maxFontSize)return!1;if(t.classes.length===1){var n=t.classes[0];if(n==="mbin"||n==="mord")return!1}for(var r in t.style)if(t.style.hasOwnProperty(r)&&t.style[r]!==e.style[r])return!1;for(var s in e.style)if(e.style.hasOwnProperty(s)&&t.style[s]!==e.style[s])return!1;return!0},ybe=t=>{for(var e=0;en&&(n=a.height),a.depth>r&&(r=a.depth),a.maxFontSize>s&&(s=a.maxFontSize)}e.height=n,e.depth=r,e.maxFontSize=s},Xs=function(e,n,r,s){var i=new dp(e,n,r,s);return WO(i),i},eQ=(t,e,n,r)=>new dp(t,e,n,r),bbe=function(e,n,r){var s=Xs([e],[],n);return s.height=Math.max(r||n.fontMetrics().defaultRuleThickness,n.minRuleThickness),s.style.borderBottomWidth=Ve(s.height),s.maxFontSize=1,s},wbe=function(e,n,r,s){var i=new UO(e,n,r,s);return WO(i),i},tQ=function(e){var n=new up(e);return WO(n),n},Sbe=function(e,n){return e instanceof up?Xs([],[e],n):e},kbe=function(e){if(e.positionType==="individualShift"){for(var n=e.children,r=[n[0]],s=-n[0].shift-n[0].elem.depth,i=s,a=1;a{var n=Xs(["mspace"],[],e),r=hr(t,e);return n.style.marginRight=Ve(r),n},Mx=function(e,n,r){var s="";switch(e){case"amsrm":s="AMS";break;case"textrm":s="Main";break;case"textsf":s="SansSerif";break;case"texttt":s="Typewriter";break;default:s=e}var i;return n==="textbf"&&r==="textit"?i="BoldItalic":n==="textbf"?i="Bold":n==="textit"?i="Italic":i="Regular",s+"-"+i},nQ={mathbf:{variant:"bold",fontName:"Main-Bold"},mathrm:{variant:"normal",fontName:"Main-Regular"},textit:{variant:"italic",fontName:"Main-Italic"},mathit:{variant:"italic",fontName:"Main-Italic"},mathnormal:{variant:"italic",fontName:"Math-Italic"},mathsfit:{variant:"sans-serif-italic",fontName:"SansSerif-Italic"},mathbb:{variant:"double-struck",fontName:"AMS-Regular"},mathcal:{variant:"script",fontName:"Caligraphic-Regular"},mathfrak:{variant:"fraktur",fontName:"Fraktur-Regular"},mathscr:{variant:"script",fontName:"Script-Regular"},mathsf:{variant:"sans-serif",fontName:"SansSerif-Regular"},mathtt:{variant:"monospace",fontName:"Typewriter-Regular"}},rQ={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659]},Nbe=function(e,n){var[r,s,i]=rQ[e],a=new jc(r),o=new go([a],{width:Ve(s),height:Ve(i),style:"width:"+Ve(s),viewBox:"0 0 "+1e3*s+" "+1e3*i,preserveAspectRatio:"xMinYMin"}),c=eQ(["overlay"],[o],n);return c.height=i,c.style.height=Ve(i),c.style.width=Ve(s),c},we={fontMap:nQ,makeSymbol:wa,mathsym:pbe,makeSpan:Xs,makeSvgSpan:eQ,makeLineSpan:bbe,makeAnchor:wbe,makeFragment:tQ,wrapFragment:Sbe,makeVList:Obe,makeOrd:xbe,makeGlue:jbe,staticSvg:Nbe,svgData:rQ,tryCombineChars:ybe},cr={number:3,unit:"mu"},au={number:4,unit:"mu"},Hl={number:5,unit:"mu"},Cbe={mord:{mop:cr,mbin:au,mrel:Hl,minner:cr},mop:{mord:cr,mop:cr,mrel:Hl,minner:cr},mbin:{mord:au,mop:au,mopen:au,minner:au},mrel:{mord:Hl,mop:Hl,mopen:Hl,minner:Hl},mopen:{},mclose:{mop:cr,mbin:au,mrel:Hl,minner:cr},mpunct:{mord:cr,mop:cr,mrel:Hl,mopen:cr,mclose:cr,mpunct:cr,minner:cr},minner:{mord:cr,mop:cr,mbin:au,mrel:Hl,mopen:cr,mpunct:cr,minner:cr}},Tbe={mord:{mop:cr},mop:{mord:cr,mop:cr},mbin:{},mrel:{},mopen:{},mclose:{mop:cr},mpunct:{},minner:{mop:cr}},sQ={},uv={},dv={};function Ke(t){for(var{type:e,names:n,props:r,handler:s,htmlBuilder:i,mathmlBuilder:a}=t,o={type:e,numArgs:r.numArgs,argTypes:r.argTypes,allowedInArgument:!!r.allowedInArgument,allowedInText:!!r.allowedInText,allowedInMath:r.allowedInMath===void 0?!0:r.allowedInMath,numOptionalArgs:r.numOptionalArgs||0,infix:!!r.infix,primitive:!!r.primitive,handler:s},c=0;c{var S=w.classes[0],k=y.classes[0];S==="mbin"&&_be.includes(k)?w.classes[0]="mord":k==="mbin"&&Ebe.includes(S)&&(y.classes[0]="mord")},{node:m},g,x),rM(i,(y,w)=>{var S=ok(w),k=ok(y),N=S&&k?y.hasClass("mtight")?Tbe[S][k]:Cbe[S][k]:null;if(N)return we.makeGlue(N,h)},{node:m},g,x),i},rM=function t(e,n,r,s,i){s&&e.push(s);for(var a=0;ag=>{e.splice(m+1,0,g),a++})(a)}s&&e.pop()},iQ=function(e){return e instanceof up||e instanceof UO||e instanceof dp&&e.hasClass("enclosing")?e:null},Rbe=function t(e,n){var r=iQ(e);if(r){var s=r.children;if(s.length){if(n==="right")return t(s[s.length-1],"right");if(n==="left")return t(s[0],"left")}}return e},ok=function(e,n){return e?(n&&(e=Rbe(e,n)),Abe[e.classes[0]]||null):null},b0=function(e,n){var r=["nulldelimiter"].concat(e.baseSizingClasses());return xo(n.concat(r))},Sn=function(e,n,r){if(!e)return xo();if(uv[e.type]){var s=uv[e.type](e,n);if(r&&n.size!==r.size){s=xo(n.sizingClasses(r),[s],n);var i=n.sizeMultiplier/r.sizeMultiplier;s.height*=i,s.depth*=i}return s}else throw new Be("Got group of unknown type: '"+e.type+"'")};function Ax(t,e){var n=xo(["base"],t,e),r=xo(["strut"]);return r.style.height=Ve(n.height+n.depth),n.depth&&(r.style.verticalAlign=Ve(-n.depth)),n.children.unshift(r),n}function ck(t,e){var n=null;t.length===1&&t[0].type==="tag"&&(n=t[0].tag,t=t[0].body);var r=Wr(t,e,"root"),s;r.length===2&&r[1].hasClass("tag")&&(s=r.pop());for(var i=[],a=[],o=0;o0&&(i.push(Ax(a,e)),a=[]),i.push(r[o]));a.length>0&&i.push(Ax(a,e));var h;n?(h=Ax(Wr(n,e,!0)),h.classes=["tag"],i.push(h)):s&&i.push(s);var f=xo(["katex-html"],i);if(f.setAttribute("aria-hidden","true"),h){var m=h.children[0];m.style.height=Ve(f.height+f.depth),f.depth&&(m.style.verticalAlign=Ve(-f.depth))}return f}function aQ(t){return new up(t)}class Ci{constructor(e,n,r){this.type=void 0,this.attributes=void 0,this.children=void 0,this.classes=void 0,this.type=e,this.attributes={},this.children=n||[],this.classes=r||[]}setAttribute(e,n){this.attributes[e]=n}getAttribute(e){return this.attributes[e]}toNode(){var e=document.createElementNS("http://www.w3.org/1998/Math/MathML",this.type);for(var n in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,n)&&e.setAttribute(n,this.attributes[n]);this.classes.length>0&&(e.className=Oc(this.classes));for(var r=0;r0&&(e+=' class ="'+Nn.escape(Oc(this.classes))+'"'),e+=">";for(var r=0;r",e}toText(){return this.children.map(e=>e.toText()).join("")}}class rl{constructor(e){this.text=void 0,this.text=e}toNode(){return document.createTextNode(this.text)}toMarkup(){return Nn.escape(this.toText())}toText(){return this.text}}class Dbe{constructor(e){this.width=void 0,this.character=void 0,this.width=e,e>=.05555&&e<=.05556?this.character=" ":e>=.1666&&e<=.1667?this.character=" ":e>=.2222&&e<=.2223?this.character=" ":e>=.2777&&e<=.2778?this.character="  ":e>=-.05556&&e<=-.05555?this.character=" ⁣":e>=-.1667&&e<=-.1666?this.character=" ⁣":e>=-.2223&&e<=-.2222?this.character=" ⁣":e>=-.2778&&e<=-.2777?this.character=" ⁣":this.character=null}toNode(){if(this.character)return document.createTextNode(this.character);var e=document.createElementNS("http://www.w3.org/1998/Math/MathML","mspace");return e.setAttribute("width",Ve(this.width)),e}toMarkup(){return this.character?""+this.character+"":''}toText(){return this.character?this.character:" "}}var Ie={MathNode:Ci,TextNode:rl,SpaceNode:Dbe,newDocumentFragment:aQ},ca=function(e,n,r){return Gn[n][e]&&Gn[n][e].replace&&e.charCodeAt(0)!==55349&&!(J$.hasOwnProperty(e)&&r&&(r.fontFamily&&r.fontFamily.slice(4,6)==="tt"||r.font&&r.font.slice(4,6)==="tt"))&&(e=Gn[n][e].replace),new Ie.TextNode(e)},GO=function(e){return e.length===1?e[0]:new Ie.MathNode("mrow",e)},XO=function(e,n){if(n.fontFamily==="texttt")return"monospace";if(n.fontFamily==="textsf")return n.fontShape==="textit"&&n.fontWeight==="textbf"?"sans-serif-bold-italic":n.fontShape==="textit"?"sans-serif-italic":n.fontWeight==="textbf"?"bold-sans-serif":"sans-serif";if(n.fontShape==="textit"&&n.fontWeight==="textbf")return"bold-italic";if(n.fontShape==="textit")return"italic";if(n.fontWeight==="textbf")return"bold";var r=n.font;if(!r||r==="mathnormal")return null;var s=e.mode;if(r==="mathit")return"italic";if(r==="boldsymbol")return e.type==="textord"?"bold":"bold-italic";if(r==="mathbf")return"bold";if(r==="mathbb")return"double-struck";if(r==="mathsfit")return"sans-serif-italic";if(r==="mathfrak")return"fraktur";if(r==="mathscr"||r==="mathcal")return"script";if(r==="mathsf")return"sans-serif";if(r==="mathtt")return"monospace";var i=e.text;if(["\\imath","\\jmath"].includes(i))return null;Gn[s][i]&&Gn[s][i].replace&&(i=Gn[s][i].replace);var a=we.fontMap[r].fontName;return VO(i,a,s)?we.fontMap[r].variant:null};function S4(t){if(!t)return!1;if(t.type==="mi"&&t.children.length===1){var e=t.children[0];return e instanceof rl&&e.text==="."}else if(t.type==="mo"&&t.children.length===1&&t.getAttribute("separator")==="true"&&t.getAttribute("lspace")==="0em"&&t.getAttribute("rspace")==="0em"){var n=t.children[0];return n instanceof rl&&n.text===","}else return!1}var di=function(e,n,r){if(e.length===1){var s=Un(e[0],n);return r&&s instanceof Ci&&s.type==="mo"&&(s.setAttribute("lspace","0em"),s.setAttribute("rspace","0em")),[s]}for(var i=[],a,o=0;o=1&&(a.type==="mn"||S4(a))){var h=c.children[0];h instanceof Ci&&h.type==="mn"&&(h.children=[...a.children,...h.children],i.pop())}else if(a.type==="mi"&&a.children.length===1){var f=a.children[0];if(f instanceof rl&&f.text==="̸"&&(c.type==="mo"||c.type==="mi"||c.type==="mn")){var m=c.children[0];m instanceof rl&&m.text.length>0&&(m.text=m.text.slice(0,1)+"̸"+m.text.slice(1),i.pop())}}}i.push(c),a=c}return i},Nc=function(e,n,r){return GO(di(e,n,r))},Un=function(e,n){if(!e)return new Ie.MathNode("mrow");if(dv[e.type]){var r=dv[e.type](e,n);return r}else throw new Be("Got group of unknown type: '"+e.type+"'")};function sM(t,e,n,r,s){var i=di(t,n),a;i.length===1&&i[0]instanceof Ci&&["mrow","mtable"].includes(i[0].type)?a=i[0]:a=new Ie.MathNode("mrow",i);var o=new Ie.MathNode("annotation",[new Ie.TextNode(e)]);o.setAttribute("encoding","application/x-tex");var c=new Ie.MathNode("semantics",[a,o]),h=new Ie.MathNode("math",[c]);h.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),r&&h.setAttribute("display","block");var f=s?"katex":"katex-mathml";return we.makeSpan([f],[h])}var lQ=function(e){return new Zl({style:e.displayMode?kt.DISPLAY:kt.TEXT,maxSize:e.maxSize,minRuleThickness:e.minRuleThickness})},oQ=function(e,n){if(n.displayMode){var r=["katex-display"];n.leqno&&r.push("leqno"),n.fleqn&&r.push("fleqn"),e=we.makeSpan(r,[e])}return e},zbe=function(e,n,r){var s=lQ(r),i;if(r.output==="mathml")return sM(e,n,s,r.displayMode,!0);if(r.output==="html"){var a=ck(e,s);i=we.makeSpan(["katex"],[a])}else{var o=sM(e,n,s,r.displayMode,!1),c=ck(e,s);i=we.makeSpan(["katex"],[o,c])}return oQ(i,r)},Pbe=function(e,n,r){var s=lQ(r),i=ck(e,s),a=we.makeSpan(["katex"],[i]);return oQ(a,r)},Lbe={widehat:"^",widecheck:"ˇ",widetilde:"~",utilde:"~",overleftarrow:"←",underleftarrow:"←",xleftarrow:"←",overrightarrow:"→",underrightarrow:"→",xrightarrow:"→",underbrace:"⏟",overbrace:"⏞",overgroup:"⏠",undergroup:"⏡",overleftrightarrow:"↔",underleftrightarrow:"↔",xleftrightarrow:"↔",Overrightarrow:"⇒",xRightarrow:"⇒",overleftharpoon:"↼",xleftharpoonup:"↼",overrightharpoon:"⇀",xrightharpoonup:"⇀",xLeftarrow:"⇐",xLeftrightarrow:"⇔",xhookleftarrow:"↩",xhookrightarrow:"↪",xmapsto:"↦",xrightharpoondown:"⇁",xleftharpoondown:"↽",xrightleftharpoons:"⇌",xleftrightharpoons:"⇋",xtwoheadleftarrow:"↞",xtwoheadrightarrow:"↠",xlongequal:"=",xtofrom:"⇄",xrightleftarrows:"⇄",xrightequilibrium:"⇌",xleftequilibrium:"⇋","\\cdrightarrow":"→","\\cdleftarrow":"←","\\cdlongequal":"="},Ibe=function(e){var n=new Ie.MathNode("mo",[new Ie.TextNode(Lbe[e.replace(/^\\/,"")])]);return n.setAttribute("stretchy","true"),n},Bbe={overrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],overleftarrow:[["leftarrow"],.888,522,"xMinYMin"],underrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],underleftarrow:[["leftarrow"],.888,522,"xMinYMin"],xrightarrow:[["rightarrow"],1.469,522,"xMaxYMin"],"\\cdrightarrow":[["rightarrow"],3,522,"xMaxYMin"],xleftarrow:[["leftarrow"],1.469,522,"xMinYMin"],"\\cdleftarrow":[["leftarrow"],3,522,"xMinYMin"],Overrightarrow:[["doublerightarrow"],.888,560,"xMaxYMin"],xRightarrow:[["doublerightarrow"],1.526,560,"xMaxYMin"],xLeftarrow:[["doubleleftarrow"],1.526,560,"xMinYMin"],overleftharpoon:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoonup:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoondown:[["leftharpoondown"],.888,522,"xMinYMin"],overrightharpoon:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoonup:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoondown:[["rightharpoondown"],.888,522,"xMaxYMin"],xlongequal:[["longequal"],.888,334,"xMinYMin"],"\\cdlongequal":[["longequal"],3,334,"xMinYMin"],xtwoheadleftarrow:[["twoheadleftarrow"],.888,334,"xMinYMin"],xtwoheadrightarrow:[["twoheadrightarrow"],.888,334,"xMaxYMin"],overleftrightarrow:[["leftarrow","rightarrow"],.888,522],overbrace:[["leftbrace","midbrace","rightbrace"],1.6,548],underbrace:[["leftbraceunder","midbraceunder","rightbraceunder"],1.6,548],underleftrightarrow:[["leftarrow","rightarrow"],.888,522],xleftrightarrow:[["leftarrow","rightarrow"],1.75,522],xLeftrightarrow:[["doubleleftarrow","doublerightarrow"],1.75,560],xrightleftharpoons:[["leftharpoondownplus","rightharpoonplus"],1.75,716],xleftrightharpoons:[["leftharpoonplus","rightharpoondownplus"],1.75,716],xhookleftarrow:[["leftarrow","righthook"],1.08,522],xhookrightarrow:[["lefthook","rightarrow"],1.08,522],overlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],underlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],overgroup:[["leftgroup","rightgroup"],.888,342],undergroup:[["leftgroupunder","rightgroupunder"],.888,342],xmapsto:[["leftmapsto","rightarrow"],1.5,522],xtofrom:[["leftToFrom","rightToFrom"],1.75,528],xrightleftarrows:[["baraboveleftarrow","rightarrowabovebar"],1.75,901],xrightequilibrium:[["baraboveshortleftharpoon","rightharpoonaboveshortbar"],1.75,716],xleftequilibrium:[["shortbaraboveleftharpoon","shortrightharpoonabovebar"],1.75,716]},qbe=function(e){return e.type==="ordgroup"?e.body.length:1},Fbe=function(e,n){function r(){var o=4e5,c=e.label.slice(1);if(["widehat","widecheck","widetilde","utilde"].includes(c)){var h=e,f=qbe(h.base),m,g,x;if(f>5)c==="widehat"||c==="widecheck"?(m=420,o=2364,x=.42,g=c+"4"):(m=312,o=2340,x=.34,g="tilde4");else{var y=[1,1,2,2,3,3][f];c==="widehat"||c==="widecheck"?(o=[0,1062,2364,2364,2364][y],m=[0,239,300,360,420][y],x=[0,.24,.3,.3,.36,.42][y],g=c+y):(o=[0,600,1033,2339,2340][y],m=[0,260,286,306,312][y],x=[0,.26,.286,.3,.306,.34][y],g="tilde"+y)}var w=new jc(g),S=new go([w],{width:"100%",height:Ve(x),viewBox:"0 0 "+o+" "+m,preserveAspectRatio:"none"});return{span:we.makeSvgSpan([],[S],n),minWidth:0,height:x}}else{var k=[],N=Bbe[c],[C,T,_]=N,E=_/1e3,M=C.length,q,L;if(M===1){var I=N[3];q=["hide-tail"],L=[I]}else if(M===2)q=["halfarrow-left","halfarrow-right"],L=["xMinYMin","xMaxYMin"];else if(M===3)q=["brace-left","brace-center","brace-right"],L=["xMinYMin","xMidYMin","xMaxYMin"];else throw new Error(`Correct katexImagesData or update code here to support - `+M+" children.");for(var $=0;$0&&(s.style.minWidth=Ve(i)),s},$be=function(e,n,r,s,i){var a,o=e.height+e.depth+r+s;if(/fbox|color|angl/.test(n)){if(a=we.makeSpan(["stretchy",n],[],i),n==="fbox"){var c=i.color&&i.getColor();c&&(a.style.borderColor=c)}}else{var h=[];/^[bx]cancel$/.test(n)&&h.push(new ak({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(n)&&h.push(new ak({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var f=new go(h,{width:"100%",height:Ve(o)});a=we.makeSvgSpan([],[f],i)}return a.height=o,a.style.height=Ve(o),a},vo={encloseSpan:$be,mathMLnode:Ibe,svgSpan:Fbe};function $t(t,e){if(!t||t.type!==e)throw new Error("Expected node of type "+e+", but got "+(t?"node of type "+t.type:String(t)));return t}function YO(t){var e=wy(t);if(!e)throw new Error("Expected node of symbol group type, but got "+(t?"node of type "+t.type:String(t)));return e}function wy(t){return t&&(t.type==="atom"||fbe.hasOwnProperty(t.type))?t:null}var KO=(t,e)=>{var n,r,s;t&&t.type==="supsub"?(r=$t(t.base,"accent"),n=r.base,t.base=n,s=dbe(Sn(t,e)),t.base=r):(r=$t(t,"accent"),n=r.base);var i=Sn(n,e.havingCrampedStyle()),a=r.isShifty&&Nn.isCharacterBox(n),o=0;if(a){var c=Nn.getBaseElem(n),h=Sn(c,e.havingCrampedStyle());o=K_(h).skew}var f=r.label==="\\c",m=f?i.height+i.depth:Math.min(i.height,e.fontMetrics().xHeight),g;if(r.isStretchy)g=vo.svgSpan(r,e),g=we.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"elem",elem:g,wrapperClasses:["svg-align"],wrapperStyle:o>0?{width:"calc(100% - "+Ve(2*o)+")",marginLeft:Ve(2*o)}:void 0}]},e);else{var x,y;r.label==="\\vec"?(x=we.staticSvg("vec",e),y=we.svgData.vec[1]):(x=we.makeOrd({mode:r.mode,text:r.label},e,"textord"),x=K_(x),x.italic=0,y=x.width,f&&(m+=x.depth)),g=we.makeSpan(["accent-body"],[x]);var w=r.label==="\\textcircled";w&&(g.classes.push("accent-full"),m=i.height);var S=o;w||(S-=y/2),g.style.left=Ve(S),r.label==="\\textcircled"&&(g.style.top=".2em"),g=we.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:-m},{type:"elem",elem:g}]},e)}var k=we.makeSpan(["mord","accent"],[g],e);return s?(s.children[0]=k,s.height=Math.max(k.height,s.height),s.classes[0]="mord",s):k},cQ=(t,e)=>{var n=t.isStretchy?vo.mathMLnode(t.label):new Ie.MathNode("mo",[ca(t.label,t.mode)]),r=new Ie.MathNode("mover",[Un(t.base,e),n]);return r.setAttribute("accent","true"),r},Qbe=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map(t=>"\\"+t).join("|"));Ke({type:"accent",names:["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring","\\widecheck","\\widehat","\\widetilde","\\overrightarrow","\\overleftarrow","\\Overrightarrow","\\overleftrightarrow","\\overgroup","\\overlinesegment","\\overleftharpoon","\\overrightharpoon"],props:{numArgs:1},handler:(t,e)=>{var n=hv(e[0]),r=!Qbe.test(t.funcName),s=!r||t.funcName==="\\widehat"||t.funcName==="\\widetilde"||t.funcName==="\\widecheck";return{type:"accent",mode:t.parser.mode,label:t.funcName,isStretchy:r,isShifty:s,base:n}},htmlBuilder:KO,mathmlBuilder:cQ});Ke({type:"accent",names:["\\'","\\`","\\^","\\~","\\=","\\u","\\.",'\\"',"\\c","\\r","\\H","\\v","\\textcircled"],props:{numArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["primitive"]},handler:(t,e)=>{var n=e[0],r=t.parser.mode;return r==="math"&&(t.parser.settings.reportNonstrict("mathVsTextAccents","LaTeX's accent "+t.funcName+" works only in text mode"),r="text"),{type:"accent",mode:r,label:t.funcName,isStretchy:!1,isShifty:!0,base:n}},htmlBuilder:KO,mathmlBuilder:cQ});Ke({type:"accentUnder",names:["\\underleftarrow","\\underrightarrow","\\underleftrightarrow","\\undergroup","\\underlinesegment","\\utilde"],props:{numArgs:1},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=e[0];return{type:"accentUnder",mode:n.mode,label:r,base:s}},htmlBuilder:(t,e)=>{var n=Sn(t.base,e),r=vo.svgSpan(t,e),s=t.label==="\\utilde"?.12:0,i=we.makeVList({positionType:"top",positionData:n.height,children:[{type:"elem",elem:r,wrapperClasses:["svg-align"]},{type:"kern",size:s},{type:"elem",elem:n}]},e);return we.makeSpan(["mord","accentunder"],[i],e)},mathmlBuilder:(t,e)=>{var n=vo.mathMLnode(t.label),r=new Ie.MathNode("munder",[Un(t.base,e),n]);return r.setAttribute("accentunder","true"),r}});var Rx=t=>{var e=new Ie.MathNode("mpadded",t?[t]:[]);return e.setAttribute("width","+0.6em"),e.setAttribute("lspace","0.3em"),e};Ke({type:"xArrow",names:["\\xleftarrow","\\xrightarrow","\\xLeftarrow","\\xRightarrow","\\xleftrightarrow","\\xLeftrightarrow","\\xhookleftarrow","\\xhookrightarrow","\\xmapsto","\\xrightharpoondown","\\xrightharpoonup","\\xleftharpoondown","\\xleftharpoonup","\\xrightleftharpoons","\\xleftrightharpoons","\\xlongequal","\\xtwoheadrightarrow","\\xtwoheadleftarrow","\\xtofrom","\\xrightleftarrows","\\xrightequilibrium","\\xleftequilibrium","\\\\cdrightarrow","\\\\cdleftarrow","\\\\cdlongequal"],props:{numArgs:1,numOptionalArgs:1},handler(t,e,n){var{parser:r,funcName:s}=t;return{type:"xArrow",mode:r.mode,label:s,body:e[0],below:n[0]}},htmlBuilder(t,e){var n=e.style,r=e.havingStyle(n.sup()),s=we.wrapFragment(Sn(t.body,r,e),e),i=t.label.slice(0,2)==="\\x"?"x":"cd";s.classes.push(i+"-arrow-pad");var a;t.below&&(r=e.havingStyle(n.sub()),a=we.wrapFragment(Sn(t.below,r,e),e),a.classes.push(i+"-arrow-pad"));var o=vo.svgSpan(t,e),c=-e.fontMetrics().axisHeight+.5*o.height,h=-e.fontMetrics().axisHeight-.5*o.height-.111;(s.depth>.25||t.label==="\\xleftequilibrium")&&(h-=s.depth);var f;if(a){var m=-e.fontMetrics().axisHeight+a.height+.5*o.height+.111;f=we.makeVList({positionType:"individualShift",children:[{type:"elem",elem:s,shift:h},{type:"elem",elem:o,shift:c},{type:"elem",elem:a,shift:m}]},e)}else f=we.makeVList({positionType:"individualShift",children:[{type:"elem",elem:s,shift:h},{type:"elem",elem:o,shift:c}]},e);return f.children[0].children[0].children[1].classes.push("svg-align"),we.makeSpan(["mrel","x-arrow"],[f],e)},mathmlBuilder(t,e){var n=vo.mathMLnode(t.label);n.setAttribute("minsize",t.label.charAt(0)==="x"?"1.75em":"3.0em");var r;if(t.body){var s=Rx(Un(t.body,e));if(t.below){var i=Rx(Un(t.below,e));r=new Ie.MathNode("munderover",[n,i,s])}else r=new Ie.MathNode("mover",[n,s])}else if(t.below){var a=Rx(Un(t.below,e));r=new Ie.MathNode("munder",[n,a])}else r=Rx(),r=new Ie.MathNode("mover",[n,r]);return r}});var Hbe=we.makeSpan;function uQ(t,e){var n=Wr(t.body,e,!0);return Hbe([t.mclass],n,e)}function dQ(t,e){var n,r=di(t.body,e);return t.mclass==="minner"?n=new Ie.MathNode("mpadded",r):t.mclass==="mord"?t.isCharacterBox?(n=r[0],n.type="mi"):n=new Ie.MathNode("mi",r):(t.isCharacterBox?(n=r[0],n.type="mo"):n=new Ie.MathNode("mo",r),t.mclass==="mbin"?(n.attributes.lspace="0.22em",n.attributes.rspace="0.22em"):t.mclass==="mpunct"?(n.attributes.lspace="0em",n.attributes.rspace="0.17em"):t.mclass==="mopen"||t.mclass==="mclose"?(n.attributes.lspace="0em",n.attributes.rspace="0em"):t.mclass==="minner"&&(n.attributes.lspace="0.0556em",n.attributes.width="+0.1111em")),n}Ke({type:"mclass",names:["\\mathord","\\mathbin","\\mathrel","\\mathopen","\\mathclose","\\mathpunct","\\mathinner"],props:{numArgs:1,primitive:!0},handler(t,e){var{parser:n,funcName:r}=t,s=e[0];return{type:"mclass",mode:n.mode,mclass:"m"+r.slice(5),body:jr(s),isCharacterBox:Nn.isCharacterBox(s)}},htmlBuilder:uQ,mathmlBuilder:dQ});var Sy=t=>{var e=t.type==="ordgroup"&&t.body.length?t.body[0]:t;return e.type==="atom"&&(e.family==="bin"||e.family==="rel")?"m"+e.family:"mord"};Ke({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler(t,e){var{parser:n}=t;return{type:"mclass",mode:n.mode,mclass:Sy(e[0]),body:jr(e[1]),isCharacterBox:Nn.isCharacterBox(e[1])}}});Ke({type:"mclass",names:["\\stackrel","\\overset","\\underset"],props:{numArgs:2},handler(t,e){var{parser:n,funcName:r}=t,s=e[1],i=e[0],a;r!=="\\stackrel"?a=Sy(s):a="mrel";var o={type:"op",mode:s.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:r!=="\\stackrel",body:jr(s)},c={type:"supsub",mode:i.mode,base:o,sup:r==="\\underset"?null:i,sub:r==="\\underset"?i:null};return{type:"mclass",mode:n.mode,mclass:a,body:[c],isCharacterBox:Nn.isCharacterBox(c)}},htmlBuilder:uQ,mathmlBuilder:dQ});Ke({type:"pmb",names:["\\pmb"],props:{numArgs:1,allowedInText:!0},handler(t,e){var{parser:n}=t;return{type:"pmb",mode:n.mode,mclass:Sy(e[0]),body:jr(e[0])}},htmlBuilder(t,e){var n=Wr(t.body,e,!0),r=we.makeSpan([t.mclass],n,e);return r.style.textShadow="0.02em 0.01em 0.04px",r},mathmlBuilder(t,e){var n=di(t.body,e),r=new Ie.MathNode("mstyle",n);return r.setAttribute("style","text-shadow: 0.02em 0.01em 0.04px"),r}});var Vbe={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},iM=()=>({type:"styling",body:[],mode:"math",style:"display"}),aM=t=>t.type==="textord"&&t.text==="@",Ube=(t,e)=>(t.type==="mathord"||t.type==="atom")&&t.text===e;function Wbe(t,e,n){var r=Vbe[t];switch(r){case"\\\\cdrightarrow":case"\\\\cdleftarrow":return n.callFunction(r,[e[0]],[e[1]]);case"\\uparrow":case"\\downarrow":{var s=n.callFunction("\\\\cdleft",[e[0]],[]),i={type:"atom",text:r,mode:"math",family:"rel"},a=n.callFunction("\\Big",[i],[]),o=n.callFunction("\\\\cdright",[e[1]],[]),c={type:"ordgroup",mode:"math",body:[s,a,o]};return n.callFunction("\\\\cdparent",[c],[])}case"\\\\cdlongequal":return n.callFunction("\\\\cdlongequal",[],[]);case"\\Vert":{var h={type:"textord",text:"\\Vert",mode:"math"};return n.callFunction("\\Big",[h],[])}default:return{type:"textord",text:" ",mode:"math"}}}function Gbe(t){var e=[];for(t.gullet.beginGroup(),t.gullet.macros.set("\\cr","\\\\\\relax"),t.gullet.beginGroup();;){e.push(t.parseExpression(!1,"\\\\")),t.gullet.endGroup(),t.gullet.beginGroup();var n=t.fetch().text;if(n==="&"||n==="\\\\")t.consume();else if(n==="\\end"){e[e.length-1].length===0&&e.pop();break}else throw new Be("Expected \\\\ or \\cr or \\end",t.nextToken)}for(var r=[],s=[r],i=0;i-1))if("<>AV".indexOf(h)>-1)for(var m=0;m<2;m++){for(var g=!0,x=c+1;xAV=|." after @',a[c]);var y=Wbe(h,f,t),w={type:"styling",body:[y],mode:"math",style:"display"};r.push(w),o=iM()}i%2===0?r.push(o):r.shift(),r=[],s.push(r)}t.gullet.endGroup(),t.gullet.endGroup();var S=new Array(s[0].length).fill({type:"align",align:"c",pregap:.25,postgap:.25});return{type:"array",mode:"math",body:s,arraystretch:1,addJot:!0,rowGaps:[null],cols:S,colSeparationType:"CD",hLinesBeforeRow:new Array(s.length+1).fill([])}}Ke({type:"cdlabel",names:["\\\\cdleft","\\\\cdright"],props:{numArgs:1},handler(t,e){var{parser:n,funcName:r}=t;return{type:"cdlabel",mode:n.mode,side:r.slice(4),label:e[0]}},htmlBuilder(t,e){var n=e.havingStyle(e.style.sup()),r=we.wrapFragment(Sn(t.label,n,e),e);return r.classes.push("cd-label-"+t.side),r.style.bottom=Ve(.8-r.depth),r.height=0,r.depth=0,r},mathmlBuilder(t,e){var n=new Ie.MathNode("mrow",[Un(t.label,e)]);return n=new Ie.MathNode("mpadded",[n]),n.setAttribute("width","0"),t.side==="left"&&n.setAttribute("lspace","-1width"),n.setAttribute("voffset","0.7em"),n=new Ie.MathNode("mstyle",[n]),n.setAttribute("displaystyle","false"),n.setAttribute("scriptlevel","1"),n}});Ke({type:"cdlabelparent",names:["\\\\cdparent"],props:{numArgs:1},handler(t,e){var{parser:n}=t;return{type:"cdlabelparent",mode:n.mode,fragment:e[0]}},htmlBuilder(t,e){var n=we.wrapFragment(Sn(t.fragment,e),e);return n.classes.push("cd-vert-arrow"),n},mathmlBuilder(t,e){return new Ie.MathNode("mrow",[Un(t.fragment,e)])}});Ke({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler(t,e){for(var{parser:n}=t,r=$t(e[0],"ordgroup"),s=r.body,i="",a=0;a=1114111)throw new Be("\\@char with invalid code point "+i);return c<=65535?h=String.fromCharCode(c):(c-=65536,h=String.fromCharCode((c>>10)+55296,(c&1023)+56320)),{type:"textord",mode:n.mode,text:h}}});var hQ=(t,e)=>{var n=Wr(t.body,e.withColor(t.color),!1);return we.makeFragment(n)},fQ=(t,e)=>{var n=di(t.body,e.withColor(t.color)),r=new Ie.MathNode("mstyle",n);return r.setAttribute("mathcolor",t.color),r};Ke({type:"color",names:["\\textcolor"],props:{numArgs:2,allowedInText:!0,argTypes:["color","original"]},handler(t,e){var{parser:n}=t,r=$t(e[0],"color-token").color,s=e[1];return{type:"color",mode:n.mode,color:r,body:jr(s)}},htmlBuilder:hQ,mathmlBuilder:fQ});Ke({type:"color",names:["\\color"],props:{numArgs:1,allowedInText:!0,argTypes:["color"]},handler(t,e){var{parser:n,breakOnTokenText:r}=t,s=$t(e[0],"color-token").color;n.gullet.macros.set("\\current@color",s);var i=n.parseExpression(!0,r);return{type:"color",mode:n.mode,color:s,body:i}},htmlBuilder:hQ,mathmlBuilder:fQ});Ke({type:"cr",names:["\\\\"],props:{numArgs:0,numOptionalArgs:0,allowedInText:!0},handler(t,e,n){var{parser:r}=t,s=r.gullet.future().text==="["?r.parseSizeGroup(!0):null,i=!r.settings.displayMode||!r.settings.useStrictBehavior("newLineInDisplayMode","In LaTeX, \\\\ or \\newline does nothing in display mode");return{type:"cr",mode:r.mode,newLine:i,size:s&&$t(s,"size").value}},htmlBuilder(t,e){var n=we.makeSpan(["mspace"],[],e);return t.newLine&&(n.classes.push("newline"),t.size&&(n.style.marginTop=Ve(hr(t.size,e)))),n},mathmlBuilder(t,e){var n=new Ie.MathNode("mspace");return t.newLine&&(n.setAttribute("linebreak","newline"),t.size&&n.setAttribute("height",Ve(hr(t.size,e)))),n}});var uk={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},mQ=t=>{var e=t.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(e))throw new Be("Expected a control sequence",t);return e},Xbe=t=>{var e=t.gullet.popToken();return e.text==="="&&(e=t.gullet.popToken(),e.text===" "&&(e=t.gullet.popToken())),e},pQ=(t,e,n,r)=>{var s=t.gullet.macros.get(n.text);s==null&&(n.noexpand=!0,s={tokens:[n],numArgs:0,unexpandable:!t.gullet.isExpandable(n.text)}),t.gullet.macros.set(e,s,r)};Ke({type:"internal",names:["\\global","\\long","\\\\globallong"],props:{numArgs:0,allowedInText:!0},handler(t){var{parser:e,funcName:n}=t;e.consumeSpaces();var r=e.fetch();if(uk[r.text])return(n==="\\global"||n==="\\\\globallong")&&(r.text=uk[r.text]),$t(e.parseFunction(),"internal");throw new Be("Invalid token after macro prefix",r)}});Ke({type:"internal",names:["\\def","\\gdef","\\edef","\\xdef"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t){var{parser:e,funcName:n}=t,r=e.gullet.popToken(),s=r.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(s))throw new Be("Expected a control sequence",r);for(var i=0,a,o=[[]];e.gullet.future().text!=="{";)if(r=e.gullet.popToken(),r.text==="#"){if(e.gullet.future().text==="{"){a=e.gullet.future(),o[i].push("{");break}if(r=e.gullet.popToken(),!/^[1-9]$/.test(r.text))throw new Be('Invalid argument number "'+r.text+'"');if(parseInt(r.text)!==i+1)throw new Be('Argument number "'+r.text+'" out of order');i++,o.push([])}else{if(r.text==="EOF")throw new Be("Expected a macro definition");o[i].push(r.text)}var{tokens:c}=e.gullet.consumeArg();return a&&c.unshift(a),(n==="\\edef"||n==="\\xdef")&&(c=e.gullet.expandTokens(c),c.reverse()),e.gullet.macros.set(s,{tokens:c,numArgs:i,delimiters:o},n===uk[n]),{type:"internal",mode:e.mode}}});Ke({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t){var{parser:e,funcName:n}=t,r=mQ(e.gullet.popToken());e.gullet.consumeSpaces();var s=Xbe(e);return pQ(e,r,s,n==="\\\\globallet"),{type:"internal",mode:e.mode}}});Ke({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t){var{parser:e,funcName:n}=t,r=mQ(e.gullet.popToken()),s=e.gullet.popToken(),i=e.gullet.popToken();return pQ(e,r,i,n==="\\\\globalfuture"),e.gullet.pushToken(i),e.gullet.pushToken(s),{type:"internal",mode:e.mode}}});var vm=function(e,n,r){var s=Gn.math[e]&&Gn.math[e].replace,i=VO(s||e,n,r);if(!i)throw new Error("Unsupported symbol "+e+" and font size "+n+".");return i},ZO=function(e,n,r,s){var i=r.havingBaseStyle(n),a=we.makeSpan(s.concat(i.sizingClasses(r)),[e],r),o=i.sizeMultiplier/r.sizeMultiplier;return a.height*=o,a.depth*=o,a.maxFontSize=i.sizeMultiplier,a},gQ=function(e,n,r){var s=n.havingBaseStyle(r),i=(1-n.sizeMultiplier/s.sizeMultiplier)*n.fontMetrics().axisHeight;e.classes.push("delimcenter"),e.style.top=Ve(i),e.height-=i,e.depth+=i},Ybe=function(e,n,r,s,i,a){var o=we.makeSymbol(e,"Main-Regular",i,s),c=ZO(o,n,s,a);return r&&gQ(c,s,n),c},Kbe=function(e,n,r,s){return we.makeSymbol(e,"Size"+n+"-Regular",r,s)},xQ=function(e,n,r,s,i,a){var o=Kbe(e,n,i,s),c=ZO(we.makeSpan(["delimsizing","size"+n],[o],s),kt.TEXT,s,a);return r&&gQ(c,s,kt.TEXT),c},k4=function(e,n,r){var s;n==="Size1-Regular"?s="delim-size1":s="delim-size4";var i=we.makeSpan(["delimsizinginner",s],[we.makeSpan([],[we.makeSymbol(e,n,r)])]);return{type:"elem",elem:i}},O4=function(e,n,r){var s=nl["Size4-Regular"][e.charCodeAt(0)]?nl["Size4-Regular"][e.charCodeAt(0)][4]:nl["Size1-Regular"][e.charCodeAt(0)][4],i=new jc("inner",nbe(e,Math.round(1e3*n))),a=new go([i],{width:Ve(s),height:Ve(n),style:"width:"+Ve(s),viewBox:"0 0 "+1e3*s+" "+Math.round(1e3*n),preserveAspectRatio:"xMinYMin"}),o=we.makeSvgSpan([],[a],r);return o.height=n,o.style.height=Ve(n),o.style.width=Ve(s),{type:"elem",elem:o}},dk=.008,Dx={type:"kern",size:-1*dk},Zbe=["|","\\lvert","\\rvert","\\vert"],Jbe=["\\|","\\lVert","\\rVert","\\Vert"],vQ=function(e,n,r,s,i,a){var o,c,h,f,m="",g=0;o=h=f=e,c=null;var x="Size1-Regular";e==="\\uparrow"?h=f="⏐":e==="\\Uparrow"?h=f="‖":e==="\\downarrow"?o=h="⏐":e==="\\Downarrow"?o=h="‖":e==="\\updownarrow"?(o="\\uparrow",h="⏐",f="\\downarrow"):e==="\\Updownarrow"?(o="\\Uparrow",h="‖",f="\\Downarrow"):Zbe.includes(e)?(h="∣",m="vert",g=333):Jbe.includes(e)?(h="∥",m="doublevert",g=556):e==="["||e==="\\lbrack"?(o="⎡",h="⎢",f="⎣",x="Size4-Regular",m="lbrack",g=667):e==="]"||e==="\\rbrack"?(o="⎤",h="⎥",f="⎦",x="Size4-Regular",m="rbrack",g=667):e==="\\lfloor"||e==="⌊"?(h=o="⎢",f="⎣",x="Size4-Regular",m="lfloor",g=667):e==="\\lceil"||e==="⌈"?(o="⎡",h=f="⎢",x="Size4-Regular",m="lceil",g=667):e==="\\rfloor"||e==="⌋"?(h=o="⎥",f="⎦",x="Size4-Regular",m="rfloor",g=667):e==="\\rceil"||e==="⌉"?(o="⎤",h=f="⎥",x="Size4-Regular",m="rceil",g=667):e==="("||e==="\\lparen"?(o="⎛",h="⎜",f="⎝",x="Size4-Regular",m="lparen",g=875):e===")"||e==="\\rparen"?(o="⎞",h="⎟",f="⎠",x="Size4-Regular",m="rparen",g=875):e==="\\{"||e==="\\lbrace"?(o="⎧",c="⎨",f="⎩",h="⎪",x="Size4-Regular"):e==="\\}"||e==="\\rbrace"?(o="⎫",c="⎬",f="⎭",h="⎪",x="Size4-Regular"):e==="\\lgroup"||e==="⟮"?(o="⎧",f="⎩",h="⎪",x="Size4-Regular"):e==="\\rgroup"||e==="⟯"?(o="⎫",f="⎭",h="⎪",x="Size4-Regular"):e==="\\lmoustache"||e==="⎰"?(o="⎧",f="⎭",h="⎪",x="Size4-Regular"):(e==="\\rmoustache"||e==="⎱")&&(o="⎫",f="⎩",h="⎪",x="Size4-Regular");var y=vm(o,x,i),w=y.height+y.depth,S=vm(h,x,i),k=S.height+S.depth,N=vm(f,x,i),C=N.height+N.depth,T=0,_=1;if(c!==null){var E=vm(c,x,i);T=E.height+E.depth,_=2}var M=w+C+T,q=Math.max(0,Math.ceil((n-M)/(_*k))),L=M+q*_*k,I=s.fontMetrics().axisHeight;r&&(I*=s.sizeMultiplier);var $=L/2-I,V=[];if(m.length>0){var ee=L-w-C,z=Math.round(L*1e3),H=rbe(m,Math.round(ee*1e3)),P=new jc(m,H),W=(g/1e3).toFixed(3)+"em",J=(z/1e3).toFixed(3)+"em",X=new go([P],{width:W,height:J,viewBox:"0 0 "+g+" "+z}),R=we.makeSvgSpan([],[X],s);R.height=z/1e3,R.style.width=W,R.style.height=J,V.push({type:"elem",elem:R})}else{if(V.push(k4(f,x,i)),V.push(Dx),c===null){var se=L-w-C+2*dk;V.push(O4(h,se,s))}else{var G=(L-w-C-T)/2+2*dk;V.push(O4(h,G,s)),V.push(Dx),V.push(k4(c,x,i)),V.push(Dx),V.push(O4(h,G,s))}V.push(Dx),V.push(k4(o,x,i))}var F=s.havingBaseStyle(kt.TEXT),U=we.makeVList({positionType:"bottom",positionData:$,children:V},F);return ZO(we.makeSpan(["delimsizing","mult"],[U],F),kt.TEXT,s,a)},j4=80,N4=.08,C4=function(e,n,r,s,i){var a=tbe(e,s,r),o=new jc(e,a),c=new go([o],{width:"400em",height:Ve(n),viewBox:"0 0 400000 "+r,preserveAspectRatio:"xMinYMin slice"});return we.makeSvgSpan(["hide-tail"],[c],i)},e2e=function(e,n){var r=n.havingBaseSizing(),s=SQ("\\surd",e*r.sizeMultiplier,wQ,r),i=r.sizeMultiplier,a=Math.max(0,n.minRuleThickness-n.fontMetrics().sqrtRuleThickness),o,c=0,h=0,f=0,m;return s.type==="small"?(f=1e3+1e3*a+j4,e<1?i=1:e<1.4&&(i=.7),c=(1+a+N4)/i,h=(1+a)/i,o=C4("sqrtMain",c,f,a,n),o.style.minWidth="0.853em",m=.833/i):s.type==="large"?(f=(1e3+j4)*Bm[s.size],h=(Bm[s.size]+a)/i,c=(Bm[s.size]+a+N4)/i,o=C4("sqrtSize"+s.size,c,f,a,n),o.style.minWidth="1.02em",m=1/i):(c=e+a+N4,h=e+a,f=Math.floor(1e3*e+a)+j4,o=C4("sqrtTall",c,f,a,n),o.style.minWidth="0.742em",m=1.056),o.height=h,o.style.height=Ve(c),{span:o,advanceWidth:m,ruleWidth:(n.fontMetrics().sqrtRuleThickness+a)*i}},yQ=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","\\surd"],t2e=["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱"],bQ=["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"],Bm=[0,1.2,1.8,2.4,3],n2e=function(e,n,r,s,i){if(e==="<"||e==="\\lt"||e==="⟨"?e="\\langle":(e===">"||e==="\\gt"||e==="⟩")&&(e="\\rangle"),yQ.includes(e)||bQ.includes(e))return xQ(e,n,!1,r,s,i);if(t2e.includes(e))return vQ(e,Bm[n],!1,r,s,i);throw new Be("Illegal delimiter: '"+e+"'")},r2e=[{type:"small",style:kt.SCRIPTSCRIPT},{type:"small",style:kt.SCRIPT},{type:"small",style:kt.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],s2e=[{type:"small",style:kt.SCRIPTSCRIPT},{type:"small",style:kt.SCRIPT},{type:"small",style:kt.TEXT},{type:"stack"}],wQ=[{type:"small",style:kt.SCRIPTSCRIPT},{type:"small",style:kt.SCRIPT},{type:"small",style:kt.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],i2e=function(e){if(e.type==="small")return"Main-Regular";if(e.type==="large")return"Size"+e.size+"-Regular";if(e.type==="stack")return"Size4-Regular";throw new Error("Add support for delim type '"+e.type+"' here.")},SQ=function(e,n,r,s){for(var i=Math.min(2,3-s.style.size),a=i;an)return r[a]}return r[r.length-1]},kQ=function(e,n,r,s,i,a){e==="<"||e==="\\lt"||e==="⟨"?e="\\langle":(e===">"||e==="\\gt"||e==="⟩")&&(e="\\rangle");var o;bQ.includes(e)?o=r2e:yQ.includes(e)?o=wQ:o=s2e;var c=SQ(e,n,o,s);return c.type==="small"?Ybe(e,c.style,r,s,i,a):c.type==="large"?xQ(e,c.size,r,s,i,a):vQ(e,n,r,s,i,a)},a2e=function(e,n,r,s,i,a){var o=s.fontMetrics().axisHeight*s.sizeMultiplier,c=901,h=5/s.fontMetrics().ptPerEm,f=Math.max(n-o,r+o),m=Math.max(f/500*c,2*f-h);return kQ(e,m,!0,s,i,a)},oo={sqrtImage:e2e,sizedDelim:n2e,sizeToMaxHeight:Bm,customSizedDelim:kQ,leftRightDelim:a2e},lM={"\\bigl":{mclass:"mopen",size:1},"\\Bigl":{mclass:"mopen",size:2},"\\biggl":{mclass:"mopen",size:3},"\\Biggl":{mclass:"mopen",size:4},"\\bigr":{mclass:"mclose",size:1},"\\Bigr":{mclass:"mclose",size:2},"\\biggr":{mclass:"mclose",size:3},"\\Biggr":{mclass:"mclose",size:4},"\\bigm":{mclass:"mrel",size:1},"\\Bigm":{mclass:"mrel",size:2},"\\biggm":{mclass:"mrel",size:3},"\\Biggm":{mclass:"mrel",size:4},"\\big":{mclass:"mord",size:1},"\\Big":{mclass:"mord",size:2},"\\bigg":{mclass:"mord",size:3},"\\Bigg":{mclass:"mord",size:4}},l2e=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","<",">","\\langle","⟨","\\rangle","⟩","\\lt","\\gt","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱","/","\\backslash","|","\\vert","\\|","\\Vert","\\uparrow","\\Uparrow","\\downarrow","\\Downarrow","\\updownarrow","\\Updownarrow","."];function ky(t,e){var n=wy(t);if(n&&l2e.includes(n.text))return n;throw n?new Be("Invalid delimiter '"+n.text+"' after '"+e.funcName+"'",t):new Be("Invalid delimiter type '"+t.type+"'",t)}Ke({type:"delimsizing",names:["\\bigl","\\Bigl","\\biggl","\\Biggl","\\bigr","\\Bigr","\\biggr","\\Biggr","\\bigm","\\Bigm","\\biggm","\\Biggm","\\big","\\Big","\\bigg","\\Bigg"],props:{numArgs:1,argTypes:["primitive"]},handler:(t,e)=>{var n=ky(e[0],t);return{type:"delimsizing",mode:t.parser.mode,size:lM[t.funcName].size,mclass:lM[t.funcName].mclass,delim:n.text}},htmlBuilder:(t,e)=>t.delim==="."?we.makeSpan([t.mclass]):oo.sizedDelim(t.delim,t.size,e,t.mode,[t.mclass]),mathmlBuilder:t=>{var e=[];t.delim!=="."&&e.push(ca(t.delim,t.mode));var n=new Ie.MathNode("mo",e);t.mclass==="mopen"||t.mclass==="mclose"?n.setAttribute("fence","true"):n.setAttribute("fence","false"),n.setAttribute("stretchy","true");var r=Ve(oo.sizeToMaxHeight[t.size]);return n.setAttribute("minsize",r),n.setAttribute("maxsize",r),n}});function oM(t){if(!t.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}Ke({type:"leftright-right",names:["\\right"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var n=t.parser.gullet.macros.get("\\current@color");if(n&&typeof n!="string")throw new Be("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:t.parser.mode,delim:ky(e[0],t).text,color:n}}});Ke({type:"leftright",names:["\\left"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var n=ky(e[0],t),r=t.parser;++r.leftrightDepth;var s=r.parseExpression(!1);--r.leftrightDepth,r.expect("\\right",!1);var i=$t(r.parseFunction(),"leftright-right");return{type:"leftright",mode:r.mode,body:s,left:n.text,right:i.delim,rightColor:i.color}},htmlBuilder:(t,e)=>{oM(t);for(var n=Wr(t.body,e,!0,["mopen","mclose"]),r=0,s=0,i=!1,a=0;a{oM(t);var n=di(t.body,e);if(t.left!=="."){var r=new Ie.MathNode("mo",[ca(t.left,t.mode)]);r.setAttribute("fence","true"),n.unshift(r)}if(t.right!=="."){var s=new Ie.MathNode("mo",[ca(t.right,t.mode)]);s.setAttribute("fence","true"),t.rightColor&&s.setAttribute("mathcolor",t.rightColor),n.push(s)}return GO(n)}});Ke({type:"middle",names:["\\middle"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var n=ky(e[0],t);if(!t.parser.leftrightDepth)throw new Be("\\middle without preceding \\left",n);return{type:"middle",mode:t.parser.mode,delim:n.text}},htmlBuilder:(t,e)=>{var n;if(t.delim===".")n=b0(e,[]);else{n=oo.sizedDelim(t.delim,1,e,t.mode,[]);var r={delim:t.delim,options:e};n.isMiddle=r}return n},mathmlBuilder:(t,e)=>{var n=t.delim==="\\vert"||t.delim==="|"?ca("|","text"):ca(t.delim,t.mode),r=new Ie.MathNode("mo",[n]);return r.setAttribute("fence","true"),r.setAttribute("lspace","0.05em"),r.setAttribute("rspace","0.05em"),r}});var JO=(t,e)=>{var n=we.wrapFragment(Sn(t.body,e),e),r=t.label.slice(1),s=e.sizeMultiplier,i,a=0,o=Nn.isCharacterBox(t.body);if(r==="sout")i=we.makeSpan(["stretchy","sout"]),i.height=e.fontMetrics().defaultRuleThickness/s,a=-.5*e.fontMetrics().xHeight;else if(r==="phase"){var c=hr({number:.6,unit:"pt"},e),h=hr({number:.35,unit:"ex"},e),f=e.havingBaseSizing();s=s/f.sizeMultiplier;var m=n.height+n.depth+c+h;n.style.paddingLeft=Ve(m/2+c);var g=Math.floor(1e3*m*s),x=Jye(g),y=new go([new jc("phase",x)],{width:"400em",height:Ve(g/1e3),viewBox:"0 0 400000 "+g,preserveAspectRatio:"xMinYMin slice"});i=we.makeSvgSpan(["hide-tail"],[y],e),i.style.height=Ve(m),a=n.depth+c+h}else{/cancel/.test(r)?o||n.classes.push("cancel-pad"):r==="angl"?n.classes.push("anglpad"):n.classes.push("boxpad");var w=0,S=0,k=0;/box/.test(r)?(k=Math.max(e.fontMetrics().fboxrule,e.minRuleThickness),w=e.fontMetrics().fboxsep+(r==="colorbox"?0:k),S=w):r==="angl"?(k=Math.max(e.fontMetrics().defaultRuleThickness,e.minRuleThickness),w=4*k,S=Math.max(0,.25-n.depth)):(w=o?.2:0,S=w),i=vo.encloseSpan(n,r,w,S,e),/fbox|boxed|fcolorbox/.test(r)?(i.style.borderStyle="solid",i.style.borderWidth=Ve(k)):r==="angl"&&k!==.049&&(i.style.borderTopWidth=Ve(k),i.style.borderRightWidth=Ve(k)),a=n.depth+S,t.backgroundColor&&(i.style.backgroundColor=t.backgroundColor,t.borderColor&&(i.style.borderColor=t.borderColor))}var N;if(t.backgroundColor)N=we.makeVList({positionType:"individualShift",children:[{type:"elem",elem:i,shift:a},{type:"elem",elem:n,shift:0}]},e);else{var C=/cancel|phase/.test(r)?["svg-align"]:[];N=we.makeVList({positionType:"individualShift",children:[{type:"elem",elem:n,shift:0},{type:"elem",elem:i,shift:a,wrapperClasses:C}]},e)}return/cancel/.test(r)&&(N.height=n.height,N.depth=n.depth),/cancel/.test(r)&&!o?we.makeSpan(["mord","cancel-lap"],[N],e):we.makeSpan(["mord"],[N],e)},ej=(t,e)=>{var n=0,r=new Ie.MathNode(t.label.indexOf("colorbox")>-1?"mpadded":"menclose",[Un(t.body,e)]);switch(t.label){case"\\cancel":r.setAttribute("notation","updiagonalstrike");break;case"\\bcancel":r.setAttribute("notation","downdiagonalstrike");break;case"\\phase":r.setAttribute("notation","phasorangle");break;case"\\sout":r.setAttribute("notation","horizontalstrike");break;case"\\fbox":r.setAttribute("notation","box");break;case"\\angl":r.setAttribute("notation","actuarial");break;case"\\fcolorbox":case"\\colorbox":if(n=e.fontMetrics().fboxsep*e.fontMetrics().ptPerEm,r.setAttribute("width","+"+2*n+"pt"),r.setAttribute("height","+"+2*n+"pt"),r.setAttribute("lspace",n+"pt"),r.setAttribute("voffset",n+"pt"),t.label==="\\fcolorbox"){var s=Math.max(e.fontMetrics().fboxrule,e.minRuleThickness);r.setAttribute("style","border: "+s+"em solid "+String(t.borderColor))}break;case"\\xcancel":r.setAttribute("notation","updiagonalstrike downdiagonalstrike");break}return t.backgroundColor&&r.setAttribute("mathbackground",t.backgroundColor),r};Ke({type:"enclose",names:["\\colorbox"],props:{numArgs:2,allowedInText:!0,argTypes:["color","text"]},handler(t,e,n){var{parser:r,funcName:s}=t,i=$t(e[0],"color-token").color,a=e[1];return{type:"enclose",mode:r.mode,label:s,backgroundColor:i,body:a}},htmlBuilder:JO,mathmlBuilder:ej});Ke({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,allowedInText:!0,argTypes:["color","color","text"]},handler(t,e,n){var{parser:r,funcName:s}=t,i=$t(e[0],"color-token").color,a=$t(e[1],"color-token").color,o=e[2];return{type:"enclose",mode:r.mode,label:s,backgroundColor:a,borderColor:i,body:o}},htmlBuilder:JO,mathmlBuilder:ej});Ke({type:"enclose",names:["\\fbox"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!0},handler(t,e){var{parser:n}=t;return{type:"enclose",mode:n.mode,label:"\\fbox",body:e[0]}}});Ke({type:"enclose",names:["\\cancel","\\bcancel","\\xcancel","\\sout","\\phase"],props:{numArgs:1},handler(t,e){var{parser:n,funcName:r}=t,s=e[0];return{type:"enclose",mode:n.mode,label:r,body:s}},htmlBuilder:JO,mathmlBuilder:ej});Ke({type:"enclose",names:["\\angl"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!1},handler(t,e){var{parser:n}=t;return{type:"enclose",mode:n.mode,label:"\\angl",body:e[0]}}});var OQ={};function gl(t){for(var{type:e,names:n,props:r,handler:s,htmlBuilder:i,mathmlBuilder:a}=t,o={type:e,numArgs:r.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:s},c=0;c{var e=t.parser.settings;if(!e.displayMode)throw new Be("{"+t.envName+"} can be used only in display mode.")};function tj(t){if(t.indexOf("ed")===-1)return t.indexOf("*")===-1}function zc(t,e,n){var{hskipBeforeAndAfter:r,addJot:s,cols:i,arraystretch:a,colSeparationType:o,autoTag:c,singleRow:h,emptySingleRow:f,maxNumCols:m,leqno:g}=e;if(t.gullet.beginGroup(),h||t.gullet.macros.set("\\cr","\\\\\\relax"),!a){var x=t.gullet.expandMacroAsText("\\arraystretch");if(x==null)a=1;else if(a=parseFloat(x),!a||a<0)throw new Be("Invalid \\arraystretch: "+x)}t.gullet.beginGroup();var y=[],w=[y],S=[],k=[],N=c!=null?[]:void 0;function C(){c&&t.gullet.macros.set("\\@eqnsw","1",!0)}function T(){N&&(t.gullet.macros.get("\\df@tag")?(N.push(t.subparse([new Ai("\\df@tag")])),t.gullet.macros.set("\\df@tag",void 0,!0)):N.push(!!c&&t.gullet.macros.get("\\@eqnsw")==="1"))}for(C(),k.push(cM(t));;){var _=t.parseExpression(!1,h?"\\end":"\\\\");t.gullet.endGroup(),t.gullet.beginGroup(),_={type:"ordgroup",mode:t.mode,body:_},n&&(_={type:"styling",mode:t.mode,style:n,body:[_]}),y.push(_);var E=t.fetch().text;if(E==="&"){if(m&&y.length===m){if(h||o)throw new Be("Too many tab characters: &",t.nextToken);t.settings.reportNonstrict("textEnv","Too few columns specified in the {array} column argument.")}t.consume()}else if(E==="\\end"){T(),y.length===1&&_.type==="styling"&&_.body[0].body.length===0&&(w.length>1||!f)&&w.pop(),k.length0&&(C+=.25),h.push({pos:C,isDashed:$e[bt]})}for(T(a[0]),r=0;r0&&($+=N,M<$&&(M=$),$=0)),e.addJot&&(M+=w),q.height=E,q.depth=M,C+=E,q.pos=C,C+=M+$,c[r]=q,T(a[r+1])}var V=C/2+n.fontMetrics().axisHeight,ee=e.cols||[],z=[],H,P,W=[];if(e.tags&&e.tags.some($e=>$e))for(r=0;r=o)){var Y=void 0;(s>0||e.hskipBeforeAndAfter)&&(Y=Nn.deflt(G.pregap,g),Y!==0&&(H=we.makeSpan(["arraycolsep"],[]),H.style.width=Ve(Y),z.push(H)));var ae=[];for(r=0;r0){for(var Ge=we.makeLineSpan("hline",n,f),tt=we.makeLineSpan("hdashline",n,f),Xe=[{type:"elem",elem:c,shift:0}];h.length>0;){var je=h.pop(),Qe=je.pos-V;je.isDashed?Xe.push({type:"elem",elem:tt,shift:Qe}):Xe.push({type:"elem",elem:Ge,shift:Qe})}c=we.makeVList({positionType:"individualShift",children:Xe},n)}if(W.length===0)return we.makeSpan(["mord"],[c],n);var He=we.makeVList({positionType:"individualShift",children:W},n);return He=we.makeSpan(["tag"],[He],n),we.makeFragment([c,He])},o2e={c:"center ",l:"left ",r:"right "},vl=function(e,n){for(var r=[],s=new Ie.MathNode("mtd",[],["mtr-glue"]),i=new Ie.MathNode("mtd",[],["mml-eqn-num"]),a=0;a0){var y=e.cols,w="",S=!1,k=0,N=y.length;y[0].type==="separator"&&(g+="top ",k=1),y[y.length-1].type==="separator"&&(g+="bottom ",N-=1);for(var C=k;C0?"left ":"",g+=q[q.length-1].length>0?"right ":"";for(var L=1;L-1?"alignat":"align",i=e.envName==="split",a=zc(e.parser,{cols:r,addJot:!0,autoTag:i?void 0:tj(e.envName),emptySingleRow:!0,colSeparationType:s,maxNumCols:i?2:void 0,leqno:e.parser.settings.leqno},"display"),o,c=0,h={type:"ordgroup",mode:e.mode,body:[]};if(n[0]&&n[0].type==="ordgroup"){for(var f="",m=0;m0&&x&&(S=1),r[y]={type:"align",align:w,pregap:S,postgap:0}}return a.colSeparationType=x?"align":"alignat",a};gl({type:"array",names:["array","darray"],props:{numArgs:1},handler(t,e){var n=wy(e[0]),r=n?[e[0]]:$t(e[0],"ordgroup").body,s=r.map(function(a){var o=YO(a),c=o.text;if("lcr".indexOf(c)!==-1)return{type:"align",align:c};if(c==="|")return{type:"separator",separator:"|"};if(c===":")return{type:"separator",separator:":"};throw new Be("Unknown column alignment: "+c,a)}),i={cols:s,hskipBeforeAndAfter:!0,maxNumCols:s.length};return zc(t.parser,i,nj(t.envName))},htmlBuilder:xl,mathmlBuilder:vl});gl({type:"array",names:["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","matrix*","pmatrix*","bmatrix*","Bmatrix*","vmatrix*","Vmatrix*"],props:{numArgs:0},handler(t){var e={matrix:null,pmatrix:["(",")"],bmatrix:["[","]"],Bmatrix:["\\{","\\}"],vmatrix:["|","|"],Vmatrix:["\\Vert","\\Vert"]}[t.envName.replace("*","")],n="c",r={hskipBeforeAndAfter:!1,cols:[{type:"align",align:n}]};if(t.envName.charAt(t.envName.length-1)==="*"){var s=t.parser;if(s.consumeSpaces(),s.fetch().text==="["){if(s.consume(),s.consumeSpaces(),n=s.fetch().text,"lcr".indexOf(n)===-1)throw new Be("Expected l or c or r",s.nextToken);s.consume(),s.consumeSpaces(),s.expect("]"),s.consume(),r.cols=[{type:"align",align:n}]}}var i=zc(t.parser,r,nj(t.envName)),a=Math.max(0,...i.body.map(o=>o.length));return i.cols=new Array(a).fill({type:"align",align:n}),e?{type:"leftright",mode:t.mode,body:[i],left:e[0],right:e[1],rightColor:void 0}:i},htmlBuilder:xl,mathmlBuilder:vl});gl({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(t){var e={arraystretch:.5},n=zc(t.parser,e,"script");return n.colSeparationType="small",n},htmlBuilder:xl,mathmlBuilder:vl});gl({type:"array",names:["subarray"],props:{numArgs:1},handler(t,e){var n=wy(e[0]),r=n?[e[0]]:$t(e[0],"ordgroup").body,s=r.map(function(a){var o=YO(a),c=o.text;if("lc".indexOf(c)!==-1)return{type:"align",align:c};throw new Be("Unknown column alignment: "+c,a)});if(s.length>1)throw new Be("{subarray} can contain only one column");var i={cols:s,hskipBeforeAndAfter:!1,arraystretch:.5};if(i=zc(t.parser,i,"script"),i.body.length>0&&i.body[0].length>1)throw new Be("{subarray} can contain only one column");return i},htmlBuilder:xl,mathmlBuilder:vl});gl({type:"array",names:["cases","dcases","rcases","drcases"],props:{numArgs:0},handler(t){var e={arraystretch:1.2,cols:[{type:"align",align:"l",pregap:0,postgap:1},{type:"align",align:"l",pregap:0,postgap:0}]},n=zc(t.parser,e,nj(t.envName));return{type:"leftright",mode:t.mode,body:[n],left:t.envName.indexOf("r")>-1?".":"\\{",right:t.envName.indexOf("r")>-1?"\\}":".",rightColor:void 0}},htmlBuilder:xl,mathmlBuilder:vl});gl({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:NQ,htmlBuilder:xl,mathmlBuilder:vl});gl({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(t){["gather","gather*"].includes(t.envName)&&Oy(t);var e={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",autoTag:tj(t.envName),emptySingleRow:!0,leqno:t.parser.settings.leqno};return zc(t.parser,e,"display")},htmlBuilder:xl,mathmlBuilder:vl});gl({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:NQ,htmlBuilder:xl,mathmlBuilder:vl});gl({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(t){Oy(t);var e={autoTag:tj(t.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:t.parser.settings.leqno};return zc(t.parser,e,"display")},htmlBuilder:xl,mathmlBuilder:vl});gl({type:"array",names:["CD"],props:{numArgs:0},handler(t){return Oy(t),Gbe(t.parser)},htmlBuilder:xl,mathmlBuilder:vl});Z("\\nonumber","\\gdef\\@eqnsw{0}");Z("\\notag","\\nonumber");Ke({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(t,e){throw new Be(t.funcName+" valid only within array environment")}});var uM=OQ;Ke({type:"environment",names:["\\begin","\\end"],props:{numArgs:1,argTypes:["text"]},handler(t,e){var{parser:n,funcName:r}=t,s=e[0];if(s.type!=="ordgroup")throw new Be("Invalid environment name",s);for(var i="",a=0;a{var n=t.font,r=e.withFont(n);return Sn(t.body,r)},TQ=(t,e)=>{var n=t.font,r=e.withFont(n);return Un(t.body,r)},dM={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak","\\bm":"\\boldsymbol"};Ke({type:"font",names:["\\mathrm","\\mathit","\\mathbf","\\mathnormal","\\mathsfit","\\mathbb","\\mathcal","\\mathfrak","\\mathscr","\\mathsf","\\mathtt","\\Bbb","\\bold","\\frak"],props:{numArgs:1,allowedInArgument:!0},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=hv(e[0]),i=r;return i in dM&&(i=dM[i]),{type:"font",mode:n.mode,font:i.slice(1),body:s}},htmlBuilder:CQ,mathmlBuilder:TQ});Ke({type:"mclass",names:["\\boldsymbol","\\bm"],props:{numArgs:1},handler:(t,e)=>{var{parser:n}=t,r=e[0],s=Nn.isCharacterBox(r);return{type:"mclass",mode:n.mode,mclass:Sy(r),body:[{type:"font",mode:n.mode,font:"boldsymbol",body:r}],isCharacterBox:s}}});Ke({type:"font",names:["\\rm","\\sf","\\tt","\\bf","\\it","\\cal"],props:{numArgs:0,allowedInText:!0},handler:(t,e)=>{var{parser:n,funcName:r,breakOnTokenText:s}=t,{mode:i}=n,a=n.parseExpression(!0,s),o="math"+r.slice(1);return{type:"font",mode:i,font:o,body:{type:"ordgroup",mode:n.mode,body:a}}},htmlBuilder:CQ,mathmlBuilder:TQ});var EQ=(t,e)=>{var n=e;return t==="display"?n=n.id>=kt.SCRIPT.id?n.text():kt.DISPLAY:t==="text"&&n.size===kt.DISPLAY.size?n=kt.TEXT:t==="script"?n=kt.SCRIPT:t==="scriptscript"&&(n=kt.SCRIPTSCRIPT),n},rj=(t,e)=>{var n=EQ(t.size,e.style),r=n.fracNum(),s=n.fracDen(),i;i=e.havingStyle(r);var a=Sn(t.numer,i,e);if(t.continued){var o=8.5/e.fontMetrics().ptPerEm,c=3.5/e.fontMetrics().ptPerEm;a.height=a.height0?y=3*g:y=7*g,w=e.fontMetrics().denom1):(m>0?(x=e.fontMetrics().num2,y=g):(x=e.fontMetrics().num3,y=3*g),w=e.fontMetrics().denom2);var S;if(f){var N=e.fontMetrics().axisHeight;x-a.depth-(N+.5*m){var n=new Ie.MathNode("mfrac",[Un(t.numer,e),Un(t.denom,e)]);if(!t.hasBarLine)n.setAttribute("linethickness","0px");else if(t.barSize){var r=hr(t.barSize,e);n.setAttribute("linethickness",Ve(r))}var s=EQ(t.size,e.style);if(s.size!==e.style.size){n=new Ie.MathNode("mstyle",[n]);var i=s.size===kt.DISPLAY.size?"true":"false";n.setAttribute("displaystyle",i),n.setAttribute("scriptlevel","0")}if(t.leftDelim!=null||t.rightDelim!=null){var a=[];if(t.leftDelim!=null){var o=new Ie.MathNode("mo",[new Ie.TextNode(t.leftDelim.replace("\\",""))]);o.setAttribute("fence","true"),a.push(o)}if(a.push(n),t.rightDelim!=null){var c=new Ie.MathNode("mo",[new Ie.TextNode(t.rightDelim.replace("\\",""))]);c.setAttribute("fence","true"),a.push(c)}return GO(a)}return n};Ke({type:"genfrac",names:["\\dfrac","\\frac","\\tfrac","\\dbinom","\\binom","\\tbinom","\\\\atopfrac","\\\\bracefrac","\\\\brackfrac"],props:{numArgs:2,allowedInArgument:!0},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=e[0],i=e[1],a,o=null,c=null,h="auto";switch(r){case"\\dfrac":case"\\frac":case"\\tfrac":a=!0;break;case"\\\\atopfrac":a=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":a=!1,o="(",c=")";break;case"\\\\bracefrac":a=!1,o="\\{",c="\\}";break;case"\\\\brackfrac":a=!1,o="[",c="]";break;default:throw new Error("Unrecognized genfrac command")}switch(r){case"\\dfrac":case"\\dbinom":h="display";break;case"\\tfrac":case"\\tbinom":h="text";break}return{type:"genfrac",mode:n.mode,continued:!1,numer:s,denom:i,hasBarLine:a,leftDelim:o,rightDelim:c,size:h,barSize:null}},htmlBuilder:rj,mathmlBuilder:sj});Ke({type:"genfrac",names:["\\cfrac"],props:{numArgs:2},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=e[0],i=e[1];return{type:"genfrac",mode:n.mode,continued:!0,numer:s,denom:i,hasBarLine:!0,leftDelim:null,rightDelim:null,size:"display",barSize:null}}});Ke({type:"infix",names:["\\over","\\choose","\\atop","\\brace","\\brack"],props:{numArgs:0,infix:!0},handler(t){var{parser:e,funcName:n,token:r}=t,s;switch(n){case"\\over":s="\\frac";break;case"\\choose":s="\\binom";break;case"\\atop":s="\\\\atopfrac";break;case"\\brace":s="\\\\bracefrac";break;case"\\brack":s="\\\\brackfrac";break;default:throw new Error("Unrecognized infix genfrac command")}return{type:"infix",mode:e.mode,replaceWith:s,token:r}}});var hM=["display","text","script","scriptscript"],fM=function(e){var n=null;return e.length>0&&(n=e,n=n==="."?null:n),n};Ke({type:"genfrac",names:["\\genfrac"],props:{numArgs:6,allowedInArgument:!0,argTypes:["math","math","size","text","math","math"]},handler(t,e){var{parser:n}=t,r=e[4],s=e[5],i=hv(e[0]),a=i.type==="atom"&&i.family==="open"?fM(i.text):null,o=hv(e[1]),c=o.type==="atom"&&o.family==="close"?fM(o.text):null,h=$t(e[2],"size"),f,m=null;h.isBlank?f=!0:(m=h.value,f=m.number>0);var g="auto",x=e[3];if(x.type==="ordgroup"){if(x.body.length>0){var y=$t(x.body[0],"textord");g=hM[Number(y.text)]}}else x=$t(x,"textord"),g=hM[Number(x.text)];return{type:"genfrac",mode:n.mode,numer:r,denom:s,continued:!1,hasBarLine:f,barSize:m,leftDelim:a,rightDelim:c,size:g}},htmlBuilder:rj,mathmlBuilder:sj});Ke({type:"infix",names:["\\above"],props:{numArgs:1,argTypes:["size"],infix:!0},handler(t,e){var{parser:n,funcName:r,token:s}=t;return{type:"infix",mode:n.mode,replaceWith:"\\\\abovefrac",size:$t(e[0],"size").value,token:s}}});Ke({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=e[0],i=Iye($t(e[1],"infix").size),a=e[2],o=i.number>0;return{type:"genfrac",mode:n.mode,numer:s,denom:a,continued:!1,hasBarLine:o,barSize:i,leftDelim:null,rightDelim:null,size:"auto"}},htmlBuilder:rj,mathmlBuilder:sj});var _Q=(t,e)=>{var n=e.style,r,s;t.type==="supsub"?(r=t.sup?Sn(t.sup,e.havingStyle(n.sup()),e):Sn(t.sub,e.havingStyle(n.sub()),e),s=$t(t.base,"horizBrace")):s=$t(t,"horizBrace");var i=Sn(s.base,e.havingBaseStyle(kt.DISPLAY)),a=vo.svgSpan(s,e),o;if(s.isOver?(o=we.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:.1},{type:"elem",elem:a}]},e),o.children[0].children[0].children[1].classes.push("svg-align")):(o=we.makeVList({positionType:"bottom",positionData:i.depth+.1+a.height,children:[{type:"elem",elem:a},{type:"kern",size:.1},{type:"elem",elem:i}]},e),o.children[0].children[0].children[0].classes.push("svg-align")),r){var c=we.makeSpan(["mord",s.isOver?"mover":"munder"],[o],e);s.isOver?o=we.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:c},{type:"kern",size:.2},{type:"elem",elem:r}]},e):o=we.makeVList({positionType:"bottom",positionData:c.depth+.2+r.height+r.depth,children:[{type:"elem",elem:r},{type:"kern",size:.2},{type:"elem",elem:c}]},e)}return we.makeSpan(["mord",s.isOver?"mover":"munder"],[o],e)},c2e=(t,e)=>{var n=vo.mathMLnode(t.label);return new Ie.MathNode(t.isOver?"mover":"munder",[Un(t.base,e),n])};Ke({type:"horizBrace",names:["\\overbrace","\\underbrace"],props:{numArgs:1},handler(t,e){var{parser:n,funcName:r}=t;return{type:"horizBrace",mode:n.mode,label:r,isOver:/^\\over/.test(r),base:e[0]}},htmlBuilder:_Q,mathmlBuilder:c2e});Ke({type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=e[1],s=$t(e[0],"url").url;return n.settings.isTrusted({command:"\\href",url:s})?{type:"href",mode:n.mode,href:s,body:jr(r)}:n.formatUnsupportedCmd("\\href")},htmlBuilder:(t,e)=>{var n=Wr(t.body,e,!1);return we.makeAnchor(t.href,[],n,e)},mathmlBuilder:(t,e)=>{var n=Nc(t.body,e);return n instanceof Ci||(n=new Ci("mrow",[n])),n.setAttribute("href",t.href),n}});Ke({type:"href",names:["\\url"],props:{numArgs:1,argTypes:["url"],allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=$t(e[0],"url").url;if(!n.settings.isTrusted({command:"\\url",url:r}))return n.formatUnsupportedCmd("\\url");for(var s=[],i=0;i{var{parser:n,funcName:r,token:s}=t,i=$t(e[0],"raw").string,a=e[1];n.settings.strict&&n.settings.reportNonstrict("htmlExtension","HTML extension is disabled on strict mode");var o,c={};switch(r){case"\\htmlClass":c.class=i,o={command:"\\htmlClass",class:i};break;case"\\htmlId":c.id=i,o={command:"\\htmlId",id:i};break;case"\\htmlStyle":c.style=i,o={command:"\\htmlStyle",style:i};break;case"\\htmlData":{for(var h=i.split(","),f=0;f{var n=Wr(t.body,e,!1),r=["enclosing"];t.attributes.class&&r.push(...t.attributes.class.trim().split(/\s+/));var s=we.makeSpan(r,n,e);for(var i in t.attributes)i!=="class"&&t.attributes.hasOwnProperty(i)&&s.setAttribute(i,t.attributes[i]);return s},mathmlBuilder:(t,e)=>Nc(t.body,e)});Ke({type:"htmlmathml",names:["\\html@mathml"],props:{numArgs:2,allowedInText:!0},handler:(t,e)=>{var{parser:n}=t;return{type:"htmlmathml",mode:n.mode,html:jr(e[0]),mathml:jr(e[1])}},htmlBuilder:(t,e)=>{var n=Wr(t.html,e,!1);return we.makeFragment(n)},mathmlBuilder:(t,e)=>Nc(t.mathml,e)});var T4=function(e){if(/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(e))return{number:+e,unit:"bp"};var n=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(e);if(!n)throw new Be("Invalid size: '"+e+"' in \\includegraphics");var r={number:+(n[1]+n[2]),unit:n[3]};if(!X$(r))throw new Be("Invalid unit: '"+r.unit+"' in \\includegraphics.");return r};Ke({type:"includegraphics",names:["\\includegraphics"],props:{numArgs:1,numOptionalArgs:1,argTypes:["raw","url"],allowedInText:!1},handler:(t,e,n)=>{var{parser:r}=t,s={number:0,unit:"em"},i={number:.9,unit:"em"},a={number:0,unit:"em"},o="";if(n[0])for(var c=$t(n[0],"raw").string,h=c.split(","),f=0;f{var n=hr(t.height,e),r=0;t.totalheight.number>0&&(r=hr(t.totalheight,e)-n);var s=0;t.width.number>0&&(s=hr(t.width,e));var i={height:Ve(n+r)};s>0&&(i.width=Ve(s)),r>0&&(i.verticalAlign=Ve(-r));var a=new cbe(t.src,t.alt,i);return a.height=n,a.depth=r,a},mathmlBuilder:(t,e)=>{var n=new Ie.MathNode("mglyph",[]);n.setAttribute("alt",t.alt);var r=hr(t.height,e),s=0;if(t.totalheight.number>0&&(s=hr(t.totalheight,e)-r,n.setAttribute("valign",Ve(-s))),n.setAttribute("height",Ve(r+s)),t.width.number>0){var i=hr(t.width,e);n.setAttribute("width",Ve(i))}return n.setAttribute("src",t.src),n}});Ke({type:"kern",names:["\\kern","\\mkern","\\hskip","\\mskip"],props:{numArgs:1,argTypes:["size"],primitive:!0,allowedInText:!0},handler(t,e){var{parser:n,funcName:r}=t,s=$t(e[0],"size");if(n.settings.strict){var i=r[1]==="m",a=s.value.unit==="mu";i?(a||n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" supports only mu units, "+("not "+s.value.unit+" units")),n.mode!=="math"&&n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" works only in math mode")):a&&n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" doesn't support mu units")}return{type:"kern",mode:n.mode,dimension:s.value}},htmlBuilder(t,e){return we.makeGlue(t.dimension,e)},mathmlBuilder(t,e){var n=hr(t.dimension,e);return new Ie.SpaceNode(n)}});Ke({type:"lap",names:["\\mathllap","\\mathrlap","\\mathclap"],props:{numArgs:1,allowedInText:!0},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=e[0];return{type:"lap",mode:n.mode,alignment:r.slice(5),body:s}},htmlBuilder:(t,e)=>{var n;t.alignment==="clap"?(n=we.makeSpan([],[Sn(t.body,e)]),n=we.makeSpan(["inner"],[n],e)):n=we.makeSpan(["inner"],[Sn(t.body,e)]);var r=we.makeSpan(["fix"],[]),s=we.makeSpan([t.alignment],[n,r],e),i=we.makeSpan(["strut"]);return i.style.height=Ve(s.height+s.depth),s.depth&&(i.style.verticalAlign=Ve(-s.depth)),s.children.unshift(i),s=we.makeSpan(["thinbox"],[s],e),we.makeSpan(["mord","vbox"],[s],e)},mathmlBuilder:(t,e)=>{var n=new Ie.MathNode("mpadded",[Un(t.body,e)]);if(t.alignment!=="rlap"){var r=t.alignment==="llap"?"-1":"-0.5";n.setAttribute("lspace",r+"width")}return n.setAttribute("width","0px"),n}});Ke({type:"styling",names:["\\(","$"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(t,e){var{funcName:n,parser:r}=t,s=r.mode;r.switchMode("math");var i=n==="\\("?"\\)":"$",a=r.parseExpression(!1,i);return r.expect(i),r.switchMode(s),{type:"styling",mode:r.mode,style:"text",body:a}}});Ke({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(t,e){throw new Be("Mismatched "+t.funcName)}});var mM=(t,e)=>{switch(e.style.size){case kt.DISPLAY.size:return t.display;case kt.TEXT.size:return t.text;case kt.SCRIPT.size:return t.script;case kt.SCRIPTSCRIPT.size:return t.scriptscript;default:return t.text}};Ke({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:(t,e)=>{var{parser:n}=t;return{type:"mathchoice",mode:n.mode,display:jr(e[0]),text:jr(e[1]),script:jr(e[2]),scriptscript:jr(e[3])}},htmlBuilder:(t,e)=>{var n=mM(t,e),r=Wr(n,e,!1);return we.makeFragment(r)},mathmlBuilder:(t,e)=>{var n=mM(t,e);return Nc(n,e)}});var MQ=(t,e,n,r,s,i,a)=>{t=we.makeSpan([],[t]);var o=n&&Nn.isCharacterBox(n),c,h;if(e){var f=Sn(e,r.havingStyle(s.sup()),r);h={elem:f,kern:Math.max(r.fontMetrics().bigOpSpacing1,r.fontMetrics().bigOpSpacing3-f.depth)}}if(n){var m=Sn(n,r.havingStyle(s.sub()),r);c={elem:m,kern:Math.max(r.fontMetrics().bigOpSpacing2,r.fontMetrics().bigOpSpacing4-m.height)}}var g;if(h&&c){var x=r.fontMetrics().bigOpSpacing5+c.elem.height+c.elem.depth+c.kern+t.depth+a;g=we.makeVList({positionType:"bottom",positionData:x,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:c.elem,marginLeft:Ve(-i)},{type:"kern",size:c.kern},{type:"elem",elem:t},{type:"kern",size:h.kern},{type:"elem",elem:h.elem,marginLeft:Ve(i)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]},r)}else if(c){var y=t.height-a;g=we.makeVList({positionType:"top",positionData:y,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:c.elem,marginLeft:Ve(-i)},{type:"kern",size:c.kern},{type:"elem",elem:t}]},r)}else if(h){var w=t.depth+a;g=we.makeVList({positionType:"bottom",positionData:w,children:[{type:"elem",elem:t},{type:"kern",size:h.kern},{type:"elem",elem:h.elem,marginLeft:Ve(i)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]},r)}else return t;var S=[g];if(c&&i!==0&&!o){var k=we.makeSpan(["mspace"],[],r);k.style.marginRight=Ve(i),S.unshift(k)}return we.makeSpan(["mop","op-limits"],S,r)},AQ=["\\smallint"],ef=(t,e)=>{var n,r,s=!1,i;t.type==="supsub"?(n=t.sup,r=t.sub,i=$t(t.base,"op"),s=!0):i=$t(t,"op");var a=e.style,o=!1;a.size===kt.DISPLAY.size&&i.symbol&&!AQ.includes(i.name)&&(o=!0);var c;if(i.symbol){var h=o?"Size2-Regular":"Size1-Regular",f="";if((i.name==="\\oiint"||i.name==="\\oiiint")&&(f=i.name.slice(1),i.name=f==="oiint"?"\\iint":"\\iiint"),c=we.makeSymbol(i.name,h,"math",e,["mop","op-symbol",o?"large-op":"small-op"]),f.length>0){var m=c.italic,g=we.staticSvg(f+"Size"+(o?"2":"1"),e);c=we.makeVList({positionType:"individualShift",children:[{type:"elem",elem:c,shift:0},{type:"elem",elem:g,shift:o?.08:0}]},e),i.name="\\"+f,c.classes.unshift("mop"),c.italic=m}}else if(i.body){var x=Wr(i.body,e,!0);x.length===1&&x[0]instanceof oa?(c=x[0],c.classes[0]="mop"):c=we.makeSpan(["mop"],x,e)}else{for(var y=[],w=1;w{var n;if(t.symbol)n=new Ci("mo",[ca(t.name,t.mode)]),AQ.includes(t.name)&&n.setAttribute("largeop","false");else if(t.body)n=new Ci("mo",di(t.body,e));else{n=new Ci("mi",[new rl(t.name.slice(1))]);var r=new Ci("mo",[ca("⁡","text")]);t.parentIsSupSub?n=new Ci("mrow",[n,r]):n=aQ([n,r])}return n},u2e={"∏":"\\prod","∐":"\\coprod","∑":"\\sum","⋀":"\\bigwedge","⋁":"\\bigvee","⋂":"\\bigcap","⋃":"\\bigcup","⨀":"\\bigodot","⨁":"\\bigoplus","⨂":"\\bigotimes","⨄":"\\biguplus","⨆":"\\bigsqcup"};Ke({type:"op",names:["\\coprod","\\bigvee","\\bigwedge","\\biguplus","\\bigcap","\\bigcup","\\intop","\\prod","\\sum","\\bigotimes","\\bigoplus","\\bigodot","\\bigsqcup","\\smallint","∏","∐","∑","⋀","⋁","⋂","⋃","⨀","⨁","⨂","⨄","⨆"],props:{numArgs:0},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=r;return s.length===1&&(s=u2e[s]),{type:"op",mode:n.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:s}},htmlBuilder:ef,mathmlBuilder:hp});Ke({type:"op",names:["\\mathop"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var{parser:n}=t,r=e[0];return{type:"op",mode:n.mode,limits:!1,parentIsSupSub:!1,symbol:!1,body:jr(r)}},htmlBuilder:ef,mathmlBuilder:hp});var d2e={"∫":"\\int","∬":"\\iint","∭":"\\iiint","∮":"\\oint","∯":"\\oiint","∰":"\\oiiint"};Ke({type:"op",names:["\\arcsin","\\arccos","\\arctan","\\arctg","\\arcctg","\\arg","\\ch","\\cos","\\cosec","\\cosh","\\cot","\\cotg","\\coth","\\csc","\\ctg","\\cth","\\deg","\\dim","\\exp","\\hom","\\ker","\\lg","\\ln","\\log","\\sec","\\sin","\\sinh","\\sh","\\tan","\\tanh","\\tg","\\th"],props:{numArgs:0},handler(t){var{parser:e,funcName:n}=t;return{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!1,name:n}},htmlBuilder:ef,mathmlBuilder:hp});Ke({type:"op",names:["\\det","\\gcd","\\inf","\\lim","\\max","\\min","\\Pr","\\sup"],props:{numArgs:0},handler(t){var{parser:e,funcName:n}=t;return{type:"op",mode:e.mode,limits:!0,parentIsSupSub:!1,symbol:!1,name:n}},htmlBuilder:ef,mathmlBuilder:hp});Ke({type:"op",names:["\\int","\\iint","\\iiint","\\oint","\\oiint","\\oiiint","∫","∬","∭","∮","∯","∰"],props:{numArgs:0},handler(t){var{parser:e,funcName:n}=t,r=n;return r.length===1&&(r=d2e[r]),{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:r}},htmlBuilder:ef,mathmlBuilder:hp});var RQ=(t,e)=>{var n,r,s=!1,i;t.type==="supsub"?(n=t.sup,r=t.sub,i=$t(t.base,"operatorname"),s=!0):i=$t(t,"operatorname");var a;if(i.body.length>0){for(var o=i.body.map(m=>{var g=m.text;return typeof g=="string"?{type:"textord",mode:m.mode,text:g}:m}),c=Wr(o,e.withFont("mathrm"),!0),h=0;h{for(var n=di(t.body,e.withFont("mathrm")),r=!0,s=0;sf.toText()).join("");n=[new Ie.TextNode(o)]}var c=new Ie.MathNode("mi",n);c.setAttribute("mathvariant","normal");var h=new Ie.MathNode("mo",[ca("⁡","text")]);return t.parentIsSupSub?new Ie.MathNode("mrow",[c,h]):Ie.newDocumentFragment([c,h])};Ke({type:"operatorname",names:["\\operatorname@","\\operatornamewithlimits"],props:{numArgs:1},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=e[0];return{type:"operatorname",mode:n.mode,body:jr(s),alwaysHandleSupSub:r==="\\operatornamewithlimits",limits:!1,parentIsSupSub:!1}},htmlBuilder:RQ,mathmlBuilder:h2e});Z("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@");Qu({type:"ordgroup",htmlBuilder(t,e){return t.semisimple?we.makeFragment(Wr(t.body,e,!1)):we.makeSpan(["mord"],Wr(t.body,e,!0),e)},mathmlBuilder(t,e){return Nc(t.body,e,!0)}});Ke({type:"overline",names:["\\overline"],props:{numArgs:1},handler(t,e){var{parser:n}=t,r=e[0];return{type:"overline",mode:n.mode,body:r}},htmlBuilder(t,e){var n=Sn(t.body,e.havingCrampedStyle()),r=we.makeLineSpan("overline-line",e),s=e.fontMetrics().defaultRuleThickness,i=we.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:n},{type:"kern",size:3*s},{type:"elem",elem:r},{type:"kern",size:s}]},e);return we.makeSpan(["mord","overline"],[i],e)},mathmlBuilder(t,e){var n=new Ie.MathNode("mo",[new Ie.TextNode("‾")]);n.setAttribute("stretchy","true");var r=new Ie.MathNode("mover",[Un(t.body,e),n]);return r.setAttribute("accent","true"),r}});Ke({type:"phantom",names:["\\phantom"],props:{numArgs:1,allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=e[0];return{type:"phantom",mode:n.mode,body:jr(r)}},htmlBuilder:(t,e)=>{var n=Wr(t.body,e.withPhantom(),!1);return we.makeFragment(n)},mathmlBuilder:(t,e)=>{var n=di(t.body,e);return new Ie.MathNode("mphantom",n)}});Ke({type:"hphantom",names:["\\hphantom"],props:{numArgs:1,allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=e[0];return{type:"hphantom",mode:n.mode,body:r}},htmlBuilder:(t,e)=>{var n=we.makeSpan([],[Sn(t.body,e.withPhantom())]);if(n.height=0,n.depth=0,n.children)for(var r=0;r{var n=di(jr(t.body),e),r=new Ie.MathNode("mphantom",n),s=new Ie.MathNode("mpadded",[r]);return s.setAttribute("height","0px"),s.setAttribute("depth","0px"),s}});Ke({type:"vphantom",names:["\\vphantom"],props:{numArgs:1,allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=e[0];return{type:"vphantom",mode:n.mode,body:r}},htmlBuilder:(t,e)=>{var n=we.makeSpan(["inner"],[Sn(t.body,e.withPhantom())]),r=we.makeSpan(["fix"],[]);return we.makeSpan(["mord","rlap"],[n,r],e)},mathmlBuilder:(t,e)=>{var n=di(jr(t.body),e),r=new Ie.MathNode("mphantom",n),s=new Ie.MathNode("mpadded",[r]);return s.setAttribute("width","0px"),s}});Ke({type:"raisebox",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:!0},handler(t,e){var{parser:n}=t,r=$t(e[0],"size").value,s=e[1];return{type:"raisebox",mode:n.mode,dy:r,body:s}},htmlBuilder(t,e){var n=Sn(t.body,e),r=hr(t.dy,e);return we.makeVList({positionType:"shift",positionData:-r,children:[{type:"elem",elem:n}]},e)},mathmlBuilder(t,e){var n=new Ie.MathNode("mpadded",[Un(t.body,e)]),r=t.dy.number+t.dy.unit;return n.setAttribute("voffset",r),n}});Ke({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0,allowedInArgument:!0},handler(t){var{parser:e}=t;return{type:"internal",mode:e.mode}}});Ke({type:"rule",names:["\\rule"],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["size","size","size"]},handler(t,e,n){var{parser:r}=t,s=n[0],i=$t(e[0],"size"),a=$t(e[1],"size");return{type:"rule",mode:r.mode,shift:s&&$t(s,"size").value,width:i.value,height:a.value}},htmlBuilder(t,e){var n=we.makeSpan(["mord","rule"],[],e),r=hr(t.width,e),s=hr(t.height,e),i=t.shift?hr(t.shift,e):0;return n.style.borderRightWidth=Ve(r),n.style.borderTopWidth=Ve(s),n.style.bottom=Ve(i),n.width=r,n.height=s+i,n.depth=-i,n.maxFontSize=s*1.125*e.sizeMultiplier,n},mathmlBuilder(t,e){var n=hr(t.width,e),r=hr(t.height,e),s=t.shift?hr(t.shift,e):0,i=e.color&&e.getColor()||"black",a=new Ie.MathNode("mspace");a.setAttribute("mathbackground",i),a.setAttribute("width",Ve(n)),a.setAttribute("height",Ve(r));var o=new Ie.MathNode("mpadded",[a]);return s>=0?o.setAttribute("height",Ve(s)):(o.setAttribute("height",Ve(s)),o.setAttribute("depth",Ve(-s))),o.setAttribute("voffset",Ve(s)),o}});function DQ(t,e,n){for(var r=Wr(t,e,!1),s=e.sizeMultiplier/n.sizeMultiplier,i=0;i{var n=e.havingSize(t.size);return DQ(t.body,n,e)};Ke({type:"sizing",names:pM,props:{numArgs:0,allowedInText:!0},handler:(t,e)=>{var{breakOnTokenText:n,funcName:r,parser:s}=t,i=s.parseExpression(!1,n);return{type:"sizing",mode:s.mode,size:pM.indexOf(r)+1,body:i}},htmlBuilder:f2e,mathmlBuilder:(t,e)=>{var n=e.havingSize(t.size),r=di(t.body,n),s=new Ie.MathNode("mstyle",r);return s.setAttribute("mathsize",Ve(n.sizeMultiplier)),s}});Ke({type:"smash",names:["\\smash"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:(t,e,n)=>{var{parser:r}=t,s=!1,i=!1,a=n[0]&&$t(n[0],"ordgroup");if(a)for(var o="",c=0;c{var n=we.makeSpan([],[Sn(t.body,e)]);if(!t.smashHeight&&!t.smashDepth)return n;if(t.smashHeight&&(n.height=0,n.children))for(var r=0;r{var n=new Ie.MathNode("mpadded",[Un(t.body,e)]);return t.smashHeight&&n.setAttribute("height","0px"),t.smashDepth&&n.setAttribute("depth","0px"),n}});Ke({type:"sqrt",names:["\\sqrt"],props:{numArgs:1,numOptionalArgs:1},handler(t,e,n){var{parser:r}=t,s=n[0],i=e[0];return{type:"sqrt",mode:r.mode,body:i,index:s}},htmlBuilder(t,e){var n=Sn(t.body,e.havingCrampedStyle());n.height===0&&(n.height=e.fontMetrics().xHeight),n=we.wrapFragment(n,e);var r=e.fontMetrics(),s=r.defaultRuleThickness,i=s;e.style.idn.height+n.depth+a&&(a=(a+m-n.height-n.depth)/2);var g=c.height-n.height-a-h;n.style.paddingLeft=Ve(f);var x=we.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:n,wrapperClasses:["svg-align"]},{type:"kern",size:-(n.height+g)},{type:"elem",elem:c},{type:"kern",size:h}]},e);if(t.index){var y=e.havingStyle(kt.SCRIPTSCRIPT),w=Sn(t.index,y,e),S=.6*(x.height-x.depth),k=we.makeVList({positionType:"shift",positionData:-S,children:[{type:"elem",elem:w}]},e),N=we.makeSpan(["root"],[k]);return we.makeSpan(["mord","sqrt"],[N,x],e)}else return we.makeSpan(["mord","sqrt"],[x],e)},mathmlBuilder(t,e){var{body:n,index:r}=t;return r?new Ie.MathNode("mroot",[Un(n,e),Un(r,e)]):new Ie.MathNode("msqrt",[Un(n,e)])}});var gM={display:kt.DISPLAY,text:kt.TEXT,script:kt.SCRIPT,scriptscript:kt.SCRIPTSCRIPT};Ke({type:"styling",names:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t,e){var{breakOnTokenText:n,funcName:r,parser:s}=t,i=s.parseExpression(!0,n),a=r.slice(1,r.length-5);return{type:"styling",mode:s.mode,style:a,body:i}},htmlBuilder(t,e){var n=gM[t.style],r=e.havingStyle(n).withFont("");return DQ(t.body,r,e)},mathmlBuilder(t,e){var n=gM[t.style],r=e.havingStyle(n),s=di(t.body,r),i=new Ie.MathNode("mstyle",s),a={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]},o=a[t.style];return i.setAttribute("scriptlevel",o[0]),i.setAttribute("displaystyle",o[1]),i}});var m2e=function(e,n){var r=e.base;if(r)if(r.type==="op"){var s=r.limits&&(n.style.size===kt.DISPLAY.size||r.alwaysHandleSupSub);return s?ef:null}else if(r.type==="operatorname"){var i=r.alwaysHandleSupSub&&(n.style.size===kt.DISPLAY.size||r.limits);return i?RQ:null}else{if(r.type==="accent")return Nn.isCharacterBox(r.base)?KO:null;if(r.type==="horizBrace"){var a=!e.sub;return a===r.isOver?_Q:null}else return null}else return null};Qu({type:"supsub",htmlBuilder(t,e){var n=m2e(t,e);if(n)return n(t,e);var{base:r,sup:s,sub:i}=t,a=Sn(r,e),o,c,h=e.fontMetrics(),f=0,m=0,g=r&&Nn.isCharacterBox(r);if(s){var x=e.havingStyle(e.style.sup());o=Sn(s,x,e),g||(f=a.height-x.fontMetrics().supDrop*x.sizeMultiplier/e.sizeMultiplier)}if(i){var y=e.havingStyle(e.style.sub());c=Sn(i,y,e),g||(m=a.depth+y.fontMetrics().subDrop*y.sizeMultiplier/e.sizeMultiplier)}var w;e.style===kt.DISPLAY?w=h.sup1:e.style.cramped?w=h.sup3:w=h.sup2;var S=e.sizeMultiplier,k=Ve(.5/h.ptPerEm/S),N=null;if(c){var C=t.base&&t.base.type==="op"&&t.base.name&&(t.base.name==="\\oiint"||t.base.name==="\\oiiint");(a instanceof oa||C)&&(N=Ve(-a.italic))}var T;if(o&&c){f=Math.max(f,w,o.depth+.25*h.xHeight),m=Math.max(m,h.sub2);var _=h.defaultRuleThickness,E=4*_;if(f-o.depth-(c.height-m)0&&(f+=M,m-=M)}var q=[{type:"elem",elem:c,shift:m,marginRight:k,marginLeft:N},{type:"elem",elem:o,shift:-f,marginRight:k}];T=we.makeVList({positionType:"individualShift",children:q},e)}else if(c){m=Math.max(m,h.sub1,c.height-.8*h.xHeight);var L=[{type:"elem",elem:c,marginLeft:N,marginRight:k}];T=we.makeVList({positionType:"shift",positionData:m,children:L},e)}else if(o)f=Math.max(f,w,o.depth+.25*h.xHeight),T=we.makeVList({positionType:"shift",positionData:-f,children:[{type:"elem",elem:o,marginRight:k}]},e);else throw new Error("supsub must have either sup or sub.");var I=ok(a,"right")||"mord";return we.makeSpan([I],[a,we.makeSpan(["msupsub"],[T])],e)},mathmlBuilder(t,e){var n=!1,r,s;t.base&&t.base.type==="horizBrace"&&(s=!!t.sup,s===t.base.isOver&&(n=!0,r=t.base.isOver)),t.base&&(t.base.type==="op"||t.base.type==="operatorname")&&(t.base.parentIsSupSub=!0);var i=[Un(t.base,e)];t.sub&&i.push(Un(t.sub,e)),t.sup&&i.push(Un(t.sup,e));var a;if(n)a=r?"mover":"munder";else if(t.sub)if(t.sup){var h=t.base;h&&h.type==="op"&&h.limits&&e.style===kt.DISPLAY||h&&h.type==="operatorname"&&h.alwaysHandleSupSub&&(e.style===kt.DISPLAY||h.limits)?a="munderover":a="msubsup"}else{var c=t.base;c&&c.type==="op"&&c.limits&&(e.style===kt.DISPLAY||c.alwaysHandleSupSub)||c&&c.type==="operatorname"&&c.alwaysHandleSupSub&&(c.limits||e.style===kt.DISPLAY)?a="munder":a="msub"}else{var o=t.base;o&&o.type==="op"&&o.limits&&(e.style===kt.DISPLAY||o.alwaysHandleSupSub)||o&&o.type==="operatorname"&&o.alwaysHandleSupSub&&(o.limits||e.style===kt.DISPLAY)?a="mover":a="msup"}return new Ie.MathNode(a,i)}});Qu({type:"atom",htmlBuilder(t,e){return we.mathsym(t.text,t.mode,e,["m"+t.family])},mathmlBuilder(t,e){var n=new Ie.MathNode("mo",[ca(t.text,t.mode)]);if(t.family==="bin"){var r=XO(t,e);r==="bold-italic"&&n.setAttribute("mathvariant",r)}else t.family==="punct"?n.setAttribute("separator","true"):(t.family==="open"||t.family==="close")&&n.setAttribute("stretchy","false");return n}});var zQ={mi:"italic",mn:"normal",mtext:"normal"};Qu({type:"mathord",htmlBuilder(t,e){return we.makeOrd(t,e,"mathord")},mathmlBuilder(t,e){var n=new Ie.MathNode("mi",[ca(t.text,t.mode,e)]),r=XO(t,e)||"italic";return r!==zQ[n.type]&&n.setAttribute("mathvariant",r),n}});Qu({type:"textord",htmlBuilder(t,e){return we.makeOrd(t,e,"textord")},mathmlBuilder(t,e){var n=ca(t.text,t.mode,e),r=XO(t,e)||"normal",s;return t.mode==="text"?s=new Ie.MathNode("mtext",[n]):/[0-9]/.test(t.text)?s=new Ie.MathNode("mn",[n]):t.text==="\\prime"?s=new Ie.MathNode("mo",[n]):s=new Ie.MathNode("mi",[n]),r!==zQ[s.type]&&s.setAttribute("mathvariant",r),s}});var E4={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},_4={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};Qu({type:"spacing",htmlBuilder(t,e){if(_4.hasOwnProperty(t.text)){var n=_4[t.text].className||"";if(t.mode==="text"){var r=we.makeOrd(t,e,"textord");return r.classes.push(n),r}else return we.makeSpan(["mspace",n],[we.mathsym(t.text,t.mode,e)],e)}else{if(E4.hasOwnProperty(t.text))return we.makeSpan(["mspace",E4[t.text]],[],e);throw new Be('Unknown type of space "'+t.text+'"')}},mathmlBuilder(t,e){var n;if(_4.hasOwnProperty(t.text))n=new Ie.MathNode("mtext",[new Ie.TextNode(" ")]);else{if(E4.hasOwnProperty(t.text))return new Ie.MathNode("mspace");throw new Be('Unknown type of space "'+t.text+'"')}return n}});var xM=()=>{var t=new Ie.MathNode("mtd",[]);return t.setAttribute("width","50%"),t};Qu({type:"tag",mathmlBuilder(t,e){var n=new Ie.MathNode("mtable",[new Ie.MathNode("mtr",[xM(),new Ie.MathNode("mtd",[Nc(t.body,e)]),xM(),new Ie.MathNode("mtd",[Nc(t.tag,e)])])]);return n.setAttribute("width","100%"),n}});var vM={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},yM={"\\textbf":"textbf","\\textmd":"textmd"},p2e={"\\textit":"textit","\\textup":"textup"},bM=(t,e)=>{var n=t.font;if(n){if(vM[n])return e.withTextFontFamily(vM[n]);if(yM[n])return e.withTextFontWeight(yM[n]);if(n==="\\emph")return e.fontShape==="textit"?e.withTextFontShape("textup"):e.withTextFontShape("textit")}else return e;return e.withTextFontShape(p2e[n])};Ke({type:"text",names:["\\text","\\textrm","\\textsf","\\texttt","\\textnormal","\\textbf","\\textmd","\\textit","\\textup","\\emph"],props:{numArgs:1,argTypes:["text"],allowedInArgument:!0,allowedInText:!0},handler(t,e){var{parser:n,funcName:r}=t,s=e[0];return{type:"text",mode:n.mode,body:jr(s),font:r}},htmlBuilder(t,e){var n=bM(t,e),r=Wr(t.body,n,!0);return we.makeSpan(["mord","text"],r,n)},mathmlBuilder(t,e){var n=bM(t,e);return Nc(t.body,n)}});Ke({type:"underline",names:["\\underline"],props:{numArgs:1,allowedInText:!0},handler(t,e){var{parser:n}=t;return{type:"underline",mode:n.mode,body:e[0]}},htmlBuilder(t,e){var n=Sn(t.body,e),r=we.makeLineSpan("underline-line",e),s=e.fontMetrics().defaultRuleThickness,i=we.makeVList({positionType:"top",positionData:n.height,children:[{type:"kern",size:s},{type:"elem",elem:r},{type:"kern",size:3*s},{type:"elem",elem:n}]},e);return we.makeSpan(["mord","underline"],[i],e)},mathmlBuilder(t,e){var n=new Ie.MathNode("mo",[new Ie.TextNode("‾")]);n.setAttribute("stretchy","true");var r=new Ie.MathNode("munder",[Un(t.body,e),n]);return r.setAttribute("accentunder","true"),r}});Ke({type:"vcenter",names:["\\vcenter"],props:{numArgs:1,argTypes:["original"],allowedInText:!1},handler(t,e){var{parser:n}=t;return{type:"vcenter",mode:n.mode,body:e[0]}},htmlBuilder(t,e){var n=Sn(t.body,e),r=e.fontMetrics().axisHeight,s=.5*(n.height-r-(n.depth+r));return we.makeVList({positionType:"shift",positionData:s,children:[{type:"elem",elem:n}]},e)},mathmlBuilder(t,e){return new Ie.MathNode("mpadded",[Un(t.body,e)],["vcenter"])}});Ke({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler(t,e,n){throw new Be("\\verb ended by end of line instead of matching delimiter")},htmlBuilder(t,e){for(var n=wM(t),r=[],s=e.havingStyle(e.style.text()),i=0;it.body.replace(/ /g,t.star?"␣":" "),fc=sQ,PQ=`[ \r - ]`,g2e="\\\\[a-zA-Z@]+",x2e="\\\\[^\uD800-\uDFFF]",v2e="("+g2e+")"+PQ+"*",y2e=`\\\\( +-470,-1265c-4.7,-6,-9.7,-11.7,-15,-17c-0.7,-0.7,-6.7,-1,-18,-1z`;default:throw new Error("Unknown stretchy delimiter.")}};class fp{constructor(e){this.children=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.children=e,this.classes=[],this.height=0,this.depth=0,this.maxFontSize=0,this.style={}}hasClass(e){return this.classes.includes(e)}toNode(){for(var e=document.createDocumentFragment(),n=0;nn.toText();return this.children.map(e).join("")}}var il={"AMS-Regular":{32:[0,0,0,0,.25],65:[0,.68889,0,0,.72222],66:[0,.68889,0,0,.66667],67:[0,.68889,0,0,.72222],68:[0,.68889,0,0,.72222],69:[0,.68889,0,0,.66667],70:[0,.68889,0,0,.61111],71:[0,.68889,0,0,.77778],72:[0,.68889,0,0,.77778],73:[0,.68889,0,0,.38889],74:[.16667,.68889,0,0,.5],75:[0,.68889,0,0,.77778],76:[0,.68889,0,0,.66667],77:[0,.68889,0,0,.94445],78:[0,.68889,0,0,.72222],79:[.16667,.68889,0,0,.77778],80:[0,.68889,0,0,.61111],81:[.16667,.68889,0,0,.77778],82:[0,.68889,0,0,.72222],83:[0,.68889,0,0,.55556],84:[0,.68889,0,0,.66667],85:[0,.68889,0,0,.72222],86:[0,.68889,0,0,.72222],87:[0,.68889,0,0,1],88:[0,.68889,0,0,.72222],89:[0,.68889,0,0,.72222],90:[0,.68889,0,0,.66667],107:[0,.68889,0,0,.55556],160:[0,0,0,0,.25],165:[0,.675,.025,0,.75],174:[.15559,.69224,0,0,.94666],240:[0,.68889,0,0,.55556],295:[0,.68889,0,0,.54028],710:[0,.825,0,0,2.33334],732:[0,.9,0,0,2.33334],770:[0,.825,0,0,2.33334],771:[0,.9,0,0,2.33334],989:[.08167,.58167,0,0,.77778],1008:[0,.43056,.04028,0,.66667],8245:[0,.54986,0,0,.275],8463:[0,.68889,0,0,.54028],8487:[0,.68889,0,0,.72222],8498:[0,.68889,0,0,.55556],8502:[0,.68889,0,0,.66667],8503:[0,.68889,0,0,.44445],8504:[0,.68889,0,0,.66667],8513:[0,.68889,0,0,.63889],8592:[-.03598,.46402,0,0,.5],8594:[-.03598,.46402,0,0,.5],8602:[-.13313,.36687,0,0,1],8603:[-.13313,.36687,0,0,1],8606:[.01354,.52239,0,0,1],8608:[.01354,.52239,0,0,1],8610:[.01354,.52239,0,0,1.11111],8611:[.01354,.52239,0,0,1.11111],8619:[0,.54986,0,0,1],8620:[0,.54986,0,0,1],8621:[-.13313,.37788,0,0,1.38889],8622:[-.13313,.36687,0,0,1],8624:[0,.69224,0,0,.5],8625:[0,.69224,0,0,.5],8630:[0,.43056,0,0,1],8631:[0,.43056,0,0,1],8634:[.08198,.58198,0,0,.77778],8635:[.08198,.58198,0,0,.77778],8638:[.19444,.69224,0,0,.41667],8639:[.19444,.69224,0,0,.41667],8642:[.19444,.69224,0,0,.41667],8643:[.19444,.69224,0,0,.41667],8644:[.1808,.675,0,0,1],8646:[.1808,.675,0,0,1],8647:[.1808,.675,0,0,1],8648:[.19444,.69224,0,0,.83334],8649:[.1808,.675,0,0,1],8650:[.19444,.69224,0,0,.83334],8651:[.01354,.52239,0,0,1],8652:[.01354,.52239,0,0,1],8653:[-.13313,.36687,0,0,1],8654:[-.13313,.36687,0,0,1],8655:[-.13313,.36687,0,0,1],8666:[.13667,.63667,0,0,1],8667:[.13667,.63667,0,0,1],8669:[-.13313,.37788,0,0,1],8672:[-.064,.437,0,0,1.334],8674:[-.064,.437,0,0,1.334],8705:[0,.825,0,0,.5],8708:[0,.68889,0,0,.55556],8709:[.08167,.58167,0,0,.77778],8717:[0,.43056,0,0,.42917],8722:[-.03598,.46402,0,0,.5],8724:[.08198,.69224,0,0,.77778],8726:[.08167,.58167,0,0,.77778],8733:[0,.69224,0,0,.77778],8736:[0,.69224,0,0,.72222],8737:[0,.69224,0,0,.72222],8738:[.03517,.52239,0,0,.72222],8739:[.08167,.58167,0,0,.22222],8740:[.25142,.74111,0,0,.27778],8741:[.08167,.58167,0,0,.38889],8742:[.25142,.74111,0,0,.5],8756:[0,.69224,0,0,.66667],8757:[0,.69224,0,0,.66667],8764:[-.13313,.36687,0,0,.77778],8765:[-.13313,.37788,0,0,.77778],8769:[-.13313,.36687,0,0,.77778],8770:[-.03625,.46375,0,0,.77778],8774:[.30274,.79383,0,0,.77778],8776:[-.01688,.48312,0,0,.77778],8778:[.08167,.58167,0,0,.77778],8782:[.06062,.54986,0,0,.77778],8783:[.06062,.54986,0,0,.77778],8785:[.08198,.58198,0,0,.77778],8786:[.08198,.58198,0,0,.77778],8787:[.08198,.58198,0,0,.77778],8790:[0,.69224,0,0,.77778],8791:[.22958,.72958,0,0,.77778],8796:[.08198,.91667,0,0,.77778],8806:[.25583,.75583,0,0,.77778],8807:[.25583,.75583,0,0,.77778],8808:[.25142,.75726,0,0,.77778],8809:[.25142,.75726,0,0,.77778],8812:[.25583,.75583,0,0,.5],8814:[.20576,.70576,0,0,.77778],8815:[.20576,.70576,0,0,.77778],8816:[.30274,.79383,0,0,.77778],8817:[.30274,.79383,0,0,.77778],8818:[.22958,.72958,0,0,.77778],8819:[.22958,.72958,0,0,.77778],8822:[.1808,.675,0,0,.77778],8823:[.1808,.675,0,0,.77778],8828:[.13667,.63667,0,0,.77778],8829:[.13667,.63667,0,0,.77778],8830:[.22958,.72958,0,0,.77778],8831:[.22958,.72958,0,0,.77778],8832:[.20576,.70576,0,0,.77778],8833:[.20576,.70576,0,0,.77778],8840:[.30274,.79383,0,0,.77778],8841:[.30274,.79383,0,0,.77778],8842:[.13597,.63597,0,0,.77778],8843:[.13597,.63597,0,0,.77778],8847:[.03517,.54986,0,0,.77778],8848:[.03517,.54986,0,0,.77778],8858:[.08198,.58198,0,0,.77778],8859:[.08198,.58198,0,0,.77778],8861:[.08198,.58198,0,0,.77778],8862:[0,.675,0,0,.77778],8863:[0,.675,0,0,.77778],8864:[0,.675,0,0,.77778],8865:[0,.675,0,0,.77778],8872:[0,.69224,0,0,.61111],8873:[0,.69224,0,0,.72222],8874:[0,.69224,0,0,.88889],8876:[0,.68889,0,0,.61111],8877:[0,.68889,0,0,.61111],8878:[0,.68889,0,0,.72222],8879:[0,.68889,0,0,.72222],8882:[.03517,.54986,0,0,.77778],8883:[.03517,.54986,0,0,.77778],8884:[.13667,.63667,0,0,.77778],8885:[.13667,.63667,0,0,.77778],8888:[0,.54986,0,0,1.11111],8890:[.19444,.43056,0,0,.55556],8891:[.19444,.69224,0,0,.61111],8892:[.19444,.69224,0,0,.61111],8901:[0,.54986,0,0,.27778],8903:[.08167,.58167,0,0,.77778],8905:[.08167,.58167,0,0,.77778],8906:[.08167,.58167,0,0,.77778],8907:[0,.69224,0,0,.77778],8908:[0,.69224,0,0,.77778],8909:[-.03598,.46402,0,0,.77778],8910:[0,.54986,0,0,.76042],8911:[0,.54986,0,0,.76042],8912:[.03517,.54986,0,0,.77778],8913:[.03517,.54986,0,0,.77778],8914:[0,.54986,0,0,.66667],8915:[0,.54986,0,0,.66667],8916:[0,.69224,0,0,.66667],8918:[.0391,.5391,0,0,.77778],8919:[.0391,.5391,0,0,.77778],8920:[.03517,.54986,0,0,1.33334],8921:[.03517,.54986,0,0,1.33334],8922:[.38569,.88569,0,0,.77778],8923:[.38569,.88569,0,0,.77778],8926:[.13667,.63667,0,0,.77778],8927:[.13667,.63667,0,0,.77778],8928:[.30274,.79383,0,0,.77778],8929:[.30274,.79383,0,0,.77778],8934:[.23222,.74111,0,0,.77778],8935:[.23222,.74111,0,0,.77778],8936:[.23222,.74111,0,0,.77778],8937:[.23222,.74111,0,0,.77778],8938:[.20576,.70576,0,0,.77778],8939:[.20576,.70576,0,0,.77778],8940:[.30274,.79383,0,0,.77778],8941:[.30274,.79383,0,0,.77778],8994:[.19444,.69224,0,0,.77778],8995:[.19444,.69224,0,0,.77778],9416:[.15559,.69224,0,0,.90222],9484:[0,.69224,0,0,.5],9488:[0,.69224,0,0,.5],9492:[0,.37788,0,0,.5],9496:[0,.37788,0,0,.5],9585:[.19444,.68889,0,0,.88889],9586:[.19444,.74111,0,0,.88889],9632:[0,.675,0,0,.77778],9633:[0,.675,0,0,.77778],9650:[0,.54986,0,0,.72222],9651:[0,.54986,0,0,.72222],9654:[.03517,.54986,0,0,.77778],9660:[0,.54986,0,0,.72222],9661:[0,.54986,0,0,.72222],9664:[.03517,.54986,0,0,.77778],9674:[.11111,.69224,0,0,.66667],9733:[.19444,.69224,0,0,.94445],10003:[0,.69224,0,0,.83334],10016:[0,.69224,0,0,.83334],10731:[.11111,.69224,0,0,.66667],10846:[.19444,.75583,0,0,.61111],10877:[.13667,.63667,0,0,.77778],10878:[.13667,.63667,0,0,.77778],10885:[.25583,.75583,0,0,.77778],10886:[.25583,.75583,0,0,.77778],10887:[.13597,.63597,0,0,.77778],10888:[.13597,.63597,0,0,.77778],10889:[.26167,.75726,0,0,.77778],10890:[.26167,.75726,0,0,.77778],10891:[.48256,.98256,0,0,.77778],10892:[.48256,.98256,0,0,.77778],10901:[.13667,.63667,0,0,.77778],10902:[.13667,.63667,0,0,.77778],10933:[.25142,.75726,0,0,.77778],10934:[.25142,.75726,0,0,.77778],10935:[.26167,.75726,0,0,.77778],10936:[.26167,.75726,0,0,.77778],10937:[.26167,.75726,0,0,.77778],10938:[.26167,.75726,0,0,.77778],10949:[.25583,.75583,0,0,.77778],10950:[.25583,.75583,0,0,.77778],10955:[.28481,.79383,0,0,.77778],10956:[.28481,.79383,0,0,.77778],57350:[.08167,.58167,0,0,.22222],57351:[.08167,.58167,0,0,.38889],57352:[.08167,.58167,0,0,.77778],57353:[0,.43056,.04028,0,.66667],57356:[.25142,.75726,0,0,.77778],57357:[.25142,.75726,0,0,.77778],57358:[.41951,.91951,0,0,.77778],57359:[.30274,.79383,0,0,.77778],57360:[.30274,.79383,0,0,.77778],57361:[.41951,.91951,0,0,.77778],57366:[.25142,.75726,0,0,.77778],57367:[.25142,.75726,0,0,.77778],57368:[.25142,.75726,0,0,.77778],57369:[.25142,.75726,0,0,.77778],57370:[.13597,.63597,0,0,.77778],57371:[.13597,.63597,0,0,.77778]},"Caligraphic-Regular":{32:[0,0,0,0,.25],65:[0,.68333,0,.19445,.79847],66:[0,.68333,.03041,.13889,.65681],67:[0,.68333,.05834,.13889,.52653],68:[0,.68333,.02778,.08334,.77139],69:[0,.68333,.08944,.11111,.52778],70:[0,.68333,.09931,.11111,.71875],71:[.09722,.68333,.0593,.11111,.59487],72:[0,.68333,.00965,.11111,.84452],73:[0,.68333,.07382,0,.54452],74:[.09722,.68333,.18472,.16667,.67778],75:[0,.68333,.01445,.05556,.76195],76:[0,.68333,0,.13889,.68972],77:[0,.68333,0,.13889,1.2009],78:[0,.68333,.14736,.08334,.82049],79:[0,.68333,.02778,.11111,.79611],80:[0,.68333,.08222,.08334,.69556],81:[.09722,.68333,0,.11111,.81667],82:[0,.68333,0,.08334,.8475],83:[0,.68333,.075,.13889,.60556],84:[0,.68333,.25417,0,.54464],85:[0,.68333,.09931,.08334,.62583],86:[0,.68333,.08222,0,.61278],87:[0,.68333,.08222,.08334,.98778],88:[0,.68333,.14643,.13889,.7133],89:[.09722,.68333,.08222,.08334,.66834],90:[0,.68333,.07944,.13889,.72473],160:[0,0,0,0,.25]},"Fraktur-Regular":{32:[0,0,0,0,.25],33:[0,.69141,0,0,.29574],34:[0,.69141,0,0,.21471],38:[0,.69141,0,0,.73786],39:[0,.69141,0,0,.21201],40:[.24982,.74947,0,0,.38865],41:[.24982,.74947,0,0,.38865],42:[0,.62119,0,0,.27764],43:[.08319,.58283,0,0,.75623],44:[0,.10803,0,0,.27764],45:[.08319,.58283,0,0,.75623],46:[0,.10803,0,0,.27764],47:[.24982,.74947,0,0,.50181],48:[0,.47534,0,0,.50181],49:[0,.47534,0,0,.50181],50:[0,.47534,0,0,.50181],51:[.18906,.47534,0,0,.50181],52:[.18906,.47534,0,0,.50181],53:[.18906,.47534,0,0,.50181],54:[0,.69141,0,0,.50181],55:[.18906,.47534,0,0,.50181],56:[0,.69141,0,0,.50181],57:[.18906,.47534,0,0,.50181],58:[0,.47534,0,0,.21606],59:[.12604,.47534,0,0,.21606],61:[-.13099,.36866,0,0,.75623],63:[0,.69141,0,0,.36245],65:[0,.69141,0,0,.7176],66:[0,.69141,0,0,.88397],67:[0,.69141,0,0,.61254],68:[0,.69141,0,0,.83158],69:[0,.69141,0,0,.66278],70:[.12604,.69141,0,0,.61119],71:[0,.69141,0,0,.78539],72:[.06302,.69141,0,0,.7203],73:[0,.69141,0,0,.55448],74:[.12604,.69141,0,0,.55231],75:[0,.69141,0,0,.66845],76:[0,.69141,0,0,.66602],77:[0,.69141,0,0,1.04953],78:[0,.69141,0,0,.83212],79:[0,.69141,0,0,.82699],80:[.18906,.69141,0,0,.82753],81:[.03781,.69141,0,0,.82699],82:[0,.69141,0,0,.82807],83:[0,.69141,0,0,.82861],84:[0,.69141,0,0,.66899],85:[0,.69141,0,0,.64576],86:[0,.69141,0,0,.83131],87:[0,.69141,0,0,1.04602],88:[0,.69141,0,0,.71922],89:[.18906,.69141,0,0,.83293],90:[.12604,.69141,0,0,.60201],91:[.24982,.74947,0,0,.27764],93:[.24982,.74947,0,0,.27764],94:[0,.69141,0,0,.49965],97:[0,.47534,0,0,.50046],98:[0,.69141,0,0,.51315],99:[0,.47534,0,0,.38946],100:[0,.62119,0,0,.49857],101:[0,.47534,0,0,.40053],102:[.18906,.69141,0,0,.32626],103:[.18906,.47534,0,0,.5037],104:[.18906,.69141,0,0,.52126],105:[0,.69141,0,0,.27899],106:[0,.69141,0,0,.28088],107:[0,.69141,0,0,.38946],108:[0,.69141,0,0,.27953],109:[0,.47534,0,0,.76676],110:[0,.47534,0,0,.52666],111:[0,.47534,0,0,.48885],112:[.18906,.52396,0,0,.50046],113:[.18906,.47534,0,0,.48912],114:[0,.47534,0,0,.38919],115:[0,.47534,0,0,.44266],116:[0,.62119,0,0,.33301],117:[0,.47534,0,0,.5172],118:[0,.52396,0,0,.5118],119:[0,.52396,0,0,.77351],120:[.18906,.47534,0,0,.38865],121:[.18906,.47534,0,0,.49884],122:[.18906,.47534,0,0,.39054],160:[0,0,0,0,.25],8216:[0,.69141,0,0,.21471],8217:[0,.69141,0,0,.21471],58112:[0,.62119,0,0,.49749],58113:[0,.62119,0,0,.4983],58114:[.18906,.69141,0,0,.33328],58115:[.18906,.69141,0,0,.32923],58116:[.18906,.47534,0,0,.50343],58117:[0,.69141,0,0,.33301],58118:[0,.62119,0,0,.33409],58119:[0,.47534,0,0,.50073]},"Main-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.35],34:[0,.69444,0,0,.60278],35:[.19444,.69444,0,0,.95833],36:[.05556,.75,0,0,.575],37:[.05556,.75,0,0,.95833],38:[0,.69444,0,0,.89444],39:[0,.69444,0,0,.31944],40:[.25,.75,0,0,.44722],41:[.25,.75,0,0,.44722],42:[0,.75,0,0,.575],43:[.13333,.63333,0,0,.89444],44:[.19444,.15556,0,0,.31944],45:[0,.44444,0,0,.38333],46:[0,.15556,0,0,.31944],47:[.25,.75,0,0,.575],48:[0,.64444,0,0,.575],49:[0,.64444,0,0,.575],50:[0,.64444,0,0,.575],51:[0,.64444,0,0,.575],52:[0,.64444,0,0,.575],53:[0,.64444,0,0,.575],54:[0,.64444,0,0,.575],55:[0,.64444,0,0,.575],56:[0,.64444,0,0,.575],57:[0,.64444,0,0,.575],58:[0,.44444,0,0,.31944],59:[.19444,.44444,0,0,.31944],60:[.08556,.58556,0,0,.89444],61:[-.10889,.39111,0,0,.89444],62:[.08556,.58556,0,0,.89444],63:[0,.69444,0,0,.54305],64:[0,.69444,0,0,.89444],65:[0,.68611,0,0,.86944],66:[0,.68611,0,0,.81805],67:[0,.68611,0,0,.83055],68:[0,.68611,0,0,.88194],69:[0,.68611,0,0,.75555],70:[0,.68611,0,0,.72361],71:[0,.68611,0,0,.90416],72:[0,.68611,0,0,.9],73:[0,.68611,0,0,.43611],74:[0,.68611,0,0,.59444],75:[0,.68611,0,0,.90138],76:[0,.68611,0,0,.69166],77:[0,.68611,0,0,1.09166],78:[0,.68611,0,0,.9],79:[0,.68611,0,0,.86388],80:[0,.68611,0,0,.78611],81:[.19444,.68611,0,0,.86388],82:[0,.68611,0,0,.8625],83:[0,.68611,0,0,.63889],84:[0,.68611,0,0,.8],85:[0,.68611,0,0,.88472],86:[0,.68611,.01597,0,.86944],87:[0,.68611,.01597,0,1.18888],88:[0,.68611,0,0,.86944],89:[0,.68611,.02875,0,.86944],90:[0,.68611,0,0,.70277],91:[.25,.75,0,0,.31944],92:[.25,.75,0,0,.575],93:[.25,.75,0,0,.31944],94:[0,.69444,0,0,.575],95:[.31,.13444,.03194,0,.575],97:[0,.44444,0,0,.55902],98:[0,.69444,0,0,.63889],99:[0,.44444,0,0,.51111],100:[0,.69444,0,0,.63889],101:[0,.44444,0,0,.52708],102:[0,.69444,.10903,0,.35139],103:[.19444,.44444,.01597,0,.575],104:[0,.69444,0,0,.63889],105:[0,.69444,0,0,.31944],106:[.19444,.69444,0,0,.35139],107:[0,.69444,0,0,.60694],108:[0,.69444,0,0,.31944],109:[0,.44444,0,0,.95833],110:[0,.44444,0,0,.63889],111:[0,.44444,0,0,.575],112:[.19444,.44444,0,0,.63889],113:[.19444,.44444,0,0,.60694],114:[0,.44444,0,0,.47361],115:[0,.44444,0,0,.45361],116:[0,.63492,0,0,.44722],117:[0,.44444,0,0,.63889],118:[0,.44444,.01597,0,.60694],119:[0,.44444,.01597,0,.83055],120:[0,.44444,0,0,.60694],121:[.19444,.44444,.01597,0,.60694],122:[0,.44444,0,0,.51111],123:[.25,.75,0,0,.575],124:[.25,.75,0,0,.31944],125:[.25,.75,0,0,.575],126:[.35,.34444,0,0,.575],160:[0,0,0,0,.25],163:[0,.69444,0,0,.86853],168:[0,.69444,0,0,.575],172:[0,.44444,0,0,.76666],176:[0,.69444,0,0,.86944],177:[.13333,.63333,0,0,.89444],184:[.17014,0,0,0,.51111],198:[0,.68611,0,0,1.04166],215:[.13333,.63333,0,0,.89444],216:[.04861,.73472,0,0,.89444],223:[0,.69444,0,0,.59722],230:[0,.44444,0,0,.83055],247:[.13333,.63333,0,0,.89444],248:[.09722,.54167,0,0,.575],305:[0,.44444,0,0,.31944],338:[0,.68611,0,0,1.16944],339:[0,.44444,0,0,.89444],567:[.19444,.44444,0,0,.35139],710:[0,.69444,0,0,.575],711:[0,.63194,0,0,.575],713:[0,.59611,0,0,.575],714:[0,.69444,0,0,.575],715:[0,.69444,0,0,.575],728:[0,.69444,0,0,.575],729:[0,.69444,0,0,.31944],730:[0,.69444,0,0,.86944],732:[0,.69444,0,0,.575],733:[0,.69444,0,0,.575],915:[0,.68611,0,0,.69166],916:[0,.68611,0,0,.95833],920:[0,.68611,0,0,.89444],923:[0,.68611,0,0,.80555],926:[0,.68611,0,0,.76666],928:[0,.68611,0,0,.9],931:[0,.68611,0,0,.83055],933:[0,.68611,0,0,.89444],934:[0,.68611,0,0,.83055],936:[0,.68611,0,0,.89444],937:[0,.68611,0,0,.83055],8211:[0,.44444,.03194,0,.575],8212:[0,.44444,.03194,0,1.14999],8216:[0,.69444,0,0,.31944],8217:[0,.69444,0,0,.31944],8220:[0,.69444,0,0,.60278],8221:[0,.69444,0,0,.60278],8224:[.19444,.69444,0,0,.51111],8225:[.19444,.69444,0,0,.51111],8242:[0,.55556,0,0,.34444],8407:[0,.72444,.15486,0,.575],8463:[0,.69444,0,0,.66759],8465:[0,.69444,0,0,.83055],8467:[0,.69444,0,0,.47361],8472:[.19444,.44444,0,0,.74027],8476:[0,.69444,0,0,.83055],8501:[0,.69444,0,0,.70277],8592:[-.10889,.39111,0,0,1.14999],8593:[.19444,.69444,0,0,.575],8594:[-.10889,.39111,0,0,1.14999],8595:[.19444,.69444,0,0,.575],8596:[-.10889,.39111,0,0,1.14999],8597:[.25,.75,0,0,.575],8598:[.19444,.69444,0,0,1.14999],8599:[.19444,.69444,0,0,1.14999],8600:[.19444,.69444,0,0,1.14999],8601:[.19444,.69444,0,0,1.14999],8636:[-.10889,.39111,0,0,1.14999],8637:[-.10889,.39111,0,0,1.14999],8640:[-.10889,.39111,0,0,1.14999],8641:[-.10889,.39111,0,0,1.14999],8656:[-.10889,.39111,0,0,1.14999],8657:[.19444,.69444,0,0,.70277],8658:[-.10889,.39111,0,0,1.14999],8659:[.19444,.69444,0,0,.70277],8660:[-.10889,.39111,0,0,1.14999],8661:[.25,.75,0,0,.70277],8704:[0,.69444,0,0,.63889],8706:[0,.69444,.06389,0,.62847],8707:[0,.69444,0,0,.63889],8709:[.05556,.75,0,0,.575],8711:[0,.68611,0,0,.95833],8712:[.08556,.58556,0,0,.76666],8715:[.08556,.58556,0,0,.76666],8722:[.13333,.63333,0,0,.89444],8723:[.13333,.63333,0,0,.89444],8725:[.25,.75,0,0,.575],8726:[.25,.75,0,0,.575],8727:[-.02778,.47222,0,0,.575],8728:[-.02639,.47361,0,0,.575],8729:[-.02639,.47361,0,0,.575],8730:[.18,.82,0,0,.95833],8733:[0,.44444,0,0,.89444],8734:[0,.44444,0,0,1.14999],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.31944],8741:[.25,.75,0,0,.575],8743:[0,.55556,0,0,.76666],8744:[0,.55556,0,0,.76666],8745:[0,.55556,0,0,.76666],8746:[0,.55556,0,0,.76666],8747:[.19444,.69444,.12778,0,.56875],8764:[-.10889,.39111,0,0,.89444],8768:[.19444,.69444,0,0,.31944],8771:[.00222,.50222,0,0,.89444],8773:[.027,.638,0,0,.894],8776:[.02444,.52444,0,0,.89444],8781:[.00222,.50222,0,0,.89444],8801:[.00222,.50222,0,0,.89444],8804:[.19667,.69667,0,0,.89444],8805:[.19667,.69667,0,0,.89444],8810:[.08556,.58556,0,0,1.14999],8811:[.08556,.58556,0,0,1.14999],8826:[.08556,.58556,0,0,.89444],8827:[.08556,.58556,0,0,.89444],8834:[.08556,.58556,0,0,.89444],8835:[.08556,.58556,0,0,.89444],8838:[.19667,.69667,0,0,.89444],8839:[.19667,.69667,0,0,.89444],8846:[0,.55556,0,0,.76666],8849:[.19667,.69667,0,0,.89444],8850:[.19667,.69667,0,0,.89444],8851:[0,.55556,0,0,.76666],8852:[0,.55556,0,0,.76666],8853:[.13333,.63333,0,0,.89444],8854:[.13333,.63333,0,0,.89444],8855:[.13333,.63333,0,0,.89444],8856:[.13333,.63333,0,0,.89444],8857:[.13333,.63333,0,0,.89444],8866:[0,.69444,0,0,.70277],8867:[0,.69444,0,0,.70277],8868:[0,.69444,0,0,.89444],8869:[0,.69444,0,0,.89444],8900:[-.02639,.47361,0,0,.575],8901:[-.02639,.47361,0,0,.31944],8902:[-.02778,.47222,0,0,.575],8968:[.25,.75,0,0,.51111],8969:[.25,.75,0,0,.51111],8970:[.25,.75,0,0,.51111],8971:[.25,.75,0,0,.51111],8994:[-.13889,.36111,0,0,1.14999],8995:[-.13889,.36111,0,0,1.14999],9651:[.19444,.69444,0,0,1.02222],9657:[-.02778,.47222,0,0,.575],9661:[.19444,.69444,0,0,1.02222],9667:[-.02778,.47222,0,0,.575],9711:[.19444,.69444,0,0,1.14999],9824:[.12963,.69444,0,0,.89444],9825:[.12963,.69444,0,0,.89444],9826:[.12963,.69444,0,0,.89444],9827:[.12963,.69444,0,0,.89444],9837:[0,.75,0,0,.44722],9838:[.19444,.69444,0,0,.44722],9839:[.19444,.69444,0,0,.44722],10216:[.25,.75,0,0,.44722],10217:[.25,.75,0,0,.44722],10815:[0,.68611,0,0,.9],10927:[.19667,.69667,0,0,.89444],10928:[.19667,.69667,0,0,.89444],57376:[.19444,.69444,0,0,0]},"Main-BoldItalic":{32:[0,0,0,0,.25],33:[0,.69444,.11417,0,.38611],34:[0,.69444,.07939,0,.62055],35:[.19444,.69444,.06833,0,.94444],37:[.05556,.75,.12861,0,.94444],38:[0,.69444,.08528,0,.88555],39:[0,.69444,.12945,0,.35555],40:[.25,.75,.15806,0,.47333],41:[.25,.75,.03306,0,.47333],42:[0,.75,.14333,0,.59111],43:[.10333,.60333,.03306,0,.88555],44:[.19444,.14722,0,0,.35555],45:[0,.44444,.02611,0,.41444],46:[0,.14722,0,0,.35555],47:[.25,.75,.15806,0,.59111],48:[0,.64444,.13167,0,.59111],49:[0,.64444,.13167,0,.59111],50:[0,.64444,.13167,0,.59111],51:[0,.64444,.13167,0,.59111],52:[.19444,.64444,.13167,0,.59111],53:[0,.64444,.13167,0,.59111],54:[0,.64444,.13167,0,.59111],55:[.19444,.64444,.13167,0,.59111],56:[0,.64444,.13167,0,.59111],57:[0,.64444,.13167,0,.59111],58:[0,.44444,.06695,0,.35555],59:[.19444,.44444,.06695,0,.35555],61:[-.10889,.39111,.06833,0,.88555],63:[0,.69444,.11472,0,.59111],64:[0,.69444,.09208,0,.88555],65:[0,.68611,0,0,.86555],66:[0,.68611,.0992,0,.81666],67:[0,.68611,.14208,0,.82666],68:[0,.68611,.09062,0,.87555],69:[0,.68611,.11431,0,.75666],70:[0,.68611,.12903,0,.72722],71:[0,.68611,.07347,0,.89527],72:[0,.68611,.17208,0,.8961],73:[0,.68611,.15681,0,.47166],74:[0,.68611,.145,0,.61055],75:[0,.68611,.14208,0,.89499],76:[0,.68611,0,0,.69777],77:[0,.68611,.17208,0,1.07277],78:[0,.68611,.17208,0,.8961],79:[0,.68611,.09062,0,.85499],80:[0,.68611,.0992,0,.78721],81:[.19444,.68611,.09062,0,.85499],82:[0,.68611,.02559,0,.85944],83:[0,.68611,.11264,0,.64999],84:[0,.68611,.12903,0,.7961],85:[0,.68611,.17208,0,.88083],86:[0,.68611,.18625,0,.86555],87:[0,.68611,.18625,0,1.15999],88:[0,.68611,.15681,0,.86555],89:[0,.68611,.19803,0,.86555],90:[0,.68611,.14208,0,.70888],91:[.25,.75,.1875,0,.35611],93:[.25,.75,.09972,0,.35611],94:[0,.69444,.06709,0,.59111],95:[.31,.13444,.09811,0,.59111],97:[0,.44444,.09426,0,.59111],98:[0,.69444,.07861,0,.53222],99:[0,.44444,.05222,0,.53222],100:[0,.69444,.10861,0,.59111],101:[0,.44444,.085,0,.53222],102:[.19444,.69444,.21778,0,.4],103:[.19444,.44444,.105,0,.53222],104:[0,.69444,.09426,0,.59111],105:[0,.69326,.11387,0,.35555],106:[.19444,.69326,.1672,0,.35555],107:[0,.69444,.11111,0,.53222],108:[0,.69444,.10861,0,.29666],109:[0,.44444,.09426,0,.94444],110:[0,.44444,.09426,0,.64999],111:[0,.44444,.07861,0,.59111],112:[.19444,.44444,.07861,0,.59111],113:[.19444,.44444,.105,0,.53222],114:[0,.44444,.11111,0,.50167],115:[0,.44444,.08167,0,.48694],116:[0,.63492,.09639,0,.385],117:[0,.44444,.09426,0,.62055],118:[0,.44444,.11111,0,.53222],119:[0,.44444,.11111,0,.76777],120:[0,.44444,.12583,0,.56055],121:[.19444,.44444,.105,0,.56166],122:[0,.44444,.13889,0,.49055],126:[.35,.34444,.11472,0,.59111],160:[0,0,0,0,.25],168:[0,.69444,.11473,0,.59111],176:[0,.69444,0,0,.94888],184:[.17014,0,0,0,.53222],198:[0,.68611,.11431,0,1.02277],216:[.04861,.73472,.09062,0,.88555],223:[.19444,.69444,.09736,0,.665],230:[0,.44444,.085,0,.82666],248:[.09722,.54167,.09458,0,.59111],305:[0,.44444,.09426,0,.35555],338:[0,.68611,.11431,0,1.14054],339:[0,.44444,.085,0,.82666],567:[.19444,.44444,.04611,0,.385],710:[0,.69444,.06709,0,.59111],711:[0,.63194,.08271,0,.59111],713:[0,.59444,.10444,0,.59111],714:[0,.69444,.08528,0,.59111],715:[0,.69444,0,0,.59111],728:[0,.69444,.10333,0,.59111],729:[0,.69444,.12945,0,.35555],730:[0,.69444,0,0,.94888],732:[0,.69444,.11472,0,.59111],733:[0,.69444,.11472,0,.59111],915:[0,.68611,.12903,0,.69777],916:[0,.68611,0,0,.94444],920:[0,.68611,.09062,0,.88555],923:[0,.68611,0,0,.80666],926:[0,.68611,.15092,0,.76777],928:[0,.68611,.17208,0,.8961],931:[0,.68611,.11431,0,.82666],933:[0,.68611,.10778,0,.88555],934:[0,.68611,.05632,0,.82666],936:[0,.68611,.10778,0,.88555],937:[0,.68611,.0992,0,.82666],8211:[0,.44444,.09811,0,.59111],8212:[0,.44444,.09811,0,1.18221],8216:[0,.69444,.12945,0,.35555],8217:[0,.69444,.12945,0,.35555],8220:[0,.69444,.16772,0,.62055],8221:[0,.69444,.07939,0,.62055]},"Main-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.12417,0,.30667],34:[0,.69444,.06961,0,.51444],35:[.19444,.69444,.06616,0,.81777],37:[.05556,.75,.13639,0,.81777],38:[0,.69444,.09694,0,.76666],39:[0,.69444,.12417,0,.30667],40:[.25,.75,.16194,0,.40889],41:[.25,.75,.03694,0,.40889],42:[0,.75,.14917,0,.51111],43:[.05667,.56167,.03694,0,.76666],44:[.19444,.10556,0,0,.30667],45:[0,.43056,.02826,0,.35778],46:[0,.10556,0,0,.30667],47:[.25,.75,.16194,0,.51111],48:[0,.64444,.13556,0,.51111],49:[0,.64444,.13556,0,.51111],50:[0,.64444,.13556,0,.51111],51:[0,.64444,.13556,0,.51111],52:[.19444,.64444,.13556,0,.51111],53:[0,.64444,.13556,0,.51111],54:[0,.64444,.13556,0,.51111],55:[.19444,.64444,.13556,0,.51111],56:[0,.64444,.13556,0,.51111],57:[0,.64444,.13556,0,.51111],58:[0,.43056,.0582,0,.30667],59:[.19444,.43056,.0582,0,.30667],61:[-.13313,.36687,.06616,0,.76666],63:[0,.69444,.1225,0,.51111],64:[0,.69444,.09597,0,.76666],65:[0,.68333,0,0,.74333],66:[0,.68333,.10257,0,.70389],67:[0,.68333,.14528,0,.71555],68:[0,.68333,.09403,0,.755],69:[0,.68333,.12028,0,.67833],70:[0,.68333,.13305,0,.65277],71:[0,.68333,.08722,0,.77361],72:[0,.68333,.16389,0,.74333],73:[0,.68333,.15806,0,.38555],74:[0,.68333,.14028,0,.525],75:[0,.68333,.14528,0,.76888],76:[0,.68333,0,0,.62722],77:[0,.68333,.16389,0,.89666],78:[0,.68333,.16389,0,.74333],79:[0,.68333,.09403,0,.76666],80:[0,.68333,.10257,0,.67833],81:[.19444,.68333,.09403,0,.76666],82:[0,.68333,.03868,0,.72944],83:[0,.68333,.11972,0,.56222],84:[0,.68333,.13305,0,.71555],85:[0,.68333,.16389,0,.74333],86:[0,.68333,.18361,0,.74333],87:[0,.68333,.18361,0,.99888],88:[0,.68333,.15806,0,.74333],89:[0,.68333,.19383,0,.74333],90:[0,.68333,.14528,0,.61333],91:[.25,.75,.1875,0,.30667],93:[.25,.75,.10528,0,.30667],94:[0,.69444,.06646,0,.51111],95:[.31,.12056,.09208,0,.51111],97:[0,.43056,.07671,0,.51111],98:[0,.69444,.06312,0,.46],99:[0,.43056,.05653,0,.46],100:[0,.69444,.10333,0,.51111],101:[0,.43056,.07514,0,.46],102:[.19444,.69444,.21194,0,.30667],103:[.19444,.43056,.08847,0,.46],104:[0,.69444,.07671,0,.51111],105:[0,.65536,.1019,0,.30667],106:[.19444,.65536,.14467,0,.30667],107:[0,.69444,.10764,0,.46],108:[0,.69444,.10333,0,.25555],109:[0,.43056,.07671,0,.81777],110:[0,.43056,.07671,0,.56222],111:[0,.43056,.06312,0,.51111],112:[.19444,.43056,.06312,0,.51111],113:[.19444,.43056,.08847,0,.46],114:[0,.43056,.10764,0,.42166],115:[0,.43056,.08208,0,.40889],116:[0,.61508,.09486,0,.33222],117:[0,.43056,.07671,0,.53666],118:[0,.43056,.10764,0,.46],119:[0,.43056,.10764,0,.66444],120:[0,.43056,.12042,0,.46389],121:[.19444,.43056,.08847,0,.48555],122:[0,.43056,.12292,0,.40889],126:[.35,.31786,.11585,0,.51111],160:[0,0,0,0,.25],168:[0,.66786,.10474,0,.51111],176:[0,.69444,0,0,.83129],184:[.17014,0,0,0,.46],198:[0,.68333,.12028,0,.88277],216:[.04861,.73194,.09403,0,.76666],223:[.19444,.69444,.10514,0,.53666],230:[0,.43056,.07514,0,.71555],248:[.09722,.52778,.09194,0,.51111],338:[0,.68333,.12028,0,.98499],339:[0,.43056,.07514,0,.71555],710:[0,.69444,.06646,0,.51111],711:[0,.62847,.08295,0,.51111],713:[0,.56167,.10333,0,.51111],714:[0,.69444,.09694,0,.51111],715:[0,.69444,0,0,.51111],728:[0,.69444,.10806,0,.51111],729:[0,.66786,.11752,0,.30667],730:[0,.69444,0,0,.83129],732:[0,.66786,.11585,0,.51111],733:[0,.69444,.1225,0,.51111],915:[0,.68333,.13305,0,.62722],916:[0,.68333,0,0,.81777],920:[0,.68333,.09403,0,.76666],923:[0,.68333,0,0,.69222],926:[0,.68333,.15294,0,.66444],928:[0,.68333,.16389,0,.74333],931:[0,.68333,.12028,0,.71555],933:[0,.68333,.11111,0,.76666],934:[0,.68333,.05986,0,.71555],936:[0,.68333,.11111,0,.76666],937:[0,.68333,.10257,0,.71555],8211:[0,.43056,.09208,0,.51111],8212:[0,.43056,.09208,0,1.02222],8216:[0,.69444,.12417,0,.30667],8217:[0,.69444,.12417,0,.30667],8220:[0,.69444,.1685,0,.51444],8221:[0,.69444,.06961,0,.51444],8463:[0,.68889,0,0,.54028]},"Main-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.27778],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.77778],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.19444,.10556,0,0,.27778],45:[0,.43056,0,0,.33333],46:[0,.10556,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.64444,0,0,.5],49:[0,.64444,0,0,.5],50:[0,.64444,0,0,.5],51:[0,.64444,0,0,.5],52:[0,.64444,0,0,.5],53:[0,.64444,0,0,.5],54:[0,.64444,0,0,.5],55:[0,.64444,0,0,.5],56:[0,.64444,0,0,.5],57:[0,.64444,0,0,.5],58:[0,.43056,0,0,.27778],59:[.19444,.43056,0,0,.27778],60:[.0391,.5391,0,0,.77778],61:[-.13313,.36687,0,0,.77778],62:[.0391,.5391,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.77778],65:[0,.68333,0,0,.75],66:[0,.68333,0,0,.70834],67:[0,.68333,0,0,.72222],68:[0,.68333,0,0,.76389],69:[0,.68333,0,0,.68056],70:[0,.68333,0,0,.65278],71:[0,.68333,0,0,.78472],72:[0,.68333,0,0,.75],73:[0,.68333,0,0,.36111],74:[0,.68333,0,0,.51389],75:[0,.68333,0,0,.77778],76:[0,.68333,0,0,.625],77:[0,.68333,0,0,.91667],78:[0,.68333,0,0,.75],79:[0,.68333,0,0,.77778],80:[0,.68333,0,0,.68056],81:[.19444,.68333,0,0,.77778],82:[0,.68333,0,0,.73611],83:[0,.68333,0,0,.55556],84:[0,.68333,0,0,.72222],85:[0,.68333,0,0,.75],86:[0,.68333,.01389,0,.75],87:[0,.68333,.01389,0,1.02778],88:[0,.68333,0,0,.75],89:[0,.68333,.025,0,.75],90:[0,.68333,0,0,.61111],91:[.25,.75,0,0,.27778],92:[.25,.75,0,0,.5],93:[.25,.75,0,0,.27778],94:[0,.69444,0,0,.5],95:[.31,.12056,.02778,0,.5],97:[0,.43056,0,0,.5],98:[0,.69444,0,0,.55556],99:[0,.43056,0,0,.44445],100:[0,.69444,0,0,.55556],101:[0,.43056,0,0,.44445],102:[0,.69444,.07778,0,.30556],103:[.19444,.43056,.01389,0,.5],104:[0,.69444,0,0,.55556],105:[0,.66786,0,0,.27778],106:[.19444,.66786,0,0,.30556],107:[0,.69444,0,0,.52778],108:[0,.69444,0,0,.27778],109:[0,.43056,0,0,.83334],110:[0,.43056,0,0,.55556],111:[0,.43056,0,0,.5],112:[.19444,.43056,0,0,.55556],113:[.19444,.43056,0,0,.52778],114:[0,.43056,0,0,.39167],115:[0,.43056,0,0,.39445],116:[0,.61508,0,0,.38889],117:[0,.43056,0,0,.55556],118:[0,.43056,.01389,0,.52778],119:[0,.43056,.01389,0,.72222],120:[0,.43056,0,0,.52778],121:[.19444,.43056,.01389,0,.52778],122:[0,.43056,0,0,.44445],123:[.25,.75,0,0,.5],124:[.25,.75,0,0,.27778],125:[.25,.75,0,0,.5],126:[.35,.31786,0,0,.5],160:[0,0,0,0,.25],163:[0,.69444,0,0,.76909],167:[.19444,.69444,0,0,.44445],168:[0,.66786,0,0,.5],172:[0,.43056,0,0,.66667],176:[0,.69444,0,0,.75],177:[.08333,.58333,0,0,.77778],182:[.19444,.69444,0,0,.61111],184:[.17014,0,0,0,.44445],198:[0,.68333,0,0,.90278],215:[.08333,.58333,0,0,.77778],216:[.04861,.73194,0,0,.77778],223:[0,.69444,0,0,.5],230:[0,.43056,0,0,.72222],247:[.08333,.58333,0,0,.77778],248:[.09722,.52778,0,0,.5],305:[0,.43056,0,0,.27778],338:[0,.68333,0,0,1.01389],339:[0,.43056,0,0,.77778],567:[.19444,.43056,0,0,.30556],710:[0,.69444,0,0,.5],711:[0,.62847,0,0,.5],713:[0,.56778,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.66786,0,0,.27778],730:[0,.69444,0,0,.75],732:[0,.66786,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.68333,0,0,.625],916:[0,.68333,0,0,.83334],920:[0,.68333,0,0,.77778],923:[0,.68333,0,0,.69445],926:[0,.68333,0,0,.66667],928:[0,.68333,0,0,.75],931:[0,.68333,0,0,.72222],933:[0,.68333,0,0,.77778],934:[0,.68333,0,0,.72222],936:[0,.68333,0,0,.77778],937:[0,.68333,0,0,.72222],8211:[0,.43056,.02778,0,.5],8212:[0,.43056,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5],8224:[.19444,.69444,0,0,.44445],8225:[.19444,.69444,0,0,.44445],8230:[0,.123,0,0,1.172],8242:[0,.55556,0,0,.275],8407:[0,.71444,.15382,0,.5],8463:[0,.68889,0,0,.54028],8465:[0,.69444,0,0,.72222],8467:[0,.69444,0,.11111,.41667],8472:[.19444,.43056,0,.11111,.63646],8476:[0,.69444,0,0,.72222],8501:[0,.69444,0,0,.61111],8592:[-.13313,.36687,0,0,1],8593:[.19444,.69444,0,0,.5],8594:[-.13313,.36687,0,0,1],8595:[.19444,.69444,0,0,.5],8596:[-.13313,.36687,0,0,1],8597:[.25,.75,0,0,.5],8598:[.19444,.69444,0,0,1],8599:[.19444,.69444,0,0,1],8600:[.19444,.69444,0,0,1],8601:[.19444,.69444,0,0,1],8614:[.011,.511,0,0,1],8617:[.011,.511,0,0,1.126],8618:[.011,.511,0,0,1.126],8636:[-.13313,.36687,0,0,1],8637:[-.13313,.36687,0,0,1],8640:[-.13313,.36687,0,0,1],8641:[-.13313,.36687,0,0,1],8652:[.011,.671,0,0,1],8656:[-.13313,.36687,0,0,1],8657:[.19444,.69444,0,0,.61111],8658:[-.13313,.36687,0,0,1],8659:[.19444,.69444,0,0,.61111],8660:[-.13313,.36687,0,0,1],8661:[.25,.75,0,0,.61111],8704:[0,.69444,0,0,.55556],8706:[0,.69444,.05556,.08334,.5309],8707:[0,.69444,0,0,.55556],8709:[.05556,.75,0,0,.5],8711:[0,.68333,0,0,.83334],8712:[.0391,.5391,0,0,.66667],8715:[.0391,.5391,0,0,.66667],8722:[.08333,.58333,0,0,.77778],8723:[.08333,.58333,0,0,.77778],8725:[.25,.75,0,0,.5],8726:[.25,.75,0,0,.5],8727:[-.03472,.46528,0,0,.5],8728:[-.05555,.44445,0,0,.5],8729:[-.05555,.44445,0,0,.5],8730:[.2,.8,0,0,.83334],8733:[0,.43056,0,0,.77778],8734:[0,.43056,0,0,1],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.27778],8741:[.25,.75,0,0,.5],8743:[0,.55556,0,0,.66667],8744:[0,.55556,0,0,.66667],8745:[0,.55556,0,0,.66667],8746:[0,.55556,0,0,.66667],8747:[.19444,.69444,.11111,0,.41667],8764:[-.13313,.36687,0,0,.77778],8768:[.19444,.69444,0,0,.27778],8771:[-.03625,.46375,0,0,.77778],8773:[-.022,.589,0,0,.778],8776:[-.01688,.48312,0,0,.77778],8781:[-.03625,.46375,0,0,.77778],8784:[-.133,.673,0,0,.778],8801:[-.03625,.46375,0,0,.77778],8804:[.13597,.63597,0,0,.77778],8805:[.13597,.63597,0,0,.77778],8810:[.0391,.5391,0,0,1],8811:[.0391,.5391,0,0,1],8826:[.0391,.5391,0,0,.77778],8827:[.0391,.5391,0,0,.77778],8834:[.0391,.5391,0,0,.77778],8835:[.0391,.5391,0,0,.77778],8838:[.13597,.63597,0,0,.77778],8839:[.13597,.63597,0,0,.77778],8846:[0,.55556,0,0,.66667],8849:[.13597,.63597,0,0,.77778],8850:[.13597,.63597,0,0,.77778],8851:[0,.55556,0,0,.66667],8852:[0,.55556,0,0,.66667],8853:[.08333,.58333,0,0,.77778],8854:[.08333,.58333,0,0,.77778],8855:[.08333,.58333,0,0,.77778],8856:[.08333,.58333,0,0,.77778],8857:[.08333,.58333,0,0,.77778],8866:[0,.69444,0,0,.61111],8867:[0,.69444,0,0,.61111],8868:[0,.69444,0,0,.77778],8869:[0,.69444,0,0,.77778],8872:[.249,.75,0,0,.867],8900:[-.05555,.44445,0,0,.5],8901:[-.05555,.44445,0,0,.27778],8902:[-.03472,.46528,0,0,.5],8904:[.005,.505,0,0,.9],8942:[.03,.903,0,0,.278],8943:[-.19,.313,0,0,1.172],8945:[-.1,.823,0,0,1.282],8968:[.25,.75,0,0,.44445],8969:[.25,.75,0,0,.44445],8970:[.25,.75,0,0,.44445],8971:[.25,.75,0,0,.44445],8994:[-.14236,.35764,0,0,1],8995:[-.14236,.35764,0,0,1],9136:[.244,.744,0,0,.412],9137:[.244,.745,0,0,.412],9651:[.19444,.69444,0,0,.88889],9657:[-.03472,.46528,0,0,.5],9661:[.19444,.69444,0,0,.88889],9667:[-.03472,.46528,0,0,.5],9711:[.19444,.69444,0,0,1],9824:[.12963,.69444,0,0,.77778],9825:[.12963,.69444,0,0,.77778],9826:[.12963,.69444,0,0,.77778],9827:[.12963,.69444,0,0,.77778],9837:[0,.75,0,0,.38889],9838:[.19444,.69444,0,0,.38889],9839:[.19444,.69444,0,0,.38889],10216:[.25,.75,0,0,.38889],10217:[.25,.75,0,0,.38889],10222:[.244,.744,0,0,.412],10223:[.244,.745,0,0,.412],10229:[.011,.511,0,0,1.609],10230:[.011,.511,0,0,1.638],10231:[.011,.511,0,0,1.859],10232:[.024,.525,0,0,1.609],10233:[.024,.525,0,0,1.638],10234:[.024,.525,0,0,1.858],10236:[.011,.511,0,0,1.638],10815:[0,.68333,0,0,.75],10927:[.13597,.63597,0,0,.77778],10928:[.13597,.63597,0,0,.77778],57376:[.19444,.69444,0,0,0]},"Math-BoldItalic":{32:[0,0,0,0,.25],48:[0,.44444,0,0,.575],49:[0,.44444,0,0,.575],50:[0,.44444,0,0,.575],51:[.19444,.44444,0,0,.575],52:[.19444,.44444,0,0,.575],53:[.19444,.44444,0,0,.575],54:[0,.64444,0,0,.575],55:[.19444,.44444,0,0,.575],56:[0,.64444,0,0,.575],57:[.19444,.44444,0,0,.575],65:[0,.68611,0,0,.86944],66:[0,.68611,.04835,0,.8664],67:[0,.68611,.06979,0,.81694],68:[0,.68611,.03194,0,.93812],69:[0,.68611,.05451,0,.81007],70:[0,.68611,.15972,0,.68889],71:[0,.68611,0,0,.88673],72:[0,.68611,.08229,0,.98229],73:[0,.68611,.07778,0,.51111],74:[0,.68611,.10069,0,.63125],75:[0,.68611,.06979,0,.97118],76:[0,.68611,0,0,.75555],77:[0,.68611,.11424,0,1.14201],78:[0,.68611,.11424,0,.95034],79:[0,.68611,.03194,0,.83666],80:[0,.68611,.15972,0,.72309],81:[.19444,.68611,0,0,.86861],82:[0,.68611,.00421,0,.87235],83:[0,.68611,.05382,0,.69271],84:[0,.68611,.15972,0,.63663],85:[0,.68611,.11424,0,.80027],86:[0,.68611,.25555,0,.67778],87:[0,.68611,.15972,0,1.09305],88:[0,.68611,.07778,0,.94722],89:[0,.68611,.25555,0,.67458],90:[0,.68611,.06979,0,.77257],97:[0,.44444,0,0,.63287],98:[0,.69444,0,0,.52083],99:[0,.44444,0,0,.51342],100:[0,.69444,0,0,.60972],101:[0,.44444,0,0,.55361],102:[.19444,.69444,.11042,0,.56806],103:[.19444,.44444,.03704,0,.5449],104:[0,.69444,0,0,.66759],105:[0,.69326,0,0,.4048],106:[.19444,.69326,.0622,0,.47083],107:[0,.69444,.01852,0,.6037],108:[0,.69444,.0088,0,.34815],109:[0,.44444,0,0,1.0324],110:[0,.44444,0,0,.71296],111:[0,.44444,0,0,.58472],112:[.19444,.44444,0,0,.60092],113:[.19444,.44444,.03704,0,.54213],114:[0,.44444,.03194,0,.5287],115:[0,.44444,0,0,.53125],116:[0,.63492,0,0,.41528],117:[0,.44444,0,0,.68102],118:[0,.44444,.03704,0,.56666],119:[0,.44444,.02778,0,.83148],120:[0,.44444,0,0,.65903],121:[.19444,.44444,.03704,0,.59028],122:[0,.44444,.04213,0,.55509],160:[0,0,0,0,.25],915:[0,.68611,.15972,0,.65694],916:[0,.68611,0,0,.95833],920:[0,.68611,.03194,0,.86722],923:[0,.68611,0,0,.80555],926:[0,.68611,.07458,0,.84125],928:[0,.68611,.08229,0,.98229],931:[0,.68611,.05451,0,.88507],933:[0,.68611,.15972,0,.67083],934:[0,.68611,0,0,.76666],936:[0,.68611,.11653,0,.71402],937:[0,.68611,.04835,0,.8789],945:[0,.44444,0,0,.76064],946:[.19444,.69444,.03403,0,.65972],947:[.19444,.44444,.06389,0,.59003],948:[0,.69444,.03819,0,.52222],949:[0,.44444,0,0,.52882],950:[.19444,.69444,.06215,0,.50833],951:[.19444,.44444,.03704,0,.6],952:[0,.69444,.03194,0,.5618],953:[0,.44444,0,0,.41204],954:[0,.44444,0,0,.66759],955:[0,.69444,0,0,.67083],956:[.19444,.44444,0,0,.70787],957:[0,.44444,.06898,0,.57685],958:[.19444,.69444,.03021,0,.50833],959:[0,.44444,0,0,.58472],960:[0,.44444,.03704,0,.68241],961:[.19444,.44444,0,0,.6118],962:[.09722,.44444,.07917,0,.42361],963:[0,.44444,.03704,0,.68588],964:[0,.44444,.13472,0,.52083],965:[0,.44444,.03704,0,.63055],966:[.19444,.44444,0,0,.74722],967:[.19444,.44444,0,0,.71805],968:[.19444,.69444,.03704,0,.75833],969:[0,.44444,.03704,0,.71782],977:[0,.69444,0,0,.69155],981:[.19444,.69444,0,0,.7125],982:[0,.44444,.03194,0,.975],1009:[.19444,.44444,0,0,.6118],1013:[0,.44444,0,0,.48333],57649:[0,.44444,0,0,.39352],57911:[.19444,.44444,0,0,.43889]},"Math-Italic":{32:[0,0,0,0,.25],48:[0,.43056,0,0,.5],49:[0,.43056,0,0,.5],50:[0,.43056,0,0,.5],51:[.19444,.43056,0,0,.5],52:[.19444,.43056,0,0,.5],53:[.19444,.43056,0,0,.5],54:[0,.64444,0,0,.5],55:[.19444,.43056,0,0,.5],56:[0,.64444,0,0,.5],57:[.19444,.43056,0,0,.5],65:[0,.68333,0,.13889,.75],66:[0,.68333,.05017,.08334,.75851],67:[0,.68333,.07153,.08334,.71472],68:[0,.68333,.02778,.05556,.82792],69:[0,.68333,.05764,.08334,.7382],70:[0,.68333,.13889,.08334,.64306],71:[0,.68333,0,.08334,.78625],72:[0,.68333,.08125,.05556,.83125],73:[0,.68333,.07847,.11111,.43958],74:[0,.68333,.09618,.16667,.55451],75:[0,.68333,.07153,.05556,.84931],76:[0,.68333,0,.02778,.68056],77:[0,.68333,.10903,.08334,.97014],78:[0,.68333,.10903,.08334,.80347],79:[0,.68333,.02778,.08334,.76278],80:[0,.68333,.13889,.08334,.64201],81:[.19444,.68333,0,.08334,.79056],82:[0,.68333,.00773,.08334,.75929],83:[0,.68333,.05764,.08334,.6132],84:[0,.68333,.13889,.08334,.58438],85:[0,.68333,.10903,.02778,.68278],86:[0,.68333,.22222,0,.58333],87:[0,.68333,.13889,0,.94445],88:[0,.68333,.07847,.08334,.82847],89:[0,.68333,.22222,0,.58056],90:[0,.68333,.07153,.08334,.68264],97:[0,.43056,0,0,.52859],98:[0,.69444,0,0,.42917],99:[0,.43056,0,.05556,.43276],100:[0,.69444,0,.16667,.52049],101:[0,.43056,0,.05556,.46563],102:[.19444,.69444,.10764,.16667,.48959],103:[.19444,.43056,.03588,.02778,.47697],104:[0,.69444,0,0,.57616],105:[0,.65952,0,0,.34451],106:[.19444,.65952,.05724,0,.41181],107:[0,.69444,.03148,0,.5206],108:[0,.69444,.01968,.08334,.29838],109:[0,.43056,0,0,.87801],110:[0,.43056,0,0,.60023],111:[0,.43056,0,.05556,.48472],112:[.19444,.43056,0,.08334,.50313],113:[.19444,.43056,.03588,.08334,.44641],114:[0,.43056,.02778,.05556,.45116],115:[0,.43056,0,.05556,.46875],116:[0,.61508,0,.08334,.36111],117:[0,.43056,0,.02778,.57246],118:[0,.43056,.03588,.02778,.48472],119:[0,.43056,.02691,.08334,.71592],120:[0,.43056,0,.02778,.57153],121:[.19444,.43056,.03588,.05556,.49028],122:[0,.43056,.04398,.05556,.46505],160:[0,0,0,0,.25],915:[0,.68333,.13889,.08334,.61528],916:[0,.68333,0,.16667,.83334],920:[0,.68333,.02778,.08334,.76278],923:[0,.68333,0,.16667,.69445],926:[0,.68333,.07569,.08334,.74236],928:[0,.68333,.08125,.05556,.83125],931:[0,.68333,.05764,.08334,.77986],933:[0,.68333,.13889,.05556,.58333],934:[0,.68333,0,.08334,.66667],936:[0,.68333,.11,.05556,.61222],937:[0,.68333,.05017,.08334,.7724],945:[0,.43056,.0037,.02778,.6397],946:[.19444,.69444,.05278,.08334,.56563],947:[.19444,.43056,.05556,0,.51773],948:[0,.69444,.03785,.05556,.44444],949:[0,.43056,0,.08334,.46632],950:[.19444,.69444,.07378,.08334,.4375],951:[.19444,.43056,.03588,.05556,.49653],952:[0,.69444,.02778,.08334,.46944],953:[0,.43056,0,.05556,.35394],954:[0,.43056,0,0,.57616],955:[0,.69444,0,0,.58334],956:[.19444,.43056,0,.02778,.60255],957:[0,.43056,.06366,.02778,.49398],958:[.19444,.69444,.04601,.11111,.4375],959:[0,.43056,0,.05556,.48472],960:[0,.43056,.03588,0,.57003],961:[.19444,.43056,0,.08334,.51702],962:[.09722,.43056,.07986,.08334,.36285],963:[0,.43056,.03588,0,.57141],964:[0,.43056,.1132,.02778,.43715],965:[0,.43056,.03588,.02778,.54028],966:[.19444,.43056,0,.08334,.65417],967:[.19444,.43056,0,.05556,.62569],968:[.19444,.69444,.03588,.11111,.65139],969:[0,.43056,.03588,0,.62245],977:[0,.69444,0,.08334,.59144],981:[.19444,.69444,0,.08334,.59583],982:[0,.43056,.02778,0,.82813],1009:[.19444,.43056,0,.08334,.51702],1013:[0,.43056,0,.05556,.4059],57649:[0,.43056,0,.02778,.32246],57911:[.19444,.43056,0,.08334,.38403]},"SansSerif-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.36667],34:[0,.69444,0,0,.55834],35:[.19444,.69444,0,0,.91667],36:[.05556,.75,0,0,.55],37:[.05556,.75,0,0,1.02912],38:[0,.69444,0,0,.83056],39:[0,.69444,0,0,.30556],40:[.25,.75,0,0,.42778],41:[.25,.75,0,0,.42778],42:[0,.75,0,0,.55],43:[.11667,.61667,0,0,.85556],44:[.10556,.13056,0,0,.30556],45:[0,.45833,0,0,.36667],46:[0,.13056,0,0,.30556],47:[.25,.75,0,0,.55],48:[0,.69444,0,0,.55],49:[0,.69444,0,0,.55],50:[0,.69444,0,0,.55],51:[0,.69444,0,0,.55],52:[0,.69444,0,0,.55],53:[0,.69444,0,0,.55],54:[0,.69444,0,0,.55],55:[0,.69444,0,0,.55],56:[0,.69444,0,0,.55],57:[0,.69444,0,0,.55],58:[0,.45833,0,0,.30556],59:[.10556,.45833,0,0,.30556],61:[-.09375,.40625,0,0,.85556],63:[0,.69444,0,0,.51945],64:[0,.69444,0,0,.73334],65:[0,.69444,0,0,.73334],66:[0,.69444,0,0,.73334],67:[0,.69444,0,0,.70278],68:[0,.69444,0,0,.79445],69:[0,.69444,0,0,.64167],70:[0,.69444,0,0,.61111],71:[0,.69444,0,0,.73334],72:[0,.69444,0,0,.79445],73:[0,.69444,0,0,.33056],74:[0,.69444,0,0,.51945],75:[0,.69444,0,0,.76389],76:[0,.69444,0,0,.58056],77:[0,.69444,0,0,.97778],78:[0,.69444,0,0,.79445],79:[0,.69444,0,0,.79445],80:[0,.69444,0,0,.70278],81:[.10556,.69444,0,0,.79445],82:[0,.69444,0,0,.70278],83:[0,.69444,0,0,.61111],84:[0,.69444,0,0,.73334],85:[0,.69444,0,0,.76389],86:[0,.69444,.01528,0,.73334],87:[0,.69444,.01528,0,1.03889],88:[0,.69444,0,0,.73334],89:[0,.69444,.0275,0,.73334],90:[0,.69444,0,0,.67223],91:[.25,.75,0,0,.34306],93:[.25,.75,0,0,.34306],94:[0,.69444,0,0,.55],95:[.35,.10833,.03056,0,.55],97:[0,.45833,0,0,.525],98:[0,.69444,0,0,.56111],99:[0,.45833,0,0,.48889],100:[0,.69444,0,0,.56111],101:[0,.45833,0,0,.51111],102:[0,.69444,.07639,0,.33611],103:[.19444,.45833,.01528,0,.55],104:[0,.69444,0,0,.56111],105:[0,.69444,0,0,.25556],106:[.19444,.69444,0,0,.28611],107:[0,.69444,0,0,.53056],108:[0,.69444,0,0,.25556],109:[0,.45833,0,0,.86667],110:[0,.45833,0,0,.56111],111:[0,.45833,0,0,.55],112:[.19444,.45833,0,0,.56111],113:[.19444,.45833,0,0,.56111],114:[0,.45833,.01528,0,.37222],115:[0,.45833,0,0,.42167],116:[0,.58929,0,0,.40417],117:[0,.45833,0,0,.56111],118:[0,.45833,.01528,0,.5],119:[0,.45833,.01528,0,.74445],120:[0,.45833,0,0,.5],121:[.19444,.45833,.01528,0,.5],122:[0,.45833,0,0,.47639],126:[.35,.34444,0,0,.55],160:[0,0,0,0,.25],168:[0,.69444,0,0,.55],176:[0,.69444,0,0,.73334],180:[0,.69444,0,0,.55],184:[.17014,0,0,0,.48889],305:[0,.45833,0,0,.25556],567:[.19444,.45833,0,0,.28611],710:[0,.69444,0,0,.55],711:[0,.63542,0,0,.55],713:[0,.63778,0,0,.55],728:[0,.69444,0,0,.55],729:[0,.69444,0,0,.30556],730:[0,.69444,0,0,.73334],732:[0,.69444,0,0,.55],733:[0,.69444,0,0,.55],915:[0,.69444,0,0,.58056],916:[0,.69444,0,0,.91667],920:[0,.69444,0,0,.85556],923:[0,.69444,0,0,.67223],926:[0,.69444,0,0,.73334],928:[0,.69444,0,0,.79445],931:[0,.69444,0,0,.79445],933:[0,.69444,0,0,.85556],934:[0,.69444,0,0,.79445],936:[0,.69444,0,0,.85556],937:[0,.69444,0,0,.79445],8211:[0,.45833,.03056,0,.55],8212:[0,.45833,.03056,0,1.10001],8216:[0,.69444,0,0,.30556],8217:[0,.69444,0,0,.30556],8220:[0,.69444,0,0,.55834],8221:[0,.69444,0,0,.55834]},"SansSerif-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.05733,0,.31945],34:[0,.69444,.00316,0,.5],35:[.19444,.69444,.05087,0,.83334],36:[.05556,.75,.11156,0,.5],37:[.05556,.75,.03126,0,.83334],38:[0,.69444,.03058,0,.75834],39:[0,.69444,.07816,0,.27778],40:[.25,.75,.13164,0,.38889],41:[.25,.75,.02536,0,.38889],42:[0,.75,.11775,0,.5],43:[.08333,.58333,.02536,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,.01946,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,.13164,0,.5],48:[0,.65556,.11156,0,.5],49:[0,.65556,.11156,0,.5],50:[0,.65556,.11156,0,.5],51:[0,.65556,.11156,0,.5],52:[0,.65556,.11156,0,.5],53:[0,.65556,.11156,0,.5],54:[0,.65556,.11156,0,.5],55:[0,.65556,.11156,0,.5],56:[0,.65556,.11156,0,.5],57:[0,.65556,.11156,0,.5],58:[0,.44444,.02502,0,.27778],59:[.125,.44444,.02502,0,.27778],61:[-.13,.37,.05087,0,.77778],63:[0,.69444,.11809,0,.47222],64:[0,.69444,.07555,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,.08293,0,.66667],67:[0,.69444,.11983,0,.63889],68:[0,.69444,.07555,0,.72223],69:[0,.69444,.11983,0,.59722],70:[0,.69444,.13372,0,.56945],71:[0,.69444,.11983,0,.66667],72:[0,.69444,.08094,0,.70834],73:[0,.69444,.13372,0,.27778],74:[0,.69444,.08094,0,.47222],75:[0,.69444,.11983,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,.08094,0,.875],78:[0,.69444,.08094,0,.70834],79:[0,.69444,.07555,0,.73611],80:[0,.69444,.08293,0,.63889],81:[.125,.69444,.07555,0,.73611],82:[0,.69444,.08293,0,.64584],83:[0,.69444,.09205,0,.55556],84:[0,.69444,.13372,0,.68056],85:[0,.69444,.08094,0,.6875],86:[0,.69444,.1615,0,.66667],87:[0,.69444,.1615,0,.94445],88:[0,.69444,.13372,0,.66667],89:[0,.69444,.17261,0,.66667],90:[0,.69444,.11983,0,.61111],91:[.25,.75,.15942,0,.28889],93:[.25,.75,.08719,0,.28889],94:[0,.69444,.0799,0,.5],95:[.35,.09444,.08616,0,.5],97:[0,.44444,.00981,0,.48056],98:[0,.69444,.03057,0,.51667],99:[0,.44444,.08336,0,.44445],100:[0,.69444,.09483,0,.51667],101:[0,.44444,.06778,0,.44445],102:[0,.69444,.21705,0,.30556],103:[.19444,.44444,.10836,0,.5],104:[0,.69444,.01778,0,.51667],105:[0,.67937,.09718,0,.23889],106:[.19444,.67937,.09162,0,.26667],107:[0,.69444,.08336,0,.48889],108:[0,.69444,.09483,0,.23889],109:[0,.44444,.01778,0,.79445],110:[0,.44444,.01778,0,.51667],111:[0,.44444,.06613,0,.5],112:[.19444,.44444,.0389,0,.51667],113:[.19444,.44444,.04169,0,.51667],114:[0,.44444,.10836,0,.34167],115:[0,.44444,.0778,0,.38333],116:[0,.57143,.07225,0,.36111],117:[0,.44444,.04169,0,.51667],118:[0,.44444,.10836,0,.46111],119:[0,.44444,.10836,0,.68334],120:[0,.44444,.09169,0,.46111],121:[.19444,.44444,.10836,0,.46111],122:[0,.44444,.08752,0,.43472],126:[.35,.32659,.08826,0,.5],160:[0,0,0,0,.25],168:[0,.67937,.06385,0,.5],176:[0,.69444,0,0,.73752],184:[.17014,0,0,0,.44445],305:[0,.44444,.04169,0,.23889],567:[.19444,.44444,.04169,0,.26667],710:[0,.69444,.0799,0,.5],711:[0,.63194,.08432,0,.5],713:[0,.60889,.08776,0,.5],714:[0,.69444,.09205,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,.09483,0,.5],729:[0,.67937,.07774,0,.27778],730:[0,.69444,0,0,.73752],732:[0,.67659,.08826,0,.5],733:[0,.69444,.09205,0,.5],915:[0,.69444,.13372,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,.07555,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,.12816,0,.66667],928:[0,.69444,.08094,0,.70834],931:[0,.69444,.11983,0,.72222],933:[0,.69444,.09031,0,.77778],934:[0,.69444,.04603,0,.72222],936:[0,.69444,.09031,0,.77778],937:[0,.69444,.08293,0,.72222],8211:[0,.44444,.08616,0,.5],8212:[0,.44444,.08616,0,1],8216:[0,.69444,.07816,0,.27778],8217:[0,.69444,.07816,0,.27778],8220:[0,.69444,.14205,0,.5],8221:[0,.69444,.00316,0,.5]},"SansSerif-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.31945],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.75834],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,0,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.65556,0,0,.5],49:[0,.65556,0,0,.5],50:[0,.65556,0,0,.5],51:[0,.65556,0,0,.5],52:[0,.65556,0,0,.5],53:[0,.65556,0,0,.5],54:[0,.65556,0,0,.5],55:[0,.65556,0,0,.5],56:[0,.65556,0,0,.5],57:[0,.65556,0,0,.5],58:[0,.44444,0,0,.27778],59:[.125,.44444,0,0,.27778],61:[-.13,.37,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,0,0,.66667],67:[0,.69444,0,0,.63889],68:[0,.69444,0,0,.72223],69:[0,.69444,0,0,.59722],70:[0,.69444,0,0,.56945],71:[0,.69444,0,0,.66667],72:[0,.69444,0,0,.70834],73:[0,.69444,0,0,.27778],74:[0,.69444,0,0,.47222],75:[0,.69444,0,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,0,0,.875],78:[0,.69444,0,0,.70834],79:[0,.69444,0,0,.73611],80:[0,.69444,0,0,.63889],81:[.125,.69444,0,0,.73611],82:[0,.69444,0,0,.64584],83:[0,.69444,0,0,.55556],84:[0,.69444,0,0,.68056],85:[0,.69444,0,0,.6875],86:[0,.69444,.01389,0,.66667],87:[0,.69444,.01389,0,.94445],88:[0,.69444,0,0,.66667],89:[0,.69444,.025,0,.66667],90:[0,.69444,0,0,.61111],91:[.25,.75,0,0,.28889],93:[.25,.75,0,0,.28889],94:[0,.69444,0,0,.5],95:[.35,.09444,.02778,0,.5],97:[0,.44444,0,0,.48056],98:[0,.69444,0,0,.51667],99:[0,.44444,0,0,.44445],100:[0,.69444,0,0,.51667],101:[0,.44444,0,0,.44445],102:[0,.69444,.06944,0,.30556],103:[.19444,.44444,.01389,0,.5],104:[0,.69444,0,0,.51667],105:[0,.67937,0,0,.23889],106:[.19444,.67937,0,0,.26667],107:[0,.69444,0,0,.48889],108:[0,.69444,0,0,.23889],109:[0,.44444,0,0,.79445],110:[0,.44444,0,0,.51667],111:[0,.44444,0,0,.5],112:[.19444,.44444,0,0,.51667],113:[.19444,.44444,0,0,.51667],114:[0,.44444,.01389,0,.34167],115:[0,.44444,0,0,.38333],116:[0,.57143,0,0,.36111],117:[0,.44444,0,0,.51667],118:[0,.44444,.01389,0,.46111],119:[0,.44444,.01389,0,.68334],120:[0,.44444,0,0,.46111],121:[.19444,.44444,.01389,0,.46111],122:[0,.44444,0,0,.43472],126:[.35,.32659,0,0,.5],160:[0,0,0,0,.25],168:[0,.67937,0,0,.5],176:[0,.69444,0,0,.66667],184:[.17014,0,0,0,.44445],305:[0,.44444,0,0,.23889],567:[.19444,.44444,0,0,.26667],710:[0,.69444,0,0,.5],711:[0,.63194,0,0,.5],713:[0,.60889,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.67937,0,0,.27778],730:[0,.69444,0,0,.66667],732:[0,.67659,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.69444,0,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,0,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,0,0,.66667],928:[0,.69444,0,0,.70834],931:[0,.69444,0,0,.72222],933:[0,.69444,0,0,.77778],934:[0,.69444,0,0,.72222],936:[0,.69444,0,0,.77778],937:[0,.69444,0,0,.72222],8211:[0,.44444,.02778,0,.5],8212:[0,.44444,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5]},"Script-Regular":{32:[0,0,0,0,.25],65:[0,.7,.22925,0,.80253],66:[0,.7,.04087,0,.90757],67:[0,.7,.1689,0,.66619],68:[0,.7,.09371,0,.77443],69:[0,.7,.18583,0,.56162],70:[0,.7,.13634,0,.89544],71:[0,.7,.17322,0,.60961],72:[0,.7,.29694,0,.96919],73:[0,.7,.19189,0,.80907],74:[.27778,.7,.19189,0,1.05159],75:[0,.7,.31259,0,.91364],76:[0,.7,.19189,0,.87373],77:[0,.7,.15981,0,1.08031],78:[0,.7,.3525,0,.9015],79:[0,.7,.08078,0,.73787],80:[0,.7,.08078,0,1.01262],81:[0,.7,.03305,0,.88282],82:[0,.7,.06259,0,.85],83:[0,.7,.19189,0,.86767],84:[0,.7,.29087,0,.74697],85:[0,.7,.25815,0,.79996],86:[0,.7,.27523,0,.62204],87:[0,.7,.27523,0,.80532],88:[0,.7,.26006,0,.94445],89:[0,.7,.2939,0,.70961],90:[0,.7,.24037,0,.8212],160:[0,0,0,0,.25]},"Size1-Regular":{32:[0,0,0,0,.25],40:[.35001,.85,0,0,.45834],41:[.35001,.85,0,0,.45834],47:[.35001,.85,0,0,.57778],91:[.35001,.85,0,0,.41667],92:[.35001,.85,0,0,.57778],93:[.35001,.85,0,0,.41667],123:[.35001,.85,0,0,.58334],125:[.35001,.85,0,0,.58334],160:[0,0,0,0,.25],710:[0,.72222,0,0,.55556],732:[0,.72222,0,0,.55556],770:[0,.72222,0,0,.55556],771:[0,.72222,0,0,.55556],8214:[-99e-5,.601,0,0,.77778],8593:[1e-5,.6,0,0,.66667],8595:[1e-5,.6,0,0,.66667],8657:[1e-5,.6,0,0,.77778],8659:[1e-5,.6,0,0,.77778],8719:[.25001,.75,0,0,.94445],8720:[.25001,.75,0,0,.94445],8721:[.25001,.75,0,0,1.05556],8730:[.35001,.85,0,0,1],8739:[-.00599,.606,0,0,.33333],8741:[-.00599,.606,0,0,.55556],8747:[.30612,.805,.19445,0,.47222],8748:[.306,.805,.19445,0,.47222],8749:[.306,.805,.19445,0,.47222],8750:[.30612,.805,.19445,0,.47222],8896:[.25001,.75,0,0,.83334],8897:[.25001,.75,0,0,.83334],8898:[.25001,.75,0,0,.83334],8899:[.25001,.75,0,0,.83334],8968:[.35001,.85,0,0,.47222],8969:[.35001,.85,0,0,.47222],8970:[.35001,.85,0,0,.47222],8971:[.35001,.85,0,0,.47222],9168:[-99e-5,.601,0,0,.66667],10216:[.35001,.85,0,0,.47222],10217:[.35001,.85,0,0,.47222],10752:[.25001,.75,0,0,1.11111],10753:[.25001,.75,0,0,1.11111],10754:[.25001,.75,0,0,1.11111],10756:[.25001,.75,0,0,.83334],10758:[.25001,.75,0,0,.83334]},"Size2-Regular":{32:[0,0,0,0,.25],40:[.65002,1.15,0,0,.59722],41:[.65002,1.15,0,0,.59722],47:[.65002,1.15,0,0,.81111],91:[.65002,1.15,0,0,.47222],92:[.65002,1.15,0,0,.81111],93:[.65002,1.15,0,0,.47222],123:[.65002,1.15,0,0,.66667],125:[.65002,1.15,0,0,.66667],160:[0,0,0,0,.25],710:[0,.75,0,0,1],732:[0,.75,0,0,1],770:[0,.75,0,0,1],771:[0,.75,0,0,1],8719:[.55001,1.05,0,0,1.27778],8720:[.55001,1.05,0,0,1.27778],8721:[.55001,1.05,0,0,1.44445],8730:[.65002,1.15,0,0,1],8747:[.86225,1.36,.44445,0,.55556],8748:[.862,1.36,.44445,0,.55556],8749:[.862,1.36,.44445,0,.55556],8750:[.86225,1.36,.44445,0,.55556],8896:[.55001,1.05,0,0,1.11111],8897:[.55001,1.05,0,0,1.11111],8898:[.55001,1.05,0,0,1.11111],8899:[.55001,1.05,0,0,1.11111],8968:[.65002,1.15,0,0,.52778],8969:[.65002,1.15,0,0,.52778],8970:[.65002,1.15,0,0,.52778],8971:[.65002,1.15,0,0,.52778],10216:[.65002,1.15,0,0,.61111],10217:[.65002,1.15,0,0,.61111],10752:[.55001,1.05,0,0,1.51112],10753:[.55001,1.05,0,0,1.51112],10754:[.55001,1.05,0,0,1.51112],10756:[.55001,1.05,0,0,1.11111],10758:[.55001,1.05,0,0,1.11111]},"Size3-Regular":{32:[0,0,0,0,.25],40:[.95003,1.45,0,0,.73611],41:[.95003,1.45,0,0,.73611],47:[.95003,1.45,0,0,1.04445],91:[.95003,1.45,0,0,.52778],92:[.95003,1.45,0,0,1.04445],93:[.95003,1.45,0,0,.52778],123:[.95003,1.45,0,0,.75],125:[.95003,1.45,0,0,.75],160:[0,0,0,0,.25],710:[0,.75,0,0,1.44445],732:[0,.75,0,0,1.44445],770:[0,.75,0,0,1.44445],771:[0,.75,0,0,1.44445],8730:[.95003,1.45,0,0,1],8968:[.95003,1.45,0,0,.58334],8969:[.95003,1.45,0,0,.58334],8970:[.95003,1.45,0,0,.58334],8971:[.95003,1.45,0,0,.58334],10216:[.95003,1.45,0,0,.75],10217:[.95003,1.45,0,0,.75]},"Size4-Regular":{32:[0,0,0,0,.25],40:[1.25003,1.75,0,0,.79167],41:[1.25003,1.75,0,0,.79167],47:[1.25003,1.75,0,0,1.27778],91:[1.25003,1.75,0,0,.58334],92:[1.25003,1.75,0,0,1.27778],93:[1.25003,1.75,0,0,.58334],123:[1.25003,1.75,0,0,.80556],125:[1.25003,1.75,0,0,.80556],160:[0,0,0,0,.25],710:[0,.825,0,0,1.8889],732:[0,.825,0,0,1.8889],770:[0,.825,0,0,1.8889],771:[0,.825,0,0,1.8889],8730:[1.25003,1.75,0,0,1],8968:[1.25003,1.75,0,0,.63889],8969:[1.25003,1.75,0,0,.63889],8970:[1.25003,1.75,0,0,.63889],8971:[1.25003,1.75,0,0,.63889],9115:[.64502,1.155,0,0,.875],9116:[1e-5,.6,0,0,.875],9117:[.64502,1.155,0,0,.875],9118:[.64502,1.155,0,0,.875],9119:[1e-5,.6,0,0,.875],9120:[.64502,1.155,0,0,.875],9121:[.64502,1.155,0,0,.66667],9122:[-99e-5,.601,0,0,.66667],9123:[.64502,1.155,0,0,.66667],9124:[.64502,1.155,0,0,.66667],9125:[-99e-5,.601,0,0,.66667],9126:[.64502,1.155,0,0,.66667],9127:[1e-5,.9,0,0,.88889],9128:[.65002,1.15,0,0,.88889],9129:[.90001,0,0,0,.88889],9130:[0,.3,0,0,.88889],9131:[1e-5,.9,0,0,.88889],9132:[.65002,1.15,0,0,.88889],9133:[.90001,0,0,0,.88889],9143:[.88502,.915,0,0,1.05556],10216:[1.25003,1.75,0,0,.80556],10217:[1.25003,1.75,0,0,.80556],57344:[-.00499,.605,0,0,1.05556],57345:[-.00499,.605,0,0,1.05556],57680:[0,.12,0,0,.45],57681:[0,.12,0,0,.45],57682:[0,.12,0,0,.45],57683:[0,.12,0,0,.45]},"Typewriter-Regular":{32:[0,0,0,0,.525],33:[0,.61111,0,0,.525],34:[0,.61111,0,0,.525],35:[0,.61111,0,0,.525],36:[.08333,.69444,0,0,.525],37:[.08333,.69444,0,0,.525],38:[0,.61111,0,0,.525],39:[0,.61111,0,0,.525],40:[.08333,.69444,0,0,.525],41:[.08333,.69444,0,0,.525],42:[0,.52083,0,0,.525],43:[-.08056,.53055,0,0,.525],44:[.13889,.125,0,0,.525],45:[-.08056,.53055,0,0,.525],46:[0,.125,0,0,.525],47:[.08333,.69444,0,0,.525],48:[0,.61111,0,0,.525],49:[0,.61111,0,0,.525],50:[0,.61111,0,0,.525],51:[0,.61111,0,0,.525],52:[0,.61111,0,0,.525],53:[0,.61111,0,0,.525],54:[0,.61111,0,0,.525],55:[0,.61111,0,0,.525],56:[0,.61111,0,0,.525],57:[0,.61111,0,0,.525],58:[0,.43056,0,0,.525],59:[.13889,.43056,0,0,.525],60:[-.05556,.55556,0,0,.525],61:[-.19549,.41562,0,0,.525],62:[-.05556,.55556,0,0,.525],63:[0,.61111,0,0,.525],64:[0,.61111,0,0,.525],65:[0,.61111,0,0,.525],66:[0,.61111,0,0,.525],67:[0,.61111,0,0,.525],68:[0,.61111,0,0,.525],69:[0,.61111,0,0,.525],70:[0,.61111,0,0,.525],71:[0,.61111,0,0,.525],72:[0,.61111,0,0,.525],73:[0,.61111,0,0,.525],74:[0,.61111,0,0,.525],75:[0,.61111,0,0,.525],76:[0,.61111,0,0,.525],77:[0,.61111,0,0,.525],78:[0,.61111,0,0,.525],79:[0,.61111,0,0,.525],80:[0,.61111,0,0,.525],81:[.13889,.61111,0,0,.525],82:[0,.61111,0,0,.525],83:[0,.61111,0,0,.525],84:[0,.61111,0,0,.525],85:[0,.61111,0,0,.525],86:[0,.61111,0,0,.525],87:[0,.61111,0,0,.525],88:[0,.61111,0,0,.525],89:[0,.61111,0,0,.525],90:[0,.61111,0,0,.525],91:[.08333,.69444,0,0,.525],92:[.08333,.69444,0,0,.525],93:[.08333,.69444,0,0,.525],94:[0,.61111,0,0,.525],95:[.09514,0,0,0,.525],96:[0,.61111,0,0,.525],97:[0,.43056,0,0,.525],98:[0,.61111,0,0,.525],99:[0,.43056,0,0,.525],100:[0,.61111,0,0,.525],101:[0,.43056,0,0,.525],102:[0,.61111,0,0,.525],103:[.22222,.43056,0,0,.525],104:[0,.61111,0,0,.525],105:[0,.61111,0,0,.525],106:[.22222,.61111,0,0,.525],107:[0,.61111,0,0,.525],108:[0,.61111,0,0,.525],109:[0,.43056,0,0,.525],110:[0,.43056,0,0,.525],111:[0,.43056,0,0,.525],112:[.22222,.43056,0,0,.525],113:[.22222,.43056,0,0,.525],114:[0,.43056,0,0,.525],115:[0,.43056,0,0,.525],116:[0,.55358,0,0,.525],117:[0,.43056,0,0,.525],118:[0,.43056,0,0,.525],119:[0,.43056,0,0,.525],120:[0,.43056,0,0,.525],121:[.22222,.43056,0,0,.525],122:[0,.43056,0,0,.525],123:[.08333,.69444,0,0,.525],124:[.08333,.69444,0,0,.525],125:[.08333,.69444,0,0,.525],126:[0,.61111,0,0,.525],127:[0,.61111,0,0,.525],160:[0,0,0,0,.525],176:[0,.61111,0,0,.525],184:[.19445,0,0,0,.525],305:[0,.43056,0,0,.525],567:[.22222,.43056,0,0,.525],711:[0,.56597,0,0,.525],713:[0,.56555,0,0,.525],714:[0,.61111,0,0,.525],715:[0,.61111,0,0,.525],728:[0,.61111,0,0,.525],730:[0,.61111,0,0,.525],770:[0,.61111,0,0,.525],771:[0,.61111,0,0,.525],776:[0,.61111,0,0,.525],915:[0,.61111,0,0,.525],916:[0,.61111,0,0,.525],920:[0,.61111,0,0,.525],923:[0,.61111,0,0,.525],926:[0,.61111,0,0,.525],928:[0,.61111,0,0,.525],931:[0,.61111,0,0,.525],933:[0,.61111,0,0,.525],934:[0,.61111,0,0,.525],936:[0,.61111,0,0,.525],937:[0,.61111,0,0,.525],8216:[0,.61111,0,0,.525],8217:[0,.61111,0,0,.525],8242:[0,.61111,0,0,.525],9251:[.11111,.21944,0,0,.525]}},Ex={slant:[.25,.25,.25],space:[0,0,0],stretch:[0,0,0],shrink:[0,0,0],xHeight:[.431,.431,.431],quad:[1,1.171,1.472],extraSpace:[0,0,0],num1:[.677,.732,.925],num2:[.394,.384,.387],num3:[.444,.471,.504],denom1:[.686,.752,1.025],denom2:[.345,.344,.532],sup1:[.413,.503,.504],sup2:[.363,.431,.404],sup3:[.289,.286,.294],sub1:[.15,.143,.2],sub2:[.247,.286,.4],supDrop:[.386,.353,.494],subDrop:[.05,.071,.1],delim1:[2.39,1.7,1.98],delim2:[1.01,1.157,1.42],axisHeight:[.25,.25,.25],defaultRuleThickness:[.04,.049,.049],bigOpSpacing1:[.111,.111,.111],bigOpSpacing2:[.166,.166,.166],bigOpSpacing3:[.2,.2,.2],bigOpSpacing4:[.6,.611,.611],bigOpSpacing5:[.1,.143,.143],sqrtRuleThickness:[.04,.04,.04],ptPerEm:[10,10,10],doubleRuleSep:[.2,.2,.2],arrayRuleWidth:[.04,.04,.04],fboxsep:[.3,.3,.3],fboxrule:[.04,.04,.04]},K_={Å:"A",Ð:"D",Þ:"o",å:"a",ð:"d",þ:"o",А:"A",Б:"B",В:"B",Г:"F",Д:"A",Е:"E",Ж:"K",З:"3",И:"N",Й:"N",К:"K",Л:"N",М:"M",Н:"H",О:"O",П:"N",Р:"P",С:"C",Т:"T",У:"y",Ф:"O",Х:"X",Ц:"U",Ч:"h",Ш:"W",Щ:"W",Ъ:"B",Ы:"X",Ь:"B",Э:"3",Ю:"X",Я:"R",а:"a",б:"b",в:"a",г:"r",д:"y",е:"e",ж:"m",з:"e",и:"n",й:"n",к:"n",л:"n",м:"m",н:"n",о:"o",п:"n",р:"p",с:"c",т:"o",у:"y",ф:"b",х:"x",ц:"n",ч:"n",ш:"w",щ:"w",ъ:"a",ы:"m",ь:"a",э:"e",ю:"m",я:"r"};function cbe(t,e){il[t]=e}function Uj(t,e,n){if(!il[e])throw new Error("Font metrics not found for font: "+e+".");var r=t.charCodeAt(0),s=il[e][r];if(!s&&t[0]in K_&&(r=K_[t[0]].charCodeAt(0),s=il[e][r]),!s&&n==="text"&&Y$(r)&&(s=il[e][77]),s)return{depth:s[0],height:s[1],italic:s[2],skew:s[3],width:s[4]}}var k4={};function ube(t){var e;if(t>=5?e=0:t>=3?e=1:e=2,!k4[e]){var n=k4[e]={cssEmPerMu:Ex.quad[e]/18};for(var r in Ex)Ex.hasOwnProperty(r)&&(n[r]=Ex[r][e])}return k4[e]}var dbe=[[1,1,1],[2,1,1],[3,1,1],[4,2,1],[5,2,1],[6,3,1],[7,4,2],[8,6,3],[9,7,6],[10,8,7],[11,10,9]],Z_=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],J_=function(e,n){return n.size<2?e:dbe[e-1][n.size-1]};class to{constructor(e){this.style=void 0,this.color=void 0,this.size=void 0,this.textSize=void 0,this.phantom=void 0,this.font=void 0,this.fontFamily=void 0,this.fontWeight=void 0,this.fontShape=void 0,this.sizeMultiplier=void 0,this.maxSize=void 0,this.minRuleThickness=void 0,this._fontMetrics=void 0,this.style=e.style,this.color=e.color,this.size=e.size||to.BASESIZE,this.textSize=e.textSize||this.size,this.phantom=!!e.phantom,this.font=e.font||"",this.fontFamily=e.fontFamily||"",this.fontWeight=e.fontWeight||"",this.fontShape=e.fontShape||"",this.sizeMultiplier=Z_[this.size-1],this.maxSize=e.maxSize,this.minRuleThickness=e.minRuleThickness,this._fontMetrics=void 0}extend(e){var n={style:this.style,size:this.size,textSize:this.textSize,color:this.color,phantom:this.phantom,font:this.font,fontFamily:this.fontFamily,fontWeight:this.fontWeight,fontShape:this.fontShape,maxSize:this.maxSize,minRuleThickness:this.minRuleThickness};for(var r in e)e.hasOwnProperty(r)&&(n[r]=e[r]);return new to(n)}havingStyle(e){return this.style===e?this:this.extend({style:e,size:J_(this.textSize,e)})}havingCrampedStyle(){return this.havingStyle(this.style.cramp())}havingSize(e){return this.size===e&&this.textSize===e?this:this.extend({style:this.style.text(),size:e,textSize:e,sizeMultiplier:Z_[e-1]})}havingBaseStyle(e){e=e||this.style.text();var n=J_(to.BASESIZE,e);return this.size===n&&this.textSize===to.BASESIZE&&this.style===e?this:this.extend({style:e,size:n})}havingBaseSizing(){var e;switch(this.style.id){case 4:case 5:e=3;break;case 6:case 7:e=1;break;default:e=6}return this.extend({style:this.style.text(),size:e})}withColor(e){return this.extend({color:e})}withPhantom(){return this.extend({phantom:!0})}withFont(e){return this.extend({font:e})}withTextFontFamily(e){return this.extend({fontFamily:e,font:""})}withTextFontWeight(e){return this.extend({fontWeight:e,font:""})}withTextFontShape(e){return this.extend({fontShape:e,font:""})}sizingClasses(e){return e.size!==this.size?["sizing","reset-size"+e.size,"size"+this.size]:[]}baseSizingClasses(){return this.size!==to.BASESIZE?["sizing","reset-size"+this.size,"size"+to.BASESIZE]:[]}fontMetrics(){return this._fontMetrics||(this._fontMetrics=ube(this.size)),this._fontMetrics}getColor(){return this.phantom?"transparent":this.color}}to.BASESIZE=6;var dk={pt:1,mm:7227/2540,cm:7227/254,in:72.27,bp:803/800,pc:12,dd:1238/1157,cc:14856/1157,nd:685/642,nc:1370/107,sp:1/65536,px:803/800},hbe={ex:!0,em:!0,mu:!0},K$=function(e){return typeof e!="string"&&(e=e.unit),e in dk||e in hbe||e==="ex"},gr=function(e,n){var r;if(e.unit in dk)r=dk[e.unit]/n.fontMetrics().ptPerEm/n.sizeMultiplier;else if(e.unit==="mu")r=n.fontMetrics().cssEmPerMu;else{var s;if(n.style.isTight()?s=n.havingStyle(n.style.text()):s=n,e.unit==="ex")r=s.fontMetrics().xHeight;else if(e.unit==="em")r=s.fontMetrics().quad;else throw new $e("Invalid unit: '"+e.unit+"'");s!==n&&(r*=s.sizeMultiplier/n.sizeMultiplier)}return Math.min(e.number*r,n.maxSize)},We=function(e){return+e.toFixed(4)+"em"},Oc=function(e){return e.filter(n=>n).join(" ")},Z$=function(e,n,r){if(this.classes=e||[],this.attributes={},this.height=0,this.depth=0,this.maxFontSize=0,this.style=r||{},n){n.style.isTight()&&this.classes.push("mtight");var s=n.getColor();s&&(this.style.color=s)}},J$=function(e){var n=document.createElement(e);n.className=Oc(this.classes);for(var r in this.style)this.style.hasOwnProperty(r)&&(n.style[r]=this.style[r]);for(var s in this.attributes)this.attributes.hasOwnProperty(s)&&n.setAttribute(s,this.attributes[s]);for(var i=0;i/=\x00-\x1f]/,eQ=function(e){var n="<"+e;this.classes.length&&(n+=' class="'+Mn.escape(Oc(this.classes))+'"');var r="";for(var s in this.style)this.style.hasOwnProperty(s)&&(r+=Mn.hyphenate(s)+":"+this.style[s]+";");r&&(n+=' style="'+Mn.escape(r)+'"');for(var i in this.attributes)if(this.attributes.hasOwnProperty(i)){if(fbe.test(i))throw new $e("Invalid attribute name '"+i+"'");n+=" "+i+'="'+Mn.escape(this.attributes[i])+'"'}n+=">";for(var a=0;a",n};class mp{constructor(e,n,r,s){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.width=void 0,this.maxFontSize=void 0,this.style=void 0,Z$.call(this,e,r,s),this.children=n||[]}setAttribute(e,n){this.attributes[e]=n}hasClass(e){return this.classes.includes(e)}toNode(){return J$.call(this,"span")}toMarkup(){return eQ.call(this,"span")}}class Wj{constructor(e,n,r,s){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,Z$.call(this,n,s),this.children=r||[],this.setAttribute("href",e)}setAttribute(e,n){this.attributes[e]=n}hasClass(e){return this.classes.includes(e)}toNode(){return J$.call(this,"a")}toMarkup(){return eQ.call(this,"a")}}class mbe{constructor(e,n,r){this.src=void 0,this.alt=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.alt=n,this.src=e,this.classes=["mord"],this.style=r}hasClass(e){return this.classes.includes(e)}toNode(){var e=document.createElement("img");e.src=this.src,e.alt=this.alt,e.className="mord";for(var n in this.style)this.style.hasOwnProperty(n)&&(e.style[n]=this.style[n]);return e}toMarkup(){var e=''+Mn.escape(this.alt)+'0&&(n=document.createElement("span"),n.style.marginRight=We(this.italic)),this.classes.length>0&&(n=n||document.createElement("span"),n.className=Oc(this.classes));for(var r in this.style)this.style.hasOwnProperty(r)&&(n=n||document.createElement("span"),n.style[r]=this.style[r]);return n?(n.appendChild(e),n):e}toMarkup(){var e=!1,n="0&&(r+="margin-right:"+this.italic+"em;");for(var s in this.style)this.style.hasOwnProperty(s)&&(r+=Mn.hyphenate(s)+":"+this.style[s]+";");r&&(e=!0,n+=' style="'+Mn.escape(r)+'"');var i=Mn.escape(this.text);return e?(n+=">",n+=i,n+="",n):i}}class go{constructor(e,n){this.children=void 0,this.attributes=void 0,this.children=e||[],this.attributes=n||{}}toNode(){var e="http://www.w3.org/2000/svg",n=document.createElementNS(e,"svg");for(var r in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,r)&&n.setAttribute(r,this.attributes[r]);for(var s=0;s':''}}class hk{constructor(e){this.attributes=void 0,this.attributes=e||{}}toNode(){var e="http://www.w3.org/2000/svg",n=document.createElementNS(e,"line");for(var r in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,r)&&n.setAttribute(r,this.attributes[r]);return n}toMarkup(){var e=" but got "+String(t)+".")}var xbe={bin:1,close:1,inner:1,open:1,punct:1,rel:1},vbe={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1},Jn={math:{},text:{}};function A(t,e,n,r,s,i){Jn[t][s]={font:e,group:n,replace:r},i&&r&&(Jn[t][r]=Jn[t][s])}var D="math",Ie="text",$="main",le="ams",ur="accent-token",st="bin",$s="close",Jh="inner",wt="mathord",Ur="op-token",Pi="open",Oy="punct",oe="rel",jo="spacing",me="textord";A(D,$,oe,"≡","\\equiv",!0);A(D,$,oe,"≺","\\prec",!0);A(D,$,oe,"≻","\\succ",!0);A(D,$,oe,"∼","\\sim",!0);A(D,$,oe,"⊥","\\perp");A(D,$,oe,"⪯","\\preceq",!0);A(D,$,oe,"⪰","\\succeq",!0);A(D,$,oe,"≃","\\simeq",!0);A(D,$,oe,"∣","\\mid",!0);A(D,$,oe,"≪","\\ll",!0);A(D,$,oe,"≫","\\gg",!0);A(D,$,oe,"≍","\\asymp",!0);A(D,$,oe,"∥","\\parallel");A(D,$,oe,"⋈","\\bowtie",!0);A(D,$,oe,"⌣","\\smile",!0);A(D,$,oe,"⊑","\\sqsubseteq",!0);A(D,$,oe,"⊒","\\sqsupseteq",!0);A(D,$,oe,"≐","\\doteq",!0);A(D,$,oe,"⌢","\\frown",!0);A(D,$,oe,"∋","\\ni",!0);A(D,$,oe,"∝","\\propto",!0);A(D,$,oe,"⊢","\\vdash",!0);A(D,$,oe,"⊣","\\dashv",!0);A(D,$,oe,"∋","\\owns");A(D,$,Oy,".","\\ldotp");A(D,$,Oy,"⋅","\\cdotp");A(D,$,me,"#","\\#");A(Ie,$,me,"#","\\#");A(D,$,me,"&","\\&");A(Ie,$,me,"&","\\&");A(D,$,me,"ℵ","\\aleph",!0);A(D,$,me,"∀","\\forall",!0);A(D,$,me,"ℏ","\\hbar",!0);A(D,$,me,"∃","\\exists",!0);A(D,$,me,"∇","\\nabla",!0);A(D,$,me,"♭","\\flat",!0);A(D,$,me,"ℓ","\\ell",!0);A(D,$,me,"♮","\\natural",!0);A(D,$,me,"♣","\\clubsuit",!0);A(D,$,me,"℘","\\wp",!0);A(D,$,me,"♯","\\sharp",!0);A(D,$,me,"♢","\\diamondsuit",!0);A(D,$,me,"ℜ","\\Re",!0);A(D,$,me,"♡","\\heartsuit",!0);A(D,$,me,"ℑ","\\Im",!0);A(D,$,me,"♠","\\spadesuit",!0);A(D,$,me,"§","\\S",!0);A(Ie,$,me,"§","\\S");A(D,$,me,"¶","\\P",!0);A(Ie,$,me,"¶","\\P");A(D,$,me,"†","\\dag");A(Ie,$,me,"†","\\dag");A(Ie,$,me,"†","\\textdagger");A(D,$,me,"‡","\\ddag");A(Ie,$,me,"‡","\\ddag");A(Ie,$,me,"‡","\\textdaggerdbl");A(D,$,$s,"⎱","\\rmoustache",!0);A(D,$,Pi,"⎰","\\lmoustache",!0);A(D,$,$s,"⟯","\\rgroup",!0);A(D,$,Pi,"⟮","\\lgroup",!0);A(D,$,st,"∓","\\mp",!0);A(D,$,st,"⊖","\\ominus",!0);A(D,$,st,"⊎","\\uplus",!0);A(D,$,st,"⊓","\\sqcap",!0);A(D,$,st,"∗","\\ast");A(D,$,st,"⊔","\\sqcup",!0);A(D,$,st,"◯","\\bigcirc",!0);A(D,$,st,"∙","\\bullet",!0);A(D,$,st,"‡","\\ddagger");A(D,$,st,"≀","\\wr",!0);A(D,$,st,"⨿","\\amalg");A(D,$,st,"&","\\And");A(D,$,oe,"⟵","\\longleftarrow",!0);A(D,$,oe,"⇐","\\Leftarrow",!0);A(D,$,oe,"⟸","\\Longleftarrow",!0);A(D,$,oe,"⟶","\\longrightarrow",!0);A(D,$,oe,"⇒","\\Rightarrow",!0);A(D,$,oe,"⟹","\\Longrightarrow",!0);A(D,$,oe,"↔","\\leftrightarrow",!0);A(D,$,oe,"⟷","\\longleftrightarrow",!0);A(D,$,oe,"⇔","\\Leftrightarrow",!0);A(D,$,oe,"⟺","\\Longleftrightarrow",!0);A(D,$,oe,"↦","\\mapsto",!0);A(D,$,oe,"⟼","\\longmapsto",!0);A(D,$,oe,"↗","\\nearrow",!0);A(D,$,oe,"↩","\\hookleftarrow",!0);A(D,$,oe,"↪","\\hookrightarrow",!0);A(D,$,oe,"↘","\\searrow",!0);A(D,$,oe,"↼","\\leftharpoonup",!0);A(D,$,oe,"⇀","\\rightharpoonup",!0);A(D,$,oe,"↙","\\swarrow",!0);A(D,$,oe,"↽","\\leftharpoondown",!0);A(D,$,oe,"⇁","\\rightharpoondown",!0);A(D,$,oe,"↖","\\nwarrow",!0);A(D,$,oe,"⇌","\\rightleftharpoons",!0);A(D,le,oe,"≮","\\nless",!0);A(D,le,oe,"","\\@nleqslant");A(D,le,oe,"","\\@nleqq");A(D,le,oe,"⪇","\\lneq",!0);A(D,le,oe,"≨","\\lneqq",!0);A(D,le,oe,"","\\@lvertneqq");A(D,le,oe,"⋦","\\lnsim",!0);A(D,le,oe,"⪉","\\lnapprox",!0);A(D,le,oe,"⊀","\\nprec",!0);A(D,le,oe,"⋠","\\npreceq",!0);A(D,le,oe,"⋨","\\precnsim",!0);A(D,le,oe,"⪹","\\precnapprox",!0);A(D,le,oe,"≁","\\nsim",!0);A(D,le,oe,"","\\@nshortmid");A(D,le,oe,"∤","\\nmid",!0);A(D,le,oe,"⊬","\\nvdash",!0);A(D,le,oe,"⊭","\\nvDash",!0);A(D,le,oe,"⋪","\\ntriangleleft");A(D,le,oe,"⋬","\\ntrianglelefteq",!0);A(D,le,oe,"⊊","\\subsetneq",!0);A(D,le,oe,"","\\@varsubsetneq");A(D,le,oe,"⫋","\\subsetneqq",!0);A(D,le,oe,"","\\@varsubsetneqq");A(D,le,oe,"≯","\\ngtr",!0);A(D,le,oe,"","\\@ngeqslant");A(D,le,oe,"","\\@ngeqq");A(D,le,oe,"⪈","\\gneq",!0);A(D,le,oe,"≩","\\gneqq",!0);A(D,le,oe,"","\\@gvertneqq");A(D,le,oe,"⋧","\\gnsim",!0);A(D,le,oe,"⪊","\\gnapprox",!0);A(D,le,oe,"⊁","\\nsucc",!0);A(D,le,oe,"⋡","\\nsucceq",!0);A(D,le,oe,"⋩","\\succnsim",!0);A(D,le,oe,"⪺","\\succnapprox",!0);A(D,le,oe,"≆","\\ncong",!0);A(D,le,oe,"","\\@nshortparallel");A(D,le,oe,"∦","\\nparallel",!0);A(D,le,oe,"⊯","\\nVDash",!0);A(D,le,oe,"⋫","\\ntriangleright");A(D,le,oe,"⋭","\\ntrianglerighteq",!0);A(D,le,oe,"","\\@nsupseteqq");A(D,le,oe,"⊋","\\supsetneq",!0);A(D,le,oe,"","\\@varsupsetneq");A(D,le,oe,"⫌","\\supsetneqq",!0);A(D,le,oe,"","\\@varsupsetneqq");A(D,le,oe,"⊮","\\nVdash",!0);A(D,le,oe,"⪵","\\precneqq",!0);A(D,le,oe,"⪶","\\succneqq",!0);A(D,le,oe,"","\\@nsubseteqq");A(D,le,st,"⊴","\\unlhd");A(D,le,st,"⊵","\\unrhd");A(D,le,oe,"↚","\\nleftarrow",!0);A(D,le,oe,"↛","\\nrightarrow",!0);A(D,le,oe,"⇍","\\nLeftarrow",!0);A(D,le,oe,"⇏","\\nRightarrow",!0);A(D,le,oe,"↮","\\nleftrightarrow",!0);A(D,le,oe,"⇎","\\nLeftrightarrow",!0);A(D,le,oe,"△","\\vartriangle");A(D,le,me,"ℏ","\\hslash");A(D,le,me,"▽","\\triangledown");A(D,le,me,"◊","\\lozenge");A(D,le,me,"Ⓢ","\\circledS");A(D,le,me,"®","\\circledR");A(Ie,le,me,"®","\\circledR");A(D,le,me,"∡","\\measuredangle",!0);A(D,le,me,"∄","\\nexists");A(D,le,me,"℧","\\mho");A(D,le,me,"Ⅎ","\\Finv",!0);A(D,le,me,"⅁","\\Game",!0);A(D,le,me,"‵","\\backprime");A(D,le,me,"▲","\\blacktriangle");A(D,le,me,"▼","\\blacktriangledown");A(D,le,me,"■","\\blacksquare");A(D,le,me,"⧫","\\blacklozenge");A(D,le,me,"★","\\bigstar");A(D,le,me,"∢","\\sphericalangle",!0);A(D,le,me,"∁","\\complement",!0);A(D,le,me,"ð","\\eth",!0);A(Ie,$,me,"ð","ð");A(D,le,me,"╱","\\diagup");A(D,le,me,"╲","\\diagdown");A(D,le,me,"□","\\square");A(D,le,me,"□","\\Box");A(D,le,me,"◊","\\Diamond");A(D,le,me,"¥","\\yen",!0);A(Ie,le,me,"¥","\\yen",!0);A(D,le,me,"✓","\\checkmark",!0);A(Ie,le,me,"✓","\\checkmark");A(D,le,me,"ℶ","\\beth",!0);A(D,le,me,"ℸ","\\daleth",!0);A(D,le,me,"ℷ","\\gimel",!0);A(D,le,me,"ϝ","\\digamma",!0);A(D,le,me,"ϰ","\\varkappa");A(D,le,Pi,"┌","\\@ulcorner",!0);A(D,le,$s,"┐","\\@urcorner",!0);A(D,le,Pi,"└","\\@llcorner",!0);A(D,le,$s,"┘","\\@lrcorner",!0);A(D,le,oe,"≦","\\leqq",!0);A(D,le,oe,"⩽","\\leqslant",!0);A(D,le,oe,"⪕","\\eqslantless",!0);A(D,le,oe,"≲","\\lesssim",!0);A(D,le,oe,"⪅","\\lessapprox",!0);A(D,le,oe,"≊","\\approxeq",!0);A(D,le,st,"⋖","\\lessdot");A(D,le,oe,"⋘","\\lll",!0);A(D,le,oe,"≶","\\lessgtr",!0);A(D,le,oe,"⋚","\\lesseqgtr",!0);A(D,le,oe,"⪋","\\lesseqqgtr",!0);A(D,le,oe,"≑","\\doteqdot");A(D,le,oe,"≓","\\risingdotseq",!0);A(D,le,oe,"≒","\\fallingdotseq",!0);A(D,le,oe,"∽","\\backsim",!0);A(D,le,oe,"⋍","\\backsimeq",!0);A(D,le,oe,"⫅","\\subseteqq",!0);A(D,le,oe,"⋐","\\Subset",!0);A(D,le,oe,"⊏","\\sqsubset",!0);A(D,le,oe,"≼","\\preccurlyeq",!0);A(D,le,oe,"⋞","\\curlyeqprec",!0);A(D,le,oe,"≾","\\precsim",!0);A(D,le,oe,"⪷","\\precapprox",!0);A(D,le,oe,"⊲","\\vartriangleleft");A(D,le,oe,"⊴","\\trianglelefteq");A(D,le,oe,"⊨","\\vDash",!0);A(D,le,oe,"⊪","\\Vvdash",!0);A(D,le,oe,"⌣","\\smallsmile");A(D,le,oe,"⌢","\\smallfrown");A(D,le,oe,"≏","\\bumpeq",!0);A(D,le,oe,"≎","\\Bumpeq",!0);A(D,le,oe,"≧","\\geqq",!0);A(D,le,oe,"⩾","\\geqslant",!0);A(D,le,oe,"⪖","\\eqslantgtr",!0);A(D,le,oe,"≳","\\gtrsim",!0);A(D,le,oe,"⪆","\\gtrapprox",!0);A(D,le,st,"⋗","\\gtrdot");A(D,le,oe,"⋙","\\ggg",!0);A(D,le,oe,"≷","\\gtrless",!0);A(D,le,oe,"⋛","\\gtreqless",!0);A(D,le,oe,"⪌","\\gtreqqless",!0);A(D,le,oe,"≖","\\eqcirc",!0);A(D,le,oe,"≗","\\circeq",!0);A(D,le,oe,"≜","\\triangleq",!0);A(D,le,oe,"∼","\\thicksim");A(D,le,oe,"≈","\\thickapprox");A(D,le,oe,"⫆","\\supseteqq",!0);A(D,le,oe,"⋑","\\Supset",!0);A(D,le,oe,"⊐","\\sqsupset",!0);A(D,le,oe,"≽","\\succcurlyeq",!0);A(D,le,oe,"⋟","\\curlyeqsucc",!0);A(D,le,oe,"≿","\\succsim",!0);A(D,le,oe,"⪸","\\succapprox",!0);A(D,le,oe,"⊳","\\vartriangleright");A(D,le,oe,"⊵","\\trianglerighteq");A(D,le,oe,"⊩","\\Vdash",!0);A(D,le,oe,"∣","\\shortmid");A(D,le,oe,"∥","\\shortparallel");A(D,le,oe,"≬","\\between",!0);A(D,le,oe,"⋔","\\pitchfork",!0);A(D,le,oe,"∝","\\varpropto");A(D,le,oe,"◀","\\blacktriangleleft");A(D,le,oe,"∴","\\therefore",!0);A(D,le,oe,"∍","\\backepsilon");A(D,le,oe,"▶","\\blacktriangleright");A(D,le,oe,"∵","\\because",!0);A(D,le,oe,"⋘","\\llless");A(D,le,oe,"⋙","\\gggtr");A(D,le,st,"⊲","\\lhd");A(D,le,st,"⊳","\\rhd");A(D,le,oe,"≂","\\eqsim",!0);A(D,$,oe,"⋈","\\Join");A(D,le,oe,"≑","\\Doteq",!0);A(D,le,st,"∔","\\dotplus",!0);A(D,le,st,"∖","\\smallsetminus");A(D,le,st,"⋒","\\Cap",!0);A(D,le,st,"⋓","\\Cup",!0);A(D,le,st,"⩞","\\doublebarwedge",!0);A(D,le,st,"⊟","\\boxminus",!0);A(D,le,st,"⊞","\\boxplus",!0);A(D,le,st,"⋇","\\divideontimes",!0);A(D,le,st,"⋉","\\ltimes",!0);A(D,le,st,"⋊","\\rtimes",!0);A(D,le,st,"⋋","\\leftthreetimes",!0);A(D,le,st,"⋌","\\rightthreetimes",!0);A(D,le,st,"⋏","\\curlywedge",!0);A(D,le,st,"⋎","\\curlyvee",!0);A(D,le,st,"⊝","\\circleddash",!0);A(D,le,st,"⊛","\\circledast",!0);A(D,le,st,"⋅","\\centerdot");A(D,le,st,"⊺","\\intercal",!0);A(D,le,st,"⋒","\\doublecap");A(D,le,st,"⋓","\\doublecup");A(D,le,st,"⊠","\\boxtimes",!0);A(D,le,oe,"⇢","\\dashrightarrow",!0);A(D,le,oe,"⇠","\\dashleftarrow",!0);A(D,le,oe,"⇇","\\leftleftarrows",!0);A(D,le,oe,"⇆","\\leftrightarrows",!0);A(D,le,oe,"⇚","\\Lleftarrow",!0);A(D,le,oe,"↞","\\twoheadleftarrow",!0);A(D,le,oe,"↢","\\leftarrowtail",!0);A(D,le,oe,"↫","\\looparrowleft",!0);A(D,le,oe,"⇋","\\leftrightharpoons",!0);A(D,le,oe,"↶","\\curvearrowleft",!0);A(D,le,oe,"↺","\\circlearrowleft",!0);A(D,le,oe,"↰","\\Lsh",!0);A(D,le,oe,"⇈","\\upuparrows",!0);A(D,le,oe,"↿","\\upharpoonleft",!0);A(D,le,oe,"⇃","\\downharpoonleft",!0);A(D,$,oe,"⊶","\\origof",!0);A(D,$,oe,"⊷","\\imageof",!0);A(D,le,oe,"⊸","\\multimap",!0);A(D,le,oe,"↭","\\leftrightsquigarrow",!0);A(D,le,oe,"⇉","\\rightrightarrows",!0);A(D,le,oe,"⇄","\\rightleftarrows",!0);A(D,le,oe,"↠","\\twoheadrightarrow",!0);A(D,le,oe,"↣","\\rightarrowtail",!0);A(D,le,oe,"↬","\\looparrowright",!0);A(D,le,oe,"↷","\\curvearrowright",!0);A(D,le,oe,"↻","\\circlearrowright",!0);A(D,le,oe,"↱","\\Rsh",!0);A(D,le,oe,"⇊","\\downdownarrows",!0);A(D,le,oe,"↾","\\upharpoonright",!0);A(D,le,oe,"⇂","\\downharpoonright",!0);A(D,le,oe,"⇝","\\rightsquigarrow",!0);A(D,le,oe,"⇝","\\leadsto");A(D,le,oe,"⇛","\\Rrightarrow",!0);A(D,le,oe,"↾","\\restriction");A(D,$,me,"‘","`");A(D,$,me,"$","\\$");A(Ie,$,me,"$","\\$");A(Ie,$,me,"$","\\textdollar");A(D,$,me,"%","\\%");A(Ie,$,me,"%","\\%");A(D,$,me,"_","\\_");A(Ie,$,me,"_","\\_");A(Ie,$,me,"_","\\textunderscore");A(D,$,me,"∠","\\angle",!0);A(D,$,me,"∞","\\infty",!0);A(D,$,me,"′","\\prime");A(D,$,me,"△","\\triangle");A(D,$,me,"Γ","\\Gamma",!0);A(D,$,me,"Δ","\\Delta",!0);A(D,$,me,"Θ","\\Theta",!0);A(D,$,me,"Λ","\\Lambda",!0);A(D,$,me,"Ξ","\\Xi",!0);A(D,$,me,"Π","\\Pi",!0);A(D,$,me,"Σ","\\Sigma",!0);A(D,$,me,"Υ","\\Upsilon",!0);A(D,$,me,"Φ","\\Phi",!0);A(D,$,me,"Ψ","\\Psi",!0);A(D,$,me,"Ω","\\Omega",!0);A(D,$,me,"A","Α");A(D,$,me,"B","Β");A(D,$,me,"E","Ε");A(D,$,me,"Z","Ζ");A(D,$,me,"H","Η");A(D,$,me,"I","Ι");A(D,$,me,"K","Κ");A(D,$,me,"M","Μ");A(D,$,me,"N","Ν");A(D,$,me,"O","Ο");A(D,$,me,"P","Ρ");A(D,$,me,"T","Τ");A(D,$,me,"X","Χ");A(D,$,me,"¬","\\neg",!0);A(D,$,me,"¬","\\lnot");A(D,$,me,"⊤","\\top");A(D,$,me,"⊥","\\bot");A(D,$,me,"∅","\\emptyset");A(D,le,me,"∅","\\varnothing");A(D,$,wt,"α","\\alpha",!0);A(D,$,wt,"β","\\beta",!0);A(D,$,wt,"γ","\\gamma",!0);A(D,$,wt,"δ","\\delta",!0);A(D,$,wt,"ϵ","\\epsilon",!0);A(D,$,wt,"ζ","\\zeta",!0);A(D,$,wt,"η","\\eta",!0);A(D,$,wt,"θ","\\theta",!0);A(D,$,wt,"ι","\\iota",!0);A(D,$,wt,"κ","\\kappa",!0);A(D,$,wt,"λ","\\lambda",!0);A(D,$,wt,"μ","\\mu",!0);A(D,$,wt,"ν","\\nu",!0);A(D,$,wt,"ξ","\\xi",!0);A(D,$,wt,"ο","\\omicron",!0);A(D,$,wt,"π","\\pi",!0);A(D,$,wt,"ρ","\\rho",!0);A(D,$,wt,"σ","\\sigma",!0);A(D,$,wt,"τ","\\tau",!0);A(D,$,wt,"υ","\\upsilon",!0);A(D,$,wt,"ϕ","\\phi",!0);A(D,$,wt,"χ","\\chi",!0);A(D,$,wt,"ψ","\\psi",!0);A(D,$,wt,"ω","\\omega",!0);A(D,$,wt,"ε","\\varepsilon",!0);A(D,$,wt,"ϑ","\\vartheta",!0);A(D,$,wt,"ϖ","\\varpi",!0);A(D,$,wt,"ϱ","\\varrho",!0);A(D,$,wt,"ς","\\varsigma",!0);A(D,$,wt,"φ","\\varphi",!0);A(D,$,st,"∗","*",!0);A(D,$,st,"+","+");A(D,$,st,"−","-",!0);A(D,$,st,"⋅","\\cdot",!0);A(D,$,st,"∘","\\circ",!0);A(D,$,st,"÷","\\div",!0);A(D,$,st,"±","\\pm",!0);A(D,$,st,"×","\\times",!0);A(D,$,st,"∩","\\cap",!0);A(D,$,st,"∪","\\cup",!0);A(D,$,st,"∖","\\setminus",!0);A(D,$,st,"∧","\\land");A(D,$,st,"∨","\\lor");A(D,$,st,"∧","\\wedge",!0);A(D,$,st,"∨","\\vee",!0);A(D,$,me,"√","\\surd");A(D,$,Pi,"⟨","\\langle",!0);A(D,$,Pi,"∣","\\lvert");A(D,$,Pi,"∥","\\lVert");A(D,$,$s,"?","?");A(D,$,$s,"!","!");A(D,$,$s,"⟩","\\rangle",!0);A(D,$,$s,"∣","\\rvert");A(D,$,$s,"∥","\\rVert");A(D,$,oe,"=","=");A(D,$,oe,":",":");A(D,$,oe,"≈","\\approx",!0);A(D,$,oe,"≅","\\cong",!0);A(D,$,oe,"≥","\\ge");A(D,$,oe,"≥","\\geq",!0);A(D,$,oe,"←","\\gets");A(D,$,oe,">","\\gt",!0);A(D,$,oe,"∈","\\in",!0);A(D,$,oe,"","\\@not");A(D,$,oe,"⊂","\\subset",!0);A(D,$,oe,"⊃","\\supset",!0);A(D,$,oe,"⊆","\\subseteq",!0);A(D,$,oe,"⊇","\\supseteq",!0);A(D,le,oe,"⊈","\\nsubseteq",!0);A(D,le,oe,"⊉","\\nsupseteq",!0);A(D,$,oe,"⊨","\\models");A(D,$,oe,"←","\\leftarrow",!0);A(D,$,oe,"≤","\\le");A(D,$,oe,"≤","\\leq",!0);A(D,$,oe,"<","\\lt",!0);A(D,$,oe,"→","\\rightarrow",!0);A(D,$,oe,"→","\\to");A(D,le,oe,"≱","\\ngeq",!0);A(D,le,oe,"≰","\\nleq",!0);A(D,$,jo," ","\\ ");A(D,$,jo," ","\\space");A(D,$,jo," ","\\nobreakspace");A(Ie,$,jo," ","\\ ");A(Ie,$,jo," "," ");A(Ie,$,jo," ","\\space");A(Ie,$,jo," ","\\nobreakspace");A(D,$,jo,null,"\\nobreak");A(D,$,jo,null,"\\allowbreak");A(D,$,Oy,",",",");A(D,$,Oy,";",";");A(D,le,st,"⊼","\\barwedge",!0);A(D,le,st,"⊻","\\veebar",!0);A(D,$,st,"⊙","\\odot",!0);A(D,$,st,"⊕","\\oplus",!0);A(D,$,st,"⊗","\\otimes",!0);A(D,$,me,"∂","\\partial",!0);A(D,$,st,"⊘","\\oslash",!0);A(D,le,st,"⊚","\\circledcirc",!0);A(D,le,st,"⊡","\\boxdot",!0);A(D,$,st,"△","\\bigtriangleup");A(D,$,st,"▽","\\bigtriangledown");A(D,$,st,"†","\\dagger");A(D,$,st,"⋄","\\diamond");A(D,$,st,"⋆","\\star");A(D,$,st,"◃","\\triangleleft");A(D,$,st,"▹","\\triangleright");A(D,$,Pi,"{","\\{");A(Ie,$,me,"{","\\{");A(Ie,$,me,"{","\\textbraceleft");A(D,$,$s,"}","\\}");A(Ie,$,me,"}","\\}");A(Ie,$,me,"}","\\textbraceright");A(D,$,Pi,"{","\\lbrace");A(D,$,$s,"}","\\rbrace");A(D,$,Pi,"[","\\lbrack",!0);A(Ie,$,me,"[","\\lbrack",!0);A(D,$,$s,"]","\\rbrack",!0);A(Ie,$,me,"]","\\rbrack",!0);A(D,$,Pi,"(","\\lparen",!0);A(D,$,$s,")","\\rparen",!0);A(Ie,$,me,"<","\\textless",!0);A(Ie,$,me,">","\\textgreater",!0);A(D,$,Pi,"⌊","\\lfloor",!0);A(D,$,$s,"⌋","\\rfloor",!0);A(D,$,Pi,"⌈","\\lceil",!0);A(D,$,$s,"⌉","\\rceil",!0);A(D,$,me,"\\","\\backslash");A(D,$,me,"∣","|");A(D,$,me,"∣","\\vert");A(Ie,$,me,"|","\\textbar",!0);A(D,$,me,"∥","\\|");A(D,$,me,"∥","\\Vert");A(Ie,$,me,"∥","\\textbardbl");A(Ie,$,me,"~","\\textasciitilde");A(Ie,$,me,"\\","\\textbackslash");A(Ie,$,me,"^","\\textasciicircum");A(D,$,oe,"↑","\\uparrow",!0);A(D,$,oe,"⇑","\\Uparrow",!0);A(D,$,oe,"↓","\\downarrow",!0);A(D,$,oe,"⇓","\\Downarrow",!0);A(D,$,oe,"↕","\\updownarrow",!0);A(D,$,oe,"⇕","\\Updownarrow",!0);A(D,$,Ur,"∐","\\coprod");A(D,$,Ur,"⋁","\\bigvee");A(D,$,Ur,"⋀","\\bigwedge");A(D,$,Ur,"⨄","\\biguplus");A(D,$,Ur,"⋂","\\bigcap");A(D,$,Ur,"⋃","\\bigcup");A(D,$,Ur,"∫","\\int");A(D,$,Ur,"∫","\\intop");A(D,$,Ur,"∬","\\iint");A(D,$,Ur,"∭","\\iiint");A(D,$,Ur,"∏","\\prod");A(D,$,Ur,"∑","\\sum");A(D,$,Ur,"⨂","\\bigotimes");A(D,$,Ur,"⨁","\\bigoplus");A(D,$,Ur,"⨀","\\bigodot");A(D,$,Ur,"∮","\\oint");A(D,$,Ur,"∯","\\oiint");A(D,$,Ur,"∰","\\oiiint");A(D,$,Ur,"⨆","\\bigsqcup");A(D,$,Ur,"∫","\\smallint");A(Ie,$,Jh,"…","\\textellipsis");A(D,$,Jh,"…","\\mathellipsis");A(Ie,$,Jh,"…","\\ldots",!0);A(D,$,Jh,"…","\\ldots",!0);A(D,$,Jh,"⋯","\\@cdots",!0);A(D,$,Jh,"⋱","\\ddots",!0);A(D,$,me,"⋮","\\varvdots");A(Ie,$,me,"⋮","\\varvdots");A(D,$,ur,"ˊ","\\acute");A(D,$,ur,"ˋ","\\grave");A(D,$,ur,"¨","\\ddot");A(D,$,ur,"~","\\tilde");A(D,$,ur,"ˉ","\\bar");A(D,$,ur,"˘","\\breve");A(D,$,ur,"ˇ","\\check");A(D,$,ur,"^","\\hat");A(D,$,ur,"⃗","\\vec");A(D,$,ur,"˙","\\dot");A(D,$,ur,"˚","\\mathring");A(D,$,wt,"","\\@imath");A(D,$,wt,"","\\@jmath");A(D,$,me,"ı","ı");A(D,$,me,"ȷ","ȷ");A(Ie,$,me,"ı","\\i",!0);A(Ie,$,me,"ȷ","\\j",!0);A(Ie,$,me,"ß","\\ss",!0);A(Ie,$,me,"æ","\\ae",!0);A(Ie,$,me,"œ","\\oe",!0);A(Ie,$,me,"ø","\\o",!0);A(Ie,$,me,"Æ","\\AE",!0);A(Ie,$,me,"Œ","\\OE",!0);A(Ie,$,me,"Ø","\\O",!0);A(Ie,$,ur,"ˊ","\\'");A(Ie,$,ur,"ˋ","\\`");A(Ie,$,ur,"ˆ","\\^");A(Ie,$,ur,"˜","\\~");A(Ie,$,ur,"ˉ","\\=");A(Ie,$,ur,"˘","\\u");A(Ie,$,ur,"˙","\\.");A(Ie,$,ur,"¸","\\c");A(Ie,$,ur,"˚","\\r");A(Ie,$,ur,"ˇ","\\v");A(Ie,$,ur,"¨",'\\"');A(Ie,$,ur,"˝","\\H");A(Ie,$,ur,"◯","\\textcircled");var tQ={"--":!0,"---":!0,"``":!0,"''":!0};A(Ie,$,me,"–","--",!0);A(Ie,$,me,"–","\\textendash");A(Ie,$,me,"—","---",!0);A(Ie,$,me,"—","\\textemdash");A(Ie,$,me,"‘","`",!0);A(Ie,$,me,"‘","\\textquoteleft");A(Ie,$,me,"’","'",!0);A(Ie,$,me,"’","\\textquoteright");A(Ie,$,me,"“","``",!0);A(Ie,$,me,"“","\\textquotedblleft");A(Ie,$,me,"”","''",!0);A(Ie,$,me,"”","\\textquotedblright");A(D,$,me,"°","\\degree",!0);A(Ie,$,me,"°","\\degree");A(Ie,$,me,"°","\\textdegree",!0);A(D,$,me,"£","\\pounds");A(D,$,me,"£","\\mathsterling",!0);A(Ie,$,me,"£","\\pounds");A(Ie,$,me,"£","\\textsterling",!0);A(D,le,me,"✠","\\maltese");A(Ie,le,me,"✠","\\maltese");var tM='0123456789/@."';for(var j4=0;j40)return Sa(i,h,s,n,a.concat(f));if(c){var m,g;if(c==="boldsymbol"){var x=wbe(i,s,n,a,r);m=x.fontName,g=[x.fontClass]}else o?(m=sQ[c].fontName,g=[c]):(m=Rx(c,n.fontWeight,n.fontShape),g=[c,n.fontWeight,n.fontShape]);if(Ny(i,m,s).metrics)return Sa(i,m,s,n,a.concat(g));if(tQ.hasOwnProperty(i)&&m.slice(0,10)==="Typewriter"){for(var y=[],w=0;w{if(Oc(t.classes)!==Oc(e.classes)||t.skew!==e.skew||t.maxFontSize!==e.maxFontSize)return!1;if(t.classes.length===1){var n=t.classes[0];if(n==="mbin"||n==="mord")return!1}for(var r in t.style)if(t.style.hasOwnProperty(r)&&t.style[r]!==e.style[r])return!1;for(var s in e.style)if(e.style.hasOwnProperty(s)&&t.style[s]!==e.style[s])return!1;return!0},jbe=t=>{for(var e=0;en&&(n=a.height),a.depth>r&&(r=a.depth),a.maxFontSize>s&&(s=a.maxFontSize)}e.height=n,e.depth=r,e.maxFontSize=s},Zs=function(e,n,r,s){var i=new mp(e,n,r,s);return Gj(i),i},nQ=(t,e,n,r)=>new mp(t,e,n,r),Obe=function(e,n,r){var s=Zs([e],[],n);return s.height=Math.max(r||n.fontMetrics().defaultRuleThickness,n.minRuleThickness),s.style.borderBottomWidth=We(s.height),s.maxFontSize=1,s},Nbe=function(e,n,r,s){var i=new Wj(e,n,r,s);return Gj(i),i},rQ=function(e){var n=new fp(e);return Gj(n),n},Cbe=function(e,n){return e instanceof fp?Zs([],[e],n):e},Tbe=function(e){if(e.positionType==="individualShift"){for(var n=e.children,r=[n[0]],s=-n[0].shift-n[0].elem.depth,i=s,a=1;a{var n=Zs(["mspace"],[],e),r=gr(t,e);return n.style.marginRight=We(r),n},Rx=function(e,n,r){var s="";switch(e){case"amsrm":s="AMS";break;case"textrm":s="Main";break;case"textsf":s="SansSerif";break;case"texttt":s="Typewriter";break;default:s=e}var i;return n==="textbf"&&r==="textit"?i="BoldItalic":n==="textbf"?i="Bold":n==="textit"?i="Italic":i="Regular",s+"-"+i},sQ={mathbf:{variant:"bold",fontName:"Main-Bold"},mathrm:{variant:"normal",fontName:"Main-Regular"},textit:{variant:"italic",fontName:"Main-Italic"},mathit:{variant:"italic",fontName:"Main-Italic"},mathnormal:{variant:"italic",fontName:"Math-Italic"},mathsfit:{variant:"sans-serif-italic",fontName:"SansSerif-Italic"},mathbb:{variant:"double-struck",fontName:"AMS-Regular"},mathcal:{variant:"script",fontName:"Caligraphic-Regular"},mathfrak:{variant:"fraktur",fontName:"Fraktur-Regular"},mathscr:{variant:"script",fontName:"Script-Regular"},mathsf:{variant:"sans-serif",fontName:"SansSerif-Regular"},mathtt:{variant:"monospace",fontName:"Typewriter-Regular"}},iQ={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659]},Mbe=function(e,n){var[r,s,i]=iQ[e],a=new Nc(r),o=new go([a],{width:We(s),height:We(i),style:"width:"+We(s),viewBox:"0 0 "+1e3*s+" "+1e3*i,preserveAspectRatio:"xMinYMin"}),c=nQ(["overlay"],[o],n);return c.height=i,c.style.height=We(i),c.style.width=We(s),c},be={fontMap:sQ,makeSymbol:Sa,mathsym:bbe,makeSpan:Zs,makeSvgSpan:nQ,makeLineSpan:Obe,makeAnchor:Nbe,makeFragment:rQ,wrapFragment:Cbe,makeVList:Ebe,makeOrd:Sbe,makeGlue:_be,staticSvg:Mbe,svgData:iQ,tryCombineChars:jbe},fr={number:3,unit:"mu"},lu={number:4,unit:"mu"},Wl={number:5,unit:"mu"},Abe={mord:{mop:fr,mbin:lu,mrel:Wl,minner:fr},mop:{mord:fr,mop:fr,mrel:Wl,minner:fr},mbin:{mord:lu,mop:lu,mopen:lu,minner:lu},mrel:{mord:Wl,mop:Wl,mopen:Wl,minner:Wl},mopen:{},mclose:{mop:fr,mbin:lu,mrel:Wl,minner:fr},mpunct:{mord:fr,mop:fr,mrel:Wl,mopen:fr,mclose:fr,mpunct:fr,minner:fr},minner:{mord:fr,mop:fr,mbin:lu,mrel:Wl,mopen:fr,mpunct:fr,minner:fr}},Rbe={mord:{mop:fr},mop:{mord:fr,mop:fr},mbin:{},mrel:{},mopen:{},mclose:{mop:fr},mpunct:{},minner:{mop:fr}},aQ={},hv={},fv={};function et(t){for(var{type:e,names:n,props:r,handler:s,htmlBuilder:i,mathmlBuilder:a}=t,o={type:e,numArgs:r.numArgs,argTypes:r.argTypes,allowedInArgument:!!r.allowedInArgument,allowedInText:!!r.allowedInText,allowedInMath:r.allowedInMath===void 0?!0:r.allowedInMath,numOptionalArgs:r.numOptionalArgs||0,infix:!!r.infix,primitive:!!r.primitive,handler:s},c=0;c{var S=w.classes[0],k=y.classes[0];S==="mbin"&&zbe.includes(k)?w.classes[0]="mord":k==="mbin"&&Dbe.includes(S)&&(y.classes[0]="mord")},{node:m},g,x),aM(i,(y,w)=>{var S=mk(w),k=mk(y),N=S&&k?y.hasClass("mtight")?Rbe[S][k]:Abe[S][k]:null;if(N)return be.makeGlue(N,h)},{node:m},g,x),i},aM=function t(e,n,r,s,i){s&&e.push(s);for(var a=0;ag=>{e.splice(m+1,0,g),a++})(a)}s&&e.pop()},lQ=function(e){return e instanceof fp||e instanceof Wj||e instanceof mp&&e.hasClass("enclosing")?e:null},Ibe=function t(e,n){var r=lQ(e);if(r){var s=r.children;if(s.length){if(n==="right")return t(s[s.length-1],"right");if(n==="left")return t(s[0],"left")}}return e},mk=function(e,n){return e?(n&&(e=Ibe(e,n)),Lbe[e.classes[0]]||null):null},k0=function(e,n){var r=["nulldelimiter"].concat(e.baseSizingClasses());return xo(n.concat(r))},Cn=function(e,n,r){if(!e)return xo();if(hv[e.type]){var s=hv[e.type](e,n);if(r&&n.size!==r.size){s=xo(n.sizingClasses(r),[s],n);var i=n.sizeMultiplier/r.sizeMultiplier;s.height*=i,s.depth*=i}return s}else throw new $e("Got group of unknown type: '"+e.type+"'")};function Dx(t,e){var n=xo(["base"],t,e),r=xo(["strut"]);return r.style.height=We(n.height+n.depth),n.depth&&(r.style.verticalAlign=We(-n.depth)),n.children.unshift(r),n}function pk(t,e){var n=null;t.length===1&&t[0].type==="tag"&&(n=t[0].tag,t=t[0].body);var r=es(t,e,"root"),s;r.length===2&&r[1].hasClass("tag")&&(s=r.pop());for(var i=[],a=[],o=0;o0&&(i.push(Dx(a,e)),a=[]),i.push(r[o]));a.length>0&&i.push(Dx(a,e));var h;n?(h=Dx(es(n,e,!0)),h.classes=["tag"],i.push(h)):s&&i.push(s);var f=xo(["katex-html"],i);if(f.setAttribute("aria-hidden","true"),h){var m=h.children[0];m.style.height=We(f.height+f.depth),f.depth&&(m.style.verticalAlign=We(-f.depth))}return f}function oQ(t){return new fp(t)}class Ti{constructor(e,n,r){this.type=void 0,this.attributes=void 0,this.children=void 0,this.classes=void 0,this.type=e,this.attributes={},this.children=n||[],this.classes=r||[]}setAttribute(e,n){this.attributes[e]=n}getAttribute(e){return this.attributes[e]}toNode(){var e=document.createElementNS("http://www.w3.org/1998/Math/MathML",this.type);for(var n in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,n)&&e.setAttribute(n,this.attributes[n]);this.classes.length>0&&(e.className=Oc(this.classes));for(var r=0;r0&&(e+=' class ="'+Mn.escape(Oc(this.classes))+'"'),e+=">";for(var r=0;r",e}toText(){return this.children.map(e=>e.toText()).join("")}}class al{constructor(e){this.text=void 0,this.text=e}toNode(){return document.createTextNode(this.text)}toMarkup(){return Mn.escape(this.toText())}toText(){return this.text}}class Bbe{constructor(e){this.width=void 0,this.character=void 0,this.width=e,e>=.05555&&e<=.05556?this.character=" ":e>=.1666&&e<=.1667?this.character=" ":e>=.2222&&e<=.2223?this.character=" ":e>=.2777&&e<=.2778?this.character="  ":e>=-.05556&&e<=-.05555?this.character=" ⁣":e>=-.1667&&e<=-.1666?this.character=" ⁣":e>=-.2223&&e<=-.2222?this.character=" ⁣":e>=-.2778&&e<=-.2777?this.character=" ⁣":this.character=null}toNode(){if(this.character)return document.createTextNode(this.character);var e=document.createElementNS("http://www.w3.org/1998/Math/MathML","mspace");return e.setAttribute("width",We(this.width)),e}toMarkup(){return this.character?""+this.character+"":''}toText(){return this.character?this.character:" "}}var Fe={MathNode:Ti,TextNode:al,SpaceNode:Bbe,newDocumentFragment:oQ},da=function(e,n,r){return Jn[n][e]&&Jn[n][e].replace&&e.charCodeAt(0)!==55349&&!(tQ.hasOwnProperty(e)&&r&&(r.fontFamily&&r.fontFamily.slice(4,6)==="tt"||r.font&&r.font.slice(4,6)==="tt"))&&(e=Jn[n][e].replace),new Fe.TextNode(e)},Xj=function(e){return e.length===1?e[0]:new Fe.MathNode("mrow",e)},Yj=function(e,n){if(n.fontFamily==="texttt")return"monospace";if(n.fontFamily==="textsf")return n.fontShape==="textit"&&n.fontWeight==="textbf"?"sans-serif-bold-italic":n.fontShape==="textit"?"sans-serif-italic":n.fontWeight==="textbf"?"bold-sans-serif":"sans-serif";if(n.fontShape==="textit"&&n.fontWeight==="textbf")return"bold-italic";if(n.fontShape==="textit")return"italic";if(n.fontWeight==="textbf")return"bold";var r=n.font;if(!r||r==="mathnormal")return null;var s=e.mode;if(r==="mathit")return"italic";if(r==="boldsymbol")return e.type==="textord"?"bold":"bold-italic";if(r==="mathbf")return"bold";if(r==="mathbb")return"double-struck";if(r==="mathsfit")return"sans-serif-italic";if(r==="mathfrak")return"fraktur";if(r==="mathscr"||r==="mathcal")return"script";if(r==="mathsf")return"sans-serif";if(r==="mathtt")return"monospace";var i=e.text;if(["\\imath","\\jmath"].includes(i))return null;Jn[s][i]&&Jn[s][i].replace&&(i=Jn[s][i].replace);var a=be.fontMap[r].fontName;return Uj(i,a,s)?be.fontMap[r].variant:null};function T4(t){if(!t)return!1;if(t.type==="mi"&&t.children.length===1){var e=t.children[0];return e instanceof al&&e.text==="."}else if(t.type==="mo"&&t.children.length===1&&t.getAttribute("separator")==="true"&&t.getAttribute("lspace")==="0em"&&t.getAttribute("rspace")==="0em"){var n=t.children[0];return n instanceof al&&n.text===","}else return!1}var fi=function(e,n,r){if(e.length===1){var s=Kn(e[0],n);return r&&s instanceof Ti&&s.type==="mo"&&(s.setAttribute("lspace","0em"),s.setAttribute("rspace","0em")),[s]}for(var i=[],a,o=0;o=1&&(a.type==="mn"||T4(a))){var h=c.children[0];h instanceof Ti&&h.type==="mn"&&(h.children=[...a.children,...h.children],i.pop())}else if(a.type==="mi"&&a.children.length===1){var f=a.children[0];if(f instanceof al&&f.text==="̸"&&(c.type==="mo"||c.type==="mi"||c.type==="mn")){var m=c.children[0];m instanceof al&&m.text.length>0&&(m.text=m.text.slice(0,1)+"̸"+m.text.slice(1),i.pop())}}}i.push(c),a=c}return i},Cc=function(e,n,r){return Xj(fi(e,n,r))},Kn=function(e,n){if(!e)return new Fe.MathNode("mrow");if(fv[e.type]){var r=fv[e.type](e,n);return r}else throw new $e("Got group of unknown type: '"+e.type+"'")};function lM(t,e,n,r,s){var i=fi(t,n),a;i.length===1&&i[0]instanceof Ti&&["mrow","mtable"].includes(i[0].type)?a=i[0]:a=new Fe.MathNode("mrow",i);var o=new Fe.MathNode("annotation",[new Fe.TextNode(e)]);o.setAttribute("encoding","application/x-tex");var c=new Fe.MathNode("semantics",[a,o]),h=new Fe.MathNode("math",[c]);h.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),r&&h.setAttribute("display","block");var f=s?"katex":"katex-mathml";return be.makeSpan([f],[h])}var cQ=function(e){return new to({style:e.displayMode?St.DISPLAY:St.TEXT,maxSize:e.maxSize,minRuleThickness:e.minRuleThickness})},uQ=function(e,n){if(n.displayMode){var r=["katex-display"];n.leqno&&r.push("leqno"),n.fleqn&&r.push("fleqn"),e=be.makeSpan(r,[e])}return e},qbe=function(e,n,r){var s=cQ(r),i;if(r.output==="mathml")return lM(e,n,s,r.displayMode,!0);if(r.output==="html"){var a=pk(e,s);i=be.makeSpan(["katex"],[a])}else{var o=lM(e,n,s,r.displayMode,!1),c=pk(e,s);i=be.makeSpan(["katex"],[o,c])}return uQ(i,r)},Fbe=function(e,n,r){var s=cQ(r),i=pk(e,s),a=be.makeSpan(["katex"],[i]);return uQ(a,r)},$be={widehat:"^",widecheck:"ˇ",widetilde:"~",utilde:"~",overleftarrow:"←",underleftarrow:"←",xleftarrow:"←",overrightarrow:"→",underrightarrow:"→",xrightarrow:"→",underbrace:"⏟",overbrace:"⏞",overgroup:"⏠",undergroup:"⏡",overleftrightarrow:"↔",underleftrightarrow:"↔",xleftrightarrow:"↔",Overrightarrow:"⇒",xRightarrow:"⇒",overleftharpoon:"↼",xleftharpoonup:"↼",overrightharpoon:"⇀",xrightharpoonup:"⇀",xLeftarrow:"⇐",xLeftrightarrow:"⇔",xhookleftarrow:"↩",xhookrightarrow:"↪",xmapsto:"↦",xrightharpoondown:"⇁",xleftharpoondown:"↽",xrightleftharpoons:"⇌",xleftrightharpoons:"⇋",xtwoheadleftarrow:"↞",xtwoheadrightarrow:"↠",xlongequal:"=",xtofrom:"⇄",xrightleftarrows:"⇄",xrightequilibrium:"⇌",xleftequilibrium:"⇋","\\cdrightarrow":"→","\\cdleftarrow":"←","\\cdlongequal":"="},Qbe=function(e){var n=new Fe.MathNode("mo",[new Fe.TextNode($be[e.replace(/^\\/,"")])]);return n.setAttribute("stretchy","true"),n},Hbe={overrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],overleftarrow:[["leftarrow"],.888,522,"xMinYMin"],underrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],underleftarrow:[["leftarrow"],.888,522,"xMinYMin"],xrightarrow:[["rightarrow"],1.469,522,"xMaxYMin"],"\\cdrightarrow":[["rightarrow"],3,522,"xMaxYMin"],xleftarrow:[["leftarrow"],1.469,522,"xMinYMin"],"\\cdleftarrow":[["leftarrow"],3,522,"xMinYMin"],Overrightarrow:[["doublerightarrow"],.888,560,"xMaxYMin"],xRightarrow:[["doublerightarrow"],1.526,560,"xMaxYMin"],xLeftarrow:[["doubleleftarrow"],1.526,560,"xMinYMin"],overleftharpoon:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoonup:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoondown:[["leftharpoondown"],.888,522,"xMinYMin"],overrightharpoon:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoonup:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoondown:[["rightharpoondown"],.888,522,"xMaxYMin"],xlongequal:[["longequal"],.888,334,"xMinYMin"],"\\cdlongequal":[["longequal"],3,334,"xMinYMin"],xtwoheadleftarrow:[["twoheadleftarrow"],.888,334,"xMinYMin"],xtwoheadrightarrow:[["twoheadrightarrow"],.888,334,"xMaxYMin"],overleftrightarrow:[["leftarrow","rightarrow"],.888,522],overbrace:[["leftbrace","midbrace","rightbrace"],1.6,548],underbrace:[["leftbraceunder","midbraceunder","rightbraceunder"],1.6,548],underleftrightarrow:[["leftarrow","rightarrow"],.888,522],xleftrightarrow:[["leftarrow","rightarrow"],1.75,522],xLeftrightarrow:[["doubleleftarrow","doublerightarrow"],1.75,560],xrightleftharpoons:[["leftharpoondownplus","rightharpoonplus"],1.75,716],xleftrightharpoons:[["leftharpoonplus","rightharpoondownplus"],1.75,716],xhookleftarrow:[["leftarrow","righthook"],1.08,522],xhookrightarrow:[["lefthook","rightarrow"],1.08,522],overlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],underlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],overgroup:[["leftgroup","rightgroup"],.888,342],undergroup:[["leftgroupunder","rightgroupunder"],.888,342],xmapsto:[["leftmapsto","rightarrow"],1.5,522],xtofrom:[["leftToFrom","rightToFrom"],1.75,528],xrightleftarrows:[["baraboveleftarrow","rightarrowabovebar"],1.75,901],xrightequilibrium:[["baraboveshortleftharpoon","rightharpoonaboveshortbar"],1.75,716],xleftequilibrium:[["shortbaraboveleftharpoon","shortrightharpoonabovebar"],1.75,716]},Vbe=function(e){return e.type==="ordgroup"?e.body.length:1},Ube=function(e,n){function r(){var o=4e5,c=e.label.slice(1);if(["widehat","widecheck","widetilde","utilde"].includes(c)){var h=e,f=Vbe(h.base),m,g,x;if(f>5)c==="widehat"||c==="widecheck"?(m=420,o=2364,x=.42,g=c+"4"):(m=312,o=2340,x=.34,g="tilde4");else{var y=[1,1,2,2,3,3][f];c==="widehat"||c==="widecheck"?(o=[0,1062,2364,2364,2364][y],m=[0,239,300,360,420][y],x=[0,.24,.3,.3,.36,.42][y],g=c+y):(o=[0,600,1033,2339,2340][y],m=[0,260,286,306,312][y],x=[0,.26,.286,.3,.306,.34][y],g="tilde"+y)}var w=new Nc(g),S=new go([w],{width:"100%",height:We(x),viewBox:"0 0 "+o+" "+m,preserveAspectRatio:"none"});return{span:be.makeSvgSpan([],[S],n),minWidth:0,height:x}}else{var k=[],N=Hbe[c],[C,T,_]=N,E=_/1e3,M=C.length,L,P;if(M===1){var I=N[3];L=["hide-tail"],P=[I]}else if(M===2)L=["halfarrow-left","halfarrow-right"],P=["xMinYMin","xMaxYMin"];else if(M===3)L=["brace-left","brace-center","brace-right"],P=["xMinYMin","xMidYMin","xMaxYMin"];else throw new Error(`Correct katexImagesData or update code here to support + `+M+" children.");for(var Q=0;Q0&&(s.style.minWidth=We(i)),s},Wbe=function(e,n,r,s,i){var a,o=e.height+e.depth+r+s;if(/fbox|color|angl/.test(n)){if(a=be.makeSpan(["stretchy",n],[],i),n==="fbox"){var c=i.color&&i.getColor();c&&(a.style.borderColor=c)}}else{var h=[];/^[bx]cancel$/.test(n)&&h.push(new hk({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(n)&&h.push(new hk({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var f=new go(h,{width:"100%",height:We(o)});a=be.makeSvgSpan([],[f],i)}return a.height=o,a.style.height=We(o),a},vo={encloseSpan:Wbe,mathMLnode:Qbe,svgSpan:Ube};function Wt(t,e){if(!t||t.type!==e)throw new Error("Expected node of type "+e+", but got "+(t?"node of type "+t.type:String(t)));return t}function Kj(t){var e=Cy(t);if(!e)throw new Error("Expected node of symbol group type, but got "+(t?"node of type "+t.type:String(t)));return e}function Cy(t){return t&&(t.type==="atom"||vbe.hasOwnProperty(t.type))?t:null}var Zj=(t,e)=>{var n,r,s;t&&t.type==="supsub"?(r=Wt(t.base,"accent"),n=r.base,t.base=n,s=gbe(Cn(t,e)),t.base=r):(r=Wt(t,"accent"),n=r.base);var i=Cn(n,e.havingCrampedStyle()),a=r.isShifty&&Mn.isCharacterBox(n),o=0;if(a){var c=Mn.getBaseElem(n),h=Cn(c,e.havingCrampedStyle());o=eM(h).skew}var f=r.label==="\\c",m=f?i.height+i.depth:Math.min(i.height,e.fontMetrics().xHeight),g;if(r.isStretchy)g=vo.svgSpan(r,e),g=be.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"elem",elem:g,wrapperClasses:["svg-align"],wrapperStyle:o>0?{width:"calc(100% - "+We(2*o)+")",marginLeft:We(2*o)}:void 0}]},e);else{var x,y;r.label==="\\vec"?(x=be.staticSvg("vec",e),y=be.svgData.vec[1]):(x=be.makeOrd({mode:r.mode,text:r.label},e,"textord"),x=eM(x),x.italic=0,y=x.width,f&&(m+=x.depth)),g=be.makeSpan(["accent-body"],[x]);var w=r.label==="\\textcircled";w&&(g.classes.push("accent-full"),m=i.height);var S=o;w||(S-=y/2),g.style.left=We(S),r.label==="\\textcircled"&&(g.style.top=".2em"),g=be.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:-m},{type:"elem",elem:g}]},e)}var k=be.makeSpan(["mord","accent"],[g],e);return s?(s.children[0]=k,s.height=Math.max(k.height,s.height),s.classes[0]="mord",s):k},dQ=(t,e)=>{var n=t.isStretchy?vo.mathMLnode(t.label):new Fe.MathNode("mo",[da(t.label,t.mode)]),r=new Fe.MathNode("mover",[Kn(t.base,e),n]);return r.setAttribute("accent","true"),r},Gbe=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map(t=>"\\"+t).join("|"));et({type:"accent",names:["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring","\\widecheck","\\widehat","\\widetilde","\\overrightarrow","\\overleftarrow","\\Overrightarrow","\\overleftrightarrow","\\overgroup","\\overlinesegment","\\overleftharpoon","\\overrightharpoon"],props:{numArgs:1},handler:(t,e)=>{var n=mv(e[0]),r=!Gbe.test(t.funcName),s=!r||t.funcName==="\\widehat"||t.funcName==="\\widetilde"||t.funcName==="\\widecheck";return{type:"accent",mode:t.parser.mode,label:t.funcName,isStretchy:r,isShifty:s,base:n}},htmlBuilder:Zj,mathmlBuilder:dQ});et({type:"accent",names:["\\'","\\`","\\^","\\~","\\=","\\u","\\.",'\\"',"\\c","\\r","\\H","\\v","\\textcircled"],props:{numArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["primitive"]},handler:(t,e)=>{var n=e[0],r=t.parser.mode;return r==="math"&&(t.parser.settings.reportNonstrict("mathVsTextAccents","LaTeX's accent "+t.funcName+" works only in text mode"),r="text"),{type:"accent",mode:r,label:t.funcName,isStretchy:!1,isShifty:!0,base:n}},htmlBuilder:Zj,mathmlBuilder:dQ});et({type:"accentUnder",names:["\\underleftarrow","\\underrightarrow","\\underleftrightarrow","\\undergroup","\\underlinesegment","\\utilde"],props:{numArgs:1},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=e[0];return{type:"accentUnder",mode:n.mode,label:r,base:s}},htmlBuilder:(t,e)=>{var n=Cn(t.base,e),r=vo.svgSpan(t,e),s=t.label==="\\utilde"?.12:0,i=be.makeVList({positionType:"top",positionData:n.height,children:[{type:"elem",elem:r,wrapperClasses:["svg-align"]},{type:"kern",size:s},{type:"elem",elem:n}]},e);return be.makeSpan(["mord","accentunder"],[i],e)},mathmlBuilder:(t,e)=>{var n=vo.mathMLnode(t.label),r=new Fe.MathNode("munder",[Kn(t.base,e),n]);return r.setAttribute("accentunder","true"),r}});var zx=t=>{var e=new Fe.MathNode("mpadded",t?[t]:[]);return e.setAttribute("width","+0.6em"),e.setAttribute("lspace","0.3em"),e};et({type:"xArrow",names:["\\xleftarrow","\\xrightarrow","\\xLeftarrow","\\xRightarrow","\\xleftrightarrow","\\xLeftrightarrow","\\xhookleftarrow","\\xhookrightarrow","\\xmapsto","\\xrightharpoondown","\\xrightharpoonup","\\xleftharpoondown","\\xleftharpoonup","\\xrightleftharpoons","\\xleftrightharpoons","\\xlongequal","\\xtwoheadrightarrow","\\xtwoheadleftarrow","\\xtofrom","\\xrightleftarrows","\\xrightequilibrium","\\xleftequilibrium","\\\\cdrightarrow","\\\\cdleftarrow","\\\\cdlongequal"],props:{numArgs:1,numOptionalArgs:1},handler(t,e,n){var{parser:r,funcName:s}=t;return{type:"xArrow",mode:r.mode,label:s,body:e[0],below:n[0]}},htmlBuilder(t,e){var n=e.style,r=e.havingStyle(n.sup()),s=be.wrapFragment(Cn(t.body,r,e),e),i=t.label.slice(0,2)==="\\x"?"x":"cd";s.classes.push(i+"-arrow-pad");var a;t.below&&(r=e.havingStyle(n.sub()),a=be.wrapFragment(Cn(t.below,r,e),e),a.classes.push(i+"-arrow-pad"));var o=vo.svgSpan(t,e),c=-e.fontMetrics().axisHeight+.5*o.height,h=-e.fontMetrics().axisHeight-.5*o.height-.111;(s.depth>.25||t.label==="\\xleftequilibrium")&&(h-=s.depth);var f;if(a){var m=-e.fontMetrics().axisHeight+a.height+.5*o.height+.111;f=be.makeVList({positionType:"individualShift",children:[{type:"elem",elem:s,shift:h},{type:"elem",elem:o,shift:c},{type:"elem",elem:a,shift:m}]},e)}else f=be.makeVList({positionType:"individualShift",children:[{type:"elem",elem:s,shift:h},{type:"elem",elem:o,shift:c}]},e);return f.children[0].children[0].children[1].classes.push("svg-align"),be.makeSpan(["mrel","x-arrow"],[f],e)},mathmlBuilder(t,e){var n=vo.mathMLnode(t.label);n.setAttribute("minsize",t.label.charAt(0)==="x"?"1.75em":"3.0em");var r;if(t.body){var s=zx(Kn(t.body,e));if(t.below){var i=zx(Kn(t.below,e));r=new Fe.MathNode("munderover",[n,i,s])}else r=new Fe.MathNode("mover",[n,s])}else if(t.below){var a=zx(Kn(t.below,e));r=new Fe.MathNode("munder",[n,a])}else r=zx(),r=new Fe.MathNode("mover",[n,r]);return r}});var Xbe=be.makeSpan;function hQ(t,e){var n=es(t.body,e,!0);return Xbe([t.mclass],n,e)}function fQ(t,e){var n,r=fi(t.body,e);return t.mclass==="minner"?n=new Fe.MathNode("mpadded",r):t.mclass==="mord"?t.isCharacterBox?(n=r[0],n.type="mi"):n=new Fe.MathNode("mi",r):(t.isCharacterBox?(n=r[0],n.type="mo"):n=new Fe.MathNode("mo",r),t.mclass==="mbin"?(n.attributes.lspace="0.22em",n.attributes.rspace="0.22em"):t.mclass==="mpunct"?(n.attributes.lspace="0em",n.attributes.rspace="0.17em"):t.mclass==="mopen"||t.mclass==="mclose"?(n.attributes.lspace="0em",n.attributes.rspace="0em"):t.mclass==="minner"&&(n.attributes.lspace="0.0556em",n.attributes.width="+0.1111em")),n}et({type:"mclass",names:["\\mathord","\\mathbin","\\mathrel","\\mathopen","\\mathclose","\\mathpunct","\\mathinner"],props:{numArgs:1,primitive:!0},handler(t,e){var{parser:n,funcName:r}=t,s=e[0];return{type:"mclass",mode:n.mode,mclass:"m"+r.slice(5),body:Er(s),isCharacterBox:Mn.isCharacterBox(s)}},htmlBuilder:hQ,mathmlBuilder:fQ});var Ty=t=>{var e=t.type==="ordgroup"&&t.body.length?t.body[0]:t;return e.type==="atom"&&(e.family==="bin"||e.family==="rel")?"m"+e.family:"mord"};et({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler(t,e){var{parser:n}=t;return{type:"mclass",mode:n.mode,mclass:Ty(e[0]),body:Er(e[1]),isCharacterBox:Mn.isCharacterBox(e[1])}}});et({type:"mclass",names:["\\stackrel","\\overset","\\underset"],props:{numArgs:2},handler(t,e){var{parser:n,funcName:r}=t,s=e[1],i=e[0],a;r!=="\\stackrel"?a=Ty(s):a="mrel";var o={type:"op",mode:s.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:r!=="\\stackrel",body:Er(s)},c={type:"supsub",mode:i.mode,base:o,sup:r==="\\underset"?null:i,sub:r==="\\underset"?i:null};return{type:"mclass",mode:n.mode,mclass:a,body:[c],isCharacterBox:Mn.isCharacterBox(c)}},htmlBuilder:hQ,mathmlBuilder:fQ});et({type:"pmb",names:["\\pmb"],props:{numArgs:1,allowedInText:!0},handler(t,e){var{parser:n}=t;return{type:"pmb",mode:n.mode,mclass:Ty(e[0]),body:Er(e[0])}},htmlBuilder(t,e){var n=es(t.body,e,!0),r=be.makeSpan([t.mclass],n,e);return r.style.textShadow="0.02em 0.01em 0.04px",r},mathmlBuilder(t,e){var n=fi(t.body,e),r=new Fe.MathNode("mstyle",n);return r.setAttribute("style","text-shadow: 0.02em 0.01em 0.04px"),r}});var Ybe={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},oM=()=>({type:"styling",body:[],mode:"math",style:"display"}),cM=t=>t.type==="textord"&&t.text==="@",Kbe=(t,e)=>(t.type==="mathord"||t.type==="atom")&&t.text===e;function Zbe(t,e,n){var r=Ybe[t];switch(r){case"\\\\cdrightarrow":case"\\\\cdleftarrow":return n.callFunction(r,[e[0]],[e[1]]);case"\\uparrow":case"\\downarrow":{var s=n.callFunction("\\\\cdleft",[e[0]],[]),i={type:"atom",text:r,mode:"math",family:"rel"},a=n.callFunction("\\Big",[i],[]),o=n.callFunction("\\\\cdright",[e[1]],[]),c={type:"ordgroup",mode:"math",body:[s,a,o]};return n.callFunction("\\\\cdparent",[c],[])}case"\\\\cdlongequal":return n.callFunction("\\\\cdlongequal",[],[]);case"\\Vert":{var h={type:"textord",text:"\\Vert",mode:"math"};return n.callFunction("\\Big",[h],[])}default:return{type:"textord",text:" ",mode:"math"}}}function Jbe(t){var e=[];for(t.gullet.beginGroup(),t.gullet.macros.set("\\cr","\\\\\\relax"),t.gullet.beginGroup();;){e.push(t.parseExpression(!1,"\\\\")),t.gullet.endGroup(),t.gullet.beginGroup();var n=t.fetch().text;if(n==="&"||n==="\\\\")t.consume();else if(n==="\\end"){e[e.length-1].length===0&&e.pop();break}else throw new $e("Expected \\\\ or \\cr or \\end",t.nextToken)}for(var r=[],s=[r],i=0;i-1))if("<>AV".indexOf(h)>-1)for(var m=0;m<2;m++){for(var g=!0,x=c+1;xAV=|." after @',a[c]);var y=Zbe(h,f,t),w={type:"styling",body:[y],mode:"math",style:"display"};r.push(w),o=oM()}i%2===0?r.push(o):r.shift(),r=[],s.push(r)}t.gullet.endGroup(),t.gullet.endGroup();var S=new Array(s[0].length).fill({type:"align",align:"c",pregap:.25,postgap:.25});return{type:"array",mode:"math",body:s,arraystretch:1,addJot:!0,rowGaps:[null],cols:S,colSeparationType:"CD",hLinesBeforeRow:new Array(s.length+1).fill([])}}et({type:"cdlabel",names:["\\\\cdleft","\\\\cdright"],props:{numArgs:1},handler(t,e){var{parser:n,funcName:r}=t;return{type:"cdlabel",mode:n.mode,side:r.slice(4),label:e[0]}},htmlBuilder(t,e){var n=e.havingStyle(e.style.sup()),r=be.wrapFragment(Cn(t.label,n,e),e);return r.classes.push("cd-label-"+t.side),r.style.bottom=We(.8-r.depth),r.height=0,r.depth=0,r},mathmlBuilder(t,e){var n=new Fe.MathNode("mrow",[Kn(t.label,e)]);return n=new Fe.MathNode("mpadded",[n]),n.setAttribute("width","0"),t.side==="left"&&n.setAttribute("lspace","-1width"),n.setAttribute("voffset","0.7em"),n=new Fe.MathNode("mstyle",[n]),n.setAttribute("displaystyle","false"),n.setAttribute("scriptlevel","1"),n}});et({type:"cdlabelparent",names:["\\\\cdparent"],props:{numArgs:1},handler(t,e){var{parser:n}=t;return{type:"cdlabelparent",mode:n.mode,fragment:e[0]}},htmlBuilder(t,e){var n=be.wrapFragment(Cn(t.fragment,e),e);return n.classes.push("cd-vert-arrow"),n},mathmlBuilder(t,e){return new Fe.MathNode("mrow",[Kn(t.fragment,e)])}});et({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler(t,e){for(var{parser:n}=t,r=Wt(e[0],"ordgroup"),s=r.body,i="",a=0;a=1114111)throw new $e("\\@char with invalid code point "+i);return c<=65535?h=String.fromCharCode(c):(c-=65536,h=String.fromCharCode((c>>10)+55296,(c&1023)+56320)),{type:"textord",mode:n.mode,text:h}}});var mQ=(t,e)=>{var n=es(t.body,e.withColor(t.color),!1);return be.makeFragment(n)},pQ=(t,e)=>{var n=fi(t.body,e.withColor(t.color)),r=new Fe.MathNode("mstyle",n);return r.setAttribute("mathcolor",t.color),r};et({type:"color",names:["\\textcolor"],props:{numArgs:2,allowedInText:!0,argTypes:["color","original"]},handler(t,e){var{parser:n}=t,r=Wt(e[0],"color-token").color,s=e[1];return{type:"color",mode:n.mode,color:r,body:Er(s)}},htmlBuilder:mQ,mathmlBuilder:pQ});et({type:"color",names:["\\color"],props:{numArgs:1,allowedInText:!0,argTypes:["color"]},handler(t,e){var{parser:n,breakOnTokenText:r}=t,s=Wt(e[0],"color-token").color;n.gullet.macros.set("\\current@color",s);var i=n.parseExpression(!0,r);return{type:"color",mode:n.mode,color:s,body:i}},htmlBuilder:mQ,mathmlBuilder:pQ});et({type:"cr",names:["\\\\"],props:{numArgs:0,numOptionalArgs:0,allowedInText:!0},handler(t,e,n){var{parser:r}=t,s=r.gullet.future().text==="["?r.parseSizeGroup(!0):null,i=!r.settings.displayMode||!r.settings.useStrictBehavior("newLineInDisplayMode","In LaTeX, \\\\ or \\newline does nothing in display mode");return{type:"cr",mode:r.mode,newLine:i,size:s&&Wt(s,"size").value}},htmlBuilder(t,e){var n=be.makeSpan(["mspace"],[],e);return t.newLine&&(n.classes.push("newline"),t.size&&(n.style.marginTop=We(gr(t.size,e)))),n},mathmlBuilder(t,e){var n=new Fe.MathNode("mspace");return t.newLine&&(n.setAttribute("linebreak","newline"),t.size&&n.setAttribute("height",We(gr(t.size,e)))),n}});var gk={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},gQ=t=>{var e=t.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(e))throw new $e("Expected a control sequence",t);return e},e2e=t=>{var e=t.gullet.popToken();return e.text==="="&&(e=t.gullet.popToken(),e.text===" "&&(e=t.gullet.popToken())),e},xQ=(t,e,n,r)=>{var s=t.gullet.macros.get(n.text);s==null&&(n.noexpand=!0,s={tokens:[n],numArgs:0,unexpandable:!t.gullet.isExpandable(n.text)}),t.gullet.macros.set(e,s,r)};et({type:"internal",names:["\\global","\\long","\\\\globallong"],props:{numArgs:0,allowedInText:!0},handler(t){var{parser:e,funcName:n}=t;e.consumeSpaces();var r=e.fetch();if(gk[r.text])return(n==="\\global"||n==="\\\\globallong")&&(r.text=gk[r.text]),Wt(e.parseFunction(),"internal");throw new $e("Invalid token after macro prefix",r)}});et({type:"internal",names:["\\def","\\gdef","\\edef","\\xdef"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t){var{parser:e,funcName:n}=t,r=e.gullet.popToken(),s=r.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(s))throw new $e("Expected a control sequence",r);for(var i=0,a,o=[[]];e.gullet.future().text!=="{";)if(r=e.gullet.popToken(),r.text==="#"){if(e.gullet.future().text==="{"){a=e.gullet.future(),o[i].push("{");break}if(r=e.gullet.popToken(),!/^[1-9]$/.test(r.text))throw new $e('Invalid argument number "'+r.text+'"');if(parseInt(r.text)!==i+1)throw new $e('Argument number "'+r.text+'" out of order');i++,o.push([])}else{if(r.text==="EOF")throw new $e("Expected a macro definition");o[i].push(r.text)}var{tokens:c}=e.gullet.consumeArg();return a&&c.unshift(a),(n==="\\edef"||n==="\\xdef")&&(c=e.gullet.expandTokens(c),c.reverse()),e.gullet.macros.set(s,{tokens:c,numArgs:i,delimiters:o},n===gk[n]),{type:"internal",mode:e.mode}}});et({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t){var{parser:e,funcName:n}=t,r=gQ(e.gullet.popToken());e.gullet.consumeSpaces();var s=e2e(e);return xQ(e,r,s,n==="\\\\globallet"),{type:"internal",mode:e.mode}}});et({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t){var{parser:e,funcName:n}=t,r=gQ(e.gullet.popToken()),s=e.gullet.popToken(),i=e.gullet.popToken();return xQ(e,r,i,n==="\\\\globalfuture"),e.gullet.pushToken(i),e.gullet.pushToken(s),{type:"internal",mode:e.mode}}});var ym=function(e,n,r){var s=Jn.math[e]&&Jn.math[e].replace,i=Uj(s||e,n,r);if(!i)throw new Error("Unsupported symbol "+e+" and font size "+n+".");return i},Jj=function(e,n,r,s){var i=r.havingBaseStyle(n),a=be.makeSpan(s.concat(i.sizingClasses(r)),[e],r),o=i.sizeMultiplier/r.sizeMultiplier;return a.height*=o,a.depth*=o,a.maxFontSize=i.sizeMultiplier,a},vQ=function(e,n,r){var s=n.havingBaseStyle(r),i=(1-n.sizeMultiplier/s.sizeMultiplier)*n.fontMetrics().axisHeight;e.classes.push("delimcenter"),e.style.top=We(i),e.height-=i,e.depth+=i},t2e=function(e,n,r,s,i,a){var o=be.makeSymbol(e,"Main-Regular",i,s),c=Jj(o,n,s,a);return r&&vQ(c,s,n),c},n2e=function(e,n,r,s){return be.makeSymbol(e,"Size"+n+"-Regular",r,s)},yQ=function(e,n,r,s,i,a){var o=n2e(e,n,i,s),c=Jj(be.makeSpan(["delimsizing","size"+n],[o],s),St.TEXT,s,a);return r&&vQ(c,s,St.TEXT),c},E4=function(e,n,r){var s;n==="Size1-Regular"?s="delim-size1":s="delim-size4";var i=be.makeSpan(["delimsizinginner",s],[be.makeSpan([],[be.makeSymbol(e,n,r)])]);return{type:"elem",elem:i}},_4=function(e,n,r){var s=il["Size4-Regular"][e.charCodeAt(0)]?il["Size4-Regular"][e.charCodeAt(0)][4]:il["Size1-Regular"][e.charCodeAt(0)][4],i=new Nc("inner",lbe(e,Math.round(1e3*n))),a=new go([i],{width:We(s),height:We(n),style:"width:"+We(s),viewBox:"0 0 "+1e3*s+" "+Math.round(1e3*n),preserveAspectRatio:"xMinYMin"}),o=be.makeSvgSpan([],[a],r);return o.height=n,o.style.height=We(n),o.style.width=We(s),{type:"elem",elem:o}},xk=.008,Px={type:"kern",size:-1*xk},r2e=["|","\\lvert","\\rvert","\\vert"],s2e=["\\|","\\lVert","\\rVert","\\Vert"],bQ=function(e,n,r,s,i,a){var o,c,h,f,m="",g=0;o=h=f=e,c=null;var x="Size1-Regular";e==="\\uparrow"?h=f="⏐":e==="\\Uparrow"?h=f="‖":e==="\\downarrow"?o=h="⏐":e==="\\Downarrow"?o=h="‖":e==="\\updownarrow"?(o="\\uparrow",h="⏐",f="\\downarrow"):e==="\\Updownarrow"?(o="\\Uparrow",h="‖",f="\\Downarrow"):r2e.includes(e)?(h="∣",m="vert",g=333):s2e.includes(e)?(h="∥",m="doublevert",g=556):e==="["||e==="\\lbrack"?(o="⎡",h="⎢",f="⎣",x="Size4-Regular",m="lbrack",g=667):e==="]"||e==="\\rbrack"?(o="⎤",h="⎥",f="⎦",x="Size4-Regular",m="rbrack",g=667):e==="\\lfloor"||e==="⌊"?(h=o="⎢",f="⎣",x="Size4-Regular",m="lfloor",g=667):e==="\\lceil"||e==="⌈"?(o="⎡",h=f="⎢",x="Size4-Regular",m="lceil",g=667):e==="\\rfloor"||e==="⌋"?(h=o="⎥",f="⎦",x="Size4-Regular",m="rfloor",g=667):e==="\\rceil"||e==="⌉"?(o="⎤",h=f="⎥",x="Size4-Regular",m="rceil",g=667):e==="("||e==="\\lparen"?(o="⎛",h="⎜",f="⎝",x="Size4-Regular",m="lparen",g=875):e===")"||e==="\\rparen"?(o="⎞",h="⎟",f="⎠",x="Size4-Regular",m="rparen",g=875):e==="\\{"||e==="\\lbrace"?(o="⎧",c="⎨",f="⎩",h="⎪",x="Size4-Regular"):e==="\\}"||e==="\\rbrace"?(o="⎫",c="⎬",f="⎭",h="⎪",x="Size4-Regular"):e==="\\lgroup"||e==="⟮"?(o="⎧",f="⎩",h="⎪",x="Size4-Regular"):e==="\\rgroup"||e==="⟯"?(o="⎫",f="⎭",h="⎪",x="Size4-Regular"):e==="\\lmoustache"||e==="⎰"?(o="⎧",f="⎭",h="⎪",x="Size4-Regular"):(e==="\\rmoustache"||e==="⎱")&&(o="⎫",f="⎩",h="⎪",x="Size4-Regular");var y=ym(o,x,i),w=y.height+y.depth,S=ym(h,x,i),k=S.height+S.depth,N=ym(f,x,i),C=N.height+N.depth,T=0,_=1;if(c!==null){var E=ym(c,x,i);T=E.height+E.depth,_=2}var M=w+C+T,L=Math.max(0,Math.ceil((n-M)/(_*k))),P=M+L*_*k,I=s.fontMetrics().axisHeight;r&&(I*=s.sizeMultiplier);var Q=P/2-I,U=[];if(m.length>0){var ee=P-w-C,z=Math.round(P*1e3),H=obe(m,Math.round(ee*1e3)),B=new Nc(m,H),X=(g/1e3).toFixed(3)+"em",J=(z/1e3).toFixed(3)+"em",G=new go([B],{width:X,height:J,viewBox:"0 0 "+g+" "+z}),R=be.makeSvgSpan([],[G],s);R.height=z/1e3,R.style.width=X,R.style.height=J,U.push({type:"elem",elem:R})}else{if(U.push(E4(f,x,i)),U.push(Px),c===null){var se=P-w-C+2*xk;U.push(_4(h,se,s))}else{var W=(P-w-C-T)/2+2*xk;U.push(_4(h,W,s)),U.push(Px),U.push(E4(c,x,i)),U.push(Px),U.push(_4(h,W,s))}U.push(Px),U.push(E4(o,x,i))}var F=s.havingBaseStyle(St.TEXT),V=be.makeVList({positionType:"bottom",positionData:Q,children:U},F);return Jj(be.makeSpan(["delimsizing","mult"],[V],F),St.TEXT,s,a)},M4=80,A4=.08,R4=function(e,n,r,s,i){var a=abe(e,s,r),o=new Nc(e,a),c=new go([o],{width:"400em",height:We(n),viewBox:"0 0 400000 "+r,preserveAspectRatio:"xMinYMin slice"});return be.makeSvgSpan(["hide-tail"],[c],i)},i2e=function(e,n){var r=n.havingBaseSizing(),s=jQ("\\surd",e*r.sizeMultiplier,kQ,r),i=r.sizeMultiplier,a=Math.max(0,n.minRuleThickness-n.fontMetrics().sqrtRuleThickness),o,c=0,h=0,f=0,m;return s.type==="small"?(f=1e3+1e3*a+M4,e<1?i=1:e<1.4&&(i=.7),c=(1+a+A4)/i,h=(1+a)/i,o=R4("sqrtMain",c,f,a,n),o.style.minWidth="0.853em",m=.833/i):s.type==="large"?(f=(1e3+M4)*qm[s.size],h=(qm[s.size]+a)/i,c=(qm[s.size]+a+A4)/i,o=R4("sqrtSize"+s.size,c,f,a,n),o.style.minWidth="1.02em",m=1/i):(c=e+a+A4,h=e+a,f=Math.floor(1e3*e+a)+M4,o=R4("sqrtTall",c,f,a,n),o.style.minWidth="0.742em",m=1.056),o.height=h,o.style.height=We(c),{span:o,advanceWidth:m,ruleWidth:(n.fontMetrics().sqrtRuleThickness+a)*i}},wQ=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","\\surd"],a2e=["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱"],SQ=["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"],qm=[0,1.2,1.8,2.4,3],l2e=function(e,n,r,s,i){if(e==="<"||e==="\\lt"||e==="⟨"?e="\\langle":(e===">"||e==="\\gt"||e==="⟩")&&(e="\\rangle"),wQ.includes(e)||SQ.includes(e))return yQ(e,n,!1,r,s,i);if(a2e.includes(e))return bQ(e,qm[n],!1,r,s,i);throw new $e("Illegal delimiter: '"+e+"'")},o2e=[{type:"small",style:St.SCRIPTSCRIPT},{type:"small",style:St.SCRIPT},{type:"small",style:St.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],c2e=[{type:"small",style:St.SCRIPTSCRIPT},{type:"small",style:St.SCRIPT},{type:"small",style:St.TEXT},{type:"stack"}],kQ=[{type:"small",style:St.SCRIPTSCRIPT},{type:"small",style:St.SCRIPT},{type:"small",style:St.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],u2e=function(e){if(e.type==="small")return"Main-Regular";if(e.type==="large")return"Size"+e.size+"-Regular";if(e.type==="stack")return"Size4-Regular";throw new Error("Add support for delim type '"+e.type+"' here.")},jQ=function(e,n,r,s){for(var i=Math.min(2,3-s.style.size),a=i;an)return r[a]}return r[r.length-1]},OQ=function(e,n,r,s,i,a){e==="<"||e==="\\lt"||e==="⟨"?e="\\langle":(e===">"||e==="\\gt"||e==="⟩")&&(e="\\rangle");var o;SQ.includes(e)?o=o2e:wQ.includes(e)?o=kQ:o=c2e;var c=jQ(e,n,o,s);return c.type==="small"?t2e(e,c.style,r,s,i,a):c.type==="large"?yQ(e,c.size,r,s,i,a):bQ(e,n,r,s,i,a)},d2e=function(e,n,r,s,i,a){var o=s.fontMetrics().axisHeight*s.sizeMultiplier,c=901,h=5/s.fontMetrics().ptPerEm,f=Math.max(n-o,r+o),m=Math.max(f/500*c,2*f-h);return OQ(e,m,!0,s,i,a)},uo={sqrtImage:i2e,sizedDelim:l2e,sizeToMaxHeight:qm,customSizedDelim:OQ,leftRightDelim:d2e},uM={"\\bigl":{mclass:"mopen",size:1},"\\Bigl":{mclass:"mopen",size:2},"\\biggl":{mclass:"mopen",size:3},"\\Biggl":{mclass:"mopen",size:4},"\\bigr":{mclass:"mclose",size:1},"\\Bigr":{mclass:"mclose",size:2},"\\biggr":{mclass:"mclose",size:3},"\\Biggr":{mclass:"mclose",size:4},"\\bigm":{mclass:"mrel",size:1},"\\Bigm":{mclass:"mrel",size:2},"\\biggm":{mclass:"mrel",size:3},"\\Biggm":{mclass:"mrel",size:4},"\\big":{mclass:"mord",size:1},"\\Big":{mclass:"mord",size:2},"\\bigg":{mclass:"mord",size:3},"\\Bigg":{mclass:"mord",size:4}},h2e=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","<",">","\\langle","⟨","\\rangle","⟩","\\lt","\\gt","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱","/","\\backslash","|","\\vert","\\|","\\Vert","\\uparrow","\\Uparrow","\\downarrow","\\Downarrow","\\updownarrow","\\Updownarrow","."];function Ey(t,e){var n=Cy(t);if(n&&h2e.includes(n.text))return n;throw n?new $e("Invalid delimiter '"+n.text+"' after '"+e.funcName+"'",t):new $e("Invalid delimiter type '"+t.type+"'",t)}et({type:"delimsizing",names:["\\bigl","\\Bigl","\\biggl","\\Biggl","\\bigr","\\Bigr","\\biggr","\\Biggr","\\bigm","\\Bigm","\\biggm","\\Biggm","\\big","\\Big","\\bigg","\\Bigg"],props:{numArgs:1,argTypes:["primitive"]},handler:(t,e)=>{var n=Ey(e[0],t);return{type:"delimsizing",mode:t.parser.mode,size:uM[t.funcName].size,mclass:uM[t.funcName].mclass,delim:n.text}},htmlBuilder:(t,e)=>t.delim==="."?be.makeSpan([t.mclass]):uo.sizedDelim(t.delim,t.size,e,t.mode,[t.mclass]),mathmlBuilder:t=>{var e=[];t.delim!=="."&&e.push(da(t.delim,t.mode));var n=new Fe.MathNode("mo",e);t.mclass==="mopen"||t.mclass==="mclose"?n.setAttribute("fence","true"):n.setAttribute("fence","false"),n.setAttribute("stretchy","true");var r=We(uo.sizeToMaxHeight[t.size]);return n.setAttribute("minsize",r),n.setAttribute("maxsize",r),n}});function dM(t){if(!t.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}et({type:"leftright-right",names:["\\right"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var n=t.parser.gullet.macros.get("\\current@color");if(n&&typeof n!="string")throw new $e("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:t.parser.mode,delim:Ey(e[0],t).text,color:n}}});et({type:"leftright",names:["\\left"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var n=Ey(e[0],t),r=t.parser;++r.leftrightDepth;var s=r.parseExpression(!1);--r.leftrightDepth,r.expect("\\right",!1);var i=Wt(r.parseFunction(),"leftright-right");return{type:"leftright",mode:r.mode,body:s,left:n.text,right:i.delim,rightColor:i.color}},htmlBuilder:(t,e)=>{dM(t);for(var n=es(t.body,e,!0,["mopen","mclose"]),r=0,s=0,i=!1,a=0;a{dM(t);var n=fi(t.body,e);if(t.left!=="."){var r=new Fe.MathNode("mo",[da(t.left,t.mode)]);r.setAttribute("fence","true"),n.unshift(r)}if(t.right!=="."){var s=new Fe.MathNode("mo",[da(t.right,t.mode)]);s.setAttribute("fence","true"),t.rightColor&&s.setAttribute("mathcolor",t.rightColor),n.push(s)}return Xj(n)}});et({type:"middle",names:["\\middle"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var n=Ey(e[0],t);if(!t.parser.leftrightDepth)throw new $e("\\middle without preceding \\left",n);return{type:"middle",mode:t.parser.mode,delim:n.text}},htmlBuilder:(t,e)=>{var n;if(t.delim===".")n=k0(e,[]);else{n=uo.sizedDelim(t.delim,1,e,t.mode,[]);var r={delim:t.delim,options:e};n.isMiddle=r}return n},mathmlBuilder:(t,e)=>{var n=t.delim==="\\vert"||t.delim==="|"?da("|","text"):da(t.delim,t.mode),r=new Fe.MathNode("mo",[n]);return r.setAttribute("fence","true"),r.setAttribute("lspace","0.05em"),r.setAttribute("rspace","0.05em"),r}});var eO=(t,e)=>{var n=be.wrapFragment(Cn(t.body,e),e),r=t.label.slice(1),s=e.sizeMultiplier,i,a=0,o=Mn.isCharacterBox(t.body);if(r==="sout")i=be.makeSpan(["stretchy","sout"]),i.height=e.fontMetrics().defaultRuleThickness/s,a=-.5*e.fontMetrics().xHeight;else if(r==="phase"){var c=gr({number:.6,unit:"pt"},e),h=gr({number:.35,unit:"ex"},e),f=e.havingBaseSizing();s=s/f.sizeMultiplier;var m=n.height+n.depth+c+h;n.style.paddingLeft=We(m/2+c);var g=Math.floor(1e3*m*s),x=sbe(g),y=new go([new Nc("phase",x)],{width:"400em",height:We(g/1e3),viewBox:"0 0 400000 "+g,preserveAspectRatio:"xMinYMin slice"});i=be.makeSvgSpan(["hide-tail"],[y],e),i.style.height=We(m),a=n.depth+c+h}else{/cancel/.test(r)?o||n.classes.push("cancel-pad"):r==="angl"?n.classes.push("anglpad"):n.classes.push("boxpad");var w=0,S=0,k=0;/box/.test(r)?(k=Math.max(e.fontMetrics().fboxrule,e.minRuleThickness),w=e.fontMetrics().fboxsep+(r==="colorbox"?0:k),S=w):r==="angl"?(k=Math.max(e.fontMetrics().defaultRuleThickness,e.minRuleThickness),w=4*k,S=Math.max(0,.25-n.depth)):(w=o?.2:0,S=w),i=vo.encloseSpan(n,r,w,S,e),/fbox|boxed|fcolorbox/.test(r)?(i.style.borderStyle="solid",i.style.borderWidth=We(k)):r==="angl"&&k!==.049&&(i.style.borderTopWidth=We(k),i.style.borderRightWidth=We(k)),a=n.depth+S,t.backgroundColor&&(i.style.backgroundColor=t.backgroundColor,t.borderColor&&(i.style.borderColor=t.borderColor))}var N;if(t.backgroundColor)N=be.makeVList({positionType:"individualShift",children:[{type:"elem",elem:i,shift:a},{type:"elem",elem:n,shift:0}]},e);else{var C=/cancel|phase/.test(r)?["svg-align"]:[];N=be.makeVList({positionType:"individualShift",children:[{type:"elem",elem:n,shift:0},{type:"elem",elem:i,shift:a,wrapperClasses:C}]},e)}return/cancel/.test(r)&&(N.height=n.height,N.depth=n.depth),/cancel/.test(r)&&!o?be.makeSpan(["mord","cancel-lap"],[N],e):be.makeSpan(["mord"],[N],e)},tO=(t,e)=>{var n=0,r=new Fe.MathNode(t.label.indexOf("colorbox")>-1?"mpadded":"menclose",[Kn(t.body,e)]);switch(t.label){case"\\cancel":r.setAttribute("notation","updiagonalstrike");break;case"\\bcancel":r.setAttribute("notation","downdiagonalstrike");break;case"\\phase":r.setAttribute("notation","phasorangle");break;case"\\sout":r.setAttribute("notation","horizontalstrike");break;case"\\fbox":r.setAttribute("notation","box");break;case"\\angl":r.setAttribute("notation","actuarial");break;case"\\fcolorbox":case"\\colorbox":if(n=e.fontMetrics().fboxsep*e.fontMetrics().ptPerEm,r.setAttribute("width","+"+2*n+"pt"),r.setAttribute("height","+"+2*n+"pt"),r.setAttribute("lspace",n+"pt"),r.setAttribute("voffset",n+"pt"),t.label==="\\fcolorbox"){var s=Math.max(e.fontMetrics().fboxrule,e.minRuleThickness);r.setAttribute("style","border: "+s+"em solid "+String(t.borderColor))}break;case"\\xcancel":r.setAttribute("notation","updiagonalstrike downdiagonalstrike");break}return t.backgroundColor&&r.setAttribute("mathbackground",t.backgroundColor),r};et({type:"enclose",names:["\\colorbox"],props:{numArgs:2,allowedInText:!0,argTypes:["color","text"]},handler(t,e,n){var{parser:r,funcName:s}=t,i=Wt(e[0],"color-token").color,a=e[1];return{type:"enclose",mode:r.mode,label:s,backgroundColor:i,body:a}},htmlBuilder:eO,mathmlBuilder:tO});et({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,allowedInText:!0,argTypes:["color","color","text"]},handler(t,e,n){var{parser:r,funcName:s}=t,i=Wt(e[0],"color-token").color,a=Wt(e[1],"color-token").color,o=e[2];return{type:"enclose",mode:r.mode,label:s,backgroundColor:a,borderColor:i,body:o}},htmlBuilder:eO,mathmlBuilder:tO});et({type:"enclose",names:["\\fbox"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!0},handler(t,e){var{parser:n}=t;return{type:"enclose",mode:n.mode,label:"\\fbox",body:e[0]}}});et({type:"enclose",names:["\\cancel","\\bcancel","\\xcancel","\\sout","\\phase"],props:{numArgs:1},handler(t,e){var{parser:n,funcName:r}=t,s=e[0];return{type:"enclose",mode:n.mode,label:r,body:s}},htmlBuilder:eO,mathmlBuilder:tO});et({type:"enclose",names:["\\angl"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!1},handler(t,e){var{parser:n}=t;return{type:"enclose",mode:n.mode,label:"\\angl",body:e[0]}}});var NQ={};function yl(t){for(var{type:e,names:n,props:r,handler:s,htmlBuilder:i,mathmlBuilder:a}=t,o={type:e,numArgs:r.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:s},c=0;c{var e=t.parser.settings;if(!e.displayMode)throw new $e("{"+t.envName+"} can be used only in display mode.")};function nO(t){if(t.indexOf("ed")===-1)return t.indexOf("*")===-1}function Pc(t,e,n){var{hskipBeforeAndAfter:r,addJot:s,cols:i,arraystretch:a,colSeparationType:o,autoTag:c,singleRow:h,emptySingleRow:f,maxNumCols:m,leqno:g}=e;if(t.gullet.beginGroup(),h||t.gullet.macros.set("\\cr","\\\\\\relax"),!a){var x=t.gullet.expandMacroAsText("\\arraystretch");if(x==null)a=1;else if(a=parseFloat(x),!a||a<0)throw new $e("Invalid \\arraystretch: "+x)}t.gullet.beginGroup();var y=[],w=[y],S=[],k=[],N=c!=null?[]:void 0;function C(){c&&t.gullet.macros.set("\\@eqnsw","1",!0)}function T(){N&&(t.gullet.macros.get("\\df@tag")?(N.push(t.subparse([new Ri("\\df@tag")])),t.gullet.macros.set("\\df@tag",void 0,!0)):N.push(!!c&&t.gullet.macros.get("\\@eqnsw")==="1"))}for(C(),k.push(hM(t));;){var _=t.parseExpression(!1,h?"\\end":"\\\\");t.gullet.endGroup(),t.gullet.beginGroup(),_={type:"ordgroup",mode:t.mode,body:_},n&&(_={type:"styling",mode:t.mode,style:n,body:[_]}),y.push(_);var E=t.fetch().text;if(E==="&"){if(m&&y.length===m){if(h||o)throw new $e("Too many tab characters: &",t.nextToken);t.settings.reportNonstrict("textEnv","Too few columns specified in the {array} column argument.")}t.consume()}else if(E==="\\end"){T(),y.length===1&&_.type==="styling"&&_.body[0].body.length===0&&(w.length>1||!f)&&w.pop(),k.length0&&(C+=.25),h.push({pos:C,isDashed:Be[ut]})}for(T(a[0]),r=0;r0&&(Q+=N,MBe))for(r=0;r=o)){var K=void 0;(s>0||e.hskipBeforeAndAfter)&&(K=Mn.deflt(W.pregap,g),K!==0&&(H=be.makeSpan(["arraycolsep"],[]),H.style.width=We(K),z.push(H)));var ie=[];for(r=0;r0){for(var Ue=be.makeLineSpan("hline",n,f),Xe=be.makeLineSpan("hdashline",n,f),Ze=[{type:"elem",elem:c,shift:0}];h.length>0;){var Oe=h.pop(),He=Oe.pos-U;Oe.isDashed?Ze.push({type:"elem",elem:Xe,shift:He}):Ze.push({type:"elem",elem:Ue,shift:He})}c=be.makeVList({positionType:"individualShift",children:Ze},n)}if(X.length===0)return be.makeSpan(["mord"],[c],n);var Ve=be.makeVList({positionType:"individualShift",children:X},n);return Ve=be.makeSpan(["tag"],[Ve],n),be.makeFragment([c,Ve])},f2e={c:"center ",l:"left ",r:"right "},wl=function(e,n){for(var r=[],s=new Fe.MathNode("mtd",[],["mtr-glue"]),i=new Fe.MathNode("mtd",[],["mml-eqn-num"]),a=0;a0){var y=e.cols,w="",S=!1,k=0,N=y.length;y[0].type==="separator"&&(g+="top ",k=1),y[y.length-1].type==="separator"&&(g+="bottom ",N-=1);for(var C=k;C0?"left ":"",g+=L[L.length-1].length>0?"right ":"";for(var P=1;P-1?"alignat":"align",i=e.envName==="split",a=Pc(e.parser,{cols:r,addJot:!0,autoTag:i?void 0:nO(e.envName),emptySingleRow:!0,colSeparationType:s,maxNumCols:i?2:void 0,leqno:e.parser.settings.leqno},"display"),o,c=0,h={type:"ordgroup",mode:e.mode,body:[]};if(n[0]&&n[0].type==="ordgroup"){for(var f="",m=0;m0&&x&&(S=1),r[y]={type:"align",align:w,pregap:S,postgap:0}}return a.colSeparationType=x?"align":"alignat",a};yl({type:"array",names:["array","darray"],props:{numArgs:1},handler(t,e){var n=Cy(e[0]),r=n?[e[0]]:Wt(e[0],"ordgroup").body,s=r.map(function(a){var o=Kj(a),c=o.text;if("lcr".indexOf(c)!==-1)return{type:"align",align:c};if(c==="|")return{type:"separator",separator:"|"};if(c===":")return{type:"separator",separator:":"};throw new $e("Unknown column alignment: "+c,a)}),i={cols:s,hskipBeforeAndAfter:!0,maxNumCols:s.length};return Pc(t.parser,i,rO(t.envName))},htmlBuilder:bl,mathmlBuilder:wl});yl({type:"array",names:["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","matrix*","pmatrix*","bmatrix*","Bmatrix*","vmatrix*","Vmatrix*"],props:{numArgs:0},handler(t){var e={matrix:null,pmatrix:["(",")"],bmatrix:["[","]"],Bmatrix:["\\{","\\}"],vmatrix:["|","|"],Vmatrix:["\\Vert","\\Vert"]}[t.envName.replace("*","")],n="c",r={hskipBeforeAndAfter:!1,cols:[{type:"align",align:n}]};if(t.envName.charAt(t.envName.length-1)==="*"){var s=t.parser;if(s.consumeSpaces(),s.fetch().text==="["){if(s.consume(),s.consumeSpaces(),n=s.fetch().text,"lcr".indexOf(n)===-1)throw new $e("Expected l or c or r",s.nextToken);s.consume(),s.consumeSpaces(),s.expect("]"),s.consume(),r.cols=[{type:"align",align:n}]}}var i=Pc(t.parser,r,rO(t.envName)),a=Math.max(0,...i.body.map(o=>o.length));return i.cols=new Array(a).fill({type:"align",align:n}),e?{type:"leftright",mode:t.mode,body:[i],left:e[0],right:e[1],rightColor:void 0}:i},htmlBuilder:bl,mathmlBuilder:wl});yl({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(t){var e={arraystretch:.5},n=Pc(t.parser,e,"script");return n.colSeparationType="small",n},htmlBuilder:bl,mathmlBuilder:wl});yl({type:"array",names:["subarray"],props:{numArgs:1},handler(t,e){var n=Cy(e[0]),r=n?[e[0]]:Wt(e[0],"ordgroup").body,s=r.map(function(a){var o=Kj(a),c=o.text;if("lc".indexOf(c)!==-1)return{type:"align",align:c};throw new $e("Unknown column alignment: "+c,a)});if(s.length>1)throw new $e("{subarray} can contain only one column");var i={cols:s,hskipBeforeAndAfter:!1,arraystretch:.5};if(i=Pc(t.parser,i,"script"),i.body.length>0&&i.body[0].length>1)throw new $e("{subarray} can contain only one column");return i},htmlBuilder:bl,mathmlBuilder:wl});yl({type:"array",names:["cases","dcases","rcases","drcases"],props:{numArgs:0},handler(t){var e={arraystretch:1.2,cols:[{type:"align",align:"l",pregap:0,postgap:1},{type:"align",align:"l",pregap:0,postgap:0}]},n=Pc(t.parser,e,rO(t.envName));return{type:"leftright",mode:t.mode,body:[n],left:t.envName.indexOf("r")>-1?".":"\\{",right:t.envName.indexOf("r")>-1?"\\}":".",rightColor:void 0}},htmlBuilder:bl,mathmlBuilder:wl});yl({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:TQ,htmlBuilder:bl,mathmlBuilder:wl});yl({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(t){["gather","gather*"].includes(t.envName)&&_y(t);var e={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",autoTag:nO(t.envName),emptySingleRow:!0,leqno:t.parser.settings.leqno};return Pc(t.parser,e,"display")},htmlBuilder:bl,mathmlBuilder:wl});yl({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:TQ,htmlBuilder:bl,mathmlBuilder:wl});yl({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(t){_y(t);var e={autoTag:nO(t.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:t.parser.settings.leqno};return Pc(t.parser,e,"display")},htmlBuilder:bl,mathmlBuilder:wl});yl({type:"array",names:["CD"],props:{numArgs:0},handler(t){return _y(t),Jbe(t.parser)},htmlBuilder:bl,mathmlBuilder:wl});Z("\\nonumber","\\gdef\\@eqnsw{0}");Z("\\notag","\\nonumber");et({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(t,e){throw new $e(t.funcName+" valid only within array environment")}});var fM=NQ;et({type:"environment",names:["\\begin","\\end"],props:{numArgs:1,argTypes:["text"]},handler(t,e){var{parser:n,funcName:r}=t,s=e[0];if(s.type!=="ordgroup")throw new $e("Invalid environment name",s);for(var i="",a=0;a{var n=t.font,r=e.withFont(n);return Cn(t.body,r)},_Q=(t,e)=>{var n=t.font,r=e.withFont(n);return Kn(t.body,r)},mM={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak","\\bm":"\\boldsymbol"};et({type:"font",names:["\\mathrm","\\mathit","\\mathbf","\\mathnormal","\\mathsfit","\\mathbb","\\mathcal","\\mathfrak","\\mathscr","\\mathsf","\\mathtt","\\Bbb","\\bold","\\frak"],props:{numArgs:1,allowedInArgument:!0},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=mv(e[0]),i=r;return i in mM&&(i=mM[i]),{type:"font",mode:n.mode,font:i.slice(1),body:s}},htmlBuilder:EQ,mathmlBuilder:_Q});et({type:"mclass",names:["\\boldsymbol","\\bm"],props:{numArgs:1},handler:(t,e)=>{var{parser:n}=t,r=e[0],s=Mn.isCharacterBox(r);return{type:"mclass",mode:n.mode,mclass:Ty(r),body:[{type:"font",mode:n.mode,font:"boldsymbol",body:r}],isCharacterBox:s}}});et({type:"font",names:["\\rm","\\sf","\\tt","\\bf","\\it","\\cal"],props:{numArgs:0,allowedInText:!0},handler:(t,e)=>{var{parser:n,funcName:r,breakOnTokenText:s}=t,{mode:i}=n,a=n.parseExpression(!0,s),o="math"+r.slice(1);return{type:"font",mode:i,font:o,body:{type:"ordgroup",mode:n.mode,body:a}}},htmlBuilder:EQ,mathmlBuilder:_Q});var MQ=(t,e)=>{var n=e;return t==="display"?n=n.id>=St.SCRIPT.id?n.text():St.DISPLAY:t==="text"&&n.size===St.DISPLAY.size?n=St.TEXT:t==="script"?n=St.SCRIPT:t==="scriptscript"&&(n=St.SCRIPTSCRIPT),n},sO=(t,e)=>{var n=MQ(t.size,e.style),r=n.fracNum(),s=n.fracDen(),i;i=e.havingStyle(r);var a=Cn(t.numer,i,e);if(t.continued){var o=8.5/e.fontMetrics().ptPerEm,c=3.5/e.fontMetrics().ptPerEm;a.height=a.height0?y=3*g:y=7*g,w=e.fontMetrics().denom1):(m>0?(x=e.fontMetrics().num2,y=g):(x=e.fontMetrics().num3,y=3*g),w=e.fontMetrics().denom2);var S;if(f){var N=e.fontMetrics().axisHeight;x-a.depth-(N+.5*m){var n=new Fe.MathNode("mfrac",[Kn(t.numer,e),Kn(t.denom,e)]);if(!t.hasBarLine)n.setAttribute("linethickness","0px");else if(t.barSize){var r=gr(t.barSize,e);n.setAttribute("linethickness",We(r))}var s=MQ(t.size,e.style);if(s.size!==e.style.size){n=new Fe.MathNode("mstyle",[n]);var i=s.size===St.DISPLAY.size?"true":"false";n.setAttribute("displaystyle",i),n.setAttribute("scriptlevel","0")}if(t.leftDelim!=null||t.rightDelim!=null){var a=[];if(t.leftDelim!=null){var o=new Fe.MathNode("mo",[new Fe.TextNode(t.leftDelim.replace("\\",""))]);o.setAttribute("fence","true"),a.push(o)}if(a.push(n),t.rightDelim!=null){var c=new Fe.MathNode("mo",[new Fe.TextNode(t.rightDelim.replace("\\",""))]);c.setAttribute("fence","true"),a.push(c)}return Xj(a)}return n};et({type:"genfrac",names:["\\dfrac","\\frac","\\tfrac","\\dbinom","\\binom","\\tbinom","\\\\atopfrac","\\\\bracefrac","\\\\brackfrac"],props:{numArgs:2,allowedInArgument:!0},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=e[0],i=e[1],a,o=null,c=null,h="auto";switch(r){case"\\dfrac":case"\\frac":case"\\tfrac":a=!0;break;case"\\\\atopfrac":a=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":a=!1,o="(",c=")";break;case"\\\\bracefrac":a=!1,o="\\{",c="\\}";break;case"\\\\brackfrac":a=!1,o="[",c="]";break;default:throw new Error("Unrecognized genfrac command")}switch(r){case"\\dfrac":case"\\dbinom":h="display";break;case"\\tfrac":case"\\tbinom":h="text";break}return{type:"genfrac",mode:n.mode,continued:!1,numer:s,denom:i,hasBarLine:a,leftDelim:o,rightDelim:c,size:h,barSize:null}},htmlBuilder:sO,mathmlBuilder:iO});et({type:"genfrac",names:["\\cfrac"],props:{numArgs:2},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=e[0],i=e[1];return{type:"genfrac",mode:n.mode,continued:!0,numer:s,denom:i,hasBarLine:!0,leftDelim:null,rightDelim:null,size:"display",barSize:null}}});et({type:"infix",names:["\\over","\\choose","\\atop","\\brace","\\brack"],props:{numArgs:0,infix:!0},handler(t){var{parser:e,funcName:n,token:r}=t,s;switch(n){case"\\over":s="\\frac";break;case"\\choose":s="\\binom";break;case"\\atop":s="\\\\atopfrac";break;case"\\brace":s="\\\\bracefrac";break;case"\\brack":s="\\\\brackfrac";break;default:throw new Error("Unrecognized infix genfrac command")}return{type:"infix",mode:e.mode,replaceWith:s,token:r}}});var pM=["display","text","script","scriptscript"],gM=function(e){var n=null;return e.length>0&&(n=e,n=n==="."?null:n),n};et({type:"genfrac",names:["\\genfrac"],props:{numArgs:6,allowedInArgument:!0,argTypes:["math","math","size","text","math","math"]},handler(t,e){var{parser:n}=t,r=e[4],s=e[5],i=mv(e[0]),a=i.type==="atom"&&i.family==="open"?gM(i.text):null,o=mv(e[1]),c=o.type==="atom"&&o.family==="close"?gM(o.text):null,h=Wt(e[2],"size"),f,m=null;h.isBlank?f=!0:(m=h.value,f=m.number>0);var g="auto",x=e[3];if(x.type==="ordgroup"){if(x.body.length>0){var y=Wt(x.body[0],"textord");g=pM[Number(y.text)]}}else x=Wt(x,"textord"),g=pM[Number(x.text)];return{type:"genfrac",mode:n.mode,numer:r,denom:s,continued:!1,hasBarLine:f,barSize:m,leftDelim:a,rightDelim:c,size:g}},htmlBuilder:sO,mathmlBuilder:iO});et({type:"infix",names:["\\above"],props:{numArgs:1,argTypes:["size"],infix:!0},handler(t,e){var{parser:n,funcName:r,token:s}=t;return{type:"infix",mode:n.mode,replaceWith:"\\\\abovefrac",size:Wt(e[0],"size").value,token:s}}});et({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=e[0],i=Qye(Wt(e[1],"infix").size),a=e[2],o=i.number>0;return{type:"genfrac",mode:n.mode,numer:s,denom:a,continued:!1,hasBarLine:o,barSize:i,leftDelim:null,rightDelim:null,size:"auto"}},htmlBuilder:sO,mathmlBuilder:iO});var AQ=(t,e)=>{var n=e.style,r,s;t.type==="supsub"?(r=t.sup?Cn(t.sup,e.havingStyle(n.sup()),e):Cn(t.sub,e.havingStyle(n.sub()),e),s=Wt(t.base,"horizBrace")):s=Wt(t,"horizBrace");var i=Cn(s.base,e.havingBaseStyle(St.DISPLAY)),a=vo.svgSpan(s,e),o;if(s.isOver?(o=be.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:.1},{type:"elem",elem:a}]},e),o.children[0].children[0].children[1].classes.push("svg-align")):(o=be.makeVList({positionType:"bottom",positionData:i.depth+.1+a.height,children:[{type:"elem",elem:a},{type:"kern",size:.1},{type:"elem",elem:i}]},e),o.children[0].children[0].children[0].classes.push("svg-align")),r){var c=be.makeSpan(["mord",s.isOver?"mover":"munder"],[o],e);s.isOver?o=be.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:c},{type:"kern",size:.2},{type:"elem",elem:r}]},e):o=be.makeVList({positionType:"bottom",positionData:c.depth+.2+r.height+r.depth,children:[{type:"elem",elem:r},{type:"kern",size:.2},{type:"elem",elem:c}]},e)}return be.makeSpan(["mord",s.isOver?"mover":"munder"],[o],e)},m2e=(t,e)=>{var n=vo.mathMLnode(t.label);return new Fe.MathNode(t.isOver?"mover":"munder",[Kn(t.base,e),n])};et({type:"horizBrace",names:["\\overbrace","\\underbrace"],props:{numArgs:1},handler(t,e){var{parser:n,funcName:r}=t;return{type:"horizBrace",mode:n.mode,label:r,isOver:/^\\over/.test(r),base:e[0]}},htmlBuilder:AQ,mathmlBuilder:m2e});et({type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=e[1],s=Wt(e[0],"url").url;return n.settings.isTrusted({command:"\\href",url:s})?{type:"href",mode:n.mode,href:s,body:Er(r)}:n.formatUnsupportedCmd("\\href")},htmlBuilder:(t,e)=>{var n=es(t.body,e,!1);return be.makeAnchor(t.href,[],n,e)},mathmlBuilder:(t,e)=>{var n=Cc(t.body,e);return n instanceof Ti||(n=new Ti("mrow",[n])),n.setAttribute("href",t.href),n}});et({type:"href",names:["\\url"],props:{numArgs:1,argTypes:["url"],allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=Wt(e[0],"url").url;if(!n.settings.isTrusted({command:"\\url",url:r}))return n.formatUnsupportedCmd("\\url");for(var s=[],i=0;i{var{parser:n,funcName:r,token:s}=t,i=Wt(e[0],"raw").string,a=e[1];n.settings.strict&&n.settings.reportNonstrict("htmlExtension","HTML extension is disabled on strict mode");var o,c={};switch(r){case"\\htmlClass":c.class=i,o={command:"\\htmlClass",class:i};break;case"\\htmlId":c.id=i,o={command:"\\htmlId",id:i};break;case"\\htmlStyle":c.style=i,o={command:"\\htmlStyle",style:i};break;case"\\htmlData":{for(var h=i.split(","),f=0;f{var n=es(t.body,e,!1),r=["enclosing"];t.attributes.class&&r.push(...t.attributes.class.trim().split(/\s+/));var s=be.makeSpan(r,n,e);for(var i in t.attributes)i!=="class"&&t.attributes.hasOwnProperty(i)&&s.setAttribute(i,t.attributes[i]);return s},mathmlBuilder:(t,e)=>Cc(t.body,e)});et({type:"htmlmathml",names:["\\html@mathml"],props:{numArgs:2,allowedInText:!0},handler:(t,e)=>{var{parser:n}=t;return{type:"htmlmathml",mode:n.mode,html:Er(e[0]),mathml:Er(e[1])}},htmlBuilder:(t,e)=>{var n=es(t.html,e,!1);return be.makeFragment(n)},mathmlBuilder:(t,e)=>Cc(t.mathml,e)});var D4=function(e){if(/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(e))return{number:+e,unit:"bp"};var n=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(e);if(!n)throw new $e("Invalid size: '"+e+"' in \\includegraphics");var r={number:+(n[1]+n[2]),unit:n[3]};if(!K$(r))throw new $e("Invalid unit: '"+r.unit+"' in \\includegraphics.");return r};et({type:"includegraphics",names:["\\includegraphics"],props:{numArgs:1,numOptionalArgs:1,argTypes:["raw","url"],allowedInText:!1},handler:(t,e,n)=>{var{parser:r}=t,s={number:0,unit:"em"},i={number:.9,unit:"em"},a={number:0,unit:"em"},o="";if(n[0])for(var c=Wt(n[0],"raw").string,h=c.split(","),f=0;f{var n=gr(t.height,e),r=0;t.totalheight.number>0&&(r=gr(t.totalheight,e)-n);var s=0;t.width.number>0&&(s=gr(t.width,e));var i={height:We(n+r)};s>0&&(i.width=We(s)),r>0&&(i.verticalAlign=We(-r));var a=new mbe(t.src,t.alt,i);return a.height=n,a.depth=r,a},mathmlBuilder:(t,e)=>{var n=new Fe.MathNode("mglyph",[]);n.setAttribute("alt",t.alt);var r=gr(t.height,e),s=0;if(t.totalheight.number>0&&(s=gr(t.totalheight,e)-r,n.setAttribute("valign",We(-s))),n.setAttribute("height",We(r+s)),t.width.number>0){var i=gr(t.width,e);n.setAttribute("width",We(i))}return n.setAttribute("src",t.src),n}});et({type:"kern",names:["\\kern","\\mkern","\\hskip","\\mskip"],props:{numArgs:1,argTypes:["size"],primitive:!0,allowedInText:!0},handler(t,e){var{parser:n,funcName:r}=t,s=Wt(e[0],"size");if(n.settings.strict){var i=r[1]==="m",a=s.value.unit==="mu";i?(a||n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" supports only mu units, "+("not "+s.value.unit+" units")),n.mode!=="math"&&n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" works only in math mode")):a&&n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" doesn't support mu units")}return{type:"kern",mode:n.mode,dimension:s.value}},htmlBuilder(t,e){return be.makeGlue(t.dimension,e)},mathmlBuilder(t,e){var n=gr(t.dimension,e);return new Fe.SpaceNode(n)}});et({type:"lap",names:["\\mathllap","\\mathrlap","\\mathclap"],props:{numArgs:1,allowedInText:!0},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=e[0];return{type:"lap",mode:n.mode,alignment:r.slice(5),body:s}},htmlBuilder:(t,e)=>{var n;t.alignment==="clap"?(n=be.makeSpan([],[Cn(t.body,e)]),n=be.makeSpan(["inner"],[n],e)):n=be.makeSpan(["inner"],[Cn(t.body,e)]);var r=be.makeSpan(["fix"],[]),s=be.makeSpan([t.alignment],[n,r],e),i=be.makeSpan(["strut"]);return i.style.height=We(s.height+s.depth),s.depth&&(i.style.verticalAlign=We(-s.depth)),s.children.unshift(i),s=be.makeSpan(["thinbox"],[s],e),be.makeSpan(["mord","vbox"],[s],e)},mathmlBuilder:(t,e)=>{var n=new Fe.MathNode("mpadded",[Kn(t.body,e)]);if(t.alignment!=="rlap"){var r=t.alignment==="llap"?"-1":"-0.5";n.setAttribute("lspace",r+"width")}return n.setAttribute("width","0px"),n}});et({type:"styling",names:["\\(","$"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(t,e){var{funcName:n,parser:r}=t,s=r.mode;r.switchMode("math");var i=n==="\\("?"\\)":"$",a=r.parseExpression(!1,i);return r.expect(i),r.switchMode(s),{type:"styling",mode:r.mode,style:"text",body:a}}});et({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(t,e){throw new $e("Mismatched "+t.funcName)}});var xM=(t,e)=>{switch(e.style.size){case St.DISPLAY.size:return t.display;case St.TEXT.size:return t.text;case St.SCRIPT.size:return t.script;case St.SCRIPTSCRIPT.size:return t.scriptscript;default:return t.text}};et({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:(t,e)=>{var{parser:n}=t;return{type:"mathchoice",mode:n.mode,display:Er(e[0]),text:Er(e[1]),script:Er(e[2]),scriptscript:Er(e[3])}},htmlBuilder:(t,e)=>{var n=xM(t,e),r=es(n,e,!1);return be.makeFragment(r)},mathmlBuilder:(t,e)=>{var n=xM(t,e);return Cc(n,e)}});var RQ=(t,e,n,r,s,i,a)=>{t=be.makeSpan([],[t]);var o=n&&Mn.isCharacterBox(n),c,h;if(e){var f=Cn(e,r.havingStyle(s.sup()),r);h={elem:f,kern:Math.max(r.fontMetrics().bigOpSpacing1,r.fontMetrics().bigOpSpacing3-f.depth)}}if(n){var m=Cn(n,r.havingStyle(s.sub()),r);c={elem:m,kern:Math.max(r.fontMetrics().bigOpSpacing2,r.fontMetrics().bigOpSpacing4-m.height)}}var g;if(h&&c){var x=r.fontMetrics().bigOpSpacing5+c.elem.height+c.elem.depth+c.kern+t.depth+a;g=be.makeVList({positionType:"bottom",positionData:x,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:c.elem,marginLeft:We(-i)},{type:"kern",size:c.kern},{type:"elem",elem:t},{type:"kern",size:h.kern},{type:"elem",elem:h.elem,marginLeft:We(i)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]},r)}else if(c){var y=t.height-a;g=be.makeVList({positionType:"top",positionData:y,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:c.elem,marginLeft:We(-i)},{type:"kern",size:c.kern},{type:"elem",elem:t}]},r)}else if(h){var w=t.depth+a;g=be.makeVList({positionType:"bottom",positionData:w,children:[{type:"elem",elem:t},{type:"kern",size:h.kern},{type:"elem",elem:h.elem,marginLeft:We(i)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]},r)}else return t;var S=[g];if(c&&i!==0&&!o){var k=be.makeSpan(["mspace"],[],r);k.style.marginRight=We(i),S.unshift(k)}return be.makeSpan(["mop","op-limits"],S,r)},DQ=["\\smallint"],ef=(t,e)=>{var n,r,s=!1,i;t.type==="supsub"?(n=t.sup,r=t.sub,i=Wt(t.base,"op"),s=!0):i=Wt(t,"op");var a=e.style,o=!1;a.size===St.DISPLAY.size&&i.symbol&&!DQ.includes(i.name)&&(o=!0);var c;if(i.symbol){var h=o?"Size2-Regular":"Size1-Regular",f="";if((i.name==="\\oiint"||i.name==="\\oiiint")&&(f=i.name.slice(1),i.name=f==="oiint"?"\\iint":"\\iiint"),c=be.makeSymbol(i.name,h,"math",e,["mop","op-symbol",o?"large-op":"small-op"]),f.length>0){var m=c.italic,g=be.staticSvg(f+"Size"+(o?"2":"1"),e);c=be.makeVList({positionType:"individualShift",children:[{type:"elem",elem:c,shift:0},{type:"elem",elem:g,shift:o?.08:0}]},e),i.name="\\"+f,c.classes.unshift("mop"),c.italic=m}}else if(i.body){var x=es(i.body,e,!0);x.length===1&&x[0]instanceof ua?(c=x[0],c.classes[0]="mop"):c=be.makeSpan(["mop"],x,e)}else{for(var y=[],w=1;w{var n;if(t.symbol)n=new Ti("mo",[da(t.name,t.mode)]),DQ.includes(t.name)&&n.setAttribute("largeop","false");else if(t.body)n=new Ti("mo",fi(t.body,e));else{n=new Ti("mi",[new al(t.name.slice(1))]);var r=new Ti("mo",[da("⁡","text")]);t.parentIsSupSub?n=new Ti("mrow",[n,r]):n=oQ([n,r])}return n},p2e={"∏":"\\prod","∐":"\\coprod","∑":"\\sum","⋀":"\\bigwedge","⋁":"\\bigvee","⋂":"\\bigcap","⋃":"\\bigcup","⨀":"\\bigodot","⨁":"\\bigoplus","⨂":"\\bigotimes","⨄":"\\biguplus","⨆":"\\bigsqcup"};et({type:"op",names:["\\coprod","\\bigvee","\\bigwedge","\\biguplus","\\bigcap","\\bigcup","\\intop","\\prod","\\sum","\\bigotimes","\\bigoplus","\\bigodot","\\bigsqcup","\\smallint","∏","∐","∑","⋀","⋁","⋂","⋃","⨀","⨁","⨂","⨄","⨆"],props:{numArgs:0},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=r;return s.length===1&&(s=p2e[s]),{type:"op",mode:n.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:s}},htmlBuilder:ef,mathmlBuilder:pp});et({type:"op",names:["\\mathop"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var{parser:n}=t,r=e[0];return{type:"op",mode:n.mode,limits:!1,parentIsSupSub:!1,symbol:!1,body:Er(r)}},htmlBuilder:ef,mathmlBuilder:pp});var g2e={"∫":"\\int","∬":"\\iint","∭":"\\iiint","∮":"\\oint","∯":"\\oiint","∰":"\\oiiint"};et({type:"op",names:["\\arcsin","\\arccos","\\arctan","\\arctg","\\arcctg","\\arg","\\ch","\\cos","\\cosec","\\cosh","\\cot","\\cotg","\\coth","\\csc","\\ctg","\\cth","\\deg","\\dim","\\exp","\\hom","\\ker","\\lg","\\ln","\\log","\\sec","\\sin","\\sinh","\\sh","\\tan","\\tanh","\\tg","\\th"],props:{numArgs:0},handler(t){var{parser:e,funcName:n}=t;return{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!1,name:n}},htmlBuilder:ef,mathmlBuilder:pp});et({type:"op",names:["\\det","\\gcd","\\inf","\\lim","\\max","\\min","\\Pr","\\sup"],props:{numArgs:0},handler(t){var{parser:e,funcName:n}=t;return{type:"op",mode:e.mode,limits:!0,parentIsSupSub:!1,symbol:!1,name:n}},htmlBuilder:ef,mathmlBuilder:pp});et({type:"op",names:["\\int","\\iint","\\iiint","\\oint","\\oiint","\\oiiint","∫","∬","∭","∮","∯","∰"],props:{numArgs:0},handler(t){var{parser:e,funcName:n}=t,r=n;return r.length===1&&(r=g2e[r]),{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:r}},htmlBuilder:ef,mathmlBuilder:pp});var zQ=(t,e)=>{var n,r,s=!1,i;t.type==="supsub"?(n=t.sup,r=t.sub,i=Wt(t.base,"operatorname"),s=!0):i=Wt(t,"operatorname");var a;if(i.body.length>0){for(var o=i.body.map(m=>{var g=m.text;return typeof g=="string"?{type:"textord",mode:m.mode,text:g}:m}),c=es(o,e.withFont("mathrm"),!0),h=0;h{for(var n=fi(t.body,e.withFont("mathrm")),r=!0,s=0;sf.toText()).join("");n=[new Fe.TextNode(o)]}var c=new Fe.MathNode("mi",n);c.setAttribute("mathvariant","normal");var h=new Fe.MathNode("mo",[da("⁡","text")]);return t.parentIsSupSub?new Fe.MathNode("mrow",[c,h]):Fe.newDocumentFragment([c,h])};et({type:"operatorname",names:["\\operatorname@","\\operatornamewithlimits"],props:{numArgs:1},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=e[0];return{type:"operatorname",mode:n.mode,body:Er(s),alwaysHandleSupSub:r==="\\operatornamewithlimits",limits:!1,parentIsSupSub:!1}},htmlBuilder:zQ,mathmlBuilder:x2e});Z("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@");Vu({type:"ordgroup",htmlBuilder(t,e){return t.semisimple?be.makeFragment(es(t.body,e,!1)):be.makeSpan(["mord"],es(t.body,e,!0),e)},mathmlBuilder(t,e){return Cc(t.body,e,!0)}});et({type:"overline",names:["\\overline"],props:{numArgs:1},handler(t,e){var{parser:n}=t,r=e[0];return{type:"overline",mode:n.mode,body:r}},htmlBuilder(t,e){var n=Cn(t.body,e.havingCrampedStyle()),r=be.makeLineSpan("overline-line",e),s=e.fontMetrics().defaultRuleThickness,i=be.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:n},{type:"kern",size:3*s},{type:"elem",elem:r},{type:"kern",size:s}]},e);return be.makeSpan(["mord","overline"],[i],e)},mathmlBuilder(t,e){var n=new Fe.MathNode("mo",[new Fe.TextNode("‾")]);n.setAttribute("stretchy","true");var r=new Fe.MathNode("mover",[Kn(t.body,e),n]);return r.setAttribute("accent","true"),r}});et({type:"phantom",names:["\\phantom"],props:{numArgs:1,allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=e[0];return{type:"phantom",mode:n.mode,body:Er(r)}},htmlBuilder:(t,e)=>{var n=es(t.body,e.withPhantom(),!1);return be.makeFragment(n)},mathmlBuilder:(t,e)=>{var n=fi(t.body,e);return new Fe.MathNode("mphantom",n)}});et({type:"hphantom",names:["\\hphantom"],props:{numArgs:1,allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=e[0];return{type:"hphantom",mode:n.mode,body:r}},htmlBuilder:(t,e)=>{var n=be.makeSpan([],[Cn(t.body,e.withPhantom())]);if(n.height=0,n.depth=0,n.children)for(var r=0;r{var n=fi(Er(t.body),e),r=new Fe.MathNode("mphantom",n),s=new Fe.MathNode("mpadded",[r]);return s.setAttribute("height","0px"),s.setAttribute("depth","0px"),s}});et({type:"vphantom",names:["\\vphantom"],props:{numArgs:1,allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=e[0];return{type:"vphantom",mode:n.mode,body:r}},htmlBuilder:(t,e)=>{var n=be.makeSpan(["inner"],[Cn(t.body,e.withPhantom())]),r=be.makeSpan(["fix"],[]);return be.makeSpan(["mord","rlap"],[n,r],e)},mathmlBuilder:(t,e)=>{var n=fi(Er(t.body),e),r=new Fe.MathNode("mphantom",n),s=new Fe.MathNode("mpadded",[r]);return s.setAttribute("width","0px"),s}});et({type:"raisebox",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:!0},handler(t,e){var{parser:n}=t,r=Wt(e[0],"size").value,s=e[1];return{type:"raisebox",mode:n.mode,dy:r,body:s}},htmlBuilder(t,e){var n=Cn(t.body,e),r=gr(t.dy,e);return be.makeVList({positionType:"shift",positionData:-r,children:[{type:"elem",elem:n}]},e)},mathmlBuilder(t,e){var n=new Fe.MathNode("mpadded",[Kn(t.body,e)]),r=t.dy.number+t.dy.unit;return n.setAttribute("voffset",r),n}});et({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0,allowedInArgument:!0},handler(t){var{parser:e}=t;return{type:"internal",mode:e.mode}}});et({type:"rule",names:["\\rule"],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["size","size","size"]},handler(t,e,n){var{parser:r}=t,s=n[0],i=Wt(e[0],"size"),a=Wt(e[1],"size");return{type:"rule",mode:r.mode,shift:s&&Wt(s,"size").value,width:i.value,height:a.value}},htmlBuilder(t,e){var n=be.makeSpan(["mord","rule"],[],e),r=gr(t.width,e),s=gr(t.height,e),i=t.shift?gr(t.shift,e):0;return n.style.borderRightWidth=We(r),n.style.borderTopWidth=We(s),n.style.bottom=We(i),n.width=r,n.height=s+i,n.depth=-i,n.maxFontSize=s*1.125*e.sizeMultiplier,n},mathmlBuilder(t,e){var n=gr(t.width,e),r=gr(t.height,e),s=t.shift?gr(t.shift,e):0,i=e.color&&e.getColor()||"black",a=new Fe.MathNode("mspace");a.setAttribute("mathbackground",i),a.setAttribute("width",We(n)),a.setAttribute("height",We(r));var o=new Fe.MathNode("mpadded",[a]);return s>=0?o.setAttribute("height",We(s)):(o.setAttribute("height",We(s)),o.setAttribute("depth",We(-s))),o.setAttribute("voffset",We(s)),o}});function PQ(t,e,n){for(var r=es(t,e,!1),s=e.sizeMultiplier/n.sizeMultiplier,i=0;i{var n=e.havingSize(t.size);return PQ(t.body,n,e)};et({type:"sizing",names:vM,props:{numArgs:0,allowedInText:!0},handler:(t,e)=>{var{breakOnTokenText:n,funcName:r,parser:s}=t,i=s.parseExpression(!1,n);return{type:"sizing",mode:s.mode,size:vM.indexOf(r)+1,body:i}},htmlBuilder:v2e,mathmlBuilder:(t,e)=>{var n=e.havingSize(t.size),r=fi(t.body,n),s=new Fe.MathNode("mstyle",r);return s.setAttribute("mathsize",We(n.sizeMultiplier)),s}});et({type:"smash",names:["\\smash"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:(t,e,n)=>{var{parser:r}=t,s=!1,i=!1,a=n[0]&&Wt(n[0],"ordgroup");if(a)for(var o="",c=0;c{var n=be.makeSpan([],[Cn(t.body,e)]);if(!t.smashHeight&&!t.smashDepth)return n;if(t.smashHeight&&(n.height=0,n.children))for(var r=0;r{var n=new Fe.MathNode("mpadded",[Kn(t.body,e)]);return t.smashHeight&&n.setAttribute("height","0px"),t.smashDepth&&n.setAttribute("depth","0px"),n}});et({type:"sqrt",names:["\\sqrt"],props:{numArgs:1,numOptionalArgs:1},handler(t,e,n){var{parser:r}=t,s=n[0],i=e[0];return{type:"sqrt",mode:r.mode,body:i,index:s}},htmlBuilder(t,e){var n=Cn(t.body,e.havingCrampedStyle());n.height===0&&(n.height=e.fontMetrics().xHeight),n=be.wrapFragment(n,e);var r=e.fontMetrics(),s=r.defaultRuleThickness,i=s;e.style.idn.height+n.depth+a&&(a=(a+m-n.height-n.depth)/2);var g=c.height-n.height-a-h;n.style.paddingLeft=We(f);var x=be.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:n,wrapperClasses:["svg-align"]},{type:"kern",size:-(n.height+g)},{type:"elem",elem:c},{type:"kern",size:h}]},e);if(t.index){var y=e.havingStyle(St.SCRIPTSCRIPT),w=Cn(t.index,y,e),S=.6*(x.height-x.depth),k=be.makeVList({positionType:"shift",positionData:-S,children:[{type:"elem",elem:w}]},e),N=be.makeSpan(["root"],[k]);return be.makeSpan(["mord","sqrt"],[N,x],e)}else return be.makeSpan(["mord","sqrt"],[x],e)},mathmlBuilder(t,e){var{body:n,index:r}=t;return r?new Fe.MathNode("mroot",[Kn(n,e),Kn(r,e)]):new Fe.MathNode("msqrt",[Kn(n,e)])}});var yM={display:St.DISPLAY,text:St.TEXT,script:St.SCRIPT,scriptscript:St.SCRIPTSCRIPT};et({type:"styling",names:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t,e){var{breakOnTokenText:n,funcName:r,parser:s}=t,i=s.parseExpression(!0,n),a=r.slice(1,r.length-5);return{type:"styling",mode:s.mode,style:a,body:i}},htmlBuilder(t,e){var n=yM[t.style],r=e.havingStyle(n).withFont("");return PQ(t.body,r,e)},mathmlBuilder(t,e){var n=yM[t.style],r=e.havingStyle(n),s=fi(t.body,r),i=new Fe.MathNode("mstyle",s),a={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]},o=a[t.style];return i.setAttribute("scriptlevel",o[0]),i.setAttribute("displaystyle",o[1]),i}});var y2e=function(e,n){var r=e.base;if(r)if(r.type==="op"){var s=r.limits&&(n.style.size===St.DISPLAY.size||r.alwaysHandleSupSub);return s?ef:null}else if(r.type==="operatorname"){var i=r.alwaysHandleSupSub&&(n.style.size===St.DISPLAY.size||r.limits);return i?zQ:null}else{if(r.type==="accent")return Mn.isCharacterBox(r.base)?Zj:null;if(r.type==="horizBrace"){var a=!e.sub;return a===r.isOver?AQ:null}else return null}else return null};Vu({type:"supsub",htmlBuilder(t,e){var n=y2e(t,e);if(n)return n(t,e);var{base:r,sup:s,sub:i}=t,a=Cn(r,e),o,c,h=e.fontMetrics(),f=0,m=0,g=r&&Mn.isCharacterBox(r);if(s){var x=e.havingStyle(e.style.sup());o=Cn(s,x,e),g||(f=a.height-x.fontMetrics().supDrop*x.sizeMultiplier/e.sizeMultiplier)}if(i){var y=e.havingStyle(e.style.sub());c=Cn(i,y,e),g||(m=a.depth+y.fontMetrics().subDrop*y.sizeMultiplier/e.sizeMultiplier)}var w;e.style===St.DISPLAY?w=h.sup1:e.style.cramped?w=h.sup3:w=h.sup2;var S=e.sizeMultiplier,k=We(.5/h.ptPerEm/S),N=null;if(c){var C=t.base&&t.base.type==="op"&&t.base.name&&(t.base.name==="\\oiint"||t.base.name==="\\oiiint");(a instanceof ua||C)&&(N=We(-a.italic))}var T;if(o&&c){f=Math.max(f,w,o.depth+.25*h.xHeight),m=Math.max(m,h.sub2);var _=h.defaultRuleThickness,E=4*_;if(f-o.depth-(c.height-m)0&&(f+=M,m-=M)}var L=[{type:"elem",elem:c,shift:m,marginRight:k,marginLeft:N},{type:"elem",elem:o,shift:-f,marginRight:k}];T=be.makeVList({positionType:"individualShift",children:L},e)}else if(c){m=Math.max(m,h.sub1,c.height-.8*h.xHeight);var P=[{type:"elem",elem:c,marginLeft:N,marginRight:k}];T=be.makeVList({positionType:"shift",positionData:m,children:P},e)}else if(o)f=Math.max(f,w,o.depth+.25*h.xHeight),T=be.makeVList({positionType:"shift",positionData:-f,children:[{type:"elem",elem:o,marginRight:k}]},e);else throw new Error("supsub must have either sup or sub.");var I=mk(a,"right")||"mord";return be.makeSpan([I],[a,be.makeSpan(["msupsub"],[T])],e)},mathmlBuilder(t,e){var n=!1,r,s;t.base&&t.base.type==="horizBrace"&&(s=!!t.sup,s===t.base.isOver&&(n=!0,r=t.base.isOver)),t.base&&(t.base.type==="op"||t.base.type==="operatorname")&&(t.base.parentIsSupSub=!0);var i=[Kn(t.base,e)];t.sub&&i.push(Kn(t.sub,e)),t.sup&&i.push(Kn(t.sup,e));var a;if(n)a=r?"mover":"munder";else if(t.sub)if(t.sup){var h=t.base;h&&h.type==="op"&&h.limits&&e.style===St.DISPLAY||h&&h.type==="operatorname"&&h.alwaysHandleSupSub&&(e.style===St.DISPLAY||h.limits)?a="munderover":a="msubsup"}else{var c=t.base;c&&c.type==="op"&&c.limits&&(e.style===St.DISPLAY||c.alwaysHandleSupSub)||c&&c.type==="operatorname"&&c.alwaysHandleSupSub&&(c.limits||e.style===St.DISPLAY)?a="munder":a="msub"}else{var o=t.base;o&&o.type==="op"&&o.limits&&(e.style===St.DISPLAY||o.alwaysHandleSupSub)||o&&o.type==="operatorname"&&o.alwaysHandleSupSub&&(o.limits||e.style===St.DISPLAY)?a="mover":a="msup"}return new Fe.MathNode(a,i)}});Vu({type:"atom",htmlBuilder(t,e){return be.mathsym(t.text,t.mode,e,["m"+t.family])},mathmlBuilder(t,e){var n=new Fe.MathNode("mo",[da(t.text,t.mode)]);if(t.family==="bin"){var r=Yj(t,e);r==="bold-italic"&&n.setAttribute("mathvariant",r)}else t.family==="punct"?n.setAttribute("separator","true"):(t.family==="open"||t.family==="close")&&n.setAttribute("stretchy","false");return n}});var LQ={mi:"italic",mn:"normal",mtext:"normal"};Vu({type:"mathord",htmlBuilder(t,e){return be.makeOrd(t,e,"mathord")},mathmlBuilder(t,e){var n=new Fe.MathNode("mi",[da(t.text,t.mode,e)]),r=Yj(t,e)||"italic";return r!==LQ[n.type]&&n.setAttribute("mathvariant",r),n}});Vu({type:"textord",htmlBuilder(t,e){return be.makeOrd(t,e,"textord")},mathmlBuilder(t,e){var n=da(t.text,t.mode,e),r=Yj(t,e)||"normal",s;return t.mode==="text"?s=new Fe.MathNode("mtext",[n]):/[0-9]/.test(t.text)?s=new Fe.MathNode("mn",[n]):t.text==="\\prime"?s=new Fe.MathNode("mo",[n]):s=new Fe.MathNode("mi",[n]),r!==LQ[s.type]&&s.setAttribute("mathvariant",r),s}});var z4={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},P4={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};Vu({type:"spacing",htmlBuilder(t,e){if(P4.hasOwnProperty(t.text)){var n=P4[t.text].className||"";if(t.mode==="text"){var r=be.makeOrd(t,e,"textord");return r.classes.push(n),r}else return be.makeSpan(["mspace",n],[be.mathsym(t.text,t.mode,e)],e)}else{if(z4.hasOwnProperty(t.text))return be.makeSpan(["mspace",z4[t.text]],[],e);throw new $e('Unknown type of space "'+t.text+'"')}},mathmlBuilder(t,e){var n;if(P4.hasOwnProperty(t.text))n=new Fe.MathNode("mtext",[new Fe.TextNode(" ")]);else{if(z4.hasOwnProperty(t.text))return new Fe.MathNode("mspace");throw new $e('Unknown type of space "'+t.text+'"')}return n}});var bM=()=>{var t=new Fe.MathNode("mtd",[]);return t.setAttribute("width","50%"),t};Vu({type:"tag",mathmlBuilder(t,e){var n=new Fe.MathNode("mtable",[new Fe.MathNode("mtr",[bM(),new Fe.MathNode("mtd",[Cc(t.body,e)]),bM(),new Fe.MathNode("mtd",[Cc(t.tag,e)])])]);return n.setAttribute("width","100%"),n}});var wM={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},SM={"\\textbf":"textbf","\\textmd":"textmd"},b2e={"\\textit":"textit","\\textup":"textup"},kM=(t,e)=>{var n=t.font;if(n){if(wM[n])return e.withTextFontFamily(wM[n]);if(SM[n])return e.withTextFontWeight(SM[n]);if(n==="\\emph")return e.fontShape==="textit"?e.withTextFontShape("textup"):e.withTextFontShape("textit")}else return e;return e.withTextFontShape(b2e[n])};et({type:"text",names:["\\text","\\textrm","\\textsf","\\texttt","\\textnormal","\\textbf","\\textmd","\\textit","\\textup","\\emph"],props:{numArgs:1,argTypes:["text"],allowedInArgument:!0,allowedInText:!0},handler(t,e){var{parser:n,funcName:r}=t,s=e[0];return{type:"text",mode:n.mode,body:Er(s),font:r}},htmlBuilder(t,e){var n=kM(t,e),r=es(t.body,n,!0);return be.makeSpan(["mord","text"],r,n)},mathmlBuilder(t,e){var n=kM(t,e);return Cc(t.body,n)}});et({type:"underline",names:["\\underline"],props:{numArgs:1,allowedInText:!0},handler(t,e){var{parser:n}=t;return{type:"underline",mode:n.mode,body:e[0]}},htmlBuilder(t,e){var n=Cn(t.body,e),r=be.makeLineSpan("underline-line",e),s=e.fontMetrics().defaultRuleThickness,i=be.makeVList({positionType:"top",positionData:n.height,children:[{type:"kern",size:s},{type:"elem",elem:r},{type:"kern",size:3*s},{type:"elem",elem:n}]},e);return be.makeSpan(["mord","underline"],[i],e)},mathmlBuilder(t,e){var n=new Fe.MathNode("mo",[new Fe.TextNode("‾")]);n.setAttribute("stretchy","true");var r=new Fe.MathNode("munder",[Kn(t.body,e),n]);return r.setAttribute("accentunder","true"),r}});et({type:"vcenter",names:["\\vcenter"],props:{numArgs:1,argTypes:["original"],allowedInText:!1},handler(t,e){var{parser:n}=t;return{type:"vcenter",mode:n.mode,body:e[0]}},htmlBuilder(t,e){var n=Cn(t.body,e),r=e.fontMetrics().axisHeight,s=.5*(n.height-r-(n.depth+r));return be.makeVList({positionType:"shift",positionData:s,children:[{type:"elem",elem:n}]},e)},mathmlBuilder(t,e){return new Fe.MathNode("mpadded",[Kn(t.body,e)],["vcenter"])}});et({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler(t,e,n){throw new $e("\\verb ended by end of line instead of matching delimiter")},htmlBuilder(t,e){for(var n=jM(t),r=[],s=e.havingStyle(e.style.text()),i=0;it.body.replace(/ /g,t.star?"␣":" "),fc=aQ,IQ=`[ \r + ]`,w2e="\\\\[a-zA-Z@]+",S2e="\\\\[^\uD800-\uDFFF]",k2e="("+w2e+")"+IQ+"*",j2e=`\\\\( |[ \r ]+ -?)[ \r ]*`,hk="[̀-ͯ]",b2e=new RegExp(hk+"+$"),w2e="("+PQ+"+)|"+(y2e+"|")+"([!-\\[\\]-‧‪-퟿豈-￿]"+(hk+"*")+"|[\uD800-\uDBFF][\uDC00-\uDFFF]"+(hk+"*")+"|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5"+("|"+v2e)+("|"+x2e+")");class SM{constructor(e,n){this.input=void 0,this.settings=void 0,this.tokenRegex=void 0,this.catcodes=void 0,this.input=e,this.settings=n,this.tokenRegex=new RegExp(w2e,"g"),this.catcodes={"%":14,"~":13}}setCatcode(e,n){this.catcodes[e]=n}lex(){var e=this.input,n=this.tokenRegex.lastIndex;if(n===e.length)return new Ai("EOF",new Ys(this,n,n));var r=this.tokenRegex.exec(e);if(r===null||r.index!==n)throw new Be("Unexpected character: '"+e[n]+"'",new Ai(e[n],new Ys(this,n,n+1)));var s=r[6]||r[3]||(r[2]?"\\ ":" ");if(this.catcodes[s]===14){var i=e.indexOf(` -`,this.tokenRegex.lastIndex);return i===-1?(this.tokenRegex.lastIndex=e.length,this.settings.reportNonstrict("commentAtEnd","% comment has no terminating newline; LaTeX would fail because of commenting the end of math mode (e.g. $)")):this.tokenRegex.lastIndex=i+1,this.lex()}return new Ai(s,new Ys(this,n,this.tokenRegex.lastIndex))}}class S2e{constructor(e,n){e===void 0&&(e={}),n===void 0&&(n={}),this.current=void 0,this.builtins=void 0,this.undefStack=void 0,this.current=n,this.builtins=e,this.undefStack=[]}beginGroup(){this.undefStack.push({})}endGroup(){if(this.undefStack.length===0)throw new Be("Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug");var e=this.undefStack.pop();for(var n in e)e.hasOwnProperty(n)&&(e[n]==null?delete this.current[n]:this.current[n]=e[n])}endGroups(){for(;this.undefStack.length>0;)this.endGroup()}has(e){return this.current.hasOwnProperty(e)||this.builtins.hasOwnProperty(e)}get(e){return this.current.hasOwnProperty(e)?this.current[e]:this.builtins[e]}set(e,n,r){if(r===void 0&&(r=!1),r){for(var s=0;s0&&(this.undefStack[this.undefStack.length-1][e]=n)}else{var i=this.undefStack[this.undefStack.length-1];i&&!i.hasOwnProperty(e)&&(i[e]=this.current[e])}n==null?delete this.current[e]:this.current[e]=n}}var k2e=jQ;Z("\\noexpand",function(t){var e=t.popToken();return t.isExpandable(e.text)&&(e.noexpand=!0,e.treatAsRelax=!0),{tokens:[e],numArgs:0}});Z("\\expandafter",function(t){var e=t.popToken();return t.expandOnce(!0),{tokens:[e],numArgs:0}});Z("\\@firstoftwo",function(t){var e=t.consumeArgs(2);return{tokens:e[0],numArgs:0}});Z("\\@secondoftwo",function(t){var e=t.consumeArgs(2);return{tokens:e[1],numArgs:0}});Z("\\@ifnextchar",function(t){var e=t.consumeArgs(3);t.consumeSpaces();var n=t.future();return e[0].length===1&&e[0][0].text===n.text?{tokens:e[1],numArgs:0}:{tokens:e[2],numArgs:0}});Z("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}");Z("\\TextOrMath",function(t){var e=t.consumeArgs(2);return t.mode==="text"?{tokens:e[0],numArgs:0}:{tokens:e[1],numArgs:0}});var kM={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};Z("\\char",function(t){var e=t.popToken(),n,r="";if(e.text==="'")n=8,e=t.popToken();else if(e.text==='"')n=16,e=t.popToken();else if(e.text==="`")if(e=t.popToken(),e.text[0]==="\\")r=e.text.charCodeAt(1);else{if(e.text==="EOF")throw new Be("\\char` missing argument");r=e.text.charCodeAt(0)}else n=10;if(n){if(r=kM[e.text],r==null||r>=n)throw new Be("Invalid base-"+n+" digit "+e.text);for(var s;(s=kM[t.future().text])!=null&&s{var s=t.consumeArg().tokens;if(s.length!==1)throw new Be("\\newcommand's first argument must be a macro name");var i=s[0].text,a=t.isDefined(i);if(a&&!e)throw new Be("\\newcommand{"+i+"} attempting to redefine "+(i+"; use \\renewcommand"));if(!a&&!n)throw new Be("\\renewcommand{"+i+"} when command "+i+" does not yet exist; use \\newcommand");var o=0;if(s=t.consumeArg().tokens,s.length===1&&s[0].text==="["){for(var c="",h=t.expandNextToken();h.text!=="]"&&h.text!=="EOF";)c+=h.text,h=t.expandNextToken();if(!c.match(/^\s*[0-9]+\s*$/))throw new Be("Invalid number of arguments: "+c);o=parseInt(c),s=t.consumeArg().tokens}return a&&r||t.macros.set(i,{tokens:s,numArgs:o}),""};Z("\\newcommand",t=>ij(t,!1,!0,!1));Z("\\renewcommand",t=>ij(t,!0,!1,!1));Z("\\providecommand",t=>ij(t,!0,!0,!0));Z("\\message",t=>{var e=t.consumeArgs(1)[0];return console.log(e.reverse().map(n=>n.text).join("")),""});Z("\\errmessage",t=>{var e=t.consumeArgs(1)[0];return console.error(e.reverse().map(n=>n.text).join("")),""});Z("\\show",t=>{var e=t.popToken(),n=e.text;return console.log(e,t.macros.get(n),fc[n],Gn.math[n],Gn.text[n]),""});Z("\\bgroup","{");Z("\\egroup","}");Z("~","\\nobreakspace");Z("\\lq","`");Z("\\rq","'");Z("\\aa","\\r a");Z("\\AA","\\r A");Z("\\textcopyright","\\html@mathml{\\textcircled{c}}{\\char`©}");Z("\\copyright","\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}");Z("\\textregistered","\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}");Z("ℬ","\\mathscr{B}");Z("ℰ","\\mathscr{E}");Z("ℱ","\\mathscr{F}");Z("ℋ","\\mathscr{H}");Z("ℐ","\\mathscr{I}");Z("ℒ","\\mathscr{L}");Z("ℳ","\\mathscr{M}");Z("ℛ","\\mathscr{R}");Z("ℭ","\\mathfrak{C}");Z("ℌ","\\mathfrak{H}");Z("ℨ","\\mathfrak{Z}");Z("\\Bbbk","\\Bbb{k}");Z("·","\\cdotp");Z("\\llap","\\mathllap{\\textrm{#1}}");Z("\\rlap","\\mathrlap{\\textrm{#1}}");Z("\\clap","\\mathclap{\\textrm{#1}}");Z("\\mathstrut","\\vphantom{(}");Z("\\underbar","\\underline{\\text{#1}}");Z("\\not",'\\html@mathml{\\mathrel{\\mathrlap\\@not}}{\\char"338}');Z("\\neq","\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}");Z("\\ne","\\neq");Z("≠","\\neq");Z("\\notin","\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`∉}}");Z("∉","\\notin");Z("≘","\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`≘}}");Z("≙","\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`≘}}");Z("≚","\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`≚}}");Z("≛","\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`≛}}");Z("≝","\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`≝}}");Z("≞","\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`≞}}");Z("≟","\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`≟}}");Z("⟂","\\perp");Z("‼","\\mathclose{!\\mkern-0.8mu!}");Z("∌","\\notni");Z("⌜","\\ulcorner");Z("⌝","\\urcorner");Z("⌞","\\llcorner");Z("⌟","\\lrcorner");Z("©","\\copyright");Z("®","\\textregistered");Z("️","\\textregistered");Z("\\ulcorner",'\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}');Z("\\urcorner",'\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}');Z("\\llcorner",'\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}');Z("\\lrcorner",'\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}');Z("\\vdots","{\\varvdots\\rule{0pt}{15pt}}");Z("⋮","\\vdots");Z("\\varGamma","\\mathit{\\Gamma}");Z("\\varDelta","\\mathit{\\Delta}");Z("\\varTheta","\\mathit{\\Theta}");Z("\\varLambda","\\mathit{\\Lambda}");Z("\\varXi","\\mathit{\\Xi}");Z("\\varPi","\\mathit{\\Pi}");Z("\\varSigma","\\mathit{\\Sigma}");Z("\\varUpsilon","\\mathit{\\Upsilon}");Z("\\varPhi","\\mathit{\\Phi}");Z("\\varPsi","\\mathit{\\Psi}");Z("\\varOmega","\\mathit{\\Omega}");Z("\\substack","\\begin{subarray}{c}#1\\end{subarray}");Z("\\colon","\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax");Z("\\boxed","\\fbox{$\\displaystyle{#1}$}");Z("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;");Z("\\implies","\\DOTSB\\;\\Longrightarrow\\;");Z("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;");Z("\\dddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}");Z("\\ddddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}");var OM={",":"\\dotsc","\\not":"\\dotsb","+":"\\dotsb","=":"\\dotsb","<":"\\dotsb",">":"\\dotsb","-":"\\dotsb","*":"\\dotsb",":":"\\dotsb","\\DOTSB":"\\dotsb","\\coprod":"\\dotsb","\\bigvee":"\\dotsb","\\bigwedge":"\\dotsb","\\biguplus":"\\dotsb","\\bigcap":"\\dotsb","\\bigcup":"\\dotsb","\\prod":"\\dotsb","\\sum":"\\dotsb","\\bigotimes":"\\dotsb","\\bigoplus":"\\dotsb","\\bigodot":"\\dotsb","\\bigsqcup":"\\dotsb","\\And":"\\dotsb","\\longrightarrow":"\\dotsb","\\Longrightarrow":"\\dotsb","\\longleftarrow":"\\dotsb","\\Longleftarrow":"\\dotsb","\\longleftrightarrow":"\\dotsb","\\Longleftrightarrow":"\\dotsb","\\mapsto":"\\dotsb","\\longmapsto":"\\dotsb","\\hookrightarrow":"\\dotsb","\\doteq":"\\dotsb","\\mathbin":"\\dotsb","\\mathrel":"\\dotsb","\\relbar":"\\dotsb","\\Relbar":"\\dotsb","\\xrightarrow":"\\dotsb","\\xleftarrow":"\\dotsb","\\DOTSI":"\\dotsi","\\int":"\\dotsi","\\oint":"\\dotsi","\\iint":"\\dotsi","\\iiint":"\\dotsi","\\iiiint":"\\dotsi","\\idotsint":"\\dotsi","\\DOTSX":"\\dotsx"};Z("\\dots",function(t){var e="\\dotso",n=t.expandAfterFuture().text;return n in OM?e=OM[n]:(n.slice(0,4)==="\\not"||n in Gn.math&&["bin","rel"].includes(Gn.math[n].group))&&(e="\\dotsb"),e});var aj={")":!0,"]":!0,"\\rbrack":!0,"\\}":!0,"\\rbrace":!0,"\\rangle":!0,"\\rceil":!0,"\\rfloor":!0,"\\rgroup":!0,"\\rmoustache":!0,"\\right":!0,"\\bigr":!0,"\\biggr":!0,"\\Bigr":!0,"\\Biggr":!0,$:!0,";":!0,".":!0,",":!0};Z("\\dotso",function(t){var e=t.future().text;return e in aj?"\\ldots\\,":"\\ldots"});Z("\\dotsc",function(t){var e=t.future().text;return e in aj&&e!==","?"\\ldots\\,":"\\ldots"});Z("\\cdots",function(t){var e=t.future().text;return e in aj?"\\@cdots\\,":"\\@cdots"});Z("\\dotsb","\\cdots");Z("\\dotsm","\\cdots");Z("\\dotsi","\\!\\cdots");Z("\\dotsx","\\ldots\\,");Z("\\DOTSI","\\relax");Z("\\DOTSB","\\relax");Z("\\DOTSX","\\relax");Z("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax");Z("\\,","\\tmspace+{3mu}{.1667em}");Z("\\thinspace","\\,");Z("\\>","\\mskip{4mu}");Z("\\:","\\tmspace+{4mu}{.2222em}");Z("\\medspace","\\:");Z("\\;","\\tmspace+{5mu}{.2777em}");Z("\\thickspace","\\;");Z("\\!","\\tmspace-{3mu}{.1667em}");Z("\\negthinspace","\\!");Z("\\negmedspace","\\tmspace-{4mu}{.2222em}");Z("\\negthickspace","\\tmspace-{5mu}{.277em}");Z("\\enspace","\\kern.5em ");Z("\\enskip","\\hskip.5em\\relax");Z("\\quad","\\hskip1em\\relax");Z("\\qquad","\\hskip2em\\relax");Z("\\tag","\\@ifstar\\tag@literal\\tag@paren");Z("\\tag@paren","\\tag@literal{({#1})}");Z("\\tag@literal",t=>{if(t.macros.get("\\df@tag"))throw new Be("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"});Z("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}");Z("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)");Z("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}");Z("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1");Z("\\newline","\\\\\\relax");Z("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");var LQ=Ve(nl["Main-Regular"][84][1]-.7*nl["Main-Regular"][65][1]);Z("\\LaTeX","\\textrm{\\html@mathml{"+("L\\kern-.36em\\raisebox{"+LQ+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{LaTeX}}");Z("\\KaTeX","\\textrm{\\html@mathml{"+("K\\kern-.17em\\raisebox{"+LQ+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{KaTeX}}");Z("\\hspace","\\@ifstar\\@hspacer\\@hspace");Z("\\@hspace","\\hskip #1\\relax");Z("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax");Z("\\ordinarycolon",":");Z("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}");Z("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}');Z("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}');Z("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}');Z("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}');Z("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}');Z("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}');Z("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}');Z("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}');Z("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}');Z("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}');Z("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}');Z("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}');Z("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}');Z("∷","\\dblcolon");Z("∹","\\eqcolon");Z("≔","\\coloneqq");Z("≕","\\eqqcolon");Z("⩴","\\Coloneqq");Z("\\ratio","\\vcentcolon");Z("\\coloncolon","\\dblcolon");Z("\\colonequals","\\coloneqq");Z("\\coloncolonequals","\\Coloneqq");Z("\\equalscolon","\\eqqcolon");Z("\\equalscoloncolon","\\Eqqcolon");Z("\\colonminus","\\coloneq");Z("\\coloncolonminus","\\Coloneq");Z("\\minuscolon","\\eqcolon");Z("\\minuscoloncolon","\\Eqcolon");Z("\\coloncolonapprox","\\Colonapprox");Z("\\coloncolonsim","\\Colonsim");Z("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}");Z("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}");Z("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}");Z("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}");Z("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`∌}}");Z("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}");Z("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}");Z("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}");Z("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}");Z("\\varlimsup","\\DOTSB\\operatorname*{\\overline{lim}}");Z("\\varliminf","\\DOTSB\\operatorname*{\\underline{lim}}");Z("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{lim}}");Z("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{lim}}");Z("\\gvertneqq","\\html@mathml{\\@gvertneqq}{≩}");Z("\\lvertneqq","\\html@mathml{\\@lvertneqq}{≨}");Z("\\ngeqq","\\html@mathml{\\@ngeqq}{≱}");Z("\\ngeqslant","\\html@mathml{\\@ngeqslant}{≱}");Z("\\nleqq","\\html@mathml{\\@nleqq}{≰}");Z("\\nleqslant","\\html@mathml{\\@nleqslant}{≰}");Z("\\nshortmid","\\html@mathml{\\@nshortmid}{∤}");Z("\\nshortparallel","\\html@mathml{\\@nshortparallel}{∦}");Z("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{⊈}");Z("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{⊉}");Z("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{⊊}");Z("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{⫋}");Z("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{⊋}");Z("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{⫌}");Z("\\imath","\\html@mathml{\\@imath}{ı}");Z("\\jmath","\\html@mathml{\\@jmath}{ȷ}");Z("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`⟦}}");Z("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`⟧}}");Z("⟦","\\llbracket");Z("⟧","\\rrbracket");Z("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`⦃}}");Z("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`⦄}}");Z("⦃","\\lBrace");Z("⦄","\\rBrace");Z("\\minuso","\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`⦵}}");Z("⦵","\\minuso");Z("\\darr","\\downarrow");Z("\\dArr","\\Downarrow");Z("\\Darr","\\Downarrow");Z("\\lang","\\langle");Z("\\rang","\\rangle");Z("\\uarr","\\uparrow");Z("\\uArr","\\Uparrow");Z("\\Uarr","\\Uparrow");Z("\\N","\\mathbb{N}");Z("\\R","\\mathbb{R}");Z("\\Z","\\mathbb{Z}");Z("\\alef","\\aleph");Z("\\alefsym","\\aleph");Z("\\Alpha","\\mathrm{A}");Z("\\Beta","\\mathrm{B}");Z("\\bull","\\bullet");Z("\\Chi","\\mathrm{X}");Z("\\clubs","\\clubsuit");Z("\\cnums","\\mathbb{C}");Z("\\Complex","\\mathbb{C}");Z("\\Dagger","\\ddagger");Z("\\diamonds","\\diamondsuit");Z("\\empty","\\emptyset");Z("\\Epsilon","\\mathrm{E}");Z("\\Eta","\\mathrm{H}");Z("\\exist","\\exists");Z("\\harr","\\leftrightarrow");Z("\\hArr","\\Leftrightarrow");Z("\\Harr","\\Leftrightarrow");Z("\\hearts","\\heartsuit");Z("\\image","\\Im");Z("\\infin","\\infty");Z("\\Iota","\\mathrm{I}");Z("\\isin","\\in");Z("\\Kappa","\\mathrm{K}");Z("\\larr","\\leftarrow");Z("\\lArr","\\Leftarrow");Z("\\Larr","\\Leftarrow");Z("\\lrarr","\\leftrightarrow");Z("\\lrArr","\\Leftrightarrow");Z("\\Lrarr","\\Leftrightarrow");Z("\\Mu","\\mathrm{M}");Z("\\natnums","\\mathbb{N}");Z("\\Nu","\\mathrm{N}");Z("\\Omicron","\\mathrm{O}");Z("\\plusmn","\\pm");Z("\\rarr","\\rightarrow");Z("\\rArr","\\Rightarrow");Z("\\Rarr","\\Rightarrow");Z("\\real","\\Re");Z("\\reals","\\mathbb{R}");Z("\\Reals","\\mathbb{R}");Z("\\Rho","\\mathrm{P}");Z("\\sdot","\\cdot");Z("\\sect","\\S");Z("\\spades","\\spadesuit");Z("\\sub","\\subset");Z("\\sube","\\subseteq");Z("\\supe","\\supseteq");Z("\\Tau","\\mathrm{T}");Z("\\thetasym","\\vartheta");Z("\\weierp","\\wp");Z("\\Zeta","\\mathrm{Z}");Z("\\argmin","\\DOTSB\\operatorname*{arg\\,min}");Z("\\argmax","\\DOTSB\\operatorname*{arg\\,max}");Z("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits");Z("\\bra","\\mathinner{\\langle{#1}|}");Z("\\ket","\\mathinner{|{#1}\\rangle}");Z("\\braket","\\mathinner{\\langle{#1}\\rangle}");Z("\\Bra","\\left\\langle#1\\right|");Z("\\Ket","\\left|#1\\right\\rangle");var IQ=t=>e=>{var n=e.consumeArg().tokens,r=e.consumeArg().tokens,s=e.consumeArg().tokens,i=e.consumeArg().tokens,a=e.macros.get("|"),o=e.macros.get("\\|");e.macros.beginGroup();var c=m=>g=>{t&&(g.macros.set("|",a),s.length&&g.macros.set("\\|",o));var x=m;if(!m&&s.length){var y=g.future();y.text==="|"&&(g.popToken(),x=!0)}return{tokens:x?s:r,numArgs:0}};e.macros.set("|",c(!1)),s.length&&e.macros.set("\\|",c(!0));var h=e.consumeArg().tokens,f=e.expandTokens([...i,...h,...n]);return e.macros.endGroup(),{tokens:f.reverse(),numArgs:0}};Z("\\bra@ket",IQ(!1));Z("\\bra@set",IQ(!0));Z("\\Braket","\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}");Z("\\Set","\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}");Z("\\set","\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}");Z("\\angln","{\\angl n}");Z("\\blue","\\textcolor{##6495ed}{#1}");Z("\\orange","\\textcolor{##ffa500}{#1}");Z("\\pink","\\textcolor{##ff00af}{#1}");Z("\\red","\\textcolor{##df0030}{#1}");Z("\\green","\\textcolor{##28ae7b}{#1}");Z("\\gray","\\textcolor{gray}{#1}");Z("\\purple","\\textcolor{##9d38bd}{#1}");Z("\\blueA","\\textcolor{##ccfaff}{#1}");Z("\\blueB","\\textcolor{##80f6ff}{#1}");Z("\\blueC","\\textcolor{##63d9ea}{#1}");Z("\\blueD","\\textcolor{##11accd}{#1}");Z("\\blueE","\\textcolor{##0c7f99}{#1}");Z("\\tealA","\\textcolor{##94fff5}{#1}");Z("\\tealB","\\textcolor{##26edd5}{#1}");Z("\\tealC","\\textcolor{##01d1c1}{#1}");Z("\\tealD","\\textcolor{##01a995}{#1}");Z("\\tealE","\\textcolor{##208170}{#1}");Z("\\greenA","\\textcolor{##b6ffb0}{#1}");Z("\\greenB","\\textcolor{##8af281}{#1}");Z("\\greenC","\\textcolor{##74cf70}{#1}");Z("\\greenD","\\textcolor{##1fab54}{#1}");Z("\\greenE","\\textcolor{##0d923f}{#1}");Z("\\goldA","\\textcolor{##ffd0a9}{#1}");Z("\\goldB","\\textcolor{##ffbb71}{#1}");Z("\\goldC","\\textcolor{##ff9c39}{#1}");Z("\\goldD","\\textcolor{##e07d10}{#1}");Z("\\goldE","\\textcolor{##a75a05}{#1}");Z("\\redA","\\textcolor{##fca9a9}{#1}");Z("\\redB","\\textcolor{##ff8482}{#1}");Z("\\redC","\\textcolor{##f9685d}{#1}");Z("\\redD","\\textcolor{##e84d39}{#1}");Z("\\redE","\\textcolor{##bc2612}{#1}");Z("\\maroonA","\\textcolor{##ffbde0}{#1}");Z("\\maroonB","\\textcolor{##ff92c6}{#1}");Z("\\maroonC","\\textcolor{##ed5fa6}{#1}");Z("\\maroonD","\\textcolor{##ca337c}{#1}");Z("\\maroonE","\\textcolor{##9e034e}{#1}");Z("\\purpleA","\\textcolor{##ddd7ff}{#1}");Z("\\purpleB","\\textcolor{##c6b9fc}{#1}");Z("\\purpleC","\\textcolor{##aa87ff}{#1}");Z("\\purpleD","\\textcolor{##7854ab}{#1}");Z("\\purpleE","\\textcolor{##543b78}{#1}");Z("\\mintA","\\textcolor{##f5f9e8}{#1}");Z("\\mintB","\\textcolor{##edf2df}{#1}");Z("\\mintC","\\textcolor{##e0e5cc}{#1}");Z("\\grayA","\\textcolor{##f6f7f7}{#1}");Z("\\grayB","\\textcolor{##f0f1f2}{#1}");Z("\\grayC","\\textcolor{##e3e5e6}{#1}");Z("\\grayD","\\textcolor{##d6d8da}{#1}");Z("\\grayE","\\textcolor{##babec2}{#1}");Z("\\grayF","\\textcolor{##888d93}{#1}");Z("\\grayG","\\textcolor{##626569}{#1}");Z("\\grayH","\\textcolor{##3b3e40}{#1}");Z("\\grayI","\\textcolor{##21242c}{#1}");Z("\\kaBlue","\\textcolor{##314453}{#1}");Z("\\kaGreen","\\textcolor{##71B307}{#1}");var BQ={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0};class O2e{constructor(e,n,r){this.settings=void 0,this.expansionCount=void 0,this.lexer=void 0,this.macros=void 0,this.stack=void 0,this.mode=void 0,this.settings=n,this.expansionCount=0,this.feed(e),this.macros=new S2e(k2e,n.macros),this.mode=r,this.stack=[]}feed(e){this.lexer=new SM(e,this.settings)}switchMode(e){this.mode=e}beginGroup(){this.macros.beginGroup()}endGroup(){this.macros.endGroup()}endGroups(){this.macros.endGroups()}future(){return this.stack.length===0&&this.pushToken(this.lexer.lex()),this.stack[this.stack.length-1]}popToken(){return this.future(),this.stack.pop()}pushToken(e){this.stack.push(e)}pushTokens(e){this.stack.push(...e)}scanArgument(e){var n,r,s;if(e){if(this.consumeSpaces(),this.future().text!=="[")return null;n=this.popToken(),{tokens:s,end:r}=this.consumeArg(["]"])}else({tokens:s,start:n,end:r}=this.consumeArg());return this.pushToken(new Ai("EOF",r.loc)),this.pushTokens(s),new Ai("",Ys.range(n,r))}consumeSpaces(){for(;;){var e=this.future();if(e.text===" ")this.stack.pop();else break}}consumeArg(e){var n=[],r=e&&e.length>0;r||this.consumeSpaces();var s=this.future(),i,a=0,o=0;do{if(i=this.popToken(),n.push(i),i.text==="{")++a;else if(i.text==="}"){if(--a,a===-1)throw new Be("Extra }",i)}else if(i.text==="EOF")throw new Be("Unexpected end of input in a macro argument, expected '"+(e&&r?e[o]:"}")+"'",i);if(e&&r)if((a===0||a===1&&e[o]==="{")&&i.text===e[o]){if(++o,o===e.length){n.splice(-o,o);break}}else o=0}while(a!==0||r);return s.text==="{"&&n[n.length-1].text==="}"&&(n.pop(),n.shift()),n.reverse(),{tokens:n,start:s,end:i}}consumeArgs(e,n){if(n){if(n.length!==e+1)throw new Be("The length of delimiters doesn't match the number of args!");for(var r=n[0],s=0;sthis.settings.maxExpand)throw new Be("Too many expansions: infinite loop or need to increase maxExpand setting")}expandOnce(e){var n=this.popToken(),r=n.text,s=n.noexpand?null:this._getExpansion(r);if(s==null||e&&s.unexpandable){if(e&&s==null&&r[0]==="\\"&&!this.isDefined(r))throw new Be("Undefined control sequence: "+r);return this.pushToken(n),!1}this.countExpansion(1);var i=s.tokens,a=this.consumeArgs(s.numArgs,s.delimiters);if(s.numArgs){i=i.slice();for(var o=i.length-1;o>=0;--o){var c=i[o];if(c.text==="#"){if(o===0)throw new Be("Incomplete placeholder at end of macro body",c);if(c=i[--o],c.text==="#")i.splice(o+1,1);else if(/^[1-9]$/.test(c.text))i.splice(o,2,...a[+c.text-1]);else throw new Be("Not a valid argument number",c)}}}return this.pushTokens(i),i.length}expandAfterFuture(){return this.expandOnce(),this.future()}expandNextToken(){for(;;)if(this.expandOnce()===!1){var e=this.stack.pop();return e.treatAsRelax&&(e.text="\\relax"),e}throw new Error}expandMacro(e){return this.macros.has(e)?this.expandTokens([new Ai(e)]):void 0}expandTokens(e){var n=[],r=this.stack.length;for(this.pushTokens(e);this.stack.length>r;)if(this.expandOnce(!0)===!1){var s=this.stack.pop();s.treatAsRelax&&(s.noexpand=!1,s.treatAsRelax=!1),n.push(s)}return this.countExpansion(n.length),n}expandMacroAsText(e){var n=this.expandMacro(e);return n&&n.map(r=>r.text).join("")}_getExpansion(e){var n=this.macros.get(e);if(n==null)return n;if(e.length===1){var r=this.lexer.catcodes[e];if(r!=null&&r!==13)return}var s=typeof n=="function"?n(this):n;if(typeof s=="string"){var i=0;if(s.indexOf("#")!==-1)for(var a=s.replace(/##/g,"");a.indexOf("#"+(i+1))!==-1;)++i;for(var o=new SM(s,this.settings),c=[],h=o.lex();h.text!=="EOF";)c.push(h),h=o.lex();c.reverse();var f={tokens:c,numArgs:i};return f}return s}isDefined(e){return this.macros.has(e)||fc.hasOwnProperty(e)||Gn.math.hasOwnProperty(e)||Gn.text.hasOwnProperty(e)||BQ.hasOwnProperty(e)}isExpandable(e){var n=this.macros.get(e);return n!=null?typeof n=="string"||typeof n=="function"||!n.unexpandable:fc.hasOwnProperty(e)&&!fc[e].primitive}}var jM=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,zx=Object.freeze({"₊":"+","₋":"-","₌":"=","₍":"(","₎":")","₀":"0","₁":"1","₂":"2","₃":"3","₄":"4","₅":"5","₆":"6","₇":"7","₈":"8","₉":"9","ₐ":"a","ₑ":"e","ₕ":"h","ᵢ":"i","ⱼ":"j","ₖ":"k","ₗ":"l","ₘ":"m","ₙ":"n","ₒ":"o","ₚ":"p","ᵣ":"r","ₛ":"s","ₜ":"t","ᵤ":"u","ᵥ":"v","ₓ":"x","ᵦ":"β","ᵧ":"γ","ᵨ":"ρ","ᵩ":"ϕ","ᵪ":"χ","⁺":"+","⁻":"-","⁼":"=","⁽":"(","⁾":")","⁰":"0","¹":"1","²":"2","³":"3","⁴":"4","⁵":"5","⁶":"6","⁷":"7","⁸":"8","⁹":"9","ᴬ":"A","ᴮ":"B","ᴰ":"D","ᴱ":"E","ᴳ":"G","ᴴ":"H","ᴵ":"I","ᴶ":"J","ᴷ":"K","ᴸ":"L","ᴹ":"M","ᴺ":"N","ᴼ":"O","ᴾ":"P","ᴿ":"R","ᵀ":"T","ᵁ":"U","ⱽ":"V","ᵂ":"W","ᵃ":"a","ᵇ":"b","ᶜ":"c","ᵈ":"d","ᵉ":"e","ᶠ":"f","ᵍ":"g",ʰ:"h","ⁱ":"i",ʲ:"j","ᵏ":"k",ˡ:"l","ᵐ":"m",ⁿ:"n","ᵒ":"o","ᵖ":"p",ʳ:"r",ˢ:"s","ᵗ":"t","ᵘ":"u","ᵛ":"v",ʷ:"w",ˣ:"x",ʸ:"y","ᶻ":"z","ᵝ":"β","ᵞ":"γ","ᵟ":"δ","ᵠ":"ϕ","ᵡ":"χ","ᶿ":"θ"}),M4={"́":{text:"\\'",math:"\\acute"},"̀":{text:"\\`",math:"\\grave"},"̈":{text:'\\"',math:"\\ddot"},"̃":{text:"\\~",math:"\\tilde"},"̄":{text:"\\=",math:"\\bar"},"̆":{text:"\\u",math:"\\breve"},"̌":{text:"\\v",math:"\\check"},"̂":{text:"\\^",math:"\\hat"},"̇":{text:"\\.",math:"\\dot"},"̊":{text:"\\r",math:"\\mathring"},"̋":{text:"\\H"},"̧":{text:"\\c"}},NM={á:"á",à:"à",ä:"ä",ǟ:"ǟ",ã:"ã",ā:"ā",ă:"ă",ắ:"ắ",ằ:"ằ",ẵ:"ẵ",ǎ:"ǎ",â:"â",ấ:"ấ",ầ:"ầ",ẫ:"ẫ",ȧ:"ȧ",ǡ:"ǡ",å:"å",ǻ:"ǻ",ḃ:"ḃ",ć:"ć",ḉ:"ḉ",č:"č",ĉ:"ĉ",ċ:"ċ",ç:"ç",ď:"ď",ḋ:"ḋ",ḑ:"ḑ",é:"é",è:"è",ë:"ë",ẽ:"ẽ",ē:"ē",ḗ:"ḗ",ḕ:"ḕ",ĕ:"ĕ",ḝ:"ḝ",ě:"ě",ê:"ê",ế:"ế",ề:"ề",ễ:"ễ",ė:"ė",ȩ:"ȩ",ḟ:"ḟ",ǵ:"ǵ",ḡ:"ḡ",ğ:"ğ",ǧ:"ǧ",ĝ:"ĝ",ġ:"ġ",ģ:"ģ",ḧ:"ḧ",ȟ:"ȟ",ĥ:"ĥ",ḣ:"ḣ",ḩ:"ḩ",í:"í",ì:"ì",ï:"ï",ḯ:"ḯ",ĩ:"ĩ",ī:"ī",ĭ:"ĭ",ǐ:"ǐ",î:"î",ǰ:"ǰ",ĵ:"ĵ",ḱ:"ḱ",ǩ:"ǩ",ķ:"ķ",ĺ:"ĺ",ľ:"ľ",ļ:"ļ",ḿ:"ḿ",ṁ:"ṁ",ń:"ń",ǹ:"ǹ",ñ:"ñ",ň:"ň",ṅ:"ṅ",ņ:"ņ",ó:"ó",ò:"ò",ö:"ö",ȫ:"ȫ",õ:"õ",ṍ:"ṍ",ṏ:"ṏ",ȭ:"ȭ",ō:"ō",ṓ:"ṓ",ṑ:"ṑ",ŏ:"ŏ",ǒ:"ǒ",ô:"ô",ố:"ố",ồ:"ồ",ỗ:"ỗ",ȯ:"ȯ",ȱ:"ȱ",ő:"ő",ṕ:"ṕ",ṗ:"ṗ",ŕ:"ŕ",ř:"ř",ṙ:"ṙ",ŗ:"ŗ",ś:"ś",ṥ:"ṥ",š:"š",ṧ:"ṧ",ŝ:"ŝ",ṡ:"ṡ",ş:"ş",ẗ:"ẗ",ť:"ť",ṫ:"ṫ",ţ:"ţ",ú:"ú",ù:"ù",ü:"ü",ǘ:"ǘ",ǜ:"ǜ",ǖ:"ǖ",ǚ:"ǚ",ũ:"ũ",ṹ:"ṹ",ū:"ū",ṻ:"ṻ",ŭ:"ŭ",ǔ:"ǔ",û:"û",ů:"ů",ű:"ű",ṽ:"ṽ",ẃ:"ẃ",ẁ:"ẁ",ẅ:"ẅ",ŵ:"ŵ",ẇ:"ẇ",ẘ:"ẘ",ẍ:"ẍ",ẋ:"ẋ",ý:"ý",ỳ:"ỳ",ÿ:"ÿ",ỹ:"ỹ",ȳ:"ȳ",ŷ:"ŷ",ẏ:"ẏ",ẙ:"ẙ",ź:"ź",ž:"ž",ẑ:"ẑ",ż:"ż",Á:"Á",À:"À",Ä:"Ä",Ǟ:"Ǟ",Ã:"Ã",Ā:"Ā",Ă:"Ă",Ắ:"Ắ",Ằ:"Ằ",Ẵ:"Ẵ",Ǎ:"Ǎ",Â:"Â",Ấ:"Ấ",Ầ:"Ầ",Ẫ:"Ẫ",Ȧ:"Ȧ",Ǡ:"Ǡ",Å:"Å",Ǻ:"Ǻ",Ḃ:"Ḃ",Ć:"Ć",Ḉ:"Ḉ",Č:"Č",Ĉ:"Ĉ",Ċ:"Ċ",Ç:"Ç",Ď:"Ď",Ḋ:"Ḋ",Ḑ:"Ḑ",É:"É",È:"È",Ë:"Ë",Ẽ:"Ẽ",Ē:"Ē",Ḗ:"Ḗ",Ḕ:"Ḕ",Ĕ:"Ĕ",Ḝ:"Ḝ",Ě:"Ě",Ê:"Ê",Ế:"Ế",Ề:"Ề",Ễ:"Ễ",Ė:"Ė",Ȩ:"Ȩ",Ḟ:"Ḟ",Ǵ:"Ǵ",Ḡ:"Ḡ",Ğ:"Ğ",Ǧ:"Ǧ",Ĝ:"Ĝ",Ġ:"Ġ",Ģ:"Ģ",Ḧ:"Ḧ",Ȟ:"Ȟ",Ĥ:"Ĥ",Ḣ:"Ḣ",Ḩ:"Ḩ",Í:"Í",Ì:"Ì",Ï:"Ï",Ḯ:"Ḯ",Ĩ:"Ĩ",Ī:"Ī",Ĭ:"Ĭ",Ǐ:"Ǐ",Î:"Î",İ:"İ",Ĵ:"Ĵ",Ḱ:"Ḱ",Ǩ:"Ǩ",Ķ:"Ķ",Ĺ:"Ĺ",Ľ:"Ľ",Ļ:"Ļ",Ḿ:"Ḿ",Ṁ:"Ṁ",Ń:"Ń",Ǹ:"Ǹ",Ñ:"Ñ",Ň:"Ň",Ṅ:"Ṅ",Ņ:"Ņ",Ó:"Ó",Ò:"Ò",Ö:"Ö",Ȫ:"Ȫ",Õ:"Õ",Ṍ:"Ṍ",Ṏ:"Ṏ",Ȭ:"Ȭ",Ō:"Ō",Ṓ:"Ṓ",Ṑ:"Ṑ",Ŏ:"Ŏ",Ǒ:"Ǒ",Ô:"Ô",Ố:"Ố",Ồ:"Ồ",Ỗ:"Ỗ",Ȯ:"Ȯ",Ȱ:"Ȱ",Ő:"Ő",Ṕ:"Ṕ",Ṗ:"Ṗ",Ŕ:"Ŕ",Ř:"Ř",Ṙ:"Ṙ",Ŗ:"Ŗ",Ś:"Ś",Ṥ:"Ṥ",Š:"Š",Ṧ:"Ṧ",Ŝ:"Ŝ",Ṡ:"Ṡ",Ş:"Ş",Ť:"Ť",Ṫ:"Ṫ",Ţ:"Ţ",Ú:"Ú",Ù:"Ù",Ü:"Ü",Ǘ:"Ǘ",Ǜ:"Ǜ",Ǖ:"Ǖ",Ǚ:"Ǚ",Ũ:"Ũ",Ṹ:"Ṹ",Ū:"Ū",Ṻ:"Ṻ",Ŭ:"Ŭ",Ǔ:"Ǔ",Û:"Û",Ů:"Ů",Ű:"Ű",Ṽ:"Ṽ",Ẃ:"Ẃ",Ẁ:"Ẁ",Ẅ:"Ẅ",Ŵ:"Ŵ",Ẇ:"Ẇ",Ẍ:"Ẍ",Ẋ:"Ẋ",Ý:"Ý",Ỳ:"Ỳ",Ÿ:"Ÿ",Ỹ:"Ỹ",Ȳ:"Ȳ",Ŷ:"Ŷ",Ẏ:"Ẏ",Ź:"Ź",Ž:"Ž",Ẑ:"Ẑ",Ż:"Ż",ά:"ά",ὰ:"ὰ",ᾱ:"ᾱ",ᾰ:"ᾰ",έ:"έ",ὲ:"ὲ",ή:"ή",ὴ:"ὴ",ί:"ί",ὶ:"ὶ",ϊ:"ϊ",ΐ:"ΐ",ῒ:"ῒ",ῑ:"ῑ",ῐ:"ῐ",ό:"ό",ὸ:"ὸ",ύ:"ύ",ὺ:"ὺ",ϋ:"ϋ",ΰ:"ΰ",ῢ:"ῢ",ῡ:"ῡ",ῠ:"ῠ",ώ:"ώ",ὼ:"ὼ",Ύ:"Ύ",Ὺ:"Ὺ",Ϋ:"Ϋ",Ῡ:"Ῡ",Ῠ:"Ῠ",Ώ:"Ώ",Ὼ:"Ὼ"};class jy{constructor(e,n){this.mode=void 0,this.gullet=void 0,this.settings=void 0,this.leftrightDepth=void 0,this.nextToken=void 0,this.mode="math",this.gullet=new O2e(e,n,this.mode),this.settings=n,this.leftrightDepth=0}expect(e,n){if(n===void 0&&(n=!0),this.fetch().text!==e)throw new Be("Expected '"+e+"', got '"+this.fetch().text+"'",this.fetch());n&&this.consume()}consume(){this.nextToken=null}fetch(){return this.nextToken==null&&(this.nextToken=this.gullet.expandNextToken()),this.nextToken}switchMode(e){this.mode=e,this.gullet.switchMode(e)}parse(){this.settings.globalGroup||this.gullet.beginGroup(),this.settings.colorIsTextColor&&this.gullet.macros.set("\\color","\\textcolor");try{var e=this.parseExpression(!1);return this.expect("EOF"),this.settings.globalGroup||this.gullet.endGroup(),e}finally{this.gullet.endGroups()}}subparse(e){var n=this.nextToken;this.consume(),this.gullet.pushToken(new Ai("}")),this.gullet.pushTokens(e);var r=this.parseExpression(!1);return this.expect("}"),this.nextToken=n,r}parseExpression(e,n){for(var r=[];;){this.mode==="math"&&this.consumeSpaces();var s=this.fetch();if(jy.endOfExpression.indexOf(s.text)!==-1||n&&s.text===n||e&&fc[s.text]&&fc[s.text].infix)break;var i=this.parseAtom(n);if(i){if(i.type==="internal")continue}else break;r.push(i)}return this.mode==="text"&&this.formLigatures(r),this.handleInfixNodes(r)}handleInfixNodes(e){for(var n=-1,r,s=0;s=0&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+n[0]+'" used in math mode',e);var o=Gn[this.mode][n].group,c=Ys.range(e),h;if(hbe.hasOwnProperty(o)){var f=o;h={type:"atom",mode:this.mode,family:f,loc:c,text:n}}else h={type:o,mode:this.mode,loc:c,text:n};a=h}else if(n.charCodeAt(0)>=128)this.settings.strict&&(G$(n.charCodeAt(0))?this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Unicode text character "'+n[0]+'" used in math mode',e):this.settings.reportNonstrict("unknownSymbol",'Unrecognized Unicode character "'+n[0]+'"'+(" ("+n.charCodeAt(0)+")"),e)),a={type:"textord",mode:"text",loc:Ys.range(e),text:n};else return null;if(this.consume(),i)for(var m=0;mh&&(h=f):f&&(h!==void 0&&h>-1&&c.push(` -`.repeat(h)||" "),h=-1,c.push(f))}return c.join("")}function UQ(t,e,n){return t.type==="element"?twe(t,e,n):t.type==="text"?n.whitespace==="normal"?WQ(t,n):nwe(t):[]}function twe(t,e,n){const r=GQ(t,n),s=t.children||[];let i=-1,a=[];if(J2e(t))return a;let o,c;for(mk(t)||zM(t)&&MM(e,t,zM)?c=` -`:Z2e(t)?(o=2,c=2):VQ(t)&&(o=1,c=1);++i{try{i(!0);const je=await hwe({page:a,page_size:f,is_registered:g==="all"?void 0:g==="registered",is_banned:y==="all"?void 0:y==="banned",format:S==="all"?void 0:S,sort_by:N,sort_order:T});e(je.data),h(je.total)}catch(je){const Qe=je instanceof Error?je.message:"加载表情包列表失败";G({title:"错误",description:Qe,variant:"destructive"})}finally{i(!1)}},[a,f,g,y,S,N,T,G]),U=async()=>{try{const je=await gwe();r(je.data)}catch(je){console.error("加载统计数据失败:",je)}};b.useEffect(()=>{F()},[F]),b.useEffect(()=>{U()},[]);const te=async je=>{try{const Qe=await fwe(je.id);M(Qe.data),L(!0)}catch(Qe){const He=Qe instanceof Error?Qe.message:"加载详情失败";G({title:"错误",description:He,variant:"destructive"})}},ne=je=>{M(je),$(!0)},Y=je=>{M(je),ee(!0)},ae=async()=>{if(E)try{await pwe(E.id),G({title:"成功",description:"表情包已删除"}),ee(!1),M(null),F(),U()}catch(je){const Qe=je instanceof Error?je.message:"删除失败";G({title:"错误",description:Qe,variant:"destructive"})}},re=async je=>{try{await xwe(je.id),G({title:"成功",description:"表情包已注册"}),F(),U()}catch(Qe){const He=Qe instanceof Error?Qe.message:"注册失败";G({title:"错误",description:He,variant:"destructive"})}},le=async je=>{try{await vwe(je.id),G({title:"成功",description:"表情包已封禁"}),F(),U()}catch(Qe){const He=Qe instanceof Error?Qe.message:"封禁失败";G({title:"错误",description:He,variant:"destructive"})}},_e=je=>{const Qe=new Set(z);Qe.has(je)?Qe.delete(je):Qe.add(je),H(Qe)},Ge=async()=>{try{const je=await ywe(Array.from(z));G({title:"批量删除完成",description:je.message}),H(new Set),W(!1),F(),U()}catch(je){G({title:"批量删除失败",description:je instanceof Error?je.message:"批量删除失败",variant:"destructive"})}},tt=()=>{const je=parseInt(J),Qe=Math.ceil(c/f);je>=1&&je<=Qe?(o(je),X("")):G({title:"无效的页码",description:`请输入1-${Qe}之间的页码`,variant:"destructive"})},Xe=n?.formats?Object.keys(n.formats):[];return l.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[l.jsxs("div",{className:"mb-4 sm:mb-6",children:[l.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"表情包管理"}),l.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"管理麦麦的表情包资源"})]}),l.jsx(on,{className:"flex-1",children:l.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[n&&l.jsxs("div",{className:"grid gap-4 grid-cols-2 lg:grid-cols-4",children:[l.jsx(Tt,{children:l.jsxs(vn,{className:"pb-2",children:[l.jsx(zr,{children:"总数"}),l.jsx(yn,{className:"text-2xl",children:n.total})]})}),l.jsx(Tt,{children:l.jsxs(vn,{className:"pb-2",children:[l.jsx(zr,{children:"已注册"}),l.jsx(yn,{className:"text-2xl text-green-600",children:n.registered})]})}),l.jsx(Tt,{children:l.jsxs(vn,{className:"pb-2",children:[l.jsx(zr,{children:"已封禁"}),l.jsx(yn,{className:"text-2xl text-red-600",children:n.banned})]})}),l.jsx(Tt,{children:l.jsxs(vn,{className:"pb-2",children:[l.jsx(zr,{children:"未注册"}),l.jsx(yn,{className:"text-2xl text-gray-600",children:n.unregistered})]})})]}),l.jsxs(Tt,{children:[l.jsx(vn,{children:l.jsxs(yn,{className:"flex items-center gap-2",children:[l.jsx(_3,{className:"h-5 w-5"}),"筛选和排序"]})}),l.jsxs(En,{className:"space-y-4",children:[l.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(de,{children:"排序方式"}),l.jsxs(zt,{value:`${N}-${T}`,onValueChange:je=>{const[Qe,He]=je.split("-");C(Qe),_(He),o(1)},children:[l.jsx(At,{children:l.jsx(Pt,{})}),l.jsxs(Rt,{children:[l.jsx(ze,{value:"usage_count-desc",children:"使用次数 (多→少)"}),l.jsx(ze,{value:"usage_count-asc",children:"使用次数 (少→多)"}),l.jsx(ze,{value:"register_time-desc",children:"注册时间 (新→旧)"}),l.jsx(ze,{value:"register_time-asc",children:"注册时间 (旧→新)"}),l.jsx(ze,{value:"record_time-desc",children:"记录时间 (新→旧)"}),l.jsx(ze,{value:"record_time-asc",children:"记录时间 (旧→新)"}),l.jsx(ze,{value:"last_used_time-desc",children:"最后使用 (新→旧)"}),l.jsx(ze,{value:"last_used_time-asc",children:"最后使用 (旧→新)"})]})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(de,{children:"注册状态"}),l.jsxs(zt,{value:g,onValueChange:je=>{x(je),o(1)},children:[l.jsx(At,{children:l.jsx(Pt,{})}),l.jsxs(Rt,{children:[l.jsx(ze,{value:"all",children:"全部"}),l.jsx(ze,{value:"registered",children:"已注册"}),l.jsx(ze,{value:"unregistered",children:"未注册"})]})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(de,{children:"封禁状态"}),l.jsxs(zt,{value:y,onValueChange:je=>{w(je),o(1)},children:[l.jsx(At,{children:l.jsx(Pt,{})}),l.jsxs(Rt,{children:[l.jsx(ze,{value:"all",children:"全部"}),l.jsx(ze,{value:"banned",children:"已封禁"}),l.jsx(ze,{value:"unbanned",children:"未封禁"})]})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(de,{children:"格式"}),l.jsxs(zt,{value:S,onValueChange:je=>{k(je),o(1)},children:[l.jsx(At,{children:l.jsx(Pt,{})}),l.jsxs(Rt,{children:[l.jsx(ze,{value:"all",children:"全部"}),Xe.map(je=>l.jsxs(ze,{value:je,children:[je.toUpperCase()," (",n?.formats[je],")"]},je))]})]})]})]}),l.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 pt-4 border-t",children:[l.jsxs("div",{className:"flex items-center gap-4",children:[z.size>0&&l.jsxs("span",{className:"text-sm text-muted-foreground",children:["已选择 ",z.size," 个表情包"]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(de,{className:"text-sm whitespace-nowrap",children:"卡片大小"}),l.jsxs(zt,{value:R,onValueChange:je=>se(je),children:[l.jsx(At,{className:"w-24",children:l.jsx(Pt,{})}),l.jsxs(Rt,{children:[l.jsx(ze,{value:"small",children:"小"}),l.jsx(ze,{value:"medium",children:"中"}),l.jsx(ze,{value:"large",children:"大"})]})]})]})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(de,{htmlFor:"emoji-page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),l.jsxs(zt,{value:f.toString(),onValueChange:je=>{m(parseInt(je)),o(1),H(new Set)},children:[l.jsx(At,{id:"emoji-page-size",className:"w-20",children:l.jsx(Pt,{})}),l.jsxs(Rt,{children:[l.jsx(ze,{value:"20",children:"20"}),l.jsx(ze,{value:"40",children:"40"}),l.jsx(ze,{value:"60",children:"60"}),l.jsx(ze,{value:"100",children:"100"})]})]}),z.size>0&&l.jsxs(l.Fragment,{children:[l.jsx(fe,{variant:"outline",size:"sm",onClick:()=>H(new Set),children:"取消选择"}),l.jsxs(fe,{variant:"destructive",size:"sm",onClick:()=>W(!0),children:[l.jsx(ln,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]})]}),l.jsx("div",{className:"flex justify-end pt-4 border-t",children:l.jsxs(fe,{variant:"outline",size:"sm",onClick:F,disabled:s,children:[l.jsx(ti,{className:`h-4 w-4 mr-2 ${s?"animate-spin":""}`}),"刷新"]})})]})]}),l.jsxs(Tt,{children:[l.jsxs(vn,{children:[l.jsx(yn,{children:"表情包列表"}),l.jsxs(zr,{children:["共 ",c," 个表情包,当前第 ",a," 页"]})]}),l.jsxs(En,{children:[t.length===0?l.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"暂无数据"}):l.jsx("div",{className:`grid gap-3 ${R==="small"?"grid-cols-3 sm:grid-cols-4 md:grid-cols-6 lg:grid-cols-8 xl:grid-cols-10":R==="medium"?"grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6 xl:grid-cols-8":"grid-cols-2 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5"}`,children:t.map(je=>l.jsxs("div",{className:`group relative rounded-lg border bg-card overflow-hidden hover:ring-2 hover:ring-primary transition-all cursor-pointer ${z.has(je.id)?"ring-2 ring-primary bg-primary/5":""}`,onClick:()=>_e(je.id),children:[l.jsx("div",{className:`absolute top-1 left-1 z-10 transition-opacity ${z.has(je.id)?"opacity-100":"opacity-0 group-hover:opacity-100"}`,children:l.jsx("div",{className:`w-5 h-5 rounded-full border-2 flex items-center justify-center ${z.has(je.id)?"bg-primary border-primary text-primary-foreground":"bg-background/80 border-muted-foreground/50"}`,children:z.has(je.id)&&l.jsx(xc,{className:"h-3 w-3"})})}),l.jsxs("div",{className:"absolute top-1 right-1 z-10 flex flex-col gap-0.5",children:[je.is_registered&&l.jsx(In,{variant:"default",className:"bg-green-600 text-[10px] px-1 py-0",children:"已注册"}),je.is_banned&&l.jsx(In,{variant:"destructive",className:"text-[10px] px-1 py-0",children:"已封禁"})]}),l.jsx("div",{className:`aspect-square bg-muted flex items-center justify-center overflow-hidden ${R==="small"?"p-1":R==="medium"?"p-2":"p-3"}`,children:l.jsx("img",{src:XQ(je.id),alt:"表情包",className:"w-full h-full object-contain",loading:"lazy",onError:Qe=>{const He=Qe.target;He.style.display="none";const $e=He.parentElement;$e&&($e.innerHTML='')}})}),l.jsxs("div",{className:`border-t bg-card ${R==="small"?"p-1":"p-2"}`,children:[l.jsxs("div",{className:"flex items-center justify-between gap-1 text-xs text-muted-foreground mb-1",children:[l.jsx(In,{variant:"outline",className:"text-[10px] px-1 py-0",children:je.format.toUpperCase()}),l.jsxs("span",{className:"font-mono",children:[je.usage_count,"次"]})]}),l.jsxs("div",{className:`flex gap-1 justify-center opacity-0 group-hover:opacity-100 transition-opacity ${R==="small"?"flex-wrap":""}`,children:[l.jsx(fe,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:Qe=>{Qe.stopPropagation(),ne(je)},title:"编辑",children:l.jsx($m,{className:"h-3 w-3"})}),l.jsx(fe,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:Qe=>{Qe.stopPropagation(),te(je)},title:"详情",children:l.jsx(Oa,{className:"h-3 w-3"})}),!je.is_registered&&l.jsx(fe,{variant:"ghost",size:"icon",className:"h-6 w-6 text-green-600 hover:text-green-700",onClick:Qe=>{Qe.stopPropagation(),re(je)},title:"注册",children:l.jsx(xc,{className:"h-3 w-3"})}),!je.is_banned&&l.jsx(fe,{variant:"ghost",size:"icon",className:"h-6 w-6 text-orange-600 hover:text-orange-700",onClick:Qe=>{Qe.stopPropagation(),le(je)},title:"封禁",children:l.jsx($K,{className:"h-3 w-3"})}),l.jsx(fe,{variant:"ghost",size:"icon",className:"h-6 w-6 text-red-600 hover:text-red-700",onClick:Qe=>{Qe.stopPropagation(),Y(je)},title:"删除",children:l.jsx(ln,{className:"h-3 w-3"})})]})]})]},je.id))}),c>0&&l.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[l.jsxs("div",{className:"text-sm text-muted-foreground",children:["显示 ",(a-1)*f+1," 到"," ",Math.min(a*f,c)," 条,共 ",c," 条"]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(fe,{variant:"outline",size:"sm",onClick:()=>o(1),disabled:a===1,className:"hidden sm:flex",children:l.jsx(D0,{className:"h-4 w-4"})}),l.jsxs(fe,{variant:"outline",size:"sm",onClick:()=>o(je=>Math.max(1,je-1)),disabled:a===1,children:[l.jsx(qu,{className:"h-4 w-4 sm:mr-1"}),l.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Pe,{type:"number",value:J,onChange:je=>X(je.target.value),onKeyDown:je=>je.key==="Enter"&&tt(),placeholder:a.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(c/f)}),l.jsx(fe,{variant:"outline",size:"sm",onClick:tt,disabled:!J,className:"h-8",children:"跳转"})]}),l.jsxs(fe,{variant:"outline",size:"sm",onClick:()=>o(je=>je+1),disabled:a>=Math.ceil(c/f),children:[l.jsx("span",{className:"hidden sm:inline",children:"下一页"}),l.jsx(Fu,{className:"h-4 w-4 sm:ml-1"})]}),l.jsx(fe,{variant:"outline",size:"sm",onClick:()=>o(Math.ceil(c/f)),disabled:a>=Math.ceil(c/f),className:"hidden sm:flex",children:l.jsx(z0,{className:"h-4 w-4"})})]})]})]})]}),l.jsx(wwe,{emoji:E,open:q,onOpenChange:L}),l.jsx(Swe,{emoji:E,open:I,onOpenChange:$,onSuccess:()=>{F(),U()}})]})}),l.jsx(wn,{open:P,onOpenChange:W,children:l.jsxs(un,{children:[l.jsxs(dn,{children:[l.jsx(fn,{children:"确认批量删除"}),l.jsxs(mn,{children:["你确定要删除选中的 ",z.size," 个表情包吗?此操作不可撤销。"]})]}),l.jsxs(hn,{children:[l.jsx(gn,{children:"取消"}),l.jsx(pn,{onClick:Ge,children:"确认删除"})]})]})}),l.jsx(fr,{open:V,onOpenChange:ee,children:l.jsxs(rr,{children:[l.jsxs(sr,{children:[l.jsx(ir,{children:"确认删除"}),l.jsx(Ir,{children:"确定要删除这个表情包吗?此操作无法撤销。"})]}),l.jsxs(ts,{children:[l.jsx(fe,{variant:"outline",onClick:()=>ee(!1),children:"取消"}),l.jsx(fe,{variant:"destructive",onClick:ae,children:"删除"})]})]})})]})}function wwe({emoji:t,open:e,onOpenChange:n}){if(!t)return null;const r=s=>s?new Date(s*1e3).toLocaleString("zh-CN"):"-";return l.jsx(fr,{open:e,onOpenChange:n,children:l.jsxs(rr,{className:"max-w-2xl max-h-[90vh]",children:[l.jsx(sr,{children:l.jsx(ir,{children:"表情包详情"})}),l.jsx(on,{className:"max-h-[calc(90vh-8rem)] pr-4",children:l.jsxs("div",{className:"space-y-4",children:[l.jsx("div",{className:"flex justify-center",children:l.jsx("div",{className:"w-32 h-32 bg-muted rounded-lg flex items-center justify-center overflow-hidden",children:l.jsx("img",{src:XQ(t.id),alt:t.description||"表情包",className:"w-full h-full object-cover",onError:s=>{const i=s.target;i.style.display="none";const a=i.parentElement;a&&(a.innerHTML='')}})})}),l.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[l.jsxs("div",{children:[l.jsx(de,{className:"text-muted-foreground",children:"ID"}),l.jsx("div",{className:"mt-1 font-mono",children:t.id})]}),l.jsxs("div",{children:[l.jsx(de,{className:"text-muted-foreground",children:"格式"}),l.jsx("div",{className:"mt-1",children:l.jsx(In,{variant:"outline",children:t.format.toUpperCase()})})]})]}),l.jsxs("div",{children:[l.jsx(de,{className:"text-muted-foreground",children:"文件路径"}),l.jsx("div",{className:"mt-1 font-mono text-sm break-all bg-muted p-2 rounded",children:t.full_path})]}),l.jsxs("div",{children:[l.jsx(de,{className:"text-muted-foreground",children:"哈希值"}),l.jsx("div",{className:"mt-1 font-mono text-sm break-all bg-muted p-2 rounded",children:t.emoji_hash})]}),l.jsxs("div",{children:[l.jsx(de,{className:"text-muted-foreground",children:"描述"}),t.description?l.jsx("div",{className:"mt-1 rounded-lg border bg-muted/50 p-3",children:l.jsx(dwe,{className:"prose-sm",children:t.description})}):l.jsx("div",{className:"mt-1 text-sm text-muted-foreground",children:"-"})]}),l.jsxs("div",{children:[l.jsx(de,{className:"text-muted-foreground",children:"情绪"}),l.jsx("div",{className:"mt-1",children:t.emotion?l.jsx("span",{className:"text-sm",children:t.emotion}):l.jsx("span",{className:"text-sm text-muted-foreground",children:"-"})})]}),l.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[l.jsxs("div",{children:[l.jsx(de,{className:"text-muted-foreground",children:"状态"}),l.jsxs("div",{className:"mt-2 flex gap-2",children:[t.is_registered&&l.jsx(In,{variant:"default",className:"bg-green-600",children:"已注册"}),t.is_banned&&l.jsx(In,{variant:"destructive",children:"已封禁"}),!t.is_registered&&!t.is_banned&&l.jsx(In,{variant:"outline",children:"未注册"})]})]}),l.jsxs("div",{children:[l.jsx(de,{className:"text-muted-foreground",children:"使用次数"}),l.jsx("div",{className:"mt-1 font-mono text-lg",children:t.usage_count})]})]}),l.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[l.jsxs("div",{children:[l.jsx(de,{className:"text-muted-foreground",children:"记录时间"}),l.jsx("div",{className:"mt-1 text-sm",children:r(t.record_time)})]}),l.jsxs("div",{children:[l.jsx(de,{className:"text-muted-foreground",children:"注册时间"}),l.jsx("div",{className:"mt-1 text-sm",children:r(t.register_time)})]})]}),l.jsxs("div",{children:[l.jsx(de,{className:"text-muted-foreground",children:"最后使用"}),l.jsx("div",{className:"mt-1 text-sm",children:r(t.last_used_time)})]})]})})]})})}function Swe({emoji:t,open:e,onOpenChange:n,onSuccess:r}){const[s,i]=b.useState(""),[a,o]=b.useState(!1),[c,h]=b.useState(!1),[f,m]=b.useState(!1),{toast:g}=Gr();b.useEffect(()=>{t&&(i(t.emotion||""),o(t.is_registered),h(t.is_banned))},[t]);const x=async()=>{if(t)try{m(!0);const y=s.split(/[,,]/).map(w=>w.trim()).filter(Boolean).join(",");await mwe(t.id,{emotion:y||void 0,is_registered:a,is_banned:c}),g({title:"成功",description:"表情包信息已更新"}),n(!1),r()}catch(y){const w=y instanceof Error?y.message:"保存失败";g({title:"错误",description:w,variant:"destructive"})}finally{m(!1)}};return t?l.jsx(fr,{open:e,onOpenChange:n,children:l.jsxs(rr,{className:"max-w-2xl",children:[l.jsxs(sr,{children:[l.jsx(ir,{children:"编辑表情包"}),l.jsx(Ir,{children:"修改表情包的情绪和状态信息"})]}),l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{children:[l.jsx(de,{children:"情绪"}),l.jsx(dr,{value:s,onChange:y=>i(y.target.value),placeholder:"输入情绪描述...",rows:2,className:"mt-1"}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"输入情绪相关的文本描述"})]}),l.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(ii,{id:"is_registered",checked:a,onCheckedChange:y=>{y===!0?(o(!0),h(!1)):o(!1)}}),l.jsx(de,{htmlFor:"is_registered",className:"cursor-pointer",children:"已注册"})]}),l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(ii,{id:"is_banned",checked:c,onCheckedChange:y=>{y===!0?(h(!0),o(!1)):h(!1)}}),l.jsx(de,{htmlFor:"is_banned",className:"cursor-pointer",children:"已封禁"})]})]})]}),l.jsxs(ts,{children:[l.jsx(fe,{variant:"outline",onClick:()=>n(!1),children:"取消"}),l.jsx(fe,{onClick:x,disabled:f,children:f?"保存中...":"保存"})]})]})}):null}const Pc="/api/webui/expression";async function kwe(){const t=await mt(`${Pc}/chats`,{headers:Nt()});if(!t.ok){const e=await t.json();throw new Error(e.detail||"获取聊天列表失败")}return t.json()}async function Owe(t){const e=new URLSearchParams;t.page&&e.append("page",t.page.toString()),t.page_size&&e.append("page_size",t.page_size.toString()),t.search&&e.append("search",t.search),t.chat_id&&e.append("chat_id",t.chat_id);const n=await mt(`${Pc}/list?${e}`,{headers:Nt()});if(!n.ok){const r=await n.json();throw new Error(r.detail||"获取表达方式列表失败")}return n.json()}async function jwe(t){const e=await mt(`${Pc}/${t}`,{headers:Nt()});if(!e.ok){const n=await e.json();throw new Error(n.detail||"获取表达方式详情失败")}return e.json()}async function Nwe(t){const e=await mt(`${Pc}/`,{method:"POST",headers:Nt(),body:JSON.stringify(t)});if(!e.ok){const n=await e.json();throw new Error(n.detail||"创建表达方式失败")}return e.json()}async function Cwe(t,e){const n=await mt(`${Pc}/${t}`,{method:"PATCH",headers:Nt(),body:JSON.stringify(e)});if(!n.ok){const r=await n.json();throw new Error(r.detail||"更新表达方式失败")}return n.json()}async function Twe(t){const e=await mt(`${Pc}/${t}`,{method:"DELETE",headers:Nt()});if(!e.ok){const n=await e.json();throw new Error(n.detail||"删除表达方式失败")}return e.json()}async function Ewe(t){const e=await mt(`${Pc}/batch/delete`,{method:"POST",headers:Nt(),body:JSON.stringify({ids:t})});if(!e.ok){const n=await e.json();throw new Error(n.detail||"批量删除表达方式失败")}return e.json()}async function _we(){const t=await mt(`${Pc}/stats/summary`,{headers:Nt()});if(!t.ok){const e=await t.json();throw new Error(e.detail||"获取统计数据失败")}return t.json()}function Mwe(){const[t,e]=b.useState([]),[n,r]=b.useState(!0),[s,i]=b.useState(0),[a,o]=b.useState(1),[c,h]=b.useState(20),[f,m]=b.useState(""),[g,x]=b.useState(null),[y,w]=b.useState(!1),[S,k]=b.useState(!1),[N,C]=b.useState(!1),[T,_]=b.useState(null),[E,M]=b.useState(new Set),[q,L]=b.useState(!1),[I,$]=b.useState(""),[V,ee]=b.useState({total:0,recent_7days:0,chat_count:0,top_chats:{}}),[z,H]=b.useState([]),[P,W]=b.useState(new Map),{toast:J}=Gr(),X=async()=>{try{r(!0);const le=await Owe({page:a,page_size:c,search:f||void 0});e(le.data),i(le.total)}catch(le){J({title:"加载失败",description:le instanceof Error?le.message:"无法加载表达方式",variant:"destructive"})}finally{r(!1)}},R=async()=>{try{const le=await _we();le?.data&&ee(le.data)}catch(le){console.error("加载统计数据失败:",le)}},se=async()=>{try{const le=await kwe();if(le?.data){H(le.data);const _e=new Map;le.data.forEach(Ge=>{_e.set(Ge.chat_id,Ge.chat_name)}),W(_e)}}catch(le){console.error("加载聊天列表失败:",le)}},G=le=>P.get(le)||le;b.useEffect(()=>{X(),R(),se()},[a,c,f]);const F=async le=>{try{const _e=await jwe(le.id);x(_e.data),w(!0)}catch(_e){J({title:"加载详情失败",description:_e instanceof Error?_e.message:"无法加载表达方式详情",variant:"destructive"})}},U=le=>{x(le),k(!0)},te=async le=>{try{await Twe(le.id),J({title:"删除成功",description:`已删除表达方式: ${le.situation}`}),_(null),X(),R()}catch(_e){J({title:"删除失败",description:_e instanceof Error?_e.message:"无法删除表达方式",variant:"destructive"})}},ne=le=>{const _e=new Set(E);_e.has(le)?_e.delete(le):_e.add(le),M(_e)},Y=()=>{E.size===t.length&&t.length>0?M(new Set):M(new Set(t.map(le=>le.id)))},ae=async()=>{try{await Ewe(Array.from(E)),J({title:"批量删除成功",description:`已删除 ${E.size} 个表达方式`}),M(new Set),L(!1),X(),R()}catch(le){J({title:"批量删除失败",description:le instanceof Error?le.message:"无法批量删除表达方式",variant:"destructive"})}},re=()=>{const le=parseInt(I),_e=Math.ceil(s/c);le>=1&&le<=_e?(o(le),$("")):J({title:"无效的页码",description:`请输入1-${_e}之间的页码`,variant:"destructive"})};return l.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[l.jsx("div",{className:"mb-4 sm:mb-6",children:l.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[l.jsxs("div",{children:[l.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[l.jsx(A0,{className:"h-8 w-8",strokeWidth:2}),"表达方式管理"]}),l.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"管理麦麦的表达方式和话术模板"})]}),l.jsxs(fe,{onClick:()=>C(!0),className:"gap-2",children:[l.jsx(gs,{className:"h-4 w-4"}),"新增表达方式"]})]})}),l.jsx(on,{className:"flex-1",children:l.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[l.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[l.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[l.jsx("div",{className:"text-sm text-muted-foreground",children:"总数量"}),l.jsx("div",{className:"text-2xl font-bold mt-1",children:V.total})]}),l.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[l.jsx("div",{className:"text-sm text-muted-foreground",children:"近7天新增"}),l.jsx("div",{className:"text-2xl font-bold mt-1 text-green-600",children:V.recent_7days})]}),l.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[l.jsx("div",{className:"text-sm text-muted-foreground",children:"关联聊天数"}),l.jsx("div",{className:"text-2xl font-bold mt-1 text-blue-600",children:V.chat_count})]})]}),l.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[l.jsx(de,{htmlFor:"search",children:"搜索"}),l.jsx("div",{className:"flex flex-col sm:flex-row gap-2 mt-1.5",children:l.jsxs("div",{className:"flex-1 relative",children:[l.jsx(li,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),l.jsx(Pe,{id:"search",placeholder:"搜索情境、风格或上下文...",value:f,onChange:le=>m(le.target.value),className:"pl-9"})]})}),l.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 mt-4 pt-4 border-t",children:[l.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:E.size>0&&l.jsxs("span",{children:["已选择 ",E.size," 个表达方式"]})}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(de,{htmlFor:"page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),l.jsxs(zt,{value:c.toString(),onValueChange:le=>{h(parseInt(le)),o(1),M(new Set)},children:[l.jsx(At,{id:"page-size",className:"w-20",children:l.jsx(Pt,{})}),l.jsxs(Rt,{children:[l.jsx(ze,{value:"10",children:"10"}),l.jsx(ze,{value:"20",children:"20"}),l.jsx(ze,{value:"50",children:"50"}),l.jsx(ze,{value:"100",children:"100"})]})]}),E.size>0&&l.jsxs(l.Fragment,{children:[l.jsx(fe,{variant:"outline",size:"sm",onClick:()=>M(new Set),children:"取消选择"}),l.jsxs(fe,{variant:"destructive",size:"sm",onClick:()=>L(!0),children:[l.jsx(ln,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]})]})]}),l.jsxs("div",{className:"rounded-lg border bg-card",children:[l.jsx("div",{className:"hidden md:block",children:l.jsxs(Vh,{children:[l.jsx(Uh,{children:l.jsxs(ps,{children:[l.jsx(tn,{className:"w-12",children:l.jsx(ii,{checked:E.size===t.length&&t.length>0,onCheckedChange:Y})}),l.jsx(tn,{children:"情境"}),l.jsx(tn,{children:"风格"}),l.jsx(tn,{children:"聊天"}),l.jsx(tn,{className:"text-right",children:"操作"})]})}),l.jsx(Wh,{children:n?l.jsx(ps,{children:l.jsx(It,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):t.length===0?l.jsx(ps,{children:l.jsx(It,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):t.map(le=>l.jsxs(ps,{children:[l.jsx(It,{children:l.jsx(ii,{checked:E.has(le.id),onCheckedChange:()=>ne(le.id)})}),l.jsx(It,{className:"font-medium max-w-xs truncate",children:le.situation}),l.jsx(It,{className:"max-w-xs truncate",children:le.style}),l.jsx(It,{className:"max-w-[200px] truncate",title:G(le.chat_id),style:{wordBreak:"keep-all"},children:l.jsx("span",{className:"whitespace-nowrap overflow-hidden text-ellipsis block",children:G(le.chat_id)})}),l.jsx(It,{className:"text-right",children:l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsxs(fe,{variant:"default",size:"sm",onClick:()=>U(le),children:[l.jsx($m,{className:"h-4 w-4 mr-1"}),"编辑"]}),l.jsx(fe,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>F(le),title:"查看详情",children:l.jsx(aa,{className:"h-4 w-4"})}),l.jsxs(fe,{size:"sm",onClick:()=>_(le),className:"bg-red-600 hover:bg-red-700 text-white",children:[l.jsx(ln,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},le.id))})]})}),l.jsx("div",{className:"md:hidden space-y-3 p-4",children:n?l.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):t.length===0?l.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):t.map(le=>l.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3 overflow-hidden",children:[l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx(ii,{checked:E.has(le.id),onCheckedChange:()=>ne(le.id),className:"mt-1"}),l.jsxs("div",{className:"min-w-0 flex-1 overflow-hidden space-y-2",children:[l.jsxs("div",{children:[l.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"情境"}),l.jsx("h3",{className:"font-semibold text-sm line-clamp-2 w-full break-all",title:le.situation,children:le.situation})]}),l.jsxs("div",{children:[l.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"风格"}),l.jsx("p",{className:"text-sm line-clamp-2 w-full break-all",title:le.style,children:le.style})]})]})]}),l.jsxs("div",{className:"text-sm",children:[l.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"聊天"}),l.jsx("p",{className:"text-sm truncate",title:G(le.chat_id),style:{wordBreak:"keep-all"},children:G(le.chat_id)})]}),l.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t overflow-hidden",children:[l.jsxs(fe,{variant:"outline",size:"sm",onClick:()=>U(le),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[l.jsx($m,{className:"h-3 w-3 mr-1"}),"编辑"]}),l.jsx(fe,{variant:"outline",size:"sm",onClick:()=>F(le),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:l.jsx(aa,{className:"h-3 w-3"})}),l.jsxs(fe,{variant:"outline",size:"sm",onClick:()=>_(le),className:"text-xs px-2 py-1 h-auto flex-shrink-0 text-destructive hover:text-destructive",children:[l.jsx(ln,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},le.id))}),s>0&&l.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 px-4 py-3 border-t",children:[l.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",s," 条记录,第 ",a," / ",Math.ceil(s/c)," 页"]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(fe,{variant:"outline",size:"sm",onClick:()=>o(1),disabled:a===1,className:"hidden sm:flex",children:l.jsx(D0,{className:"h-4 w-4"})}),l.jsxs(fe,{variant:"outline",size:"sm",onClick:()=>o(a-1),disabled:a===1,children:[l.jsx(qu,{className:"h-4 w-4 sm:mr-1"}),l.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Pe,{type:"number",value:I,onChange:le=>$(le.target.value),onKeyDown:le=>le.key==="Enter"&&re(),placeholder:a.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(s/c)}),l.jsx(fe,{variant:"outline",size:"sm",onClick:re,disabled:!I,className:"h-8",children:"跳转"})]}),l.jsxs(fe,{variant:"outline",size:"sm",onClick:()=>o(a+1),disabled:a>=Math.ceil(s/c),children:[l.jsx("span",{className:"hidden sm:inline",children:"下一页"}),l.jsx(Fu,{className:"h-4 w-4 sm:ml-1"})]}),l.jsx(fe,{variant:"outline",size:"sm",onClick:()=>o(Math.ceil(s/c)),disabled:a>=Math.ceil(s/c),className:"hidden sm:flex",children:l.jsx(z0,{className:"h-4 w-4"})})]})]})]})]})}),l.jsx(Awe,{expression:g,open:y,onOpenChange:w,chatNameMap:P}),l.jsx(Rwe,{open:N,onOpenChange:C,chatList:z,onSuccess:()=>{X(),R(),C(!1)}}),l.jsx(Dwe,{expression:g,open:S,onOpenChange:k,chatList:z,onSuccess:()=>{X(),R(),k(!1)}}),l.jsx(wn,{open:!!T,onOpenChange:()=>_(null),children:l.jsxs(un,{children:[l.jsxs(dn,{children:[l.jsx(fn,{children:"确认删除"}),l.jsxs(mn,{children:['确定要删除表达方式 "',T?.situation,'" 吗? 此操作不可撤销。']})]}),l.jsxs(hn,{children:[l.jsx(gn,{children:"取消"}),l.jsx(pn,{onClick:()=>T&&te(T),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})}),l.jsx(zwe,{open:q,onOpenChange:L,onConfirm:ae,count:E.size})]})}function Awe({expression:t,open:e,onOpenChange:n,chatNameMap:r}){if(!t)return null;const s=a=>a?new Date(a*1e3).toLocaleString("zh-CN"):"-",i=a=>r.get(a)||a;return l.jsx(fr,{open:e,onOpenChange:n,children:l.jsxs(rr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[l.jsxs(sr,{children:[l.jsx(ir,{children:"表达方式详情"}),l.jsx(Ir,{children:"查看表达方式的完整信息"})]}),l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[l.jsx(om,{label:"情境",value:t.situation}),l.jsx(om,{label:"风格",value:t.style}),l.jsx(om,{label:"聊天",value:i(t.chat_id)}),l.jsx(om,{icon:M3,label:"记录ID",value:t.id.toString(),mono:!0})]}),l.jsx("div",{className:"grid grid-cols-2 gap-4",children:l.jsx(om,{icon:Yd,label:"创建时间",value:s(t.create_date)})})]}),l.jsx(ts,{children:l.jsx(fe,{onClick:()=>n(!1),children:"关闭"})})]})})}function om({icon:t,label:e,value:n,mono:r=!1}){return l.jsxs("div",{className:"space-y-1",children:[l.jsxs(de,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[t&&l.jsx(t,{className:"h-3 w-3"}),e]}),l.jsx("div",{className:ye("text-sm",r&&"font-mono",!n&&"text-muted-foreground"),children:n||"-"})]})}function Rwe({open:t,onOpenChange:e,chatList:n,onSuccess:r}){const[s,i]=b.useState({situation:"",style:"",chat_id:""}),[a,o]=b.useState(!1),{toast:c}=Gr(),h=async()=>{if(!s.situation||!s.style||!s.chat_id){c({title:"验证失败",description:"请填写必填字段:情境、风格和聊天",variant:"destructive"});return}try{o(!0),await Nwe(s),c({title:"创建成功",description:"表达方式已创建"}),i({situation:"",style:"",chat_id:""}),r()}catch(f){c({title:"创建失败",description:f instanceof Error?f.message:"无法创建表达方式",variant:"destructive"})}finally{o(!1)}};return l.jsx(fr,{open:t,onOpenChange:e,children:l.jsxs(rr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[l.jsxs(sr,{children:[l.jsx(ir,{children:"新增表达方式"}),l.jsx(Ir,{children:"创建新的表达方式记录"})]}),l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsxs(de,{htmlFor:"situation",children:["情境 ",l.jsx("span",{className:"text-destructive",children:"*"})]}),l.jsx(Pe,{id:"situation",value:s.situation,onChange:f=>i({...s,situation:f.target.value}),placeholder:"描述使用场景"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsxs(de,{htmlFor:"style",children:["风格 ",l.jsx("span",{className:"text-destructive",children:"*"})]}),l.jsx(Pe,{id:"style",value:s.style,onChange:f=>i({...s,style:f.target.value}),placeholder:"描述表达风格"})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsxs(de,{htmlFor:"chat_id",children:["聊天 ",l.jsx("span",{className:"text-destructive",children:"*"})]}),l.jsxs(zt,{value:s.chat_id,onValueChange:f=>i({...s,chat_id:f}),children:[l.jsx(At,{children:l.jsx(Pt,{placeholder:"选择关联的聊天"})}),l.jsx(Rt,{children:n.map(f=>l.jsx(ze,{value:f.chat_id,children:l.jsxs("span",{className:"truncate",style:{wordBreak:"keep-all"},children:[f.chat_name,f.is_group&&l.jsx("span",{className:"text-muted-foreground ml-1",children:"(群聊)"})]})},f.chat_id))})]})]})]}),l.jsxs(ts,{children:[l.jsx(fe,{variant:"outline",onClick:()=>e(!1),children:"取消"}),l.jsx(fe,{onClick:h,disabled:a,children:a?"创建中...":"创建"})]})]})})}function Dwe({expression:t,open:e,onOpenChange:n,chatList:r,onSuccess:s}){const[i,a]=b.useState({}),[o,c]=b.useState(!1),{toast:h}=Gr();b.useEffect(()=>{t&&a({situation:t.situation,style:t.style,chat_id:t.chat_id})},[t]);const f=async()=>{if(t)try{c(!0),await Cwe(t.id,i),h({title:"保存成功",description:"表达方式已更新"}),s()}catch(m){h({title:"保存失败",description:m instanceof Error?m.message:"无法更新表达方式",variant:"destructive"})}finally{c(!1)}};return t?l.jsx(fr,{open:e,onOpenChange:n,children:l.jsxs(rr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[l.jsxs(sr,{children:[l.jsx(ir,{children:"编辑表达方式"}),l.jsx(Ir,{children:"修改表达方式的信息"})]}),l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(de,{htmlFor:"edit_situation",children:"情境"}),l.jsx(Pe,{id:"edit_situation",value:i.situation||"",onChange:m=>a({...i,situation:m.target.value}),placeholder:"描述使用场景"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(de,{htmlFor:"edit_style",children:"风格"}),l.jsx(Pe,{id:"edit_style",value:i.style||"",onChange:m=>a({...i,style:m.target.value}),placeholder:"描述表达风格"})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(de,{htmlFor:"edit_chat_id",children:"聊天"}),l.jsxs(zt,{value:i.chat_id||"",onValueChange:m=>a({...i,chat_id:m}),children:[l.jsx(At,{children:l.jsx(Pt,{placeholder:"选择关联的聊天"})}),l.jsx(Rt,{children:r.map(m=>l.jsx(ze,{value:m.chat_id,children:l.jsxs("span",{className:"truncate",style:{wordBreak:"keep-all"},children:[m.chat_name,m.is_group&&l.jsx("span",{className:"text-muted-foreground ml-1",children:"(群聊)"})]})},m.chat_id))})]})]})]}),l.jsxs(ts,{children:[l.jsx(fe,{variant:"outline",onClick:()=>n(!1),children:"取消"}),l.jsx(fe,{onClick:f,disabled:o,children:o?"保存中...":"保存"})]})]})}):null}function zwe({open:t,onOpenChange:e,onConfirm:n,count:r}){return l.jsx(wn,{open:t,onOpenChange:e,children:l.jsxs(un,{children:[l.jsxs(dn,{children:[l.jsx(fn,{children:"确认批量删除"}),l.jsxs(mn,{children:["您即将删除 ",r," 个表达方式,此操作无法撤销。确定要继续吗?"]})]}),l.jsxs(hn,{children:[l.jsx(gn,{children:"取消"}),l.jsx(pn,{onClick:n,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"确认删除"})]})]})})}const tf="/api/webui/person";async function Pwe(t){const e=new URLSearchParams;t.page&&e.append("page",t.page.toString()),t.page_size&&e.append("page_size",t.page_size.toString()),t.search&&e.append("search",t.search),t.is_known!==void 0&&e.append("is_known",t.is_known.toString()),t.platform&&e.append("platform",t.platform);const n=await mt(`${tf}/list?${e}`,{headers:Nt()});if(!n.ok){const r=await n.json();throw new Error(r.detail||"获取人物列表失败")}return n.json()}async function Lwe(t){const e=await mt(`${tf}/${t}`,{headers:Nt()});if(!e.ok){const n=await e.json();throw new Error(n.detail||"获取人物详情失败")}return e.json()}async function Iwe(t,e){const n=await mt(`${tf}/${t}`,{method:"PATCH",headers:Nt(),body:JSON.stringify(e)});if(!n.ok){const r=await n.json();throw new Error(r.detail||"更新人物信息失败")}return n.json()}async function Bwe(t){const e=await mt(`${tf}/${t}`,{method:"DELETE",headers:Nt()});if(!e.ok){const n=await e.json();throw new Error(n.detail||"删除人物信息失败")}return e.json()}async function qwe(){const t=await mt(`${tf}/stats/summary`,{headers:Nt()});if(!t.ok){const e=await t.json();throw new Error(e.detail||"获取统计数据失败")}return t.json()}async function Fwe(t){const e=await mt(`${tf}/batch/delete`,{method:"POST",headers:Nt(),body:JSON.stringify({person_ids:t})});if(!e.ok){const n=await e.json();throw new Error(n.detail||"批量删除失败")}return e.json()}function $we(){const[t,e]=b.useState([]),[n,r]=b.useState(!0),[s,i]=b.useState(0),[a,o]=b.useState(1),[c,h]=b.useState(20),[f,m]=b.useState(""),[g,x]=b.useState(void 0),[y,w]=b.useState(void 0),[S,k]=b.useState(null),[N,C]=b.useState(!1),[T,_]=b.useState(!1),[E,M]=b.useState(null),[q,L]=b.useState({total:0,known:0,unknown:0,platforms:{}}),[I,$]=b.useState(new Set),[V,ee]=b.useState(!1),[z,H]=b.useState(""),{toast:P}=Gr(),W=async()=>{try{r(!0);const re=await Pwe({page:a,page_size:c,search:f||void 0,is_known:g,platform:y});e(re.data),i(re.total)}catch(re){P({title:"加载失败",description:re instanceof Error?re.message:"无法加载人物信息",variant:"destructive"})}finally{r(!1)}},J=async()=>{try{const re=await qwe();re?.data&&L(re.data)}catch(re){console.error("加载统计数据失败:",re)}};b.useEffect(()=>{W(),J()},[a,c,f,g,y]);const X=async re=>{try{const le=await Lwe(re.person_id);k(le.data),C(!0)}catch(le){P({title:"加载详情失败",description:le instanceof Error?le.message:"无法加载人物详情",variant:"destructive"})}},R=re=>{k(re),_(!0)},se=async re=>{try{await Bwe(re.person_id),P({title:"删除成功",description:`已删除人物信息: ${re.person_name||re.nickname||re.user_id}`}),M(null),W(),J()}catch(le){P({title:"删除失败",description:le instanceof Error?le.message:"无法删除人物信息",variant:"destructive"})}},G=b.useMemo(()=>Object.keys(q.platforms),[q.platforms]),F=re=>{const le=new Set(I);le.has(re)?le.delete(re):le.add(re),$(le)},U=()=>{I.size===t.length&&t.length>0?$(new Set):$(new Set(t.map(re=>re.person_id)))},te=()=>{if(I.size===0){P({title:"未选择任何人物",description:"请先选择要删除的人物",variant:"destructive"});return}ee(!0)},ne=async()=>{try{const re=await Fwe(Array.from(I));P({title:"批量删除完成",description:re.message}),$(new Set),ee(!1),W(),J()}catch(re){P({title:"批量删除失败",description:re instanceof Error?re.message:"批量删除失败",variant:"destructive"})}},Y=()=>{const re=parseInt(z),le=Math.ceil(s/c);re>=1&&re<=le?(o(re),H("")):P({title:"无效的页码",description:`请输入1-${le}之间的页码`,variant:"destructive"})},ae=re=>re?new Date(re*1e3).toLocaleString("zh-CN"):"-";return l.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[l.jsx("div",{className:"mb-4 sm:mb-6",children:l.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:l.jsxs("div",{children:[l.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[l.jsx(QK,{className:"h-8 w-8",strokeWidth:2}),"人物信息管理"]}),l.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"管理麦麦认识的所有人物信息"})]})})}),l.jsx(on,{className:"flex-1",children:l.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[l.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[l.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[l.jsx("div",{className:"text-sm text-muted-foreground",children:"总人数"}),l.jsx("div",{className:"text-2xl font-bold mt-1",children:q.total})]}),l.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[l.jsx("div",{className:"text-sm text-muted-foreground",children:"已认识"}),l.jsx("div",{className:"text-2xl font-bold mt-1 text-green-600",children:q.known})]}),l.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[l.jsx("div",{className:"text-sm text-muted-foreground",children:"未认识"}),l.jsx("div",{className:"text-2xl font-bold mt-1 text-muted-foreground",children:q.unknown})]})]}),l.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[l.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-4 gap-4",children:[l.jsxs("div",{className:"sm:col-span-2",children:[l.jsx(de,{htmlFor:"search",children:"搜索"}),l.jsxs("div",{className:"relative mt-1.5",children:[l.jsx(li,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),l.jsx(Pe,{id:"search",placeholder:"搜索名称、昵称或用户ID...",value:f,onChange:re=>m(re.target.value),className:"pl-9"})]})]}),l.jsxs("div",{children:[l.jsx(de,{htmlFor:"filter-known",children:"认识状态"}),l.jsxs(zt,{value:g===void 0?"all":g.toString(),onValueChange:re=>{x(re==="all"?void 0:re==="true"),o(1)},children:[l.jsx(At,{id:"filter-known",className:"mt-1.5",children:l.jsx(Pt,{})}),l.jsxs(Rt,{children:[l.jsx(ze,{value:"all",children:"全部"}),l.jsx(ze,{value:"true",children:"已认识"}),l.jsx(ze,{value:"false",children:"未认识"})]})]})]}),l.jsxs("div",{children:[l.jsx(de,{htmlFor:"filter-platform",children:"平台"}),l.jsxs(zt,{value:y||"all",onValueChange:re=>{w(re==="all"?void 0:re),o(1)},children:[l.jsx(At,{id:"filter-platform",className:"mt-1.5",children:l.jsx(Pt,{})}),l.jsxs(Rt,{children:[l.jsx(ze,{value:"all",children:"全部平台"}),G.map(re=>l.jsxs(ze,{value:re,children:[re," (",q.platforms[re],")"]},re))]})]})]})]}),l.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 mt-4 pt-4 border-t",children:[l.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:I.size>0&&l.jsxs("span",{children:["已选择 ",I.size," 个人物"]})}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(de,{htmlFor:"page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),l.jsxs(zt,{value:c.toString(),onValueChange:re=>{h(parseInt(re)),o(1),$(new Set)},children:[l.jsx(At,{id:"page-size",className:"w-20",children:l.jsx(Pt,{})}),l.jsxs(Rt,{children:[l.jsx(ze,{value:"10",children:"10"}),l.jsx(ze,{value:"20",children:"20"}),l.jsx(ze,{value:"50",children:"50"}),l.jsx(ze,{value:"100",children:"100"})]})]}),I.size>0&&l.jsxs(l.Fragment,{children:[l.jsx(fe,{variant:"outline",size:"sm",onClick:()=>$(new Set),children:"取消选择"}),l.jsxs(fe,{variant:"destructive",size:"sm",onClick:te,children:[l.jsx(ln,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]})]})]}),l.jsxs("div",{className:"rounded-lg border bg-card",children:[l.jsx("div",{className:"hidden md:block",children:l.jsxs(Vh,{children:[l.jsx(Uh,{children:l.jsxs(ps,{children:[l.jsx(tn,{className:"w-12",children:l.jsx(ii,{checked:t.length>0&&I.size===t.length,onCheckedChange:U,"aria-label":"全选"})}),l.jsx(tn,{children:"状态"}),l.jsx(tn,{children:"名称"}),l.jsx(tn,{children:"昵称"}),l.jsx(tn,{children:"平台"}),l.jsx(tn,{children:"用户ID"}),l.jsx(tn,{children:"最后更新"}),l.jsx(tn,{className:"text-right",children:"操作"})]})}),l.jsx(Wh,{children:n?l.jsx(ps,{children:l.jsx(It,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):t.length===0?l.jsx(ps,{children:l.jsx(It,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):t.map(re=>l.jsxs(ps,{children:[l.jsx(It,{children:l.jsx(ii,{checked:I.has(re.person_id),onCheckedChange:()=>F(re.person_id),"aria-label":`选择 ${re.person_name||re.nickname||re.user_id}`})}),l.jsx(It,{children:l.jsx("div",{className:ye("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",re.is_known?"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400":"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-400"),children:re.is_known?"已认识":"未认识"})}),l.jsx(It,{className:"font-medium",children:re.person_name||l.jsx("span",{className:"text-muted-foreground",children:"-"})}),l.jsx(It,{children:re.nickname||"-"}),l.jsx(It,{children:re.platform}),l.jsx(It,{className:"font-mono text-sm",children:re.user_id}),l.jsx(It,{className:"text-sm text-muted-foreground",children:ae(re.last_know)}),l.jsx(It,{className:"text-right",children:l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsxs(fe,{variant:"default",size:"sm",onClick:()=>X(re),children:[l.jsx(aa,{className:"h-4 w-4 mr-1"}),"详情"]}),l.jsxs(fe,{variant:"default",size:"sm",onClick:()=>R(re),children:[l.jsx($m,{className:"h-4 w-4 mr-1"}),"编辑"]}),l.jsxs(fe,{size:"sm",onClick:()=>M(re),className:"bg-red-600 hover:bg-red-700 text-white",children:[l.jsx(ln,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},re.id))})]})}),l.jsx("div",{className:"md:hidden space-y-3 p-4",children:n?l.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):t.length===0?l.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):t.map(re=>l.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3 overflow-hidden",children:[l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx(ii,{checked:I.has(re.person_id),onCheckedChange:()=>F(re.person_id),className:"mt-1"}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:ye("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium mb-2",re.is_known?"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400":"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-400"),children:re.is_known?"已认识":"未认识"}),l.jsx("h3",{className:"font-semibold text-sm line-clamp-1 w-full break-all",children:re.person_name||l.jsx("span",{className:"text-muted-foreground",children:"未命名"})}),re.nickname&&l.jsxs("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-1 w-full break-all",children:["昵称: ",re.nickname]})]})]}),l.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[l.jsxs("div",{children:[l.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"平台"}),l.jsx("p",{className:"font-medium text-xs",children:re.platform})]}),l.jsxs("div",{children:[l.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"用户ID"}),l.jsx("p",{className:"font-mono text-xs truncate",title:re.user_id,children:re.user_id})]}),l.jsxs("div",{className:"col-span-2",children:[l.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"最后更新"}),l.jsx("p",{className:"text-xs",children:ae(re.last_know)})]})]}),l.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t overflow-hidden",children:[l.jsxs(fe,{variant:"outline",size:"sm",onClick:()=>X(re),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[l.jsx(aa,{className:"h-3 w-3 mr-1"}),"查看"]}),l.jsxs(fe,{variant:"outline",size:"sm",onClick:()=>R(re),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[l.jsx($m,{className:"h-3 w-3 mr-1"}),"编辑"]}),l.jsxs(fe,{variant:"outline",size:"sm",onClick:()=>M(re),className:"text-xs px-2 py-1 h-auto flex-shrink-0 text-destructive hover:text-destructive",children:[l.jsx(ln,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},re.id))}),s>0&&l.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 px-4 py-3 border-t",children:[l.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",s," 条记录,第 ",a," / ",Math.ceil(s/c)," 页"]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(fe,{variant:"outline",size:"sm",onClick:()=>o(1),disabled:a===1,className:"hidden sm:flex",children:l.jsx(D0,{className:"h-4 w-4"})}),l.jsxs(fe,{variant:"outline",size:"sm",onClick:()=>o(a-1),disabled:a===1,children:[l.jsx(qu,{className:"h-4 w-4 sm:mr-1"}),l.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Pe,{type:"number",value:z,onChange:re=>H(re.target.value),onKeyDown:re=>re.key==="Enter"&&Y(),placeholder:a.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(s/c)}),l.jsx(fe,{variant:"outline",size:"sm",onClick:Y,disabled:!z,className:"h-8",children:"跳转"})]}),l.jsxs(fe,{variant:"outline",size:"sm",onClick:()=>o(a+1),disabled:a>=Math.ceil(s/c),children:[l.jsx("span",{className:"hidden sm:inline",children:"下一页"}),l.jsx(Fu,{className:"h-4 w-4 sm:ml-1"})]}),l.jsx(fe,{variant:"outline",size:"sm",onClick:()=>o(Math.ceil(s/c)),disabled:a>=Math.ceil(s/c),className:"hidden sm:flex",children:l.jsx(z0,{className:"h-4 w-4"})})]})]})]})]})}),l.jsx(Qwe,{person:S,open:N,onOpenChange:C}),l.jsx(Hwe,{person:S,open:T,onOpenChange:_,onSuccess:()=>{W(),J(),_(!1)}}),l.jsx(wn,{open:!!E,onOpenChange:()=>M(null),children:l.jsxs(un,{children:[l.jsxs(dn,{children:[l.jsx(fn,{children:"确认删除"}),l.jsxs(mn,{children:['确定要删除人物信息 "',E?.person_name||E?.nickname||E?.user_id,'" 吗? 此操作不可撤销。']})]}),l.jsxs(hn,{children:[l.jsx(gn,{children:"取消"}),l.jsx(pn,{onClick:()=>E&&se(E),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})}),l.jsx(wn,{open:V,onOpenChange:ee,children:l.jsxs(un,{children:[l.jsxs(dn,{children:[l.jsx(fn,{children:"确认批量删除"}),l.jsxs(mn,{children:["确定要删除选中的 ",I.size," 个人物信息吗? 此操作不可撤销。"]})]}),l.jsxs(hn,{children:[l.jsx(gn,{children:"取消"}),l.jsx(pn,{onClick:ne,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})})]})}function Qwe({person:t,open:e,onOpenChange:n}){if(!t)return null;const r=s=>s?new Date(s*1e3).toLocaleString("zh-CN"):"-";return l.jsx(fr,{open:e,onOpenChange:n,children:l.jsxs(rr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[l.jsxs(sr,{children:[l.jsx(ir,{children:"人物详情"}),l.jsxs(Ir,{children:["查看 ",t.person_name||t.nickname||t.user_id," 的完整信息"]})]}),l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[l.jsx(Vl,{icon:rz,label:"人物名称",value:t.person_name}),l.jsx(Vl,{icon:A0,label:"昵称",value:t.nickname}),l.jsx(Vl,{icon:M3,label:"用户ID",value:t.user_id,mono:!0}),l.jsx(Vl,{icon:M3,label:"人物ID",value:t.person_id,mono:!0}),l.jsx(Vl,{label:"平台",value:t.platform}),l.jsx(Vl,{label:"状态",value:t.is_known?"已认识":"未认识"})]}),t.name_reason&&l.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[l.jsx(de,{className:"text-xs text-muted-foreground",children:"名称设定原因"}),l.jsx("p",{className:"mt-1 text-sm",children:t.name_reason})]}),t.memory_points&&l.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[l.jsx(de,{className:"text-xs text-muted-foreground",children:"个人印象"}),l.jsx("p",{className:"mt-1 text-sm whitespace-pre-wrap",children:t.memory_points})]}),t.group_nick_name&&t.group_nick_name.length>0&&l.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[l.jsx(de,{className:"text-xs text-muted-foreground",children:"群昵称"}),l.jsx("div",{className:"mt-2 space-y-1",children:t.group_nick_name.map((s,i)=>l.jsxs("div",{className:"text-sm flex items-center gap-2",children:[l.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:s.group_id}),l.jsx("span",{children:"→"}),l.jsx("span",{children:s.group_nick_name})]},i))})]}),l.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[l.jsx(Vl,{icon:Yd,label:"认识时间",value:r(t.know_times)}),l.jsx(Vl,{icon:Yd,label:"首次记录",value:r(t.know_since)}),l.jsx(Vl,{icon:Yd,label:"最后更新",value:r(t.last_know)})]})]}),l.jsx(ts,{children:l.jsx(fe,{onClick:()=>n(!1),children:"关闭"})})]})})}function Vl({icon:t,label:e,value:n,mono:r=!1}){return l.jsxs("div",{className:"space-y-1",children:[l.jsxs(de,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[t&&l.jsx(t,{className:"h-3 w-3"}),e]}),l.jsx("div",{className:ye("text-sm",r&&"font-mono",!n&&"text-muted-foreground"),children:n||"-"})]})}function Hwe({person:t,open:e,onOpenChange:n,onSuccess:r}){const[s,i]=b.useState({}),[a,o]=b.useState(!1),{toast:c}=Gr();b.useEffect(()=>{t&&i({person_name:t.person_name||"",name_reason:t.name_reason||"",nickname:t.nickname||"",memory_points:t.memory_points||"",is_known:t.is_known})},[t]);const h=async()=>{if(t)try{o(!0),await Iwe(t.person_id,s),c({title:"保存成功",description:"人物信息已更新"}),r()}catch(f){c({title:"保存失败",description:f instanceof Error?f.message:"无法更新人物信息",variant:"destructive"})}finally{o(!1)}};return t?l.jsx(fr,{open:e,onOpenChange:n,children:l.jsxs(rr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[l.jsxs(sr,{children:[l.jsx(ir,{children:"编辑人物信息"}),l.jsxs(Ir,{children:["修改 ",t.person_name||t.nickname||t.user_id," 的信息"]})]}),l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(de,{htmlFor:"person_name",children:"人物名称"}),l.jsx(Pe,{id:"person_name",value:s.person_name||"",onChange:f=>i({...s,person_name:f.target.value}),placeholder:"为这个人设置一个名称"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(de,{htmlFor:"nickname",children:"昵称"}),l.jsx(Pe,{id:"nickname",value:s.nickname||"",onChange:f=>i({...s,nickname:f.target.value}),placeholder:"昵称"})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(de,{htmlFor:"name_reason",children:"名称设定原因"}),l.jsx(dr,{id:"name_reason",value:s.name_reason||"",onChange:f=>i({...s,name_reason:f.target.value}),placeholder:"为什么这样称呼这个人?",rows:2})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(de,{htmlFor:"memory_points",children:"个人印象"}),l.jsx(dr,{id:"memory_points",value:s.memory_points||"",onChange:f=>i({...s,memory_points:f.target.value}),placeholder:"对这个人的印象和记忆点...",rows:4})]}),l.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[l.jsxs("div",{children:[l.jsx(de,{htmlFor:"is_known",className:"text-base font-medium",children:"已认识"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"标记是否已经认识这个人"})]}),l.jsx(_t,{id:"is_known",checked:s.is_known,onCheckedChange:f=>i({...s,is_known:f})})]})]}),l.jsxs(ts,{children:[l.jsx(fe,{variant:"outline",onClick:()=>n(!1),children:"取消"}),l.jsx(fe,{onClick:h,disabled:a,children:a?"保存中...":"保存"})]})]})}):null}function xs(t){if(typeof t=="string"||typeof t=="number")return""+t;let e="";if(Array.isArray(t))for(let n=0,r;n{let e;const n=new Set,r=(f,m)=>{const g=typeof f=="function"?f(e):f;if(!Object.is(g,e)){const x=e;e=m??(typeof g!="object"||g===null)?g:Object.assign({},e,g),n.forEach(y=>y(e,x))}},s=()=>e,c={setState:r,getState:s,getInitialState:()=>h,subscribe:f=>(n.add(f),()=>n.delete(f)),destroy:()=>{(Vwe?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},h=e=t(r,s,c);return c},Uwe=t=>t?PM(t):PM,{useDebugValue:Wwe}=he,{useSyncExternalStoreWithSelector:Gwe}=iY,Xwe=t=>t;function YQ(t,e=Xwe,n){const r=Gwe(t.subscribe,t.getState,t.getServerState||t.getInitialState,e,n);return Wwe(r),r}const LM=(t,e)=>{const n=Uwe(t),r=(s,i=e)=>YQ(n,s,i);return Object.assign(r,n),r},Ywe=(t,e)=>t?LM(t,e):LM;function rs(t,e){if(Object.is(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;if(t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(const[r,s]of t)if(!Object.is(s,e.get(r)))return!1;return!0}if(t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(const r of t)if(!e.has(r))return!1;return!0}const n=Object.keys(t);if(n.length!==Object.keys(e).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(e,r)||!Object.is(t[r],e[r]))return!1;return!0}var Kwe={value:()=>{}};function Ny(){for(var t=0,e=arguments.length,n={},r;t=0&&(r=n.slice(s+1),n=n.slice(0,s)),n&&!e.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}v1.prototype=Ny.prototype={constructor:v1,on:function(t,e){var n=this._,r=Zwe(t+"",n),s,i=-1,a=r.length;if(arguments.length<2){for(;++i0)for(var n=new Array(s),r=0,s,i;r=0&&(e=t.slice(0,n))!=="xmlns"&&(t=t.slice(n+1)),BM.hasOwnProperty(e)?{space:BM[e],local:t}:t}function e4e(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===pk&&e.documentElement.namespaceURI===pk?e.createElement(t):e.createElementNS(n,t)}}function t4e(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function KQ(t){var e=Cy(t);return(e.local?t4e:e4e)(e)}function n4e(){}function uj(t){return t==null?n4e:function(){return this.querySelector(t)}}function r4e(t){typeof t!="function"&&(t=uj(t));for(var e=this._groups,n=e.length,r=new Array(n),s=0;s=C&&(C=N+1);!(_=S[C])&&++C=0;)(a=r[s])&&(i&&a.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(a,i),i=a);return this}function T4e(t){t||(t=E4e);function e(m,g){return m&&g?t(m.__data__,g.__data__):!m-!g}for(var n=this._groups,r=n.length,s=new Array(r),i=0;ie?1:t>=e?0:NaN}function _4e(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function M4e(){return Array.from(this)}function A4e(){for(var t=this._groups,e=0,n=t.length;e1?this.each((e==null?Q4e:typeof e=="function"?V4e:H4e)(t,e,n??"")):Eh(this.node(),t)}function Eh(t,e){return t.style.getPropertyValue(e)||nH(t).getComputedStyle(t,null).getPropertyValue(e)}function W4e(t){return function(){delete this[t]}}function G4e(t,e){return function(){this[t]=e}}function X4e(t,e){return function(){var n=e.apply(this,arguments);n==null?delete this[t]:this[t]=n}}function Y4e(t,e){return arguments.length>1?this.each((e==null?W4e:typeof e=="function"?X4e:G4e)(t,e)):this.node()[t]}function rH(t){return t.trim().split(/^|\s+/)}function dj(t){return t.classList||new sH(t)}function sH(t){this._node=t,this._names=rH(t.getAttribute("class")||"")}sH.prototype={add:function(t){var e=this._names.indexOf(t);e<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function iH(t,e){for(var n=dj(t),r=-1,s=e.length;++r=0&&(n=e.slice(r+1),e=e.slice(0,r)),{type:e,name:n}})}function O5e(t){return function(){var e=this.__on;if(e){for(var n=0,r=-1,s=e.length,i;n()=>t;function gk(t,{sourceEvent:e,subject:n,target:r,identifier:s,active:i,x:a,y:o,dx:c,dy:h,dispatch:f}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:s,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:o,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:h,enumerable:!0,configurable:!0},_:{value:f}})}gk.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};function D5e(t){return!t.ctrlKey&&!t.button}function z5e(){return this.parentNode}function P5e(t,e){return e??{x:t.x,y:t.y}}function L5e(){return navigator.maxTouchPoints||"ontouchstart"in this}function I5e(){var t=D5e,e=z5e,n=P5e,r=L5e,s={},i=Ny("start","drag","end"),a=0,o,c,h,f,m=0;function g(T){T.on("mousedown.drag",x).filter(r).on("touchstart.drag",S).on("touchmove.drag",k,R5e).on("touchend.drag touchcancel.drag",N).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function x(T,_){if(!(f||!t.call(this,T,_))){var E=C(this,e.call(this,T,_),T,_,"mouse");E&&(Yi(T.view).on("mousemove.drag",y,w0).on("mouseup.drag",w,w0),cH(T.view),R4(T),h=!1,o=T.clientX,c=T.clientY,E("start",T))}}function y(T){if(ch(T),!h){var _=T.clientX-o,E=T.clientY-c;h=_*_+E*E>m}s.mouse("drag",T)}function w(T){Yi(T.view).on("mousemove.drag mouseup.drag",null),uH(T.view,h),ch(T),s.mouse("end",T)}function S(T,_){if(t.call(this,T,_)){var E=T.changedTouches,M=e.call(this,T,_),q=E.length,L,I;for(L=0;L=0&&t._call.call(void 0,e),t=t._next;--_h}function qM(){Lu=(pv=S0.now())+Ty,_h=ym=0;try{q5e()}finally{_h=0,$5e(),Lu=0}}function F5e(){var t=S0.now(),e=t-pv;e>dH&&(Ty-=e,pv=t)}function $5e(){for(var t,e=mv,n,r=1/0;e;)e._call?(r>e._time&&(r=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:mv=n);bm=t,xk(r)}function xk(t){if(!_h){ym&&(ym=clearTimeout(ym));var e=t-Lu;e>24?(t<1/0&&(ym=setTimeout(qM,t-S0.now()-Ty)),cm&&(cm=clearInterval(cm))):(cm||(pv=S0.now(),cm=setInterval(F5e,dH)),_h=1,hH(qM))}}function FM(t,e,n){var r=new gv;return e=e==null?0:+e,r.restart(s=>{r.stop(),t(s+e)},e,n),r}var Q5e=Ny("start","end","cancel","interrupt"),H5e=[],mH=0,$M=1,vk=2,y1=3,QM=4,yk=5,b1=6;function Ey(t,e,n,r,s,i){var a=t.__transition;if(!a)t.__transition={};else if(n in a)return;V5e(t,n,{name:e,index:r,group:s,on:Q5e,tween:H5e,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:mH})}function fj(t,e){var n=za(t,e);if(n.state>mH)throw new Error("too late; already scheduled");return n}function yl(t,e){var n=za(t,e);if(n.state>y1)throw new Error("too late; already running");return n}function za(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function V5e(t,e,n){var r=t.__transition,s;r[e]=n,n.timer=fH(i,0,n.time);function i(h){n.state=$M,n.timer.restart(a,n.delay,n.time),n.delay<=h&&a(h-n.delay)}function a(h){var f,m,g,x;if(n.state!==$M)return c();for(f in r)if(x=r[f],x.name===n.name){if(x.state===y1)return FM(a);x.state===QM?(x.state=b1,x.timer.stop(),x.on.call("interrupt",t,t.__data__,x.index,x.group),delete r[f]):+fvk&&r.state=0&&(e=e.slice(0,n)),!e||e==="start"})}function w3e(t,e,n){var r,s,i=b3e(e)?fj:yl;return function(){var a=i(this,t),o=a.on;o!==r&&(s=(r=o).copy()).on(e,n),a.on=s}}function S3e(t,e){var n=this._id;return arguments.length<2?za(this.node(),n).on.on(t):this.each(w3e(n,t,e))}function k3e(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}function O3e(){return this.on("end.remove",k3e(this._id))}function j3e(t){var e=this._name,n=this._id;typeof t!="function"&&(t=uj(t));for(var r=this._groups,s=r.length,i=new Array(s),a=0;a()=>t;function Y3e(t,{sourceEvent:e,target:n,transform:r,dispatch:s}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:s}})}function to(t,e,n){this.k=t,this.x=e,this.y=n}to.prototype={constructor:to,scale:function(t){return t===1?this:new to(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new to(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var co=new to(1,0,0);to.prototype;function D4(t){t.stopImmediatePropagation()}function um(t){t.preventDefault(),t.stopImmediatePropagation()}function K3e(t){return(!t.ctrlKey||t.type==="wheel")&&!t.button}function Z3e(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t,t.hasAttribute("viewBox")?(t=t.viewBox.baseVal,[[t.x,t.y],[t.x+t.width,t.y+t.height]]):[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]):[[0,0],[t.clientWidth,t.clientHeight]]}function HM(){return this.__zoom||co}function J3e(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function eSe(){return navigator.maxTouchPoints||"ontouchstart"in this}function tSe(t,e,n){var r=t.invertX(e[0][0])-n[0][0],s=t.invertX(e[1][0])-n[1][0],i=t.invertY(e[0][1])-n[0][1],a=t.invertY(e[1][1])-n[1][1];return t.translate(s>r?(r+s)/2:Math.min(0,r)||Math.max(0,s),a>i?(i+a)/2:Math.min(0,i)||Math.max(0,a))}function vH(){var t=K3e,e=Z3e,n=tSe,r=J3e,s=eSe,i=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],o=250,c=TY,h=Ny("start","zoom","end"),f,m,g,x=500,y=150,w=0,S=10;function k(z){z.property("__zoom",HM).on("wheel.zoom",q,{passive:!1}).on("mousedown.zoom",L).on("dblclick.zoom",I).filter(s).on("touchstart.zoom",$).on("touchmove.zoom",V).on("touchend.zoom touchcancel.zoom",ee).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}k.transform=function(z,H,P,W){var J=z.selection?z.selection():z;J.property("__zoom",HM),z!==J?_(z,H,P,W):J.interrupt().each(function(){E(this,arguments).event(W).start().zoom(null,typeof H=="function"?H.apply(this,arguments):H).end()})},k.scaleBy=function(z,H,P,W){k.scaleTo(z,function(){var J=this.__zoom.k,X=typeof H=="function"?H.apply(this,arguments):H;return J*X},P,W)},k.scaleTo=function(z,H,P,W){k.transform(z,function(){var J=e.apply(this,arguments),X=this.__zoom,R=P==null?T(J):typeof P=="function"?P.apply(this,arguments):P,se=X.invert(R),G=typeof H=="function"?H.apply(this,arguments):H;return n(C(N(X,G),R,se),J,a)},P,W)},k.translateBy=function(z,H,P,W){k.transform(z,function(){return n(this.__zoom.translate(typeof H=="function"?H.apply(this,arguments):H,typeof P=="function"?P.apply(this,arguments):P),e.apply(this,arguments),a)},null,W)},k.translateTo=function(z,H,P,W,J){k.transform(z,function(){var X=e.apply(this,arguments),R=this.__zoom,se=W==null?T(X):typeof W=="function"?W.apply(this,arguments):W;return n(co.translate(se[0],se[1]).scale(R.k).translate(typeof H=="function"?-H.apply(this,arguments):-H,typeof P=="function"?-P.apply(this,arguments):-P),X,a)},W,J)};function N(z,H){return H=Math.max(i[0],Math.min(i[1],H)),H===z.k?z:new to(H,z.x,z.y)}function C(z,H,P){var W=H[0]-P[0]*z.k,J=H[1]-P[1]*z.k;return W===z.x&&J===z.y?z:new to(z.k,W,J)}function T(z){return[(+z[0][0]+ +z[1][0])/2,(+z[0][1]+ +z[1][1])/2]}function _(z,H,P,W){z.on("start.zoom",function(){E(this,arguments).event(W).start()}).on("interrupt.zoom end.zoom",function(){E(this,arguments).event(W).end()}).tween("zoom",function(){var J=this,X=arguments,R=E(J,X).event(W),se=e.apply(J,X),G=P==null?T(se):typeof P=="function"?P.apply(J,X):P,F=Math.max(se[1][0]-se[0][0],se[1][1]-se[0][1]),U=J.__zoom,te=typeof H=="function"?H.apply(J,X):H,ne=c(U.invert(G).concat(F/U.k),te.invert(G).concat(F/te.k));return function(Y){if(Y===1)Y=te;else{var ae=ne(Y),re=F/ae[2];Y=new to(re,G[0]-ae[0]*re,G[1]-ae[1]*re)}R.zoom(null,Y)}})}function E(z,H,P){return!P&&z.__zooming||new M(z,H)}function M(z,H){this.that=z,this.args=H,this.active=0,this.sourceEvent=null,this.extent=e.apply(z,H),this.taps=0}M.prototype={event:function(z){return z&&(this.sourceEvent=z),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(z,H){return this.mouse&&z!=="mouse"&&(this.mouse[1]=H.invert(this.mouse[0])),this.touch0&&z!=="touch"&&(this.touch0[1]=H.invert(this.touch0[0])),this.touch1&&z!=="touch"&&(this.touch1[1]=H.invert(this.touch1[0])),this.that.__zoom=H,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(z){var H=Yi(this.that).datum();h.call(z,this.that,new Y3e(z,{sourceEvent:this.sourceEvent,target:k,transform:this.that.__zoom,dispatch:h}),H)}};function q(z,...H){if(!t.apply(this,arguments))return;var P=E(this,H).event(z),W=this.__zoom,J=Math.max(i[0],Math.min(i[1],W.k*Math.pow(2,r.apply(this,arguments)))),X=Sa(z);if(P.wheel)(P.mouse[0][0]!==X[0]||P.mouse[0][1]!==X[1])&&(P.mouse[1]=W.invert(P.mouse[0]=X)),clearTimeout(P.wheel);else{if(W.k===J)return;P.mouse=[X,W.invert(X)],w1(this),P.start()}um(z),P.wheel=setTimeout(R,y),P.zoom("mouse",n(C(N(W,J),P.mouse[0],P.mouse[1]),P.extent,a));function R(){P.wheel=null,P.end()}}function L(z,...H){if(g||!t.apply(this,arguments))return;var P=z.currentTarget,W=E(this,H,!0).event(z),J=Yi(z.view).on("mousemove.zoom",G,!0).on("mouseup.zoom",F,!0),X=Sa(z,P),R=z.clientX,se=z.clientY;cH(z.view),D4(z),W.mouse=[X,this.__zoom.invert(X)],w1(this),W.start();function G(U){if(um(U),!W.moved){var te=U.clientX-R,ne=U.clientY-se;W.moved=te*te+ne*ne>w}W.event(U).zoom("mouse",n(C(W.that.__zoom,W.mouse[0]=Sa(U,P),W.mouse[1]),W.extent,a))}function F(U){J.on("mousemove.zoom mouseup.zoom",null),uH(U.view,W.moved),um(U),W.event(U).end()}}function I(z,...H){if(t.apply(this,arguments)){var P=this.__zoom,W=Sa(z.changedTouches?z.changedTouches[0]:z,this),J=P.invert(W),X=P.k*(z.shiftKey?.5:2),R=n(C(N(P,X),W,J),e.apply(this,H),a);um(z),o>0?Yi(this).transition().duration(o).call(_,R,W,z):Yi(this).call(k.transform,R,W,z)}}function $(z,...H){if(t.apply(this,arguments)){var P=z.touches,W=P.length,J=E(this,H,z.changedTouches.length===W).event(z),X,R,se,G;for(D4(z),R=0;R"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:t=>`Node type "${t}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:t=>`The old edge with id=${t} does not exist.`,error009:t=>`Marker type "${t}" doesn't exist.`,error008:(t,e)=>`Couldn't create edge for ${t?"target":"source"} handle id: "${t?e.targetHandle:e.sourceHandle}", edge id: ${e.id}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:t=>`Edge type "${t}" not found. Using fallback type "default".`,error012:t=>`Node with id "${t}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`},yH=bo.error001();function Xn(t,e){const n=b.useContext(_y);if(n===null)throw new Error(yH);return YQ(n,t,e)}const Xr=()=>{const t=b.useContext(_y);if(t===null)throw new Error(yH);return b.useMemo(()=>({getState:t.getState,setState:t.setState,subscribe:t.subscribe,destroy:t.destroy}),[t])},rSe=t=>t.userSelectionActive?"none":"all";function My({position:t,children:e,className:n,style:r,...s}){const i=Xn(rSe),a=`${t}`.split("-");return he.createElement("div",{className:xs(["react-flow__panel",n,...a]),style:{...r,pointerEvents:i},...s},e)}function sSe({proOptions:t,position:e="bottom-right"}){return t?.hideAttribution?null:he.createElement(My,{position:e,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://reactflow.dev/pro"},he.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}const iSe=({x:t,y:e,label:n,labelStyle:r={},labelShowBg:s=!0,labelBgStyle:i={},labelBgPadding:a=[2,4],labelBgBorderRadius:o=2,children:c,className:h,...f})=>{const m=b.useRef(null),[g,x]=b.useState({x:0,y:0,width:0,height:0}),y=xs(["react-flow__edge-textwrapper",h]);return b.useEffect(()=>{if(m.current){const w=m.current.getBBox();x({x:w.x,y:w.y,width:w.width,height:w.height})}},[n]),typeof n>"u"||!n?null:he.createElement("g",{transform:`translate(${t-g.width/2} ${e-g.height/2})`,className:y,visibility:g.width?"visible":"hidden",...f},s&&he.createElement("rect",{width:g.width+2*a[0],x:-a[0],y:-a[1],height:g.height+2*a[1],className:"react-flow__edge-textbg",style:i,rx:o,ry:o}),he.createElement("text",{className:"react-flow__edge-text",y:g.height/2,dy:"0.3em",ref:m,style:r},n),c)};var aSe=b.memo(iSe);const pj=t=>({width:t.offsetWidth,height:t.offsetHeight}),Mh=(t,e=0,n=1)=>Math.min(Math.max(t,e),n),gj=(t={x:0,y:0},e)=>({x:Mh(t.x,e[0][0],e[1][0]),y:Mh(t.y,e[0][1],e[1][1])}),VM=(t,e,n)=>tn?-Mh(Math.abs(t-n),1,50)/50:0,bH=(t,e)=>{const n=VM(t.x,35,e.width-35)*20,r=VM(t.y,35,e.height-35)*20;return[n,r]},wH=t=>t.getRootNode?.()||window?.document,SH=(t,e)=>({x:Math.min(t.x,e.x),y:Math.min(t.y,e.y),x2:Math.max(t.x2,e.x2),y2:Math.max(t.y2,e.y2)}),k0=({x:t,y:e,width:n,height:r})=>({x:t,y:e,x2:t+n,y2:e+r}),kH=({x:t,y:e,x2:n,y2:r})=>({x:t,y:e,width:n-t,height:r-e}),UM=t=>({...t.positionAbsolute||{x:0,y:0},width:t.width||0,height:t.height||0}),lSe=(t,e)=>kH(SH(k0(t),k0(e))),bk=(t,e)=>{const n=Math.max(0,Math.min(t.x+t.width,e.x+e.width)-Math.max(t.x,e.x)),r=Math.max(0,Math.min(t.y+t.height,e.y+e.height)-Math.max(t.y,e.y));return Math.ceil(n*r)},oSe=t=>ta(t.width)&&ta(t.height)&&ta(t.x)&&ta(t.y),ta=t=>!isNaN(t)&&isFinite(t),yr=Symbol.for("internals"),OH=["Enter"," ","Escape"],cSe=(t,e)=>{},uSe=t=>"nativeEvent"in t;function wk(t){const n=(uSe(t)?t.nativeEvent:t).composedPath?.()?.[0]||t.target;return["INPUT","SELECT","TEXTAREA"].includes(n?.nodeName)||n?.hasAttribute("contenteditable")||!!n?.closest(".nokey")}const jH=t=>"clientX"in t,pc=(t,e)=>{const n=jH(t),r=n?t.clientX:t.touches?.[0].clientX,s=n?t.clientY:t.touches?.[0].clientY;return{x:r-(e?.left??0),y:s-(e?.top??0)}},xv=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0,mp=({id:t,path:e,labelX:n,labelY:r,label:s,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:c,labelBgBorderRadius:h,style:f,markerEnd:m,markerStart:g,interactionWidth:x=20})=>he.createElement(he.Fragment,null,he.createElement("path",{id:t,style:f,d:e,fill:"none",className:"react-flow__edge-path",markerEnd:m,markerStart:g}),x&&he.createElement("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:x,className:"react-flow__edge-interaction"}),s&&ta(n)&&ta(r)?he.createElement(aSe,{x:n,y:r,label:s,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:c,labelBgBorderRadius:h}):null);mp.displayName="BaseEdge";function dm(t,e,n){return n===void 0?n:r=>{const s=e().edges.find(i=>i.id===t);s&&n(r,{...s})}}function NH({sourceX:t,sourceY:e,targetX:n,targetY:r}){const s=Math.abs(n-t)/2,i=n{const[S,k,N]=TH({sourceX:t,sourceY:e,sourcePosition:s,targetX:n,targetY:r,targetPosition:i});return he.createElement(mp,{path:S,labelX:k,labelY:N,label:a,labelStyle:o,labelShowBg:c,labelBgStyle:h,labelBgPadding:f,labelBgBorderRadius:m,style:g,markerEnd:x,markerStart:y,interactionWidth:w})});xj.displayName="SimpleBezierEdge";const GM={[ht.Left]:{x:-1,y:0},[ht.Right]:{x:1,y:0},[ht.Top]:{x:0,y:-1},[ht.Bottom]:{x:0,y:1}},dSe=({source:t,sourcePosition:e=ht.Bottom,target:n})=>e===ht.Left||e===ht.Right?t.xMath.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2));function hSe({source:t,sourcePosition:e=ht.Bottom,target:n,targetPosition:r=ht.Top,center:s,offset:i}){const a=GM[e],o=GM[r],c={x:t.x+a.x*i,y:t.y+a.y*i},h={x:n.x+o.x*i,y:n.y+o.y*i},f=dSe({source:c,sourcePosition:e,target:h}),m=f.x!==0?"x":"y",g=f[m];let x=[],y,w;const S={x:0,y:0},k={x:0,y:0},[N,C,T,_]=NH({sourceX:t.x,sourceY:t.y,targetX:n.x,targetY:n.y});if(a[m]*o[m]===-1){y=s.x??N,w=s.y??C;const M=[{x:y,y:c.y},{x:y,y:h.y}],q=[{x:c.x,y:w},{x:h.x,y:w}];a[m]===g?x=m==="x"?M:q:x=m==="x"?q:M}else{const M=[{x:c.x,y:h.y}],q=[{x:h.x,y:c.y}];if(m==="x"?x=a.x===g?q:M:x=a.y===g?M:q,e===r){const ee=Math.abs(t[m]-n[m]);if(ee<=i){const z=Math.min(i-1,i-ee);a[m]===g?S[m]=(c[m]>t[m]?-1:1)*z:k[m]=(h[m]>n[m]?-1:1)*z}}if(e!==r){const ee=m==="x"?"y":"x",z=a[m]===o[ee],H=c[ee]>h[ee],P=c[ee]=V?(y=(L.x+I.x)/2,w=x[0].y):(y=x[0].x,w=(L.y+I.y)/2)}return[[t,{x:c.x+S.x,y:c.y+S.y},...x,{x:h.x+k.x,y:h.y+k.y},n],y,w,T,_]}function fSe(t,e,n,r){const s=Math.min(XM(t,e)/2,XM(e,n)/2,r),{x:i,y:a}=e;if(t.x===i&&i===n.x||t.y===a&&a===n.y)return`L${i} ${a}`;if(t.y===a){const h=t.x{let C="";return N>0&&N{const[k,N,C]=Sk({sourceX:t,sourceY:e,sourcePosition:m,targetX:n,targetY:r,targetPosition:g,borderRadius:w?.borderRadius,offset:w?.offset});return he.createElement(mp,{path:k,labelX:N,labelY:C,label:s,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:c,labelBgBorderRadius:h,style:f,markerEnd:x,markerStart:y,interactionWidth:S})});Ay.displayName="SmoothStepEdge";const vj=b.memo(t=>he.createElement(Ay,{...t,pathOptions:b.useMemo(()=>({borderRadius:0,offset:t.pathOptions?.offset}),[t.pathOptions?.offset])}));vj.displayName="StepEdge";function mSe({sourceX:t,sourceY:e,targetX:n,targetY:r}){const[s,i,a,o]=NH({sourceX:t,sourceY:e,targetX:n,targetY:r});return[`M ${t},${e}L ${n},${r}`,s,i,a,o]}const yj=b.memo(({sourceX:t,sourceY:e,targetX:n,targetY:r,label:s,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:c,labelBgBorderRadius:h,style:f,markerEnd:m,markerStart:g,interactionWidth:x})=>{const[y,w,S]=mSe({sourceX:t,sourceY:e,targetX:n,targetY:r});return he.createElement(mp,{path:y,labelX:w,labelY:S,label:s,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:c,labelBgBorderRadius:h,style:f,markerEnd:m,markerStart:g,interactionWidth:x})});yj.displayName="StraightEdge";function Ix(t,e){return t>=0?.5*t:e*25*Math.sqrt(-t)}function YM({pos:t,x1:e,y1:n,x2:r,y2:s,c:i}){switch(t){case ht.Left:return[e-Ix(e-r,i),n];case ht.Right:return[e+Ix(r-e,i),n];case ht.Top:return[e,n-Ix(n-s,i)];case ht.Bottom:return[e,n+Ix(s-n,i)]}}function EH({sourceX:t,sourceY:e,sourcePosition:n=ht.Bottom,targetX:r,targetY:s,targetPosition:i=ht.Top,curvature:a=.25}){const[o,c]=YM({pos:n,x1:t,y1:e,x2:r,y2:s,c:a}),[h,f]=YM({pos:i,x1:r,y1:s,x2:t,y2:e,c:a}),[m,g,x,y]=CH({sourceX:t,sourceY:e,targetX:r,targetY:s,sourceControlX:o,sourceControlY:c,targetControlX:h,targetControlY:f});return[`M${t},${e} C${o},${c} ${h},${f} ${r},${s}`,m,g,x,y]}const yv=b.memo(({sourceX:t,sourceY:e,targetX:n,targetY:r,sourcePosition:s=ht.Bottom,targetPosition:i=ht.Top,label:a,labelStyle:o,labelShowBg:c,labelBgStyle:h,labelBgPadding:f,labelBgBorderRadius:m,style:g,markerEnd:x,markerStart:y,pathOptions:w,interactionWidth:S})=>{const[k,N,C]=EH({sourceX:t,sourceY:e,sourcePosition:s,targetX:n,targetY:r,targetPosition:i,curvature:w?.curvature});return he.createElement(mp,{path:k,labelX:N,labelY:C,label:a,labelStyle:o,labelShowBg:c,labelBgStyle:h,labelBgPadding:f,labelBgBorderRadius:m,style:g,markerEnd:x,markerStart:y,interactionWidth:S})});yv.displayName="BezierEdge";const bj=b.createContext(null),pSe=bj.Provider;bj.Consumer;const gSe=()=>b.useContext(bj),xSe=t=>"id"in t&&"source"in t&&"target"in t,vSe=({source:t,sourceHandle:e,target:n,targetHandle:r})=>`reactflow__edge-${t}${e||""}-${n}${r||""}`,kk=(t,e)=>typeof t>"u"?"":typeof t=="string"?t:`${e?`${e}__`:""}${Object.keys(t).sort().map(r=>`${r}=${t[r]}`).join("&")}`,ySe=(t,e)=>e.some(n=>n.source===t.source&&n.target===t.target&&(n.sourceHandle===t.sourceHandle||!n.sourceHandle&&!t.sourceHandle)&&(n.targetHandle===t.targetHandle||!n.targetHandle&&!t.targetHandle)),bSe=(t,e)=>{if(!t.source||!t.target)return e;let n;return xSe(t)?n={...t}:n={...t,id:vSe(t)},ySe(n,e)?e:e.concat(n)},Ok=({x:t,y:e},[n,r,s],i,[a,o])=>{const c={x:(t-n)/s,y:(e-r)/s};return i?{x:a*Math.round(c.x/a),y:o*Math.round(c.y/o)}:c},_H=({x:t,y:e},[n,r,s])=>({x:t*s+n,y:e*s+r}),Ou=(t,e=[0,0])=>{if(!t)return{x:0,y:0,positionAbsolute:{x:0,y:0}};const n=(t.width??0)*e[0],r=(t.height??0)*e[1],s={x:t.position.x-n,y:t.position.y-r};return{...s,positionAbsolute:t.positionAbsolute?{x:t.positionAbsolute.x-n,y:t.positionAbsolute.y-r}:s}},Ry=(t,e=[0,0])=>{if(t.length===0)return{x:0,y:0,width:0,height:0};const n=t.reduce((r,s)=>{const{x:i,y:a}=Ou(s,e).positionAbsolute;return SH(r,k0({x:i,y:a,width:s.width||0,height:s.height||0}))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return kH(n)},MH=(t,e,[n,r,s]=[0,0,1],i=!1,a=!1,o=[0,0])=>{const c={x:(e.x-n)/s,y:(e.y-r)/s,width:e.width/s,height:e.height/s},h=[];return t.forEach(f=>{const{width:m,height:g,selectable:x=!0,hidden:y=!1}=f;if(a&&!x||y)return!1;const{positionAbsolute:w}=Ou(f,o),S={x:w.x,y:w.y,width:m||0,height:g||0},k=bk(c,S),N=typeof m>"u"||typeof g>"u"||m===null||g===null,C=i&&k>0,T=(m||0)*(g||0);(N||C||k>=T||f.dragging)&&h.push(f)}),h},AH=(t,e)=>{const n=t.map(r=>r.id);return e.filter(r=>n.includes(r.source)||n.includes(r.target))},RH=(t,e,n,r,s,i=.1)=>{const a=e/(t.width*(1+i)),o=n/(t.height*(1+i)),c=Math.min(a,o),h=Mh(c,r,s),f=t.x+t.width/2,m=t.y+t.height/2,g=e/2-f*h,x=n/2-m*h;return{x:g,y:x,zoom:h}},ou=(t,e=0)=>t.transition().duration(e);function KM(t,e,n,r){return(e[n]||[]).reduce((s,i)=>(`${t.id}-${i.id}-${n}`!==r&&s.push({id:i.id||null,type:n,nodeId:t.id,x:(t.positionAbsolute?.x??0)+i.x+i.width/2,y:(t.positionAbsolute?.y??0)+i.y+i.height/2}),s),[])}function wSe(t,e,n,r,s,i){const{x:a,y:o}=pc(t),h=e.elementsFromPoint(a,o).find(y=>y.classList.contains("react-flow__handle"));if(h){const y=h.getAttribute("data-nodeid");if(y){const w=wj(void 0,h),S=h.getAttribute("data-handleid"),k=i({nodeId:y,id:S,type:w});if(k){const N=s.find(C=>C.nodeId===y&&C.type===w&&C.id===S);return{handle:{id:S,type:w,nodeId:y,x:N?.x||n.x,y:N?.y||n.y},validHandleResult:k}}}}let f=[],m=1/0;if(s.forEach(y=>{const w=Math.sqrt((y.x-n.x)**2+(y.y-n.y)**2);if(w<=r){const S=i(y);w<=m&&(wy.isValid),x=f.some(({handle:y})=>y.type==="target");return f.find(({handle:y,validHandleResult:w})=>x?y.type==="target":g?w.isValid:!0)||f[0]}const SSe={source:null,target:null,sourceHandle:null,targetHandle:null},DH=()=>({handleDomNode:null,isValid:!1,connection:SSe,endHandle:null});function zH(t,e,n,r,s,i,a){const o=s==="target",c=a.querySelector(`.react-flow__handle[data-id="${t?.nodeId}-${t?.id}-${t?.type}"]`),h={...DH(),handleDomNode:c};if(c){const f=wj(void 0,c),m=c.getAttribute("data-nodeid"),g=c.getAttribute("data-handleid"),x=c.classList.contains("connectable"),y=c.classList.contains("connectableend"),w={source:o?m:n,sourceHandle:o?g:r,target:o?n:m,targetHandle:o?r:g};h.connection=w,x&&y&&(e===Iu.Strict?o&&f==="source"||!o&&f==="target":m!==n||g!==r)&&(h.endHandle={nodeId:m,handleId:g,type:f},h.isValid=i(w))}return h}function kSe({nodes:t,nodeId:e,handleId:n,handleType:r}){return t.reduce((s,i)=>{if(i[yr]){const{handleBounds:a}=i[yr];let o=[],c=[];a&&(o=KM(i,a,"source",`${e}-${n}-${r}`),c=KM(i,a,"target",`${e}-${n}-${r}`)),s.push(...o,...c)}return s},[])}function wj(t,e){return t||(e?.classList.contains("target")?"target":e?.classList.contains("source")?"source":null)}function z4(t){t?.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function OSe(t,e){let n=null;return e?n="valid":t&&!e&&(n="invalid"),n}function PH({event:t,handleId:e,nodeId:n,onConnect:r,isTarget:s,getState:i,setState:a,isValidConnection:o,edgeUpdaterType:c,onReconnectEnd:h}){const f=wH(t.target),{connectionMode:m,domNode:g,autoPanOnConnect:x,connectionRadius:y,onConnectStart:w,panBy:S,getNodes:k,cancelConnection:N}=i();let C=0,T;const{x:_,y:E}=pc(t),M=f?.elementFromPoint(_,E),q=wj(c,M),L=g?.getBoundingClientRect();if(!L||!q)return;let I,$=pc(t,L),V=!1,ee=null,z=!1,H=null;const P=kSe({nodes:k(),nodeId:n,handleId:e,handleType:q}),W=()=>{if(!x)return;const[R,se]=bH($,L);S({x:R,y:se}),C=requestAnimationFrame(W)};a({connectionPosition:$,connectionStatus:null,connectionNodeId:n,connectionHandleId:e,connectionHandleType:q,connectionStartHandle:{nodeId:n,handleId:e,type:q},connectionEndHandle:null}),w?.(t,{nodeId:n,handleId:e,handleType:q});function J(R){const{transform:se}=i();$=pc(R,L);const{handle:G,validHandleResult:F}=wSe(R,f,Ok($,se,!1,[1,1]),y,P,U=>zH(U,m,n,e,s?"target":"source",o,f));if(T=G,V||(W(),V=!0),H=F.handleDomNode,ee=F.connection,z=F.isValid,a({connectionPosition:T&&z?_H({x:T.x,y:T.y},se):$,connectionStatus:OSe(!!T,z),connectionEndHandle:F.endHandle}),!T&&!z&&!H)return z4(I);ee.source!==ee.target&&H&&(z4(I),I=H,H.classList.add("connecting","react-flow__handle-connecting"),H.classList.toggle("valid",z),H.classList.toggle("react-flow__handle-valid",z))}function X(R){(T||H)&&ee&&z&&r?.(ee),i().onConnectEnd?.(R),c&&h?.(R),z4(I),N(),cancelAnimationFrame(C),V=!1,z=!1,ee=null,H=null,f.removeEventListener("mousemove",J),f.removeEventListener("mouseup",X),f.removeEventListener("touchmove",J),f.removeEventListener("touchend",X)}f.addEventListener("mousemove",J),f.addEventListener("mouseup",X),f.addEventListener("touchmove",J),f.addEventListener("touchend",X)}const ZM=()=>!0,jSe=t=>({connectionStartHandle:t.connectionStartHandle,connectOnClick:t.connectOnClick,noPanClassName:t.noPanClassName}),NSe=(t,e,n)=>r=>{const{connectionStartHandle:s,connectionEndHandle:i,connectionClickStartHandle:a}=r;return{connecting:s?.nodeId===t&&s?.handleId===e&&s?.type===n||i?.nodeId===t&&i?.handleId===e&&i?.type===n,clickConnecting:a?.nodeId===t&&a?.handleId===e&&a?.type===n}},LH=b.forwardRef(({type:t="source",position:e=ht.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:s=!0,isConnectableEnd:i=!0,id:a,onConnect:o,children:c,className:h,onMouseDown:f,onTouchStart:m,...g},x)=>{const y=a||null,w=t==="target",S=Xr(),k=gSe(),{connectOnClick:N,noPanClassName:C}=Xn(jSe,rs),{connecting:T,clickConnecting:_}=Xn(NSe(k,y,t),rs);k||S.getState().onError?.("010",bo.error010());const E=L=>{const{defaultEdgeOptions:I,onConnect:$,hasDefaultEdges:V}=S.getState(),ee={...I,...L};if(V){const{edges:z,setEdges:H}=S.getState();H(bSe(ee,z))}$?.(ee),o?.(ee)},M=L=>{if(!k)return;const I=jH(L);s&&(I&&L.button===0||!I)&&PH({event:L,handleId:y,nodeId:k,onConnect:E,isTarget:w,getState:S.getState,setState:S.setState,isValidConnection:n||S.getState().isValidConnection||ZM}),I?f?.(L):m?.(L)},q=L=>{const{onClickConnectStart:I,onClickConnectEnd:$,connectionClickStartHandle:V,connectionMode:ee,isValidConnection:z}=S.getState();if(!k||!V&&!s)return;if(!V){I?.(L,{nodeId:k,handleId:y,handleType:t}),S.setState({connectionClickStartHandle:{nodeId:k,type:t,handleId:y}});return}const H=wH(L.target),P=n||z||ZM,{connection:W,isValid:J}=zH({nodeId:k,id:y,type:t},ee,V.nodeId,V.handleId||null,V.type,P,H);J&&E(W),$?.(L),S.setState({connectionClickStartHandle:null})};return he.createElement("div",{"data-handleid":y,"data-nodeid":k,"data-handlepos":e,"data-id":`${k}-${y}-${t}`,className:xs(["react-flow__handle",`react-flow__handle-${e}`,"nodrag",C,h,{source:!w,target:w,connectable:r,connectablestart:s,connectableend:i,connecting:_,connectionindicator:r&&(s&&!T||i&&T)}]),onMouseDown:M,onTouchStart:M,onClick:N?q:void 0,ref:x,...g},c)});LH.displayName="Handle";var Cc=b.memo(LH);const IH=({data:t,isConnectable:e,targetPosition:n=ht.Top,sourcePosition:r=ht.Bottom})=>he.createElement(he.Fragment,null,he.createElement(Cc,{type:"target",position:n,isConnectable:e}),t?.label,he.createElement(Cc,{type:"source",position:r,isConnectable:e}));IH.displayName="DefaultNode";var jk=b.memo(IH);const BH=({data:t,isConnectable:e,sourcePosition:n=ht.Bottom})=>he.createElement(he.Fragment,null,t?.label,he.createElement(Cc,{type:"source",position:n,isConnectable:e}));BH.displayName="InputNode";var qH=b.memo(BH);const FH=({data:t,isConnectable:e,targetPosition:n=ht.Top})=>he.createElement(he.Fragment,null,he.createElement(Cc,{type:"target",position:n,isConnectable:e}),t?.label);FH.displayName="OutputNode";var $H=b.memo(FH);const Sj=()=>null;Sj.displayName="GroupNode";const CSe=t=>({selectedNodes:t.getNodes().filter(e=>e.selected),selectedEdges:t.edges.filter(e=>e.selected).map(e=>({...e}))}),Bx=t=>t.id;function TSe(t,e){return rs(t.selectedNodes.map(Bx),e.selectedNodes.map(Bx))&&rs(t.selectedEdges.map(Bx),e.selectedEdges.map(Bx))}const QH=b.memo(({onSelectionChange:t})=>{const e=Xr(),{selectedNodes:n,selectedEdges:r}=Xn(CSe,TSe);return b.useEffect(()=>{const s={nodes:n,edges:r};t?.(s),e.getState().onSelectionChange.forEach(i=>i(s))},[n,r,t]),null});QH.displayName="SelectionListener";const ESe=t=>!!t.onSelectionChange;function _Se({onSelectionChange:t}){const e=Xn(ESe);return t||e?he.createElement(QH,{onSelectionChange:t}):null}const MSe=t=>({setNodes:t.setNodes,setEdges:t.setEdges,setDefaultNodesAndEdges:t.setDefaultNodesAndEdges,setMinZoom:t.setMinZoom,setMaxZoom:t.setMaxZoom,setTranslateExtent:t.setTranslateExtent,setNodeExtent:t.setNodeExtent,reset:t.reset});function _d(t,e){b.useEffect(()=>{typeof t<"u"&&e(t)},[t])}function Ut(t,e,n){b.useEffect(()=>{typeof e<"u"&&n({[t]:e})},[e])}const ASe=({nodes:t,edges:e,defaultNodes:n,defaultEdges:r,onConnect:s,onConnectStart:i,onConnectEnd:a,onClickConnectStart:o,onClickConnectEnd:c,nodesDraggable:h,nodesConnectable:f,nodesFocusable:m,edgesFocusable:g,edgesUpdatable:x,elevateNodesOnSelect:y,minZoom:w,maxZoom:S,nodeExtent:k,onNodesChange:N,onEdgesChange:C,elementsSelectable:T,connectionMode:_,snapGrid:E,snapToGrid:M,translateExtent:q,connectOnClick:L,defaultEdgeOptions:I,fitView:$,fitViewOptions:V,onNodesDelete:ee,onEdgesDelete:z,onNodeDrag:H,onNodeDragStart:P,onNodeDragStop:W,onSelectionDrag:J,onSelectionDragStart:X,onSelectionDragStop:R,noPanClassName:se,nodeOrigin:G,rfId:F,autoPanOnConnect:U,autoPanOnNodeDrag:te,onError:ne,connectionRadius:Y,isValidConnection:ae,nodeDragThreshold:re})=>{const{setNodes:le,setEdges:_e,setDefaultNodesAndEdges:Ge,setMinZoom:tt,setMaxZoom:Xe,setTranslateExtent:je,setNodeExtent:Qe,reset:He}=Xn(MSe,rs),$e=Xr();return b.useEffect(()=>{const bt=r?.map(lt=>({...lt,...I}));return Ge(n,bt),()=>{He()}},[]),Ut("defaultEdgeOptions",I,$e.setState),Ut("connectionMode",_,$e.setState),Ut("onConnect",s,$e.setState),Ut("onConnectStart",i,$e.setState),Ut("onConnectEnd",a,$e.setState),Ut("onClickConnectStart",o,$e.setState),Ut("onClickConnectEnd",c,$e.setState),Ut("nodesDraggable",h,$e.setState),Ut("nodesConnectable",f,$e.setState),Ut("nodesFocusable",m,$e.setState),Ut("edgesFocusable",g,$e.setState),Ut("edgesUpdatable",x,$e.setState),Ut("elementsSelectable",T,$e.setState),Ut("elevateNodesOnSelect",y,$e.setState),Ut("snapToGrid",M,$e.setState),Ut("snapGrid",E,$e.setState),Ut("onNodesChange",N,$e.setState),Ut("onEdgesChange",C,$e.setState),Ut("connectOnClick",L,$e.setState),Ut("fitViewOnInit",$,$e.setState),Ut("fitViewOnInitOptions",V,$e.setState),Ut("onNodesDelete",ee,$e.setState),Ut("onEdgesDelete",z,$e.setState),Ut("onNodeDrag",H,$e.setState),Ut("onNodeDragStart",P,$e.setState),Ut("onNodeDragStop",W,$e.setState),Ut("onSelectionDrag",J,$e.setState),Ut("onSelectionDragStart",X,$e.setState),Ut("onSelectionDragStop",R,$e.setState),Ut("noPanClassName",se,$e.setState),Ut("nodeOrigin",G,$e.setState),Ut("rfId",F,$e.setState),Ut("autoPanOnConnect",U,$e.setState),Ut("autoPanOnNodeDrag",te,$e.setState),Ut("onError",ne,$e.setState),Ut("connectionRadius",Y,$e.setState),Ut("isValidConnection",ae,$e.setState),Ut("nodeDragThreshold",re,$e.setState),_d(t,le),_d(e,_e),_d(w,tt),_d(S,Xe),_d(q,je),_d(k,Qe),null},JM={display:"none"},RSe={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},HH="react-flow__node-desc",VH="react-flow__edge-desc",DSe="react-flow__aria-live",zSe=t=>t.ariaLiveMessage;function PSe({rfId:t}){const e=Xn(zSe);return he.createElement("div",{id:`${DSe}-${t}`,"aria-live":"assertive","aria-atomic":"true",style:RSe},e)}function LSe({rfId:t,disableKeyboardA11y:e}){return he.createElement(he.Fragment,null,he.createElement("div",{id:`${HH}-${t}`,style:JM},"Press enter or space to select a node.",!e&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "),he.createElement("div",{id:`${VH}-${t}`,style:JM},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!e&&he.createElement(PSe,{rfId:t}))}var j0=(t=null,e={actInsideInputWithModifier:!0})=>{const[n,r]=b.useState(!1),s=b.useRef(!1),i=b.useRef(new Set([])),[a,o]=b.useMemo(()=>{if(t!==null){const h=(Array.isArray(t)?t:[t]).filter(m=>typeof m=="string").map(m=>m.split("+")),f=h.reduce((m,g)=>m.concat(...g),[]);return[h,f]}return[[],[]]},[t]);return b.useEffect(()=>{const c=typeof document<"u"?document:null,h=e?.target||c;if(t!==null){const f=x=>{if(s.current=x.ctrlKey||x.metaKey||x.shiftKey,(!s.current||s.current&&!e.actInsideInputWithModifier)&&wk(x))return!1;const w=tA(x.code,o);i.current.add(x[w]),eA(a,i.current,!1)&&(x.preventDefault(),r(!0))},m=x=>{if((!s.current||s.current&&!e.actInsideInputWithModifier)&&wk(x))return!1;const w=tA(x.code,o);eA(a,i.current,!0)?(r(!1),i.current.clear()):i.current.delete(x[w]),x.key==="Meta"&&i.current.clear(),s.current=!1},g=()=>{i.current.clear(),r(!1)};return h?.addEventListener("keydown",f),h?.addEventListener("keyup",m),window.addEventListener("blur",g),()=>{h?.removeEventListener("keydown",f),h?.removeEventListener("keyup",m),window.removeEventListener("blur",g)}}},[t,r]),n};function eA(t,e,n){return t.filter(r=>n||r.length===e.size).some(r=>r.every(s=>e.has(s)))}function tA(t,e){return e.includes(t)?"code":"key"}function UH(t,e,n,r){const s=t.parentNode||t.parentId;if(!s)return n;const i=e.get(s),a=Ou(i,r);return UH(i,e,{x:(n.x??0)+a.x,y:(n.y??0)+a.y,z:(i[yr]?.z??0)>(n.z??0)?i[yr]?.z??0:n.z??0},r)}function WH(t,e,n){t.forEach(r=>{const s=r.parentNode||r.parentId;if(s&&!t.has(s))throw new Error(`Parent node ${s} not found`);if(s||n?.[r.id]){const{x:i,y:a,z:o}=UH(r,t,{...r.position,z:r[yr]?.z??0},e);r.positionAbsolute={x:i,y:a},r[yr].z=o,n?.[r.id]&&(r[yr].isParent=!0)}})}function P4(t,e,n,r){const s=new Map,i={},a=r?1e3:0;return t.forEach(o=>{const c=(ta(o.zIndex)?o.zIndex:0)+(o.selected?a:0),h=e.get(o.id),f={...o,positionAbsolute:{x:o.position.x,y:o.position.y}},m=o.parentNode||o.parentId;m&&(i[m]=!0);const g=h?.type&&h?.type!==o.type;Object.defineProperty(f,yr,{enumerable:!1,value:{handleBounds:g?void 0:h?.[yr]?.handleBounds,z:c}}),s.set(o.id,f)}),WH(s,n,i),s}function GH(t,e={}){const{getNodes:n,width:r,height:s,minZoom:i,maxZoom:a,d3Zoom:o,d3Selection:c,fitViewOnInitDone:h,fitViewOnInit:f,nodeOrigin:m}=t(),g=e.initial&&!h&&f;if(o&&c&&(g||!e.initial)){const y=n().filter(S=>{const k=e.includeHiddenNodes?S.width&&S.height:!S.hidden;return e.nodes?.length?k&&e.nodes.some(N=>N.id===S.id):k}),w=y.every(S=>S.width&&S.height);if(y.length>0&&w){const S=Ry(y,m),{x:k,y:N,zoom:C}=RH(S,r,s,e.minZoom??i,e.maxZoom??a,e.padding??.1),T=co.translate(k,N).scale(C);return typeof e.duration=="number"&&e.duration>0?o.transform(ou(c,e.duration),T):o.transform(c,T),!0}}return!1}function ISe(t,e){return t.forEach(n=>{const r=e.get(n.id);r&&e.set(r.id,{...r,[yr]:r[yr],selected:n.selected})}),new Map(e)}function BSe(t,e){return e.map(n=>{const r=t.find(s=>s.id===n.id);return r&&(n.selected=r.selected),n})}function qx({changedNodes:t,changedEdges:e,get:n,set:r}){const{nodeInternals:s,edges:i,onNodesChange:a,onEdgesChange:o,hasDefaultNodes:c,hasDefaultEdges:h}=n();t?.length&&(c&&r({nodeInternals:ISe(t,s)}),a?.(t)),e?.length&&(h&&r({edges:BSe(e,i)}),o?.(e))}const Md=()=>{},qSe={zoomIn:Md,zoomOut:Md,zoomTo:Md,getZoom:()=>1,setViewport:Md,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:Md,fitBounds:Md,project:t=>t,screenToFlowPosition:t=>t,flowToScreenPosition:t=>t,viewportInitialized:!1},FSe=t=>({d3Zoom:t.d3Zoom,d3Selection:t.d3Selection}),$Se=()=>{const t=Xr(),{d3Zoom:e,d3Selection:n}=Xn(FSe,rs);return b.useMemo(()=>n&&e?{zoomIn:s=>e.scaleBy(ou(n,s?.duration),1.2),zoomOut:s=>e.scaleBy(ou(n,s?.duration),1/1.2),zoomTo:(s,i)=>e.scaleTo(ou(n,i?.duration),s),getZoom:()=>t.getState().transform[2],setViewport:(s,i)=>{const[a,o,c]=t.getState().transform,h=co.translate(s.x??a,s.y??o).scale(s.zoom??c);e.transform(ou(n,i?.duration),h)},getViewport:()=>{const[s,i,a]=t.getState().transform;return{x:s,y:i,zoom:a}},fitView:s=>GH(t.getState,s),setCenter:(s,i,a)=>{const{width:o,height:c,maxZoom:h}=t.getState(),f=typeof a?.zoom<"u"?a.zoom:h,m=o/2-s*f,g=c/2-i*f,x=co.translate(m,g).scale(f);e.transform(ou(n,a?.duration),x)},fitBounds:(s,i)=>{const{width:a,height:o,minZoom:c,maxZoom:h}=t.getState(),{x:f,y:m,zoom:g}=RH(s,a,o,c,h,i?.padding??.1),x=co.translate(f,m).scale(g);e.transform(ou(n,i?.duration),x)},project:s=>{const{transform:i,snapToGrid:a,snapGrid:o}=t.getState();return console.warn("[DEPRECATED] `project` is deprecated. Instead use `screenToFlowPosition`. There is no need to subtract the react flow bounds anymore! https://reactflow.dev/api-reference/types/react-flow-instance#screen-to-flow-position"),Ok(s,i,a,o)},screenToFlowPosition:s=>{const{transform:i,snapToGrid:a,snapGrid:o,domNode:c}=t.getState();if(!c)return s;const{x:h,y:f}=c.getBoundingClientRect(),m={x:s.x-h,y:s.y-f};return Ok(m,i,a,o)},flowToScreenPosition:s=>{const{transform:i,domNode:a}=t.getState();if(!a)return s;const{x:o,y:c}=a.getBoundingClientRect(),h=_H(s,i);return{x:h.x+o,y:h.y+c}},viewportInitialized:!0}:qSe,[e,n])};function kj(){const t=$Se(),e=Xr(),n=b.useCallback(()=>e.getState().getNodes().map(w=>({...w})),[]),r=b.useCallback(w=>e.getState().nodeInternals.get(w),[]),s=b.useCallback(()=>{const{edges:w=[]}=e.getState();return w.map(S=>({...S}))},[]),i=b.useCallback(w=>{const{edges:S=[]}=e.getState();return S.find(k=>k.id===w)},[]),a=b.useCallback(w=>{const{getNodes:S,setNodes:k,hasDefaultNodes:N,onNodesChange:C}=e.getState(),T=S(),_=typeof w=="function"?w(T):w;if(N)k(_);else if(C){const E=_.length===0?T.map(M=>({type:"remove",id:M.id})):_.map(M=>({item:M,type:"reset"}));C(E)}},[]),o=b.useCallback(w=>{const{edges:S=[],setEdges:k,hasDefaultEdges:N,onEdgesChange:C}=e.getState(),T=typeof w=="function"?w(S):w;if(N)k(T);else if(C){const _=T.length===0?S.map(E=>({type:"remove",id:E.id})):T.map(E=>({item:E,type:"reset"}));C(_)}},[]),c=b.useCallback(w=>{const S=Array.isArray(w)?w:[w],{getNodes:k,setNodes:N,hasDefaultNodes:C,onNodesChange:T}=e.getState();if(C){const E=[...k(),...S];N(E)}else if(T){const _=S.map(E=>({item:E,type:"add"}));T(_)}},[]),h=b.useCallback(w=>{const S=Array.isArray(w)?w:[w],{edges:k=[],setEdges:N,hasDefaultEdges:C,onEdgesChange:T}=e.getState();if(C)N([...k,...S]);else if(T){const _=S.map(E=>({item:E,type:"add"}));T(_)}},[]),f=b.useCallback(()=>{const{getNodes:w,edges:S=[],transform:k}=e.getState(),[N,C,T]=k;return{nodes:w().map(_=>({..._})),edges:S.map(_=>({..._})),viewport:{x:N,y:C,zoom:T}}},[]),m=b.useCallback(({nodes:w,edges:S})=>{const{nodeInternals:k,getNodes:N,edges:C,hasDefaultNodes:T,hasDefaultEdges:_,onNodesDelete:E,onEdgesDelete:M,onNodesChange:q,onEdgesChange:L}=e.getState(),I=(w||[]).map(H=>H.id),$=(S||[]).map(H=>H.id),V=N().reduce((H,P)=>{const W=P.parentNode||P.parentId,J=!I.includes(P.id)&&W&&H.find(R=>R.id===W);return(typeof P.deletable=="boolean"?P.deletable:!0)&&(I.includes(P.id)||J)&&H.push(P),H},[]),ee=C.filter(H=>typeof H.deletable=="boolean"?H.deletable:!0),z=ee.filter(H=>$.includes(H.id));if(V||z){const H=AH(V,ee),P=[...z,...H],W=P.reduce((J,X)=>(J.includes(X.id)||J.push(X.id),J),[]);if((_||T)&&(_&&e.setState({edges:C.filter(J=>!W.includes(J.id))}),T&&(V.forEach(J=>{k.delete(J.id)}),e.setState({nodeInternals:new Map(k)}))),W.length>0&&(M?.(P),L&&L(W.map(J=>({id:J,type:"remove"})))),V.length>0&&(E?.(V),q)){const J=V.map(X=>({id:X.id,type:"remove"}));q(J)}}},[]),g=b.useCallback(w=>{const S=oSe(w),k=S?null:e.getState().nodeInternals.get(w.id);return!S&&!k?[null,null,S]:[S?w:UM(k),k,S]},[]),x=b.useCallback((w,S=!0,k)=>{const[N,C,T]=g(w);return N?(k||e.getState().getNodes()).filter(_=>{if(!T&&(_.id===C.id||!_.positionAbsolute))return!1;const E=UM(_),M=bk(E,N);return S&&M>0||M>=N.width*N.height}):[]},[]),y=b.useCallback((w,S,k=!0)=>{const[N]=g(w);if(!N)return!1;const C=bk(N,S);return k&&C>0||C>=N.width*N.height},[]);return b.useMemo(()=>({...t,getNodes:n,getNode:r,getEdges:s,getEdge:i,setNodes:a,setEdges:o,addNodes:c,addEdges:h,toObject:f,deleteElements:m,getIntersectingNodes:x,isNodeIntersecting:y}),[t,n,r,s,i,a,o,c,h,f,m,x,y])}const QSe={actInsideInputWithModifier:!1};var HSe=({deleteKeyCode:t,multiSelectionKeyCode:e})=>{const n=Xr(),{deleteElements:r}=kj(),s=j0(t,QSe),i=j0(e);b.useEffect(()=>{if(s){const{edges:a,getNodes:o}=n.getState(),c=o().filter(f=>f.selected),h=a.filter(f=>f.selected);r({nodes:c,edges:h}),n.setState({nodesSelectionActive:!1})}},[s]),b.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])};function VSe(t){const e=Xr();b.useEffect(()=>{let n;const r=()=>{if(!t.current)return;const s=pj(t.current);(s.height===0||s.width===0)&&e.getState().onError?.("004",bo.error004()),e.setState({width:s.width||500,height:s.height||500})};return r(),window.addEventListener("resize",r),t.current&&(n=new ResizeObserver(()=>r()),n.observe(t.current)),()=>{window.removeEventListener("resize",r),n&&t.current&&n.unobserve(t.current)}},[])}const Oj={position:"absolute",width:"100%",height:"100%",top:0,left:0},USe=(t,e)=>t.x!==e.x||t.y!==e.y||t.zoom!==e.k,Fx=t=>({x:t.x,y:t.y,zoom:t.k}),Ad=(t,e)=>t.target.closest(`.${e}`),nA=(t,e)=>e===2&&Array.isArray(t)&&t.includes(2),rA=t=>{const e=t.ctrlKey&&xv()?10:1;return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*e},WSe=t=>({d3Zoom:t.d3Zoom,d3Selection:t.d3Selection,d3ZoomHandler:t.d3ZoomHandler,userSelectionActive:t.userSelectionActive}),GSe=({onMove:t,onMoveStart:e,onMoveEnd:n,onPaneContextMenu:r,zoomOnScroll:s=!0,zoomOnPinch:i=!0,panOnScroll:a=!1,panOnScrollSpeed:o=.5,panOnScrollMode:c=xu.Free,zoomOnDoubleClick:h=!0,elementsSelectable:f,panOnDrag:m=!0,defaultViewport:g,translateExtent:x,minZoom:y,maxZoom:w,zoomActivationKeyCode:S,preventScrolling:k=!0,children:N,noWheelClassName:C,noPanClassName:T})=>{const _=b.useRef(),E=Xr(),M=b.useRef(!1),q=b.useRef(!1),L=b.useRef(null),I=b.useRef({x:0,y:0,zoom:0}),{d3Zoom:$,d3Selection:V,d3ZoomHandler:ee,userSelectionActive:z}=Xn(WSe,rs),H=j0(S),P=b.useRef(0),W=b.useRef(!1),J=b.useRef();return VSe(L),b.useEffect(()=>{if(L.current){const X=L.current.getBoundingClientRect(),R=vH().scaleExtent([y,w]).translateExtent(x),se=Yi(L.current).call(R),G=co.translate(g.x,g.y).scale(Mh(g.zoom,y,w)),F=[[0,0],[X.width,X.height]],U=R.constrain()(G,F,x);R.transform(se,U),R.wheelDelta(rA),E.setState({d3Zoom:R,d3Selection:se,d3ZoomHandler:se.on("wheel.zoom"),transform:[U.x,U.y,U.k],domNode:L.current.closest(".react-flow")})}},[]),b.useEffect(()=>{V&&$&&(a&&!H&&!z?V.on("wheel.zoom",X=>{if(Ad(X,C))return!1;X.preventDefault(),X.stopImmediatePropagation();const R=V.property("__zoom").k||1;if(X.ctrlKey&&i){const ae=Sa(X),re=rA(X),le=R*Math.pow(2,re);$.scaleTo(V,le,ae,X);return}const se=X.deltaMode===1?20:1;let G=c===xu.Vertical?0:X.deltaX*se,F=c===xu.Horizontal?0:X.deltaY*se;!xv()&&X.shiftKey&&c!==xu.Vertical&&(G=X.deltaY*se,F=0),$.translateBy(V,-(G/R)*o,-(F/R)*o,{internal:!0});const U=Fx(V.property("__zoom")),{onViewportChangeStart:te,onViewportChange:ne,onViewportChangeEnd:Y}=E.getState();clearTimeout(J.current),W.current||(W.current=!0,e?.(X,U),te?.(U)),W.current&&(t?.(X,U),ne?.(U),J.current=setTimeout(()=>{n?.(X,U),Y?.(U),W.current=!1},150))},{passive:!1}):typeof ee<"u"&&V.on("wheel.zoom",function(X,R){if(!k&&X.type==="wheel"&&!X.ctrlKey||Ad(X,C))return null;X.preventDefault(),ee.call(this,X,R)},{passive:!1}))},[z,a,c,V,$,ee,H,i,k,C,e,t,n]),b.useEffect(()=>{$&&$.on("start",X=>{if(!X.sourceEvent||X.sourceEvent.internal)return null;P.current=X.sourceEvent?.button;const{onViewportChangeStart:R}=E.getState(),se=Fx(X.transform);M.current=!0,I.current=se,X.sourceEvent?.type==="mousedown"&&E.setState({paneDragging:!0}),R?.(se),e?.(X.sourceEvent,se)})},[$,e]),b.useEffect(()=>{$&&(z&&!M.current?$.on("zoom",null):z||$.on("zoom",X=>{const{onViewportChange:R}=E.getState();if(E.setState({transform:[X.transform.x,X.transform.y,X.transform.k]}),q.current=!!(r&&nA(m,P.current??0)),(t||R)&&!X.sourceEvent?.internal){const se=Fx(X.transform);R?.(se),t?.(X.sourceEvent,se)}}))},[z,$,t,m,r]),b.useEffect(()=>{$&&$.on("end",X=>{if(!X.sourceEvent||X.sourceEvent.internal)return null;const{onViewportChangeEnd:R}=E.getState();if(M.current=!1,E.setState({paneDragging:!1}),r&&nA(m,P.current??0)&&!q.current&&r(X.sourceEvent),q.current=!1,(n||R)&&USe(I.current,X.transform)){const se=Fx(X.transform);I.current=se,clearTimeout(_.current),_.current=setTimeout(()=>{R?.(se),n?.(X.sourceEvent,se)},a?150:0)}})},[$,a,m,n,r]),b.useEffect(()=>{$&&$.filter(X=>{const R=H||s,se=i&&X.ctrlKey;if((m===!0||Array.isArray(m)&&m.includes(1))&&X.button===1&&X.type==="mousedown"&&(Ad(X,"react-flow__node")||Ad(X,"react-flow__edge")))return!0;if(!m&&!R&&!a&&!h&&!i||z||!h&&X.type==="dblclick"||Ad(X,C)&&X.type==="wheel"||Ad(X,T)&&(X.type!=="wheel"||a&&X.type==="wheel"&&!H)||!i&&X.ctrlKey&&X.type==="wheel"||!R&&!a&&!se&&X.type==="wheel"||!m&&(X.type==="mousedown"||X.type==="touchstart")||Array.isArray(m)&&!m.includes(X.button)&&X.type==="mousedown")return!1;const G=Array.isArray(m)&&m.includes(X.button)||!X.button||X.button<=1;return(!X.ctrlKey||X.type==="wheel")&&G})},[z,$,s,i,a,h,m,f,H]),he.createElement("div",{className:"react-flow__renderer",ref:L,style:Oj},N)},XSe=t=>({userSelectionActive:t.userSelectionActive,userSelectionRect:t.userSelectionRect});function YSe(){const{userSelectionActive:t,userSelectionRect:e}=Xn(XSe,rs);return t&&e?he.createElement("div",{className:"react-flow__selection react-flow__container",style:{width:e.width,height:e.height,transform:`translate(${e.x}px, ${e.y}px)`}}):null}function sA(t,e){const n=e.parentNode||e.parentId,r=t.find(s=>s.id===n);if(r){const s=e.position.x+e.width-r.width,i=e.position.y+e.height-r.height;if(s>0||i>0||e.position.x<0||e.position.y<0){if(r.style={...r.style},r.style.width=r.style.width??r.width,r.style.height=r.style.height??r.height,s>0&&(r.style.width+=s),i>0&&(r.style.height+=i),e.position.x<0){const a=Math.abs(e.position.x);r.position.x=r.position.x-a,r.style.width+=a,e.position.x=0}if(e.position.y<0){const a=Math.abs(e.position.y);r.position.y=r.position.y-a,r.style.height+=a,e.position.y=0}r.width=r.style.width,r.height=r.style.height}}}function XH(t,e){if(t.some(r=>r.type==="reset"))return t.filter(r=>r.type==="reset").map(r=>r.item);const n=t.filter(r=>r.type==="add").map(r=>r.item);return e.reduce((r,s)=>{const i=t.filter(o=>o.id===s.id);if(i.length===0)return r.push(s),r;const a={...s};for(const o of i)if(o)switch(o.type){case"select":{a.selected=o.selected;break}case"position":{typeof o.position<"u"&&(a.position=o.position),typeof o.positionAbsolute<"u"&&(a.positionAbsolute=o.positionAbsolute),typeof o.dragging<"u"&&(a.dragging=o.dragging),a.expandParent&&sA(r,a);break}case"dimensions":{typeof o.dimensions<"u"&&(a.width=o.dimensions.width,a.height=o.dimensions.height),typeof o.updateStyle<"u"&&(a.style={...a.style||{},...o.dimensions}),typeof o.resizing=="boolean"&&(a.resizing=o.resizing),a.expandParent&&sA(r,a);break}case"remove":return r}return r.push(a),r},n)}function YH(t,e){return XH(t,e)}function KSe(t,e){return XH(t,e)}const oc=(t,e)=>({id:t,type:"select",selected:e});function Xd(t,e){return t.reduce((n,r)=>{const s=e.includes(r.id);return!r.selected&&s?(r.selected=!0,n.push(oc(r.id,!0))):r.selected&&!s&&(r.selected=!1,n.push(oc(r.id,!1))),n},[])}const L4=(t,e)=>n=>{n.target===e.current&&t?.(n)},ZSe=t=>({userSelectionActive:t.userSelectionActive,elementsSelectable:t.elementsSelectable,dragging:t.paneDragging}),KH=b.memo(({isSelecting:t,selectionMode:e=O0.Full,panOnDrag:n,onSelectionStart:r,onSelectionEnd:s,onPaneClick:i,onPaneContextMenu:a,onPaneScroll:o,onPaneMouseEnter:c,onPaneMouseMove:h,onPaneMouseLeave:f,children:m})=>{const g=b.useRef(null),x=Xr(),y=b.useRef(0),w=b.useRef(0),S=b.useRef(),{userSelectionActive:k,elementsSelectable:N,dragging:C}=Xn(ZSe,rs),T=()=>{x.setState({userSelectionActive:!1,userSelectionRect:null}),y.current=0,w.current=0},_=ee=>{i?.(ee),x.getState().resetSelectedElements(),x.setState({nodesSelectionActive:!1})},E=ee=>{if(Array.isArray(n)&&n?.includes(2)){ee.preventDefault();return}a?.(ee)},M=o?ee=>o(ee):void 0,q=ee=>{const{resetSelectedElements:z,domNode:H}=x.getState();if(S.current=H?.getBoundingClientRect(),!N||!t||ee.button!==0||ee.target!==g.current||!S.current)return;const{x:P,y:W}=pc(ee,S.current);z(),x.setState({userSelectionRect:{width:0,height:0,startX:P,startY:W,x:P,y:W}}),r?.(ee)},L=ee=>{const{userSelectionRect:z,nodeInternals:H,edges:P,transform:W,onNodesChange:J,onEdgesChange:X,nodeOrigin:R,getNodes:se}=x.getState();if(!t||!S.current||!z)return;x.setState({userSelectionActive:!0,nodesSelectionActive:!1});const G=pc(ee,S.current),F=z.startX??0,U=z.startY??0,te={...z,x:G.xle.id),re=Y.map(le=>le.id);if(y.current!==re.length){y.current=re.length;const le=Xd(ne,re);le.length&&J?.(le)}if(w.current!==ae.length){w.current=ae.length;const le=Xd(P,ae);le.length&&X?.(le)}x.setState({userSelectionRect:te})},I=ee=>{if(ee.button!==0)return;const{userSelectionRect:z}=x.getState();!k&&z&&ee.target===g.current&&_?.(ee),x.setState({nodesSelectionActive:y.current>0}),T(),s?.(ee)},$=ee=>{k&&(x.setState({nodesSelectionActive:y.current>0}),s?.(ee)),T()},V=N&&(t||k);return he.createElement("div",{className:xs(["react-flow__pane",{dragging:C,selection:t}]),onClick:V?void 0:L4(_,g),onContextMenu:L4(E,g),onWheel:L4(M,g),onMouseEnter:V?void 0:c,onMouseDown:V?q:void 0,onMouseMove:V?L:h,onMouseUp:V?I:void 0,onMouseLeave:V?$:f,ref:g,style:Oj},m,he.createElement(YSe,null))});KH.displayName="Pane";function ZH(t,e){const n=t.parentNode||t.parentId;if(!n)return!1;const r=e.get(n);return r?r.selected?!0:ZH(r,e):!1}function iA(t,e,n){let r=t;do{if(r?.matches(e))return!0;if(r===n.current)return!1;r=r.parentElement}while(r);return!1}function JSe(t,e,n,r){return Array.from(t.values()).filter(s=>(s.selected||s.id===r)&&(!s.parentNode||s.parentId||!ZH(s,t))&&(s.draggable||e&&typeof s.draggable>"u")).map(s=>({id:s.id,position:s.position||{x:0,y:0},positionAbsolute:s.positionAbsolute||{x:0,y:0},distance:{x:n.x-(s.positionAbsolute?.x??0),y:n.y-(s.positionAbsolute?.y??0)},delta:{x:0,y:0},extent:s.extent,parentNode:s.parentNode||s.parentId,parentId:s.parentNode||s.parentId,width:s.width,height:s.height,expandParent:s.expandParent}))}function eke(t,e){return!e||e==="parent"?e:[e[0],[e[1][0]-(t.width||0),e[1][1]-(t.height||0)]]}function JH(t,e,n,r,s=[0,0],i){const a=eke(t,t.extent||r);let o=a;const c=t.parentNode||t.parentId;if(t.extent==="parent"&&!t.expandParent)if(c&&t.width&&t.height){const m=n.get(c),{x:g,y:x}=Ou(m,s).positionAbsolute;o=m&&ta(g)&&ta(x)&&ta(m.width)&&ta(m.height)?[[g+t.width*s[0],x+t.height*s[1]],[g+m.width-t.width+t.width*s[0],x+m.height-t.height+t.height*s[1]]]:o}else i?.("005",bo.error005()),o=a;else if(t.extent&&c&&t.extent!=="parent"){const m=n.get(c),{x:g,y:x}=Ou(m,s).positionAbsolute;o=[[t.extent[0][0]+g,t.extent[0][1]+x],[t.extent[1][0]+g,t.extent[1][1]+x]]}let h={x:0,y:0};if(c){const m=n.get(c);h=Ou(m,s).positionAbsolute}const f=o&&o!=="parent"?gj(e,o):e;return{position:{x:f.x-h.x,y:f.y-h.y},positionAbsolute:f}}function I4({nodeId:t,dragItems:e,nodeInternals:n}){const r=e.map(s=>({...n.get(s.id),position:s.position,positionAbsolute:s.positionAbsolute}));return[t?r.find(s=>s.id===t):r[0],r]}const aA=(t,e,n,r)=>{const s=e.querySelectorAll(t);if(!s||!s.length)return null;const i=Array.from(s),a=e.getBoundingClientRect(),o={x:a.width*r[0],y:a.height*r[1]};return i.map(c=>{const h=c.getBoundingClientRect();return{id:c.getAttribute("data-handleid"),position:c.getAttribute("data-handlepos"),x:(h.left-a.left-o.x)/n,y:(h.top-a.top-o.y)/n,...pj(c)}})};function hm(t,e,n){return n===void 0?n:r=>{const s=e().nodeInternals.get(t);s&&n(r,{...s})}}function Nk({id:t,store:e,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:s,unselectNodesAndEdges:i,multiSelectionActive:a,nodeInternals:o,onError:c}=e.getState(),h=o.get(t);if(!h){c?.("012",bo.error012(t));return}e.setState({nodesSelectionActive:!1}),h.selected?(n||h.selected&&a)&&(i({nodes:[h],edges:[]}),requestAnimationFrame(()=>r?.current?.blur())):s([t])}function tke(){const t=Xr();return b.useCallback(({sourceEvent:n})=>{const{transform:r,snapGrid:s,snapToGrid:i}=t.getState(),a=n.touches?n.touches[0].clientX:n.clientX,o=n.touches?n.touches[0].clientY:n.clientY,c={x:(a-r[0])/r[2],y:(o-r[1])/r[2]};return{xSnapped:i?s[0]*Math.round(c.x/s[0]):c.x,ySnapped:i?s[1]*Math.round(c.y/s[1]):c.y,...c}},[])}function B4(t){return(e,n,r)=>t?.(e,r)}function eV({nodeRef:t,disabled:e=!1,noDragClassName:n,handleSelector:r,nodeId:s,isSelectable:i,selectNodesOnDrag:a}){const o=Xr(),[c,h]=b.useState(!1),f=b.useRef([]),m=b.useRef({x:null,y:null}),g=b.useRef(0),x=b.useRef(null),y=b.useRef({x:0,y:0}),w=b.useRef(null),S=b.useRef(!1),k=b.useRef(!1),N=b.useRef(!1),C=tke();return b.useEffect(()=>{if(t?.current){const T=Yi(t.current),_=({x:q,y:L})=>{const{nodeInternals:I,onNodeDrag:$,onSelectionDrag:V,updateNodePositions:ee,nodeExtent:z,snapGrid:H,snapToGrid:P,nodeOrigin:W,onError:J}=o.getState();m.current={x:q,y:L};let X=!1,R={x:0,y:0,x2:0,y2:0};if(f.current.length>1&&z){const G=Ry(f.current,W);R=k0(G)}if(f.current=f.current.map(G=>{const F={x:q-G.distance.x,y:L-G.distance.y};P&&(F.x=H[0]*Math.round(F.x/H[0]),F.y=H[1]*Math.round(F.y/H[1]));const U=[[z[0][0],z[0][1]],[z[1][0],z[1][1]]];f.current.length>1&&z&&!G.extent&&(U[0][0]=G.positionAbsolute.x-R.x+z[0][0],U[1][0]=G.positionAbsolute.x+(G.width??0)-R.x2+z[1][0],U[0][1]=G.positionAbsolute.y-R.y+z[0][1],U[1][1]=G.positionAbsolute.y+(G.height??0)-R.y2+z[1][1]);const te=JH(G,F,I,U,W,J);return X=X||G.position.x!==te.position.x||G.position.y!==te.position.y,G.position=te.position,G.positionAbsolute=te.positionAbsolute,G}),!X)return;ee(f.current,!0,!0),h(!0);const se=s?$:B4(V);if(se&&w.current){const[G,F]=I4({nodeId:s,dragItems:f.current,nodeInternals:I});se(w.current,G,F)}},E=()=>{if(!x.current)return;const[q,L]=bH(y.current,x.current);if(q!==0||L!==0){const{transform:I,panBy:$}=o.getState();m.current.x=(m.current.x??0)-q/I[2],m.current.y=(m.current.y??0)-L/I[2],$({x:q,y:L})&&_(m.current)}g.current=requestAnimationFrame(E)},M=q=>{const{nodeInternals:L,multiSelectionActive:I,nodesDraggable:$,unselectNodesAndEdges:V,onNodeDragStart:ee,onSelectionDragStart:z}=o.getState();k.current=!0;const H=s?ee:B4(z);(!a||!i)&&!I&&s&&(L.get(s)?.selected||V()),s&&i&&a&&Nk({id:s,store:o,nodeRef:t});const P=C(q);if(m.current=P,f.current=JSe(L,$,P,s),H&&f.current){const[W,J]=I4({nodeId:s,dragItems:f.current,nodeInternals:L});H(q.sourceEvent,W,J)}};if(e)T.on(".drag",null);else{const q=I5e().on("start",L=>{const{domNode:I,nodeDragThreshold:$}=o.getState();$===0&&M(L),N.current=!1;const V=C(L);m.current=V,x.current=I?.getBoundingClientRect()||null,y.current=pc(L.sourceEvent,x.current)}).on("drag",L=>{const I=C(L),{autoPanOnNodeDrag:$,nodeDragThreshold:V}=o.getState();if(L.sourceEvent.type==="touchmove"&&L.sourceEvent.touches.length>1&&(N.current=!0),!N.current){if(!S.current&&k.current&&$&&(S.current=!0,E()),!k.current){const ee=I.xSnapped-(m?.current?.x??0),z=I.ySnapped-(m?.current?.y??0);Math.sqrt(ee*ee+z*z)>V&&M(L)}(m.current.x!==I.xSnapped||m.current.y!==I.ySnapped)&&f.current&&k.current&&(w.current=L.sourceEvent,y.current=pc(L.sourceEvent,x.current),_(I))}}).on("end",L=>{if(!(!k.current||N.current)&&(h(!1),S.current=!1,k.current=!1,cancelAnimationFrame(g.current),f.current)){const{updateNodePositions:I,nodeInternals:$,onNodeDragStop:V,onSelectionDragStop:ee}=o.getState(),z=s?V:B4(ee);if(I(f.current,!1,!1),z){const[H,P]=I4({nodeId:s,dragItems:f.current,nodeInternals:$});z(L.sourceEvent,H,P)}}}).filter(L=>{const I=L.target;return!L.button&&(!n||!iA(I,`.${n}`,t))&&(!r||iA(I,r,t))});return T.call(q),()=>{T.on(".drag",null)}}}},[t,e,n,r,i,o,s,a,C]),c}function tV(){const t=Xr();return b.useCallback(n=>{const{nodeInternals:r,nodeExtent:s,updateNodePositions:i,getNodes:a,snapToGrid:o,snapGrid:c,onError:h,nodesDraggable:f}=t.getState(),m=a().filter(N=>N.selected&&(N.draggable||f&&typeof N.draggable>"u")),g=o?c[0]:5,x=o?c[1]:5,y=n.isShiftPressed?4:1,w=n.x*g*y,S=n.y*x*y,k=m.map(N=>{if(N.positionAbsolute){const C={x:N.positionAbsolute.x+w,y:N.positionAbsolute.y+S};o&&(C.x=c[0]*Math.round(C.x/c[0]),C.y=c[1]*Math.round(C.y/c[1]));const{positionAbsolute:T,position:_}=JH(N,C,r,s,void 0,h);N.position=_,N.positionAbsolute=T}return N});i(k,!0,!1)},[])}const uh={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var fm=t=>{const e=({id:n,type:r,data:s,xPos:i,yPos:a,xPosOrigin:o,yPosOrigin:c,selected:h,onClick:f,onMouseEnter:m,onMouseMove:g,onMouseLeave:x,onContextMenu:y,onDoubleClick:w,style:S,className:k,isDraggable:N,isSelectable:C,isConnectable:T,isFocusable:_,selectNodesOnDrag:E,sourcePosition:M,targetPosition:q,hidden:L,resizeObserver:I,dragHandle:$,zIndex:V,isParent:ee,noDragClassName:z,noPanClassName:H,initialized:P,disableKeyboardA11y:W,ariaLabel:J,rfId:X,hasHandleBounds:R})=>{const se=Xr(),G=b.useRef(null),F=b.useRef(null),U=b.useRef(M),te=b.useRef(q),ne=b.useRef(r),Y=C||N||f||m||g||x,ae=tV(),re=hm(n,se.getState,m),le=hm(n,se.getState,g),_e=hm(n,se.getState,x),Ge=hm(n,se.getState,y),tt=hm(n,se.getState,w),Xe=He=>{const{nodeDragThreshold:$e}=se.getState();if(C&&(!E||!N||$e>0)&&Nk({id:n,store:se,nodeRef:G}),f){const bt=se.getState().nodeInternals.get(n);bt&&f(He,{...bt})}},je=He=>{if(!wk(He)&&!W)if(OH.includes(He.key)&&C){const $e=He.key==="Escape";Nk({id:n,store:se,unselect:$e,nodeRef:G})}else N&&h&&Object.prototype.hasOwnProperty.call(uh,He.key)&&(se.setState({ariaLiveMessage:`Moved selected node ${He.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~i}, y: ${~~a}`}),ae({x:uh[He.key].x,y:uh[He.key].y,isShiftPressed:He.shiftKey}))};b.useEffect(()=>()=>{F.current&&(I?.unobserve(F.current),F.current=null)},[]),b.useEffect(()=>{if(G.current&&!L){const He=G.current;(!P||!R||F.current!==He)&&(F.current&&I?.unobserve(F.current),I?.observe(He),F.current=He)}},[L,P,R]),b.useEffect(()=>{const He=ne.current!==r,$e=U.current!==M,bt=te.current!==q;G.current&&(He||$e||bt)&&(He&&(ne.current=r),$e&&(U.current=M),bt&&(te.current=q),se.getState().updateNodeDimensions([{id:n,nodeElement:G.current,forceUpdate:!0}]))},[n,r,M,q]);const Qe=eV({nodeRef:G,disabled:L||!N,noDragClassName:z,handleSelector:$,nodeId:n,isSelectable:C,selectNodesOnDrag:E});return L?null:he.createElement("div",{className:xs(["react-flow__node",`react-flow__node-${r}`,{[H]:N},k,{selected:h,selectable:C,parent:ee,dragging:Qe}]),ref:G,style:{zIndex:V,transform:`translate(${o}px,${c}px)`,pointerEvents:Y?"all":"none",visibility:P?"visible":"hidden",...S},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:re,onMouseMove:le,onMouseLeave:_e,onContextMenu:Ge,onClick:Xe,onDoubleClick:tt,onKeyDown:_?je:void 0,tabIndex:_?0:void 0,role:_?"button":void 0,"aria-describedby":W?void 0:`${HH}-${X}`,"aria-label":J},he.createElement(pSe,{value:n},he.createElement(t,{id:n,data:s,type:r,xPos:i,yPos:a,selected:h,isConnectable:T,sourcePosition:M,targetPosition:q,dragging:Qe,dragHandle:$,zIndex:V})))};return e.displayName="NodeWrapper",b.memo(e)};const nke=t=>{const e=t.getNodes().filter(n=>n.selected);return{...Ry(e,t.nodeOrigin),transformString:`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]})`,userSelectionActive:t.userSelectionActive}};function rke({onSelectionContextMenu:t,noPanClassName:e,disableKeyboardA11y:n}){const r=Xr(),{width:s,height:i,x:a,y:o,transformString:c,userSelectionActive:h}=Xn(nke,rs),f=tV(),m=b.useRef(null);if(b.useEffect(()=>{n||m.current?.focus({preventScroll:!0})},[n]),eV({nodeRef:m}),h||!s||!i)return null;const g=t?y=>{const w=r.getState().getNodes().filter(S=>S.selected);t(y,w)}:void 0,x=y=>{Object.prototype.hasOwnProperty.call(uh,y.key)&&f({x:uh[y.key].x,y:uh[y.key].y,isShiftPressed:y.shiftKey})};return he.createElement("div",{className:xs(["react-flow__nodesselection","react-flow__container",e]),style:{transform:c}},he.createElement("div",{ref:m,className:"react-flow__nodesselection-rect",onContextMenu:g,tabIndex:n?void 0:-1,onKeyDown:n?void 0:x,style:{width:s,height:i,top:o,left:a}}))}var ske=b.memo(rke);const ike=t=>t.nodesSelectionActive,nV=({children:t,onPaneClick:e,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:i,onPaneScroll:a,deleteKeyCode:o,onMove:c,onMoveStart:h,onMoveEnd:f,selectionKeyCode:m,selectionOnDrag:g,selectionMode:x,onSelectionStart:y,onSelectionEnd:w,multiSelectionKeyCode:S,panActivationKeyCode:k,zoomActivationKeyCode:N,elementsSelectable:C,zoomOnScroll:T,zoomOnPinch:_,panOnScroll:E,panOnScrollSpeed:M,panOnScrollMode:q,zoomOnDoubleClick:L,panOnDrag:I,defaultViewport:$,translateExtent:V,minZoom:ee,maxZoom:z,preventScrolling:H,onSelectionContextMenu:P,noWheelClassName:W,noPanClassName:J,disableKeyboardA11y:X})=>{const R=Xn(ike),se=j0(m),G=j0(k),F=G||I,U=G||E,te=se||g&&F!==!0;return HSe({deleteKeyCode:o,multiSelectionKeyCode:S}),he.createElement(GSe,{onMove:c,onMoveStart:h,onMoveEnd:f,onPaneContextMenu:i,elementsSelectable:C,zoomOnScroll:T,zoomOnPinch:_,panOnScroll:U,panOnScrollSpeed:M,panOnScrollMode:q,zoomOnDoubleClick:L,panOnDrag:!se&&F,defaultViewport:$,translateExtent:V,minZoom:ee,maxZoom:z,zoomActivationKeyCode:N,preventScrolling:H,noWheelClassName:W,noPanClassName:J},he.createElement(KH,{onSelectionStart:y,onSelectionEnd:w,onPaneClick:e,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:i,onPaneScroll:a,panOnDrag:F,isSelecting:!!te,selectionMode:x},t,R&&he.createElement(ske,{onSelectionContextMenu:P,noPanClassName:J,disableKeyboardA11y:X})))};nV.displayName="FlowRenderer";var ake=b.memo(nV);function lke(t){return Xn(b.useCallback(n=>t?MH(n.nodeInternals,{x:0,y:0,width:n.width,height:n.height},n.transform,!0):n.getNodes(),[t]))}function oke(t){const e={input:fm(t.input||qH),default:fm(t.default||jk),output:fm(t.output||$H),group:fm(t.group||Sj)},n={},r=Object.keys(t).filter(s=>!["input","default","output","group"].includes(s)).reduce((s,i)=>(s[i]=fm(t[i]||jk),s),n);return{...e,...r}}const cke=({x:t,y:e,width:n,height:r,origin:s})=>!n||!r?{x:t,y:e}:s[0]<0||s[1]<0||s[0]>1||s[1]>1?{x:t,y:e}:{x:t-n*s[0],y:e-r*s[1]},uke=t=>({nodesDraggable:t.nodesDraggable,nodesConnectable:t.nodesConnectable,nodesFocusable:t.nodesFocusable,elementsSelectable:t.elementsSelectable,updateNodeDimensions:t.updateNodeDimensions,onError:t.onError}),rV=t=>{const{nodesDraggable:e,nodesConnectable:n,nodesFocusable:r,elementsSelectable:s,updateNodeDimensions:i,onError:a}=Xn(uke,rs),o=lke(t.onlyRenderVisibleElements),c=b.useRef(),h=b.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const f=new ResizeObserver(m=>{const g=m.map(x=>({id:x.target.getAttribute("data-id"),nodeElement:x.target,forceUpdate:!0}));i(g)});return c.current=f,f},[]);return b.useEffect(()=>()=>{c?.current?.disconnect()},[]),he.createElement("div",{className:"react-flow__nodes",style:Oj},o.map(f=>{let m=f.type||"default";t.nodeTypes[m]||(a?.("003",bo.error003(m)),m="default");const g=t.nodeTypes[m]||t.nodeTypes.default,x=!!(f.draggable||e&&typeof f.draggable>"u"),y=!!(f.selectable||s&&typeof f.selectable>"u"),w=!!(f.connectable||n&&typeof f.connectable>"u"),S=!!(f.focusable||r&&typeof f.focusable>"u"),k=t.nodeExtent?gj(f.positionAbsolute,t.nodeExtent):f.positionAbsolute,N=k?.x??0,C=k?.y??0,T=cke({x:N,y:C,width:f.width??0,height:f.height??0,origin:t.nodeOrigin});return he.createElement(g,{key:f.id,id:f.id,className:f.className,style:f.style,type:m,data:f.data,sourcePosition:f.sourcePosition||ht.Bottom,targetPosition:f.targetPosition||ht.Top,hidden:f.hidden,xPos:N,yPos:C,xPosOrigin:T.x,yPosOrigin:T.y,selectNodesOnDrag:t.selectNodesOnDrag,onClick:t.onNodeClick,onMouseEnter:t.onNodeMouseEnter,onMouseMove:t.onNodeMouseMove,onMouseLeave:t.onNodeMouseLeave,onContextMenu:t.onNodeContextMenu,onDoubleClick:t.onNodeDoubleClick,selected:!!f.selected,isDraggable:x,isSelectable:y,isConnectable:w,isFocusable:S,resizeObserver:h,dragHandle:f.dragHandle,zIndex:f[yr]?.z??0,isParent:!!f[yr]?.isParent,noDragClassName:t.noDragClassName,noPanClassName:t.noPanClassName,initialized:!!f.width&&!!f.height,rfId:t.rfId,disableKeyboardA11y:t.disableKeyboardA11y,ariaLabel:f.ariaLabel,hasHandleBounds:!!f[yr]?.handleBounds})}))};rV.displayName="NodeRenderer";var dke=b.memo(rV);const hke=(t,e,n)=>n===ht.Left?t-e:n===ht.Right?t+e:t,fke=(t,e,n)=>n===ht.Top?t-e:n===ht.Bottom?t+e:t,lA="react-flow__edgeupdater",oA=({position:t,centerX:e,centerY:n,radius:r=10,onMouseDown:s,onMouseEnter:i,onMouseOut:a,type:o})=>he.createElement("circle",{onMouseDown:s,onMouseEnter:i,onMouseOut:a,className:xs([lA,`${lA}-${o}`]),cx:hke(e,r,t),cy:fke(n,r,t),r,stroke:"transparent",fill:"transparent"}),mke=()=>!0;var Rd=t=>{const e=({id:n,className:r,type:s,data:i,onClick:a,onEdgeDoubleClick:o,selected:c,animated:h,label:f,labelStyle:m,labelShowBg:g,labelBgStyle:x,labelBgPadding:y,labelBgBorderRadius:w,style:S,source:k,target:N,sourceX:C,sourceY:T,targetX:_,targetY:E,sourcePosition:M,targetPosition:q,elementsSelectable:L,hidden:I,sourceHandleId:$,targetHandleId:V,onContextMenu:ee,onMouseEnter:z,onMouseMove:H,onMouseLeave:P,reconnectRadius:W,onReconnect:J,onReconnectStart:X,onReconnectEnd:R,markerEnd:se,markerStart:G,rfId:F,ariaLabel:U,isFocusable:te,isReconnectable:ne,pathOptions:Y,interactionWidth:ae,disableKeyboardA11y:re})=>{const le=b.useRef(null),[_e,Ge]=b.useState(!1),[tt,Xe]=b.useState(!1),je=Xr(),Qe=b.useMemo(()=>`url('#${kk(G,F)}')`,[G,F]),He=b.useMemo(()=>`url('#${kk(se,F)}')`,[se,F]);if(I)return null;const $e=jt=>{const{edges:Ne,addSelectedEdges:ie,unselectNodesAndEdges:xe,multiSelectionActive:Je}=je.getState(),dt=Ne.find(er=>er.id===n);dt&&(L&&(je.setState({nodesSelectionActive:!1}),dt.selected&&Je?(xe({nodes:[],edges:[dt]}),le.current?.blur()):ie([n])),a&&a(jt,dt))},bt=dm(n,je.getState,o),lt=dm(n,je.getState,ee),xn=dm(n,je.getState,z),_n=dm(n,je.getState,H),Cn=dm(n,je.getState,P),Dt=(jt,Ne)=>{if(jt.button!==0)return;const{edges:ie,isValidConnection:xe}=je.getState(),Je=Ne?N:k,dt=(Ne?V:$)||null,er=Ne?"target":"source",pt=xe||mke,kn=Ne,vt=ie.find(ot=>ot.id===n);Xe(!0),X?.(jt,vt,er);const Gt=ot=>{Xe(!1),R?.(ot,vt,er)};PH({event:jt,handleId:dt,nodeId:Je,onConnect:ot=>J?.(vt,ot),isTarget:kn,getState:je.getState,setState:je.setState,isValidConnection:pt,edgeUpdaterType:er,onReconnectEnd:Gt})},xt=jt=>Dt(jt,!0),Te=jt=>Dt(jt,!1),Re=()=>Ge(!0),qe=()=>Ge(!1),rt=!L&&!a,wt=jt=>{if(!re&&OH.includes(jt.key)&&L){const{unselectNodesAndEdges:Ne,addSelectedEdges:ie,edges:xe}=je.getState();jt.key==="Escape"?(le.current?.blur(),Ne({edges:[xe.find(dt=>dt.id===n)]})):ie([n])}};return he.createElement("g",{className:xs(["react-flow__edge",`react-flow__edge-${s}`,r,{selected:c,animated:h,inactive:rt,updating:_e}]),onClick:$e,onDoubleClick:bt,onContextMenu:lt,onMouseEnter:xn,onMouseMove:_n,onMouseLeave:Cn,onKeyDown:te?wt:void 0,tabIndex:te?0:void 0,role:te?"button":"img","data-testid":`rf__edge-${n}`,"aria-label":U===null?void 0:U||`Edge from ${k} to ${N}`,"aria-describedby":te?`${VH}-${F}`:void 0,ref:le},!tt&&he.createElement(t,{id:n,source:k,target:N,selected:c,animated:h,label:f,labelStyle:m,labelShowBg:g,labelBgStyle:x,labelBgPadding:y,labelBgBorderRadius:w,data:i,style:S,sourceX:C,sourceY:T,targetX:_,targetY:E,sourcePosition:M,targetPosition:q,sourceHandleId:$,targetHandleId:V,markerStart:Qe,markerEnd:He,pathOptions:Y,interactionWidth:ae}),ne&&he.createElement(he.Fragment,null,(ne==="source"||ne===!0)&&he.createElement(oA,{position:M,centerX:C,centerY:T,radius:W,onMouseDown:xt,onMouseEnter:Re,onMouseOut:qe,type:"source"}),(ne==="target"||ne===!0)&&he.createElement(oA,{position:q,centerX:_,centerY:E,radius:W,onMouseDown:Te,onMouseEnter:Re,onMouseOut:qe,type:"target"})))};return e.displayName="EdgeWrapper",b.memo(e)};function pke(t){const e={default:Rd(t.default||yv),straight:Rd(t.bezier||yj),step:Rd(t.step||vj),smoothstep:Rd(t.step||Ay),simplebezier:Rd(t.simplebezier||xj)},n={},r=Object.keys(t).filter(s=>!["default","bezier"].includes(s)).reduce((s,i)=>(s[i]=Rd(t[i]||yv),s),n);return{...e,...r}}function cA(t,e,n=null){const r=(n?.x||0)+e.x,s=(n?.y||0)+e.y,i=n?.width||e.width,a=n?.height||e.height;switch(t){case ht.Top:return{x:r+i/2,y:s};case ht.Right:return{x:r+i,y:s+a/2};case ht.Bottom:return{x:r+i/2,y:s+a};case ht.Left:return{x:r,y:s+a/2}}}function uA(t,e){return t?t.length===1||!e?t[0]:e&&t.find(n=>n.id===e)||null:null}const gke=(t,e,n,r,s,i)=>{const a=cA(n,t,e),o=cA(i,r,s);return{sourceX:a.x,sourceY:a.y,targetX:o.x,targetY:o.y}};function xke({sourcePos:t,targetPos:e,sourceWidth:n,sourceHeight:r,targetWidth:s,targetHeight:i,width:a,height:o,transform:c}){const h={x:Math.min(t.x,e.x),y:Math.min(t.y,e.y),x2:Math.max(t.x+n,e.x+s),y2:Math.max(t.y+r,e.y+i)};h.x===h.x2&&(h.x2+=1),h.y===h.y2&&(h.y2+=1);const f=k0({x:(0-c[0])/c[2],y:(0-c[1])/c[2],width:a/c[2],height:o/c[2]}),m=Math.max(0,Math.min(f.x2,h.x2)-Math.max(f.x,h.x)),g=Math.max(0,Math.min(f.y2,h.y2)-Math.max(f.y,h.y));return Math.ceil(m*g)>0}function dA(t){const e=t?.[yr]?.handleBounds||null,n=e&&t?.width&&t?.height&&typeof t?.positionAbsolute?.x<"u"&&typeof t?.positionAbsolute?.y<"u";return[{x:t?.positionAbsolute?.x||0,y:t?.positionAbsolute?.y||0,width:t?.width||0,height:t?.height||0},e,!!n]}const vke=[{level:0,isMaxLevel:!0,edges:[]}];function yke(t,e,n=!1){let r=-1;const s=t.reduce((a,o)=>{const c=ta(o.zIndex);let h=c?o.zIndex:0;if(n){const f=e.get(o.target),m=e.get(o.source),g=o.selected||f?.selected||m?.selected,x=Math.max(m?.[yr]?.z||0,f?.[yr]?.z||0,1e3);h=(c?o.zIndex:0)+(g?x:0)}return a[h]?a[h].push(o):a[h]=[o],r=h>r?h:r,a},{}),i=Object.entries(s).map(([a,o])=>{const c=+a;return{edges:o,level:c,isMaxLevel:c===r}});return i.length===0?vke:i}function bke(t,e,n){const r=Xn(b.useCallback(s=>t?s.edges.filter(i=>{const a=e.get(i.source),o=e.get(i.target);return a?.width&&a?.height&&o?.width&&o?.height&&xke({sourcePos:a.positionAbsolute||{x:0,y:0},targetPos:o.positionAbsolute||{x:0,y:0},sourceWidth:a.width,sourceHeight:a.height,targetWidth:o.width,targetHeight:o.height,width:s.width,height:s.height,transform:s.transform})}):s.edges,[t,e]));return yke(r,e,n)}const wke=({color:t="none",strokeWidth:e=1})=>he.createElement("polyline",{style:{stroke:t,strokeWidth:e},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),Ske=({color:t="none",strokeWidth:e=1})=>he.createElement("polyline",{style:{stroke:t,fill:t,strokeWidth:e},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"}),hA={[vv.Arrow]:wke,[vv.ArrowClosed]:Ske};function kke(t){const e=Xr();return b.useMemo(()=>Object.prototype.hasOwnProperty.call(hA,t)?hA[t]:(e.getState().onError?.("009",bo.error009(t)),null),[t])}const Oke=({id:t,type:e,color:n,width:r=12.5,height:s=12.5,markerUnits:i="strokeWidth",strokeWidth:a,orient:o="auto-start-reverse"})=>{const c=kke(e);return c?he.createElement("marker",{className:"react-flow__arrowhead",id:t,markerWidth:`${r}`,markerHeight:`${s}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:o,refX:"0",refY:"0"},he.createElement(c,{color:n,strokeWidth:a})):null},jke=({defaultColor:t,rfId:e})=>n=>{const r=[];return n.edges.reduce((s,i)=>([i.markerStart,i.markerEnd].forEach(a=>{if(a&&typeof a=="object"){const o=kk(a,e);r.includes(o)||(s.push({id:o,color:a.color||t,...a}),r.push(o))}}),s),[]).sort((s,i)=>s.id.localeCompare(i.id))},sV=({defaultColor:t,rfId:e})=>{const n=Xn(b.useCallback(jke({defaultColor:t,rfId:e}),[t,e]),(r,s)=>!(r.length!==s.length||r.some((i,a)=>i.id!==s[a].id)));return he.createElement("defs",null,n.map(r=>he.createElement(Oke,{id:r.id,key:r.id,type:r.type,color:r.color,width:r.width,height:r.height,markerUnits:r.markerUnits,strokeWidth:r.strokeWidth,orient:r.orient})))};sV.displayName="MarkerDefinitions";var Nke=b.memo(sV);const Cke=t=>({nodesConnectable:t.nodesConnectable,edgesFocusable:t.edgesFocusable,edgesUpdatable:t.edgesUpdatable,elementsSelectable:t.elementsSelectable,width:t.width,height:t.height,connectionMode:t.connectionMode,nodeInternals:t.nodeInternals,onError:t.onError}),iV=({defaultMarkerColor:t,onlyRenderVisibleElements:e,elevateEdgesOnSelect:n,rfId:r,edgeTypes:s,noPanClassName:i,onEdgeContextMenu:a,onEdgeMouseEnter:o,onEdgeMouseMove:c,onEdgeMouseLeave:h,onEdgeClick:f,onEdgeDoubleClick:m,onReconnect:g,onReconnectStart:x,onReconnectEnd:y,reconnectRadius:w,children:S,disableKeyboardA11y:k})=>{const{edgesFocusable:N,edgesUpdatable:C,elementsSelectable:T,width:_,height:E,connectionMode:M,nodeInternals:q,onError:L}=Xn(Cke,rs),I=bke(e,q,n);return _?he.createElement(he.Fragment,null,I.map(({level:$,edges:V,isMaxLevel:ee})=>he.createElement("svg",{key:$,style:{zIndex:$},width:_,height:E,className:"react-flow__edges react-flow__container"},ee&&he.createElement(Nke,{defaultColor:t,rfId:r}),he.createElement("g",null,V.map(z=>{const[H,P,W]=dA(q.get(z.source)),[J,X,R]=dA(q.get(z.target));if(!W||!R)return null;let se=z.type||"default";s[se]||(L?.("011",bo.error011(se)),se="default");const G=s[se]||s.default,F=M===Iu.Strict?X.target:(X.target??[]).concat(X.source??[]),U=uA(P.source,z.sourceHandle),te=uA(F,z.targetHandle),ne=U?.position||ht.Bottom,Y=te?.position||ht.Top,ae=!!(z.focusable||N&&typeof z.focusable>"u"),re=z.reconnectable||z.updatable,le=typeof g<"u"&&(re||C&&typeof re>"u");if(!U||!te)return L?.("008",bo.error008(U,z)),null;const{sourceX:_e,sourceY:Ge,targetX:tt,targetY:Xe}=gke(H,U,ne,J,te,Y);return he.createElement(G,{key:z.id,id:z.id,className:xs([z.className,i]),type:se,data:z.data,selected:!!z.selected,animated:!!z.animated,hidden:!!z.hidden,label:z.label,labelStyle:z.labelStyle,labelShowBg:z.labelShowBg,labelBgStyle:z.labelBgStyle,labelBgPadding:z.labelBgPadding,labelBgBorderRadius:z.labelBgBorderRadius,style:z.style,source:z.source,target:z.target,sourceHandleId:z.sourceHandle,targetHandleId:z.targetHandle,markerEnd:z.markerEnd,markerStart:z.markerStart,sourceX:_e,sourceY:Ge,targetX:tt,targetY:Xe,sourcePosition:ne,targetPosition:Y,elementsSelectable:T,onContextMenu:a,onMouseEnter:o,onMouseMove:c,onMouseLeave:h,onClick:f,onEdgeDoubleClick:m,onReconnect:g,onReconnectStart:x,onReconnectEnd:y,reconnectRadius:w,rfId:r,ariaLabel:z.ariaLabel,isFocusable:ae,isReconnectable:le,pathOptions:"pathOptions"in z?z.pathOptions:void 0,interactionWidth:z.interactionWidth,disableKeyboardA11y:k})})))),S):null};iV.displayName="EdgeRenderer";var Tke=b.memo(iV);const Eke=t=>`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]})`;function _ke({children:t}){const e=Xn(Eke);return he.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:e}},t)}function Mke(t){const e=kj(),n=b.useRef(!1);b.useEffect(()=>{!n.current&&e.viewportInitialized&&t&&(setTimeout(()=>t(e),1),n.current=!0)},[t,e.viewportInitialized])}const Ake={[ht.Left]:ht.Right,[ht.Right]:ht.Left,[ht.Top]:ht.Bottom,[ht.Bottom]:ht.Top},aV=({nodeId:t,handleType:e,style:n,type:r=uc.Bezier,CustomComponent:s,connectionStatus:i})=>{const{fromNode:a,handleId:o,toX:c,toY:h,connectionMode:f}=Xn(b.useCallback(E=>({fromNode:E.nodeInternals.get(t),handleId:E.connectionHandleId,toX:(E.connectionPosition.x-E.transform[0])/E.transform[2],toY:(E.connectionPosition.y-E.transform[1])/E.transform[2],connectionMode:E.connectionMode}),[t]),rs),m=a?.[yr]?.handleBounds;let g=m?.[e];if(f===Iu.Loose&&(g=g||m?.[e==="source"?"target":"source"]),!a||!g)return null;const x=o?g.find(E=>E.id===o):g[0],y=x?x.x+x.width/2:(a.width??0)/2,w=x?x.y+x.height/2:a.height??0,S=(a.positionAbsolute?.x??0)+y,k=(a.positionAbsolute?.y??0)+w,N=x?.position,C=N?Ake[N]:null;if(!N||!C)return null;if(s)return he.createElement(s,{connectionLineType:r,connectionLineStyle:n,fromNode:a,fromHandle:x,fromX:S,fromY:k,toX:c,toY:h,fromPosition:N,toPosition:C,connectionStatus:i});let T="";const _={sourceX:S,sourceY:k,sourcePosition:N,targetX:c,targetY:h,targetPosition:C};return r===uc.Bezier?[T]=EH(_):r===uc.Step?[T]=Sk({..._,borderRadius:0}):r===uc.SmoothStep?[T]=Sk(_):r===uc.SimpleBezier?[T]=TH(_):T=`M${S},${k} ${c},${h}`,he.createElement("path",{d:T,fill:"none",className:"react-flow__connection-path",style:n})};aV.displayName="ConnectionLine";const Rke=t=>({nodeId:t.connectionNodeId,handleType:t.connectionHandleType,nodesConnectable:t.nodesConnectable,connectionStatus:t.connectionStatus,width:t.width,height:t.height});function Dke({containerStyle:t,style:e,type:n,component:r}){const{nodeId:s,handleType:i,nodesConnectable:a,width:o,height:c,connectionStatus:h}=Xn(Rke,rs);return!(s&&i&&o&&a)?null:he.createElement("svg",{style:t,width:o,height:c,className:"react-flow__edges react-flow__connectionline react-flow__container"},he.createElement("g",{className:xs(["react-flow__connection",h])},he.createElement(aV,{nodeId:s,handleType:i,style:e,type:n,CustomComponent:r,connectionStatus:h})))}function fA(t,e){return b.useRef(null),Xr(),b.useMemo(()=>e(t),[t])}const lV=({nodeTypes:t,edgeTypes:e,onMove:n,onMoveStart:r,onMoveEnd:s,onInit:i,onNodeClick:a,onEdgeClick:o,onNodeDoubleClick:c,onEdgeDoubleClick:h,onNodeMouseEnter:f,onNodeMouseMove:m,onNodeMouseLeave:g,onNodeContextMenu:x,onSelectionContextMenu:y,onSelectionStart:w,onSelectionEnd:S,connectionLineType:k,connectionLineStyle:N,connectionLineComponent:C,connectionLineContainerStyle:T,selectionKeyCode:_,selectionOnDrag:E,selectionMode:M,multiSelectionKeyCode:q,panActivationKeyCode:L,zoomActivationKeyCode:I,deleteKeyCode:$,onlyRenderVisibleElements:V,elementsSelectable:ee,selectNodesOnDrag:z,defaultViewport:H,translateExtent:P,minZoom:W,maxZoom:J,preventScrolling:X,defaultMarkerColor:R,zoomOnScroll:se,zoomOnPinch:G,panOnScroll:F,panOnScrollSpeed:U,panOnScrollMode:te,zoomOnDoubleClick:ne,panOnDrag:Y,onPaneClick:ae,onPaneMouseEnter:re,onPaneMouseMove:le,onPaneMouseLeave:_e,onPaneScroll:Ge,onPaneContextMenu:tt,onEdgeContextMenu:Xe,onEdgeMouseEnter:je,onEdgeMouseMove:Qe,onEdgeMouseLeave:He,onReconnect:$e,onReconnectStart:bt,onReconnectEnd:lt,reconnectRadius:xn,noDragClassName:_n,noWheelClassName:Cn,noPanClassName:Dt,elevateEdgesOnSelect:xt,disableKeyboardA11y:Te,nodeOrigin:Re,nodeExtent:qe,rfId:rt})=>{const wt=fA(t,oke),jt=fA(e,pke);return Mke(i),he.createElement(ake,{onPaneClick:ae,onPaneMouseEnter:re,onPaneMouseMove:le,onPaneMouseLeave:_e,onPaneContextMenu:tt,onPaneScroll:Ge,deleteKeyCode:$,selectionKeyCode:_,selectionOnDrag:E,selectionMode:M,onSelectionStart:w,onSelectionEnd:S,multiSelectionKeyCode:q,panActivationKeyCode:L,zoomActivationKeyCode:I,elementsSelectable:ee,onMove:n,onMoveStart:r,onMoveEnd:s,zoomOnScroll:se,zoomOnPinch:G,zoomOnDoubleClick:ne,panOnScroll:F,panOnScrollSpeed:U,panOnScrollMode:te,panOnDrag:Y,defaultViewport:H,translateExtent:P,minZoom:W,maxZoom:J,onSelectionContextMenu:y,preventScrolling:X,noDragClassName:_n,noWheelClassName:Cn,noPanClassName:Dt,disableKeyboardA11y:Te},he.createElement(_ke,null,he.createElement(Tke,{edgeTypes:jt,onEdgeClick:o,onEdgeDoubleClick:h,onlyRenderVisibleElements:V,onEdgeContextMenu:Xe,onEdgeMouseEnter:je,onEdgeMouseMove:Qe,onEdgeMouseLeave:He,onReconnect:$e,onReconnectStart:bt,onReconnectEnd:lt,reconnectRadius:xn,defaultMarkerColor:R,noPanClassName:Dt,elevateEdgesOnSelect:!!xt,disableKeyboardA11y:Te,rfId:rt},he.createElement(Dke,{style:N,type:k,component:C,containerStyle:T})),he.createElement("div",{className:"react-flow__edgelabel-renderer"}),he.createElement(dke,{nodeTypes:wt,onNodeClick:a,onNodeDoubleClick:c,onNodeMouseEnter:f,onNodeMouseMove:m,onNodeMouseLeave:g,onNodeContextMenu:x,selectNodesOnDrag:z,onlyRenderVisibleElements:V,noPanClassName:Dt,noDragClassName:_n,disableKeyboardA11y:Te,nodeOrigin:Re,nodeExtent:qe,rfId:rt})))};lV.displayName="GraphView";var zke=b.memo(lV);const Ck=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],nc={rfId:"1",width:0,height:0,transform:[0,0,1],nodeInternals:new Map,edges:[],onNodesChange:null,onEdgesChange:null,hasDefaultNodes:!1,hasDefaultEdges:!1,d3Zoom:null,d3Selection:null,d3ZoomHandler:void 0,minZoom:.5,maxZoom:2,translateExtent:Ck,nodeExtent:Ck,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:Iu.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:[0,0],nodeDragThreshold:0,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesUpdatable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,fitViewOnInit:!1,fitViewOnInitDone:!1,fitViewOnInitOptions:void 0,onSelectionChange:[],multiSelectionActive:!1,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,connectionRadius:20,onError:cSe,isValidConnection:void 0},Pke=()=>Ywe((t,e)=>({...nc,setNodes:n=>{const{nodeInternals:r,nodeOrigin:s,elevateNodesOnSelect:i}=e();t({nodeInternals:P4(n,r,s,i)})},getNodes:()=>Array.from(e().nodeInternals.values()),setEdges:n=>{const{defaultEdgeOptions:r={}}=e();t({edges:n.map(s=>({...r,...s}))})},setDefaultNodesAndEdges:(n,r)=>{const s=typeof n<"u",i=typeof r<"u",a=s?P4(n,new Map,e().nodeOrigin,e().elevateNodesOnSelect):new Map;t({nodeInternals:a,edges:i?r:[],hasDefaultNodes:s,hasDefaultEdges:i})},updateNodeDimensions:n=>{const{onNodesChange:r,nodeInternals:s,fitViewOnInit:i,fitViewOnInitDone:a,fitViewOnInitOptions:o,domNode:c,nodeOrigin:h}=e(),f=c?.querySelector(".react-flow__viewport");if(!f)return;const m=window.getComputedStyle(f),{m22:g}=new window.DOMMatrixReadOnly(m.transform),x=n.reduce((w,S)=>{const k=s.get(S.id);if(k?.hidden)s.set(k.id,{...k,[yr]:{...k[yr],handleBounds:void 0}});else if(k){const N=pj(S.nodeElement);!!(N.width&&N.height&&(k.width!==N.width||k.height!==N.height||S.forceUpdate))&&(s.set(k.id,{...k,[yr]:{...k[yr],handleBounds:{source:aA(".source",S.nodeElement,g,h),target:aA(".target",S.nodeElement,g,h)}},...N}),w.push({id:k.id,type:"dimensions",dimensions:N}))}return w},[]);WH(s,h);const y=a||i&&!a&&GH(e,{initial:!0,...o});t({nodeInternals:new Map(s),fitViewOnInitDone:y}),x?.length>0&&r?.(x)},updateNodePositions:(n,r=!0,s=!1)=>{const{triggerNodeChanges:i}=e(),a=n.map(o=>{const c={id:o.id,type:"position",dragging:s};return r&&(c.positionAbsolute=o.positionAbsolute,c.position=o.position),c});i(a)},triggerNodeChanges:n=>{const{onNodesChange:r,nodeInternals:s,hasDefaultNodes:i,nodeOrigin:a,getNodes:o,elevateNodesOnSelect:c}=e();if(n?.length){if(i){const h=YH(n,o()),f=P4(h,s,a,c);t({nodeInternals:f})}r?.(n)}},addSelectedNodes:n=>{const{multiSelectionActive:r,edges:s,getNodes:i}=e();let a,o=null;r?a=n.map(c=>oc(c,!0)):(a=Xd(i(),n),o=Xd(s,[])),qx({changedNodes:a,changedEdges:o,get:e,set:t})},addSelectedEdges:n=>{const{multiSelectionActive:r,edges:s,getNodes:i}=e();let a,o=null;r?a=n.map(c=>oc(c,!0)):(a=Xd(s,n),o=Xd(i(),[])),qx({changedNodes:o,changedEdges:a,get:e,set:t})},unselectNodesAndEdges:({nodes:n,edges:r}={})=>{const{edges:s,getNodes:i}=e(),a=n||i(),o=r||s,c=a.map(f=>(f.selected=!1,oc(f.id,!1))),h=o.map(f=>oc(f.id,!1));qx({changedNodes:c,changedEdges:h,get:e,set:t})},setMinZoom:n=>{const{d3Zoom:r,maxZoom:s}=e();r?.scaleExtent([n,s]),t({minZoom:n})},setMaxZoom:n=>{const{d3Zoom:r,minZoom:s}=e();r?.scaleExtent([s,n]),t({maxZoom:n})},setTranslateExtent:n=>{e().d3Zoom?.translateExtent(n),t({translateExtent:n})},resetSelectedElements:()=>{const{edges:n,getNodes:r}=e(),i=r().filter(o=>o.selected).map(o=>oc(o.id,!1)),a=n.filter(o=>o.selected).map(o=>oc(o.id,!1));qx({changedNodes:i,changedEdges:a,get:e,set:t})},setNodeExtent:n=>{const{nodeInternals:r}=e();r.forEach(s=>{s.positionAbsolute=gj(s.position,n)}),t({nodeExtent:n,nodeInternals:new Map(r)})},panBy:n=>{const{transform:r,width:s,height:i,d3Zoom:a,d3Selection:o,translateExtent:c}=e();if(!a||!o||!n.x&&!n.y)return!1;const h=co.translate(r[0]+n.x,r[1]+n.y).scale(r[2]),f=[[0,0],[s,i]],m=a?.constrain()(h,f,c);return a.transform(o,m),r[0]!==m.x||r[1]!==m.y||r[2]!==m.k},cancelConnection:()=>t({connectionNodeId:nc.connectionNodeId,connectionHandleId:nc.connectionHandleId,connectionHandleType:nc.connectionHandleType,connectionStatus:nc.connectionStatus,connectionStartHandle:nc.connectionStartHandle,connectionEndHandle:nc.connectionEndHandle}),reset:()=>t({...nc})}),Object.is),oV=({children:t})=>{const e=b.useRef(null);return e.current||(e.current=Pke()),he.createElement(nSe,{value:e.current},t)};oV.displayName="ReactFlowProvider";const cV=({children:t})=>b.useContext(_y)?he.createElement(he.Fragment,null,t):he.createElement(oV,null,t);cV.displayName="ReactFlowWrapper";const Lke={input:qH,default:jk,output:$H,group:Sj},Ike={default:yv,straight:yj,step:vj,smoothstep:Ay,simplebezier:xj},Bke=[0,0],qke=[15,15],Fke={x:0,y:0,zoom:1},$ke={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},uV=b.forwardRef(({nodes:t,edges:e,defaultNodes:n,defaultEdges:r,className:s,nodeTypes:i=Lke,edgeTypes:a=Ike,onNodeClick:o,onEdgeClick:c,onInit:h,onMove:f,onMoveStart:m,onMoveEnd:g,onConnect:x,onConnectStart:y,onConnectEnd:w,onClickConnectStart:S,onClickConnectEnd:k,onNodeMouseEnter:N,onNodeMouseMove:C,onNodeMouseLeave:T,onNodeContextMenu:_,onNodeDoubleClick:E,onNodeDragStart:M,onNodeDrag:q,onNodeDragStop:L,onNodesDelete:I,onEdgesDelete:$,onSelectionChange:V,onSelectionDragStart:ee,onSelectionDrag:z,onSelectionDragStop:H,onSelectionContextMenu:P,onSelectionStart:W,onSelectionEnd:J,connectionMode:X=Iu.Strict,connectionLineType:R=uc.Bezier,connectionLineStyle:se,connectionLineComponent:G,connectionLineContainerStyle:F,deleteKeyCode:U="Backspace",selectionKeyCode:te="Shift",selectionOnDrag:ne=!1,selectionMode:Y=O0.Full,panActivationKeyCode:ae="Space",multiSelectionKeyCode:re=xv()?"Meta":"Control",zoomActivationKeyCode:le=xv()?"Meta":"Control",snapToGrid:_e=!1,snapGrid:Ge=qke,onlyRenderVisibleElements:tt=!1,selectNodesOnDrag:Xe=!0,nodesDraggable:je,nodesConnectable:Qe,nodesFocusable:He,nodeOrigin:$e=Bke,edgesFocusable:bt,edgesUpdatable:lt,elementsSelectable:xn,defaultViewport:_n=Fke,minZoom:Cn=.5,maxZoom:Dt=2,translateExtent:xt=Ck,preventScrolling:Te=!0,nodeExtent:Re,defaultMarkerColor:qe="#b1b1b7",zoomOnScroll:rt=!0,zoomOnPinch:wt=!0,panOnScroll:jt=!1,panOnScrollSpeed:Ne=.5,panOnScrollMode:ie=xu.Free,zoomOnDoubleClick:xe=!0,panOnDrag:Je=!0,onPaneClick:dt,onPaneMouseEnter:er,onPaneMouseMove:pt,onPaneMouseLeave:kn,onPaneScroll:vt,onPaneContextMenu:Gt,children:Vt,onEdgeContextMenu:ot,onEdgeDoubleClick:mr,onEdgeMouseEnter:Yr,onEdgeMouseMove:Kr,onEdgeMouseLeave:pr,onEdgeUpdate:Cr,onEdgeUpdateStart:Bs,onEdgeUpdateEnd:wr,onReconnect:hi,onReconnectStart:Cs,onReconnectEnd:qs,reconnectRadius:ma=10,edgeUpdaterRadius:pa=10,onNodesChange:fi,onEdgesChange:Pa,noDragClassName:Fs="nodrag",noWheelClassName:Fr="nowheel",noPanClassName:as="nopan",fitView:No=!1,fitViewOptions:nf,connectOnClick:qy=!0,attributionPosition:Fy,proOptions:jp,defaultEdgeOptions:Ic,elevateNodesOnSelect:rf=!0,elevateEdgesOnSelect:Co=!1,disableKeyboardA11y:wl=!1,autoPanOnConnect:Bc=!0,autoPanOnNodeDrag:To=!0,connectionRadius:Tr=20,isValidConnection:Np,onError:Cp,style:Sl,id:kl,nodeDragThreshold:$y,...Tp},Ep)=>{const sf=kl||"1";return he.createElement("div",{...Tp,style:{...Sl,...$ke},ref:Ep,className:xs(["react-flow",s]),"data-testid":"rf__wrapper",id:kl},he.createElement(cV,null,he.createElement(zke,{onInit:h,onMove:f,onMoveStart:m,onMoveEnd:g,onNodeClick:o,onEdgeClick:c,onNodeMouseEnter:N,onNodeMouseMove:C,onNodeMouseLeave:T,onNodeContextMenu:_,onNodeDoubleClick:E,nodeTypes:i,edgeTypes:a,connectionLineType:R,connectionLineStyle:se,connectionLineComponent:G,connectionLineContainerStyle:F,selectionKeyCode:te,selectionOnDrag:ne,selectionMode:Y,deleteKeyCode:U,multiSelectionKeyCode:re,panActivationKeyCode:ae,zoomActivationKeyCode:le,onlyRenderVisibleElements:tt,selectNodesOnDrag:Xe,defaultViewport:_n,translateExtent:xt,minZoom:Cn,maxZoom:Dt,preventScrolling:Te,zoomOnScroll:rt,zoomOnPinch:wt,zoomOnDoubleClick:xe,panOnScroll:jt,panOnScrollSpeed:Ne,panOnScrollMode:ie,panOnDrag:Je,onPaneClick:dt,onPaneMouseEnter:er,onPaneMouseMove:pt,onPaneMouseLeave:kn,onPaneScroll:vt,onPaneContextMenu:Gt,onSelectionContextMenu:P,onSelectionStart:W,onSelectionEnd:J,onEdgeContextMenu:ot,onEdgeDoubleClick:mr,onEdgeMouseEnter:Yr,onEdgeMouseMove:Kr,onEdgeMouseLeave:pr,onReconnect:hi??Cr,onReconnectStart:Cs??Bs,onReconnectEnd:qs??wr,reconnectRadius:ma??pa,defaultMarkerColor:qe,noDragClassName:Fs,noWheelClassName:Fr,noPanClassName:as,elevateEdgesOnSelect:Co,rfId:sf,disableKeyboardA11y:wl,nodeOrigin:$e,nodeExtent:Re}),he.createElement(ASe,{nodes:t,edges:e,defaultNodes:n,defaultEdges:r,onConnect:x,onConnectStart:y,onConnectEnd:w,onClickConnectStart:S,onClickConnectEnd:k,nodesDraggable:je,nodesConnectable:Qe,nodesFocusable:He,edgesFocusable:bt,edgesUpdatable:lt,elementsSelectable:xn,elevateNodesOnSelect:rf,minZoom:Cn,maxZoom:Dt,nodeExtent:Re,onNodesChange:fi,onEdgesChange:Pa,snapToGrid:_e,snapGrid:Ge,connectionMode:X,translateExtent:xt,connectOnClick:qy,defaultEdgeOptions:Ic,fitView:No,fitViewOptions:nf,onNodesDelete:I,onEdgesDelete:$,onNodeDragStart:M,onNodeDrag:q,onNodeDragStop:L,onSelectionDrag:z,onSelectionDragStart:ee,onSelectionDragStop:H,noPanClassName:as,nodeOrigin:$e,rfId:sf,autoPanOnConnect:Bc,autoPanOnNodeDrag:To,onError:Cp,connectionRadius:Tr,isValidConnection:Np,nodeDragThreshold:$y}),he.createElement(_Se,{onSelectionChange:V}),Vt,he.createElement(sSe,{proOptions:jp,position:Fy}),he.createElement(LSe,{rfId:sf,disableKeyboardA11y:wl})))});uV.displayName="ReactFlow";function dV(t){return e=>{const[n,r]=b.useState(e),s=b.useCallback(i=>r(a=>t(i,a)),[]);return[n,r,s]}}const Qke=dV(YH),Hke=dV(KSe),hV=({id:t,x:e,y:n,width:r,height:s,style:i,color:a,strokeColor:o,strokeWidth:c,className:h,borderRadius:f,shapeRendering:m,onClick:g,selected:x})=>{const{background:y,backgroundColor:w}=i||{},S=a||y||w;return he.createElement("rect",{className:xs(["react-flow__minimap-node",{selected:x},h]),x:e,y:n,rx:f,ry:f,width:r,height:s,fill:S,stroke:o,strokeWidth:c,shapeRendering:m,onClick:g?k=>g(k,t):void 0})};hV.displayName="MiniMapNode";var Vke=b.memo(hV);const Uke=t=>t.nodeOrigin,Wke=t=>t.getNodes().filter(e=>!e.hidden&&e.width&&e.height),q4=t=>t instanceof Function?t:()=>t;function Gke({nodeStrokeColor:t="transparent",nodeColor:e="#e2e2e2",nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:s=2,nodeComponent:i=Vke,onClick:a}){const o=Xn(Wke,rs),c=Xn(Uke),h=q4(e),f=q4(t),m=q4(n),g=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return he.createElement(he.Fragment,null,o.map(x=>{const{x:y,y:w}=Ou(x,c).positionAbsolute;return he.createElement(i,{key:x.id,x:y,y:w,width:x.width,height:x.height,style:x.style,selected:x.selected,className:m(x),color:h(x),borderRadius:r,strokeColor:f(x),strokeWidth:s,shapeRendering:g,onClick:a,id:x.id})}))}var Xke=b.memo(Gke);const Yke=200,Kke=150,Zke=t=>{const e=t.getNodes(),n={x:-t.transform[0]/t.transform[2],y:-t.transform[1]/t.transform[2],width:t.width/t.transform[2],height:t.height/t.transform[2]};return{viewBB:n,boundingRect:e.length>0?lSe(Ry(e,t.nodeOrigin),n):n,rfId:t.rfId}},Jke="react-flow__minimap-desc";function fV({style:t,className:e,nodeStrokeColor:n="transparent",nodeColor:r="#e2e2e2",nodeClassName:s="",nodeBorderRadius:i=5,nodeStrokeWidth:a=2,nodeComponent:o,maskColor:c="rgb(240, 240, 240, 0.6)",maskStrokeColor:h="none",maskStrokeWidth:f=1,position:m="bottom-right",onClick:g,onNodeClick:x,pannable:y=!1,zoomable:w=!1,ariaLabel:S="React Flow mini map",inversePan:k=!1,zoomStep:N=10,offsetScale:C=5}){const T=Xr(),_=b.useRef(null),{boundingRect:E,viewBB:M,rfId:q}=Xn(Zke,rs),L=t?.width??Yke,I=t?.height??Kke,$=E.width/L,V=E.height/I,ee=Math.max($,V),z=ee*L,H=ee*I,P=C*ee,W=E.x-(z-E.width)/2-P,J=E.y-(H-E.height)/2-P,X=z+P*2,R=H+P*2,se=`${Jke}-${q}`,G=b.useRef(0);G.current=ee,b.useEffect(()=>{if(_.current){const te=Yi(_.current),ne=re=>{const{transform:le,d3Selection:_e,d3Zoom:Ge}=T.getState();if(re.sourceEvent.type!=="wheel"||!_e||!Ge)return;const tt=-re.sourceEvent.deltaY*(re.sourceEvent.deltaMode===1?.05:re.sourceEvent.deltaMode?1:.002)*N,Xe=le[2]*Math.pow(2,tt);Ge.scaleTo(_e,Xe)},Y=re=>{const{transform:le,d3Selection:_e,d3Zoom:Ge,translateExtent:tt,width:Xe,height:je}=T.getState();if(re.sourceEvent.type!=="mousemove"||!_e||!Ge)return;const Qe=G.current*Math.max(1,le[2])*(k?-1:1),He={x:le[0]-re.sourceEvent.movementX*Qe,y:le[1]-re.sourceEvent.movementY*Qe},$e=[[0,0],[Xe,je]],bt=co.translate(He.x,He.y).scale(le[2]),lt=Ge.constrain()(bt,$e,tt);Ge.transform(_e,lt)},ae=vH().on("zoom",y?Y:null).on("zoom.wheel",w?ne:null);return te.call(ae),()=>{te.on("zoom",null)}}},[y,w,k,N]);const F=g?te=>{const ne=Sa(te);g(te,{x:ne[0],y:ne[1]})}:void 0,U=x?(te,ne)=>{const Y=T.getState().nodeInternals.get(ne);x(te,Y)}:void 0;return he.createElement(My,{position:m,style:t,className:xs(["react-flow__minimap",e]),"data-testid":"rf__minimap"},he.createElement("svg",{width:L,height:I,viewBox:`${W} ${J} ${X} ${R}`,role:"img","aria-labelledby":se,ref:_,onClick:F},S&&he.createElement("title",{id:se},S),he.createElement(Xke,{onClick:U,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:s,nodeStrokeWidth:a,nodeComponent:o}),he.createElement("path",{className:"react-flow__minimap-mask",d:`M${W-P},${J-P}h${X+P*2}v${R+P*2}h${-X-P*2}z - M${M.x},${M.y}h${M.width}v${M.height}h${-M.width}z`,fill:c,fillRule:"evenodd",stroke:h,strokeWidth:f,pointerEvents:"none"})))}fV.displayName="MiniMap";var e6e=b.memo(fV);function t6e(){return he.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},he.createElement("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"}))}function n6e(){return he.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},he.createElement("path",{d:"M0 0h32v4.2H0z"}))}function r6e(){return he.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},he.createElement("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"}))}function s6e(){return he.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},he.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"}))}function i6e(){return he.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},he.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"}))}const wm=({children:t,className:e,...n})=>he.createElement("button",{type:"button",className:xs(["react-flow__controls-button",e]),...n},t);wm.displayName="ControlButton";const a6e=t=>({isInteractive:t.nodesDraggable||t.nodesConnectable||t.elementsSelectable,minZoomReached:t.transform[2]<=t.minZoom,maxZoomReached:t.transform[2]>=t.maxZoom}),mV=({style:t,showZoom:e=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:s,onZoomIn:i,onZoomOut:a,onFitView:o,onInteractiveChange:c,className:h,children:f,position:m="bottom-left"})=>{const g=Xr(),[x,y]=b.useState(!1),{isInteractive:w,minZoomReached:S,maxZoomReached:k}=Xn(a6e,rs),{zoomIn:N,zoomOut:C,fitView:T}=kj();if(b.useEffect(()=>{y(!0)},[]),!x)return null;const _=()=>{N(),i?.()},E=()=>{C(),a?.()},M=()=>{T(s),o?.()},q=()=>{g.setState({nodesDraggable:!w,nodesConnectable:!w,elementsSelectable:!w}),c?.(!w)};return he.createElement(My,{className:xs(["react-flow__controls",h]),position:m,style:t,"data-testid":"rf__controls"},e&&he.createElement(he.Fragment,null,he.createElement(wm,{onClick:_,className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:k},he.createElement(t6e,null)),he.createElement(wm,{onClick:E,className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:S},he.createElement(n6e,null))),n&&he.createElement(wm,{className:"react-flow__controls-fitview",onClick:M,title:"fit view","aria-label":"fit view"},he.createElement(r6e,null)),r&&he.createElement(wm,{className:"react-flow__controls-interactive",onClick:q,title:"toggle interactivity","aria-label":"toggle interactivity"},w?he.createElement(i6e,null):he.createElement(s6e,null)),f)};mV.displayName="Controls";var l6e=b.memo(mV),sa;(function(t){t.Lines="lines",t.Dots="dots",t.Cross="cross"})(sa||(sa={}));function o6e({color:t,dimensions:e,lineWidth:n}){return he.createElement("path",{stroke:t,strokeWidth:n,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`})}function c6e({color:t,radius:e}){return he.createElement("circle",{cx:e,cy:e,r:e,fill:t})}const u6e={[sa.Dots]:"#91919a",[sa.Lines]:"#eee",[sa.Cross]:"#e2e2e2"},d6e={[sa.Dots]:1,[sa.Lines]:1,[sa.Cross]:6},h6e=t=>({transform:t.transform,patternId:`pattern-${t.rfId}`});function pV({id:t,variant:e=sa.Dots,gap:n=20,size:r,lineWidth:s=1,offset:i=2,color:a,style:o,className:c}){const h=b.useRef(null),{transform:f,patternId:m}=Xn(h6e,rs),g=a||u6e[e],x=r||d6e[e],y=e===sa.Dots,w=e===sa.Cross,S=Array.isArray(n)?n:[n,n],k=[S[0]*f[2]||1,S[1]*f[2]||1],N=x*f[2],C=w?[N,N]:k,T=y?[N/i,N/i]:[C[0]/i,C[1]/i];return he.createElement("svg",{className:xs(["react-flow__background",c]),style:{...o,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:h,"data-testid":"rf__background"},he.createElement("pattern",{id:m+t,x:f[0]%k[0],y:f[1]%k[1],width:k[0],height:k[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${T[0]},-${T[1]})`},y?he.createElement(c6e,{color:g,radius:N/i}):he.createElement(o6e,{dimensions:C,color:g,lineWidth:s})),he.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${m+t})`}))}pV.displayName="Background";var f6e=b.memo(pV);function jj(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var F4,mA;function m6e(){if(mA)return F4;mA=1;var t=kD(),e=4;function n(r){return t(r,e)}return F4=n,F4}var $4,pA;function gV(){if(pA)return $4;pA=1;var t=EY();function e(n){return typeof n=="function"?n:t}return $4=e,$4}var Q4,gA;function xV(){if(gA)return Q4;gA=1;var t=OD(),e=Pk(),n=gV(),r=Bu();function s(i,a){var o=r(i)?t:e;return o(i,n(a))}return Q4=s,Q4}var H4,xA;function vV(){return xA||(xA=1,H4=xV()),H4}var V4,vA;function p6e(){if(vA)return V4;vA=1;var t=Pk();function e(n,r){var s=[];return t(n,function(i,a,o){r(i,a,o)&&s.push(i)}),s}return V4=e,V4}var U4,yA;function yV(){if(yA)return U4;yA=1;var t=_Y(),e=p6e(),n=Lk(),r=Bu();function s(i,a){var o=r(i)?t:e;return o(i,n(a,3))}return U4=s,U4}var W4,bA;function g6e(){if(bA)return W4;bA=1;var t=Object.prototype,e=t.hasOwnProperty;function n(r,s){return r!=null&&e.call(r,s)}return W4=n,W4}var G4,wA;function bV(){if(wA)return G4;wA=1;var t=g6e(),e=MY();function n(r,s){return r!=null&&e(r,s,t)}return G4=n,G4}var X4,SA;function x6e(){if(SA)return X4;SA=1;var t=jD(),e=ND(),n=CD(),r=Bu(),s=Ik(),i=Bk(),a=AY(),o=qk(),c="[object Map]",h="[object Set]",f=Object.prototype,m=f.hasOwnProperty;function g(x){if(x==null)return!0;if(s(x)&&(r(x)||typeof x=="string"||typeof x.splice=="function"||i(x)||o(x)||n(x)))return!x.length;var y=e(x);if(y==c||y==h)return!x.size;if(a(x))return!t(x).length;for(var w in x)if(m.call(x,w))return!1;return!0}return X4=g,X4}var Y4,kA;function wV(){if(kA)return Y4;kA=1;function t(e){return e===void 0}return Y4=t,Y4}var K4,OA;function v6e(){if(OA)return K4;OA=1;function t(e,n,r,s){var i=-1,a=e==null?0:e.length;for(s&&a&&(r=e[++i]);++i1?x.setNode(y,m):x.setNode(y)}),this},s.prototype.setNode=function(f,m){return t.has(this._nodes,f)?(arguments.length>1&&(this._nodes[f]=m),this):(this._nodes[f]=arguments.length>1?m:this._defaultNodeLabelFn(f),this._isCompound&&(this._parent[f]=n,this._children[f]={},this._children[n][f]=!0),this._in[f]={},this._preds[f]={},this._out[f]={},this._sucs[f]={},++this._nodeCount,this)},s.prototype.node=function(f){return this._nodes[f]},s.prototype.hasNode=function(f){return t.has(this._nodes,f)},s.prototype.removeNode=function(f){var m=this;if(t.has(this._nodes,f)){var g=function(x){m.removeEdge(m._edgeObjs[x])};delete this._nodes[f],this._isCompound&&(this._removeFromParentsChildList(f),delete this._parent[f],t.each(this.children(f),function(x){m.setParent(x)}),delete this._children[f]),t.each(t.keys(this._in[f]),g),delete this._in[f],delete this._preds[f],t.each(t.keys(this._out[f]),g),delete this._out[f],delete this._sucs[f],--this._nodeCount}return this},s.prototype.setParent=function(f,m){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(t.isUndefined(m))m=n;else{m+="";for(var g=m;!t.isUndefined(g);g=this.parent(g))if(g===f)throw new Error("Setting "+m+" as parent of "+f+" would create a cycle");this.setNode(m)}return this.setNode(f),this._removeFromParentsChildList(f),this._parent[f]=m,this._children[m][f]=!0,this},s.prototype._removeFromParentsChildList=function(f){delete this._children[this._parent[f]][f]},s.prototype.parent=function(f){if(this._isCompound){var m=this._parent[f];if(m!==n)return m}},s.prototype.children=function(f){if(t.isUndefined(f)&&(f=n),this._isCompound){var m=this._children[f];if(m)return t.keys(m)}else{if(f===n)return this.nodes();if(this.hasNode(f))return[]}},s.prototype.predecessors=function(f){var m=this._preds[f];if(m)return t.keys(m)},s.prototype.successors=function(f){var m=this._sucs[f];if(m)return t.keys(m)},s.prototype.neighbors=function(f){var m=this.predecessors(f);if(m)return t.union(m,this.successors(f))},s.prototype.isLeaf=function(f){var m;return this.isDirected()?m=this.successors(f):m=this.neighbors(f),m.length===0},s.prototype.filterNodes=function(f){var m=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});m.setGraph(this.graph());var g=this;t.each(this._nodes,function(w,S){f(S)&&m.setNode(S,w)}),t.each(this._edgeObjs,function(w){m.hasNode(w.v)&&m.hasNode(w.w)&&m.setEdge(w,g.edge(w))});var x={};function y(w){var S=g.parent(w);return S===void 0||m.hasNode(S)?(x[w]=S,S):S in x?x[S]:y(S)}return this._isCompound&&t.each(m.nodes(),function(w){m.setParent(w,y(w))}),m},s.prototype.setDefaultEdgeLabel=function(f){return t.isFunction(f)||(f=t.constant(f)),this._defaultEdgeLabelFn=f,this},s.prototype.edgeCount=function(){return this._edgeCount},s.prototype.edges=function(){return t.values(this._edgeObjs)},s.prototype.setPath=function(f,m){var g=this,x=arguments;return t.reduce(f,function(y,w){return x.length>1?g.setEdge(y,w,m):g.setEdge(y,w),w}),this},s.prototype.setEdge=function(){var f,m,g,x,y=!1,w=arguments[0];typeof w=="object"&&w!==null&&"v"in w?(f=w.v,m=w.w,g=w.name,arguments.length===2&&(x=arguments[1],y=!0)):(f=w,m=arguments[1],g=arguments[3],arguments.length>2&&(x=arguments[2],y=!0)),f=""+f,m=""+m,t.isUndefined(g)||(g=""+g);var S=o(this._isDirected,f,m,g);if(t.has(this._edgeLabels,S))return y&&(this._edgeLabels[S]=x),this;if(!t.isUndefined(g)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(f),this.setNode(m),this._edgeLabels[S]=y?x:this._defaultEdgeLabelFn(f,m,g);var k=c(this._isDirected,f,m,g);return f=k.v,m=k.w,Object.freeze(k),this._edgeObjs[S]=k,i(this._preds[m],f),i(this._sucs[f],m),this._in[m][S]=k,this._out[f][S]=k,this._edgeCount++,this},s.prototype.edge=function(f,m,g){var x=arguments.length===1?h(this._isDirected,arguments[0]):o(this._isDirected,f,m,g);return this._edgeLabels[x]},s.prototype.hasEdge=function(f,m,g){var x=arguments.length===1?h(this._isDirected,arguments[0]):o(this._isDirected,f,m,g);return t.has(this._edgeLabels,x)},s.prototype.removeEdge=function(f,m,g){var x=arguments.length===1?h(this._isDirected,arguments[0]):o(this._isDirected,f,m,g),y=this._edgeObjs[x];return y&&(f=y.v,m=y.w,delete this._edgeLabels[x],delete this._edgeObjs[x],a(this._preds[m],f),a(this._sucs[f],m),delete this._in[m][x],delete this._out[f][x],this._edgeCount--),this},s.prototype.inEdges=function(f,m){var g=this._in[f];if(g){var x=t.values(g);return m?t.filter(x,function(y){return y.v===m}):x}},s.prototype.outEdges=function(f,m){var g=this._out[f];if(g){var x=t.values(g);return m?t.filter(x,function(y){return y.w===m}):x}},s.prototype.nodeEdges=function(f,m){var g=this.inEdges(f,m);if(g)return g.concat(this.outEdges(f,m))};function i(f,m){f[m]?f[m]++:f[m]=1}function a(f,m){--f[m]||delete f[m]}function o(f,m,g,x){var y=""+m,w=""+g;if(!f&&y>w){var S=y;y=w,w=S}return y+r+w+r+(t.isUndefined(x)?e:x)}function c(f,m,g,x){var y=""+m,w=""+g;if(!f&&y>w){var S=y;y=w,w=S}var k={v:y,w};return x&&(k.name=x),k}function h(f,m){return o(f,m.v,m.w,m.name)}return u5}var d5,IA;function C6e(){return IA||(IA=1,d5="2.1.8"),d5}var h5,BA;function T6e(){return BA||(BA=1,h5={Graph:Nj(),version:C6e()}),h5}var f5,qA;function E6e(){if(qA)return f5;qA=1;var t=fa(),e=Nj();f5={write:n,read:i};function n(a){var o={options:{directed:a.isDirected(),multigraph:a.isMultigraph(),compound:a.isCompound()},nodes:r(a),edges:s(a)};return t.isUndefined(a.graph())||(o.value=t.clone(a.graph())),o}function r(a){return t.map(a.nodes(),function(o){var c=a.node(o),h=a.parent(o),f={v:o};return t.isUndefined(c)||(f.value=c),t.isUndefined(h)||(f.parent=h),f})}function s(a){return t.map(a.edges(),function(o){var c=a.edge(o),h={v:o.v,w:o.w};return t.isUndefined(o.name)||(h.name=o.name),t.isUndefined(c)||(h.value=c),h})}function i(a){var o=new e(a.options).setGraph(a.value);return t.each(a.nodes,function(c){o.setNode(c.v,c.value),c.parent&&o.setParent(c.v,c.parent)}),t.each(a.edges,function(c){o.setEdge({v:c.v,w:c.w,name:c.name},c.value)}),o}return f5}var m5,FA;function _6e(){if(FA)return m5;FA=1;var t=fa();m5=e;function e(n){var r={},s=[],i;function a(o){t.has(r,o)||(r[o]=!0,i.push(o),t.each(n.successors(o),a),t.each(n.predecessors(o),a))}return t.each(n.nodes(),function(o){i=[],a(o),i.length&&s.push(i)}),s}return m5}var p5,$A;function jV(){if($A)return p5;$A=1;var t=fa();p5=e;function e(){this._arr=[],this._keyIndices={}}return e.prototype.size=function(){return this._arr.length},e.prototype.keys=function(){return this._arr.map(function(n){return n.key})},e.prototype.has=function(n){return t.has(this._keyIndices,n)},e.prototype.priority=function(n){var r=this._keyIndices[n];if(r!==void 0)return this._arr[r].priority},e.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},e.prototype.add=function(n,r){var s=this._keyIndices;if(n=String(n),!t.has(s,n)){var i=this._arr,a=i.length;return s[n]=a,i.push({key:n,priority:r}),this._decrease(a),!0}return!1},e.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var n=this._arr.pop();return delete this._keyIndices[n.key],this._heapify(0),n.key},e.prototype.decrease=function(n,r){var s=this._keyIndices[n];if(r>this._arr[s].priority)throw new Error("New priority is greater than current priority. Key: "+n+" Old: "+this._arr[s].priority+" New: "+r);this._arr[s].priority=r,this._decrease(s)},e.prototype._heapify=function(n){var r=this._arr,s=2*n,i=s+1,a=n;s>1,!(r[i].priority0&&(m=f.removeMin(),g=h[m],g.distance!==Number.POSITIVE_INFINITY);)c(m).forEach(x);return h}return g5}var x5,HA;function M6e(){if(HA)return x5;HA=1;var t=NV(),e=fa();x5=n;function n(r,s,i){return e.transform(r.nodes(),function(a,o){a[o]=t(r,o,s,i)},{})}return x5}var v5,VA;function CV(){if(VA)return v5;VA=1;var t=fa();v5=e;function e(n){var r=0,s=[],i={},a=[];function o(c){var h=i[c]={onStack:!0,lowlink:r,index:r++};if(s.push(c),n.successors(c).forEach(function(g){t.has(i,g)?i[g].onStack&&(h.lowlink=Math.min(h.lowlink,i[g].index)):(o(g),h.lowlink=Math.min(h.lowlink,i[g].lowlink))}),h.lowlink===h.index){var f=[],m;do m=s.pop(),i[m].onStack=!1,f.push(m);while(c!==m);a.push(f)}}return n.nodes().forEach(function(c){t.has(i,c)||o(c)}),a}return v5}var y5,UA;function A6e(){if(UA)return y5;UA=1;var t=fa(),e=CV();y5=n;function n(r){return t.filter(e(r),function(s){return s.length>1||s.length===1&&r.hasEdge(s[0],s[0])})}return y5}var b5,WA;function R6e(){if(WA)return b5;WA=1;var t=fa();b5=n;var e=t.constant(1);function n(s,i,a){return r(s,i||e,a||function(o){return s.outEdges(o)})}function r(s,i,a){var o={},c=s.nodes();return c.forEach(function(h){o[h]={},o[h][h]={distance:0},c.forEach(function(f){h!==f&&(o[h][f]={distance:Number.POSITIVE_INFINITY})}),a(h).forEach(function(f){var m=f.v===h?f.w:f.v,g=i(f);o[h][m]={distance:g,predecessor:h}})}),c.forEach(function(h){var f=o[h];c.forEach(function(m){var g=o[m];c.forEach(function(x){var y=g[h],w=f[x],S=g[x],k=y.distance+w.distance;k0;){if(h=c.removeMin(),t.has(o,h))a.setEdge(h,o[h]);else{if(m)throw new Error("Input graph is not connected: "+s);m=!0}s.nodeEdges(h).forEach(f)}return a}return N5}var C5,eR;function I6e(){return eR||(eR=1,C5={components:_6e(),dijkstra:NV(),dijkstraAll:M6e(),findCycles:A6e(),floydWarshall:R6e(),isAcyclic:D6e(),postorder:z6e(),preorder:P6e(),prim:L6e(),tarjan:CV(),topsort:TV()}),C5}var T5,tR;function B6e(){if(tR)return T5;tR=1;var t=T6e();return T5={Graph:t.Graph,json:E6e(),alg:I6e(),version:t.version},T5}var E5,nR;function _a(){if(nR)return E5;nR=1;var t;if(typeof jj=="function")try{t=B6e()}catch{}return t||(t=window.graphlib),E5=t,E5}var _5,rR;function q6e(){if(rR)return _5;rR=1;var t=kD(),e=1,n=4;function r(s){return t(s,e|n)}return _5=r,_5}var M5,sR;function F6e(){if(sR)return M5;sR=1;var t=$k(),e=AD(),n=MD(),r=Ov(),s=Object.prototype,i=s.hasOwnProperty,a=t(function(o,c){o=Object(o);var h=-1,f=c.length,m=f>2?c[2]:void 0;for(m&&n(c[0],c[1],m)&&(f=1);++h1?i[o-1]:void 0,h=o>2?i[2]:void 0;for(c=r.length>3&&typeof c=="function"?(o--,c):void 0,h&&e(i[0],i[1],h)&&(c=o<3?void 0:c,o=1),s=Object(s);++a0;--S)if(w=f[S].dequeue(),w){g=g.concat(a(h,f,m,w,!0));break}}}return g}function a(h,f,m,g,x){var y=x?[]:void 0;return t.forEach(h.inEdges(g.v),function(w){var S=h.edge(w),k=h.node(w.v);x&&y.push({v:w.v,w:w.w}),k.out-=S,c(f,m,k)}),t.forEach(h.outEdges(g.v),function(w){var S=h.edge(w),k=w.w,N=h.node(k);N.in-=S,c(f,m,N)}),h.removeNode(g.v),y}function o(h,f){var m=new e,g=0,x=0;t.forEach(h.nodes(),function(S){m.setNode(S,{v:S,in:0,out:0})}),t.forEach(h.edges(),function(S){var k=m.edge(S.v,S.w)||0,N=f(S),C=k+N;m.setEdge(S.v,S.w,C),x=Math.max(x,m.node(S.v).out+=N),g=Math.max(g,m.node(S.w).in+=N)});var y=t.range(x+g+3).map(function(){return new n}),w=g+1;return t.forEach(m.nodes(),function(S){c(y,w,m.node(S))}),{graph:m,buckets:y,zeroIdx:w}}function c(h,f,m){m.out?m.in?h[m.out-m.in+f].enqueue(m):h[h.length-1].enqueue(m):h[0].enqueue(m)}return X5}var Y5,kR;function rOe(){if(kR)return Y5;kR=1;var t=lr(),e=nOe();Y5={run:n,undo:s};function n(i){var a=i.graph().acyclicer==="greedy"?e(i,o(i)):r(i);t.forEach(a,function(c){var h=i.edge(c);i.removeEdge(c),h.forwardName=c.name,h.reversed=!0,i.setEdge(c.w,c.v,h,t.uniqueId("rev"))});function o(c){return function(h){return c.edge(h).weight}}}function r(i){var a=[],o={},c={};function h(f){t.has(c,f)||(c[f]=!0,o[f]=!0,t.forEach(i.outEdges(f),function(m){t.has(o,m.w)?a.push(m):h(m.w)}),delete o[f])}return t.forEach(i.nodes(),h),a}function s(i){t.forEach(i.edges(),function(a){var o=i.edge(a);if(o.reversed){i.removeEdge(a);var c=o.forwardName;delete o.reversed,delete o.forwardName,i.setEdge(a.w,a.v,o,c)}})}return Y5}var K5,OR;function ai(){if(OR)return K5;OR=1;var t=lr(),e=_a().Graph;K5={addDummyNode:n,simplify:r,asNonCompoundGraph:s,successorWeights:i,predecessorWeights:a,intersectRect:o,buildLayerMatrix:c,normalizeRanks:h,removeEmptyRanks:f,addBorderNode:m,maxRank:g,partition:x,time:y,notime:w};function n(S,k,N,C){var T;do T=t.uniqueId(C);while(S.hasNode(T));return N.dummy=k,S.setNode(T,N),T}function r(S){var k=new e().setGraph(S.graph());return t.forEach(S.nodes(),function(N){k.setNode(N,S.node(N))}),t.forEach(S.edges(),function(N){var C=k.edge(N.v,N.w)||{weight:0,minlen:1},T=S.edge(N);k.setEdge(N.v,N.w,{weight:C.weight+T.weight,minlen:Math.max(C.minlen,T.minlen)})}),k}function s(S){var k=new e({multigraph:S.isMultigraph()}).setGraph(S.graph());return t.forEach(S.nodes(),function(N){S.children(N).length||k.setNode(N,S.node(N))}),t.forEach(S.edges(),function(N){k.setEdge(N,S.edge(N))}),k}function i(S){var k=t.map(S.nodes(),function(N){var C={};return t.forEach(S.outEdges(N),function(T){C[T.w]=(C[T.w]||0)+S.edge(T).weight}),C});return t.zipObject(S.nodes(),k)}function a(S){var k=t.map(S.nodes(),function(N){var C={};return t.forEach(S.inEdges(N),function(T){C[T.v]=(C[T.v]||0)+S.edge(T).weight}),C});return t.zipObject(S.nodes(),k)}function o(S,k){var N=S.x,C=S.y,T=k.x-N,_=k.y-C,E=S.width/2,M=S.height/2;if(!T&&!_)throw new Error("Not possible to find intersection inside of the rectangle");var q,L;return Math.abs(_)*E>Math.abs(T)*M?(_<0&&(M=-M),q=M*T/_,L=M):(T<0&&(E=-E),q=E,L=E*_/T),{x:N+q,y:C+L}}function c(S){var k=t.map(t.range(g(S)+1),function(){return[]});return t.forEach(S.nodes(),function(N){var C=S.node(N),T=C.rank;t.isUndefined(T)||(k[T][C.order]=N)}),k}function h(S){var k=t.min(t.map(S.nodes(),function(N){return S.node(N).rank}));t.forEach(S.nodes(),function(N){var C=S.node(N);t.has(C,"rank")&&(C.rank-=k)})}function f(S){var k=t.min(t.map(S.nodes(),function(_){return S.node(_).rank})),N=[];t.forEach(S.nodes(),function(_){var E=S.node(_).rank-k;N[E]||(N[E]=[]),N[E].push(_)});var C=0,T=S.graph().nodeRankFactor;t.forEach(N,function(_,E){t.isUndefined(_)&&E%T!==0?--C:C&&t.forEach(_,function(M){S.node(M).rank+=C})})}function m(S,k,N,C){var T={width:0,height:0};return arguments.length>=4&&(T.rank=N,T.order=C),n(S,"border",T,k)}function g(S){return t.max(t.map(S.nodes(),function(k){var N=S.node(k).rank;if(!t.isUndefined(N))return N}))}function x(S,k){var N={lhs:[],rhs:[]};return t.forEach(S,function(C){k(C)?N.lhs.push(C):N.rhs.push(C)}),N}function y(S,k){var N=t.now();try{return k()}finally{console.log(S+" time: "+(t.now()-N)+"ms")}}function w(S,k){return k()}return K5}var Z5,jR;function sOe(){if(jR)return Z5;jR=1;var t=lr(),e=ai();Z5={run:n,undo:s};function n(i){i.graph().dummyChains=[],t.forEach(i.edges(),function(a){r(i,a)})}function r(i,a){var o=a.v,c=i.node(o).rank,h=a.w,f=i.node(h).rank,m=a.name,g=i.edge(a),x=g.labelRank;if(f!==c+1){i.removeEdge(a);var y,w,S;for(S=0,++c;cL.lim&&(I=L,$=!0);var V=t.filter(T.edges(),function(ee){return $===N(C,C.node(ee.v),I)&&$!==N(C,C.node(ee.w),I)});return t.minBy(V,function(ee){return n(T,ee)})}function w(C,T,_,E){var M=_.v,q=_.w;C.removeEdge(M,q),C.setEdge(E.v,E.w,{}),m(C),c(C,T),S(C,T)}function S(C,T){var _=t.find(C.nodes(),function(M){return!T.node(M).parent}),E=s(C,_);E=E.slice(1),t.forEach(E,function(M){var q=C.node(M).parent,L=T.edge(M,q),I=!1;L||(L=T.edge(q,M),I=!0),T.node(M).rank=T.node(q).rank+(I?L.minlen:-L.minlen)})}function k(C,T,_){return C.hasEdge(T,_)}function N(C,T,_){return _.low<=T.lim&&T.lim<=_.lim}return t3}var n3,ER;function aOe(){if(ER)return n3;ER=1;var t=bv(),e=t.longestPath,n=AV(),r=iOe();n3=s;function s(c){switch(c.graph().ranker){case"network-simplex":o(c);break;case"tight-tree":a(c);break;case"longest-path":i(c);break;default:o(c)}}var i=e;function a(c){e(c),n(c)}function o(c){r(c)}return n3}var r3,_R;function lOe(){if(_R)return r3;_R=1;var t=lr();r3=e;function e(s){var i=r(s);t.forEach(s.graph().dummyChains,function(a){for(var o=s.node(a),c=o.edgeObj,h=n(s,i,c.v,c.w),f=h.path,m=h.lca,g=0,x=f[g],y=!0;a!==c.w;){if(o=s.node(a),y){for(;(x=f[g])!==m&&s.node(x).maxRankf||m>i[g].lim));for(x=g,g=o;(g=s.parent(g))!==x;)h.push(g);return{path:c.concat(h.reverse()),lca:x}}function r(s){var i={},a=0;function o(c){var h=a;t.forEach(s.children(c),o),i[c]={low:h,lim:a++}}return t.forEach(s.children(),o),i}return r3}var s3,MR;function oOe(){if(MR)return s3;MR=1;var t=lr(),e=ai();s3={run:n,cleanup:a};function n(o){var c=e.addDummyNode(o,"root",{},"_root"),h=s(o),f=t.max(t.values(h))-1,m=2*f+1;o.graph().nestingRoot=c,t.forEach(o.edges(),function(x){o.edge(x).minlen*=m});var g=i(o)+1;t.forEach(o.children(),function(x){r(o,c,m,g,f,h,x)}),o.graph().nodeRankFactor=m}function r(o,c,h,f,m,g,x){var y=o.children(x);if(!y.length){x!==c&&o.setEdge(c,x,{weight:0,minlen:h});return}var w=e.addBorderNode(o,"_bt"),S=e.addBorderNode(o,"_bb"),k=o.node(x);o.setParent(w,x),k.borderTop=w,o.setParent(S,x),k.borderBottom=S,t.forEach(y,function(N){r(o,c,h,f,m,g,N);var C=o.node(N),T=C.borderTop?C.borderTop:N,_=C.borderBottom?C.borderBottom:N,E=C.borderTop?f:2*f,M=T!==_?1:m-g[x]+1;o.setEdge(w,T,{weight:E,minlen:M,nestingEdge:!0}),o.setEdge(_,S,{weight:E,minlen:M,nestingEdge:!0})}),o.parent(x)||o.setEdge(c,w,{weight:0,minlen:m+g[x]})}function s(o){var c={};function h(f,m){var g=o.children(f);g&&g.length&&t.forEach(g,function(x){h(x,m+1)}),c[f]=m}return t.forEach(o.children(),function(f){h(f,1)}),c}function i(o){return t.reduce(o.edges(),function(c,h){return c+o.edge(h).weight},0)}function a(o){var c=o.graph();o.removeNode(c.nestingRoot),delete c.nestingRoot,t.forEach(o.edges(),function(h){var f=o.edge(h);f.nestingEdge&&o.removeEdge(h)})}return s3}var i3,AR;function cOe(){if(AR)return i3;AR=1;var t=lr(),e=ai();i3=n;function n(s){function i(a){var o=s.children(a),c=s.node(a);if(o.length&&t.forEach(o,i),t.has(c,"minRank")){c.borderLeft=[],c.borderRight=[];for(var h=c.minRank,f=c.maxRank+1;h0;)x%2&&(y+=f[x+1]),x=x-1>>1,f[x]+=g.weight;m+=g.weight*y})),m}return o3}var c3,PR;function fOe(){if(PR)return c3;PR=1;var t=lr();c3=e;function e(n,r){return t.map(r,function(s){var i=n.inEdges(s);if(i.length){var a=t.reduce(i,function(o,c){var h=n.edge(c),f=n.node(c.v);return{sum:o.sum+h.weight*f.order,weight:o.weight+h.weight}},{sum:0,weight:0});return{v:s,barycenter:a.sum/a.weight,weight:a.weight}}else return{v:s}})}return c3}var u3,LR;function mOe(){if(LR)return u3;LR=1;var t=lr();u3=e;function e(s,i){var a={};t.forEach(s,function(c,h){var f=a[c.v]={indegree:0,in:[],out:[],vs:[c.v],i:h};t.isUndefined(c.barycenter)||(f.barycenter=c.barycenter,f.weight=c.weight)}),t.forEach(i.edges(),function(c){var h=a[c.v],f=a[c.w];!t.isUndefined(h)&&!t.isUndefined(f)&&(f.indegree++,h.out.push(a[c.w]))});var o=t.filter(a,function(c){return!c.indegree});return n(o)}function n(s){var i=[];function a(h){return function(f){f.merged||(t.isUndefined(f.barycenter)||t.isUndefined(h.barycenter)||f.barycenter>=h.barycenter)&&r(h,f)}}function o(h){return function(f){f.in.push(h),--f.indegree===0&&s.push(f)}}for(;s.length;){var c=s.pop();i.push(c),t.forEach(c.in.reverse(),a(c)),t.forEach(c.out,o(c))}return t.map(t.filter(i,function(h){return!h.merged}),function(h){return t.pick(h,["vs","i","barycenter","weight"])})}function r(s,i){var a=0,o=0;s.weight&&(a+=s.barycenter*s.weight,o+=s.weight),i.weight&&(a+=i.barycenter*i.weight,o+=i.weight),s.vs=i.vs.concat(s.vs),s.barycenter=a/o,s.weight=o,s.i=Math.min(i.i,s.i),i.merged=!0}return u3}var d3,IR;function pOe(){if(IR)return d3;IR=1;var t=lr(),e=ai();d3=n;function n(i,a){var o=e.partition(i,function(w){return t.has(w,"barycenter")}),c=o.lhs,h=t.sortBy(o.rhs,function(w){return-w.i}),f=[],m=0,g=0,x=0;c.sort(s(!!a)),x=r(f,h,x),t.forEach(c,function(w){x+=w.vs.length,f.push(w.vs),m+=w.barycenter*w.weight,g+=w.weight,x=r(f,h,x)});var y={vs:t.flatten(f,!0)};return g&&(y.barycenter=m/g,y.weight=g),y}function r(i,a,o){for(var c;a.length&&(c=t.last(a)).i<=o;)a.pop(),i.push(c.vs),o++;return o}function s(i){return function(a,o){return a.barycentero.barycenter?1:i?o.i-a.i:a.i-o.i}}return d3}var h3,BR;function gOe(){if(BR)return h3;BR=1;var t=lr(),e=fOe(),n=mOe(),r=pOe();h3=s;function s(o,c,h,f){var m=o.children(c),g=o.node(c),x=g?g.borderLeft:void 0,y=g?g.borderRight:void 0,w={};x&&(m=t.filter(m,function(_){return _!==x&&_!==y}));var S=e(o,m);t.forEach(S,function(_){if(o.children(_.v).length){var E=s(o,_.v,h,f);w[_.v]=E,t.has(E,"barycenter")&&a(_,E)}});var k=n(S,h);i(k,w);var N=r(k,f);if(x&&(N.vs=t.flatten([x,N.vs,y],!0),o.predecessors(x).length)){var C=o.node(o.predecessors(x)[0]),T=o.node(o.predecessors(y)[0]);t.has(N,"barycenter")||(N.barycenter=0,N.weight=0),N.barycenter=(N.barycenter*N.weight+C.order+T.order)/(N.weight+2),N.weight+=2}return N}function i(o,c){t.forEach(o,function(h){h.vs=t.flatten(h.vs.map(function(f){return c[f]?c[f].vs:f}),!0)})}function a(o,c){t.isUndefined(o.barycenter)?(o.barycenter=c.barycenter,o.weight=c.weight):(o.barycenter=(o.barycenter*o.weight+c.barycenter*c.weight)/(o.weight+c.weight),o.weight+=c.weight)}return h3}var f3,qR;function xOe(){if(qR)return f3;qR=1;var t=lr(),e=_a().Graph;f3=n;function n(s,i,a){var o=r(s),c=new e({compound:!0}).setGraph({root:o}).setDefaultNodeLabel(function(h){return s.node(h)});return t.forEach(s.nodes(),function(h){var f=s.node(h),m=s.parent(h);(f.rank===i||f.minRank<=i&&i<=f.maxRank)&&(c.setNode(h),c.setParent(h,m||o),t.forEach(s[a](h),function(g){var x=g.v===h?g.w:g.v,y=c.edge(x,h),w=t.isUndefined(y)?0:y.weight;c.setEdge(x,h,{weight:s.edge(g).weight+w})}),t.has(f,"minRank")&&c.setNode(h,{borderLeft:f.borderLeft[i],borderRight:f.borderRight[i]}))}),c}function r(s){for(var i;s.hasNode(i=t.uniqueId("_root")););return i}return f3}var m3,FR;function vOe(){if(FR)return m3;FR=1;var t=lr();m3=e;function e(n,r,s){var i={},a;t.forEach(s,function(o){for(var c=n.parent(o),h,f;c;){if(h=n.parent(c),h?(f=i[h],i[h]=c):(f=a,a=c),f&&f!==c){r.setEdge(f,c);return}c=h}})}return m3}var p3,$R;function yOe(){if($R)return p3;$R=1;var t=lr(),e=dOe(),n=hOe(),r=gOe(),s=xOe(),i=vOe(),a=_a().Graph,o=ai();p3=c;function c(g){var x=o.maxRank(g),y=h(g,t.range(1,x+1),"inEdges"),w=h(g,t.range(x-1,-1,-1),"outEdges"),S=e(g);m(g,S);for(var k=Number.POSITIVE_INFINITY,N,C=0,T=0;T<4;++C,++T){f(C%2?y:w,C%4>=2),S=o.buildLayerMatrix(g);var _=n(g,S);_I)&&a(C,ee,$)})})}function _(E,M){var q=-1,L,I=0;return t.forEach(M,function($,V){if(k.node($).dummy==="border"){var ee=k.predecessors($);ee.length&&(L=k.node(ee[0]).order,T(M,I,V,q,L),I=V,q=L)}T(M,I,M.length,L,E.length)}),M}return t.reduce(N,_),C}function i(k,N){if(k.node(N).dummy)return t.find(k.predecessors(N),function(C){return k.node(C).dummy})}function a(k,N,C){if(N>C){var T=N;N=C,C=T}var _=k[N];_||(k[N]=_={}),_[C]=!0}function o(k,N,C){if(N>C){var T=N;N=C,C=T}return t.has(k[N],C)}function c(k,N,C,T){var _={},E={},M={};return t.forEach(N,function(q){t.forEach(q,function(L,I){_[L]=L,E[L]=L,M[L]=I})}),t.forEach(N,function(q){var L=-1;t.forEach(q,function(I){var $=T(I);if($.length){$=t.sortBy($,function(P){return M[P]});for(var V=($.length-1)/2,ee=Math.floor(V),z=Math.ceil(V);ee<=z;++ee){var H=$[ee];E[I]===I&&Ll.jsxs("div",{className:"px-4 py-2 shadow-md rounded-lg bg-gradient-to-br from-blue-500 to-blue-600 border-2 border-blue-700 min-w-[120px]",children:[l.jsx(Cc,{type:"target",position:ht.Top}),l.jsx("div",{className:"font-semibold text-white text-sm truncate max-w-[200px]",title:t.content,children:t.label}),l.jsx(Cc,{type:"source",position:ht.Bottom})]}));RV.displayName="EntityNode";const DV=b.memo(({data:t})=>l.jsxs("div",{className:"px-3 py-2 shadow-md rounded-md bg-gradient-to-br from-green-500 to-green-600 border-2 border-green-700 min-w-[100px]",children:[l.jsx(Cc,{type:"target",position:ht.Top}),l.jsx("div",{className:"font-medium text-white text-xs truncate max-w-[150px]",title:t.content,children:t.label}),l.jsx(Cc,{type:"source",position:ht.Bottom})]}));DV.displayName="ParagraphNode";const _Oe={entity:RV,paragraph:DV};function MOe(t,e){const n=new XR.graphlib.Graph;n.setDefaultEdgeLabel(()=>({})),n.setGraph({rankdir:"TB",ranksep:100,nodesep:80});const r=[],s=[];return t.forEach(i=>{n.setNode(i.id,{width:150,height:50})}),e.forEach(i=>{n.setEdge(i.source,i.target)}),XR.layout(n),t.forEach(i=>{const a=n.node(i.id);r.push({id:i.id,type:i.type,position:{x:a.x-75,y:a.y-25},data:{label:i.content.slice(0,20)+(i.content.length>20?"...":""),content:i.content}})}),e.forEach((i,a)=>{const o={id:`edge-${a}`,source:i.source,target:i.target,animated:t.length<=200&&i.weight>5,style:{strokeWidth:Math.min(i.weight/2,5),opacity:.6}};i.weight>10&&t.length<100&&(o.label=`${i.weight.toFixed(0)}`),s.push(o)}),{nodes:r,edges:s}}function AOe(){const t=Ma(),[e,n]=b.useState(!1),[r,s]=b.useState(null),[i,a]=b.useState(""),[o,c]=b.useState("all"),[h,f]=b.useState(50),[m,g]=b.useState("50"),[x,y]=b.useState(!1),[w,S]=b.useState(!0),[k,N]=b.useState(!1),[C,T]=b.useState(!1),[_,E,M]=Qke([]),[q,L,I]=Hke([]),[$,V]=b.useState(0),[ee,z]=b.useState(null),[H,P]=b.useState(null),{toast:W}=Gr(),J=b.useCallback(ne=>ne.type==="entity"?"#6366f1":ne.type==="paragraph"?"#10b981":"#6b7280",[]),X=b.useCallback(async(ne=!1)=>{try{if(!ne&&h>200){T(!0);return}n(!0);const[Y,ae]=await Promise.all([COe(h,o),TOe()]);if(s(ae),Y.nodes.length===0){W({title:"提示",description:"知识库为空,请先导入知识数据"}),E([]),L([]);return}const{nodes:re,edges:le}=MOe(Y.nodes,Y.edges);E(re),L(le),V(re.length),ae&&ae.total_nodes>h&&W({title:"提示",description:`知识图谱包含 ${ae.total_nodes} 个节点,当前显示 ${re.length} 个`}),W({title:"加载成功",description:`已加载 ${re.length} 个节点,${le.length} 条边`})}catch(Y){console.error("加载知识图谱失败:",Y),W({title:"加载失败",description:Y instanceof Error?Y.message:"未知错误",variant:"destructive"})}finally{n(!1)}},[h,o,W]),R=b.useCallback(async()=>{if(!i.trim()){W({title:"提示",description:"请输入搜索关键词"});return}try{const ne=await EOe(i);if(ne.length===0){W({title:"未找到",description:"没有找到匹配的节点"});return}const Y=new Set(ne.map(ae=>ae.id));E(ae=>ae.map(re=>({...re,style:{...re.style,opacity:Y.has(re.id)?1:.3,filter:Y.has(re.id)?"brightness(1.2)":"brightness(0.8)"}}))),W({title:"搜索完成",description:`找到 ${ne.length} 个匹配节点`})}catch(ne){console.error("搜索失败:",ne),W({title:"搜索失败",description:ne instanceof Error?ne.message:"未知错误",variant:"destructive"})}},[i,W]),se=b.useCallback(()=>{E(ne=>ne.map(Y=>({...Y,style:{...Y.style,opacity:1,filter:"brightness(1)"}})))},[]),G=b.useCallback(()=>{S(!1),N(!0),X()},[X]),F=b.useCallback(()=>{T(!1),setTimeout(()=>{X(!0)},0)},[X]),U=b.useCallback((ne,Y)=>{_.find(re=>re.id===Y.id)&&z({id:Y.id,type:Y.type,content:Y.data.content})},[_]);b.useEffect(()=>{w||k&&X()},[h,o,w,k]);const te=b.useCallback((ne,Y)=>{const ae=_.find(_e=>_e.id===Y.source),re=_.find(_e=>_e.id===Y.target),le=q.find(_e=>_e.id===Y.id);ae&&re&&le&&P({source:{id:ae.id,type:ae.type,content:ae.data.content},target:{id:re.id,type:re.type,content:re.data.content},edge:{source:Y.source,target:Y.target,weight:parseFloat(Y.label||"0")}})},[_,q]);return l.jsxs("div",{className:"h-full flex flex-col",children:[l.jsxs("div",{className:"flex-shrink-0 p-4 border-b bg-background",children:[l.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4",children:[l.jsxs("div",{children:[l.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"麦麦知识库图谱"}),l.jsx("p",{className:"text-muted-foreground mt-1",children:"可视化知识实体与关系网络"})]}),r&&l.jsxs("div",{className:"flex gap-2 flex-wrap",children:[l.jsxs(In,{variant:"outline",className:"gap-1",children:[l.jsx(N3,{className:"h-3 w-3"}),"节点: ",r.total_nodes]}),l.jsxs(In,{variant:"outline",className:"gap-1",children:[l.jsx(az,{className:"h-3 w-3"}),"边: ",r.total_edges]}),l.jsxs(In,{variant:"outline",className:"gap-1",children:[l.jsx(Oa,{className:"h-3 w-3"}),"实体: ",r.entity_nodes]}),l.jsxs(In,{variant:"outline",className:"gap-1",children:[l.jsx(io,{className:"h-3 w-3"}),"段落: ",r.paragraph_nodes]})]})]}),l.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 mt-4",children:[l.jsxs("div",{className:"flex-1 flex gap-2",children:[l.jsx(Pe,{placeholder:"搜索节点内容...",value:i,onChange:ne=>a(ne.target.value),onKeyDown:ne=>ne.key==="Enter"&&R(),className:"flex-1"}),l.jsx(fe,{onClick:R,size:"sm",children:l.jsx(li,{className:"h-4 w-4"})}),l.jsx(fe,{onClick:se,variant:"outline",size:"sm",children:"重置"})]}),l.jsxs("div",{className:"flex gap-2",children:[l.jsxs(zt,{value:o,onValueChange:ne=>c(ne),children:[l.jsx(At,{className:"w-[120px]",children:l.jsx(Pt,{})}),l.jsxs(Rt,{children:[l.jsx(ze,{value:"all",children:"全部节点"}),l.jsx(ze,{value:"entity",children:"仅实体"}),l.jsx(ze,{value:"paragraph",children:"仅段落"})]})]}),l.jsxs(zt,{value:h===1e4?"all":x?"custom":h.toString(),onValueChange:ne=>{ne==="custom"?(y(!0),g(h.toString())):ne==="all"?(y(!1),f(1e4)):(y(!1),f(Number(ne)))},children:[l.jsx(At,{className:"w-[120px]",children:l.jsx(Pt,{})}),l.jsxs(Rt,{children:[l.jsx(ze,{value:"50",children:"50 节点"}),l.jsx(ze,{value:"100",children:"100 节点"}),l.jsx(ze,{value:"200",children:"200 节点"}),l.jsx(ze,{value:"500",children:"500 节点"}),l.jsx(ze,{value:"1000",children:"1000 节点"}),l.jsx(ze,{value:"all",children:"全部 (最多10000)"}),l.jsx(ze,{value:"custom",children:"自定义..."})]})]}),x&&l.jsx(Pe,{type:"number",min:"50",value:m,onChange:ne=>g(ne.target.value),onBlur:()=>{const ne=parseInt(m);!isNaN(ne)&&ne>=50?f(ne):(g("50"),f(50))},onKeyDown:ne=>{if(ne.key==="Enter"){const Y=parseInt(m);!isNaN(Y)&&Y>=50?f(Y):(g("50"),f(50))}},placeholder:"最少50个",className:"w-[120px]"}),l.jsx(fe,{onClick:()=>X(),variant:"outline",size:"sm",disabled:e,children:l.jsx(ti,{className:ye("h-4 w-4",e&&"animate-spin")})})]})]})]}),l.jsx("div",{className:"flex-1 relative",children:e?l.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:l.jsxs("div",{className:"text-center",children:[l.jsx(ti,{className:"h-8 w-8 animate-spin mx-auto mb-2 text-muted-foreground"}),l.jsx("p",{className:"text-muted-foreground",children:"加载知识图谱中..."})]})}):_.length===0?l.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:l.jsxs("div",{className:"text-center",children:[l.jsx(N3,{className:"h-12 w-12 mx-auto mb-4 text-muted-foreground"}),l.jsx("h3",{className:"text-lg font-semibold mb-2",children:"知识库为空"}),l.jsx("p",{className:"text-muted-foreground",children:"请先导入知识数据"})]})}):l.jsxs(uV,{nodes:_,edges:q,onNodesChange:M,onEdgesChange:I,onNodeClick:U,onEdgeClick:te,nodeTypes:_Oe,fitView:!0,minZoom:.05,maxZoom:1.5,defaultViewport:{x:0,y:0,zoom:.5},elevateNodesOnSelect:$<=500,nodesDraggable:$<=1e3,attributionPosition:"bottom-left",children:[l.jsx(f6e,{variant:sa.Dots,gap:12,size:1}),l.jsx(l6e,{}),$<=500&&l.jsx(e6e,{nodeColor:J,nodeBorderRadius:8,pannable:!0,zoomable:!0}),l.jsxs(My,{position:"top-right",className:"bg-background/95 backdrop-blur-sm rounded-lg border p-3 shadow-lg",children:[l.jsx("div",{className:"text-sm font-semibold mb-2",children:"图例"}),l.jsxs("div",{className:"space-y-2 text-xs",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("div",{className:"w-4 h-4 rounded bg-gradient-to-br from-blue-500 to-blue-600 border-2 border-blue-700"}),l.jsx("span",{children:"实体节点"})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("div",{className:"w-4 h-4 rounded bg-gradient-to-br from-green-500 to-green-600 border-2 border-green-700"}),l.jsx("span",{children:"段落节点"})]}),$>200&&l.jsxs("div",{className:"mt-2 pt-2 border-t text-yellow-600 dark:text-yellow-500",children:[l.jsx("div",{className:"font-semibold",children:"性能模式"}),l.jsx("div",{children:"已禁用动画"}),$>500&&l.jsx("div",{children:"已禁用缩略图"})]})]})]})]})}),l.jsx(fr,{open:!!ee,onOpenChange:ne=>!ne&&z(null),children:l.jsxs(rr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[l.jsx(sr,{children:l.jsx(ir,{children:"节点详情"})}),ee&&l.jsxs("div",{className:"space-y-4",children:[l.jsx("div",{className:"grid grid-cols-2 gap-4",children:l.jsxs("div",{children:[l.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"类型"}),l.jsx("div",{className:"mt-1",children:l.jsx(In,{variant:ee.type==="entity"?"default":"secondary",children:ee.type==="entity"?"🏷️ 实体":"📄 段落"})})]})}),l.jsxs("div",{children:[l.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"ID"}),l.jsx("code",{className:"mt-1 block p-2 bg-muted rounded text-xs break-all",children:ee.id})]}),l.jsxs("div",{children:[l.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"内容"}),l.jsx(on,{className:"mt-1 h-40 p-3 bg-muted rounded",children:l.jsx("p",{className:"text-sm whitespace-pre-wrap",children:ee.content})})]})]})]})}),l.jsx(fr,{open:!!H,onOpenChange:ne=>!ne&&P(null),children:l.jsxs(rr,{className:"max-w-2xl max-h-[80vh] overflow-hidden flex flex-col",children:[l.jsx(sr,{children:l.jsx(ir,{children:"边详情"})}),H&&l.jsx(on,{className:"flex-1 pr-4",children:l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"flex items-center gap-4",children:[l.jsxs("div",{className:"flex-1 min-w-0 p-3 bg-blue-50 dark:bg-blue-950 rounded border-2 border-blue-200 dark:border-blue-800",children:[l.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"源节点"}),l.jsx("div",{className:"font-medium text-sm mb-2 truncate",children:H.source.content}),l.jsxs("code",{className:"text-xs text-muted-foreground truncate block",children:[H.source.id.slice(0,40),"..."]})]}),l.jsx("div",{className:"text-2xl text-muted-foreground flex-shrink-0",children:"→"}),l.jsxs("div",{className:"flex-1 min-w-0 p-3 bg-green-50 dark:bg-green-950 rounded border-2 border-green-200 dark:border-green-800",children:[l.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"目标节点"}),l.jsx("div",{className:"font-medium text-sm mb-2 truncate",children:H.target.content}),l.jsxs("code",{className:"text-xs text-muted-foreground truncate block",children:[H.target.id.slice(0,40),"..."]})]})]}),l.jsxs("div",{children:[l.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"权重"}),l.jsx("div",{className:"mt-1",children:l.jsx(In,{variant:"outline",className:"text-base font-mono",children:H.edge.weight.toFixed(4)})})]})]})})]})}),l.jsx(wn,{open:w,onOpenChange:S,children:l.jsxs(un,{children:[l.jsxs(dn,{children:[l.jsx(fn,{children:"加载知识图谱"}),l.jsxs(mn,{children:["知识图谱的动态展示会消耗较多系统资源。",l.jsx("br",{}),"确定要加载知识图谱吗?"]})]}),l.jsxs(hn,{children:[l.jsx(gn,{onClick:()=>t({to:"/"}),children:"取消 (返回首页)"}),l.jsx(pn,{onClick:G,children:"确认加载"})]})]})}),l.jsx(wn,{open:C,onOpenChange:T,children:l.jsxs(un,{children:[l.jsxs(dn,{children:[l.jsx(fn,{children:"⚠️ 节点数量较多"}),l.jsx(mn,{asChild:!0,children:l.jsxs("div",{children:[l.jsxs("p",{children:["您正在尝试加载 ",l.jsx("strong",{className:"text-orange-600",children:h>=1e4?"全部 (最多10000个)":h})," 个节点。"]}),l.jsx("p",{className:"mt-4",children:"节点数量过多可能导致:"}),l.jsxs("ul",{className:"list-disc list-inside mt-2 space-y-1",children:[l.jsx("li",{children:"页面加载时间较长"}),l.jsx("li",{children:"浏览器卡顿或崩溃"}),l.jsx("li",{children:"系统资源占用过高"})]}),l.jsx("p",{className:"mt-4",children:"建议先选择较少的节点数量 (50-200 个)。"})]})})]}),l.jsxs(hn,{children:[l.jsx(gn,{onClick:()=>{T(!1),h>200&&(f(50),y(!1))},children:"取消"}),l.jsx(pn,{onClick:F,className:"bg-orange-600 hover:bg-orange-700",children:"我了解风险,继续加载"})]})]})})]})}function Dd(t,e,n){let r=n.initialDeps??[],s;function i(){var a,o,c,h;let f;n.key&&((a=n.debug)!=null&&a.call(n))&&(f=Date.now());const m=t();if(!(m.length!==r.length||m.some((y,w)=>r[w]!==y)))return s;r=m;let x;if(n.key&&((o=n.debug)!=null&&o.call(n))&&(x=Date.now()),s=e(...m),n.key&&((c=n.debug)!=null&&c.call(n))){const y=Math.round((Date.now()-f)*100)/100,w=Math.round((Date.now()-x)*100)/100,S=w/16,k=(N,C)=>{for(N=String(N);N.length0;)this.endGroup()}has(e){return this.current.hasOwnProperty(e)||this.builtins.hasOwnProperty(e)}get(e){return this.current.hasOwnProperty(e)?this.current[e]:this.builtins[e]}set(e,n,r){if(r===void 0&&(r=!1),r){for(var s=0;s0&&(this.undefStack[this.undefStack.length-1][e]=n)}else{var i=this.undefStack[this.undefStack.length-1];i&&!i.hasOwnProperty(e)&&(i[e]=this.current[e])}n==null?delete this.current[e]:this.current[e]=n}}var T2e=CQ;Z("\\noexpand",function(t){var e=t.popToken();return t.isExpandable(e.text)&&(e.noexpand=!0,e.treatAsRelax=!0),{tokens:[e],numArgs:0}});Z("\\expandafter",function(t){var e=t.popToken();return t.expandOnce(!0),{tokens:[e],numArgs:0}});Z("\\@firstoftwo",function(t){var e=t.consumeArgs(2);return{tokens:e[0],numArgs:0}});Z("\\@secondoftwo",function(t){var e=t.consumeArgs(2);return{tokens:e[1],numArgs:0}});Z("\\@ifnextchar",function(t){var e=t.consumeArgs(3);t.consumeSpaces();var n=t.future();return e[0].length===1&&e[0][0].text===n.text?{tokens:e[1],numArgs:0}:{tokens:e[2],numArgs:0}});Z("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}");Z("\\TextOrMath",function(t){var e=t.consumeArgs(2);return t.mode==="text"?{tokens:e[0],numArgs:0}:{tokens:e[1],numArgs:0}});var NM={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};Z("\\char",function(t){var e=t.popToken(),n,r="";if(e.text==="'")n=8,e=t.popToken();else if(e.text==='"')n=16,e=t.popToken();else if(e.text==="`")if(e=t.popToken(),e.text[0]==="\\")r=e.text.charCodeAt(1);else{if(e.text==="EOF")throw new $e("\\char` missing argument");r=e.text.charCodeAt(0)}else n=10;if(n){if(r=NM[e.text],r==null||r>=n)throw new $e("Invalid base-"+n+" digit "+e.text);for(var s;(s=NM[t.future().text])!=null&&s{var s=t.consumeArg().tokens;if(s.length!==1)throw new $e("\\newcommand's first argument must be a macro name");var i=s[0].text,a=t.isDefined(i);if(a&&!e)throw new $e("\\newcommand{"+i+"} attempting to redefine "+(i+"; use \\renewcommand"));if(!a&&!n)throw new $e("\\renewcommand{"+i+"} when command "+i+" does not yet exist; use \\newcommand");var o=0;if(s=t.consumeArg().tokens,s.length===1&&s[0].text==="["){for(var c="",h=t.expandNextToken();h.text!=="]"&&h.text!=="EOF";)c+=h.text,h=t.expandNextToken();if(!c.match(/^\s*[0-9]+\s*$/))throw new $e("Invalid number of arguments: "+c);o=parseInt(c),s=t.consumeArg().tokens}return a&&r||t.macros.set(i,{tokens:s,numArgs:o}),""};Z("\\newcommand",t=>aO(t,!1,!0,!1));Z("\\renewcommand",t=>aO(t,!0,!1,!1));Z("\\providecommand",t=>aO(t,!0,!0,!0));Z("\\message",t=>{var e=t.consumeArgs(1)[0];return console.log(e.reverse().map(n=>n.text).join("")),""});Z("\\errmessage",t=>{var e=t.consumeArgs(1)[0];return console.error(e.reverse().map(n=>n.text).join("")),""});Z("\\show",t=>{var e=t.popToken(),n=e.text;return console.log(e,t.macros.get(n),fc[n],Jn.math[n],Jn.text[n]),""});Z("\\bgroup","{");Z("\\egroup","}");Z("~","\\nobreakspace");Z("\\lq","`");Z("\\rq","'");Z("\\aa","\\r a");Z("\\AA","\\r A");Z("\\textcopyright","\\html@mathml{\\textcircled{c}}{\\char`©}");Z("\\copyright","\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}");Z("\\textregistered","\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}");Z("ℬ","\\mathscr{B}");Z("ℰ","\\mathscr{E}");Z("ℱ","\\mathscr{F}");Z("ℋ","\\mathscr{H}");Z("ℐ","\\mathscr{I}");Z("ℒ","\\mathscr{L}");Z("ℳ","\\mathscr{M}");Z("ℛ","\\mathscr{R}");Z("ℭ","\\mathfrak{C}");Z("ℌ","\\mathfrak{H}");Z("ℨ","\\mathfrak{Z}");Z("\\Bbbk","\\Bbb{k}");Z("·","\\cdotp");Z("\\llap","\\mathllap{\\textrm{#1}}");Z("\\rlap","\\mathrlap{\\textrm{#1}}");Z("\\clap","\\mathclap{\\textrm{#1}}");Z("\\mathstrut","\\vphantom{(}");Z("\\underbar","\\underline{\\text{#1}}");Z("\\not",'\\html@mathml{\\mathrel{\\mathrlap\\@not}}{\\char"338}');Z("\\neq","\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}");Z("\\ne","\\neq");Z("≠","\\neq");Z("\\notin","\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`∉}}");Z("∉","\\notin");Z("≘","\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`≘}}");Z("≙","\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`≘}}");Z("≚","\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`≚}}");Z("≛","\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`≛}}");Z("≝","\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`≝}}");Z("≞","\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`≞}}");Z("≟","\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`≟}}");Z("⟂","\\perp");Z("‼","\\mathclose{!\\mkern-0.8mu!}");Z("∌","\\notni");Z("⌜","\\ulcorner");Z("⌝","\\urcorner");Z("⌞","\\llcorner");Z("⌟","\\lrcorner");Z("©","\\copyright");Z("®","\\textregistered");Z("️","\\textregistered");Z("\\ulcorner",'\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}');Z("\\urcorner",'\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}');Z("\\llcorner",'\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}');Z("\\lrcorner",'\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}');Z("\\vdots","{\\varvdots\\rule{0pt}{15pt}}");Z("⋮","\\vdots");Z("\\varGamma","\\mathit{\\Gamma}");Z("\\varDelta","\\mathit{\\Delta}");Z("\\varTheta","\\mathit{\\Theta}");Z("\\varLambda","\\mathit{\\Lambda}");Z("\\varXi","\\mathit{\\Xi}");Z("\\varPi","\\mathit{\\Pi}");Z("\\varSigma","\\mathit{\\Sigma}");Z("\\varUpsilon","\\mathit{\\Upsilon}");Z("\\varPhi","\\mathit{\\Phi}");Z("\\varPsi","\\mathit{\\Psi}");Z("\\varOmega","\\mathit{\\Omega}");Z("\\substack","\\begin{subarray}{c}#1\\end{subarray}");Z("\\colon","\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax");Z("\\boxed","\\fbox{$\\displaystyle{#1}$}");Z("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;");Z("\\implies","\\DOTSB\\;\\Longrightarrow\\;");Z("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;");Z("\\dddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}");Z("\\ddddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}");var CM={",":"\\dotsc","\\not":"\\dotsb","+":"\\dotsb","=":"\\dotsb","<":"\\dotsb",">":"\\dotsb","-":"\\dotsb","*":"\\dotsb",":":"\\dotsb","\\DOTSB":"\\dotsb","\\coprod":"\\dotsb","\\bigvee":"\\dotsb","\\bigwedge":"\\dotsb","\\biguplus":"\\dotsb","\\bigcap":"\\dotsb","\\bigcup":"\\dotsb","\\prod":"\\dotsb","\\sum":"\\dotsb","\\bigotimes":"\\dotsb","\\bigoplus":"\\dotsb","\\bigodot":"\\dotsb","\\bigsqcup":"\\dotsb","\\And":"\\dotsb","\\longrightarrow":"\\dotsb","\\Longrightarrow":"\\dotsb","\\longleftarrow":"\\dotsb","\\Longleftarrow":"\\dotsb","\\longleftrightarrow":"\\dotsb","\\Longleftrightarrow":"\\dotsb","\\mapsto":"\\dotsb","\\longmapsto":"\\dotsb","\\hookrightarrow":"\\dotsb","\\doteq":"\\dotsb","\\mathbin":"\\dotsb","\\mathrel":"\\dotsb","\\relbar":"\\dotsb","\\Relbar":"\\dotsb","\\xrightarrow":"\\dotsb","\\xleftarrow":"\\dotsb","\\DOTSI":"\\dotsi","\\int":"\\dotsi","\\oint":"\\dotsi","\\iint":"\\dotsi","\\iiint":"\\dotsi","\\iiiint":"\\dotsi","\\idotsint":"\\dotsi","\\DOTSX":"\\dotsx"};Z("\\dots",function(t){var e="\\dotso",n=t.expandAfterFuture().text;return n in CM?e=CM[n]:(n.slice(0,4)==="\\not"||n in Jn.math&&["bin","rel"].includes(Jn.math[n].group))&&(e="\\dotsb"),e});var lO={")":!0,"]":!0,"\\rbrack":!0,"\\}":!0,"\\rbrace":!0,"\\rangle":!0,"\\rceil":!0,"\\rfloor":!0,"\\rgroup":!0,"\\rmoustache":!0,"\\right":!0,"\\bigr":!0,"\\biggr":!0,"\\Bigr":!0,"\\Biggr":!0,$:!0,";":!0,".":!0,",":!0};Z("\\dotso",function(t){var e=t.future().text;return e in lO?"\\ldots\\,":"\\ldots"});Z("\\dotsc",function(t){var e=t.future().text;return e in lO&&e!==","?"\\ldots\\,":"\\ldots"});Z("\\cdots",function(t){var e=t.future().text;return e in lO?"\\@cdots\\,":"\\@cdots"});Z("\\dotsb","\\cdots");Z("\\dotsm","\\cdots");Z("\\dotsi","\\!\\cdots");Z("\\dotsx","\\ldots\\,");Z("\\DOTSI","\\relax");Z("\\DOTSB","\\relax");Z("\\DOTSX","\\relax");Z("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax");Z("\\,","\\tmspace+{3mu}{.1667em}");Z("\\thinspace","\\,");Z("\\>","\\mskip{4mu}");Z("\\:","\\tmspace+{4mu}{.2222em}");Z("\\medspace","\\:");Z("\\;","\\tmspace+{5mu}{.2777em}");Z("\\thickspace","\\;");Z("\\!","\\tmspace-{3mu}{.1667em}");Z("\\negthinspace","\\!");Z("\\negmedspace","\\tmspace-{4mu}{.2222em}");Z("\\negthickspace","\\tmspace-{5mu}{.277em}");Z("\\enspace","\\kern.5em ");Z("\\enskip","\\hskip.5em\\relax");Z("\\quad","\\hskip1em\\relax");Z("\\qquad","\\hskip2em\\relax");Z("\\tag","\\@ifstar\\tag@literal\\tag@paren");Z("\\tag@paren","\\tag@literal{({#1})}");Z("\\tag@literal",t=>{if(t.macros.get("\\df@tag"))throw new $e("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"});Z("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}");Z("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)");Z("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}");Z("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1");Z("\\newline","\\\\\\relax");Z("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");var BQ=We(il["Main-Regular"][84][1]-.7*il["Main-Regular"][65][1]);Z("\\LaTeX","\\textrm{\\html@mathml{"+("L\\kern-.36em\\raisebox{"+BQ+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{LaTeX}}");Z("\\KaTeX","\\textrm{\\html@mathml{"+("K\\kern-.17em\\raisebox{"+BQ+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{KaTeX}}");Z("\\hspace","\\@ifstar\\@hspacer\\@hspace");Z("\\@hspace","\\hskip #1\\relax");Z("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax");Z("\\ordinarycolon",":");Z("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}");Z("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}');Z("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}');Z("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}');Z("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}');Z("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}');Z("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}');Z("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}');Z("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}');Z("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}');Z("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}');Z("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}');Z("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}');Z("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}');Z("∷","\\dblcolon");Z("∹","\\eqcolon");Z("≔","\\coloneqq");Z("≕","\\eqqcolon");Z("⩴","\\Coloneqq");Z("\\ratio","\\vcentcolon");Z("\\coloncolon","\\dblcolon");Z("\\colonequals","\\coloneqq");Z("\\coloncolonequals","\\Coloneqq");Z("\\equalscolon","\\eqqcolon");Z("\\equalscoloncolon","\\Eqqcolon");Z("\\colonminus","\\coloneq");Z("\\coloncolonminus","\\Coloneq");Z("\\minuscolon","\\eqcolon");Z("\\minuscoloncolon","\\Eqcolon");Z("\\coloncolonapprox","\\Colonapprox");Z("\\coloncolonsim","\\Colonsim");Z("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}");Z("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}");Z("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}");Z("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}");Z("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`∌}}");Z("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}");Z("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}");Z("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}");Z("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}");Z("\\varlimsup","\\DOTSB\\operatorname*{\\overline{lim}}");Z("\\varliminf","\\DOTSB\\operatorname*{\\underline{lim}}");Z("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{lim}}");Z("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{lim}}");Z("\\gvertneqq","\\html@mathml{\\@gvertneqq}{≩}");Z("\\lvertneqq","\\html@mathml{\\@lvertneqq}{≨}");Z("\\ngeqq","\\html@mathml{\\@ngeqq}{≱}");Z("\\ngeqslant","\\html@mathml{\\@ngeqslant}{≱}");Z("\\nleqq","\\html@mathml{\\@nleqq}{≰}");Z("\\nleqslant","\\html@mathml{\\@nleqslant}{≰}");Z("\\nshortmid","\\html@mathml{\\@nshortmid}{∤}");Z("\\nshortparallel","\\html@mathml{\\@nshortparallel}{∦}");Z("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{⊈}");Z("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{⊉}");Z("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{⊊}");Z("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{⫋}");Z("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{⊋}");Z("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{⫌}");Z("\\imath","\\html@mathml{\\@imath}{ı}");Z("\\jmath","\\html@mathml{\\@jmath}{ȷ}");Z("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`⟦}}");Z("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`⟧}}");Z("⟦","\\llbracket");Z("⟧","\\rrbracket");Z("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`⦃}}");Z("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`⦄}}");Z("⦃","\\lBrace");Z("⦄","\\rBrace");Z("\\minuso","\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`⦵}}");Z("⦵","\\minuso");Z("\\darr","\\downarrow");Z("\\dArr","\\Downarrow");Z("\\Darr","\\Downarrow");Z("\\lang","\\langle");Z("\\rang","\\rangle");Z("\\uarr","\\uparrow");Z("\\uArr","\\Uparrow");Z("\\Uarr","\\Uparrow");Z("\\N","\\mathbb{N}");Z("\\R","\\mathbb{R}");Z("\\Z","\\mathbb{Z}");Z("\\alef","\\aleph");Z("\\alefsym","\\aleph");Z("\\Alpha","\\mathrm{A}");Z("\\Beta","\\mathrm{B}");Z("\\bull","\\bullet");Z("\\Chi","\\mathrm{X}");Z("\\clubs","\\clubsuit");Z("\\cnums","\\mathbb{C}");Z("\\Complex","\\mathbb{C}");Z("\\Dagger","\\ddagger");Z("\\diamonds","\\diamondsuit");Z("\\empty","\\emptyset");Z("\\Epsilon","\\mathrm{E}");Z("\\Eta","\\mathrm{H}");Z("\\exist","\\exists");Z("\\harr","\\leftrightarrow");Z("\\hArr","\\Leftrightarrow");Z("\\Harr","\\Leftrightarrow");Z("\\hearts","\\heartsuit");Z("\\image","\\Im");Z("\\infin","\\infty");Z("\\Iota","\\mathrm{I}");Z("\\isin","\\in");Z("\\Kappa","\\mathrm{K}");Z("\\larr","\\leftarrow");Z("\\lArr","\\Leftarrow");Z("\\Larr","\\Leftarrow");Z("\\lrarr","\\leftrightarrow");Z("\\lrArr","\\Leftrightarrow");Z("\\Lrarr","\\Leftrightarrow");Z("\\Mu","\\mathrm{M}");Z("\\natnums","\\mathbb{N}");Z("\\Nu","\\mathrm{N}");Z("\\Omicron","\\mathrm{O}");Z("\\plusmn","\\pm");Z("\\rarr","\\rightarrow");Z("\\rArr","\\Rightarrow");Z("\\Rarr","\\Rightarrow");Z("\\real","\\Re");Z("\\reals","\\mathbb{R}");Z("\\Reals","\\mathbb{R}");Z("\\Rho","\\mathrm{P}");Z("\\sdot","\\cdot");Z("\\sect","\\S");Z("\\spades","\\spadesuit");Z("\\sub","\\subset");Z("\\sube","\\subseteq");Z("\\supe","\\supseteq");Z("\\Tau","\\mathrm{T}");Z("\\thetasym","\\vartheta");Z("\\weierp","\\wp");Z("\\Zeta","\\mathrm{Z}");Z("\\argmin","\\DOTSB\\operatorname*{arg\\,min}");Z("\\argmax","\\DOTSB\\operatorname*{arg\\,max}");Z("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits");Z("\\bra","\\mathinner{\\langle{#1}|}");Z("\\ket","\\mathinner{|{#1}\\rangle}");Z("\\braket","\\mathinner{\\langle{#1}\\rangle}");Z("\\Bra","\\left\\langle#1\\right|");Z("\\Ket","\\left|#1\\right\\rangle");var qQ=t=>e=>{var n=e.consumeArg().tokens,r=e.consumeArg().tokens,s=e.consumeArg().tokens,i=e.consumeArg().tokens,a=e.macros.get("|"),o=e.macros.get("\\|");e.macros.beginGroup();var c=m=>g=>{t&&(g.macros.set("|",a),s.length&&g.macros.set("\\|",o));var x=m;if(!m&&s.length){var y=g.future();y.text==="|"&&(g.popToken(),x=!0)}return{tokens:x?s:r,numArgs:0}};e.macros.set("|",c(!1)),s.length&&e.macros.set("\\|",c(!0));var h=e.consumeArg().tokens,f=e.expandTokens([...i,...h,...n]);return e.macros.endGroup(),{tokens:f.reverse(),numArgs:0}};Z("\\bra@ket",qQ(!1));Z("\\bra@set",qQ(!0));Z("\\Braket","\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}");Z("\\Set","\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}");Z("\\set","\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}");Z("\\angln","{\\angl n}");Z("\\blue","\\textcolor{##6495ed}{#1}");Z("\\orange","\\textcolor{##ffa500}{#1}");Z("\\pink","\\textcolor{##ff00af}{#1}");Z("\\red","\\textcolor{##df0030}{#1}");Z("\\green","\\textcolor{##28ae7b}{#1}");Z("\\gray","\\textcolor{gray}{#1}");Z("\\purple","\\textcolor{##9d38bd}{#1}");Z("\\blueA","\\textcolor{##ccfaff}{#1}");Z("\\blueB","\\textcolor{##80f6ff}{#1}");Z("\\blueC","\\textcolor{##63d9ea}{#1}");Z("\\blueD","\\textcolor{##11accd}{#1}");Z("\\blueE","\\textcolor{##0c7f99}{#1}");Z("\\tealA","\\textcolor{##94fff5}{#1}");Z("\\tealB","\\textcolor{##26edd5}{#1}");Z("\\tealC","\\textcolor{##01d1c1}{#1}");Z("\\tealD","\\textcolor{##01a995}{#1}");Z("\\tealE","\\textcolor{##208170}{#1}");Z("\\greenA","\\textcolor{##b6ffb0}{#1}");Z("\\greenB","\\textcolor{##8af281}{#1}");Z("\\greenC","\\textcolor{##74cf70}{#1}");Z("\\greenD","\\textcolor{##1fab54}{#1}");Z("\\greenE","\\textcolor{##0d923f}{#1}");Z("\\goldA","\\textcolor{##ffd0a9}{#1}");Z("\\goldB","\\textcolor{##ffbb71}{#1}");Z("\\goldC","\\textcolor{##ff9c39}{#1}");Z("\\goldD","\\textcolor{##e07d10}{#1}");Z("\\goldE","\\textcolor{##a75a05}{#1}");Z("\\redA","\\textcolor{##fca9a9}{#1}");Z("\\redB","\\textcolor{##ff8482}{#1}");Z("\\redC","\\textcolor{##f9685d}{#1}");Z("\\redD","\\textcolor{##e84d39}{#1}");Z("\\redE","\\textcolor{##bc2612}{#1}");Z("\\maroonA","\\textcolor{##ffbde0}{#1}");Z("\\maroonB","\\textcolor{##ff92c6}{#1}");Z("\\maroonC","\\textcolor{##ed5fa6}{#1}");Z("\\maroonD","\\textcolor{##ca337c}{#1}");Z("\\maroonE","\\textcolor{##9e034e}{#1}");Z("\\purpleA","\\textcolor{##ddd7ff}{#1}");Z("\\purpleB","\\textcolor{##c6b9fc}{#1}");Z("\\purpleC","\\textcolor{##aa87ff}{#1}");Z("\\purpleD","\\textcolor{##7854ab}{#1}");Z("\\purpleE","\\textcolor{##543b78}{#1}");Z("\\mintA","\\textcolor{##f5f9e8}{#1}");Z("\\mintB","\\textcolor{##edf2df}{#1}");Z("\\mintC","\\textcolor{##e0e5cc}{#1}");Z("\\grayA","\\textcolor{##f6f7f7}{#1}");Z("\\grayB","\\textcolor{##f0f1f2}{#1}");Z("\\grayC","\\textcolor{##e3e5e6}{#1}");Z("\\grayD","\\textcolor{##d6d8da}{#1}");Z("\\grayE","\\textcolor{##babec2}{#1}");Z("\\grayF","\\textcolor{##888d93}{#1}");Z("\\grayG","\\textcolor{##626569}{#1}");Z("\\grayH","\\textcolor{##3b3e40}{#1}");Z("\\grayI","\\textcolor{##21242c}{#1}");Z("\\kaBlue","\\textcolor{##314453}{#1}");Z("\\kaGreen","\\textcolor{##71B307}{#1}");var FQ={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0};class E2e{constructor(e,n,r){this.settings=void 0,this.expansionCount=void 0,this.lexer=void 0,this.macros=void 0,this.stack=void 0,this.mode=void 0,this.settings=n,this.expansionCount=0,this.feed(e),this.macros=new C2e(T2e,n.macros),this.mode=r,this.stack=[]}feed(e){this.lexer=new OM(e,this.settings)}switchMode(e){this.mode=e}beginGroup(){this.macros.beginGroup()}endGroup(){this.macros.endGroup()}endGroups(){this.macros.endGroups()}future(){return this.stack.length===0&&this.pushToken(this.lexer.lex()),this.stack[this.stack.length-1]}popToken(){return this.future(),this.stack.pop()}pushToken(e){this.stack.push(e)}pushTokens(e){this.stack.push(...e)}scanArgument(e){var n,r,s;if(e){if(this.consumeSpaces(),this.future().text!=="[")return null;n=this.popToken(),{tokens:s,end:r}=this.consumeArg(["]"])}else({tokens:s,start:n,end:r}=this.consumeArg());return this.pushToken(new Ri("EOF",r.loc)),this.pushTokens(s),new Ri("",Js.range(n,r))}consumeSpaces(){for(;;){var e=this.future();if(e.text===" ")this.stack.pop();else break}}consumeArg(e){var n=[],r=e&&e.length>0;r||this.consumeSpaces();var s=this.future(),i,a=0,o=0;do{if(i=this.popToken(),n.push(i),i.text==="{")++a;else if(i.text==="}"){if(--a,a===-1)throw new $e("Extra }",i)}else if(i.text==="EOF")throw new $e("Unexpected end of input in a macro argument, expected '"+(e&&r?e[o]:"}")+"'",i);if(e&&r)if((a===0||a===1&&e[o]==="{")&&i.text===e[o]){if(++o,o===e.length){n.splice(-o,o);break}}else o=0}while(a!==0||r);return s.text==="{"&&n[n.length-1].text==="}"&&(n.pop(),n.shift()),n.reverse(),{tokens:n,start:s,end:i}}consumeArgs(e,n){if(n){if(n.length!==e+1)throw new $e("The length of delimiters doesn't match the number of args!");for(var r=n[0],s=0;sthis.settings.maxExpand)throw new $e("Too many expansions: infinite loop or need to increase maxExpand setting")}expandOnce(e){var n=this.popToken(),r=n.text,s=n.noexpand?null:this._getExpansion(r);if(s==null||e&&s.unexpandable){if(e&&s==null&&r[0]==="\\"&&!this.isDefined(r))throw new $e("Undefined control sequence: "+r);return this.pushToken(n),!1}this.countExpansion(1);var i=s.tokens,a=this.consumeArgs(s.numArgs,s.delimiters);if(s.numArgs){i=i.slice();for(var o=i.length-1;o>=0;--o){var c=i[o];if(c.text==="#"){if(o===0)throw new $e("Incomplete placeholder at end of macro body",c);if(c=i[--o],c.text==="#")i.splice(o+1,1);else if(/^[1-9]$/.test(c.text))i.splice(o,2,...a[+c.text-1]);else throw new $e("Not a valid argument number",c)}}}return this.pushTokens(i),i.length}expandAfterFuture(){return this.expandOnce(),this.future()}expandNextToken(){for(;;)if(this.expandOnce()===!1){var e=this.stack.pop();return e.treatAsRelax&&(e.text="\\relax"),e}throw new Error}expandMacro(e){return this.macros.has(e)?this.expandTokens([new Ri(e)]):void 0}expandTokens(e){var n=[],r=this.stack.length;for(this.pushTokens(e);this.stack.length>r;)if(this.expandOnce(!0)===!1){var s=this.stack.pop();s.treatAsRelax&&(s.noexpand=!1,s.treatAsRelax=!1),n.push(s)}return this.countExpansion(n.length),n}expandMacroAsText(e){var n=this.expandMacro(e);return n&&n.map(r=>r.text).join("")}_getExpansion(e){var n=this.macros.get(e);if(n==null)return n;if(e.length===1){var r=this.lexer.catcodes[e];if(r!=null&&r!==13)return}var s=typeof n=="function"?n(this):n;if(typeof s=="string"){var i=0;if(s.indexOf("#")!==-1)for(var a=s.replace(/##/g,"");a.indexOf("#"+(i+1))!==-1;)++i;for(var o=new OM(s,this.settings),c=[],h=o.lex();h.text!=="EOF";)c.push(h),h=o.lex();c.reverse();var f={tokens:c,numArgs:i};return f}return s}isDefined(e){return this.macros.has(e)||fc.hasOwnProperty(e)||Jn.math.hasOwnProperty(e)||Jn.text.hasOwnProperty(e)||FQ.hasOwnProperty(e)}isExpandable(e){var n=this.macros.get(e);return n!=null?typeof n=="string"||typeof n=="function"||!n.unexpandable:fc.hasOwnProperty(e)&&!fc[e].primitive}}var TM=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,Lx=Object.freeze({"₊":"+","₋":"-","₌":"=","₍":"(","₎":")","₀":"0","₁":"1","₂":"2","₃":"3","₄":"4","₅":"5","₆":"6","₇":"7","₈":"8","₉":"9","ₐ":"a","ₑ":"e","ₕ":"h","ᵢ":"i","ⱼ":"j","ₖ":"k","ₗ":"l","ₘ":"m","ₙ":"n","ₒ":"o","ₚ":"p","ᵣ":"r","ₛ":"s","ₜ":"t","ᵤ":"u","ᵥ":"v","ₓ":"x","ᵦ":"β","ᵧ":"γ","ᵨ":"ρ","ᵩ":"ϕ","ᵪ":"χ","⁺":"+","⁻":"-","⁼":"=","⁽":"(","⁾":")","⁰":"0","¹":"1","²":"2","³":"3","⁴":"4","⁵":"5","⁶":"6","⁷":"7","⁸":"8","⁹":"9","ᴬ":"A","ᴮ":"B","ᴰ":"D","ᴱ":"E","ᴳ":"G","ᴴ":"H","ᴵ":"I","ᴶ":"J","ᴷ":"K","ᴸ":"L","ᴹ":"M","ᴺ":"N","ᴼ":"O","ᴾ":"P","ᴿ":"R","ᵀ":"T","ᵁ":"U","ⱽ":"V","ᵂ":"W","ᵃ":"a","ᵇ":"b","ᶜ":"c","ᵈ":"d","ᵉ":"e","ᶠ":"f","ᵍ":"g",ʰ:"h","ⁱ":"i",ʲ:"j","ᵏ":"k",ˡ:"l","ᵐ":"m",ⁿ:"n","ᵒ":"o","ᵖ":"p",ʳ:"r",ˢ:"s","ᵗ":"t","ᵘ":"u","ᵛ":"v",ʷ:"w",ˣ:"x",ʸ:"y","ᶻ":"z","ᵝ":"β","ᵞ":"γ","ᵟ":"δ","ᵠ":"ϕ","ᵡ":"χ","ᶿ":"θ"}),L4={"́":{text:"\\'",math:"\\acute"},"̀":{text:"\\`",math:"\\grave"},"̈":{text:'\\"',math:"\\ddot"},"̃":{text:"\\~",math:"\\tilde"},"̄":{text:"\\=",math:"\\bar"},"̆":{text:"\\u",math:"\\breve"},"̌":{text:"\\v",math:"\\check"},"̂":{text:"\\^",math:"\\hat"},"̇":{text:"\\.",math:"\\dot"},"̊":{text:"\\r",math:"\\mathring"},"̋":{text:"\\H"},"̧":{text:"\\c"}},EM={á:"á",à:"à",ä:"ä",ǟ:"ǟ",ã:"ã",ā:"ā",ă:"ă",ắ:"ắ",ằ:"ằ",ẵ:"ẵ",ǎ:"ǎ",â:"â",ấ:"ấ",ầ:"ầ",ẫ:"ẫ",ȧ:"ȧ",ǡ:"ǡ",å:"å",ǻ:"ǻ",ḃ:"ḃ",ć:"ć",ḉ:"ḉ",č:"č",ĉ:"ĉ",ċ:"ċ",ç:"ç",ď:"ď",ḋ:"ḋ",ḑ:"ḑ",é:"é",è:"è",ë:"ë",ẽ:"ẽ",ē:"ē",ḗ:"ḗ",ḕ:"ḕ",ĕ:"ĕ",ḝ:"ḝ",ě:"ě",ê:"ê",ế:"ế",ề:"ề",ễ:"ễ",ė:"ė",ȩ:"ȩ",ḟ:"ḟ",ǵ:"ǵ",ḡ:"ḡ",ğ:"ğ",ǧ:"ǧ",ĝ:"ĝ",ġ:"ġ",ģ:"ģ",ḧ:"ḧ",ȟ:"ȟ",ĥ:"ĥ",ḣ:"ḣ",ḩ:"ḩ",í:"í",ì:"ì",ï:"ï",ḯ:"ḯ",ĩ:"ĩ",ī:"ī",ĭ:"ĭ",ǐ:"ǐ",î:"î",ǰ:"ǰ",ĵ:"ĵ",ḱ:"ḱ",ǩ:"ǩ",ķ:"ķ",ĺ:"ĺ",ľ:"ľ",ļ:"ļ",ḿ:"ḿ",ṁ:"ṁ",ń:"ń",ǹ:"ǹ",ñ:"ñ",ň:"ň",ṅ:"ṅ",ņ:"ņ",ó:"ó",ò:"ò",ö:"ö",ȫ:"ȫ",õ:"õ",ṍ:"ṍ",ṏ:"ṏ",ȭ:"ȭ",ō:"ō",ṓ:"ṓ",ṑ:"ṑ",ŏ:"ŏ",ǒ:"ǒ",ô:"ô",ố:"ố",ồ:"ồ",ỗ:"ỗ",ȯ:"ȯ",ȱ:"ȱ",ő:"ő",ṕ:"ṕ",ṗ:"ṗ",ŕ:"ŕ",ř:"ř",ṙ:"ṙ",ŗ:"ŗ",ś:"ś",ṥ:"ṥ",š:"š",ṧ:"ṧ",ŝ:"ŝ",ṡ:"ṡ",ş:"ş",ẗ:"ẗ",ť:"ť",ṫ:"ṫ",ţ:"ţ",ú:"ú",ù:"ù",ü:"ü",ǘ:"ǘ",ǜ:"ǜ",ǖ:"ǖ",ǚ:"ǚ",ũ:"ũ",ṹ:"ṹ",ū:"ū",ṻ:"ṻ",ŭ:"ŭ",ǔ:"ǔ",û:"û",ů:"ů",ű:"ű",ṽ:"ṽ",ẃ:"ẃ",ẁ:"ẁ",ẅ:"ẅ",ŵ:"ŵ",ẇ:"ẇ",ẘ:"ẘ",ẍ:"ẍ",ẋ:"ẋ",ý:"ý",ỳ:"ỳ",ÿ:"ÿ",ỹ:"ỹ",ȳ:"ȳ",ŷ:"ŷ",ẏ:"ẏ",ẙ:"ẙ",ź:"ź",ž:"ž",ẑ:"ẑ",ż:"ż",Á:"Á",À:"À",Ä:"Ä",Ǟ:"Ǟ",Ã:"Ã",Ā:"Ā",Ă:"Ă",Ắ:"Ắ",Ằ:"Ằ",Ẵ:"Ẵ",Ǎ:"Ǎ",Â:"Â",Ấ:"Ấ",Ầ:"Ầ",Ẫ:"Ẫ",Ȧ:"Ȧ",Ǡ:"Ǡ",Å:"Å",Ǻ:"Ǻ",Ḃ:"Ḃ",Ć:"Ć",Ḉ:"Ḉ",Č:"Č",Ĉ:"Ĉ",Ċ:"Ċ",Ç:"Ç",Ď:"Ď",Ḋ:"Ḋ",Ḑ:"Ḑ",É:"É",È:"È",Ë:"Ë",Ẽ:"Ẽ",Ē:"Ē",Ḗ:"Ḗ",Ḕ:"Ḕ",Ĕ:"Ĕ",Ḝ:"Ḝ",Ě:"Ě",Ê:"Ê",Ế:"Ế",Ề:"Ề",Ễ:"Ễ",Ė:"Ė",Ȩ:"Ȩ",Ḟ:"Ḟ",Ǵ:"Ǵ",Ḡ:"Ḡ",Ğ:"Ğ",Ǧ:"Ǧ",Ĝ:"Ĝ",Ġ:"Ġ",Ģ:"Ģ",Ḧ:"Ḧ",Ȟ:"Ȟ",Ĥ:"Ĥ",Ḣ:"Ḣ",Ḩ:"Ḩ",Í:"Í",Ì:"Ì",Ï:"Ï",Ḯ:"Ḯ",Ĩ:"Ĩ",Ī:"Ī",Ĭ:"Ĭ",Ǐ:"Ǐ",Î:"Î",İ:"İ",Ĵ:"Ĵ",Ḱ:"Ḱ",Ǩ:"Ǩ",Ķ:"Ķ",Ĺ:"Ĺ",Ľ:"Ľ",Ļ:"Ļ",Ḿ:"Ḿ",Ṁ:"Ṁ",Ń:"Ń",Ǹ:"Ǹ",Ñ:"Ñ",Ň:"Ň",Ṅ:"Ṅ",Ņ:"Ņ",Ó:"Ó",Ò:"Ò",Ö:"Ö",Ȫ:"Ȫ",Õ:"Õ",Ṍ:"Ṍ",Ṏ:"Ṏ",Ȭ:"Ȭ",Ō:"Ō",Ṓ:"Ṓ",Ṑ:"Ṑ",Ŏ:"Ŏ",Ǒ:"Ǒ",Ô:"Ô",Ố:"Ố",Ồ:"Ồ",Ỗ:"Ỗ",Ȯ:"Ȯ",Ȱ:"Ȱ",Ő:"Ő",Ṕ:"Ṕ",Ṗ:"Ṗ",Ŕ:"Ŕ",Ř:"Ř",Ṙ:"Ṙ",Ŗ:"Ŗ",Ś:"Ś",Ṥ:"Ṥ",Š:"Š",Ṧ:"Ṧ",Ŝ:"Ŝ",Ṡ:"Ṡ",Ş:"Ş",Ť:"Ť",Ṫ:"Ṫ",Ţ:"Ţ",Ú:"Ú",Ù:"Ù",Ü:"Ü",Ǘ:"Ǘ",Ǜ:"Ǜ",Ǖ:"Ǖ",Ǚ:"Ǚ",Ũ:"Ũ",Ṹ:"Ṹ",Ū:"Ū",Ṻ:"Ṻ",Ŭ:"Ŭ",Ǔ:"Ǔ",Û:"Û",Ů:"Ů",Ű:"Ű",Ṽ:"Ṽ",Ẃ:"Ẃ",Ẁ:"Ẁ",Ẅ:"Ẅ",Ŵ:"Ŵ",Ẇ:"Ẇ",Ẍ:"Ẍ",Ẋ:"Ẋ",Ý:"Ý",Ỳ:"Ỳ",Ÿ:"Ÿ",Ỹ:"Ỹ",Ȳ:"Ȳ",Ŷ:"Ŷ",Ẏ:"Ẏ",Ź:"Ź",Ž:"Ž",Ẑ:"Ẑ",Ż:"Ż",ά:"ά",ὰ:"ὰ",ᾱ:"ᾱ",ᾰ:"ᾰ",έ:"έ",ὲ:"ὲ",ή:"ή",ὴ:"ὴ",ί:"ί",ὶ:"ὶ",ϊ:"ϊ",ΐ:"ΐ",ῒ:"ῒ",ῑ:"ῑ",ῐ:"ῐ",ό:"ό",ὸ:"ὸ",ύ:"ύ",ὺ:"ὺ",ϋ:"ϋ",ΰ:"ΰ",ῢ:"ῢ",ῡ:"ῡ",ῠ:"ῠ",ώ:"ώ",ὼ:"ὼ",Ύ:"Ύ",Ὺ:"Ὺ",Ϋ:"Ϋ",Ῡ:"Ῡ",Ῠ:"Ῠ",Ώ:"Ώ",Ὼ:"Ὼ"};class My{constructor(e,n){this.mode=void 0,this.gullet=void 0,this.settings=void 0,this.leftrightDepth=void 0,this.nextToken=void 0,this.mode="math",this.gullet=new E2e(e,n,this.mode),this.settings=n,this.leftrightDepth=0}expect(e,n){if(n===void 0&&(n=!0),this.fetch().text!==e)throw new $e("Expected '"+e+"', got '"+this.fetch().text+"'",this.fetch());n&&this.consume()}consume(){this.nextToken=null}fetch(){return this.nextToken==null&&(this.nextToken=this.gullet.expandNextToken()),this.nextToken}switchMode(e){this.mode=e,this.gullet.switchMode(e)}parse(){this.settings.globalGroup||this.gullet.beginGroup(),this.settings.colorIsTextColor&&this.gullet.macros.set("\\color","\\textcolor");try{var e=this.parseExpression(!1);return this.expect("EOF"),this.settings.globalGroup||this.gullet.endGroup(),e}finally{this.gullet.endGroups()}}subparse(e){var n=this.nextToken;this.consume(),this.gullet.pushToken(new Ri("}")),this.gullet.pushTokens(e);var r=this.parseExpression(!1);return this.expect("}"),this.nextToken=n,r}parseExpression(e,n){for(var r=[];;){this.mode==="math"&&this.consumeSpaces();var s=this.fetch();if(My.endOfExpression.indexOf(s.text)!==-1||n&&s.text===n||e&&fc[s.text]&&fc[s.text].infix)break;var i=this.parseAtom(n);if(i){if(i.type==="internal")continue}else break;r.push(i)}return this.mode==="text"&&this.formLigatures(r),this.handleInfixNodes(r)}handleInfixNodes(e){for(var n=-1,r,s=0;s=0&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+n[0]+'" used in math mode',e);var o=Jn[this.mode][n].group,c=Js.range(e),h;if(xbe.hasOwnProperty(o)){var f=o;h={type:"atom",mode:this.mode,family:f,loc:c,text:n}}else h={type:o,mode:this.mode,loc:c,text:n};a=h}else if(n.charCodeAt(0)>=128)this.settings.strict&&(Y$(n.charCodeAt(0))?this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Unicode text character "'+n[0]+'" used in math mode',e):this.settings.reportNonstrict("unknownSymbol",'Unrecognized Unicode character "'+n[0]+'"'+(" ("+n.charCodeAt(0)+")"),e)),a={type:"textord",mode:"text",loc:Js.range(e),text:n};else return null;if(this.consume(),i)for(var m=0;mh&&(h=f):f&&(h!==void 0&&h>-1&&c.push(` +`.repeat(h)||" "),h=-1,c.push(f))}return c.join("")}function GQ(t,e,n){return t.type==="element"?awe(t,e,n):t.type==="text"?n.whitespace==="normal"?XQ(t,n):lwe(t):[]}function awe(t,e,n){const r=YQ(t,n),s=t.children||[];let i=-1,a=[];if(swe(t))return a;let o,c;for(bk(t)||IM(t)&&DM(e,t,IM)?c=` +`:rwe(t)?(o=2,c=2):WQ(t)&&(o=1,c=1);++i{try{i(!0);const Oe=await xwe({page:a,page_size:f,is_registered:g==="all"?void 0:g==="registered",is_banned:y==="all"?void 0:y==="banned",format:S==="all"?void 0:S,sort_by:N,sort_order:T});e(Oe.data),h(Oe.total)}catch(Oe){const He=Oe instanceof Error?Oe.message:"加载表情包列表失败";W({title:"错误",description:He,variant:"destructive"})}finally{i(!1)}},[a,f,g,y,S,N,T,W]),V=async()=>{try{const Oe=await wwe();r(Oe.data)}catch(Oe){console.error("加载统计数据失败:",Oe)}};b.useEffect(()=>{F()},[F]),b.useEffect(()=>{V()},[]);const te=async Oe=>{try{const He=await vwe(Oe.id);M(He.data),P(!0)}catch(He){const Ve=He instanceof Error?He.message:"加载详情失败";W({title:"错误",description:Ve,variant:"destructive"})}},ne=Oe=>{M(Oe),Q(!0)},K=Oe=>{M(Oe),ee(!0)},ie=async()=>{if(E)try{await bwe(E.id),W({title:"成功",description:"表情包已删除"}),ee(!1),M(null),F(),V()}catch(Oe){const He=Oe instanceof Error?Oe.message:"删除失败";W({title:"错误",description:He,variant:"destructive"})}},re=async Oe=>{try{await Swe(Oe.id),W({title:"成功",description:"表情包已注册"}),F(),V()}catch(He){const Ve=He instanceof Error?He.message:"注册失败";W({title:"错误",description:Ve,variant:"destructive"})}},ae=async Oe=>{try{await kwe(Oe.id),W({title:"成功",description:"表情包已封禁"}),F(),V()}catch(He){const Ve=He instanceof Error?He.message:"封禁失败";W({title:"错误",description:Ve,variant:"destructive"})}},_e=Oe=>{const He=new Set(z);He.has(Oe)?He.delete(Oe):He.add(Oe),H(He)},Ue=async()=>{try{const Oe=await jwe(Array.from(z));W({title:"批量删除完成",description:Oe.message}),H(new Set),X(!1),F(),V()}catch(Oe){W({title:"批量删除失败",description:Oe instanceof Error?Oe.message:"批量删除失败",variant:"destructive"})}},Xe=()=>{const Oe=parseInt(J),He=Math.ceil(c/f);Oe>=1&&Oe<=He?(o(Oe),G("")):W({title:"无效的页码",description:`请输入1-${He}之间的页码`,variant:"destructive"})},Ze=n?.formats?Object.keys(n.formats):[];return l.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[l.jsxs("div",{className:"mb-4 sm:mb-6",children:[l.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"表情包管理"}),l.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"管理麦麦的表情包资源"})]}),l.jsx(hn,{className:"flex-1",children:l.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[n&&l.jsxs("div",{className:"grid gap-4 grid-cols-2 lg:grid-cols-4",children:[l.jsx(Dt,{children:l.jsxs(kn,{className:"pb-2",children:[l.jsx(Fr,{children:"总数"}),l.jsx(jn,{className:"text-2xl",children:n.total})]})}),l.jsx(Dt,{children:l.jsxs(kn,{className:"pb-2",children:[l.jsx(Fr,{children:"已注册"}),l.jsx(jn,{className:"text-2xl text-green-600",children:n.registered})]})}),l.jsx(Dt,{children:l.jsxs(kn,{className:"pb-2",children:[l.jsx(Fr,{children:"已封禁"}),l.jsx(jn,{className:"text-2xl text-red-600",children:n.banned})]})}),l.jsx(Dt,{children:l.jsxs(kn,{className:"pb-2",children:[l.jsx(Fr,{children:"未注册"}),l.jsx(jn,{className:"text-2xl text-gray-600",children:n.unregistered})]})})]}),l.jsxs(Dt,{children:[l.jsx(kn,{children:l.jsxs(jn,{className:"flex items-center gap-2",children:[l.jsx(P3,{className:"h-5 w-5"}),"筛选和排序"]})}),l.jsxs(Dn,{className:"space-y-4",children:[l.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"排序方式"}),l.jsxs(qt,{value:`${N}-${T}`,onValueChange:Oe=>{const[He,Ve]=Oe.split("-");C(He),_(Ve),o(1)},children:[l.jsx(It,{children:l.jsx(Ft,{})}),l.jsxs(Bt,{children:[l.jsx(De,{value:"usage_count-desc",children:"使用次数 (多→少)"}),l.jsx(De,{value:"usage_count-asc",children:"使用次数 (少→多)"}),l.jsx(De,{value:"register_time-desc",children:"注册时间 (新→旧)"}),l.jsx(De,{value:"register_time-asc",children:"注册时间 (旧→新)"}),l.jsx(De,{value:"record_time-desc",children:"记录时间 (新→旧)"}),l.jsx(De,{value:"record_time-asc",children:"记录时间 (旧→新)"}),l.jsx(De,{value:"last_used_time-desc",children:"最后使用 (新→旧)"}),l.jsx(De,{value:"last_used_time-asc",children:"最后使用 (旧→新)"})]})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"注册状态"}),l.jsxs(qt,{value:g,onValueChange:Oe=>{x(Oe),o(1)},children:[l.jsx(It,{children:l.jsx(Ft,{})}),l.jsxs(Bt,{children:[l.jsx(De,{value:"all",children:"全部"}),l.jsx(De,{value:"registered",children:"已注册"}),l.jsx(De,{value:"unregistered",children:"未注册"})]})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"封禁状态"}),l.jsxs(qt,{value:y,onValueChange:Oe=>{w(Oe),o(1)},children:[l.jsx(It,{children:l.jsx(Ft,{})}),l.jsxs(Bt,{children:[l.jsx(De,{value:"all",children:"全部"}),l.jsx(De,{value:"banned",children:"已封禁"}),l.jsx(De,{value:"unbanned",children:"未封禁"})]})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"格式"}),l.jsxs(qt,{value:S,onValueChange:Oe=>{k(Oe),o(1)},children:[l.jsx(It,{children:l.jsx(Ft,{})}),l.jsxs(Bt,{children:[l.jsx(De,{value:"all",children:"全部"}),Ze.map(Oe=>l.jsxs(De,{value:Oe,children:[Oe.toUpperCase()," (",n?.formats[Oe],")"]},Oe))]})]})]})]}),l.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 pt-4 border-t",children:[l.jsxs("div",{className:"flex items-center gap-4",children:[z.size>0&&l.jsxs("span",{className:"text-sm text-muted-foreground",children:["已选择 ",z.size," 个表情包"]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(ue,{className:"text-sm whitespace-nowrap",children:"卡片大小"}),l.jsxs(qt,{value:R,onValueChange:Oe=>se(Oe),children:[l.jsx(It,{className:"w-24",children:l.jsx(Ft,{})}),l.jsxs(Bt,{children:[l.jsx(De,{value:"small",children:"小"}),l.jsx(De,{value:"medium",children:"中"}),l.jsx(De,{value:"large",children:"大"})]})]})]})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(ue,{htmlFor:"emoji-page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),l.jsxs(qt,{value:f.toString(),onValueChange:Oe=>{m(parseInt(Oe)),o(1),H(new Set)},children:[l.jsx(It,{id:"emoji-page-size",className:"w-20",children:l.jsx(Ft,{})}),l.jsxs(Bt,{children:[l.jsx(De,{value:"20",children:"20"}),l.jsx(De,{value:"40",children:"40"}),l.jsx(De,{value:"60",children:"60"}),l.jsx(De,{value:"100",children:"100"})]})]}),z.size>0&&l.jsxs(l.Fragment,{children:[l.jsx(de,{variant:"outline",size:"sm",onClick:()=>H(new Set),children:"取消选择"}),l.jsxs(de,{variant:"destructive",size:"sm",onClick:()=>X(!0),children:[l.jsx(fn,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]})]}),l.jsx("div",{className:"flex justify-end pt-4 border-t",children:l.jsxs(de,{variant:"outline",size:"sm",onClick:F,disabled:s,children:[l.jsx(Ls,{className:`h-4 w-4 mr-2 ${s?"animate-spin":""}`}),"刷新"]})})]})]}),l.jsxs(Dt,{children:[l.jsxs(kn,{children:[l.jsx(jn,{children:"表情包列表"}),l.jsxs(Fr,{children:["共 ",c," 个表情包,当前第 ",a," 页"]})]}),l.jsxs(Dn,{children:[t.length===0?l.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"暂无数据"}):l.jsx("div",{className:`grid gap-3 ${R==="small"?"grid-cols-3 sm:grid-cols-4 md:grid-cols-6 lg:grid-cols-8 xl:grid-cols-10":R==="medium"?"grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6 xl:grid-cols-8":"grid-cols-2 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5"}`,children:t.map(Oe=>l.jsxs("div",{className:`group relative rounded-lg border bg-card overflow-hidden hover:ring-2 hover:ring-primary transition-all cursor-pointer ${z.has(Oe.id)?"ring-2 ring-primary bg-primary/5":""}`,onClick:()=>_e(Oe.id),children:[l.jsx("div",{className:`absolute top-1 left-1 z-10 transition-opacity ${z.has(Oe.id)?"opacity-100":"opacity-0 group-hover:opacity-100"}`,children:l.jsx("div",{className:`w-5 h-5 rounded-full border-2 flex items-center justify-center ${z.has(Oe.id)?"bg-primary border-primary text-primary-foreground":"bg-background/80 border-muted-foreground/50"}`,children:z.has(Oe.id)&&l.jsx(xc,{className:"h-3 w-3"})})}),l.jsxs("div",{className:"absolute top-1 right-1 z-10 flex flex-col gap-0.5",children:[Oe.is_registered&&l.jsx(In,{variant:"default",className:"bg-green-600 text-[10px] px-1 py-0",children:"已注册"}),Oe.is_banned&&l.jsx(In,{variant:"destructive",className:"text-[10px] px-1 py-0",children:"已封禁"})]}),l.jsx("div",{className:`aspect-square bg-muted flex items-center justify-center overflow-hidden ${R==="small"?"p-1":R==="medium"?"p-2":"p-3"}`,children:l.jsx("img",{src:KQ(Oe.id),alt:"表情包",className:"w-full h-full object-contain",loading:"lazy",onError:He=>{const Ve=He.target;Ve.style.display="none";const Be=Ve.parentElement;Be&&(Be.innerHTML='')}})}),l.jsxs("div",{className:`border-t bg-card ${R==="small"?"p-1":"p-2"}`,children:[l.jsxs("div",{className:"flex items-center justify-between gap-1 text-xs text-muted-foreground mb-1",children:[l.jsx(In,{variant:"outline",className:"text-[10px] px-1 py-0",children:Oe.format.toUpperCase()}),l.jsxs("span",{className:"font-mono",children:[Oe.usage_count,"次"]})]}),l.jsxs("div",{className:`flex gap-1 justify-center opacity-0 group-hover:opacity-100 transition-opacity ${R==="small"?"flex-wrap":""}`,children:[l.jsx(de,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:He=>{He.stopPropagation(),ne(Oe)},title:"编辑",children:l.jsx(Qm,{className:"h-3 w-3"})}),l.jsx(de,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:He=>{He.stopPropagation(),te(Oe)},title:"详情",children:l.jsx(ra,{className:"h-3 w-3"})}),!Oe.is_registered&&l.jsx(de,{variant:"ghost",size:"icon",className:"h-6 w-6 text-green-600 hover:text-green-700",onClick:He=>{He.stopPropagation(),re(Oe)},title:"注册",children:l.jsx(xc,{className:"h-3 w-3"})}),!Oe.is_banned&&l.jsx(de,{variant:"ghost",size:"icon",className:"h-6 w-6 text-orange-600 hover:text-orange-700",onClick:He=>{He.stopPropagation(),ae(Oe)},title:"封禁",children:l.jsx(HK,{className:"h-3 w-3"})}),l.jsx(de,{variant:"ghost",size:"icon",className:"h-6 w-6 text-red-600 hover:text-red-700",onClick:He=>{He.stopPropagation(),K(Oe)},title:"删除",children:l.jsx(fn,{className:"h-3 w-3"})})]})]})]},Oe.id))}),c>0&&l.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[l.jsxs("div",{className:"text-sm text-muted-foreground",children:["显示 ",(a-1)*f+1," 到"," ",Math.min(a*f,c)," 条,共 ",c," 条"]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(de,{variant:"outline",size:"sm",onClick:()=>o(1),disabled:a===1,className:"hidden sm:flex",children:l.jsx(L0,{className:"h-4 w-4"})}),l.jsxs(de,{variant:"outline",size:"sm",onClick:()=>o(Oe=>Math.max(1,Oe-1)),disabled:a===1,children:[l.jsx($u,{className:"h-4 w-4 sm:mr-1"}),l.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Pe,{type:"number",value:J,onChange:Oe=>G(Oe.target.value),onKeyDown:Oe=>Oe.key==="Enter"&&Xe(),placeholder:a.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(c/f)}),l.jsx(de,{variant:"outline",size:"sm",onClick:Xe,disabled:!J,className:"h-8",children:"跳转"})]}),l.jsxs(de,{variant:"outline",size:"sm",onClick:()=>o(Oe=>Oe+1),disabled:a>=Math.ceil(c/f),children:[l.jsx("span",{className:"hidden sm:inline",children:"下一页"}),l.jsx(Qu,{className:"h-4 w-4 sm:ml-1"})]}),l.jsx(de,{variant:"outline",size:"sm",onClick:()=>o(Math.ceil(c/f)),disabled:a>=Math.ceil(c/f),className:"hidden sm:flex",children:l.jsx(I0,{className:"h-4 w-4"})})]})]})]})]}),l.jsx(Nwe,{emoji:E,open:L,onOpenChange:P}),l.jsx(Cwe,{emoji:E,open:I,onOpenChange:Q,onSuccess:()=>{F(),V()}})]})}),l.jsx(Nn,{open:B,onOpenChange:X,children:l.jsxs(gn,{children:[l.jsxs(xn,{children:[l.jsx(yn,{children:"确认批量删除"}),l.jsxs(bn,{children:["你确定要删除选中的 ",z.size," 个表情包吗?此操作不可撤销。"]})]}),l.jsxs(vn,{children:[l.jsx(Sn,{children:"取消"}),l.jsx(wn,{onClick:Ue,children:"确认删除"})]})]})}),l.jsx(xr,{open:U,onOpenChange:ee,children:l.jsxs(lr,{children:[l.jsxs(or,{children:[l.jsx(cr,{children:"确认删除"}),l.jsx(Hr,{children:"确定要删除这个表情包吗?此操作无法撤销。"})]}),l.jsxs(as,{children:[l.jsx(de,{variant:"outline",onClick:()=>ee(!1),children:"取消"}),l.jsx(de,{variant:"destructive",onClick:ie,children:"删除"})]})]})})]})}function Nwe({emoji:t,open:e,onOpenChange:n}){if(!t)return null;const r=s=>s?new Date(s*1e3).toLocaleString("zh-CN"):"-";return l.jsx(xr,{open:e,onOpenChange:n,children:l.jsxs(lr,{className:"max-w-2xl max-h-[90vh]",children:[l.jsx(or,{children:l.jsx(cr,{children:"表情包详情"})}),l.jsx(hn,{className:"max-h-[calc(90vh-8rem)] pr-4",children:l.jsxs("div",{className:"space-y-4",children:[l.jsx("div",{className:"flex justify-center",children:l.jsx("div",{className:"w-32 h-32 bg-muted rounded-lg flex items-center justify-center overflow-hidden",children:l.jsx("img",{src:KQ(t.id),alt:t.description||"表情包",className:"w-full h-full object-cover",onError:s=>{const i=s.target;i.style.display="none";const a=i.parentElement;a&&(a.innerHTML='')}})})}),l.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[l.jsxs("div",{children:[l.jsx(ue,{className:"text-muted-foreground",children:"ID"}),l.jsx("div",{className:"mt-1 font-mono",children:t.id})]}),l.jsxs("div",{children:[l.jsx(ue,{className:"text-muted-foreground",children:"格式"}),l.jsx("div",{className:"mt-1",children:l.jsx(In,{variant:"outline",children:t.format.toUpperCase()})})]})]}),l.jsxs("div",{children:[l.jsx(ue,{className:"text-muted-foreground",children:"文件路径"}),l.jsx("div",{className:"mt-1 font-mono text-sm break-all bg-muted p-2 rounded",children:t.full_path})]}),l.jsxs("div",{children:[l.jsx(ue,{className:"text-muted-foreground",children:"哈希值"}),l.jsx("div",{className:"mt-1 font-mono text-sm break-all bg-muted p-2 rounded",children:t.emoji_hash})]}),l.jsxs("div",{children:[l.jsx(ue,{className:"text-muted-foreground",children:"描述"}),t.description?l.jsx("div",{className:"mt-1 rounded-lg border bg-muted/50 p-3",children:l.jsx(gwe,{className:"prose-sm",children:t.description})}):l.jsx("div",{className:"mt-1 text-sm text-muted-foreground",children:"-"})]}),l.jsxs("div",{children:[l.jsx(ue,{className:"text-muted-foreground",children:"情绪"}),l.jsx("div",{className:"mt-1",children:t.emotion?l.jsx("span",{className:"text-sm",children:t.emotion}):l.jsx("span",{className:"text-sm text-muted-foreground",children:"-"})})]}),l.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[l.jsxs("div",{children:[l.jsx(ue,{className:"text-muted-foreground",children:"状态"}),l.jsxs("div",{className:"mt-2 flex gap-2",children:[t.is_registered&&l.jsx(In,{variant:"default",className:"bg-green-600",children:"已注册"}),t.is_banned&&l.jsx(In,{variant:"destructive",children:"已封禁"}),!t.is_registered&&!t.is_banned&&l.jsx(In,{variant:"outline",children:"未注册"})]})]}),l.jsxs("div",{children:[l.jsx(ue,{className:"text-muted-foreground",children:"使用次数"}),l.jsx("div",{className:"mt-1 font-mono text-lg",children:t.usage_count})]})]}),l.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[l.jsxs("div",{children:[l.jsx(ue,{className:"text-muted-foreground",children:"记录时间"}),l.jsx("div",{className:"mt-1 text-sm",children:r(t.record_time)})]}),l.jsxs("div",{children:[l.jsx(ue,{className:"text-muted-foreground",children:"注册时间"}),l.jsx("div",{className:"mt-1 text-sm",children:r(t.register_time)})]})]}),l.jsxs("div",{children:[l.jsx(ue,{className:"text-muted-foreground",children:"最后使用"}),l.jsx("div",{className:"mt-1 text-sm",children:r(t.last_used_time)})]})]})})]})})}function Cwe({emoji:t,open:e,onOpenChange:n,onSuccess:r}){const[s,i]=b.useState(""),[a,o]=b.useState(!1),[c,h]=b.useState(!1),[f,m]=b.useState(!1),{toast:g}=ts();b.useEffect(()=>{t&&(i(t.emotion||""),o(t.is_registered),h(t.is_banned))},[t]);const x=async()=>{if(t)try{m(!0);const y=s.split(/[,,]/).map(w=>w.trim()).filter(Boolean).join(",");await ywe(t.id,{emotion:y||void 0,is_registered:a,is_banned:c}),g({title:"成功",description:"表情包信息已更新"}),n(!1),r()}catch(y){const w=y instanceof Error?y.message:"保存失败";g({title:"错误",description:w,variant:"destructive"})}finally{m(!1)}};return t?l.jsx(xr,{open:e,onOpenChange:n,children:l.jsxs(lr,{className:"max-w-2xl",children:[l.jsxs(or,{children:[l.jsx(cr,{children:"编辑表情包"}),l.jsx(Hr,{children:"修改表情包的情绪和状态信息"})]}),l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{children:[l.jsx(ue,{children:"情绪"}),l.jsx(pr,{value:s,onChange:y=>i(y.target.value),placeholder:"输入情绪描述...",rows:2,className:"mt-1"}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"输入情绪相关的文本描述"})]}),l.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(li,{id:"is_registered",checked:a,onCheckedChange:y=>{y===!0?(o(!0),h(!1)):o(!1)}}),l.jsx(ue,{htmlFor:"is_registered",className:"cursor-pointer",children:"已注册"})]}),l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(li,{id:"is_banned",checked:c,onCheckedChange:y=>{y===!0?(h(!0),o(!1)):h(!1)}}),l.jsx(ue,{htmlFor:"is_banned",className:"cursor-pointer",children:"已封禁"})]})]})]}),l.jsxs(as,{children:[l.jsx(de,{variant:"outline",onClick:()=>n(!1),children:"取消"}),l.jsx(de,{onClick:x,disabled:f,children:f?"保存中...":"保存"})]})]})}):null}const Lc="/api/webui/expression";async function Twe(){const t=await pt(`${Lc}/chats`,{headers:Ct()});if(!t.ok){const e=await t.json();throw new Error(e.detail||"获取聊天列表失败")}return t.json()}async function Ewe(t){const e=new URLSearchParams;t.page&&e.append("page",t.page.toString()),t.page_size&&e.append("page_size",t.page_size.toString()),t.search&&e.append("search",t.search),t.chat_id&&e.append("chat_id",t.chat_id);const n=await pt(`${Lc}/list?${e}`,{headers:Ct()});if(!n.ok){const r=await n.json();throw new Error(r.detail||"获取表达方式列表失败")}return n.json()}async function _we(t){const e=await pt(`${Lc}/${t}`,{headers:Ct()});if(!e.ok){const n=await e.json();throw new Error(n.detail||"获取表达方式详情失败")}return e.json()}async function Mwe(t){const e=await pt(`${Lc}/`,{method:"POST",headers:Ct(),body:JSON.stringify(t)});if(!e.ok){const n=await e.json();throw new Error(n.detail||"创建表达方式失败")}return e.json()}async function Awe(t,e){const n=await pt(`${Lc}/${t}`,{method:"PATCH",headers:Ct(),body:JSON.stringify(e)});if(!n.ok){const r=await n.json();throw new Error(r.detail||"更新表达方式失败")}return n.json()}async function Rwe(t){const e=await pt(`${Lc}/${t}`,{method:"DELETE",headers:Ct()});if(!e.ok){const n=await e.json();throw new Error(n.detail||"删除表达方式失败")}return e.json()}async function Dwe(t){const e=await pt(`${Lc}/batch/delete`,{method:"POST",headers:Ct(),body:JSON.stringify({ids:t})});if(!e.ok){const n=await e.json();throw new Error(n.detail||"批量删除表达方式失败")}return e.json()}async function zwe(){const t=await pt(`${Lc}/stats/summary`,{headers:Ct()});if(!t.ok){const e=await t.json();throw new Error(e.detail||"获取统计数据失败")}return t.json()}function Pwe(){const[t,e]=b.useState([]),[n,r]=b.useState(!0),[s,i]=b.useState(0),[a,o]=b.useState(1),[c,h]=b.useState(20),[f,m]=b.useState(""),[g,x]=b.useState(null),[y,w]=b.useState(!1),[S,k]=b.useState(!1),[N,C]=b.useState(!1),[T,_]=b.useState(null),[E,M]=b.useState(new Set),[L,P]=b.useState(!1),[I,Q]=b.useState(""),[U,ee]=b.useState({total:0,recent_7days:0,chat_count:0,top_chats:{}}),[z,H]=b.useState([]),[B,X]=b.useState(new Map),{toast:J}=ts(),G=async()=>{try{r(!0);const ae=await Ewe({page:a,page_size:c,search:f||void 0});e(ae.data),i(ae.total)}catch(ae){J({title:"加载失败",description:ae instanceof Error?ae.message:"无法加载表达方式",variant:"destructive"})}finally{r(!1)}},R=async()=>{try{const ae=await zwe();ae?.data&&ee(ae.data)}catch(ae){console.error("加载统计数据失败:",ae)}},se=async()=>{try{const ae=await Twe();if(ae?.data){H(ae.data);const _e=new Map;ae.data.forEach(Ue=>{_e.set(Ue.chat_id,Ue.chat_name)}),X(_e)}}catch(ae){console.error("加载聊天列表失败:",ae)}},W=ae=>B.get(ae)||ae;b.useEffect(()=>{G(),R(),se()},[a,c,f]);const F=async ae=>{try{const _e=await _we(ae.id);x(_e.data),w(!0)}catch(_e){J({title:"加载详情失败",description:_e instanceof Error?_e.message:"无法加载表达方式详情",variant:"destructive"})}},V=ae=>{x(ae),k(!0)},te=async ae=>{try{await Rwe(ae.id),J({title:"删除成功",description:`已删除表达方式: ${ae.situation}`}),_(null),G(),R()}catch(_e){J({title:"删除失败",description:_e instanceof Error?_e.message:"无法删除表达方式",variant:"destructive"})}},ne=ae=>{const _e=new Set(E);_e.has(ae)?_e.delete(ae):_e.add(ae),M(_e)},K=()=>{E.size===t.length&&t.length>0?M(new Set):M(new Set(t.map(ae=>ae.id)))},ie=async()=>{try{await Dwe(Array.from(E)),J({title:"批量删除成功",description:`已删除 ${E.size} 个表达方式`}),M(new Set),P(!1),G(),R()}catch(ae){J({title:"批量删除失败",description:ae instanceof Error?ae.message:"无法批量删除表达方式",variant:"destructive"})}},re=()=>{const ae=parseInt(I),_e=Math.ceil(s/c);ae>=1&&ae<=_e?(o(ae),Q("")):J({title:"无效的页码",description:`请输入1-${_e}之间的页码`,variant:"destructive"})};return l.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[l.jsx("div",{className:"mb-4 sm:mb-6",children:l.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[l.jsxs("div",{children:[l.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[l.jsx(z0,{className:"h-8 w-8",strokeWidth:2}),"表达方式管理"]}),l.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"管理麦麦的表达方式和话术模板"})]}),l.jsxs(de,{onClick:()=>C(!0),className:"gap-2",children:[l.jsx(ws,{className:"h-4 w-4"}),"新增表达方式"]})]})}),l.jsx(hn,{className:"flex-1",children:l.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[l.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[l.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[l.jsx("div",{className:"text-sm text-muted-foreground",children:"总数量"}),l.jsx("div",{className:"text-2xl font-bold mt-1",children:U.total})]}),l.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[l.jsx("div",{className:"text-sm text-muted-foreground",children:"近7天新增"}),l.jsx("div",{className:"text-2xl font-bold mt-1 text-green-600",children:U.recent_7days})]}),l.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[l.jsx("div",{className:"text-sm text-muted-foreground",children:"关联聊天数"}),l.jsx("div",{className:"text-2xl font-bold mt-1 text-blue-600",children:U.chat_count})]})]}),l.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[l.jsx(ue,{htmlFor:"search",children:"搜索"}),l.jsx("div",{className:"flex flex-col sm:flex-row gap-2 mt-1.5",children:l.jsxs("div",{className:"flex-1 relative",children:[l.jsx(ci,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),l.jsx(Pe,{id:"search",placeholder:"搜索情境、风格或上下文...",value:f,onChange:ae=>m(ae.target.value),className:"pl-9"})]})}),l.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 mt-4 pt-4 border-t",children:[l.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:E.size>0&&l.jsxs("span",{children:["已选择 ",E.size," 个表达方式"]})}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(ue,{htmlFor:"page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),l.jsxs(qt,{value:c.toString(),onValueChange:ae=>{h(parseInt(ae)),o(1),M(new Set)},children:[l.jsx(It,{id:"page-size",className:"w-20",children:l.jsx(Ft,{})}),l.jsxs(Bt,{children:[l.jsx(De,{value:"10",children:"10"}),l.jsx(De,{value:"20",children:"20"}),l.jsx(De,{value:"50",children:"50"}),l.jsx(De,{value:"100",children:"100"})]})]}),E.size>0&&l.jsxs(l.Fragment,{children:[l.jsx(de,{variant:"outline",size:"sm",onClick:()=>M(new Set),children:"取消选择"}),l.jsxs(de,{variant:"destructive",size:"sm",onClick:()=>P(!0),children:[l.jsx(fn,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]})]})]}),l.jsxs("div",{className:"rounded-lg border bg-card",children:[l.jsx("div",{className:"hidden md:block",children:l.jsxs(Vh,{children:[l.jsx(Uh,{children:l.jsxs(bs,{children:[l.jsx(ln,{className:"w-12",children:l.jsx(li,{checked:E.size===t.length&&t.length>0,onCheckedChange:K})}),l.jsx(ln,{children:"情境"}),l.jsx(ln,{children:"风格"}),l.jsx(ln,{children:"聊天"}),l.jsx(ln,{className:"text-right",children:"操作"})]})}),l.jsx(Wh,{children:n?l.jsx(bs,{children:l.jsx(Qt,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):t.length===0?l.jsx(bs,{children:l.jsx(Qt,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):t.map(ae=>l.jsxs(bs,{children:[l.jsx(Qt,{children:l.jsx(li,{checked:E.has(ae.id),onCheckedChange:()=>ne(ae.id)})}),l.jsx(Qt,{className:"font-medium max-w-xs truncate",children:ae.situation}),l.jsx(Qt,{className:"max-w-xs truncate",children:ae.style}),l.jsx(Qt,{className:"max-w-[200px] truncate",title:W(ae.chat_id),style:{wordBreak:"keep-all"},children:l.jsx("span",{className:"whitespace-nowrap overflow-hidden text-ellipsis block",children:W(ae.chat_id)})}),l.jsx(Qt,{className:"text-right",children:l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsxs(de,{variant:"default",size:"sm",onClick:()=>V(ae),children:[l.jsx(Qm,{className:"h-4 w-4 mr-1"}),"编辑"]}),l.jsx(de,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>F(ae),title:"查看详情",children:l.jsx(oa,{className:"h-4 w-4"})}),l.jsxs(de,{size:"sm",onClick:()=>_(ae),className:"bg-red-600 hover:bg-red-700 text-white",children:[l.jsx(fn,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},ae.id))})]})}),l.jsx("div",{className:"md:hidden space-y-3 p-4",children:n?l.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):t.length===0?l.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):t.map(ae=>l.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3 overflow-hidden",children:[l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx(li,{checked:E.has(ae.id),onCheckedChange:()=>ne(ae.id),className:"mt-1"}),l.jsxs("div",{className:"min-w-0 flex-1 overflow-hidden space-y-2",children:[l.jsxs("div",{children:[l.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"情境"}),l.jsx("h3",{className:"font-semibold text-sm line-clamp-2 w-full break-all",title:ae.situation,children:ae.situation})]}),l.jsxs("div",{children:[l.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"风格"}),l.jsx("p",{className:"text-sm line-clamp-2 w-full break-all",title:ae.style,children:ae.style})]})]})]}),l.jsxs("div",{className:"text-sm",children:[l.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"聊天"}),l.jsx("p",{className:"text-sm truncate",title:W(ae.chat_id),style:{wordBreak:"keep-all"},children:W(ae.chat_id)})]}),l.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t overflow-hidden",children:[l.jsxs(de,{variant:"outline",size:"sm",onClick:()=>V(ae),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[l.jsx(Qm,{className:"h-3 w-3 mr-1"}),"编辑"]}),l.jsx(de,{variant:"outline",size:"sm",onClick:()=>F(ae),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:l.jsx(oa,{className:"h-3 w-3"})}),l.jsxs(de,{variant:"outline",size:"sm",onClick:()=>_(ae),className:"text-xs px-2 py-1 h-auto flex-shrink-0 text-destructive hover:text-destructive",children:[l.jsx(fn,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},ae.id))}),s>0&&l.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 px-4 py-3 border-t",children:[l.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",s," 条记录,第 ",a," / ",Math.ceil(s/c)," 页"]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(de,{variant:"outline",size:"sm",onClick:()=>o(1),disabled:a===1,className:"hidden sm:flex",children:l.jsx(L0,{className:"h-4 w-4"})}),l.jsxs(de,{variant:"outline",size:"sm",onClick:()=>o(a-1),disabled:a===1,children:[l.jsx($u,{className:"h-4 w-4 sm:mr-1"}),l.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Pe,{type:"number",value:I,onChange:ae=>Q(ae.target.value),onKeyDown:ae=>ae.key==="Enter"&&re(),placeholder:a.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(s/c)}),l.jsx(de,{variant:"outline",size:"sm",onClick:re,disabled:!I,className:"h-8",children:"跳转"})]}),l.jsxs(de,{variant:"outline",size:"sm",onClick:()=>o(a+1),disabled:a>=Math.ceil(s/c),children:[l.jsx("span",{className:"hidden sm:inline",children:"下一页"}),l.jsx(Qu,{className:"h-4 w-4 sm:ml-1"})]}),l.jsx(de,{variant:"outline",size:"sm",onClick:()=>o(Math.ceil(s/c)),disabled:a>=Math.ceil(s/c),className:"hidden sm:flex",children:l.jsx(I0,{className:"h-4 w-4"})})]})]})]})]})}),l.jsx(Lwe,{expression:g,open:y,onOpenChange:w,chatNameMap:B}),l.jsx(Iwe,{open:N,onOpenChange:C,chatList:z,onSuccess:()=>{G(),R(),C(!1)}}),l.jsx(Bwe,{expression:g,open:S,onOpenChange:k,chatList:z,onSuccess:()=>{G(),R(),k(!1)}}),l.jsx(Nn,{open:!!T,onOpenChange:()=>_(null),children:l.jsxs(gn,{children:[l.jsxs(xn,{children:[l.jsx(yn,{children:"确认删除"}),l.jsxs(bn,{children:['确定要删除表达方式 "',T?.situation,'" 吗? 此操作不可撤销。']})]}),l.jsxs(vn,{children:[l.jsx(Sn,{children:"取消"}),l.jsx(wn,{onClick:()=>T&&te(T),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})}),l.jsx(qwe,{open:L,onOpenChange:P,onConfirm:ie,count:E.size})]})}function Lwe({expression:t,open:e,onOpenChange:n,chatNameMap:r}){if(!t)return null;const s=a=>a?new Date(a*1e3).toLocaleString("zh-CN"):"-",i=a=>r.get(a)||a;return l.jsx(xr,{open:e,onOpenChange:n,children:l.jsxs(lr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[l.jsxs(or,{children:[l.jsx(cr,{children:"表达方式详情"}),l.jsx(Hr,{children:"查看表达方式的完整信息"})]}),l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[l.jsx(om,{label:"情境",value:t.situation}),l.jsx(om,{label:"风格",value:t.style}),l.jsx(om,{label:"聊天",value:i(t.chat_id)}),l.jsx(om,{icon:L3,label:"记录ID",value:t.id.toString(),mono:!0})]}),l.jsx("div",{className:"grid grid-cols-2 gap-4",children:l.jsx(om,{icon:Zd,label:"创建时间",value:s(t.create_date)})})]}),l.jsx(as,{children:l.jsx(de,{onClick:()=>n(!1),children:"关闭"})})]})})}function om({icon:t,label:e,value:n,mono:r=!1}){return l.jsxs("div",{className:"space-y-1",children:[l.jsxs(ue,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[t&&l.jsx(t,{className:"h-3 w-3"}),e]}),l.jsx("div",{className:ve("text-sm",r&&"font-mono",!n&&"text-muted-foreground"),children:n||"-"})]})}function Iwe({open:t,onOpenChange:e,chatList:n,onSuccess:r}){const[s,i]=b.useState({situation:"",style:"",chat_id:""}),[a,o]=b.useState(!1),{toast:c}=ts(),h=async()=>{if(!s.situation||!s.style||!s.chat_id){c({title:"验证失败",description:"请填写必填字段:情境、风格和聊天",variant:"destructive"});return}try{o(!0),await Mwe(s),c({title:"创建成功",description:"表达方式已创建"}),i({situation:"",style:"",chat_id:""}),r()}catch(f){c({title:"创建失败",description:f instanceof Error?f.message:"无法创建表达方式",variant:"destructive"})}finally{o(!1)}};return l.jsx(xr,{open:t,onOpenChange:e,children:l.jsxs(lr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[l.jsxs(or,{children:[l.jsx(cr,{children:"新增表达方式"}),l.jsx(Hr,{children:"创建新的表达方式记录"})]}),l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsxs(ue,{htmlFor:"situation",children:["情境 ",l.jsx("span",{className:"text-destructive",children:"*"})]}),l.jsx(Pe,{id:"situation",value:s.situation,onChange:f=>i({...s,situation:f.target.value}),placeholder:"描述使用场景"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsxs(ue,{htmlFor:"style",children:["风格 ",l.jsx("span",{className:"text-destructive",children:"*"})]}),l.jsx(Pe,{id:"style",value:s.style,onChange:f=>i({...s,style:f.target.value}),placeholder:"描述表达风格"})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsxs(ue,{htmlFor:"chat_id",children:["聊天 ",l.jsx("span",{className:"text-destructive",children:"*"})]}),l.jsxs(qt,{value:s.chat_id,onValueChange:f=>i({...s,chat_id:f}),children:[l.jsx(It,{children:l.jsx(Ft,{placeholder:"选择关联的聊天"})}),l.jsx(Bt,{children:n.map(f=>l.jsx(De,{value:f.chat_id,children:l.jsxs("span",{className:"truncate",style:{wordBreak:"keep-all"},children:[f.chat_name,f.is_group&&l.jsx("span",{className:"text-muted-foreground ml-1",children:"(群聊)"})]})},f.chat_id))})]})]})]}),l.jsxs(as,{children:[l.jsx(de,{variant:"outline",onClick:()=>e(!1),children:"取消"}),l.jsx(de,{onClick:h,disabled:a,children:a?"创建中...":"创建"})]})]})})}function Bwe({expression:t,open:e,onOpenChange:n,chatList:r,onSuccess:s}){const[i,a]=b.useState({}),[o,c]=b.useState(!1),{toast:h}=ts();b.useEffect(()=>{t&&a({situation:t.situation,style:t.style,chat_id:t.chat_id})},[t]);const f=async()=>{if(t)try{c(!0),await Awe(t.id,i),h({title:"保存成功",description:"表达方式已更新"}),s()}catch(m){h({title:"保存失败",description:m instanceof Error?m.message:"无法更新表达方式",variant:"destructive"})}finally{c(!1)}};return t?l.jsx(xr,{open:e,onOpenChange:n,children:l.jsxs(lr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[l.jsxs(or,{children:[l.jsx(cr,{children:"编辑表达方式"}),l.jsx(Hr,{children:"修改表达方式的信息"})]}),l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{htmlFor:"edit_situation",children:"情境"}),l.jsx(Pe,{id:"edit_situation",value:i.situation||"",onChange:m=>a({...i,situation:m.target.value}),placeholder:"描述使用场景"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{htmlFor:"edit_style",children:"风格"}),l.jsx(Pe,{id:"edit_style",value:i.style||"",onChange:m=>a({...i,style:m.target.value}),placeholder:"描述表达风格"})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{htmlFor:"edit_chat_id",children:"聊天"}),l.jsxs(qt,{value:i.chat_id||"",onValueChange:m=>a({...i,chat_id:m}),children:[l.jsx(It,{children:l.jsx(Ft,{placeholder:"选择关联的聊天"})}),l.jsx(Bt,{children:r.map(m=>l.jsx(De,{value:m.chat_id,children:l.jsxs("span",{className:"truncate",style:{wordBreak:"keep-all"},children:[m.chat_name,m.is_group&&l.jsx("span",{className:"text-muted-foreground ml-1",children:"(群聊)"})]})},m.chat_id))})]})]})]}),l.jsxs(as,{children:[l.jsx(de,{variant:"outline",onClick:()=>n(!1),children:"取消"}),l.jsx(de,{onClick:f,disabled:o,children:o?"保存中...":"保存"})]})]})}):null}function qwe({open:t,onOpenChange:e,onConfirm:n,count:r}){return l.jsx(Nn,{open:t,onOpenChange:e,children:l.jsxs(gn,{children:[l.jsxs(xn,{children:[l.jsx(yn,{children:"确认批量删除"}),l.jsxs(bn,{children:["您即将删除 ",r," 个表达方式,此操作无法撤销。确定要继续吗?"]})]}),l.jsxs(vn,{children:[l.jsx(Sn,{children:"取消"}),l.jsx(wn,{onClick:n,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"确认删除"})]})]})})}const tf="/api/webui/person";async function Fwe(t){const e=new URLSearchParams;t.page&&e.append("page",t.page.toString()),t.page_size&&e.append("page_size",t.page_size.toString()),t.search&&e.append("search",t.search),t.is_known!==void 0&&e.append("is_known",t.is_known.toString()),t.platform&&e.append("platform",t.platform);const n=await pt(`${tf}/list?${e}`,{headers:Ct()});if(!n.ok){const r=await n.json();throw new Error(r.detail||"获取人物列表失败")}return n.json()}async function $we(t){const e=await pt(`${tf}/${t}`,{headers:Ct()});if(!e.ok){const n=await e.json();throw new Error(n.detail||"获取人物详情失败")}return e.json()}async function Qwe(t,e){const n=await pt(`${tf}/${t}`,{method:"PATCH",headers:Ct(),body:JSON.stringify(e)});if(!n.ok){const r=await n.json();throw new Error(r.detail||"更新人物信息失败")}return n.json()}async function Hwe(t){const e=await pt(`${tf}/${t}`,{method:"DELETE",headers:Ct()});if(!e.ok){const n=await e.json();throw new Error(n.detail||"删除人物信息失败")}return e.json()}async function Vwe(){const t=await pt(`${tf}/stats/summary`,{headers:Ct()});if(!t.ok){const e=await t.json();throw new Error(e.detail||"获取统计数据失败")}return t.json()}async function Uwe(t){const e=await pt(`${tf}/batch/delete`,{method:"POST",headers:Ct(),body:JSON.stringify({person_ids:t})});if(!e.ok){const n=await e.json();throw new Error(n.detail||"批量删除失败")}return e.json()}function Wwe(){const[t,e]=b.useState([]),[n,r]=b.useState(!0),[s,i]=b.useState(0),[a,o]=b.useState(1),[c,h]=b.useState(20),[f,m]=b.useState(""),[g,x]=b.useState(void 0),[y,w]=b.useState(void 0),[S,k]=b.useState(null),[N,C]=b.useState(!1),[T,_]=b.useState(!1),[E,M]=b.useState(null),[L,P]=b.useState({total:0,known:0,unknown:0,platforms:{}}),[I,Q]=b.useState(new Set),[U,ee]=b.useState(!1),[z,H]=b.useState(""),{toast:B}=ts(),X=async()=>{try{r(!0);const re=await Fwe({page:a,page_size:c,search:f||void 0,is_known:g,platform:y});e(re.data),i(re.total)}catch(re){B({title:"加载失败",description:re instanceof Error?re.message:"无法加载人物信息",variant:"destructive"})}finally{r(!1)}},J=async()=>{try{const re=await Vwe();re?.data&&P(re.data)}catch(re){console.error("加载统计数据失败:",re)}};b.useEffect(()=>{X(),J()},[a,c,f,g,y]);const G=async re=>{try{const ae=await $we(re.person_id);k(ae.data),C(!0)}catch(ae){B({title:"加载详情失败",description:ae instanceof Error?ae.message:"无法加载人物详情",variant:"destructive"})}},R=re=>{k(re),_(!0)},se=async re=>{try{await Hwe(re.person_id),B({title:"删除成功",description:`已删除人物信息: ${re.person_name||re.nickname||re.user_id}`}),M(null),X(),J()}catch(ae){B({title:"删除失败",description:ae instanceof Error?ae.message:"无法删除人物信息",variant:"destructive"})}},W=b.useMemo(()=>Object.keys(L.platforms),[L.platforms]),F=re=>{const ae=new Set(I);ae.has(re)?ae.delete(re):ae.add(re),Q(ae)},V=()=>{I.size===t.length&&t.length>0?Q(new Set):Q(new Set(t.map(re=>re.person_id)))},te=()=>{if(I.size===0){B({title:"未选择任何人物",description:"请先选择要删除的人物",variant:"destructive"});return}ee(!0)},ne=async()=>{try{const re=await Uwe(Array.from(I));B({title:"批量删除完成",description:re.message}),Q(new Set),ee(!1),X(),J()}catch(re){B({title:"批量删除失败",description:re instanceof Error?re.message:"批量删除失败",variant:"destructive"})}},K=()=>{const re=parseInt(z),ae=Math.ceil(s/c);re>=1&&re<=ae?(o(re),H("")):B({title:"无效的页码",description:`请输入1-${ae}之间的页码`,variant:"destructive"})},ie=re=>re?new Date(re*1e3).toLocaleString("zh-CN"):"-";return l.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[l.jsx("div",{className:"mb-4 sm:mb-6",children:l.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:l.jsxs("div",{children:[l.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[l.jsx(VK,{className:"h-8 w-8",strokeWidth:2}),"人物信息管理"]}),l.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"管理麦麦认识的所有人物信息"})]})})}),l.jsx(hn,{className:"flex-1",children:l.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[l.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[l.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[l.jsx("div",{className:"text-sm text-muted-foreground",children:"总人数"}),l.jsx("div",{className:"text-2xl font-bold mt-1",children:L.total})]}),l.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[l.jsx("div",{className:"text-sm text-muted-foreground",children:"已认识"}),l.jsx("div",{className:"text-2xl font-bold mt-1 text-green-600",children:L.known})]}),l.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[l.jsx("div",{className:"text-sm text-muted-foreground",children:"未认识"}),l.jsx("div",{className:"text-2xl font-bold mt-1 text-muted-foreground",children:L.unknown})]})]}),l.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[l.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-4 gap-4",children:[l.jsxs("div",{className:"sm:col-span-2",children:[l.jsx(ue,{htmlFor:"search",children:"搜索"}),l.jsxs("div",{className:"relative mt-1.5",children:[l.jsx(ci,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),l.jsx(Pe,{id:"search",placeholder:"搜索名称、昵称或用户ID...",value:f,onChange:re=>m(re.target.value),className:"pl-9"})]})]}),l.jsxs("div",{children:[l.jsx(ue,{htmlFor:"filter-known",children:"认识状态"}),l.jsxs(qt,{value:g===void 0?"all":g.toString(),onValueChange:re=>{x(re==="all"?void 0:re==="true"),o(1)},children:[l.jsx(It,{id:"filter-known",className:"mt-1.5",children:l.jsx(Ft,{})}),l.jsxs(Bt,{children:[l.jsx(De,{value:"all",children:"全部"}),l.jsx(De,{value:"true",children:"已认识"}),l.jsx(De,{value:"false",children:"未认识"})]})]})]}),l.jsxs("div",{children:[l.jsx(ue,{htmlFor:"filter-platform",children:"平台"}),l.jsxs(qt,{value:y||"all",onValueChange:re=>{w(re==="all"?void 0:re),o(1)},children:[l.jsx(It,{id:"filter-platform",className:"mt-1.5",children:l.jsx(Ft,{})}),l.jsxs(Bt,{children:[l.jsx(De,{value:"all",children:"全部平台"}),W.map(re=>l.jsxs(De,{value:re,children:[re," (",L.platforms[re],")"]},re))]})]})]})]}),l.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 mt-4 pt-4 border-t",children:[l.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:I.size>0&&l.jsxs("span",{children:["已选择 ",I.size," 个人物"]})}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(ue,{htmlFor:"page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),l.jsxs(qt,{value:c.toString(),onValueChange:re=>{h(parseInt(re)),o(1),Q(new Set)},children:[l.jsx(It,{id:"page-size",className:"w-20",children:l.jsx(Ft,{})}),l.jsxs(Bt,{children:[l.jsx(De,{value:"10",children:"10"}),l.jsx(De,{value:"20",children:"20"}),l.jsx(De,{value:"50",children:"50"}),l.jsx(De,{value:"100",children:"100"})]})]}),I.size>0&&l.jsxs(l.Fragment,{children:[l.jsx(de,{variant:"outline",size:"sm",onClick:()=>Q(new Set),children:"取消选择"}),l.jsxs(de,{variant:"destructive",size:"sm",onClick:te,children:[l.jsx(fn,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]})]})]}),l.jsxs("div",{className:"rounded-lg border bg-card",children:[l.jsx("div",{className:"hidden md:block",children:l.jsxs(Vh,{children:[l.jsx(Uh,{children:l.jsxs(bs,{children:[l.jsx(ln,{className:"w-12",children:l.jsx(li,{checked:t.length>0&&I.size===t.length,onCheckedChange:V,"aria-label":"全选"})}),l.jsx(ln,{children:"状态"}),l.jsx(ln,{children:"名称"}),l.jsx(ln,{children:"昵称"}),l.jsx(ln,{children:"平台"}),l.jsx(ln,{children:"用户ID"}),l.jsx(ln,{children:"最后更新"}),l.jsx(ln,{className:"text-right",children:"操作"})]})}),l.jsx(Wh,{children:n?l.jsx(bs,{children:l.jsx(Qt,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):t.length===0?l.jsx(bs,{children:l.jsx(Qt,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):t.map(re=>l.jsxs(bs,{children:[l.jsx(Qt,{children:l.jsx(li,{checked:I.has(re.person_id),onCheckedChange:()=>F(re.person_id),"aria-label":`选择 ${re.person_name||re.nickname||re.user_id}`})}),l.jsx(Qt,{children:l.jsx("div",{className:ve("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",re.is_known?"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400":"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-400"),children:re.is_known?"已认识":"未认识"})}),l.jsx(Qt,{className:"font-medium",children:re.person_name||l.jsx("span",{className:"text-muted-foreground",children:"-"})}),l.jsx(Qt,{children:re.nickname||"-"}),l.jsx(Qt,{children:re.platform}),l.jsx(Qt,{className:"font-mono text-sm",children:re.user_id}),l.jsx(Qt,{className:"text-sm text-muted-foreground",children:ie(re.last_know)}),l.jsx(Qt,{className:"text-right",children:l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsxs(de,{variant:"default",size:"sm",onClick:()=>G(re),children:[l.jsx(oa,{className:"h-4 w-4 mr-1"}),"详情"]}),l.jsxs(de,{variant:"default",size:"sm",onClick:()=>R(re),children:[l.jsx(Qm,{className:"h-4 w-4 mr-1"}),"编辑"]}),l.jsxs(de,{size:"sm",onClick:()=>M(re),className:"bg-red-600 hover:bg-red-700 text-white",children:[l.jsx(fn,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},re.id))})]})}),l.jsx("div",{className:"md:hidden space-y-3 p-4",children:n?l.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):t.length===0?l.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):t.map(re=>l.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3 overflow-hidden",children:[l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx(li,{checked:I.has(re.person_id),onCheckedChange:()=>F(re.person_id),className:"mt-1"}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:ve("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium mb-2",re.is_known?"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400":"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-400"),children:re.is_known?"已认识":"未认识"}),l.jsx("h3",{className:"font-semibold text-sm line-clamp-1 w-full break-all",children:re.person_name||l.jsx("span",{className:"text-muted-foreground",children:"未命名"})}),re.nickname&&l.jsxs("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-1 w-full break-all",children:["昵称: ",re.nickname]})]})]}),l.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[l.jsxs("div",{children:[l.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"平台"}),l.jsx("p",{className:"font-medium text-xs",children:re.platform})]}),l.jsxs("div",{children:[l.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"用户ID"}),l.jsx("p",{className:"font-mono text-xs truncate",title:re.user_id,children:re.user_id})]}),l.jsxs("div",{className:"col-span-2",children:[l.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"最后更新"}),l.jsx("p",{className:"text-xs",children:ie(re.last_know)})]})]}),l.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t overflow-hidden",children:[l.jsxs(de,{variant:"outline",size:"sm",onClick:()=>G(re),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[l.jsx(oa,{className:"h-3 w-3 mr-1"}),"查看"]}),l.jsxs(de,{variant:"outline",size:"sm",onClick:()=>R(re),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[l.jsx(Qm,{className:"h-3 w-3 mr-1"}),"编辑"]}),l.jsxs(de,{variant:"outline",size:"sm",onClick:()=>M(re),className:"text-xs px-2 py-1 h-auto flex-shrink-0 text-destructive hover:text-destructive",children:[l.jsx(fn,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},re.id))}),s>0&&l.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 px-4 py-3 border-t",children:[l.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",s," 条记录,第 ",a," / ",Math.ceil(s/c)," 页"]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(de,{variant:"outline",size:"sm",onClick:()=>o(1),disabled:a===1,className:"hidden sm:flex",children:l.jsx(L0,{className:"h-4 w-4"})}),l.jsxs(de,{variant:"outline",size:"sm",onClick:()=>o(a-1),disabled:a===1,children:[l.jsx($u,{className:"h-4 w-4 sm:mr-1"}),l.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Pe,{type:"number",value:z,onChange:re=>H(re.target.value),onKeyDown:re=>re.key==="Enter"&&K(),placeholder:a.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(s/c)}),l.jsx(de,{variant:"outline",size:"sm",onClick:K,disabled:!z,className:"h-8",children:"跳转"})]}),l.jsxs(de,{variant:"outline",size:"sm",onClick:()=>o(a+1),disabled:a>=Math.ceil(s/c),children:[l.jsx("span",{className:"hidden sm:inline",children:"下一页"}),l.jsx(Qu,{className:"h-4 w-4 sm:ml-1"})]}),l.jsx(de,{variant:"outline",size:"sm",onClick:()=>o(Math.ceil(s/c)),disabled:a>=Math.ceil(s/c),className:"hidden sm:flex",children:l.jsx(I0,{className:"h-4 w-4"})})]})]})]})]})}),l.jsx(Gwe,{person:S,open:N,onOpenChange:C}),l.jsx(Xwe,{person:S,open:T,onOpenChange:_,onSuccess:()=>{X(),J(),_(!1)}}),l.jsx(Nn,{open:!!E,onOpenChange:()=>M(null),children:l.jsxs(gn,{children:[l.jsxs(xn,{children:[l.jsx(yn,{children:"确认删除"}),l.jsxs(bn,{children:['确定要删除人物信息 "',E?.person_name||E?.nickname||E?.user_id,'" 吗? 此操作不可撤销。']})]}),l.jsxs(vn,{children:[l.jsx(Sn,{children:"取消"}),l.jsx(wn,{onClick:()=>E&&se(E),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})}),l.jsx(Nn,{open:U,onOpenChange:ee,children:l.jsxs(gn,{children:[l.jsxs(xn,{children:[l.jsx(yn,{children:"确认批量删除"}),l.jsxs(bn,{children:["确定要删除选中的 ",I.size," 个人物信息吗? 此操作不可撤销。"]})]}),l.jsxs(vn,{children:[l.jsx(Sn,{children:"取消"}),l.jsx(wn,{onClick:ne,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})})]})}function Gwe({person:t,open:e,onOpenChange:n}){if(!t)return null;const r=s=>s?new Date(s*1e3).toLocaleString("zh-CN"):"-";return l.jsx(xr,{open:e,onOpenChange:n,children:l.jsxs(lr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[l.jsxs(or,{children:[l.jsx(cr,{children:"人物详情"}),l.jsxs(Hr,{children:["查看 ",t.person_name||t.nickname||t.user_id," 的完整信息"]})]}),l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[l.jsx(Gl,{icon:az,label:"人物名称",value:t.person_name}),l.jsx(Gl,{icon:z0,label:"昵称",value:t.nickname}),l.jsx(Gl,{icon:L3,label:"用户ID",value:t.user_id,mono:!0}),l.jsx(Gl,{icon:L3,label:"人物ID",value:t.person_id,mono:!0}),l.jsx(Gl,{label:"平台",value:t.platform}),l.jsx(Gl,{label:"状态",value:t.is_known?"已认识":"未认识"})]}),t.name_reason&&l.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[l.jsx(ue,{className:"text-xs text-muted-foreground",children:"名称设定原因"}),l.jsx("p",{className:"mt-1 text-sm",children:t.name_reason})]}),t.memory_points&&l.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[l.jsx(ue,{className:"text-xs text-muted-foreground",children:"个人印象"}),l.jsx("p",{className:"mt-1 text-sm whitespace-pre-wrap",children:t.memory_points})]}),t.group_nick_name&&t.group_nick_name.length>0&&l.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[l.jsx(ue,{className:"text-xs text-muted-foreground",children:"群昵称"}),l.jsx("div",{className:"mt-2 space-y-1",children:t.group_nick_name.map((s,i)=>l.jsxs("div",{className:"text-sm flex items-center gap-2",children:[l.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:s.group_id}),l.jsx("span",{children:"→"}),l.jsx("span",{children:s.group_nick_name})]},i))})]}),l.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[l.jsx(Gl,{icon:Zd,label:"认识时间",value:r(t.know_times)}),l.jsx(Gl,{icon:Zd,label:"首次记录",value:r(t.know_since)}),l.jsx(Gl,{icon:Zd,label:"最后更新",value:r(t.last_know)})]})]}),l.jsx(as,{children:l.jsx(de,{onClick:()=>n(!1),children:"关闭"})})]})})}function Gl({icon:t,label:e,value:n,mono:r=!1}){return l.jsxs("div",{className:"space-y-1",children:[l.jsxs(ue,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[t&&l.jsx(t,{className:"h-3 w-3"}),e]}),l.jsx("div",{className:ve("text-sm",r&&"font-mono",!n&&"text-muted-foreground"),children:n||"-"})]})}function Xwe({person:t,open:e,onOpenChange:n,onSuccess:r}){const[s,i]=b.useState({}),[a,o]=b.useState(!1),{toast:c}=ts();b.useEffect(()=>{t&&i({person_name:t.person_name||"",name_reason:t.name_reason||"",nickname:t.nickname||"",memory_points:t.memory_points||"",is_known:t.is_known})},[t]);const h=async()=>{if(t)try{o(!0),await Qwe(t.person_id,s),c({title:"保存成功",description:"人物信息已更新"}),r()}catch(f){c({title:"保存失败",description:f instanceof Error?f.message:"无法更新人物信息",variant:"destructive"})}finally{o(!1)}};return t?l.jsx(xr,{open:e,onOpenChange:n,children:l.jsxs(lr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[l.jsxs(or,{children:[l.jsx(cr,{children:"编辑人物信息"}),l.jsxs(Hr,{children:["修改 ",t.person_name||t.nickname||t.user_id," 的信息"]})]}),l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{htmlFor:"person_name",children:"人物名称"}),l.jsx(Pe,{id:"person_name",value:s.person_name||"",onChange:f=>i({...s,person_name:f.target.value}),placeholder:"为这个人设置一个名称"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{htmlFor:"nickname",children:"昵称"}),l.jsx(Pe,{id:"nickname",value:s.nickname||"",onChange:f=>i({...s,nickname:f.target.value}),placeholder:"昵称"})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{htmlFor:"name_reason",children:"名称设定原因"}),l.jsx(pr,{id:"name_reason",value:s.name_reason||"",onChange:f=>i({...s,name_reason:f.target.value}),placeholder:"为什么这样称呼这个人?",rows:2})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{htmlFor:"memory_points",children:"个人印象"}),l.jsx(pr,{id:"memory_points",value:s.memory_points||"",onChange:f=>i({...s,memory_points:f.target.value}),placeholder:"对这个人的印象和记忆点...",rows:4})]}),l.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[l.jsxs("div",{children:[l.jsx(ue,{htmlFor:"is_known",className:"text-base font-medium",children:"已认识"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"标记是否已经认识这个人"})]}),l.jsx(Pt,{id:"is_known",checked:s.is_known,onCheckedChange:f=>i({...s,is_known:f})})]})]}),l.jsxs(as,{children:[l.jsx(de,{variant:"outline",onClick:()=>n(!1),children:"取消"}),l.jsx(de,{onClick:h,disabled:a,children:a?"保存中...":"保存"})]})]})}):null}function Ss(t){if(typeof t=="string"||typeof t=="number")return""+t;let e="";if(Array.isArray(t))for(let n=0,r;n{let e;const n=new Set,r=(f,m)=>{const g=typeof f=="function"?f(e):f;if(!Object.is(g,e)){const x=e;e=m??(typeof g!="object"||g===null)?g:Object.assign({},e,g),n.forEach(y=>y(e,x))}},s=()=>e,c={setState:r,getState:s,getInitialState:()=>h,subscribe:f=>(n.add(f),()=>n.delete(f)),destroy:()=>{(Ywe?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},h=e=t(r,s,c);return c},Kwe=t=>t?BM(t):BM,{useDebugValue:Zwe}=he,{useSyncExternalStoreWithSelector:Jwe}=lY,e4e=t=>t;function ZQ(t,e=e4e,n){const r=Jwe(t.subscribe,t.getState,t.getServerState||t.getInitialState,e,n);return Zwe(r),r}const qM=(t,e)=>{const n=Kwe(t),r=(s,i=e)=>ZQ(n,s,i);return Object.assign(r,n),r},t4e=(t,e)=>t?qM(t,e):qM;function os(t,e){if(Object.is(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;if(t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(const[r,s]of t)if(!Object.is(s,e.get(r)))return!1;return!0}if(t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(const r of t)if(!e.has(r))return!1;return!0}const n=Object.keys(t);if(n.length!==Object.keys(e).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(e,r)||!Object.is(t[r],e[r]))return!1;return!0}var n4e={value:()=>{}};function Ay(){for(var t=0,e=arguments.length,n={},r;t=0&&(r=n.slice(s+1),n=n.slice(0,s)),n&&!e.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}b1.prototype=Ay.prototype={constructor:b1,on:function(t,e){var n=this._,r=r4e(t+"",n),s,i=-1,a=r.length;if(arguments.length<2){for(;++i0)for(var n=new Array(s),r=0,s,i;r=0&&(e=t.slice(0,n))!=="xmlns"&&(t=t.slice(n+1)),$M.hasOwnProperty(e)?{space:$M[e],local:t}:t}function i4e(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===wk&&e.documentElement.namespaceURI===wk?e.createElement(t):e.createElementNS(n,t)}}function a4e(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function JQ(t){var e=Ry(t);return(e.local?a4e:i4e)(e)}function l4e(){}function dO(t){return t==null?l4e:function(){return this.querySelector(t)}}function o4e(t){typeof t!="function"&&(t=dO(t));for(var e=this._groups,n=e.length,r=new Array(n),s=0;s=C&&(C=N+1);!(_=S[C])&&++C=0;)(a=r[s])&&(i&&a.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(a,i),i=a);return this}function R4e(t){t||(t=D4e);function e(m,g){return m&&g?t(m.__data__,g.__data__):!m-!g}for(var n=this._groups,r=n.length,s=new Array(r),i=0;ie?1:t>=e?0:NaN}function z4e(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function P4e(){return Array.from(this)}function L4e(){for(var t=this._groups,e=0,n=t.length;e1?this.each((e==null?G4e:typeof e=="function"?Y4e:X4e)(t,e,n??"")):Eh(this.node(),t)}function Eh(t,e){return t.style.getPropertyValue(e)||sH(t).getComputedStyle(t,null).getPropertyValue(e)}function Z4e(t){return function(){delete this[t]}}function J4e(t,e){return function(){this[t]=e}}function e5e(t,e){return function(){var n=e.apply(this,arguments);n==null?delete this[t]:this[t]=n}}function t5e(t,e){return arguments.length>1?this.each((e==null?Z4e:typeof e=="function"?e5e:J4e)(t,e)):this.node()[t]}function iH(t){return t.trim().split(/^|\s+/)}function hO(t){return t.classList||new aH(t)}function aH(t){this._node=t,this._names=iH(t.getAttribute("class")||"")}aH.prototype={add:function(t){var e=this._names.indexOf(t);e<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function lH(t,e){for(var n=hO(t),r=-1,s=e.length;++r=0&&(n=e.slice(r+1),e=e.slice(0,r)),{type:e,name:n}})}function E5e(t){return function(){var e=this.__on;if(e){for(var n=0,r=-1,s=e.length,i;n()=>t;function Sk(t,{sourceEvent:e,subject:n,target:r,identifier:s,active:i,x:a,y:o,dx:c,dy:h,dispatch:f}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:s,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:o,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:h,enumerable:!0,configurable:!0},_:{value:f}})}Sk.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};function B5e(t){return!t.ctrlKey&&!t.button}function q5e(){return this.parentNode}function F5e(t,e){return e??{x:t.x,y:t.y}}function $5e(){return navigator.maxTouchPoints||"ontouchstart"in this}function Q5e(){var t=B5e,e=q5e,n=F5e,r=$5e,s={},i=Ay("start","drag","end"),a=0,o,c,h,f,m=0;function g(T){T.on("mousedown.drag",x).filter(r).on("touchstart.drag",S).on("touchmove.drag",k,I5e).on("touchend.drag touchcancel.drag",N).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function x(T,_){if(!(f||!t.call(this,T,_))){var E=C(this,e.call(this,T,_),T,_,"mouse");E&&(Ki(T.view).on("mousemove.drag",y,j0).on("mouseup.drag",w,j0),dH(T.view),B4(T),h=!1,o=T.clientX,c=T.clientY,E("start",T))}}function y(T){if(dh(T),!h){var _=T.clientX-o,E=T.clientY-c;h=_*_+E*E>m}s.mouse("drag",T)}function w(T){Ki(T.view).on("mousemove.drag mouseup.drag",null),hH(T.view,h),dh(T),s.mouse("end",T)}function S(T,_){if(t.call(this,T,_)){var E=T.changedTouches,M=e.call(this,T,_),L=E.length,P,I;for(P=0;P=0&&t._call.call(void 0,e),t=t._next;--_h}function QM(){Bu=(xv=O0.now())+Dy,_h=bm=0;try{V5e()}finally{_h=0,W5e(),Bu=0}}function U5e(){var t=O0.now(),e=t-xv;e>fH&&(Dy-=e,xv=t)}function W5e(){for(var t,e=gv,n,r=1/0;e;)e._call?(r>e._time&&(r=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:gv=n);wm=t,kk(r)}function kk(t){if(!_h){bm&&(bm=clearTimeout(bm));var e=t-Bu;e>24?(t<1/0&&(bm=setTimeout(QM,t-O0.now()-Dy)),cm&&(cm=clearInterval(cm))):(cm||(xv=O0.now(),cm=setInterval(U5e,fH)),_h=1,mH(QM))}}function HM(t,e,n){var r=new vv;return e=e==null?0:+e,r.restart(s=>{r.stop(),t(s+e)},e,n),r}var G5e=Ay("start","end","cancel","interrupt"),X5e=[],gH=0,VM=1,jk=2,w1=3,UM=4,Ok=5,S1=6;function zy(t,e,n,r,s,i){var a=t.__transition;if(!a)t.__transition={};else if(n in a)return;Y5e(t,n,{name:e,index:r,group:s,on:G5e,tween:X5e,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:gH})}function mO(t,e){var n=Ia(t,e);if(n.state>gH)throw new Error("too late; already scheduled");return n}function Sl(t,e){var n=Ia(t,e);if(n.state>w1)throw new Error("too late; already running");return n}function Ia(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function Y5e(t,e,n){var r=t.__transition,s;r[e]=n,n.timer=pH(i,0,n.time);function i(h){n.state=VM,n.timer.restart(a,n.delay,n.time),n.delay<=h&&a(h-n.delay)}function a(h){var f,m,g,x;if(n.state!==VM)return c();for(f in r)if(x=r[f],x.name===n.name){if(x.state===w1)return HM(a);x.state===UM?(x.state=S1,x.timer.stop(),x.on.call("interrupt",t,t.__data__,x.index,x.group),delete r[f]):+fjk&&r.state=0&&(e=e.slice(0,n)),!e||e==="start"})}function N3e(t,e,n){var r,s,i=O3e(e)?mO:Sl;return function(){var a=i(this,t),o=a.on;o!==r&&(s=(r=o).copy()).on(e,n),a.on=s}}function C3e(t,e){var n=this._id;return arguments.length<2?Ia(this.node(),n).on.on(t):this.each(N3e(n,t,e))}function T3e(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}function E3e(){return this.on("end.remove",T3e(this._id))}function _3e(t){var e=this._name,n=this._id;typeof t!="function"&&(t=dO(t));for(var r=this._groups,s=r.length,i=new Array(s),a=0;a()=>t;function tSe(t,{sourceEvent:e,target:n,transform:r,dispatch:s}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:s}})}function so(t,e,n){this.k=t,this.x=e,this.y=n}so.prototype={constructor:so,scale:function(t){return t===1?this:new so(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new so(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var ho=new so(1,0,0);so.prototype;function q4(t){t.stopImmediatePropagation()}function um(t){t.preventDefault(),t.stopImmediatePropagation()}function nSe(t){return(!t.ctrlKey||t.type==="wheel")&&!t.button}function rSe(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t,t.hasAttribute("viewBox")?(t=t.viewBox.baseVal,[[t.x,t.y],[t.x+t.width,t.y+t.height]]):[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]):[[0,0],[t.clientWidth,t.clientHeight]]}function WM(){return this.__zoom||ho}function sSe(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function iSe(){return navigator.maxTouchPoints||"ontouchstart"in this}function aSe(t,e,n){var r=t.invertX(e[0][0])-n[0][0],s=t.invertX(e[1][0])-n[1][0],i=t.invertY(e[0][1])-n[0][1],a=t.invertY(e[1][1])-n[1][1];return t.translate(s>r?(r+s)/2:Math.min(0,r)||Math.max(0,s),a>i?(i+a)/2:Math.min(0,i)||Math.max(0,a))}function bH(){var t=nSe,e=rSe,n=aSe,r=sSe,s=iSe,i=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],o=250,c=_Y,h=Ay("start","zoom","end"),f,m,g,x=500,y=150,w=0,S=10;function k(z){z.property("__zoom",WM).on("wheel.zoom",L,{passive:!1}).on("mousedown.zoom",P).on("dblclick.zoom",I).filter(s).on("touchstart.zoom",Q).on("touchmove.zoom",U).on("touchend.zoom touchcancel.zoom",ee).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}k.transform=function(z,H,B,X){var J=z.selection?z.selection():z;J.property("__zoom",WM),z!==J?_(z,H,B,X):J.interrupt().each(function(){E(this,arguments).event(X).start().zoom(null,typeof H=="function"?H.apply(this,arguments):H).end()})},k.scaleBy=function(z,H,B,X){k.scaleTo(z,function(){var J=this.__zoom.k,G=typeof H=="function"?H.apply(this,arguments):H;return J*G},B,X)},k.scaleTo=function(z,H,B,X){k.transform(z,function(){var J=e.apply(this,arguments),G=this.__zoom,R=B==null?T(J):typeof B=="function"?B.apply(this,arguments):B,se=G.invert(R),W=typeof H=="function"?H.apply(this,arguments):H;return n(C(N(G,W),R,se),J,a)},B,X)},k.translateBy=function(z,H,B,X){k.transform(z,function(){return n(this.__zoom.translate(typeof H=="function"?H.apply(this,arguments):H,typeof B=="function"?B.apply(this,arguments):B),e.apply(this,arguments),a)},null,X)},k.translateTo=function(z,H,B,X,J){k.transform(z,function(){var G=e.apply(this,arguments),R=this.__zoom,se=X==null?T(G):typeof X=="function"?X.apply(this,arguments):X;return n(ho.translate(se[0],se[1]).scale(R.k).translate(typeof H=="function"?-H.apply(this,arguments):-H,typeof B=="function"?-B.apply(this,arguments):-B),G,a)},X,J)};function N(z,H){return H=Math.max(i[0],Math.min(i[1],H)),H===z.k?z:new so(H,z.x,z.y)}function C(z,H,B){var X=H[0]-B[0]*z.k,J=H[1]-B[1]*z.k;return X===z.x&&J===z.y?z:new so(z.k,X,J)}function T(z){return[(+z[0][0]+ +z[1][0])/2,(+z[0][1]+ +z[1][1])/2]}function _(z,H,B,X){z.on("start.zoom",function(){E(this,arguments).event(X).start()}).on("interrupt.zoom end.zoom",function(){E(this,arguments).event(X).end()}).tween("zoom",function(){var J=this,G=arguments,R=E(J,G).event(X),se=e.apply(J,G),W=B==null?T(se):typeof B=="function"?B.apply(J,G):B,F=Math.max(se[1][0]-se[0][0],se[1][1]-se[0][1]),V=J.__zoom,te=typeof H=="function"?H.apply(J,G):H,ne=c(V.invert(W).concat(F/V.k),te.invert(W).concat(F/te.k));return function(K){if(K===1)K=te;else{var ie=ne(K),re=F/ie[2];K=new so(re,W[0]-ie[0]*re,W[1]-ie[1]*re)}R.zoom(null,K)}})}function E(z,H,B){return!B&&z.__zooming||new M(z,H)}function M(z,H){this.that=z,this.args=H,this.active=0,this.sourceEvent=null,this.extent=e.apply(z,H),this.taps=0}M.prototype={event:function(z){return z&&(this.sourceEvent=z),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(z,H){return this.mouse&&z!=="mouse"&&(this.mouse[1]=H.invert(this.mouse[0])),this.touch0&&z!=="touch"&&(this.touch0[1]=H.invert(this.touch0[0])),this.touch1&&z!=="touch"&&(this.touch1[1]=H.invert(this.touch1[0])),this.that.__zoom=H,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(z){var H=Ki(this.that).datum();h.call(z,this.that,new tSe(z,{sourceEvent:this.sourceEvent,target:k,transform:this.that.__zoom,dispatch:h}),H)}};function L(z,...H){if(!t.apply(this,arguments))return;var B=E(this,H).event(z),X=this.__zoom,J=Math.max(i[0],Math.min(i[1],X.k*Math.pow(2,r.apply(this,arguments)))),G=ka(z);if(B.wheel)(B.mouse[0][0]!==G[0]||B.mouse[0][1]!==G[1])&&(B.mouse[1]=X.invert(B.mouse[0]=G)),clearTimeout(B.wheel);else{if(X.k===J)return;B.mouse=[G,X.invert(G)],k1(this),B.start()}um(z),B.wheel=setTimeout(R,y),B.zoom("mouse",n(C(N(X,J),B.mouse[0],B.mouse[1]),B.extent,a));function R(){B.wheel=null,B.end()}}function P(z,...H){if(g||!t.apply(this,arguments))return;var B=z.currentTarget,X=E(this,H,!0).event(z),J=Ki(z.view).on("mousemove.zoom",W,!0).on("mouseup.zoom",F,!0),G=ka(z,B),R=z.clientX,se=z.clientY;dH(z.view),q4(z),X.mouse=[G,this.__zoom.invert(G)],k1(this),X.start();function W(V){if(um(V),!X.moved){var te=V.clientX-R,ne=V.clientY-se;X.moved=te*te+ne*ne>w}X.event(V).zoom("mouse",n(C(X.that.__zoom,X.mouse[0]=ka(V,B),X.mouse[1]),X.extent,a))}function F(V){J.on("mousemove.zoom mouseup.zoom",null),hH(V.view,X.moved),um(V),X.event(V).end()}}function I(z,...H){if(t.apply(this,arguments)){var B=this.__zoom,X=ka(z.changedTouches?z.changedTouches[0]:z,this),J=B.invert(X),G=B.k*(z.shiftKey?.5:2),R=n(C(N(B,G),X,J),e.apply(this,H),a);um(z),o>0?Ki(this).transition().duration(o).call(_,R,X,z):Ki(this).call(k.transform,R,X,z)}}function Q(z,...H){if(t.apply(this,arguments)){var B=z.touches,X=B.length,J=E(this,H,z.changedTouches.length===X).event(z),G,R,se,W;for(q4(z),R=0;R"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:t=>`Node type "${t}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:t=>`The old edge with id=${t} does not exist.`,error009:t=>`Marker type "${t}" doesn't exist.`,error008:(t,e)=>`Couldn't create edge for ${t?"target":"source"} handle id: "${t?e.targetHandle:e.sourceHandle}", edge id: ${e.id}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:t=>`Edge type "${t}" not found. Using fallback type "default".`,error012:t=>`Node with id "${t}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`},wH=bo.error001();function er(t,e){const n=b.useContext(Py);if(n===null)throw new Error(wH);return ZQ(n,t,e)}const ns=()=>{const t=b.useContext(Py);if(t===null)throw new Error(wH);return b.useMemo(()=>({getState:t.getState,setState:t.setState,subscribe:t.subscribe,destroy:t.destroy}),[t])},oSe=t=>t.userSelectionActive?"none":"all";function Ly({position:t,children:e,className:n,style:r,...s}){const i=er(oSe),a=`${t}`.split("-");return he.createElement("div",{className:Ss(["react-flow__panel",n,...a]),style:{...r,pointerEvents:i},...s},e)}function cSe({proOptions:t,position:e="bottom-right"}){return t?.hideAttribution?null:he.createElement(Ly,{position:e,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://reactflow.dev/pro"},he.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}const uSe=({x:t,y:e,label:n,labelStyle:r={},labelShowBg:s=!0,labelBgStyle:i={},labelBgPadding:a=[2,4],labelBgBorderRadius:o=2,children:c,className:h,...f})=>{const m=b.useRef(null),[g,x]=b.useState({x:0,y:0,width:0,height:0}),y=Ss(["react-flow__edge-textwrapper",h]);return b.useEffect(()=>{if(m.current){const w=m.current.getBBox();x({x:w.x,y:w.y,width:w.width,height:w.height})}},[n]),typeof n>"u"||!n?null:he.createElement("g",{transform:`translate(${t-g.width/2} ${e-g.height/2})`,className:y,visibility:g.width?"visible":"hidden",...f},s&&he.createElement("rect",{width:g.width+2*a[0],x:-a[0],y:-a[1],height:g.height+2*a[1],className:"react-flow__edge-textbg",style:i,rx:o,ry:o}),he.createElement("text",{className:"react-flow__edge-text",y:g.height/2,dy:"0.3em",ref:m,style:r},n),c)};var dSe=b.memo(uSe);const gO=t=>({width:t.offsetWidth,height:t.offsetHeight}),Mh=(t,e=0,n=1)=>Math.min(Math.max(t,e),n),xO=(t={x:0,y:0},e)=>({x:Mh(t.x,e[0][0],e[1][0]),y:Mh(t.y,e[0][1],e[1][1])}),GM=(t,e,n)=>tn?-Mh(Math.abs(t-n),1,50)/50:0,SH=(t,e)=>{const n=GM(t.x,35,e.width-35)*20,r=GM(t.y,35,e.height-35)*20;return[n,r]},kH=t=>t.getRootNode?.()||window?.document,jH=(t,e)=>({x:Math.min(t.x,e.x),y:Math.min(t.y,e.y),x2:Math.max(t.x2,e.x2),y2:Math.max(t.y2,e.y2)}),N0=({x:t,y:e,width:n,height:r})=>({x:t,y:e,x2:t+n,y2:e+r}),OH=({x:t,y:e,x2:n,y2:r})=>({x:t,y:e,width:n-t,height:r-e}),XM=t=>({...t.positionAbsolute||{x:0,y:0},width:t.width||0,height:t.height||0}),hSe=(t,e)=>OH(jH(N0(t),N0(e))),Nk=(t,e)=>{const n=Math.max(0,Math.min(t.x+t.width,e.x+e.width)-Math.max(t.x,e.x)),r=Math.max(0,Math.min(t.y+t.height,e.y+e.height)-Math.max(t.y,e.y));return Math.ceil(n*r)},fSe=t=>na(t.width)&&na(t.height)&&na(t.x)&&na(t.y),na=t=>!isNaN(t)&&isFinite(t),Sr=Symbol.for("internals"),NH=["Enter"," ","Escape"],mSe=(t,e)=>{},pSe=t=>"nativeEvent"in t;function Ck(t){const n=(pSe(t)?t.nativeEvent:t).composedPath?.()?.[0]||t.target;return["INPUT","SELECT","TEXTAREA"].includes(n?.nodeName)||n?.hasAttribute("contenteditable")||!!n?.closest(".nokey")}const CH=t=>"clientX"in t,pc=(t,e)=>{const n=CH(t),r=n?t.clientX:t.touches?.[0].clientX,s=n?t.clientY:t.touches?.[0].clientY;return{x:r-(e?.left??0),y:s-(e?.top??0)}},yv=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0,xp=({id:t,path:e,labelX:n,labelY:r,label:s,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:c,labelBgBorderRadius:h,style:f,markerEnd:m,markerStart:g,interactionWidth:x=20})=>he.createElement(he.Fragment,null,he.createElement("path",{id:t,style:f,d:e,fill:"none",className:"react-flow__edge-path",markerEnd:m,markerStart:g}),x&&he.createElement("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:x,className:"react-flow__edge-interaction"}),s&&na(n)&&na(r)?he.createElement(dSe,{x:n,y:r,label:s,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:c,labelBgBorderRadius:h}):null);xp.displayName="BaseEdge";function dm(t,e,n){return n===void 0?n:r=>{const s=e().edges.find(i=>i.id===t);s&&n(r,{...s})}}function TH({sourceX:t,sourceY:e,targetX:n,targetY:r}){const s=Math.abs(n-t)/2,i=n{const[S,k,N]=_H({sourceX:t,sourceY:e,sourcePosition:s,targetX:n,targetY:r,targetPosition:i});return he.createElement(xp,{path:S,labelX:k,labelY:N,label:a,labelStyle:o,labelShowBg:c,labelBgStyle:h,labelBgPadding:f,labelBgBorderRadius:m,style:g,markerEnd:x,markerStart:y,interactionWidth:w})});vO.displayName="SimpleBezierEdge";const KM={[mt.Left]:{x:-1,y:0},[mt.Right]:{x:1,y:0},[mt.Top]:{x:0,y:-1},[mt.Bottom]:{x:0,y:1}},gSe=({source:t,sourcePosition:e=mt.Bottom,target:n})=>e===mt.Left||e===mt.Right?t.xMath.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2));function xSe({source:t,sourcePosition:e=mt.Bottom,target:n,targetPosition:r=mt.Top,center:s,offset:i}){const a=KM[e],o=KM[r],c={x:t.x+a.x*i,y:t.y+a.y*i},h={x:n.x+o.x*i,y:n.y+o.y*i},f=gSe({source:c,sourcePosition:e,target:h}),m=f.x!==0?"x":"y",g=f[m];let x=[],y,w;const S={x:0,y:0},k={x:0,y:0},[N,C,T,_]=TH({sourceX:t.x,sourceY:t.y,targetX:n.x,targetY:n.y});if(a[m]*o[m]===-1){y=s.x??N,w=s.y??C;const M=[{x:y,y:c.y},{x:y,y:h.y}],L=[{x:c.x,y:w},{x:h.x,y:w}];a[m]===g?x=m==="x"?M:L:x=m==="x"?L:M}else{const M=[{x:c.x,y:h.y}],L=[{x:h.x,y:c.y}];if(m==="x"?x=a.x===g?L:M:x=a.y===g?M:L,e===r){const ee=Math.abs(t[m]-n[m]);if(ee<=i){const z=Math.min(i-1,i-ee);a[m]===g?S[m]=(c[m]>t[m]?-1:1)*z:k[m]=(h[m]>n[m]?-1:1)*z}}if(e!==r){const ee=m==="x"?"y":"x",z=a[m]===o[ee],H=c[ee]>h[ee],B=c[ee]=U?(y=(P.x+I.x)/2,w=x[0].y):(y=x[0].x,w=(P.y+I.y)/2)}return[[t,{x:c.x+S.x,y:c.y+S.y},...x,{x:h.x+k.x,y:h.y+k.y},n],y,w,T,_]}function vSe(t,e,n,r){const s=Math.min(ZM(t,e)/2,ZM(e,n)/2,r),{x:i,y:a}=e;if(t.x===i&&i===n.x||t.y===a&&a===n.y)return`L${i} ${a}`;if(t.y===a){const h=t.x{let C="";return N>0&&N{const[k,N,C]=Tk({sourceX:t,sourceY:e,sourcePosition:m,targetX:n,targetY:r,targetPosition:g,borderRadius:w?.borderRadius,offset:w?.offset});return he.createElement(xp,{path:k,labelX:N,labelY:C,label:s,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:c,labelBgBorderRadius:h,style:f,markerEnd:x,markerStart:y,interactionWidth:S})});Iy.displayName="SmoothStepEdge";const yO=b.memo(t=>he.createElement(Iy,{...t,pathOptions:b.useMemo(()=>({borderRadius:0,offset:t.pathOptions?.offset}),[t.pathOptions?.offset])}));yO.displayName="StepEdge";function ySe({sourceX:t,sourceY:e,targetX:n,targetY:r}){const[s,i,a,o]=TH({sourceX:t,sourceY:e,targetX:n,targetY:r});return[`M ${t},${e}L ${n},${r}`,s,i,a,o]}const bO=b.memo(({sourceX:t,sourceY:e,targetX:n,targetY:r,label:s,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:c,labelBgBorderRadius:h,style:f,markerEnd:m,markerStart:g,interactionWidth:x})=>{const[y,w,S]=ySe({sourceX:t,sourceY:e,targetX:n,targetY:r});return he.createElement(xp,{path:y,labelX:w,labelY:S,label:s,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:c,labelBgBorderRadius:h,style:f,markerEnd:m,markerStart:g,interactionWidth:x})});bO.displayName="StraightEdge";function qx(t,e){return t>=0?.5*t:e*25*Math.sqrt(-t)}function JM({pos:t,x1:e,y1:n,x2:r,y2:s,c:i}){switch(t){case mt.Left:return[e-qx(e-r,i),n];case mt.Right:return[e+qx(r-e,i),n];case mt.Top:return[e,n-qx(n-s,i)];case mt.Bottom:return[e,n+qx(s-n,i)]}}function MH({sourceX:t,sourceY:e,sourcePosition:n=mt.Bottom,targetX:r,targetY:s,targetPosition:i=mt.Top,curvature:a=.25}){const[o,c]=JM({pos:n,x1:t,y1:e,x2:r,y2:s,c:a}),[h,f]=JM({pos:i,x1:r,y1:s,x2:t,y2:e,c:a}),[m,g,x,y]=EH({sourceX:t,sourceY:e,targetX:r,targetY:s,sourceControlX:o,sourceControlY:c,targetControlX:h,targetControlY:f});return[`M${t},${e} C${o},${c} ${h},${f} ${r},${s}`,m,g,x,y]}const wv=b.memo(({sourceX:t,sourceY:e,targetX:n,targetY:r,sourcePosition:s=mt.Bottom,targetPosition:i=mt.Top,label:a,labelStyle:o,labelShowBg:c,labelBgStyle:h,labelBgPadding:f,labelBgBorderRadius:m,style:g,markerEnd:x,markerStart:y,pathOptions:w,interactionWidth:S})=>{const[k,N,C]=MH({sourceX:t,sourceY:e,sourcePosition:s,targetX:n,targetY:r,targetPosition:i,curvature:w?.curvature});return he.createElement(xp,{path:k,labelX:N,labelY:C,label:a,labelStyle:o,labelShowBg:c,labelBgStyle:h,labelBgPadding:f,labelBgBorderRadius:m,style:g,markerEnd:x,markerStart:y,interactionWidth:S})});wv.displayName="BezierEdge";const wO=b.createContext(null),bSe=wO.Provider;wO.Consumer;const wSe=()=>b.useContext(wO),SSe=t=>"id"in t&&"source"in t&&"target"in t,kSe=({source:t,sourceHandle:e,target:n,targetHandle:r})=>`reactflow__edge-${t}${e||""}-${n}${r||""}`,Ek=(t,e)=>typeof t>"u"?"":typeof t=="string"?t:`${e?`${e}__`:""}${Object.keys(t).sort().map(r=>`${r}=${t[r]}`).join("&")}`,jSe=(t,e)=>e.some(n=>n.source===t.source&&n.target===t.target&&(n.sourceHandle===t.sourceHandle||!n.sourceHandle&&!t.sourceHandle)&&(n.targetHandle===t.targetHandle||!n.targetHandle&&!t.targetHandle)),OSe=(t,e)=>{if(!t.source||!t.target)return e;let n;return SSe(t)?n={...t}:n={...t,id:kSe(t)},jSe(n,e)?e:e.concat(n)},_k=({x:t,y:e},[n,r,s],i,[a,o])=>{const c={x:(t-n)/s,y:(e-r)/s};return i?{x:a*Math.round(c.x/a),y:o*Math.round(c.y/o)}:c},AH=({x:t,y:e},[n,r,s])=>({x:t*s+n,y:e*s+r}),Nu=(t,e=[0,0])=>{if(!t)return{x:0,y:0,positionAbsolute:{x:0,y:0}};const n=(t.width??0)*e[0],r=(t.height??0)*e[1],s={x:t.position.x-n,y:t.position.y-r};return{...s,positionAbsolute:t.positionAbsolute?{x:t.positionAbsolute.x-n,y:t.positionAbsolute.y-r}:s}},By=(t,e=[0,0])=>{if(t.length===0)return{x:0,y:0,width:0,height:0};const n=t.reduce((r,s)=>{const{x:i,y:a}=Nu(s,e).positionAbsolute;return jH(r,N0({x:i,y:a,width:s.width||0,height:s.height||0}))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return OH(n)},RH=(t,e,[n,r,s]=[0,0,1],i=!1,a=!1,o=[0,0])=>{const c={x:(e.x-n)/s,y:(e.y-r)/s,width:e.width/s,height:e.height/s},h=[];return t.forEach(f=>{const{width:m,height:g,selectable:x=!0,hidden:y=!1}=f;if(a&&!x||y)return!1;const{positionAbsolute:w}=Nu(f,o),S={x:w.x,y:w.y,width:m||0,height:g||0},k=Nk(c,S),N=typeof m>"u"||typeof g>"u"||m===null||g===null,C=i&&k>0,T=(m||0)*(g||0);(N||C||k>=T||f.dragging)&&h.push(f)}),h},DH=(t,e)=>{const n=t.map(r=>r.id);return e.filter(r=>n.includes(r.source)||n.includes(r.target))},zH=(t,e,n,r,s,i=.1)=>{const a=e/(t.width*(1+i)),o=n/(t.height*(1+i)),c=Math.min(a,o),h=Mh(c,r,s),f=t.x+t.width/2,m=t.y+t.height/2,g=e/2-f*h,x=n/2-m*h;return{x:g,y:x,zoom:h}},cu=(t,e=0)=>t.transition().duration(e);function eA(t,e,n,r){return(e[n]||[]).reduce((s,i)=>(`${t.id}-${i.id}-${n}`!==r&&s.push({id:i.id||null,type:n,nodeId:t.id,x:(t.positionAbsolute?.x??0)+i.x+i.width/2,y:(t.positionAbsolute?.y??0)+i.y+i.height/2}),s),[])}function NSe(t,e,n,r,s,i){const{x:a,y:o}=pc(t),h=e.elementsFromPoint(a,o).find(y=>y.classList.contains("react-flow__handle"));if(h){const y=h.getAttribute("data-nodeid");if(y){const w=SO(void 0,h),S=h.getAttribute("data-handleid"),k=i({nodeId:y,id:S,type:w});if(k){const N=s.find(C=>C.nodeId===y&&C.type===w&&C.id===S);return{handle:{id:S,type:w,nodeId:y,x:N?.x||n.x,y:N?.y||n.y},validHandleResult:k}}}}let f=[],m=1/0;if(s.forEach(y=>{const w=Math.sqrt((y.x-n.x)**2+(y.y-n.y)**2);if(w<=r){const S=i(y);w<=m&&(wy.isValid),x=f.some(({handle:y})=>y.type==="target");return f.find(({handle:y,validHandleResult:w})=>x?y.type==="target":g?w.isValid:!0)||f[0]}const CSe={source:null,target:null,sourceHandle:null,targetHandle:null},PH=()=>({handleDomNode:null,isValid:!1,connection:CSe,endHandle:null});function LH(t,e,n,r,s,i,a){const o=s==="target",c=a.querySelector(`.react-flow__handle[data-id="${t?.nodeId}-${t?.id}-${t?.type}"]`),h={...PH(),handleDomNode:c};if(c){const f=SO(void 0,c),m=c.getAttribute("data-nodeid"),g=c.getAttribute("data-handleid"),x=c.classList.contains("connectable"),y=c.classList.contains("connectableend"),w={source:o?m:n,sourceHandle:o?g:r,target:o?n:m,targetHandle:o?r:g};h.connection=w,x&&y&&(e===qu.Strict?o&&f==="source"||!o&&f==="target":m!==n||g!==r)&&(h.endHandle={nodeId:m,handleId:g,type:f},h.isValid=i(w))}return h}function TSe({nodes:t,nodeId:e,handleId:n,handleType:r}){return t.reduce((s,i)=>{if(i[Sr]){const{handleBounds:a}=i[Sr];let o=[],c=[];a&&(o=eA(i,a,"source",`${e}-${n}-${r}`),c=eA(i,a,"target",`${e}-${n}-${r}`)),s.push(...o,...c)}return s},[])}function SO(t,e){return t||(e?.classList.contains("target")?"target":e?.classList.contains("source")?"source":null)}function F4(t){t?.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function ESe(t,e){let n=null;return e?n="valid":t&&!e&&(n="invalid"),n}function IH({event:t,handleId:e,nodeId:n,onConnect:r,isTarget:s,getState:i,setState:a,isValidConnection:o,edgeUpdaterType:c,onReconnectEnd:h}){const f=kH(t.target),{connectionMode:m,domNode:g,autoPanOnConnect:x,connectionRadius:y,onConnectStart:w,panBy:S,getNodes:k,cancelConnection:N}=i();let C=0,T;const{x:_,y:E}=pc(t),M=f?.elementFromPoint(_,E),L=SO(c,M),P=g?.getBoundingClientRect();if(!P||!L)return;let I,Q=pc(t,P),U=!1,ee=null,z=!1,H=null;const B=TSe({nodes:k(),nodeId:n,handleId:e,handleType:L}),X=()=>{if(!x)return;const[R,se]=SH(Q,P);S({x:R,y:se}),C=requestAnimationFrame(X)};a({connectionPosition:Q,connectionStatus:null,connectionNodeId:n,connectionHandleId:e,connectionHandleType:L,connectionStartHandle:{nodeId:n,handleId:e,type:L},connectionEndHandle:null}),w?.(t,{nodeId:n,handleId:e,handleType:L});function J(R){const{transform:se}=i();Q=pc(R,P);const{handle:W,validHandleResult:F}=NSe(R,f,_k(Q,se,!1,[1,1]),y,B,V=>LH(V,m,n,e,s?"target":"source",o,f));if(T=W,U||(X(),U=!0),H=F.handleDomNode,ee=F.connection,z=F.isValid,a({connectionPosition:T&&z?AH({x:T.x,y:T.y},se):Q,connectionStatus:ESe(!!T,z),connectionEndHandle:F.endHandle}),!T&&!z&&!H)return F4(I);ee.source!==ee.target&&H&&(F4(I),I=H,H.classList.add("connecting","react-flow__handle-connecting"),H.classList.toggle("valid",z),H.classList.toggle("react-flow__handle-valid",z))}function G(R){(T||H)&&ee&&z&&r?.(ee),i().onConnectEnd?.(R),c&&h?.(R),F4(I),N(),cancelAnimationFrame(C),U=!1,z=!1,ee=null,H=null,f.removeEventListener("mousemove",J),f.removeEventListener("mouseup",G),f.removeEventListener("touchmove",J),f.removeEventListener("touchend",G)}f.addEventListener("mousemove",J),f.addEventListener("mouseup",G),f.addEventListener("touchmove",J),f.addEventListener("touchend",G)}const tA=()=>!0,_Se=t=>({connectionStartHandle:t.connectionStartHandle,connectOnClick:t.connectOnClick,noPanClassName:t.noPanClassName}),MSe=(t,e,n)=>r=>{const{connectionStartHandle:s,connectionEndHandle:i,connectionClickStartHandle:a}=r;return{connecting:s?.nodeId===t&&s?.handleId===e&&s?.type===n||i?.nodeId===t&&i?.handleId===e&&i?.type===n,clickConnecting:a?.nodeId===t&&a?.handleId===e&&a?.type===n}},BH=b.forwardRef(({type:t="source",position:e=mt.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:s=!0,isConnectableEnd:i=!0,id:a,onConnect:o,children:c,className:h,onMouseDown:f,onTouchStart:m,...g},x)=>{const y=a||null,w=t==="target",S=ns(),k=wSe(),{connectOnClick:N,noPanClassName:C}=er(_Se,os),{connecting:T,clickConnecting:_}=er(MSe(k,y,t),os);k||S.getState().onError?.("010",bo.error010());const E=P=>{const{defaultEdgeOptions:I,onConnect:Q,hasDefaultEdges:U}=S.getState(),ee={...I,...P};if(U){const{edges:z,setEdges:H}=S.getState();H(OSe(ee,z))}Q?.(ee),o?.(ee)},M=P=>{if(!k)return;const I=CH(P);s&&(I&&P.button===0||!I)&&IH({event:P,handleId:y,nodeId:k,onConnect:E,isTarget:w,getState:S.getState,setState:S.setState,isValidConnection:n||S.getState().isValidConnection||tA}),I?f?.(P):m?.(P)},L=P=>{const{onClickConnectStart:I,onClickConnectEnd:Q,connectionClickStartHandle:U,connectionMode:ee,isValidConnection:z}=S.getState();if(!k||!U&&!s)return;if(!U){I?.(P,{nodeId:k,handleId:y,handleType:t}),S.setState({connectionClickStartHandle:{nodeId:k,type:t,handleId:y}});return}const H=kH(P.target),B=n||z||tA,{connection:X,isValid:J}=LH({nodeId:k,id:y,type:t},ee,U.nodeId,U.handleId||null,U.type,B,H);J&&E(X),Q?.(P),S.setState({connectionClickStartHandle:null})};return he.createElement("div",{"data-handleid":y,"data-nodeid":k,"data-handlepos":e,"data-id":`${k}-${y}-${t}`,className:Ss(["react-flow__handle",`react-flow__handle-${e}`,"nodrag",C,h,{source:!w,target:w,connectable:r,connectablestart:s,connectableend:i,connecting:_,connectionindicator:r&&(s&&!T||i&&T)}]),onMouseDown:M,onTouchStart:M,onClick:N?L:void 0,ref:x,...g},c)});BH.displayName="Handle";var Tc=b.memo(BH);const qH=({data:t,isConnectable:e,targetPosition:n=mt.Top,sourcePosition:r=mt.Bottom})=>he.createElement(he.Fragment,null,he.createElement(Tc,{type:"target",position:n,isConnectable:e}),t?.label,he.createElement(Tc,{type:"source",position:r,isConnectable:e}));qH.displayName="DefaultNode";var Mk=b.memo(qH);const FH=({data:t,isConnectable:e,sourcePosition:n=mt.Bottom})=>he.createElement(he.Fragment,null,t?.label,he.createElement(Tc,{type:"source",position:n,isConnectable:e}));FH.displayName="InputNode";var $H=b.memo(FH);const QH=({data:t,isConnectable:e,targetPosition:n=mt.Top})=>he.createElement(he.Fragment,null,he.createElement(Tc,{type:"target",position:n,isConnectable:e}),t?.label);QH.displayName="OutputNode";var HH=b.memo(QH);const kO=()=>null;kO.displayName="GroupNode";const ASe=t=>({selectedNodes:t.getNodes().filter(e=>e.selected),selectedEdges:t.edges.filter(e=>e.selected).map(e=>({...e}))}),Fx=t=>t.id;function RSe(t,e){return os(t.selectedNodes.map(Fx),e.selectedNodes.map(Fx))&&os(t.selectedEdges.map(Fx),e.selectedEdges.map(Fx))}const VH=b.memo(({onSelectionChange:t})=>{const e=ns(),{selectedNodes:n,selectedEdges:r}=er(ASe,RSe);return b.useEffect(()=>{const s={nodes:n,edges:r};t?.(s),e.getState().onSelectionChange.forEach(i=>i(s))},[n,r,t]),null});VH.displayName="SelectionListener";const DSe=t=>!!t.onSelectionChange;function zSe({onSelectionChange:t}){const e=er(DSe);return t||e?he.createElement(VH,{onSelectionChange:t}):null}const PSe=t=>({setNodes:t.setNodes,setEdges:t.setEdges,setDefaultNodesAndEdges:t.setDefaultNodesAndEdges,setMinZoom:t.setMinZoom,setMaxZoom:t.setMaxZoom,setTranslateExtent:t.setTranslateExtent,setNodeExtent:t.setNodeExtent,reset:t.reset});function Ad(t,e){b.useEffect(()=>{typeof t<"u"&&e(t)},[t])}function Kt(t,e,n){b.useEffect(()=>{typeof e<"u"&&n({[t]:e})},[e])}const LSe=({nodes:t,edges:e,defaultNodes:n,defaultEdges:r,onConnect:s,onConnectStart:i,onConnectEnd:a,onClickConnectStart:o,onClickConnectEnd:c,nodesDraggable:h,nodesConnectable:f,nodesFocusable:m,edgesFocusable:g,edgesUpdatable:x,elevateNodesOnSelect:y,minZoom:w,maxZoom:S,nodeExtent:k,onNodesChange:N,onEdgesChange:C,elementsSelectable:T,connectionMode:_,snapGrid:E,snapToGrid:M,translateExtent:L,connectOnClick:P,defaultEdgeOptions:I,fitView:Q,fitViewOptions:U,onNodesDelete:ee,onEdgesDelete:z,onNodeDrag:H,onNodeDragStart:B,onNodeDragStop:X,onSelectionDrag:J,onSelectionDragStart:G,onSelectionDragStop:R,noPanClassName:se,nodeOrigin:W,rfId:F,autoPanOnConnect:V,autoPanOnNodeDrag:te,onError:ne,connectionRadius:K,isValidConnection:ie,nodeDragThreshold:re})=>{const{setNodes:ae,setEdges:_e,setDefaultNodesAndEdges:Ue,setMinZoom:Xe,setMaxZoom:Ze,setTranslateExtent:Oe,setNodeExtent:He,reset:Ve}=er(PSe,os),Be=ns();return b.useEffect(()=>{const ut=r?.map(rt=>({...rt,...I}));return Ue(n,ut),()=>{Ve()}},[]),Kt("defaultEdgeOptions",I,Be.setState),Kt("connectionMode",_,Be.setState),Kt("onConnect",s,Be.setState),Kt("onConnectStart",i,Be.setState),Kt("onConnectEnd",a,Be.setState),Kt("onClickConnectStart",o,Be.setState),Kt("onClickConnectEnd",c,Be.setState),Kt("nodesDraggable",h,Be.setState),Kt("nodesConnectable",f,Be.setState),Kt("nodesFocusable",m,Be.setState),Kt("edgesFocusable",g,Be.setState),Kt("edgesUpdatable",x,Be.setState),Kt("elementsSelectable",T,Be.setState),Kt("elevateNodesOnSelect",y,Be.setState),Kt("snapToGrid",M,Be.setState),Kt("snapGrid",E,Be.setState),Kt("onNodesChange",N,Be.setState),Kt("onEdgesChange",C,Be.setState),Kt("connectOnClick",P,Be.setState),Kt("fitViewOnInit",Q,Be.setState),Kt("fitViewOnInitOptions",U,Be.setState),Kt("onNodesDelete",ee,Be.setState),Kt("onEdgesDelete",z,Be.setState),Kt("onNodeDrag",H,Be.setState),Kt("onNodeDragStart",B,Be.setState),Kt("onNodeDragStop",X,Be.setState),Kt("onSelectionDrag",J,Be.setState),Kt("onSelectionDragStart",G,Be.setState),Kt("onSelectionDragStop",R,Be.setState),Kt("noPanClassName",se,Be.setState),Kt("nodeOrigin",W,Be.setState),Kt("rfId",F,Be.setState),Kt("autoPanOnConnect",V,Be.setState),Kt("autoPanOnNodeDrag",te,Be.setState),Kt("onError",ne,Be.setState),Kt("connectionRadius",K,Be.setState),Kt("isValidConnection",ie,Be.setState),Kt("nodeDragThreshold",re,Be.setState),Ad(t,ae),Ad(e,_e),Ad(w,Xe),Ad(S,Ze),Ad(L,Oe),Ad(k,He),null},nA={display:"none"},ISe={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},UH="react-flow__node-desc",WH="react-flow__edge-desc",BSe="react-flow__aria-live",qSe=t=>t.ariaLiveMessage;function FSe({rfId:t}){const e=er(qSe);return he.createElement("div",{id:`${BSe}-${t}`,"aria-live":"assertive","aria-atomic":"true",style:ISe},e)}function $Se({rfId:t,disableKeyboardA11y:e}){return he.createElement(he.Fragment,null,he.createElement("div",{id:`${UH}-${t}`,style:nA},"Press enter or space to select a node.",!e&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "),he.createElement("div",{id:`${WH}-${t}`,style:nA},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!e&&he.createElement(FSe,{rfId:t}))}var T0=(t=null,e={actInsideInputWithModifier:!0})=>{const[n,r]=b.useState(!1),s=b.useRef(!1),i=b.useRef(new Set([])),[a,o]=b.useMemo(()=>{if(t!==null){const h=(Array.isArray(t)?t:[t]).filter(m=>typeof m=="string").map(m=>m.split("+")),f=h.reduce((m,g)=>m.concat(...g),[]);return[h,f]}return[[],[]]},[t]);return b.useEffect(()=>{const c=typeof document<"u"?document:null,h=e?.target||c;if(t!==null){const f=x=>{if(s.current=x.ctrlKey||x.metaKey||x.shiftKey,(!s.current||s.current&&!e.actInsideInputWithModifier)&&Ck(x))return!1;const w=sA(x.code,o);i.current.add(x[w]),rA(a,i.current,!1)&&(x.preventDefault(),r(!0))},m=x=>{if((!s.current||s.current&&!e.actInsideInputWithModifier)&&Ck(x))return!1;const w=sA(x.code,o);rA(a,i.current,!0)?(r(!1),i.current.clear()):i.current.delete(x[w]),x.key==="Meta"&&i.current.clear(),s.current=!1},g=()=>{i.current.clear(),r(!1)};return h?.addEventListener("keydown",f),h?.addEventListener("keyup",m),window.addEventListener("blur",g),()=>{h?.removeEventListener("keydown",f),h?.removeEventListener("keyup",m),window.removeEventListener("blur",g)}}},[t,r]),n};function rA(t,e,n){return t.filter(r=>n||r.length===e.size).some(r=>r.every(s=>e.has(s)))}function sA(t,e){return e.includes(t)?"code":"key"}function GH(t,e,n,r){const s=t.parentNode||t.parentId;if(!s)return n;const i=e.get(s),a=Nu(i,r);return GH(i,e,{x:(n.x??0)+a.x,y:(n.y??0)+a.y,z:(i[Sr]?.z??0)>(n.z??0)?i[Sr]?.z??0:n.z??0},r)}function XH(t,e,n){t.forEach(r=>{const s=r.parentNode||r.parentId;if(s&&!t.has(s))throw new Error(`Parent node ${s} not found`);if(s||n?.[r.id]){const{x:i,y:a,z:o}=GH(r,t,{...r.position,z:r[Sr]?.z??0},e);r.positionAbsolute={x:i,y:a},r[Sr].z=o,n?.[r.id]&&(r[Sr].isParent=!0)}})}function $4(t,e,n,r){const s=new Map,i={},a=r?1e3:0;return t.forEach(o=>{const c=(na(o.zIndex)?o.zIndex:0)+(o.selected?a:0),h=e.get(o.id),f={...o,positionAbsolute:{x:o.position.x,y:o.position.y}},m=o.parentNode||o.parentId;m&&(i[m]=!0);const g=h?.type&&h?.type!==o.type;Object.defineProperty(f,Sr,{enumerable:!1,value:{handleBounds:g?void 0:h?.[Sr]?.handleBounds,z:c}}),s.set(o.id,f)}),XH(s,n,i),s}function YH(t,e={}){const{getNodes:n,width:r,height:s,minZoom:i,maxZoom:a,d3Zoom:o,d3Selection:c,fitViewOnInitDone:h,fitViewOnInit:f,nodeOrigin:m}=t(),g=e.initial&&!h&&f;if(o&&c&&(g||!e.initial)){const y=n().filter(S=>{const k=e.includeHiddenNodes?S.width&&S.height:!S.hidden;return e.nodes?.length?k&&e.nodes.some(N=>N.id===S.id):k}),w=y.every(S=>S.width&&S.height);if(y.length>0&&w){const S=By(y,m),{x:k,y:N,zoom:C}=zH(S,r,s,e.minZoom??i,e.maxZoom??a,e.padding??.1),T=ho.translate(k,N).scale(C);return typeof e.duration=="number"&&e.duration>0?o.transform(cu(c,e.duration),T):o.transform(c,T),!0}}return!1}function QSe(t,e){return t.forEach(n=>{const r=e.get(n.id);r&&e.set(r.id,{...r,[Sr]:r[Sr],selected:n.selected})}),new Map(e)}function HSe(t,e){return e.map(n=>{const r=t.find(s=>s.id===n.id);return r&&(n.selected=r.selected),n})}function $x({changedNodes:t,changedEdges:e,get:n,set:r}){const{nodeInternals:s,edges:i,onNodesChange:a,onEdgesChange:o,hasDefaultNodes:c,hasDefaultEdges:h}=n();t?.length&&(c&&r({nodeInternals:QSe(t,s)}),a?.(t)),e?.length&&(h&&r({edges:HSe(e,i)}),o?.(e))}const Rd=()=>{},VSe={zoomIn:Rd,zoomOut:Rd,zoomTo:Rd,getZoom:()=>1,setViewport:Rd,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:Rd,fitBounds:Rd,project:t=>t,screenToFlowPosition:t=>t,flowToScreenPosition:t=>t,viewportInitialized:!1},USe=t=>({d3Zoom:t.d3Zoom,d3Selection:t.d3Selection}),WSe=()=>{const t=ns(),{d3Zoom:e,d3Selection:n}=er(USe,os);return b.useMemo(()=>n&&e?{zoomIn:s=>e.scaleBy(cu(n,s?.duration),1.2),zoomOut:s=>e.scaleBy(cu(n,s?.duration),1/1.2),zoomTo:(s,i)=>e.scaleTo(cu(n,i?.duration),s),getZoom:()=>t.getState().transform[2],setViewport:(s,i)=>{const[a,o,c]=t.getState().transform,h=ho.translate(s.x??a,s.y??o).scale(s.zoom??c);e.transform(cu(n,i?.duration),h)},getViewport:()=>{const[s,i,a]=t.getState().transform;return{x:s,y:i,zoom:a}},fitView:s=>YH(t.getState,s),setCenter:(s,i,a)=>{const{width:o,height:c,maxZoom:h}=t.getState(),f=typeof a?.zoom<"u"?a.zoom:h,m=o/2-s*f,g=c/2-i*f,x=ho.translate(m,g).scale(f);e.transform(cu(n,a?.duration),x)},fitBounds:(s,i)=>{const{width:a,height:o,minZoom:c,maxZoom:h}=t.getState(),{x:f,y:m,zoom:g}=zH(s,a,o,c,h,i?.padding??.1),x=ho.translate(f,m).scale(g);e.transform(cu(n,i?.duration),x)},project:s=>{const{transform:i,snapToGrid:a,snapGrid:o}=t.getState();return console.warn("[DEPRECATED] `project` is deprecated. Instead use `screenToFlowPosition`. There is no need to subtract the react flow bounds anymore! https://reactflow.dev/api-reference/types/react-flow-instance#screen-to-flow-position"),_k(s,i,a,o)},screenToFlowPosition:s=>{const{transform:i,snapToGrid:a,snapGrid:o,domNode:c}=t.getState();if(!c)return s;const{x:h,y:f}=c.getBoundingClientRect(),m={x:s.x-h,y:s.y-f};return _k(m,i,a,o)},flowToScreenPosition:s=>{const{transform:i,domNode:a}=t.getState();if(!a)return s;const{x:o,y:c}=a.getBoundingClientRect(),h=AH(s,i);return{x:h.x+o,y:h.y+c}},viewportInitialized:!0}:VSe,[e,n])};function jO(){const t=WSe(),e=ns(),n=b.useCallback(()=>e.getState().getNodes().map(w=>({...w})),[]),r=b.useCallback(w=>e.getState().nodeInternals.get(w),[]),s=b.useCallback(()=>{const{edges:w=[]}=e.getState();return w.map(S=>({...S}))},[]),i=b.useCallback(w=>{const{edges:S=[]}=e.getState();return S.find(k=>k.id===w)},[]),a=b.useCallback(w=>{const{getNodes:S,setNodes:k,hasDefaultNodes:N,onNodesChange:C}=e.getState(),T=S(),_=typeof w=="function"?w(T):w;if(N)k(_);else if(C){const E=_.length===0?T.map(M=>({type:"remove",id:M.id})):_.map(M=>({item:M,type:"reset"}));C(E)}},[]),o=b.useCallback(w=>{const{edges:S=[],setEdges:k,hasDefaultEdges:N,onEdgesChange:C}=e.getState(),T=typeof w=="function"?w(S):w;if(N)k(T);else if(C){const _=T.length===0?S.map(E=>({type:"remove",id:E.id})):T.map(E=>({item:E,type:"reset"}));C(_)}},[]),c=b.useCallback(w=>{const S=Array.isArray(w)?w:[w],{getNodes:k,setNodes:N,hasDefaultNodes:C,onNodesChange:T}=e.getState();if(C){const E=[...k(),...S];N(E)}else if(T){const _=S.map(E=>({item:E,type:"add"}));T(_)}},[]),h=b.useCallback(w=>{const S=Array.isArray(w)?w:[w],{edges:k=[],setEdges:N,hasDefaultEdges:C,onEdgesChange:T}=e.getState();if(C)N([...k,...S]);else if(T){const _=S.map(E=>({item:E,type:"add"}));T(_)}},[]),f=b.useCallback(()=>{const{getNodes:w,edges:S=[],transform:k}=e.getState(),[N,C,T]=k;return{nodes:w().map(_=>({..._})),edges:S.map(_=>({..._})),viewport:{x:N,y:C,zoom:T}}},[]),m=b.useCallback(({nodes:w,edges:S})=>{const{nodeInternals:k,getNodes:N,edges:C,hasDefaultNodes:T,hasDefaultEdges:_,onNodesDelete:E,onEdgesDelete:M,onNodesChange:L,onEdgesChange:P}=e.getState(),I=(w||[]).map(H=>H.id),Q=(S||[]).map(H=>H.id),U=N().reduce((H,B)=>{const X=B.parentNode||B.parentId,J=!I.includes(B.id)&&X&&H.find(R=>R.id===X);return(typeof B.deletable=="boolean"?B.deletable:!0)&&(I.includes(B.id)||J)&&H.push(B),H},[]),ee=C.filter(H=>typeof H.deletable=="boolean"?H.deletable:!0),z=ee.filter(H=>Q.includes(H.id));if(U||z){const H=DH(U,ee),B=[...z,...H],X=B.reduce((J,G)=>(J.includes(G.id)||J.push(G.id),J),[]);if((_||T)&&(_&&e.setState({edges:C.filter(J=>!X.includes(J.id))}),T&&(U.forEach(J=>{k.delete(J.id)}),e.setState({nodeInternals:new Map(k)}))),X.length>0&&(M?.(B),P&&P(X.map(J=>({id:J,type:"remove"})))),U.length>0&&(E?.(U),L)){const J=U.map(G=>({id:G.id,type:"remove"}));L(J)}}},[]),g=b.useCallback(w=>{const S=fSe(w),k=S?null:e.getState().nodeInternals.get(w.id);return!S&&!k?[null,null,S]:[S?w:XM(k),k,S]},[]),x=b.useCallback((w,S=!0,k)=>{const[N,C,T]=g(w);return N?(k||e.getState().getNodes()).filter(_=>{if(!T&&(_.id===C.id||!_.positionAbsolute))return!1;const E=XM(_),M=Nk(E,N);return S&&M>0||M>=N.width*N.height}):[]},[]),y=b.useCallback((w,S,k=!0)=>{const[N]=g(w);if(!N)return!1;const C=Nk(N,S);return k&&C>0||C>=N.width*N.height},[]);return b.useMemo(()=>({...t,getNodes:n,getNode:r,getEdges:s,getEdge:i,setNodes:a,setEdges:o,addNodes:c,addEdges:h,toObject:f,deleteElements:m,getIntersectingNodes:x,isNodeIntersecting:y}),[t,n,r,s,i,a,o,c,h,f,m,x,y])}const GSe={actInsideInputWithModifier:!1};var XSe=({deleteKeyCode:t,multiSelectionKeyCode:e})=>{const n=ns(),{deleteElements:r}=jO(),s=T0(t,GSe),i=T0(e);b.useEffect(()=>{if(s){const{edges:a,getNodes:o}=n.getState(),c=o().filter(f=>f.selected),h=a.filter(f=>f.selected);r({nodes:c,edges:h}),n.setState({nodesSelectionActive:!1})}},[s]),b.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])};function YSe(t){const e=ns();b.useEffect(()=>{let n;const r=()=>{if(!t.current)return;const s=gO(t.current);(s.height===0||s.width===0)&&e.getState().onError?.("004",bo.error004()),e.setState({width:s.width||500,height:s.height||500})};return r(),window.addEventListener("resize",r),t.current&&(n=new ResizeObserver(()=>r()),n.observe(t.current)),()=>{window.removeEventListener("resize",r),n&&t.current&&n.unobserve(t.current)}},[])}const OO={position:"absolute",width:"100%",height:"100%",top:0,left:0},KSe=(t,e)=>t.x!==e.x||t.y!==e.y||t.zoom!==e.k,Qx=t=>({x:t.x,y:t.y,zoom:t.k}),Dd=(t,e)=>t.target.closest(`.${e}`),iA=(t,e)=>e===2&&Array.isArray(t)&&t.includes(2),aA=t=>{const e=t.ctrlKey&&yv()?10:1;return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*e},ZSe=t=>({d3Zoom:t.d3Zoom,d3Selection:t.d3Selection,d3ZoomHandler:t.d3ZoomHandler,userSelectionActive:t.userSelectionActive}),JSe=({onMove:t,onMoveStart:e,onMoveEnd:n,onPaneContextMenu:r,zoomOnScroll:s=!0,zoomOnPinch:i=!0,panOnScroll:a=!1,panOnScrollSpeed:o=.5,panOnScrollMode:c=vu.Free,zoomOnDoubleClick:h=!0,elementsSelectable:f,panOnDrag:m=!0,defaultViewport:g,translateExtent:x,minZoom:y,maxZoom:w,zoomActivationKeyCode:S,preventScrolling:k=!0,children:N,noWheelClassName:C,noPanClassName:T})=>{const _=b.useRef(),E=ns(),M=b.useRef(!1),L=b.useRef(!1),P=b.useRef(null),I=b.useRef({x:0,y:0,zoom:0}),{d3Zoom:Q,d3Selection:U,d3ZoomHandler:ee,userSelectionActive:z}=er(ZSe,os),H=T0(S),B=b.useRef(0),X=b.useRef(!1),J=b.useRef();return YSe(P),b.useEffect(()=>{if(P.current){const G=P.current.getBoundingClientRect(),R=bH().scaleExtent([y,w]).translateExtent(x),se=Ki(P.current).call(R),W=ho.translate(g.x,g.y).scale(Mh(g.zoom,y,w)),F=[[0,0],[G.width,G.height]],V=R.constrain()(W,F,x);R.transform(se,V),R.wheelDelta(aA),E.setState({d3Zoom:R,d3Selection:se,d3ZoomHandler:se.on("wheel.zoom"),transform:[V.x,V.y,V.k],domNode:P.current.closest(".react-flow")})}},[]),b.useEffect(()=>{U&&Q&&(a&&!H&&!z?U.on("wheel.zoom",G=>{if(Dd(G,C))return!1;G.preventDefault(),G.stopImmediatePropagation();const R=U.property("__zoom").k||1;if(G.ctrlKey&&i){const ie=ka(G),re=aA(G),ae=R*Math.pow(2,re);Q.scaleTo(U,ae,ie,G);return}const se=G.deltaMode===1?20:1;let W=c===vu.Vertical?0:G.deltaX*se,F=c===vu.Horizontal?0:G.deltaY*se;!yv()&&G.shiftKey&&c!==vu.Vertical&&(W=G.deltaY*se,F=0),Q.translateBy(U,-(W/R)*o,-(F/R)*o,{internal:!0});const V=Qx(U.property("__zoom")),{onViewportChangeStart:te,onViewportChange:ne,onViewportChangeEnd:K}=E.getState();clearTimeout(J.current),X.current||(X.current=!0,e?.(G,V),te?.(V)),X.current&&(t?.(G,V),ne?.(V),J.current=setTimeout(()=>{n?.(G,V),K?.(V),X.current=!1},150))},{passive:!1}):typeof ee<"u"&&U.on("wheel.zoom",function(G,R){if(!k&&G.type==="wheel"&&!G.ctrlKey||Dd(G,C))return null;G.preventDefault(),ee.call(this,G,R)},{passive:!1}))},[z,a,c,U,Q,ee,H,i,k,C,e,t,n]),b.useEffect(()=>{Q&&Q.on("start",G=>{if(!G.sourceEvent||G.sourceEvent.internal)return null;B.current=G.sourceEvent?.button;const{onViewportChangeStart:R}=E.getState(),se=Qx(G.transform);M.current=!0,I.current=se,G.sourceEvent?.type==="mousedown"&&E.setState({paneDragging:!0}),R?.(se),e?.(G.sourceEvent,se)})},[Q,e]),b.useEffect(()=>{Q&&(z&&!M.current?Q.on("zoom",null):z||Q.on("zoom",G=>{const{onViewportChange:R}=E.getState();if(E.setState({transform:[G.transform.x,G.transform.y,G.transform.k]}),L.current=!!(r&&iA(m,B.current??0)),(t||R)&&!G.sourceEvent?.internal){const se=Qx(G.transform);R?.(se),t?.(G.sourceEvent,se)}}))},[z,Q,t,m,r]),b.useEffect(()=>{Q&&Q.on("end",G=>{if(!G.sourceEvent||G.sourceEvent.internal)return null;const{onViewportChangeEnd:R}=E.getState();if(M.current=!1,E.setState({paneDragging:!1}),r&&iA(m,B.current??0)&&!L.current&&r(G.sourceEvent),L.current=!1,(n||R)&&KSe(I.current,G.transform)){const se=Qx(G.transform);I.current=se,clearTimeout(_.current),_.current=setTimeout(()=>{R?.(se),n?.(G.sourceEvent,se)},a?150:0)}})},[Q,a,m,n,r]),b.useEffect(()=>{Q&&Q.filter(G=>{const R=H||s,se=i&&G.ctrlKey;if((m===!0||Array.isArray(m)&&m.includes(1))&&G.button===1&&G.type==="mousedown"&&(Dd(G,"react-flow__node")||Dd(G,"react-flow__edge")))return!0;if(!m&&!R&&!a&&!h&&!i||z||!h&&G.type==="dblclick"||Dd(G,C)&&G.type==="wheel"||Dd(G,T)&&(G.type!=="wheel"||a&&G.type==="wheel"&&!H)||!i&&G.ctrlKey&&G.type==="wheel"||!R&&!a&&!se&&G.type==="wheel"||!m&&(G.type==="mousedown"||G.type==="touchstart")||Array.isArray(m)&&!m.includes(G.button)&&G.type==="mousedown")return!1;const W=Array.isArray(m)&&m.includes(G.button)||!G.button||G.button<=1;return(!G.ctrlKey||G.type==="wheel")&&W})},[z,Q,s,i,a,h,m,f,H]),he.createElement("div",{className:"react-flow__renderer",ref:P,style:OO},N)},eke=t=>({userSelectionActive:t.userSelectionActive,userSelectionRect:t.userSelectionRect});function tke(){const{userSelectionActive:t,userSelectionRect:e}=er(eke,os);return t&&e?he.createElement("div",{className:"react-flow__selection react-flow__container",style:{width:e.width,height:e.height,transform:`translate(${e.x}px, ${e.y}px)`}}):null}function lA(t,e){const n=e.parentNode||e.parentId,r=t.find(s=>s.id===n);if(r){const s=e.position.x+e.width-r.width,i=e.position.y+e.height-r.height;if(s>0||i>0||e.position.x<0||e.position.y<0){if(r.style={...r.style},r.style.width=r.style.width??r.width,r.style.height=r.style.height??r.height,s>0&&(r.style.width+=s),i>0&&(r.style.height+=i),e.position.x<0){const a=Math.abs(e.position.x);r.position.x=r.position.x-a,r.style.width+=a,e.position.x=0}if(e.position.y<0){const a=Math.abs(e.position.y);r.position.y=r.position.y-a,r.style.height+=a,e.position.y=0}r.width=r.style.width,r.height=r.style.height}}}function KH(t,e){if(t.some(r=>r.type==="reset"))return t.filter(r=>r.type==="reset").map(r=>r.item);const n=t.filter(r=>r.type==="add").map(r=>r.item);return e.reduce((r,s)=>{const i=t.filter(o=>o.id===s.id);if(i.length===0)return r.push(s),r;const a={...s};for(const o of i)if(o)switch(o.type){case"select":{a.selected=o.selected;break}case"position":{typeof o.position<"u"&&(a.position=o.position),typeof o.positionAbsolute<"u"&&(a.positionAbsolute=o.positionAbsolute),typeof o.dragging<"u"&&(a.dragging=o.dragging),a.expandParent&&lA(r,a);break}case"dimensions":{typeof o.dimensions<"u"&&(a.width=o.dimensions.width,a.height=o.dimensions.height),typeof o.updateStyle<"u"&&(a.style={...a.style||{},...o.dimensions}),typeof o.resizing=="boolean"&&(a.resizing=o.resizing),a.expandParent&&lA(r,a);break}case"remove":return r}return r.push(a),r},n)}function ZH(t,e){return KH(t,e)}function nke(t,e){return KH(t,e)}const oc=(t,e)=>({id:t,type:"select",selected:e});function Kd(t,e){return t.reduce((n,r)=>{const s=e.includes(r.id);return!r.selected&&s?(r.selected=!0,n.push(oc(r.id,!0))):r.selected&&!s&&(r.selected=!1,n.push(oc(r.id,!1))),n},[])}const Q4=(t,e)=>n=>{n.target===e.current&&t?.(n)},rke=t=>({userSelectionActive:t.userSelectionActive,elementsSelectable:t.elementsSelectable,dragging:t.paneDragging}),JH=b.memo(({isSelecting:t,selectionMode:e=C0.Full,panOnDrag:n,onSelectionStart:r,onSelectionEnd:s,onPaneClick:i,onPaneContextMenu:a,onPaneScroll:o,onPaneMouseEnter:c,onPaneMouseMove:h,onPaneMouseLeave:f,children:m})=>{const g=b.useRef(null),x=ns(),y=b.useRef(0),w=b.useRef(0),S=b.useRef(),{userSelectionActive:k,elementsSelectable:N,dragging:C}=er(rke,os),T=()=>{x.setState({userSelectionActive:!1,userSelectionRect:null}),y.current=0,w.current=0},_=ee=>{i?.(ee),x.getState().resetSelectedElements(),x.setState({nodesSelectionActive:!1})},E=ee=>{if(Array.isArray(n)&&n?.includes(2)){ee.preventDefault();return}a?.(ee)},M=o?ee=>o(ee):void 0,L=ee=>{const{resetSelectedElements:z,domNode:H}=x.getState();if(S.current=H?.getBoundingClientRect(),!N||!t||ee.button!==0||ee.target!==g.current||!S.current)return;const{x:B,y:X}=pc(ee,S.current);z(),x.setState({userSelectionRect:{width:0,height:0,startX:B,startY:X,x:B,y:X}}),r?.(ee)},P=ee=>{const{userSelectionRect:z,nodeInternals:H,edges:B,transform:X,onNodesChange:J,onEdgesChange:G,nodeOrigin:R,getNodes:se}=x.getState();if(!t||!S.current||!z)return;x.setState({userSelectionActive:!0,nodesSelectionActive:!1});const W=pc(ee,S.current),F=z.startX??0,V=z.startY??0,te={...z,x:W.xae.id),re=K.map(ae=>ae.id);if(y.current!==re.length){y.current=re.length;const ae=Kd(ne,re);ae.length&&J?.(ae)}if(w.current!==ie.length){w.current=ie.length;const ae=Kd(B,ie);ae.length&&G?.(ae)}x.setState({userSelectionRect:te})},I=ee=>{if(ee.button!==0)return;const{userSelectionRect:z}=x.getState();!k&&z&&ee.target===g.current&&_?.(ee),x.setState({nodesSelectionActive:y.current>0}),T(),s?.(ee)},Q=ee=>{k&&(x.setState({nodesSelectionActive:y.current>0}),s?.(ee)),T()},U=N&&(t||k);return he.createElement("div",{className:Ss(["react-flow__pane",{dragging:C,selection:t}]),onClick:U?void 0:Q4(_,g),onContextMenu:Q4(E,g),onWheel:Q4(M,g),onMouseEnter:U?void 0:c,onMouseDown:U?L:void 0,onMouseMove:U?P:h,onMouseUp:U?I:void 0,onMouseLeave:U?Q:f,ref:g,style:OO},m,he.createElement(tke,null))});JH.displayName="Pane";function eV(t,e){const n=t.parentNode||t.parentId;if(!n)return!1;const r=e.get(n);return r?r.selected?!0:eV(r,e):!1}function oA(t,e,n){let r=t;do{if(r?.matches(e))return!0;if(r===n.current)return!1;r=r.parentElement}while(r);return!1}function ske(t,e,n,r){return Array.from(t.values()).filter(s=>(s.selected||s.id===r)&&(!s.parentNode||s.parentId||!eV(s,t))&&(s.draggable||e&&typeof s.draggable>"u")).map(s=>({id:s.id,position:s.position||{x:0,y:0},positionAbsolute:s.positionAbsolute||{x:0,y:0},distance:{x:n.x-(s.positionAbsolute?.x??0),y:n.y-(s.positionAbsolute?.y??0)},delta:{x:0,y:0},extent:s.extent,parentNode:s.parentNode||s.parentId,parentId:s.parentNode||s.parentId,width:s.width,height:s.height,expandParent:s.expandParent}))}function ike(t,e){return!e||e==="parent"?e:[e[0],[e[1][0]-(t.width||0),e[1][1]-(t.height||0)]]}function tV(t,e,n,r,s=[0,0],i){const a=ike(t,t.extent||r);let o=a;const c=t.parentNode||t.parentId;if(t.extent==="parent"&&!t.expandParent)if(c&&t.width&&t.height){const m=n.get(c),{x:g,y:x}=Nu(m,s).positionAbsolute;o=m&&na(g)&&na(x)&&na(m.width)&&na(m.height)?[[g+t.width*s[0],x+t.height*s[1]],[g+m.width-t.width+t.width*s[0],x+m.height-t.height+t.height*s[1]]]:o}else i?.("005",bo.error005()),o=a;else if(t.extent&&c&&t.extent!=="parent"){const m=n.get(c),{x:g,y:x}=Nu(m,s).positionAbsolute;o=[[t.extent[0][0]+g,t.extent[0][1]+x],[t.extent[1][0]+g,t.extent[1][1]+x]]}let h={x:0,y:0};if(c){const m=n.get(c);h=Nu(m,s).positionAbsolute}const f=o&&o!=="parent"?xO(e,o):e;return{position:{x:f.x-h.x,y:f.y-h.y},positionAbsolute:f}}function H4({nodeId:t,dragItems:e,nodeInternals:n}){const r=e.map(s=>({...n.get(s.id),position:s.position,positionAbsolute:s.positionAbsolute}));return[t?r.find(s=>s.id===t):r[0],r]}const cA=(t,e,n,r)=>{const s=e.querySelectorAll(t);if(!s||!s.length)return null;const i=Array.from(s),a=e.getBoundingClientRect(),o={x:a.width*r[0],y:a.height*r[1]};return i.map(c=>{const h=c.getBoundingClientRect();return{id:c.getAttribute("data-handleid"),position:c.getAttribute("data-handlepos"),x:(h.left-a.left-o.x)/n,y:(h.top-a.top-o.y)/n,...gO(c)}})};function hm(t,e,n){return n===void 0?n:r=>{const s=e().nodeInternals.get(t);s&&n(r,{...s})}}function Ak({id:t,store:e,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:s,unselectNodesAndEdges:i,multiSelectionActive:a,nodeInternals:o,onError:c}=e.getState(),h=o.get(t);if(!h){c?.("012",bo.error012(t));return}e.setState({nodesSelectionActive:!1}),h.selected?(n||h.selected&&a)&&(i({nodes:[h],edges:[]}),requestAnimationFrame(()=>r?.current?.blur())):s([t])}function ake(){const t=ns();return b.useCallback(({sourceEvent:n})=>{const{transform:r,snapGrid:s,snapToGrid:i}=t.getState(),a=n.touches?n.touches[0].clientX:n.clientX,o=n.touches?n.touches[0].clientY:n.clientY,c={x:(a-r[0])/r[2],y:(o-r[1])/r[2]};return{xSnapped:i?s[0]*Math.round(c.x/s[0]):c.x,ySnapped:i?s[1]*Math.round(c.y/s[1]):c.y,...c}},[])}function V4(t){return(e,n,r)=>t?.(e,r)}function nV({nodeRef:t,disabled:e=!1,noDragClassName:n,handleSelector:r,nodeId:s,isSelectable:i,selectNodesOnDrag:a}){const o=ns(),[c,h]=b.useState(!1),f=b.useRef([]),m=b.useRef({x:null,y:null}),g=b.useRef(0),x=b.useRef(null),y=b.useRef({x:0,y:0}),w=b.useRef(null),S=b.useRef(!1),k=b.useRef(!1),N=b.useRef(!1),C=ake();return b.useEffect(()=>{if(t?.current){const T=Ki(t.current),_=({x:L,y:P})=>{const{nodeInternals:I,onNodeDrag:Q,onSelectionDrag:U,updateNodePositions:ee,nodeExtent:z,snapGrid:H,snapToGrid:B,nodeOrigin:X,onError:J}=o.getState();m.current={x:L,y:P};let G=!1,R={x:0,y:0,x2:0,y2:0};if(f.current.length>1&&z){const W=By(f.current,X);R=N0(W)}if(f.current=f.current.map(W=>{const F={x:L-W.distance.x,y:P-W.distance.y};B&&(F.x=H[0]*Math.round(F.x/H[0]),F.y=H[1]*Math.round(F.y/H[1]));const V=[[z[0][0],z[0][1]],[z[1][0],z[1][1]]];f.current.length>1&&z&&!W.extent&&(V[0][0]=W.positionAbsolute.x-R.x+z[0][0],V[1][0]=W.positionAbsolute.x+(W.width??0)-R.x2+z[1][0],V[0][1]=W.positionAbsolute.y-R.y+z[0][1],V[1][1]=W.positionAbsolute.y+(W.height??0)-R.y2+z[1][1]);const te=tV(W,F,I,V,X,J);return G=G||W.position.x!==te.position.x||W.position.y!==te.position.y,W.position=te.position,W.positionAbsolute=te.positionAbsolute,W}),!G)return;ee(f.current,!0,!0),h(!0);const se=s?Q:V4(U);if(se&&w.current){const[W,F]=H4({nodeId:s,dragItems:f.current,nodeInternals:I});se(w.current,W,F)}},E=()=>{if(!x.current)return;const[L,P]=SH(y.current,x.current);if(L!==0||P!==0){const{transform:I,panBy:Q}=o.getState();m.current.x=(m.current.x??0)-L/I[2],m.current.y=(m.current.y??0)-P/I[2],Q({x:L,y:P})&&_(m.current)}g.current=requestAnimationFrame(E)},M=L=>{const{nodeInternals:P,multiSelectionActive:I,nodesDraggable:Q,unselectNodesAndEdges:U,onNodeDragStart:ee,onSelectionDragStart:z}=o.getState();k.current=!0;const H=s?ee:V4(z);(!a||!i)&&!I&&s&&(P.get(s)?.selected||U()),s&&i&&a&&Ak({id:s,store:o,nodeRef:t});const B=C(L);if(m.current=B,f.current=ske(P,Q,B,s),H&&f.current){const[X,J]=H4({nodeId:s,dragItems:f.current,nodeInternals:P});H(L.sourceEvent,X,J)}};if(e)T.on(".drag",null);else{const L=Q5e().on("start",P=>{const{domNode:I,nodeDragThreshold:Q}=o.getState();Q===0&&M(P),N.current=!1;const U=C(P);m.current=U,x.current=I?.getBoundingClientRect()||null,y.current=pc(P.sourceEvent,x.current)}).on("drag",P=>{const I=C(P),{autoPanOnNodeDrag:Q,nodeDragThreshold:U}=o.getState();if(P.sourceEvent.type==="touchmove"&&P.sourceEvent.touches.length>1&&(N.current=!0),!N.current){if(!S.current&&k.current&&Q&&(S.current=!0,E()),!k.current){const ee=I.xSnapped-(m?.current?.x??0),z=I.ySnapped-(m?.current?.y??0);Math.sqrt(ee*ee+z*z)>U&&M(P)}(m.current.x!==I.xSnapped||m.current.y!==I.ySnapped)&&f.current&&k.current&&(w.current=P.sourceEvent,y.current=pc(P.sourceEvent,x.current),_(I))}}).on("end",P=>{if(!(!k.current||N.current)&&(h(!1),S.current=!1,k.current=!1,cancelAnimationFrame(g.current),f.current)){const{updateNodePositions:I,nodeInternals:Q,onNodeDragStop:U,onSelectionDragStop:ee}=o.getState(),z=s?U:V4(ee);if(I(f.current,!1,!1),z){const[H,B]=H4({nodeId:s,dragItems:f.current,nodeInternals:Q});z(P.sourceEvent,H,B)}}}).filter(P=>{const I=P.target;return!P.button&&(!n||!oA(I,`.${n}`,t))&&(!r||oA(I,r,t))});return T.call(L),()=>{T.on(".drag",null)}}}},[t,e,n,r,i,o,s,a,C]),c}function rV(){const t=ns();return b.useCallback(n=>{const{nodeInternals:r,nodeExtent:s,updateNodePositions:i,getNodes:a,snapToGrid:o,snapGrid:c,onError:h,nodesDraggable:f}=t.getState(),m=a().filter(N=>N.selected&&(N.draggable||f&&typeof N.draggable>"u")),g=o?c[0]:5,x=o?c[1]:5,y=n.isShiftPressed?4:1,w=n.x*g*y,S=n.y*x*y,k=m.map(N=>{if(N.positionAbsolute){const C={x:N.positionAbsolute.x+w,y:N.positionAbsolute.y+S};o&&(C.x=c[0]*Math.round(C.x/c[0]),C.y=c[1]*Math.round(C.y/c[1]));const{positionAbsolute:T,position:_}=tV(N,C,r,s,void 0,h);N.position=_,N.positionAbsolute=T}return N});i(k,!0,!1)},[])}const hh={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var fm=t=>{const e=({id:n,type:r,data:s,xPos:i,yPos:a,xPosOrigin:o,yPosOrigin:c,selected:h,onClick:f,onMouseEnter:m,onMouseMove:g,onMouseLeave:x,onContextMenu:y,onDoubleClick:w,style:S,className:k,isDraggable:N,isSelectable:C,isConnectable:T,isFocusable:_,selectNodesOnDrag:E,sourcePosition:M,targetPosition:L,hidden:P,resizeObserver:I,dragHandle:Q,zIndex:U,isParent:ee,noDragClassName:z,noPanClassName:H,initialized:B,disableKeyboardA11y:X,ariaLabel:J,rfId:G,hasHandleBounds:R})=>{const se=ns(),W=b.useRef(null),F=b.useRef(null),V=b.useRef(M),te=b.useRef(L),ne=b.useRef(r),K=C||N||f||m||g||x,ie=rV(),re=hm(n,se.getState,m),ae=hm(n,se.getState,g),_e=hm(n,se.getState,x),Ue=hm(n,se.getState,y),Xe=hm(n,se.getState,w),Ze=Ve=>{const{nodeDragThreshold:Be}=se.getState();if(C&&(!E||!N||Be>0)&&Ak({id:n,store:se,nodeRef:W}),f){const ut=se.getState().nodeInternals.get(n);ut&&f(Ve,{...ut})}},Oe=Ve=>{if(!Ck(Ve)&&!X)if(NH.includes(Ve.key)&&C){const Be=Ve.key==="Escape";Ak({id:n,store:se,unselect:Be,nodeRef:W})}else N&&h&&Object.prototype.hasOwnProperty.call(hh,Ve.key)&&(se.setState({ariaLiveMessage:`Moved selected node ${Ve.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~i}, y: ${~~a}`}),ie({x:hh[Ve.key].x,y:hh[Ve.key].y,isShiftPressed:Ve.shiftKey}))};b.useEffect(()=>()=>{F.current&&(I?.unobserve(F.current),F.current=null)},[]),b.useEffect(()=>{if(W.current&&!P){const Ve=W.current;(!B||!R||F.current!==Ve)&&(F.current&&I?.unobserve(F.current),I?.observe(Ve),F.current=Ve)}},[P,B,R]),b.useEffect(()=>{const Ve=ne.current!==r,Be=V.current!==M,ut=te.current!==L;W.current&&(Ve||Be||ut)&&(Ve&&(ne.current=r),Be&&(V.current=M),ut&&(te.current=L),se.getState().updateNodeDimensions([{id:n,nodeElement:W.current,forceUpdate:!0}]))},[n,r,M,L]);const He=nV({nodeRef:W,disabled:P||!N,noDragClassName:z,handleSelector:Q,nodeId:n,isSelectable:C,selectNodesOnDrag:E});return P?null:he.createElement("div",{className:Ss(["react-flow__node",`react-flow__node-${r}`,{[H]:N},k,{selected:h,selectable:C,parent:ee,dragging:He}]),ref:W,style:{zIndex:U,transform:`translate(${o}px,${c}px)`,pointerEvents:K?"all":"none",visibility:B?"visible":"hidden",...S},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:re,onMouseMove:ae,onMouseLeave:_e,onContextMenu:Ue,onClick:Ze,onDoubleClick:Xe,onKeyDown:_?Oe:void 0,tabIndex:_?0:void 0,role:_?"button":void 0,"aria-describedby":X?void 0:`${UH}-${G}`,"aria-label":J},he.createElement(bSe,{value:n},he.createElement(t,{id:n,data:s,type:r,xPos:i,yPos:a,selected:h,isConnectable:T,sourcePosition:M,targetPosition:L,dragging:He,dragHandle:Q,zIndex:U})))};return e.displayName="NodeWrapper",b.memo(e)};const lke=t=>{const e=t.getNodes().filter(n=>n.selected);return{...By(e,t.nodeOrigin),transformString:`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]})`,userSelectionActive:t.userSelectionActive}};function oke({onSelectionContextMenu:t,noPanClassName:e,disableKeyboardA11y:n}){const r=ns(),{width:s,height:i,x:a,y:o,transformString:c,userSelectionActive:h}=er(lke,os),f=rV(),m=b.useRef(null);if(b.useEffect(()=>{n||m.current?.focus({preventScroll:!0})},[n]),nV({nodeRef:m}),h||!s||!i)return null;const g=t?y=>{const w=r.getState().getNodes().filter(S=>S.selected);t(y,w)}:void 0,x=y=>{Object.prototype.hasOwnProperty.call(hh,y.key)&&f({x:hh[y.key].x,y:hh[y.key].y,isShiftPressed:y.shiftKey})};return he.createElement("div",{className:Ss(["react-flow__nodesselection","react-flow__container",e]),style:{transform:c}},he.createElement("div",{ref:m,className:"react-flow__nodesselection-rect",onContextMenu:g,tabIndex:n?void 0:-1,onKeyDown:n?void 0:x,style:{width:s,height:i,top:o,left:a}}))}var cke=b.memo(oke);const uke=t=>t.nodesSelectionActive,sV=({children:t,onPaneClick:e,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:i,onPaneScroll:a,deleteKeyCode:o,onMove:c,onMoveStart:h,onMoveEnd:f,selectionKeyCode:m,selectionOnDrag:g,selectionMode:x,onSelectionStart:y,onSelectionEnd:w,multiSelectionKeyCode:S,panActivationKeyCode:k,zoomActivationKeyCode:N,elementsSelectable:C,zoomOnScroll:T,zoomOnPinch:_,panOnScroll:E,panOnScrollSpeed:M,panOnScrollMode:L,zoomOnDoubleClick:P,panOnDrag:I,defaultViewport:Q,translateExtent:U,minZoom:ee,maxZoom:z,preventScrolling:H,onSelectionContextMenu:B,noWheelClassName:X,noPanClassName:J,disableKeyboardA11y:G})=>{const R=er(uke),se=T0(m),W=T0(k),F=W||I,V=W||E,te=se||g&&F!==!0;return XSe({deleteKeyCode:o,multiSelectionKeyCode:S}),he.createElement(JSe,{onMove:c,onMoveStart:h,onMoveEnd:f,onPaneContextMenu:i,elementsSelectable:C,zoomOnScroll:T,zoomOnPinch:_,panOnScroll:V,panOnScrollSpeed:M,panOnScrollMode:L,zoomOnDoubleClick:P,panOnDrag:!se&&F,defaultViewport:Q,translateExtent:U,minZoom:ee,maxZoom:z,zoomActivationKeyCode:N,preventScrolling:H,noWheelClassName:X,noPanClassName:J},he.createElement(JH,{onSelectionStart:y,onSelectionEnd:w,onPaneClick:e,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:i,onPaneScroll:a,panOnDrag:F,isSelecting:!!te,selectionMode:x},t,R&&he.createElement(cke,{onSelectionContextMenu:B,noPanClassName:J,disableKeyboardA11y:G})))};sV.displayName="FlowRenderer";var dke=b.memo(sV);function hke(t){return er(b.useCallback(n=>t?RH(n.nodeInternals,{x:0,y:0,width:n.width,height:n.height},n.transform,!0):n.getNodes(),[t]))}function fke(t){const e={input:fm(t.input||$H),default:fm(t.default||Mk),output:fm(t.output||HH),group:fm(t.group||kO)},n={},r=Object.keys(t).filter(s=>!["input","default","output","group"].includes(s)).reduce((s,i)=>(s[i]=fm(t[i]||Mk),s),n);return{...e,...r}}const mke=({x:t,y:e,width:n,height:r,origin:s})=>!n||!r?{x:t,y:e}:s[0]<0||s[1]<0||s[0]>1||s[1]>1?{x:t,y:e}:{x:t-n*s[0],y:e-r*s[1]},pke=t=>({nodesDraggable:t.nodesDraggable,nodesConnectable:t.nodesConnectable,nodesFocusable:t.nodesFocusable,elementsSelectable:t.elementsSelectable,updateNodeDimensions:t.updateNodeDimensions,onError:t.onError}),iV=t=>{const{nodesDraggable:e,nodesConnectable:n,nodesFocusable:r,elementsSelectable:s,updateNodeDimensions:i,onError:a}=er(pke,os),o=hke(t.onlyRenderVisibleElements),c=b.useRef(),h=b.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const f=new ResizeObserver(m=>{const g=m.map(x=>({id:x.target.getAttribute("data-id"),nodeElement:x.target,forceUpdate:!0}));i(g)});return c.current=f,f},[]);return b.useEffect(()=>()=>{c?.current?.disconnect()},[]),he.createElement("div",{className:"react-flow__nodes",style:OO},o.map(f=>{let m=f.type||"default";t.nodeTypes[m]||(a?.("003",bo.error003(m)),m="default");const g=t.nodeTypes[m]||t.nodeTypes.default,x=!!(f.draggable||e&&typeof f.draggable>"u"),y=!!(f.selectable||s&&typeof f.selectable>"u"),w=!!(f.connectable||n&&typeof f.connectable>"u"),S=!!(f.focusable||r&&typeof f.focusable>"u"),k=t.nodeExtent?xO(f.positionAbsolute,t.nodeExtent):f.positionAbsolute,N=k?.x??0,C=k?.y??0,T=mke({x:N,y:C,width:f.width??0,height:f.height??0,origin:t.nodeOrigin});return he.createElement(g,{key:f.id,id:f.id,className:f.className,style:f.style,type:m,data:f.data,sourcePosition:f.sourcePosition||mt.Bottom,targetPosition:f.targetPosition||mt.Top,hidden:f.hidden,xPos:N,yPos:C,xPosOrigin:T.x,yPosOrigin:T.y,selectNodesOnDrag:t.selectNodesOnDrag,onClick:t.onNodeClick,onMouseEnter:t.onNodeMouseEnter,onMouseMove:t.onNodeMouseMove,onMouseLeave:t.onNodeMouseLeave,onContextMenu:t.onNodeContextMenu,onDoubleClick:t.onNodeDoubleClick,selected:!!f.selected,isDraggable:x,isSelectable:y,isConnectable:w,isFocusable:S,resizeObserver:h,dragHandle:f.dragHandle,zIndex:f[Sr]?.z??0,isParent:!!f[Sr]?.isParent,noDragClassName:t.noDragClassName,noPanClassName:t.noPanClassName,initialized:!!f.width&&!!f.height,rfId:t.rfId,disableKeyboardA11y:t.disableKeyboardA11y,ariaLabel:f.ariaLabel,hasHandleBounds:!!f[Sr]?.handleBounds})}))};iV.displayName="NodeRenderer";var gke=b.memo(iV);const xke=(t,e,n)=>n===mt.Left?t-e:n===mt.Right?t+e:t,vke=(t,e,n)=>n===mt.Top?t-e:n===mt.Bottom?t+e:t,uA="react-flow__edgeupdater",dA=({position:t,centerX:e,centerY:n,radius:r=10,onMouseDown:s,onMouseEnter:i,onMouseOut:a,type:o})=>he.createElement("circle",{onMouseDown:s,onMouseEnter:i,onMouseOut:a,className:Ss([uA,`${uA}-${o}`]),cx:xke(e,r,t),cy:vke(n,r,t),r,stroke:"transparent",fill:"transparent"}),yke=()=>!0;var zd=t=>{const e=({id:n,className:r,type:s,data:i,onClick:a,onEdgeDoubleClick:o,selected:c,animated:h,label:f,labelStyle:m,labelShowBg:g,labelBgStyle:x,labelBgPadding:y,labelBgBorderRadius:w,style:S,source:k,target:N,sourceX:C,sourceY:T,targetX:_,targetY:E,sourcePosition:M,targetPosition:L,elementsSelectable:P,hidden:I,sourceHandleId:Q,targetHandleId:U,onContextMenu:ee,onMouseEnter:z,onMouseMove:H,onMouseLeave:B,reconnectRadius:X,onReconnect:J,onReconnectStart:G,onReconnectEnd:R,markerEnd:se,markerStart:W,rfId:F,ariaLabel:V,isFocusable:te,isReconnectable:ne,pathOptions:K,interactionWidth:ie,disableKeyboardA11y:re})=>{const ae=b.useRef(null),[_e,Ue]=b.useState(!1),[Xe,Ze]=b.useState(!1),Oe=ns(),He=b.useMemo(()=>`url('#${Ek(W,F)}')`,[W,F]),Ve=b.useMemo(()=>`url('#${Ek(se,F)}')`,[se,F]);if(I)return null;const Be=Tt=>{const{edges:ke,addSelectedEdges:Te,unselectNodesAndEdges:qe,multiSelectionActive:Rt}=Oe.getState(),At=ke.find(vr=>vr.id===n);At&&(P&&(Oe.setState({nodesSelectionActive:!1}),At.selected&&Rt?(qe({nodes:[],edges:[At]}),ae.current?.blur()):Te([n])),a&&a(Tt,At))},ut=dm(n,Oe.getState,o),rt=dm(n,Oe.getState,ee),rn=dm(n,Oe.getState,z),Rn=dm(n,Oe.getState,H),Tn=dm(n,Oe.getState,B),Mt=(Tt,ke)=>{if(Tt.button!==0)return;const{edges:Te,isValidConnection:qe}=Oe.getState(),Rt=ke?N:k,At=(ke?U:Q)||null,vr=ke?"target":"source",ft=qe||yke,mn=ke,gt=Te.find(it=>it.id===n);Ze(!0),G?.(Tt,gt,vr);const Nt=it=>{Ze(!1),R?.(it,gt,vr)};IH({event:Tt,handleId:At,nodeId:Rt,onConnect:it=>J?.(gt,it),isTarget:mn,getState:Oe.getState,setState:Oe.setState,isValidConnection:ft,edgeUpdaterType:vr,onReconnectEnd:Nt})},vt=Tt=>Mt(Tt,!0),Ce=Tt=>Mt(Tt,!1),Le=()=>Ue(!0),Ge=()=>Ue(!1),lt=!P&&!a,jt=Tt=>{if(!re&&NH.includes(Tt.key)&&P){const{unselectNodesAndEdges:ke,addSelectedEdges:Te,edges:qe}=Oe.getState();Tt.key==="Escape"?(ae.current?.blur(),ke({edges:[qe.find(At=>At.id===n)]})):Te([n])}};return he.createElement("g",{className:Ss(["react-flow__edge",`react-flow__edge-${s}`,r,{selected:c,animated:h,inactive:lt,updating:_e}]),onClick:Be,onDoubleClick:ut,onContextMenu:rt,onMouseEnter:rn,onMouseMove:Rn,onMouseLeave:Tn,onKeyDown:te?jt:void 0,tabIndex:te?0:void 0,role:te?"button":"img","data-testid":`rf__edge-${n}`,"aria-label":V===null?void 0:V||`Edge from ${k} to ${N}`,"aria-describedby":te?`${WH}-${F}`:void 0,ref:ae},!Xe&&he.createElement(t,{id:n,source:k,target:N,selected:c,animated:h,label:f,labelStyle:m,labelShowBg:g,labelBgStyle:x,labelBgPadding:y,labelBgBorderRadius:w,data:i,style:S,sourceX:C,sourceY:T,targetX:_,targetY:E,sourcePosition:M,targetPosition:L,sourceHandleId:Q,targetHandleId:U,markerStart:He,markerEnd:Ve,pathOptions:K,interactionWidth:ie}),ne&&he.createElement(he.Fragment,null,(ne==="source"||ne===!0)&&he.createElement(dA,{position:M,centerX:C,centerY:T,radius:X,onMouseDown:vt,onMouseEnter:Le,onMouseOut:Ge,type:"source"}),(ne==="target"||ne===!0)&&he.createElement(dA,{position:L,centerX:_,centerY:E,radius:X,onMouseDown:Ce,onMouseEnter:Le,onMouseOut:Ge,type:"target"})))};return e.displayName="EdgeWrapper",b.memo(e)};function bke(t){const e={default:zd(t.default||wv),straight:zd(t.bezier||bO),step:zd(t.step||yO),smoothstep:zd(t.step||Iy),simplebezier:zd(t.simplebezier||vO)},n={},r=Object.keys(t).filter(s=>!["default","bezier"].includes(s)).reduce((s,i)=>(s[i]=zd(t[i]||wv),s),n);return{...e,...r}}function hA(t,e,n=null){const r=(n?.x||0)+e.x,s=(n?.y||0)+e.y,i=n?.width||e.width,a=n?.height||e.height;switch(t){case mt.Top:return{x:r+i/2,y:s};case mt.Right:return{x:r+i,y:s+a/2};case mt.Bottom:return{x:r+i/2,y:s+a};case mt.Left:return{x:r,y:s+a/2}}}function fA(t,e){return t?t.length===1||!e?t[0]:e&&t.find(n=>n.id===e)||null:null}const wke=(t,e,n,r,s,i)=>{const a=hA(n,t,e),o=hA(i,r,s);return{sourceX:a.x,sourceY:a.y,targetX:o.x,targetY:o.y}};function Ske({sourcePos:t,targetPos:e,sourceWidth:n,sourceHeight:r,targetWidth:s,targetHeight:i,width:a,height:o,transform:c}){const h={x:Math.min(t.x,e.x),y:Math.min(t.y,e.y),x2:Math.max(t.x+n,e.x+s),y2:Math.max(t.y+r,e.y+i)};h.x===h.x2&&(h.x2+=1),h.y===h.y2&&(h.y2+=1);const f=N0({x:(0-c[0])/c[2],y:(0-c[1])/c[2],width:a/c[2],height:o/c[2]}),m=Math.max(0,Math.min(f.x2,h.x2)-Math.max(f.x,h.x)),g=Math.max(0,Math.min(f.y2,h.y2)-Math.max(f.y,h.y));return Math.ceil(m*g)>0}function mA(t){const e=t?.[Sr]?.handleBounds||null,n=e&&t?.width&&t?.height&&typeof t?.positionAbsolute?.x<"u"&&typeof t?.positionAbsolute?.y<"u";return[{x:t?.positionAbsolute?.x||0,y:t?.positionAbsolute?.y||0,width:t?.width||0,height:t?.height||0},e,!!n]}const kke=[{level:0,isMaxLevel:!0,edges:[]}];function jke(t,e,n=!1){let r=-1;const s=t.reduce((a,o)=>{const c=na(o.zIndex);let h=c?o.zIndex:0;if(n){const f=e.get(o.target),m=e.get(o.source),g=o.selected||f?.selected||m?.selected,x=Math.max(m?.[Sr]?.z||0,f?.[Sr]?.z||0,1e3);h=(c?o.zIndex:0)+(g?x:0)}return a[h]?a[h].push(o):a[h]=[o],r=h>r?h:r,a},{}),i=Object.entries(s).map(([a,o])=>{const c=+a;return{edges:o,level:c,isMaxLevel:c===r}});return i.length===0?kke:i}function Oke(t,e,n){const r=er(b.useCallback(s=>t?s.edges.filter(i=>{const a=e.get(i.source),o=e.get(i.target);return a?.width&&a?.height&&o?.width&&o?.height&&Ske({sourcePos:a.positionAbsolute||{x:0,y:0},targetPos:o.positionAbsolute||{x:0,y:0},sourceWidth:a.width,sourceHeight:a.height,targetWidth:o.width,targetHeight:o.height,width:s.width,height:s.height,transform:s.transform})}):s.edges,[t,e]));return jke(r,e,n)}const Nke=({color:t="none",strokeWidth:e=1})=>he.createElement("polyline",{style:{stroke:t,strokeWidth:e},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),Cke=({color:t="none",strokeWidth:e=1})=>he.createElement("polyline",{style:{stroke:t,fill:t,strokeWidth:e},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"}),pA={[bv.Arrow]:Nke,[bv.ArrowClosed]:Cke};function Tke(t){const e=ns();return b.useMemo(()=>Object.prototype.hasOwnProperty.call(pA,t)?pA[t]:(e.getState().onError?.("009",bo.error009(t)),null),[t])}const Eke=({id:t,type:e,color:n,width:r=12.5,height:s=12.5,markerUnits:i="strokeWidth",strokeWidth:a,orient:o="auto-start-reverse"})=>{const c=Tke(e);return c?he.createElement("marker",{className:"react-flow__arrowhead",id:t,markerWidth:`${r}`,markerHeight:`${s}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:o,refX:"0",refY:"0"},he.createElement(c,{color:n,strokeWidth:a})):null},_ke=({defaultColor:t,rfId:e})=>n=>{const r=[];return n.edges.reduce((s,i)=>([i.markerStart,i.markerEnd].forEach(a=>{if(a&&typeof a=="object"){const o=Ek(a,e);r.includes(o)||(s.push({id:o,color:a.color||t,...a}),r.push(o))}}),s),[]).sort((s,i)=>s.id.localeCompare(i.id))},aV=({defaultColor:t,rfId:e})=>{const n=er(b.useCallback(_ke({defaultColor:t,rfId:e}),[t,e]),(r,s)=>!(r.length!==s.length||r.some((i,a)=>i.id!==s[a].id)));return he.createElement("defs",null,n.map(r=>he.createElement(Eke,{id:r.id,key:r.id,type:r.type,color:r.color,width:r.width,height:r.height,markerUnits:r.markerUnits,strokeWidth:r.strokeWidth,orient:r.orient})))};aV.displayName="MarkerDefinitions";var Mke=b.memo(aV);const Ake=t=>({nodesConnectable:t.nodesConnectable,edgesFocusable:t.edgesFocusable,edgesUpdatable:t.edgesUpdatable,elementsSelectable:t.elementsSelectable,width:t.width,height:t.height,connectionMode:t.connectionMode,nodeInternals:t.nodeInternals,onError:t.onError}),lV=({defaultMarkerColor:t,onlyRenderVisibleElements:e,elevateEdgesOnSelect:n,rfId:r,edgeTypes:s,noPanClassName:i,onEdgeContextMenu:a,onEdgeMouseEnter:o,onEdgeMouseMove:c,onEdgeMouseLeave:h,onEdgeClick:f,onEdgeDoubleClick:m,onReconnect:g,onReconnectStart:x,onReconnectEnd:y,reconnectRadius:w,children:S,disableKeyboardA11y:k})=>{const{edgesFocusable:N,edgesUpdatable:C,elementsSelectable:T,width:_,height:E,connectionMode:M,nodeInternals:L,onError:P}=er(Ake,os),I=Oke(e,L,n);return _?he.createElement(he.Fragment,null,I.map(({level:Q,edges:U,isMaxLevel:ee})=>he.createElement("svg",{key:Q,style:{zIndex:Q},width:_,height:E,className:"react-flow__edges react-flow__container"},ee&&he.createElement(Mke,{defaultColor:t,rfId:r}),he.createElement("g",null,U.map(z=>{const[H,B,X]=mA(L.get(z.source)),[J,G,R]=mA(L.get(z.target));if(!X||!R)return null;let se=z.type||"default";s[se]||(P?.("011",bo.error011(se)),se="default");const W=s[se]||s.default,F=M===qu.Strict?G.target:(G.target??[]).concat(G.source??[]),V=fA(B.source,z.sourceHandle),te=fA(F,z.targetHandle),ne=V?.position||mt.Bottom,K=te?.position||mt.Top,ie=!!(z.focusable||N&&typeof z.focusable>"u"),re=z.reconnectable||z.updatable,ae=typeof g<"u"&&(re||C&&typeof re>"u");if(!V||!te)return P?.("008",bo.error008(V,z)),null;const{sourceX:_e,sourceY:Ue,targetX:Xe,targetY:Ze}=wke(H,V,ne,J,te,K);return he.createElement(W,{key:z.id,id:z.id,className:Ss([z.className,i]),type:se,data:z.data,selected:!!z.selected,animated:!!z.animated,hidden:!!z.hidden,label:z.label,labelStyle:z.labelStyle,labelShowBg:z.labelShowBg,labelBgStyle:z.labelBgStyle,labelBgPadding:z.labelBgPadding,labelBgBorderRadius:z.labelBgBorderRadius,style:z.style,source:z.source,target:z.target,sourceHandleId:z.sourceHandle,targetHandleId:z.targetHandle,markerEnd:z.markerEnd,markerStart:z.markerStart,sourceX:_e,sourceY:Ue,targetX:Xe,targetY:Ze,sourcePosition:ne,targetPosition:K,elementsSelectable:T,onContextMenu:a,onMouseEnter:o,onMouseMove:c,onMouseLeave:h,onClick:f,onEdgeDoubleClick:m,onReconnect:g,onReconnectStart:x,onReconnectEnd:y,reconnectRadius:w,rfId:r,ariaLabel:z.ariaLabel,isFocusable:ie,isReconnectable:ae,pathOptions:"pathOptions"in z?z.pathOptions:void 0,interactionWidth:z.interactionWidth,disableKeyboardA11y:k})})))),S):null};lV.displayName="EdgeRenderer";var Rke=b.memo(lV);const Dke=t=>`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]})`;function zke({children:t}){const e=er(Dke);return he.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:e}},t)}function Pke(t){const e=jO(),n=b.useRef(!1);b.useEffect(()=>{!n.current&&e.viewportInitialized&&t&&(setTimeout(()=>t(e),1),n.current=!0)},[t,e.viewportInitialized])}const Lke={[mt.Left]:mt.Right,[mt.Right]:mt.Left,[mt.Top]:mt.Bottom,[mt.Bottom]:mt.Top},oV=({nodeId:t,handleType:e,style:n,type:r=uc.Bezier,CustomComponent:s,connectionStatus:i})=>{const{fromNode:a,handleId:o,toX:c,toY:h,connectionMode:f}=er(b.useCallback(E=>({fromNode:E.nodeInternals.get(t),handleId:E.connectionHandleId,toX:(E.connectionPosition.x-E.transform[0])/E.transform[2],toY:(E.connectionPosition.y-E.transform[1])/E.transform[2],connectionMode:E.connectionMode}),[t]),os),m=a?.[Sr]?.handleBounds;let g=m?.[e];if(f===qu.Loose&&(g=g||m?.[e==="source"?"target":"source"]),!a||!g)return null;const x=o?g.find(E=>E.id===o):g[0],y=x?x.x+x.width/2:(a.width??0)/2,w=x?x.y+x.height/2:a.height??0,S=(a.positionAbsolute?.x??0)+y,k=(a.positionAbsolute?.y??0)+w,N=x?.position,C=N?Lke[N]:null;if(!N||!C)return null;if(s)return he.createElement(s,{connectionLineType:r,connectionLineStyle:n,fromNode:a,fromHandle:x,fromX:S,fromY:k,toX:c,toY:h,fromPosition:N,toPosition:C,connectionStatus:i});let T="";const _={sourceX:S,sourceY:k,sourcePosition:N,targetX:c,targetY:h,targetPosition:C};return r===uc.Bezier?[T]=MH(_):r===uc.Step?[T]=Tk({..._,borderRadius:0}):r===uc.SmoothStep?[T]=Tk(_):r===uc.SimpleBezier?[T]=_H(_):T=`M${S},${k} ${c},${h}`,he.createElement("path",{d:T,fill:"none",className:"react-flow__connection-path",style:n})};oV.displayName="ConnectionLine";const Ike=t=>({nodeId:t.connectionNodeId,handleType:t.connectionHandleType,nodesConnectable:t.nodesConnectable,connectionStatus:t.connectionStatus,width:t.width,height:t.height});function Bke({containerStyle:t,style:e,type:n,component:r}){const{nodeId:s,handleType:i,nodesConnectable:a,width:o,height:c,connectionStatus:h}=er(Ike,os);return!(s&&i&&o&&a)?null:he.createElement("svg",{style:t,width:o,height:c,className:"react-flow__edges react-flow__connectionline react-flow__container"},he.createElement("g",{className:Ss(["react-flow__connection",h])},he.createElement(oV,{nodeId:s,handleType:i,style:e,type:n,CustomComponent:r,connectionStatus:h})))}function gA(t,e){return b.useRef(null),ns(),b.useMemo(()=>e(t),[t])}const cV=({nodeTypes:t,edgeTypes:e,onMove:n,onMoveStart:r,onMoveEnd:s,onInit:i,onNodeClick:a,onEdgeClick:o,onNodeDoubleClick:c,onEdgeDoubleClick:h,onNodeMouseEnter:f,onNodeMouseMove:m,onNodeMouseLeave:g,onNodeContextMenu:x,onSelectionContextMenu:y,onSelectionStart:w,onSelectionEnd:S,connectionLineType:k,connectionLineStyle:N,connectionLineComponent:C,connectionLineContainerStyle:T,selectionKeyCode:_,selectionOnDrag:E,selectionMode:M,multiSelectionKeyCode:L,panActivationKeyCode:P,zoomActivationKeyCode:I,deleteKeyCode:Q,onlyRenderVisibleElements:U,elementsSelectable:ee,selectNodesOnDrag:z,defaultViewport:H,translateExtent:B,minZoom:X,maxZoom:J,preventScrolling:G,defaultMarkerColor:R,zoomOnScroll:se,zoomOnPinch:W,panOnScroll:F,panOnScrollSpeed:V,panOnScrollMode:te,zoomOnDoubleClick:ne,panOnDrag:K,onPaneClick:ie,onPaneMouseEnter:re,onPaneMouseMove:ae,onPaneMouseLeave:_e,onPaneScroll:Ue,onPaneContextMenu:Xe,onEdgeContextMenu:Ze,onEdgeMouseEnter:Oe,onEdgeMouseMove:He,onEdgeMouseLeave:Ve,onReconnect:Be,onReconnectStart:ut,onReconnectEnd:rt,reconnectRadius:rn,noDragClassName:Rn,noWheelClassName:Tn,noPanClassName:Mt,elevateEdgesOnSelect:vt,disableKeyboardA11y:Ce,nodeOrigin:Le,nodeExtent:Ge,rfId:lt})=>{const jt=gA(t,fke),Tt=gA(e,bke);return Pke(i),he.createElement(dke,{onPaneClick:ie,onPaneMouseEnter:re,onPaneMouseMove:ae,onPaneMouseLeave:_e,onPaneContextMenu:Xe,onPaneScroll:Ue,deleteKeyCode:Q,selectionKeyCode:_,selectionOnDrag:E,selectionMode:M,onSelectionStart:w,onSelectionEnd:S,multiSelectionKeyCode:L,panActivationKeyCode:P,zoomActivationKeyCode:I,elementsSelectable:ee,onMove:n,onMoveStart:r,onMoveEnd:s,zoomOnScroll:se,zoomOnPinch:W,zoomOnDoubleClick:ne,panOnScroll:F,panOnScrollSpeed:V,panOnScrollMode:te,panOnDrag:K,defaultViewport:H,translateExtent:B,minZoom:X,maxZoom:J,onSelectionContextMenu:y,preventScrolling:G,noDragClassName:Rn,noWheelClassName:Tn,noPanClassName:Mt,disableKeyboardA11y:Ce},he.createElement(zke,null,he.createElement(Rke,{edgeTypes:Tt,onEdgeClick:o,onEdgeDoubleClick:h,onlyRenderVisibleElements:U,onEdgeContextMenu:Ze,onEdgeMouseEnter:Oe,onEdgeMouseMove:He,onEdgeMouseLeave:Ve,onReconnect:Be,onReconnectStart:ut,onReconnectEnd:rt,reconnectRadius:rn,defaultMarkerColor:R,noPanClassName:Mt,elevateEdgesOnSelect:!!vt,disableKeyboardA11y:Ce,rfId:lt},he.createElement(Bke,{style:N,type:k,component:C,containerStyle:T})),he.createElement("div",{className:"react-flow__edgelabel-renderer"}),he.createElement(gke,{nodeTypes:jt,onNodeClick:a,onNodeDoubleClick:c,onNodeMouseEnter:f,onNodeMouseMove:m,onNodeMouseLeave:g,onNodeContextMenu:x,selectNodesOnDrag:z,onlyRenderVisibleElements:U,noPanClassName:Mt,noDragClassName:Rn,disableKeyboardA11y:Ce,nodeOrigin:Le,nodeExtent:Ge,rfId:lt})))};cV.displayName="GraphView";var qke=b.memo(cV);const Rk=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],nc={rfId:"1",width:0,height:0,transform:[0,0,1],nodeInternals:new Map,edges:[],onNodesChange:null,onEdgesChange:null,hasDefaultNodes:!1,hasDefaultEdges:!1,d3Zoom:null,d3Selection:null,d3ZoomHandler:void 0,minZoom:.5,maxZoom:2,translateExtent:Rk,nodeExtent:Rk,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:qu.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:[0,0],nodeDragThreshold:0,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesUpdatable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,fitViewOnInit:!1,fitViewOnInitDone:!1,fitViewOnInitOptions:void 0,onSelectionChange:[],multiSelectionActive:!1,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,connectionRadius:20,onError:mSe,isValidConnection:void 0},Fke=()=>t4e((t,e)=>({...nc,setNodes:n=>{const{nodeInternals:r,nodeOrigin:s,elevateNodesOnSelect:i}=e();t({nodeInternals:$4(n,r,s,i)})},getNodes:()=>Array.from(e().nodeInternals.values()),setEdges:n=>{const{defaultEdgeOptions:r={}}=e();t({edges:n.map(s=>({...r,...s}))})},setDefaultNodesAndEdges:(n,r)=>{const s=typeof n<"u",i=typeof r<"u",a=s?$4(n,new Map,e().nodeOrigin,e().elevateNodesOnSelect):new Map;t({nodeInternals:a,edges:i?r:[],hasDefaultNodes:s,hasDefaultEdges:i})},updateNodeDimensions:n=>{const{onNodesChange:r,nodeInternals:s,fitViewOnInit:i,fitViewOnInitDone:a,fitViewOnInitOptions:o,domNode:c,nodeOrigin:h}=e(),f=c?.querySelector(".react-flow__viewport");if(!f)return;const m=window.getComputedStyle(f),{m22:g}=new window.DOMMatrixReadOnly(m.transform),x=n.reduce((w,S)=>{const k=s.get(S.id);if(k?.hidden)s.set(k.id,{...k,[Sr]:{...k[Sr],handleBounds:void 0}});else if(k){const N=gO(S.nodeElement);!!(N.width&&N.height&&(k.width!==N.width||k.height!==N.height||S.forceUpdate))&&(s.set(k.id,{...k,[Sr]:{...k[Sr],handleBounds:{source:cA(".source",S.nodeElement,g,h),target:cA(".target",S.nodeElement,g,h)}},...N}),w.push({id:k.id,type:"dimensions",dimensions:N}))}return w},[]);XH(s,h);const y=a||i&&!a&&YH(e,{initial:!0,...o});t({nodeInternals:new Map(s),fitViewOnInitDone:y}),x?.length>0&&r?.(x)},updateNodePositions:(n,r=!0,s=!1)=>{const{triggerNodeChanges:i}=e(),a=n.map(o=>{const c={id:o.id,type:"position",dragging:s};return r&&(c.positionAbsolute=o.positionAbsolute,c.position=o.position),c});i(a)},triggerNodeChanges:n=>{const{onNodesChange:r,nodeInternals:s,hasDefaultNodes:i,nodeOrigin:a,getNodes:o,elevateNodesOnSelect:c}=e();if(n?.length){if(i){const h=ZH(n,o()),f=$4(h,s,a,c);t({nodeInternals:f})}r?.(n)}},addSelectedNodes:n=>{const{multiSelectionActive:r,edges:s,getNodes:i}=e();let a,o=null;r?a=n.map(c=>oc(c,!0)):(a=Kd(i(),n),o=Kd(s,[])),$x({changedNodes:a,changedEdges:o,get:e,set:t})},addSelectedEdges:n=>{const{multiSelectionActive:r,edges:s,getNodes:i}=e();let a,o=null;r?a=n.map(c=>oc(c,!0)):(a=Kd(s,n),o=Kd(i(),[])),$x({changedNodes:o,changedEdges:a,get:e,set:t})},unselectNodesAndEdges:({nodes:n,edges:r}={})=>{const{edges:s,getNodes:i}=e(),a=n||i(),o=r||s,c=a.map(f=>(f.selected=!1,oc(f.id,!1))),h=o.map(f=>oc(f.id,!1));$x({changedNodes:c,changedEdges:h,get:e,set:t})},setMinZoom:n=>{const{d3Zoom:r,maxZoom:s}=e();r?.scaleExtent([n,s]),t({minZoom:n})},setMaxZoom:n=>{const{d3Zoom:r,minZoom:s}=e();r?.scaleExtent([s,n]),t({maxZoom:n})},setTranslateExtent:n=>{e().d3Zoom?.translateExtent(n),t({translateExtent:n})},resetSelectedElements:()=>{const{edges:n,getNodes:r}=e(),i=r().filter(o=>o.selected).map(o=>oc(o.id,!1)),a=n.filter(o=>o.selected).map(o=>oc(o.id,!1));$x({changedNodes:i,changedEdges:a,get:e,set:t})},setNodeExtent:n=>{const{nodeInternals:r}=e();r.forEach(s=>{s.positionAbsolute=xO(s.position,n)}),t({nodeExtent:n,nodeInternals:new Map(r)})},panBy:n=>{const{transform:r,width:s,height:i,d3Zoom:a,d3Selection:o,translateExtent:c}=e();if(!a||!o||!n.x&&!n.y)return!1;const h=ho.translate(r[0]+n.x,r[1]+n.y).scale(r[2]),f=[[0,0],[s,i]],m=a?.constrain()(h,f,c);return a.transform(o,m),r[0]!==m.x||r[1]!==m.y||r[2]!==m.k},cancelConnection:()=>t({connectionNodeId:nc.connectionNodeId,connectionHandleId:nc.connectionHandleId,connectionHandleType:nc.connectionHandleType,connectionStatus:nc.connectionStatus,connectionStartHandle:nc.connectionStartHandle,connectionEndHandle:nc.connectionEndHandle}),reset:()=>t({...nc})}),Object.is),uV=({children:t})=>{const e=b.useRef(null);return e.current||(e.current=Fke()),he.createElement(lSe,{value:e.current},t)};uV.displayName="ReactFlowProvider";const dV=({children:t})=>b.useContext(Py)?he.createElement(he.Fragment,null,t):he.createElement(uV,null,t);dV.displayName="ReactFlowWrapper";const $ke={input:$H,default:Mk,output:HH,group:kO},Qke={default:wv,straight:bO,step:yO,smoothstep:Iy,simplebezier:vO},Hke=[0,0],Vke=[15,15],Uke={x:0,y:0,zoom:1},Wke={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},hV=b.forwardRef(({nodes:t,edges:e,defaultNodes:n,defaultEdges:r,className:s,nodeTypes:i=$ke,edgeTypes:a=Qke,onNodeClick:o,onEdgeClick:c,onInit:h,onMove:f,onMoveStart:m,onMoveEnd:g,onConnect:x,onConnectStart:y,onConnectEnd:w,onClickConnectStart:S,onClickConnectEnd:k,onNodeMouseEnter:N,onNodeMouseMove:C,onNodeMouseLeave:T,onNodeContextMenu:_,onNodeDoubleClick:E,onNodeDragStart:M,onNodeDrag:L,onNodeDragStop:P,onNodesDelete:I,onEdgesDelete:Q,onSelectionChange:U,onSelectionDragStart:ee,onSelectionDrag:z,onSelectionDragStop:H,onSelectionContextMenu:B,onSelectionStart:X,onSelectionEnd:J,connectionMode:G=qu.Strict,connectionLineType:R=uc.Bezier,connectionLineStyle:se,connectionLineComponent:W,connectionLineContainerStyle:F,deleteKeyCode:V="Backspace",selectionKeyCode:te="Shift",selectionOnDrag:ne=!1,selectionMode:K=C0.Full,panActivationKeyCode:ie="Space",multiSelectionKeyCode:re=yv()?"Meta":"Control",zoomActivationKeyCode:ae=yv()?"Meta":"Control",snapToGrid:_e=!1,snapGrid:Ue=Vke,onlyRenderVisibleElements:Xe=!1,selectNodesOnDrag:Ze=!0,nodesDraggable:Oe,nodesConnectable:He,nodesFocusable:Ve,nodeOrigin:Be=Hke,edgesFocusable:ut,edgesUpdatable:rt,elementsSelectable:rn,defaultViewport:Rn=Uke,minZoom:Tn=.5,maxZoom:Mt=2,translateExtent:vt=Rk,preventScrolling:Ce=!0,nodeExtent:Le,defaultMarkerColor:Ge="#b1b1b7",zoomOnScroll:lt=!0,zoomOnPinch:jt=!0,panOnScroll:Tt=!1,panOnScrollSpeed:ke=.5,panOnScrollMode:Te=vu.Free,zoomOnDoubleClick:qe=!0,panOnDrag:Rt=!0,onPaneClick:At,onPaneMouseEnter:vr,onPaneMouseMove:ft,onPaneMouseLeave:mn,onPaneScroll:gt,onPaneContextMenu:Nt,children:Ot,onEdgeContextMenu:it,onEdgeDoubleClick:Vn,onEdgeMouseEnter:jr,onEdgeMouseMove:Or,onEdgeMouseLeave:ge,onEdgeUpdate:ze,onEdgeUpdateStart:Et,onEdgeUpdateEnd:Gt,onReconnect:Mr,onReconnectStart:Wr,onReconnectEnd:Ar,reconnectRadius:Rr=10,edgeUpdaterRadius:ga=10,onNodesChange:mi,onEdgesChange:Ba,noDragClassName:Hs="nodrag",noWheelClassName:Gr="nowheel",noPanClassName:ds="nopan",fitView:No=!1,fitViewOptions:nf,connectOnClick:Uy=!0,attributionPosition:Wy,proOptions:Tp,defaultEdgeOptions:Bc,elevateNodesOnSelect:rf=!0,elevateEdgesOnSelect:Co=!1,disableKeyboardA11y:jl=!1,autoPanOnConnect:qc=!0,autoPanOnNodeDrag:To=!0,connectionRadius:Dr=20,isValidConnection:Ep,onError:_p,style:Ol,id:Nl,nodeDragThreshold:Gy,...Mp},Ap)=>{const sf=Nl||"1";return he.createElement("div",{...Mp,style:{...Ol,...Wke},ref:Ap,className:Ss(["react-flow",s]),"data-testid":"rf__wrapper",id:Nl},he.createElement(dV,null,he.createElement(qke,{onInit:h,onMove:f,onMoveStart:m,onMoveEnd:g,onNodeClick:o,onEdgeClick:c,onNodeMouseEnter:N,onNodeMouseMove:C,onNodeMouseLeave:T,onNodeContextMenu:_,onNodeDoubleClick:E,nodeTypes:i,edgeTypes:a,connectionLineType:R,connectionLineStyle:se,connectionLineComponent:W,connectionLineContainerStyle:F,selectionKeyCode:te,selectionOnDrag:ne,selectionMode:K,deleteKeyCode:V,multiSelectionKeyCode:re,panActivationKeyCode:ie,zoomActivationKeyCode:ae,onlyRenderVisibleElements:Xe,selectNodesOnDrag:Ze,defaultViewport:Rn,translateExtent:vt,minZoom:Tn,maxZoom:Mt,preventScrolling:Ce,zoomOnScroll:lt,zoomOnPinch:jt,zoomOnDoubleClick:qe,panOnScroll:Tt,panOnScrollSpeed:ke,panOnScrollMode:Te,panOnDrag:Rt,onPaneClick:At,onPaneMouseEnter:vr,onPaneMouseMove:ft,onPaneMouseLeave:mn,onPaneScroll:gt,onPaneContextMenu:Nt,onSelectionContextMenu:B,onSelectionStart:X,onSelectionEnd:J,onEdgeContextMenu:it,onEdgeDoubleClick:Vn,onEdgeMouseEnter:jr,onEdgeMouseMove:Or,onEdgeMouseLeave:ge,onReconnect:Mr??ze,onReconnectStart:Wr??Et,onReconnectEnd:Ar??Gt,reconnectRadius:Rr??ga,defaultMarkerColor:Ge,noDragClassName:Hs,noWheelClassName:Gr,noPanClassName:ds,elevateEdgesOnSelect:Co,rfId:sf,disableKeyboardA11y:jl,nodeOrigin:Be,nodeExtent:Le}),he.createElement(LSe,{nodes:t,edges:e,defaultNodes:n,defaultEdges:r,onConnect:x,onConnectStart:y,onConnectEnd:w,onClickConnectStart:S,onClickConnectEnd:k,nodesDraggable:Oe,nodesConnectable:He,nodesFocusable:Ve,edgesFocusable:ut,edgesUpdatable:rt,elementsSelectable:rn,elevateNodesOnSelect:rf,minZoom:Tn,maxZoom:Mt,nodeExtent:Le,onNodesChange:mi,onEdgesChange:Ba,snapToGrid:_e,snapGrid:Ue,connectionMode:G,translateExtent:vt,connectOnClick:Uy,defaultEdgeOptions:Bc,fitView:No,fitViewOptions:nf,onNodesDelete:I,onEdgesDelete:Q,onNodeDragStart:M,onNodeDrag:L,onNodeDragStop:P,onSelectionDrag:z,onSelectionDragStart:ee,onSelectionDragStop:H,noPanClassName:ds,nodeOrigin:Be,rfId:sf,autoPanOnConnect:qc,autoPanOnNodeDrag:To,onError:_p,connectionRadius:Dr,isValidConnection:Ep,nodeDragThreshold:Gy}),he.createElement(zSe,{onSelectionChange:U}),Ot,he.createElement(cSe,{proOptions:Tp,position:Wy}),he.createElement($Se,{rfId:sf,disableKeyboardA11y:jl})))});hV.displayName="ReactFlow";function fV(t){return e=>{const[n,r]=b.useState(e),s=b.useCallback(i=>r(a=>t(i,a)),[]);return[n,r,s]}}const Gke=fV(ZH),Xke=fV(nke),mV=({id:t,x:e,y:n,width:r,height:s,style:i,color:a,strokeColor:o,strokeWidth:c,className:h,borderRadius:f,shapeRendering:m,onClick:g,selected:x})=>{const{background:y,backgroundColor:w}=i||{},S=a||y||w;return he.createElement("rect",{className:Ss(["react-flow__minimap-node",{selected:x},h]),x:e,y:n,rx:f,ry:f,width:r,height:s,fill:S,stroke:o,strokeWidth:c,shapeRendering:m,onClick:g?k=>g(k,t):void 0})};mV.displayName="MiniMapNode";var Yke=b.memo(mV);const Kke=t=>t.nodeOrigin,Zke=t=>t.getNodes().filter(e=>!e.hidden&&e.width&&e.height),U4=t=>t instanceof Function?t:()=>t;function Jke({nodeStrokeColor:t="transparent",nodeColor:e="#e2e2e2",nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:s=2,nodeComponent:i=Yke,onClick:a}){const o=er(Zke,os),c=er(Kke),h=U4(e),f=U4(t),m=U4(n),g=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return he.createElement(he.Fragment,null,o.map(x=>{const{x:y,y:w}=Nu(x,c).positionAbsolute;return he.createElement(i,{key:x.id,x:y,y:w,width:x.width,height:x.height,style:x.style,selected:x.selected,className:m(x),color:h(x),borderRadius:r,strokeColor:f(x),strokeWidth:s,shapeRendering:g,onClick:a,id:x.id})}))}var e6e=b.memo(Jke);const t6e=200,n6e=150,r6e=t=>{const e=t.getNodes(),n={x:-t.transform[0]/t.transform[2],y:-t.transform[1]/t.transform[2],width:t.width/t.transform[2],height:t.height/t.transform[2]};return{viewBB:n,boundingRect:e.length>0?hSe(By(e,t.nodeOrigin),n):n,rfId:t.rfId}},s6e="react-flow__minimap-desc";function pV({style:t,className:e,nodeStrokeColor:n="transparent",nodeColor:r="#e2e2e2",nodeClassName:s="",nodeBorderRadius:i=5,nodeStrokeWidth:a=2,nodeComponent:o,maskColor:c="rgb(240, 240, 240, 0.6)",maskStrokeColor:h="none",maskStrokeWidth:f=1,position:m="bottom-right",onClick:g,onNodeClick:x,pannable:y=!1,zoomable:w=!1,ariaLabel:S="React Flow mini map",inversePan:k=!1,zoomStep:N=10,offsetScale:C=5}){const T=ns(),_=b.useRef(null),{boundingRect:E,viewBB:M,rfId:L}=er(r6e,os),P=t?.width??t6e,I=t?.height??n6e,Q=E.width/P,U=E.height/I,ee=Math.max(Q,U),z=ee*P,H=ee*I,B=C*ee,X=E.x-(z-E.width)/2-B,J=E.y-(H-E.height)/2-B,G=z+B*2,R=H+B*2,se=`${s6e}-${L}`,W=b.useRef(0);W.current=ee,b.useEffect(()=>{if(_.current){const te=Ki(_.current),ne=re=>{const{transform:ae,d3Selection:_e,d3Zoom:Ue}=T.getState();if(re.sourceEvent.type!=="wheel"||!_e||!Ue)return;const Xe=-re.sourceEvent.deltaY*(re.sourceEvent.deltaMode===1?.05:re.sourceEvent.deltaMode?1:.002)*N,Ze=ae[2]*Math.pow(2,Xe);Ue.scaleTo(_e,Ze)},K=re=>{const{transform:ae,d3Selection:_e,d3Zoom:Ue,translateExtent:Xe,width:Ze,height:Oe}=T.getState();if(re.sourceEvent.type!=="mousemove"||!_e||!Ue)return;const He=W.current*Math.max(1,ae[2])*(k?-1:1),Ve={x:ae[0]-re.sourceEvent.movementX*He,y:ae[1]-re.sourceEvent.movementY*He},Be=[[0,0],[Ze,Oe]],ut=ho.translate(Ve.x,Ve.y).scale(ae[2]),rt=Ue.constrain()(ut,Be,Xe);Ue.transform(_e,rt)},ie=bH().on("zoom",y?K:null).on("zoom.wheel",w?ne:null);return te.call(ie),()=>{te.on("zoom",null)}}},[y,w,k,N]);const F=g?te=>{const ne=ka(te);g(te,{x:ne[0],y:ne[1]})}:void 0,V=x?(te,ne)=>{const K=T.getState().nodeInternals.get(ne);x(te,K)}:void 0;return he.createElement(Ly,{position:m,style:t,className:Ss(["react-flow__minimap",e]),"data-testid":"rf__minimap"},he.createElement("svg",{width:P,height:I,viewBox:`${X} ${J} ${G} ${R}`,role:"img","aria-labelledby":se,ref:_,onClick:F},S&&he.createElement("title",{id:se},S),he.createElement(e6e,{onClick:V,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:s,nodeStrokeWidth:a,nodeComponent:o}),he.createElement("path",{className:"react-flow__minimap-mask",d:`M${X-B},${J-B}h${G+B*2}v${R+B*2}h${-G-B*2}z + M${M.x},${M.y}h${M.width}v${M.height}h${-M.width}z`,fill:c,fillRule:"evenodd",stroke:h,strokeWidth:f,pointerEvents:"none"})))}pV.displayName="MiniMap";var i6e=b.memo(pV);function a6e(){return he.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},he.createElement("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"}))}function l6e(){return he.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},he.createElement("path",{d:"M0 0h32v4.2H0z"}))}function o6e(){return he.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},he.createElement("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"}))}function c6e(){return he.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},he.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"}))}function u6e(){return he.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},he.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"}))}const Sm=({children:t,className:e,...n})=>he.createElement("button",{type:"button",className:Ss(["react-flow__controls-button",e]),...n},t);Sm.displayName="ControlButton";const d6e=t=>({isInteractive:t.nodesDraggable||t.nodesConnectable||t.elementsSelectable,minZoomReached:t.transform[2]<=t.minZoom,maxZoomReached:t.transform[2]>=t.maxZoom}),gV=({style:t,showZoom:e=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:s,onZoomIn:i,onZoomOut:a,onFitView:o,onInteractiveChange:c,className:h,children:f,position:m="bottom-left"})=>{const g=ns(),[x,y]=b.useState(!1),{isInteractive:w,minZoomReached:S,maxZoomReached:k}=er(d6e,os),{zoomIn:N,zoomOut:C,fitView:T}=jO();if(b.useEffect(()=>{y(!0)},[]),!x)return null;const _=()=>{N(),i?.()},E=()=>{C(),a?.()},M=()=>{T(s),o?.()},L=()=>{g.setState({nodesDraggable:!w,nodesConnectable:!w,elementsSelectable:!w}),c?.(!w)};return he.createElement(Ly,{className:Ss(["react-flow__controls",h]),position:m,style:t,"data-testid":"rf__controls"},e&&he.createElement(he.Fragment,null,he.createElement(Sm,{onClick:_,className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:k},he.createElement(a6e,null)),he.createElement(Sm,{onClick:E,className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:S},he.createElement(l6e,null))),n&&he.createElement(Sm,{className:"react-flow__controls-fitview",onClick:M,title:"fit view","aria-label":"fit view"},he.createElement(o6e,null)),r&&he.createElement(Sm,{className:"react-flow__controls-interactive",onClick:L,title:"toggle interactivity","aria-label":"toggle interactivity"},w?he.createElement(u6e,null):he.createElement(c6e,null)),f)};gV.displayName="Controls";var h6e=b.memo(gV),aa;(function(t){t.Lines="lines",t.Dots="dots",t.Cross="cross"})(aa||(aa={}));function f6e({color:t,dimensions:e,lineWidth:n}){return he.createElement("path",{stroke:t,strokeWidth:n,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`})}function m6e({color:t,radius:e}){return he.createElement("circle",{cx:e,cy:e,r:e,fill:t})}const p6e={[aa.Dots]:"#91919a",[aa.Lines]:"#eee",[aa.Cross]:"#e2e2e2"},g6e={[aa.Dots]:1,[aa.Lines]:1,[aa.Cross]:6},x6e=t=>({transform:t.transform,patternId:`pattern-${t.rfId}`});function xV({id:t,variant:e=aa.Dots,gap:n=20,size:r,lineWidth:s=1,offset:i=2,color:a,style:o,className:c}){const h=b.useRef(null),{transform:f,patternId:m}=er(x6e,os),g=a||p6e[e],x=r||g6e[e],y=e===aa.Dots,w=e===aa.Cross,S=Array.isArray(n)?n:[n,n],k=[S[0]*f[2]||1,S[1]*f[2]||1],N=x*f[2],C=w?[N,N]:k,T=y?[N/i,N/i]:[C[0]/i,C[1]/i];return he.createElement("svg",{className:Ss(["react-flow__background",c]),style:{...o,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:h,"data-testid":"rf__background"},he.createElement("pattern",{id:m+t,x:f[0]%k[0],y:f[1]%k[1],width:k[0],height:k[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${T[0]},-${T[1]})`},y?he.createElement(m6e,{color:g,radius:N/i}):he.createElement(f6e,{dimensions:C,color:g,lineWidth:s})),he.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${m+t})`}))}xV.displayName="Background";var v6e=b.memo(xV);function NO(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var W4,xA;function y6e(){if(xA)return W4;xA=1;var t=ND(),e=4;function n(r){return t(r,e)}return W4=n,W4}var G4,vA;function vV(){if(vA)return G4;vA=1;var t=MY();function e(n){return typeof n=="function"?n:t}return G4=e,G4}var X4,yA;function yV(){if(yA)return X4;yA=1;var t=CD(),e=$k(),n=vV(),r=Fu();function s(i,a){var o=r(i)?t:e;return o(i,n(a))}return X4=s,X4}var Y4,bA;function bV(){return bA||(bA=1,Y4=yV()),Y4}var K4,wA;function b6e(){if(wA)return K4;wA=1;var t=$k();function e(n,r){var s=[];return t(n,function(i,a,o){r(i,a,o)&&s.push(i)}),s}return K4=e,K4}var Z4,SA;function wV(){if(SA)return Z4;SA=1;var t=AY(),e=b6e(),n=Qk(),r=Fu();function s(i,a){var o=r(i)?t:e;return o(i,n(a,3))}return Z4=s,Z4}var J4,kA;function w6e(){if(kA)return J4;kA=1;var t=Object.prototype,e=t.hasOwnProperty;function n(r,s){return r!=null&&e.call(r,s)}return J4=n,J4}var e5,jA;function SV(){if(jA)return e5;jA=1;var t=w6e(),e=RY();function n(r,s){return r!=null&&e(r,s,t)}return e5=n,e5}var t5,OA;function S6e(){if(OA)return t5;OA=1;var t=TD(),e=ED(),n=_D(),r=Fu(),s=Hk(),i=Vk(),a=DY(),o=Uk(),c="[object Map]",h="[object Set]",f=Object.prototype,m=f.hasOwnProperty;function g(x){if(x==null)return!0;if(s(x)&&(r(x)||typeof x=="string"||typeof x.splice=="function"||i(x)||o(x)||n(x)))return!x.length;var y=e(x);if(y==c||y==h)return!x.size;if(a(x))return!t(x).length;for(var w in x)if(m.call(x,w))return!1;return!0}return t5=g,t5}var n5,NA;function kV(){if(NA)return n5;NA=1;function t(e){return e===void 0}return n5=t,n5}var r5,CA;function k6e(){if(CA)return r5;CA=1;function t(e,n,r,s){var i=-1,a=e==null?0:e.length;for(s&&a&&(r=e[++i]);++i1?x.setNode(y,m):x.setNode(y)}),this},s.prototype.setNode=function(f,m){return t.has(this._nodes,f)?(arguments.length>1&&(this._nodes[f]=m),this):(this._nodes[f]=arguments.length>1?m:this._defaultNodeLabelFn(f),this._isCompound&&(this._parent[f]=n,this._children[f]={},this._children[n][f]=!0),this._in[f]={},this._preds[f]={},this._out[f]={},this._sucs[f]={},++this._nodeCount,this)},s.prototype.node=function(f){return this._nodes[f]},s.prototype.hasNode=function(f){return t.has(this._nodes,f)},s.prototype.removeNode=function(f){var m=this;if(t.has(this._nodes,f)){var g=function(x){m.removeEdge(m._edgeObjs[x])};delete this._nodes[f],this._isCompound&&(this._removeFromParentsChildList(f),delete this._parent[f],t.each(this.children(f),function(x){m.setParent(x)}),delete this._children[f]),t.each(t.keys(this._in[f]),g),delete this._in[f],delete this._preds[f],t.each(t.keys(this._out[f]),g),delete this._out[f],delete this._sucs[f],--this._nodeCount}return this},s.prototype.setParent=function(f,m){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(t.isUndefined(m))m=n;else{m+="";for(var g=m;!t.isUndefined(g);g=this.parent(g))if(g===f)throw new Error("Setting "+m+" as parent of "+f+" would create a cycle");this.setNode(m)}return this.setNode(f),this._removeFromParentsChildList(f),this._parent[f]=m,this._children[m][f]=!0,this},s.prototype._removeFromParentsChildList=function(f){delete this._children[this._parent[f]][f]},s.prototype.parent=function(f){if(this._isCompound){var m=this._parent[f];if(m!==n)return m}},s.prototype.children=function(f){if(t.isUndefined(f)&&(f=n),this._isCompound){var m=this._children[f];if(m)return t.keys(m)}else{if(f===n)return this.nodes();if(this.hasNode(f))return[]}},s.prototype.predecessors=function(f){var m=this._preds[f];if(m)return t.keys(m)},s.prototype.successors=function(f){var m=this._sucs[f];if(m)return t.keys(m)},s.prototype.neighbors=function(f){var m=this.predecessors(f);if(m)return t.union(m,this.successors(f))},s.prototype.isLeaf=function(f){var m;return this.isDirected()?m=this.successors(f):m=this.neighbors(f),m.length===0},s.prototype.filterNodes=function(f){var m=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});m.setGraph(this.graph());var g=this;t.each(this._nodes,function(w,S){f(S)&&m.setNode(S,w)}),t.each(this._edgeObjs,function(w){m.hasNode(w.v)&&m.hasNode(w.w)&&m.setEdge(w,g.edge(w))});var x={};function y(w){var S=g.parent(w);return S===void 0||m.hasNode(S)?(x[w]=S,S):S in x?x[S]:y(S)}return this._isCompound&&t.each(m.nodes(),function(w){m.setParent(w,y(w))}),m},s.prototype.setDefaultEdgeLabel=function(f){return t.isFunction(f)||(f=t.constant(f)),this._defaultEdgeLabelFn=f,this},s.prototype.edgeCount=function(){return this._edgeCount},s.prototype.edges=function(){return t.values(this._edgeObjs)},s.prototype.setPath=function(f,m){var g=this,x=arguments;return t.reduce(f,function(y,w){return x.length>1?g.setEdge(y,w,m):g.setEdge(y,w),w}),this},s.prototype.setEdge=function(){var f,m,g,x,y=!1,w=arguments[0];typeof w=="object"&&w!==null&&"v"in w?(f=w.v,m=w.w,g=w.name,arguments.length===2&&(x=arguments[1],y=!0)):(f=w,m=arguments[1],g=arguments[3],arguments.length>2&&(x=arguments[2],y=!0)),f=""+f,m=""+m,t.isUndefined(g)||(g=""+g);var S=o(this._isDirected,f,m,g);if(t.has(this._edgeLabels,S))return y&&(this._edgeLabels[S]=x),this;if(!t.isUndefined(g)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(f),this.setNode(m),this._edgeLabels[S]=y?x:this._defaultEdgeLabelFn(f,m,g);var k=c(this._isDirected,f,m,g);return f=k.v,m=k.w,Object.freeze(k),this._edgeObjs[S]=k,i(this._preds[m],f),i(this._sucs[f],m),this._in[m][S]=k,this._out[f][S]=k,this._edgeCount++,this},s.prototype.edge=function(f,m,g){var x=arguments.length===1?h(this._isDirected,arguments[0]):o(this._isDirected,f,m,g);return this._edgeLabels[x]},s.prototype.hasEdge=function(f,m,g){var x=arguments.length===1?h(this._isDirected,arguments[0]):o(this._isDirected,f,m,g);return t.has(this._edgeLabels,x)},s.prototype.removeEdge=function(f,m,g){var x=arguments.length===1?h(this._isDirected,arguments[0]):o(this._isDirected,f,m,g),y=this._edgeObjs[x];return y&&(f=y.v,m=y.w,delete this._edgeLabels[x],delete this._edgeObjs[x],a(this._preds[m],f),a(this._sucs[f],m),delete this._in[m][x],delete this._out[f][x],this._edgeCount--),this},s.prototype.inEdges=function(f,m){var g=this._in[f];if(g){var x=t.values(g);return m?t.filter(x,function(y){return y.v===m}):x}},s.prototype.outEdges=function(f,m){var g=this._out[f];if(g){var x=t.values(g);return m?t.filter(x,function(y){return y.w===m}):x}},s.prototype.nodeEdges=function(f,m){var g=this.inEdges(f,m);if(g)return g.concat(this.outEdges(f,m))};function i(f,m){f[m]?f[m]++:f[m]=1}function a(f,m){--f[m]||delete f[m]}function o(f,m,g,x){var y=""+m,w=""+g;if(!f&&y>w){var S=y;y=w,w=S}return y+r+w+r+(t.isUndefined(x)?e:x)}function c(f,m,g,x){var y=""+m,w=""+g;if(!f&&y>w){var S=y;y=w,w=S}var k={v:y,w};return x&&(k.name=x),k}function h(f,m){return o(f,m.v,m.w,m.name)}return g5}var x5,FA;function A6e(){return FA||(FA=1,x5="2.1.8"),x5}var v5,$A;function R6e(){return $A||($A=1,v5={Graph:CO(),version:A6e()}),v5}var y5,QA;function D6e(){if(QA)return y5;QA=1;var t=pa(),e=CO();y5={write:n,read:i};function n(a){var o={options:{directed:a.isDirected(),multigraph:a.isMultigraph(),compound:a.isCompound()},nodes:r(a),edges:s(a)};return t.isUndefined(a.graph())||(o.value=t.clone(a.graph())),o}function r(a){return t.map(a.nodes(),function(o){var c=a.node(o),h=a.parent(o),f={v:o};return t.isUndefined(c)||(f.value=c),t.isUndefined(h)||(f.parent=h),f})}function s(a){return t.map(a.edges(),function(o){var c=a.edge(o),h={v:o.v,w:o.w};return t.isUndefined(o.name)||(h.name=o.name),t.isUndefined(c)||(h.value=c),h})}function i(a){var o=new e(a.options).setGraph(a.value);return t.each(a.nodes,function(c){o.setNode(c.v,c.value),c.parent&&o.setParent(c.v,c.parent)}),t.each(a.edges,function(c){o.setEdge({v:c.v,w:c.w,name:c.name},c.value)}),o}return y5}var b5,HA;function z6e(){if(HA)return b5;HA=1;var t=pa();b5=e;function e(n){var r={},s=[],i;function a(o){t.has(r,o)||(r[o]=!0,i.push(o),t.each(n.successors(o),a),t.each(n.predecessors(o),a))}return t.each(n.nodes(),function(o){i=[],a(o),i.length&&s.push(i)}),s}return b5}var w5,VA;function CV(){if(VA)return w5;VA=1;var t=pa();w5=e;function e(){this._arr=[],this._keyIndices={}}return e.prototype.size=function(){return this._arr.length},e.prototype.keys=function(){return this._arr.map(function(n){return n.key})},e.prototype.has=function(n){return t.has(this._keyIndices,n)},e.prototype.priority=function(n){var r=this._keyIndices[n];if(r!==void 0)return this._arr[r].priority},e.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},e.prototype.add=function(n,r){var s=this._keyIndices;if(n=String(n),!t.has(s,n)){var i=this._arr,a=i.length;return s[n]=a,i.push({key:n,priority:r}),this._decrease(a),!0}return!1},e.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var n=this._arr.pop();return delete this._keyIndices[n.key],this._heapify(0),n.key},e.prototype.decrease=function(n,r){var s=this._keyIndices[n];if(r>this._arr[s].priority)throw new Error("New priority is greater than current priority. Key: "+n+" Old: "+this._arr[s].priority+" New: "+r);this._arr[s].priority=r,this._decrease(s)},e.prototype._heapify=function(n){var r=this._arr,s=2*n,i=s+1,a=n;s>1,!(r[i].priority0&&(m=f.removeMin(),g=h[m],g.distance!==Number.POSITIVE_INFINITY);)c(m).forEach(x);return h}return S5}var k5,WA;function P6e(){if(WA)return k5;WA=1;var t=TV(),e=pa();k5=n;function n(r,s,i){return e.transform(r.nodes(),function(a,o){a[o]=t(r,o,s,i)},{})}return k5}var j5,GA;function EV(){if(GA)return j5;GA=1;var t=pa();j5=e;function e(n){var r=0,s=[],i={},a=[];function o(c){var h=i[c]={onStack:!0,lowlink:r,index:r++};if(s.push(c),n.successors(c).forEach(function(g){t.has(i,g)?i[g].onStack&&(h.lowlink=Math.min(h.lowlink,i[g].index)):(o(g),h.lowlink=Math.min(h.lowlink,i[g].lowlink))}),h.lowlink===h.index){var f=[],m;do m=s.pop(),i[m].onStack=!1,f.push(m);while(c!==m);a.push(f)}}return n.nodes().forEach(function(c){t.has(i,c)||o(c)}),a}return j5}var O5,XA;function L6e(){if(XA)return O5;XA=1;var t=pa(),e=EV();O5=n;function n(r){return t.filter(e(r),function(s){return s.length>1||s.length===1&&r.hasEdge(s[0],s[0])})}return O5}var N5,YA;function I6e(){if(YA)return N5;YA=1;var t=pa();N5=n;var e=t.constant(1);function n(s,i,a){return r(s,i||e,a||function(o){return s.outEdges(o)})}function r(s,i,a){var o={},c=s.nodes();return c.forEach(function(h){o[h]={},o[h][h]={distance:0},c.forEach(function(f){h!==f&&(o[h][f]={distance:Number.POSITIVE_INFINITY})}),a(h).forEach(function(f){var m=f.v===h?f.w:f.v,g=i(f);o[h][m]={distance:g,predecessor:h}})}),c.forEach(function(h){var f=o[h];c.forEach(function(m){var g=o[m];c.forEach(function(x){var y=g[h],w=f[x],S=g[x],k=y.distance+w.distance;k0;){if(h=c.removeMin(),t.has(o,h))a.setEdge(h,o[h]);else{if(m)throw new Error("Input graph is not connected: "+s);m=!0}s.nodeEdges(h).forEach(f)}return a}return A5}var R5,rR;function Q6e(){return rR||(rR=1,R5={components:z6e(),dijkstra:TV(),dijkstraAll:P6e(),findCycles:L6e(),floydWarshall:I6e(),isAcyclic:B6e(),postorder:q6e(),preorder:F6e(),prim:$6e(),tarjan:EV(),topsort:_V()}),R5}var D5,sR;function H6e(){if(sR)return D5;sR=1;var t=R6e();return D5={Graph:t.Graph,json:D6e(),alg:Q6e(),version:t.version},D5}var z5,iR;function Ra(){if(iR)return z5;iR=1;var t;if(typeof NO=="function")try{t=H6e()}catch{}return t||(t=window.graphlib),z5=t,z5}var P5,aR;function V6e(){if(aR)return P5;aR=1;var t=ND(),e=1,n=4;function r(s){return t(s,e|n)}return P5=r,P5}var L5,lR;function U6e(){if(lR)return L5;lR=1;var t=Gk(),e=zD(),n=DD(),r=Nv(),s=Object.prototype,i=s.hasOwnProperty,a=t(function(o,c){o=Object(o);var h=-1,f=c.length,m=f>2?c[2]:void 0;for(m&&n(c[0],c[1],m)&&(f=1);++h1?i[o-1]:void 0,h=o>2?i[2]:void 0;for(c=r.length>3&&typeof c=="function"?(o--,c):void 0,h&&e(i[0],i[1],h)&&(c=o<3?void 0:c,o=1),s=Object(s);++a0;--S)if(w=f[S].dequeue(),w){g=g.concat(a(h,f,m,w,!0));break}}}return g}function a(h,f,m,g,x){var y=x?[]:void 0;return t.forEach(h.inEdges(g.v),function(w){var S=h.edge(w),k=h.node(w.v);x&&y.push({v:w.v,w:w.w}),k.out-=S,c(f,m,k)}),t.forEach(h.outEdges(g.v),function(w){var S=h.edge(w),k=w.w,N=h.node(k);N.in-=S,c(f,m,N)}),h.removeNode(g.v),y}function o(h,f){var m=new e,g=0,x=0;t.forEach(h.nodes(),function(S){m.setNode(S,{v:S,in:0,out:0})}),t.forEach(h.edges(),function(S){var k=m.edge(S.v,S.w)||0,N=f(S),C=k+N;m.setEdge(S.v,S.w,C),x=Math.max(x,m.node(S.v).out+=N),g=Math.max(g,m.node(S.w).in+=N)});var y=t.range(x+g+3).map(function(){return new n}),w=g+1;return t.forEach(m.nodes(),function(S){c(y,w,m.node(S))}),{graph:m,buckets:y,zeroIdx:w}}function c(h,f,m){m.out?m.in?h[m.out-m.in+f].enqueue(m):h[h.length-1].enqueue(m):h[0].enqueue(m)}return t3}var n3,NR;function oje(){if(NR)return n3;NR=1;var t=dr(),e=lje();n3={run:n,undo:s};function n(i){var a=i.graph().acyclicer==="greedy"?e(i,o(i)):r(i);t.forEach(a,function(c){var h=i.edge(c);i.removeEdge(c),h.forwardName=c.name,h.reversed=!0,i.setEdge(c.w,c.v,h,t.uniqueId("rev"))});function o(c){return function(h){return c.edge(h).weight}}}function r(i){var a=[],o={},c={};function h(f){t.has(c,f)||(c[f]=!0,o[f]=!0,t.forEach(i.outEdges(f),function(m){t.has(o,m.w)?a.push(m):h(m.w)}),delete o[f])}return t.forEach(i.nodes(),h),a}function s(i){t.forEach(i.edges(),function(a){var o=i.edge(a);if(o.reversed){i.removeEdge(a);var c=o.forwardName;delete o.reversed,delete o.forwardName,i.setEdge(a.w,a.v,o,c)}})}return n3}var r3,CR;function oi(){if(CR)return r3;CR=1;var t=dr(),e=Ra().Graph;r3={addDummyNode:n,simplify:r,asNonCompoundGraph:s,successorWeights:i,predecessorWeights:a,intersectRect:o,buildLayerMatrix:c,normalizeRanks:h,removeEmptyRanks:f,addBorderNode:m,maxRank:g,partition:x,time:y,notime:w};function n(S,k,N,C){var T;do T=t.uniqueId(C);while(S.hasNode(T));return N.dummy=k,S.setNode(T,N),T}function r(S){var k=new e().setGraph(S.graph());return t.forEach(S.nodes(),function(N){k.setNode(N,S.node(N))}),t.forEach(S.edges(),function(N){var C=k.edge(N.v,N.w)||{weight:0,minlen:1},T=S.edge(N);k.setEdge(N.v,N.w,{weight:C.weight+T.weight,minlen:Math.max(C.minlen,T.minlen)})}),k}function s(S){var k=new e({multigraph:S.isMultigraph()}).setGraph(S.graph());return t.forEach(S.nodes(),function(N){S.children(N).length||k.setNode(N,S.node(N))}),t.forEach(S.edges(),function(N){k.setEdge(N,S.edge(N))}),k}function i(S){var k=t.map(S.nodes(),function(N){var C={};return t.forEach(S.outEdges(N),function(T){C[T.w]=(C[T.w]||0)+S.edge(T).weight}),C});return t.zipObject(S.nodes(),k)}function a(S){var k=t.map(S.nodes(),function(N){var C={};return t.forEach(S.inEdges(N),function(T){C[T.v]=(C[T.v]||0)+S.edge(T).weight}),C});return t.zipObject(S.nodes(),k)}function o(S,k){var N=S.x,C=S.y,T=k.x-N,_=k.y-C,E=S.width/2,M=S.height/2;if(!T&&!_)throw new Error("Not possible to find intersection inside of the rectangle");var L,P;return Math.abs(_)*E>Math.abs(T)*M?(_<0&&(M=-M),L=M*T/_,P=M):(T<0&&(E=-E),L=E,P=E*_/T),{x:N+L,y:C+P}}function c(S){var k=t.map(t.range(g(S)+1),function(){return[]});return t.forEach(S.nodes(),function(N){var C=S.node(N),T=C.rank;t.isUndefined(T)||(k[T][C.order]=N)}),k}function h(S){var k=t.min(t.map(S.nodes(),function(N){return S.node(N).rank}));t.forEach(S.nodes(),function(N){var C=S.node(N);t.has(C,"rank")&&(C.rank-=k)})}function f(S){var k=t.min(t.map(S.nodes(),function(_){return S.node(_).rank})),N=[];t.forEach(S.nodes(),function(_){var E=S.node(_).rank-k;N[E]||(N[E]=[]),N[E].push(_)});var C=0,T=S.graph().nodeRankFactor;t.forEach(N,function(_,E){t.isUndefined(_)&&E%T!==0?--C:C&&t.forEach(_,function(M){S.node(M).rank+=C})})}function m(S,k,N,C){var T={width:0,height:0};return arguments.length>=4&&(T.rank=N,T.order=C),n(S,"border",T,k)}function g(S){return t.max(t.map(S.nodes(),function(k){var N=S.node(k).rank;if(!t.isUndefined(N))return N}))}function x(S,k){var N={lhs:[],rhs:[]};return t.forEach(S,function(C){k(C)?N.lhs.push(C):N.rhs.push(C)}),N}function y(S,k){var N=t.now();try{return k()}finally{console.log(S+" time: "+(t.now()-N)+"ms")}}function w(S,k){return k()}return r3}var s3,TR;function cje(){if(TR)return s3;TR=1;var t=dr(),e=oi();s3={run:n,undo:s};function n(i){i.graph().dummyChains=[],t.forEach(i.edges(),function(a){r(i,a)})}function r(i,a){var o=a.v,c=i.node(o).rank,h=a.w,f=i.node(h).rank,m=a.name,g=i.edge(a),x=g.labelRank;if(f!==c+1){i.removeEdge(a);var y,w,S;for(S=0,++c;cP.lim&&(I=P,Q=!0);var U=t.filter(T.edges(),function(ee){return Q===N(C,C.node(ee.v),I)&&Q!==N(C,C.node(ee.w),I)});return t.minBy(U,function(ee){return n(T,ee)})}function w(C,T,_,E){var M=_.v,L=_.w;C.removeEdge(M,L),C.setEdge(E.v,E.w,{}),m(C),c(C,T),S(C,T)}function S(C,T){var _=t.find(C.nodes(),function(M){return!T.node(M).parent}),E=s(C,_);E=E.slice(1),t.forEach(E,function(M){var L=C.node(M).parent,P=T.edge(M,L),I=!1;P||(P=T.edge(L,M),I=!0),T.node(M).rank=T.node(L).rank+(I?P.minlen:-P.minlen)})}function k(C,T,_){return C.hasEdge(T,_)}function N(C,T,_){return _.low<=T.lim&&T.lim<=_.lim}return l3}var o3,AR;function dje(){if(AR)return o3;AR=1;var t=Sv(),e=t.longestPath,n=DV(),r=uje();o3=s;function s(c){switch(c.graph().ranker){case"network-simplex":o(c);break;case"tight-tree":a(c);break;case"longest-path":i(c);break;default:o(c)}}var i=e;function a(c){e(c),n(c)}function o(c){r(c)}return o3}var c3,RR;function hje(){if(RR)return c3;RR=1;var t=dr();c3=e;function e(s){var i=r(s);t.forEach(s.graph().dummyChains,function(a){for(var o=s.node(a),c=o.edgeObj,h=n(s,i,c.v,c.w),f=h.path,m=h.lca,g=0,x=f[g],y=!0;a!==c.w;){if(o=s.node(a),y){for(;(x=f[g])!==m&&s.node(x).maxRankf||m>i[g].lim));for(x=g,g=o;(g=s.parent(g))!==x;)h.push(g);return{path:c.concat(h.reverse()),lca:x}}function r(s){var i={},a=0;function o(c){var h=a;t.forEach(s.children(c),o),i[c]={low:h,lim:a++}}return t.forEach(s.children(),o),i}return c3}var u3,DR;function fje(){if(DR)return u3;DR=1;var t=dr(),e=oi();u3={run:n,cleanup:a};function n(o){var c=e.addDummyNode(o,"root",{},"_root"),h=s(o),f=t.max(t.values(h))-1,m=2*f+1;o.graph().nestingRoot=c,t.forEach(o.edges(),function(x){o.edge(x).minlen*=m});var g=i(o)+1;t.forEach(o.children(),function(x){r(o,c,m,g,f,h,x)}),o.graph().nodeRankFactor=m}function r(o,c,h,f,m,g,x){var y=o.children(x);if(!y.length){x!==c&&o.setEdge(c,x,{weight:0,minlen:h});return}var w=e.addBorderNode(o,"_bt"),S=e.addBorderNode(o,"_bb"),k=o.node(x);o.setParent(w,x),k.borderTop=w,o.setParent(S,x),k.borderBottom=S,t.forEach(y,function(N){r(o,c,h,f,m,g,N);var C=o.node(N),T=C.borderTop?C.borderTop:N,_=C.borderBottom?C.borderBottom:N,E=C.borderTop?f:2*f,M=T!==_?1:m-g[x]+1;o.setEdge(w,T,{weight:E,minlen:M,nestingEdge:!0}),o.setEdge(_,S,{weight:E,minlen:M,nestingEdge:!0})}),o.parent(x)||o.setEdge(c,w,{weight:0,minlen:m+g[x]})}function s(o){var c={};function h(f,m){var g=o.children(f);g&&g.length&&t.forEach(g,function(x){h(x,m+1)}),c[f]=m}return t.forEach(o.children(),function(f){h(f,1)}),c}function i(o){return t.reduce(o.edges(),function(c,h){return c+o.edge(h).weight},0)}function a(o){var c=o.graph();o.removeNode(c.nestingRoot),delete c.nestingRoot,t.forEach(o.edges(),function(h){var f=o.edge(h);f.nestingEdge&&o.removeEdge(h)})}return u3}var d3,zR;function mje(){if(zR)return d3;zR=1;var t=dr(),e=oi();d3=n;function n(s){function i(a){var o=s.children(a),c=s.node(a);if(o.length&&t.forEach(o,i),t.has(c,"minRank")){c.borderLeft=[],c.borderRight=[];for(var h=c.minRank,f=c.maxRank+1;h0;)x%2&&(y+=f[x+1]),x=x-1>>1,f[x]+=g.weight;m+=g.weight*y})),m}return m3}var p3,BR;function vje(){if(BR)return p3;BR=1;var t=dr();p3=e;function e(n,r){return t.map(r,function(s){var i=n.inEdges(s);if(i.length){var a=t.reduce(i,function(o,c){var h=n.edge(c),f=n.node(c.v);return{sum:o.sum+h.weight*f.order,weight:o.weight+h.weight}},{sum:0,weight:0});return{v:s,barycenter:a.sum/a.weight,weight:a.weight}}else return{v:s}})}return p3}var g3,qR;function yje(){if(qR)return g3;qR=1;var t=dr();g3=e;function e(s,i){var a={};t.forEach(s,function(c,h){var f=a[c.v]={indegree:0,in:[],out:[],vs:[c.v],i:h};t.isUndefined(c.barycenter)||(f.barycenter=c.barycenter,f.weight=c.weight)}),t.forEach(i.edges(),function(c){var h=a[c.v],f=a[c.w];!t.isUndefined(h)&&!t.isUndefined(f)&&(f.indegree++,h.out.push(a[c.w]))});var o=t.filter(a,function(c){return!c.indegree});return n(o)}function n(s){var i=[];function a(h){return function(f){f.merged||(t.isUndefined(f.barycenter)||t.isUndefined(h.barycenter)||f.barycenter>=h.barycenter)&&r(h,f)}}function o(h){return function(f){f.in.push(h),--f.indegree===0&&s.push(f)}}for(;s.length;){var c=s.pop();i.push(c),t.forEach(c.in.reverse(),a(c)),t.forEach(c.out,o(c))}return t.map(t.filter(i,function(h){return!h.merged}),function(h){return t.pick(h,["vs","i","barycenter","weight"])})}function r(s,i){var a=0,o=0;s.weight&&(a+=s.barycenter*s.weight,o+=s.weight),i.weight&&(a+=i.barycenter*i.weight,o+=i.weight),s.vs=i.vs.concat(s.vs),s.barycenter=a/o,s.weight=o,s.i=Math.min(i.i,s.i),i.merged=!0}return g3}var x3,FR;function bje(){if(FR)return x3;FR=1;var t=dr(),e=oi();x3=n;function n(i,a){var o=e.partition(i,function(w){return t.has(w,"barycenter")}),c=o.lhs,h=t.sortBy(o.rhs,function(w){return-w.i}),f=[],m=0,g=0,x=0;c.sort(s(!!a)),x=r(f,h,x),t.forEach(c,function(w){x+=w.vs.length,f.push(w.vs),m+=w.barycenter*w.weight,g+=w.weight,x=r(f,h,x)});var y={vs:t.flatten(f,!0)};return g&&(y.barycenter=m/g,y.weight=g),y}function r(i,a,o){for(var c;a.length&&(c=t.last(a)).i<=o;)a.pop(),i.push(c.vs),o++;return o}function s(i){return function(a,o){return a.barycentero.barycenter?1:i?o.i-a.i:a.i-o.i}}return x3}var v3,$R;function wje(){if($R)return v3;$R=1;var t=dr(),e=vje(),n=yje(),r=bje();v3=s;function s(o,c,h,f){var m=o.children(c),g=o.node(c),x=g?g.borderLeft:void 0,y=g?g.borderRight:void 0,w={};x&&(m=t.filter(m,function(_){return _!==x&&_!==y}));var S=e(o,m);t.forEach(S,function(_){if(o.children(_.v).length){var E=s(o,_.v,h,f);w[_.v]=E,t.has(E,"barycenter")&&a(_,E)}});var k=n(S,h);i(k,w);var N=r(k,f);if(x&&(N.vs=t.flatten([x,N.vs,y],!0),o.predecessors(x).length)){var C=o.node(o.predecessors(x)[0]),T=o.node(o.predecessors(y)[0]);t.has(N,"barycenter")||(N.barycenter=0,N.weight=0),N.barycenter=(N.barycenter*N.weight+C.order+T.order)/(N.weight+2),N.weight+=2}return N}function i(o,c){t.forEach(o,function(h){h.vs=t.flatten(h.vs.map(function(f){return c[f]?c[f].vs:f}),!0)})}function a(o,c){t.isUndefined(o.barycenter)?(o.barycenter=c.barycenter,o.weight=c.weight):(o.barycenter=(o.barycenter*o.weight+c.barycenter*c.weight)/(o.weight+c.weight),o.weight+=c.weight)}return v3}var y3,QR;function Sje(){if(QR)return y3;QR=1;var t=dr(),e=Ra().Graph;y3=n;function n(s,i,a){var o=r(s),c=new e({compound:!0}).setGraph({root:o}).setDefaultNodeLabel(function(h){return s.node(h)});return t.forEach(s.nodes(),function(h){var f=s.node(h),m=s.parent(h);(f.rank===i||f.minRank<=i&&i<=f.maxRank)&&(c.setNode(h),c.setParent(h,m||o),t.forEach(s[a](h),function(g){var x=g.v===h?g.w:g.v,y=c.edge(x,h),w=t.isUndefined(y)?0:y.weight;c.setEdge(x,h,{weight:s.edge(g).weight+w})}),t.has(f,"minRank")&&c.setNode(h,{borderLeft:f.borderLeft[i],borderRight:f.borderRight[i]}))}),c}function r(s){for(var i;s.hasNode(i=t.uniqueId("_root")););return i}return y3}var b3,HR;function kje(){if(HR)return b3;HR=1;var t=dr();b3=e;function e(n,r,s){var i={},a;t.forEach(s,function(o){for(var c=n.parent(o),h,f;c;){if(h=n.parent(c),h?(f=i[h],i[h]=c):(f=a,a=c),f&&f!==c){r.setEdge(f,c);return}c=h}})}return b3}var w3,VR;function jje(){if(VR)return w3;VR=1;var t=dr(),e=gje(),n=xje(),r=wje(),s=Sje(),i=kje(),a=Ra().Graph,o=oi();w3=c;function c(g){var x=o.maxRank(g),y=h(g,t.range(1,x+1),"inEdges"),w=h(g,t.range(x-1,-1,-1),"outEdges"),S=e(g);m(g,S);for(var k=Number.POSITIVE_INFINITY,N,C=0,T=0;T<4;++C,++T){f(C%2?y:w,C%4>=2),S=o.buildLayerMatrix(g);var _=n(g,S);_I)&&a(C,ee,Q)})})}function _(E,M){var L=-1,P,I=0;return t.forEach(M,function(Q,U){if(k.node(Q).dummy==="border"){var ee=k.predecessors(Q);ee.length&&(P=k.node(ee[0]).order,T(M,I,U,L,P),I=U,L=P)}T(M,I,M.length,P,E.length)}),M}return t.reduce(N,_),C}function i(k,N){if(k.node(N).dummy)return t.find(k.predecessors(N),function(C){return k.node(C).dummy})}function a(k,N,C){if(N>C){var T=N;N=C,C=T}var _=k[N];_||(k[N]=_={}),_[C]=!0}function o(k,N,C){if(N>C){var T=N;N=C,C=T}return t.has(k[N],C)}function c(k,N,C,T){var _={},E={},M={};return t.forEach(N,function(L){t.forEach(L,function(P,I){_[P]=P,E[P]=P,M[P]=I})}),t.forEach(N,function(L){var P=-1;t.forEach(L,function(I){var Q=T(I);if(Q.length){Q=t.sortBy(Q,function(B){return M[B]});for(var U=(Q.length-1)/2,ee=Math.floor(U),z=Math.ceil(U);ee<=z;++ee){var H=Q[ee];E[I]===I&&Pl.jsxs("div",{className:"px-4 py-2 shadow-md rounded-lg bg-gradient-to-br from-blue-500 to-blue-600 border-2 border-blue-700 min-w-[120px]",children:[l.jsx(Tc,{type:"target",position:mt.Top}),l.jsx("div",{className:"font-semibold text-white text-sm truncate max-w-[200px]",title:t.content,children:t.label}),l.jsx(Tc,{type:"source",position:mt.Bottom})]}));zV.displayName="EntityNode";const PV=b.memo(({data:t})=>l.jsxs("div",{className:"px-3 py-2 shadow-md rounded-md bg-gradient-to-br from-green-500 to-green-600 border-2 border-green-700 min-w-[100px]",children:[l.jsx(Tc,{type:"target",position:mt.Top}),l.jsx("div",{className:"font-medium text-white text-xs truncate max-w-[150px]",title:t.content,children:t.label}),l.jsx(Tc,{type:"source",position:mt.Bottom})]}));PV.displayName="ParagraphNode";const zje={entity:zV,paragraph:PV};function Pje(t,e){const n=new ZR.graphlib.Graph;n.setDefaultEdgeLabel(()=>({})),n.setGraph({rankdir:"TB",ranksep:100,nodesep:80});const r=[],s=[];return t.forEach(i=>{n.setNode(i.id,{width:150,height:50})}),e.forEach(i=>{n.setEdge(i.source,i.target)}),ZR.layout(n),t.forEach(i=>{const a=n.node(i.id);r.push({id:i.id,type:i.type,position:{x:a.x-75,y:a.y-25},data:{label:i.content.slice(0,20)+(i.content.length>20?"...":""),content:i.content}})}),e.forEach((i,a)=>{const o={id:`edge-${a}`,source:i.source,target:i.target,animated:t.length<=200&&i.weight>5,style:{strokeWidth:Math.min(i.weight/2,5),opacity:.6}};i.weight>10&&t.length<100&&(o.label=`${i.weight.toFixed(0)}`),s.push(o)}),{nodes:r,edges:s}}function Lje(){const t=Da(),[e,n]=b.useState(!1),[r,s]=b.useState(null),[i,a]=b.useState(""),[o,c]=b.useState("all"),[h,f]=b.useState(50),[m,g]=b.useState("50"),[x,y]=b.useState(!1),[w,S]=b.useState(!0),[k,N]=b.useState(!1),[C,T]=b.useState(!1),[_,E,M]=Gke([]),[L,P,I]=Xke([]),[Q,U]=b.useState(0),[ee,z]=b.useState(null),[H,B]=b.useState(null),{toast:X}=ts(),J=b.useCallback(ne=>ne.type==="entity"?"#6366f1":ne.type==="paragraph"?"#10b981":"#6b7280",[]),G=b.useCallback(async(ne=!1)=>{try{if(!ne&&h>200){T(!0);return}n(!0);const[K,ie]=await Promise.all([Aje(h,o),Rje()]);if(s(ie),K.nodes.length===0){X({title:"提示",description:"知识库为空,请先导入知识数据"}),E([]),P([]);return}const{nodes:re,edges:ae}=Pje(K.nodes,K.edges);E(re),P(ae),U(re.length),ie&&ie.total_nodes>h&&X({title:"提示",description:`知识图谱包含 ${ie.total_nodes} 个节点,当前显示 ${re.length} 个`}),X({title:"加载成功",description:`已加载 ${re.length} 个节点,${ae.length} 条边`})}catch(K){console.error("加载知识图谱失败:",K),X({title:"加载失败",description:K instanceof Error?K.message:"未知错误",variant:"destructive"})}finally{n(!1)}},[h,o,X]),R=b.useCallback(async()=>{if(!i.trim()){X({title:"提示",description:"请输入搜索关键词"});return}try{const ne=await Dje(i);if(ne.length===0){X({title:"未找到",description:"没有找到匹配的节点"});return}const K=new Set(ne.map(ie=>ie.id));E(ie=>ie.map(re=>({...re,style:{...re.style,opacity:K.has(re.id)?1:.3,filter:K.has(re.id)?"brightness(1.2)":"brightness(0.8)"}}))),X({title:"搜索完成",description:`找到 ${ne.length} 个匹配节点`})}catch(ne){console.error("搜索失败:",ne),X({title:"搜索失败",description:ne instanceof Error?ne.message:"未知错误",variant:"destructive"})}},[i,X]),se=b.useCallback(()=>{E(ne=>ne.map(K=>({...K,style:{...K.style,opacity:1,filter:"brightness(1)"}})))},[]),W=b.useCallback(()=>{S(!1),N(!0),G()},[G]),F=b.useCallback(()=>{T(!1),setTimeout(()=>{G(!0)},0)},[G]),V=b.useCallback((ne,K)=>{_.find(re=>re.id===K.id)&&z({id:K.id,type:K.type,content:K.data.content})},[_]);b.useEffect(()=>{w||k&&G()},[h,o,w,k]);const te=b.useCallback((ne,K)=>{const ie=_.find(_e=>_e.id===K.source),re=_.find(_e=>_e.id===K.target),ae=L.find(_e=>_e.id===K.id);ie&&re&&ae&&B({source:{id:ie.id,type:ie.type,content:ie.data.content},target:{id:re.id,type:re.type,content:re.data.content},edge:{source:K.source,target:K.target,weight:parseFloat(K.label||"0")}})},[_,L]);return l.jsxs("div",{className:"h-full flex flex-col",children:[l.jsxs("div",{className:"flex-shrink-0 p-4 border-b bg-background",children:[l.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4",children:[l.jsxs("div",{children:[l.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"麦麦知识库图谱"}),l.jsx("p",{className:"text-muted-foreground mt-1",children:"可视化知识实体与关系网络"})]}),r&&l.jsxs("div",{className:"flex gap-2 flex-wrap",children:[l.jsxs(In,{variant:"outline",className:"gap-1",children:[l.jsx(A3,{className:"h-3 w-3"}),"节点: ",r.total_nodes]}),l.jsxs(In,{variant:"outline",className:"gap-1",children:[l.jsx(oz,{className:"h-3 w-3"}),"边: ",r.total_edges]}),l.jsxs(In,{variant:"outline",className:"gap-1",children:[l.jsx(ra,{className:"h-3 w-3"}),"实体: ",r.entity_nodes]}),l.jsxs(In,{variant:"outline",className:"gap-1",children:[l.jsx(lo,{className:"h-3 w-3"}),"段落: ",r.paragraph_nodes]})]})]}),l.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 mt-4",children:[l.jsxs("div",{className:"flex-1 flex gap-2",children:[l.jsx(Pe,{placeholder:"搜索节点内容...",value:i,onChange:ne=>a(ne.target.value),onKeyDown:ne=>ne.key==="Enter"&&R(),className:"flex-1"}),l.jsx(de,{onClick:R,size:"sm",children:l.jsx(ci,{className:"h-4 w-4"})}),l.jsx(de,{onClick:se,variant:"outline",size:"sm",children:"重置"})]}),l.jsxs("div",{className:"flex gap-2",children:[l.jsxs(qt,{value:o,onValueChange:ne=>c(ne),children:[l.jsx(It,{className:"w-[120px]",children:l.jsx(Ft,{})}),l.jsxs(Bt,{children:[l.jsx(De,{value:"all",children:"全部节点"}),l.jsx(De,{value:"entity",children:"仅实体"}),l.jsx(De,{value:"paragraph",children:"仅段落"})]})]}),l.jsxs(qt,{value:h===1e4?"all":x?"custom":h.toString(),onValueChange:ne=>{ne==="custom"?(y(!0),g(h.toString())):ne==="all"?(y(!1),f(1e4)):(y(!1),f(Number(ne)))},children:[l.jsx(It,{className:"w-[120px]",children:l.jsx(Ft,{})}),l.jsxs(Bt,{children:[l.jsx(De,{value:"50",children:"50 节点"}),l.jsx(De,{value:"100",children:"100 节点"}),l.jsx(De,{value:"200",children:"200 节点"}),l.jsx(De,{value:"500",children:"500 节点"}),l.jsx(De,{value:"1000",children:"1000 节点"}),l.jsx(De,{value:"all",children:"全部 (最多10000)"}),l.jsx(De,{value:"custom",children:"自定义..."})]})]}),x&&l.jsx(Pe,{type:"number",min:"50",value:m,onChange:ne=>g(ne.target.value),onBlur:()=>{const ne=parseInt(m);!isNaN(ne)&&ne>=50?f(ne):(g("50"),f(50))},onKeyDown:ne=>{if(ne.key==="Enter"){const K=parseInt(m);!isNaN(K)&&K>=50?f(K):(g("50"),f(50))}},placeholder:"最少50个",className:"w-[120px]"}),l.jsx(de,{onClick:()=>G(),variant:"outline",size:"sm",disabled:e,children:l.jsx(Ls,{className:ve("h-4 w-4",e&&"animate-spin")})})]})]})]}),l.jsx("div",{className:"flex-1 relative",children:e?l.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:l.jsxs("div",{className:"text-center",children:[l.jsx(Ls,{className:"h-8 w-8 animate-spin mx-auto mb-2 text-muted-foreground"}),l.jsx("p",{className:"text-muted-foreground",children:"加载知识图谱中..."})]})}):_.length===0?l.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:l.jsxs("div",{className:"text-center",children:[l.jsx(A3,{className:"h-12 w-12 mx-auto mb-4 text-muted-foreground"}),l.jsx("h3",{className:"text-lg font-semibold mb-2",children:"知识库为空"}),l.jsx("p",{className:"text-muted-foreground",children:"请先导入知识数据"})]})}):l.jsxs(hV,{nodes:_,edges:L,onNodesChange:M,onEdgesChange:I,onNodeClick:V,onEdgeClick:te,nodeTypes:zje,fitView:!0,minZoom:.05,maxZoom:1.5,defaultViewport:{x:0,y:0,zoom:.5},elevateNodesOnSelect:Q<=500,nodesDraggable:Q<=1e3,attributionPosition:"bottom-left",children:[l.jsx(v6e,{variant:aa.Dots,gap:12,size:1}),l.jsx(h6e,{}),Q<=500&&l.jsx(i6e,{nodeColor:J,nodeBorderRadius:8,pannable:!0,zoomable:!0}),l.jsxs(Ly,{position:"top-right",className:"bg-background/95 backdrop-blur-sm rounded-lg border p-3 shadow-lg",children:[l.jsx("div",{className:"text-sm font-semibold mb-2",children:"图例"}),l.jsxs("div",{className:"space-y-2 text-xs",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("div",{className:"w-4 h-4 rounded bg-gradient-to-br from-blue-500 to-blue-600 border-2 border-blue-700"}),l.jsx("span",{children:"实体节点"})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("div",{className:"w-4 h-4 rounded bg-gradient-to-br from-green-500 to-green-600 border-2 border-green-700"}),l.jsx("span",{children:"段落节点"})]}),Q>200&&l.jsxs("div",{className:"mt-2 pt-2 border-t text-yellow-600 dark:text-yellow-500",children:[l.jsx("div",{className:"font-semibold",children:"性能模式"}),l.jsx("div",{children:"已禁用动画"}),Q>500&&l.jsx("div",{children:"已禁用缩略图"})]})]})]})]})}),l.jsx(xr,{open:!!ee,onOpenChange:ne=>!ne&&z(null),children:l.jsxs(lr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[l.jsx(or,{children:l.jsx(cr,{children:"节点详情"})}),ee&&l.jsxs("div",{className:"space-y-4",children:[l.jsx("div",{className:"grid grid-cols-2 gap-4",children:l.jsxs("div",{children:[l.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"类型"}),l.jsx("div",{className:"mt-1",children:l.jsx(In,{variant:ee.type==="entity"?"default":"secondary",children:ee.type==="entity"?"🏷️ 实体":"📄 段落"})})]})}),l.jsxs("div",{children:[l.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"ID"}),l.jsx("code",{className:"mt-1 block p-2 bg-muted rounded text-xs break-all",children:ee.id})]}),l.jsxs("div",{children:[l.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"内容"}),l.jsx(hn,{className:"mt-1 h-40 p-3 bg-muted rounded",children:l.jsx("p",{className:"text-sm whitespace-pre-wrap",children:ee.content})})]})]})]})}),l.jsx(xr,{open:!!H,onOpenChange:ne=>!ne&&B(null),children:l.jsxs(lr,{className:"max-w-2xl max-h-[80vh] overflow-hidden flex flex-col",children:[l.jsx(or,{children:l.jsx(cr,{children:"边详情"})}),H&&l.jsx(hn,{className:"flex-1 pr-4",children:l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"flex items-center gap-4",children:[l.jsxs("div",{className:"flex-1 min-w-0 p-3 bg-blue-50 dark:bg-blue-950 rounded border-2 border-blue-200 dark:border-blue-800",children:[l.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"源节点"}),l.jsx("div",{className:"font-medium text-sm mb-2 truncate",children:H.source.content}),l.jsxs("code",{className:"text-xs text-muted-foreground truncate block",children:[H.source.id.slice(0,40),"..."]})]}),l.jsx("div",{className:"text-2xl text-muted-foreground flex-shrink-0",children:"→"}),l.jsxs("div",{className:"flex-1 min-w-0 p-3 bg-green-50 dark:bg-green-950 rounded border-2 border-green-200 dark:border-green-800",children:[l.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"目标节点"}),l.jsx("div",{className:"font-medium text-sm mb-2 truncate",children:H.target.content}),l.jsxs("code",{className:"text-xs text-muted-foreground truncate block",children:[H.target.id.slice(0,40),"..."]})]})]}),l.jsxs("div",{children:[l.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"权重"}),l.jsx("div",{className:"mt-1",children:l.jsx(In,{variant:"outline",className:"text-base font-mono",children:H.edge.weight.toFixed(4)})})]})]})})]})}),l.jsx(Nn,{open:w,onOpenChange:S,children:l.jsxs(gn,{children:[l.jsxs(xn,{children:[l.jsx(yn,{children:"加载知识图谱"}),l.jsxs(bn,{children:["知识图谱的动态展示会消耗较多系统资源。",l.jsx("br",{}),"确定要加载知识图谱吗?"]})]}),l.jsxs(vn,{children:[l.jsx(Sn,{onClick:()=>t({to:"/"}),children:"取消 (返回首页)"}),l.jsx(wn,{onClick:W,children:"确认加载"})]})]})}),l.jsx(Nn,{open:C,onOpenChange:T,children:l.jsxs(gn,{children:[l.jsxs(xn,{children:[l.jsx(yn,{children:"⚠️ 节点数量较多"}),l.jsx(bn,{asChild:!0,children:l.jsxs("div",{children:[l.jsxs("p",{children:["您正在尝试加载 ",l.jsx("strong",{className:"text-orange-600",children:h>=1e4?"全部 (最多10000个)":h})," 个节点。"]}),l.jsx("p",{className:"mt-4",children:"节点数量过多可能导致:"}),l.jsxs("ul",{className:"list-disc list-inside mt-2 space-y-1",children:[l.jsx("li",{children:"页面加载时间较长"}),l.jsx("li",{children:"浏览器卡顿或崩溃"}),l.jsx("li",{children:"系统资源占用过高"})]}),l.jsx("p",{className:"mt-4",children:"建议先选择较少的节点数量 (50-200 个)。"})]})})]}),l.jsxs(vn,{children:[l.jsx(Sn,{onClick:()=>{T(!1),h>200&&(f(50),y(!1))},children:"取消"}),l.jsx(wn,{onClick:F,className:"bg-orange-600 hover:bg-orange-700",children:"我了解风险,继续加载"})]})]})})]})}function Pd(t,e,n){let r=n.initialDeps??[],s;function i(){var a,o,c,h;let f;n.key&&((a=n.debug)!=null&&a.call(n))&&(f=Date.now());const m=t();if(!(m.length!==r.length||m.some((y,w)=>r[w]!==y)))return s;r=m;let x;if(n.key&&((o=n.debug)!=null&&o.call(n))&&(x=Date.now()),s=e(...m),n.key&&((c=n.debug)!=null&&c.call(n))){const y=Math.round((Date.now()-f)*100)/100,w=Math.round((Date.now()-x)*100)/100,S=w/16,k=(N,C)=>{for(N=String(N);N.length{r=a},i}function YR(t,e){if(t===void 0)throw new Error("Unexpected undefined");return t}const ROe=(t,e)=>Math.abs(t-e)<1.01,DOe=(t,e,n)=>{let r;return function(...s){t.clearTimeout(r),r=t.setTimeout(()=>e.apply(this,s),n)}},KR=t=>{const{offsetWidth:e,offsetHeight:n}=t;return{width:e,height:n}},zOe=t=>t,POe=t=>{const e=Math.max(t.startIndex-t.overscan,0),n=Math.min(t.endIndex+t.overscan,t.count-1),r=[];for(let s=e;s<=n;s++)r.push(s);return r},LOe=(t,e)=>{const n=t.scrollElement;if(!n)return;const r=t.targetWindow;if(!r)return;const s=a=>{const{width:o,height:c}=a;e({width:Math.round(o),height:Math.round(c)})};if(s(KR(n)),!r.ResizeObserver)return()=>{};const i=new r.ResizeObserver(a=>{const o=()=>{const c=a[0];if(c?.borderBoxSize){const h=c.borderBoxSize[0];if(h){s({width:h.inlineSize,height:h.blockSize});return}}s(KR(n))};t.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(o):o()});return i.observe(n,{box:"border-box"}),()=>{i.unobserve(n)}},ZR={passive:!0},JR=typeof window>"u"?!0:"onscrollend"in window,IOe=(t,e)=>{const n=t.scrollElement;if(!n)return;const r=t.targetWindow;if(!r)return;let s=0;const i=t.options.useScrollendEvent&&JR?()=>{}:DOe(r,()=>{e(s,!1)},t.options.isScrollingResetDelay),a=f=>()=>{const{horizontal:m,isRtl:g}=t.options;s=m?n.scrollLeft*(g&&-1||1):n.scrollTop,i(),e(s,f)},o=a(!0),c=a(!1);c(),n.addEventListener("scroll",o,ZR);const h=t.options.useScrollendEvent&&JR;return h&&n.addEventListener("scrollend",c,ZR),()=>{n.removeEventListener("scroll",o),h&&n.removeEventListener("scrollend",c)}},BOe=(t,e,n)=>{if(e?.borderBoxSize){const r=e.borderBoxSize[0];if(r)return Math.round(r[n.options.horizontal?"inlineSize":"blockSize"])}return t[n.options.horizontal?"offsetWidth":"offsetHeight"]},qOe=(t,{adjustments:e=0,behavior:n},r)=>{var s,i;const a=t+e;(i=(s=r.scrollElement)==null?void 0:s.scrollTo)==null||i.call(s,{[r.options.horizontal?"left":"top"]:a,behavior:n})};class FOe{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.measurementsCache=[],this.itemSizeCache=new Map,this.pendingMeasuredCacheIndexes=[],this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.observer=(()=>{let n=null;const r=()=>n||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:n=new this.targetWindow.ResizeObserver(s=>{s.forEach(i=>{const a=()=>{this._measureElement(i.target,i)};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()})}));return{disconnect:()=>{var s;(s=r())==null||s.disconnect(),n=null},observe:s=>{var i;return(i=r())==null?void 0:i.observe(s,{box:"border-box"})},unobserve:s=>{var i;return(i=r())==null?void 0:i.unobserve(s)}}})(),this.range=null,this.setOptions=n=>{Object.entries(n).forEach(([r,s])=>{typeof s>"u"&&delete n[r]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:zOe,rangeExtractor:POe,onChange:()=>{},measureElement:BOe,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,...n}},this.notify=n=>{var r,s;(s=(r=this.options).onChange)==null||s.call(r,this,n)},this.maybeNotify=Dd(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),n=>{this.notify(n)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(n=>n()),this.unsubs=[],this.observer.disconnect(),this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var n;const r=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==r){if(this.cleanup(),!r){this.maybeNotify();return}this.scrollElement=r,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((n=this.scrollElement)==null?void 0:n.window)??null,this.elementsCache.forEach(s=>{this.observer.observe(s)}),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0}),this.unsubs.push(this.options.observeElementRect(this,s=>{this.scrollRect=s,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(s,i)=>{this.scrollAdjustments=0,this.scrollDirection=i?this.getScrollOffset()this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(n,r)=>{const s=new Map,i=new Map;for(let a=r-1;a>=0;a--){const o=n[a];if(s.has(o.lane))continue;const c=i.get(o.lane);if(c==null||o.end>c.end?i.set(o.lane,o):o.enda.end===o.end?a.index-o.index:a.end-o.end)[0]:void 0},this.getMeasurementOptions=Dd(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled],(n,r,s,i,a)=>(this.pendingMeasuredCacheIndexes=[],{count:n,paddingStart:r,scrollMargin:s,getItemKey:i,enabled:a}),{key:!1}),this.getMeasurements=Dd(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:n,paddingStart:r,scrollMargin:s,getItemKey:i,enabled:a},o)=>{if(!a)return this.measurementsCache=[],this.itemSizeCache.clear(),[];this.measurementsCache.length===0&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(f=>{this.itemSizeCache.set(f.key,f.size)}));const c=this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[];const h=this.measurementsCache.slice(0,c);for(let f=c;fthis.options.debug}),this.calculateRange=Dd(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,r,s,i)=>this.range=n.length>0&&r>0?$Oe({measurements:n,outerSize:r,scrollOffset:s,lanes:i}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=Dd(()=>{let n=null,r=null;const s=this.calculateRange();return s&&(n=s.startIndex,r=s.endIndex),this.maybeNotify.updateDeps([this.isScrolling,n,r]),[this.options.rangeExtractor,this.options.overscan,this.options.count,n,r]},(n,r,s,i,a)=>i===null||a===null?[]:n({startIndex:i,endIndex:a,overscan:r,count:s}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=n=>{const r=this.options.indexAttribute,s=n.getAttribute(r);return s?parseInt(s,10):(console.warn(`Missing attribute name '${r}={index}' on measured element.`),-1)},this._measureElement=(n,r)=>{const s=this.indexFromElement(n),i=this.measurementsCache[s];if(!i)return;const a=i.key,o=this.elementsCache.get(a);o!==n&&(o&&this.observer.unobserve(o),this.observer.observe(n),this.elementsCache.set(a,n)),n.isConnected&&this.resizeItem(s,this.options.measureElement(n,r,this))},this.resizeItem=(n,r)=>{const s=this.measurementsCache[n];if(!s)return;const i=this.itemSizeCache.get(s.key)??s.size,a=r-i;a!==0&&((this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(s,a,this):s.start{if(!n){this.elementsCache.forEach((r,s)=>{r.isConnected||(this.observer.unobserve(r),this.elementsCache.delete(s))});return}this._measureElement(n,void 0)},this.getVirtualItems=Dd(()=>[this.getVirtualIndexes(),this.getMeasurements()],(n,r)=>{const s=[];for(let i=0,a=n.length;ithis.options.debug}),this.getVirtualItemForOffset=n=>{const r=this.getMeasurements();if(r.length!==0)return YR(r[zV(0,r.length-1,s=>YR(r[s]).start,n)])},this.getOffsetForAlignment=(n,r,s=0)=>{const i=this.getSize(),a=this.getScrollOffset();r==="auto"&&(r=n>=a+i?"end":"start"),r==="center"?n+=(s-i)/2:r==="end"&&(n-=i);const o=this.getTotalSize()+this.options.scrollMargin-i;return Math.max(Math.min(o,n),0)},this.getOffsetForIndex=(n,r="auto")=>{n=Math.max(0,Math.min(n,this.options.count-1));const s=this.measurementsCache[n];if(!s)return;const i=this.getSize(),a=this.getScrollOffset();if(r==="auto")if(s.end>=a+i-this.options.scrollPaddingEnd)r="end";else if(s.start<=a+this.options.scrollPaddingStart)r="start";else return[a,r];const o=r==="end"?s.end+this.options.scrollPaddingEnd:s.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(o,r,s.size),r]},this.isDynamicMode=()=>this.elementsCache.size>0,this.scrollToOffset=(n,{align:r="start",behavior:s}={})=>{s==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(n,r),{adjustments:void 0,behavior:s})},this.scrollToIndex=(n,{align:r="auto",behavior:s}={})=>{s==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),n=Math.max(0,Math.min(n,this.options.count-1));let i=0;const a=10,o=h=>{if(!this.targetWindow)return;const f=this.getOffsetForIndex(n,h);if(!f){console.warn("Failed to get offset for index:",n);return}const[m,g]=f;this._scrollToOffset(m,{adjustments:void 0,behavior:s}),this.targetWindow.requestAnimationFrame(()=>{const x=this.getScrollOffset(),y=this.getOffsetForIndex(n,g);if(!y){console.warn("Failed to get offset for index:",n);return}ROe(y[0],x)||c(g)})},c=h=>{this.targetWindow&&(i++,io(h)):console.warn(`Failed to scroll to index ${n} after ${a} attempts.`))};o(r)},this.scrollBy=(n,{behavior:r}={})=>{r==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getScrollOffset()+n,{adjustments:void 0,behavior:r})},this.getTotalSize=()=>{var n;const r=this.getMeasurements();let s;if(r.length===0)s=this.options.paddingStart;else if(this.options.lanes===1)s=((n=r[r.length-1])==null?void 0:n.end)??0;else{const i=Array(this.options.lanes).fill(null);let a=r.length-1;for(;a>=0&&i.some(o=>o===null);){const o=r[a];i[o.lane]===null&&(i[o.lane]=o.end),a--}s=Math.max(...i.filter(o=>o!==null))}return Math.max(s-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(n,{adjustments:r,behavior:s})=>{this.options.scrollToFn(n,{behavior:s,adjustments:r},this)},this.measure=()=>{this.itemSizeCache=new Map,this.notify(!1)},this.setOptions(e)}}const zV=(t,e,n,r)=>{for(;t<=e;){const s=(t+e)/2|0,i=n(s);if(ir)e=s-1;else return s}return t>0?t-1:0};function $Oe({measurements:t,outerSize:e,scrollOffset:n,lanes:r}){const s=t.length-1,i=c=>t[c].start;if(t.length<=r)return{startIndex:0,endIndex:s};let a=zV(0,s,i,n),o=a;if(r===1)for(;o1){const c=Array(r).fill(0);for(;of=0&&h.some(f=>f>=n);){const f=t[a];h[f.lane]=f.start,a--}a=Math.max(0,a-a%r),o=Math.min(s,o+(r-1-o%r))}return{startIndex:a,endIndex:o}}const eD=typeof document<"u"?b.useLayoutEffect:b.useEffect;function QOe(t){const e=b.useReducer(()=>({}),{})[1],n={...t,onChange:(s,i)=>{var a;i?hu.flushSync(e):e(),(a=t.onChange)==null||a.call(t,s,i)}},[r]=b.useState(()=>new FOe(n));return r.setOptions(n),eD(()=>r._didMount(),[]),eD(()=>r._willUpdate()),r}function HOe(t){return QOe({observeElementRect:LOe,observeElementOffset:IOe,scrollToFn:qOe,...t})}function VOe(t,e,n="long"){return new Intl.DateTimeFormat("en-US",{hour:"numeric",timeZone:t,timeZoneName:n}).format(e).split(/\s/g).slice(2).join(" ")}const UOe={},Sm={};function vu(t,e){try{const r=(UOe[t]||=new Intl.DateTimeFormat("en-US",{timeZone:t,timeZoneName:"longOffset"}).format)(e).split("GMT")[1];return r in Sm?Sm[r]:tD(r,r.split(":"))}catch{if(t in Sm)return Sm[t];const n=t?.match(WOe);return n?tD(t,n.slice(1)):NaN}}const WOe=/([+-]\d\d):?(\d\d)?/;function tD(t,e){const n=+(e[0]||0),r=+(e[1]||0),s=+(e[2]||0)/60;return Sm[t]=n*60+r>0?n*60+r+s:n*60-r-s}class sl extends Date{constructor(...e){super(),e.length>1&&typeof e[e.length-1]=="string"&&(this.timeZone=e.pop()),this.internal=new Date,isNaN(vu(this.timeZone,this))?this.setTime(NaN):e.length?typeof e[0]=="number"&&(e.length===1||e.length===2&&typeof e[1]!="number")?this.setTime(e[0]):typeof e[0]=="string"?this.setTime(+new Date(e[0])):e[0]instanceof Date?this.setTime(+e[0]):(this.setTime(+new Date(...e)),PV(this),Tk(this)):this.setTime(Date.now())}static tz(e,...n){return n.length?new sl(...n,e):new sl(Date.now(),e)}withTimeZone(e){return new sl(+this,e)}getTimezoneOffset(){const e=-vu(this.timeZone,this);return e>0?Math.floor(e):Math.ceil(e)}setTime(e){return Date.prototype.setTime.apply(this,arguments),Tk(this),+this}[Symbol.for("constructDateFrom")](e){return new sl(+new Date(e),this.timeZone)}}const nD=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(t=>{if(!nD.test(t))return;const e=t.replace(nD,"$1UTC");sl.prototype[e]&&(t.startsWith("get")?sl.prototype[t]=function(){return this.internal[e]()}:(sl.prototype[t]=function(){return Date.prototype[e].apply(this.internal,arguments),GOe(this),+this},sl.prototype[e]=function(){return Date.prototype[e].apply(this,arguments),Tk(this),+this}))});function Tk(t){t.internal.setTime(+t),t.internal.setUTCSeconds(t.internal.getUTCSeconds()-Math.round(-vu(t.timeZone,t)*60))}function GOe(t){Date.prototype.setFullYear.call(t,t.internal.getUTCFullYear(),t.internal.getUTCMonth(),t.internal.getUTCDate()),Date.prototype.setHours.call(t,t.internal.getUTCHours(),t.internal.getUTCMinutes(),t.internal.getUTCSeconds(),t.internal.getUTCMilliseconds()),PV(t)}function PV(t){const e=vu(t.timeZone,t),n=e>0?Math.floor(e):Math.ceil(e),r=new Date(+t);r.setUTCHours(r.getUTCHours()-1);const s=-new Date(+t).getTimezoneOffset(),i=-new Date(+r).getTimezoneOffset(),a=s-i,o=Date.prototype.getHours.apply(t)!==t.internal.getUTCHours();a&&o&&t.internal.setUTCMinutes(t.internal.getUTCMinutes()+a);const c=s-n;c&&Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+c);const h=new Date(+t);h.setUTCSeconds(0);const f=s>0?h.getSeconds():(h.getSeconds()-60)%60,m=Math.round(-(vu(t.timeZone,t)*60))%60;(m||f)&&(t.internal.setUTCSeconds(t.internal.getUTCSeconds()+m),Date.prototype.setUTCSeconds.call(t,Date.prototype.getUTCSeconds.call(t)+m+f));const g=vu(t.timeZone,t),x=g>0?Math.floor(g):Math.ceil(g),w=-new Date(+t).getTimezoneOffset()-x,S=x!==n,k=w-c;if(S&&k){Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+k);const N=vu(t.timeZone,t),C=N>0?Math.floor(N):Math.ceil(N),T=x-C;T&&(t.internal.setUTCMinutes(t.internal.getUTCMinutes()+T),Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+T))}}class vs extends sl{static tz(e,...n){return n.length?new vs(...n,e):new vs(Date.now(),e)}toISOString(){const[e,n,r]=this.tzComponents(),s=`${e}${n}:${r}`;return this.internal.toISOString().slice(0,-1)+s}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[e,n,r,s]=this.internal.toUTCString().split(" ");return`${e?.slice(0,-1)} ${r} ${n} ${s}`}toTimeString(){const e=this.internal.toUTCString().split(" ")[4],[n,r,s]=this.tzComponents();return`${e} GMT${n}${r}${s} (${VOe(this.timeZone,this)})`}toLocaleString(e,n){return Date.prototype.toLocaleString.call(this,e,{...n,timeZone:n?.timeZone||this.timeZone})}toLocaleDateString(e,n){return Date.prototype.toLocaleDateString.call(this,e,{...n,timeZone:n?.timeZone||this.timeZone})}toLocaleTimeString(e,n){return Date.prototype.toLocaleTimeString.call(this,e,{...n,timeZone:n?.timeZone||this.timeZone})}tzComponents(){const e=this.getTimezoneOffset(),n=e>0?"-":"+",r=String(Math.floor(Math.abs(e)/60)).padStart(2,"0"),s=String(Math.abs(e)%60).padStart(2,"0");return[n,r,s]}withTimeZone(e){return new vs(+this,e)}[Symbol.for("constructDateFrom")](e){return new vs(+new Date(e),this.timeZone)}}const LV=6048e5,XOe=864e5,rD=Symbol.for("constructDateFrom");function Br(t,e){return typeof t=="function"?t(e):t&&typeof t=="object"&&rD in t?t[rD](e):t instanceof Date?new t.constructor(e):new Date(e)}function qn(t,e){return Br(e||t,t)}function IV(t,e,n){const r=qn(t,n?.in);return isNaN(e)?Br(t,NaN):(e&&r.setDate(r.getDate()+e),r)}function BV(t,e,n){const r=qn(t,n?.in);if(isNaN(e))return Br(t,NaN);if(!e)return r;const s=r.getDate(),i=Br(t,r.getTime());i.setMonth(r.getMonth()+e+1,0);const a=i.getDate();return s>=a?i:(r.setFullYear(i.getFullYear(),i.getMonth(),s),r)}let YOe={};function pp(){return YOe}function Tc(t,e){const n=pp(),r=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,s=qn(t,e?.in),i=s.getDay(),a=(i=i.getTime()?r+1:n.getTime()>=o.getTime()?r:r-1}function sD(t){const e=qn(t),n=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return n.setUTCFullYear(e.getFullYear()),+t-+n}function Vu(t,...e){const n=Br.bind(null,t||e.find(r=>typeof r=="object"));return e.map(n)}function C0(t,e){const n=qn(t,e?.in);return n.setHours(0,0,0,0),n}function FV(t,e,n){const[r,s]=Vu(n?.in,t,e),i=C0(r),a=C0(s),o=+i-sD(i),c=+a-sD(a);return Math.round((o-c)/XOe)}function KOe(t,e){const n=qV(t,e),r=Br(t,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),N0(r)}function ZOe(t,e,n){return IV(t,e*7,n)}function JOe(t,e,n){return BV(t,e*12,n)}function eje(t,e){let n,r=e?.in;return t.forEach(s=>{!r&&typeof s=="object"&&(r=Br.bind(null,s));const i=qn(s,r);(!n||n{!r&&typeof s=="object"&&(r=Br.bind(null,s));const i=qn(s,r);(!n||n>i||isNaN(+i))&&(n=i)}),Br(r,n||NaN)}function nje(t,e,n){const[r,s]=Vu(n?.in,t,e);return+C0(r)==+C0(s)}function $V(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function rje(t){return!(!$V(t)&&typeof t!="number"||isNaN(+qn(t)))}function sje(t,e,n){const[r,s]=Vu(n?.in,t,e),i=r.getFullYear()-s.getFullYear(),a=r.getMonth()-s.getMonth();return i*12+a}function ije(t,e){const n=qn(t,e?.in),r=n.getMonth();return n.setFullYear(n.getFullYear(),r+1,0),n.setHours(23,59,59,999),n}function QV(t,e){const[n,r]=Vu(t,e.start,e.end);return{start:n,end:r}}function aje(t,e){const{start:n,end:r}=QV(e?.in,t);let s=+n>+r;const i=s?+n:+r,a=s?r:n;a.setHours(0,0,0,0),a.setDate(1);let o=1;const c=[];for(;+a<=i;)c.push(Br(n,a)),a.setMonth(a.getMonth()+o);return s?c.reverse():c}function lje(t,e){const n=qn(t,e?.in);return n.setDate(1),n.setHours(0,0,0,0),n}function oje(t,e){const n=qn(t,e?.in),r=n.getFullYear();return n.setFullYear(r+1,0,0),n.setHours(23,59,59,999),n}function HV(t,e){const n=qn(t,e?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}function cje(t,e){const{start:n,end:r}=QV(e?.in,t);let s=+n>+r;const i=s?+n:+r,a=s?r:n;a.setHours(0,0,0,0),a.setMonth(0,1);let o=1;const c=[];for(;+a<=i;)c.push(Br(n,a)),a.setFullYear(a.getFullYear()+o);return s?c.reverse():c}function VV(t,e){const n=pp(),r=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,s=qn(t,e?.in),i=s.getDay(),a=(i{let r;const s=dje[t];return typeof s=="string"?r=s:e===1?r=s.one:r=s.other.replace("{{count}}",e.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r};function dh(t){return(e={})=>{const n=e.width?String(e.width):t.defaultWidth;return t.formats[n]||t.formats[t.defaultWidth]}}const fje={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},mje={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},pje={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},gje={date:dh({formats:fje,defaultWidth:"full"}),time:dh({formats:mje,defaultWidth:"full"}),dateTime:dh({formats:pje,defaultWidth:"full"})},xje={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},vje=(t,e,n,r)=>xje[t];function Ka(t){return(e,n)=>{const r=n?.context?String(n.context):"standalone";let s;if(r==="formatting"&&t.formattingValues){const a=t.defaultFormattingWidth||t.defaultWidth,o=n?.width?String(n.width):a;s=t.formattingValues[o]||t.formattingValues[a]}else{const a=t.defaultWidth,o=n?.width?String(n.width):t.defaultWidth;s=t.values[o]||t.values[a]}const i=t.argumentCallback?t.argumentCallback(e):e;return s[i]}}const yje={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},bje={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},wje={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},Sje={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},kje={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},Oje={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},jje=(t,e)=>{const n=Number(t),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},Nje={ordinalNumber:jje,era:Ka({values:yje,defaultWidth:"wide"}),quarter:Ka({values:bje,defaultWidth:"wide",argumentCallback:t=>t-1}),month:Ka({values:wje,defaultWidth:"wide"}),day:Ka({values:Sje,defaultWidth:"wide"}),dayPeriod:Ka({values:kje,defaultWidth:"wide",formattingValues:Oje,defaultFormattingWidth:"wide"})};function Za(t){return(e,n={})=>{const r=n.width,s=r&&t.matchPatterns[r]||t.matchPatterns[t.defaultMatchWidth],i=e.match(s);if(!i)return null;const a=i[0],o=r&&t.parsePatterns[r]||t.parsePatterns[t.defaultParseWidth],c=Array.isArray(o)?Tje(o,m=>m.test(a)):Cje(o,m=>m.test(a));let h;h=t.valueCallback?t.valueCallback(c):c,h=n.valueCallback?n.valueCallback(h):h;const f=e.slice(a.length);return{value:h,rest:f}}}function Cje(t,e){for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&e(t[n]))return n}function Tje(t,e){for(let n=0;n{const r=e.match(t.matchPattern);if(!r)return null;const s=r[0],i=e.match(t.parsePattern);if(!i)return null;let a=t.valueCallback?t.valueCallback(i[0]):i[0];a=n.valueCallback?n.valueCallback(a):a;const o=e.slice(s.length);return{value:a,rest:o}}}const Eje=/^(\d+)(th|st|nd|rd)?/i,_je=/\d+/i,Mje={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},Aje={any:[/^b/i,/^(a|c)/i]},Rje={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Dje={any:[/1/i,/2/i,/3/i,/4/i]},zje={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},Pje={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},Lje={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},Ije={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},Bje={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},qje={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},Fje={ordinalNumber:UV({matchPattern:Eje,parsePattern:_je,valueCallback:t=>parseInt(t,10)}),era:Za({matchPatterns:Mje,defaultMatchWidth:"wide",parsePatterns:Aje,defaultParseWidth:"any"}),quarter:Za({matchPatterns:Rje,defaultMatchWidth:"wide",parsePatterns:Dje,defaultParseWidth:"any",valueCallback:t=>t+1}),month:Za({matchPatterns:zje,defaultMatchWidth:"wide",parsePatterns:Pje,defaultParseWidth:"any"}),day:Za({matchPatterns:Lje,defaultMatchWidth:"wide",parsePatterns:Ije,defaultParseWidth:"any"}),dayPeriod:Za({matchPatterns:Bje,defaultMatchWidth:"any",parsePatterns:qje,defaultParseWidth:"any"})},Tj={code:"en-US",formatDistance:hje,formatLong:gje,formatRelative:vje,localize:Nje,match:Fje,options:{weekStartsOn:0,firstWeekContainsDate:1}};function $je(t,e){const n=qn(t,e?.in);return FV(n,HV(n))+1}function WV(t,e){const n=qn(t,e?.in),r=+N0(n)-+KOe(n);return Math.round(r/LV)+1}function GV(t,e){const n=qn(t,e?.in),r=n.getFullYear(),s=pp(),i=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??s.firstWeekContainsDate??s.locale?.options?.firstWeekContainsDate??1,a=Br(e?.in||t,0);a.setFullYear(r+1,0,i),a.setHours(0,0,0,0);const o=Tc(a,e),c=Br(e?.in||t,0);c.setFullYear(r,0,i),c.setHours(0,0,0,0);const h=Tc(c,e);return+n>=+o?r+1:+n>=+h?r:r-1}function Qje(t,e){const n=pp(),r=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,s=GV(t,e),i=Br(e?.in||t,0);return i.setFullYear(s,0,r),i.setHours(0,0,0,0),Tc(i,e)}function XV(t,e){const n=qn(t,e?.in),r=+Tc(n,e)-+Qje(n,e);return Math.round(r/LV)+1}function Rn(t,e){const n=t<0?"-":"",r=Math.abs(t).toString().padStart(e,"0");return n+r}const rc={y(t,e){const n=t.getFullYear(),r=n>0?n:1-n;return Rn(e==="yy"?r%100:r,e.length)},M(t,e){const n=t.getMonth();return e==="M"?String(n+1):Rn(n+1,2)},d(t,e){return Rn(t.getDate(),e.length)},a(t,e){const n=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h(t,e){return Rn(t.getHours()%12||12,e.length)},H(t,e){return Rn(t.getHours(),e.length)},m(t,e){return Rn(t.getMinutes(),e.length)},s(t,e){return Rn(t.getSeconds(),e.length)},S(t,e){const n=e.length,r=t.getMilliseconds(),s=Math.trunc(r*Math.pow(10,n-3));return Rn(s,e.length)}},zd={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},iD={G:function(t,e,n){const r=t.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});case"GGGG":default:return n.era(r,{width:"wide"})}},y:function(t,e,n){if(e==="yo"){const r=t.getFullYear(),s=r>0?r:1-r;return n.ordinalNumber(s,{unit:"year"})}return rc.y(t,e)},Y:function(t,e,n,r){const s=GV(t,r),i=s>0?s:1-s;if(e==="YY"){const a=i%100;return Rn(a,2)}return e==="Yo"?n.ordinalNumber(i,{unit:"year"}):Rn(i,e.length)},R:function(t,e){const n=qV(t);return Rn(n,e.length)},u:function(t,e){const n=t.getFullYear();return Rn(n,e.length)},Q:function(t,e,n){const r=Math.ceil((t.getMonth()+1)/3);switch(e){case"Q":return String(r);case"QQ":return Rn(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(t,e,n){const r=Math.ceil((t.getMonth()+1)/3);switch(e){case"q":return String(r);case"qq":return Rn(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(t,e,n){const r=t.getMonth();switch(e){case"M":case"MM":return rc.M(t,e);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(t,e,n){const r=t.getMonth();switch(e){case"L":return String(r+1);case"LL":return Rn(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(t,e,n,r){const s=XV(t,r);return e==="wo"?n.ordinalNumber(s,{unit:"week"}):Rn(s,e.length)},I:function(t,e,n){const r=WV(t);return e==="Io"?n.ordinalNumber(r,{unit:"week"}):Rn(r,e.length)},d:function(t,e,n){return e==="do"?n.ordinalNumber(t.getDate(),{unit:"date"}):rc.d(t,e)},D:function(t,e,n){const r=$je(t);return e==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):Rn(r,e.length)},E:function(t,e,n){const r=t.getDay();switch(e){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});case"EEEE":default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(t,e,n,r){const s=t.getDay(),i=(s-r.weekStartsOn+8)%7||7;switch(e){case"e":return String(i);case"ee":return Rn(i,2);case"eo":return n.ordinalNumber(i,{unit:"day"});case"eee":return n.day(s,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(s,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(s,{width:"short",context:"formatting"});case"eeee":default:return n.day(s,{width:"wide",context:"formatting"})}},c:function(t,e,n,r){const s=t.getDay(),i=(s-r.weekStartsOn+8)%7||7;switch(e){case"c":return String(i);case"cc":return Rn(i,e.length);case"co":return n.ordinalNumber(i,{unit:"day"});case"ccc":return n.day(s,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(s,{width:"narrow",context:"standalone"});case"cccccc":return n.day(s,{width:"short",context:"standalone"});case"cccc":default:return n.day(s,{width:"wide",context:"standalone"})}},i:function(t,e,n){const r=t.getDay(),s=r===0?7:r;switch(e){case"i":return String(s);case"ii":return Rn(s,e.length);case"io":return n.ordinalNumber(s,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});case"iiii":default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(t,e,n){const s=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(s,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},b:function(t,e,n){const r=t.getHours();let s;switch(r===12?s=zd.noon:r===0?s=zd.midnight:s=r/12>=1?"pm":"am",e){case"b":case"bb":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(s,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},B:function(t,e,n){const r=t.getHours();let s;switch(r>=17?s=zd.evening:r>=12?s=zd.afternoon:r>=4?s=zd.morning:s=zd.night,e){case"B":case"BB":case"BBB":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(s,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},h:function(t,e,n){if(e==="ho"){let r=t.getHours()%12;return r===0&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return rc.h(t,e)},H:function(t,e,n){return e==="Ho"?n.ordinalNumber(t.getHours(),{unit:"hour"}):rc.H(t,e)},K:function(t,e,n){const r=t.getHours()%12;return e==="Ko"?n.ordinalNumber(r,{unit:"hour"}):Rn(r,e.length)},k:function(t,e,n){let r=t.getHours();return r===0&&(r=24),e==="ko"?n.ordinalNumber(r,{unit:"hour"}):Rn(r,e.length)},m:function(t,e,n){return e==="mo"?n.ordinalNumber(t.getMinutes(),{unit:"minute"}):rc.m(t,e)},s:function(t,e,n){return e==="so"?n.ordinalNumber(t.getSeconds(),{unit:"second"}):rc.s(t,e)},S:function(t,e){return rc.S(t,e)},X:function(t,e,n){const r=t.getTimezoneOffset();if(r===0)return"Z";switch(e){case"X":return lD(r);case"XXXX":case"XX":return cu(r);case"XXXXX":case"XXX":default:return cu(r,":")}},x:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"x":return lD(r);case"xxxx":case"xx":return cu(r);case"xxxxx":case"xxx":default:return cu(r,":")}},O:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+aD(r,":");case"OOOO":default:return"GMT"+cu(r,":")}},z:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+aD(r,":");case"zzzz":default:return"GMT"+cu(r,":")}},t:function(t,e,n){const r=Math.trunc(+t/1e3);return Rn(r,e.length)},T:function(t,e,n){return Rn(+t,e.length)}};function aD(t,e=""){const n=t>0?"-":"+",r=Math.abs(t),s=Math.trunc(r/60),i=r%60;return i===0?n+String(s):n+String(s)+e+Rn(i,2)}function lD(t,e){return t%60===0?(t>0?"-":"+")+Rn(Math.abs(t)/60,2):cu(t,e)}function cu(t,e=""){const n=t>0?"-":"+",r=Math.abs(t),s=Rn(Math.trunc(r/60),2),i=Rn(r%60,2);return n+s+e+i}const oD=(t,e)=>{switch(t){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});case"PPPP":default:return e.date({width:"full"})}},YV=(t,e)=>{switch(t){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});case"pppp":default:return e.time({width:"full"})}},Hje=(t,e)=>{const n=t.match(/(P+)(p+)?/)||[],r=n[1],s=n[2];if(!s)return oD(t,e);let i;switch(r){case"P":i=e.dateTime({width:"short"});break;case"PP":i=e.dateTime({width:"medium"});break;case"PPP":i=e.dateTime({width:"long"});break;case"PPPP":default:i=e.dateTime({width:"full"});break}return i.replace("{{date}}",oD(r,e)).replace("{{time}}",YV(s,e))},Vje={p:YV,P:Hje},Uje=/^D+$/,Wje=/^Y+$/,Gje=["D","DD","YY","YYYY"];function Xje(t){return Uje.test(t)}function Yje(t){return Wje.test(t)}function Kje(t,e,n){const r=Zje(t,e,n);if(console.warn(r),Gje.includes(t))throw new RangeError(r)}function Zje(t,e,n){const r=t[0]==="Y"?"years":"days of the month";return`Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${e}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const Jje=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,eNe=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,tNe=/^'([^]*?)'?$/,nNe=/''/g,rNe=/[a-zA-Z]/;function S1(t,e,n){const r=pp(),s=n?.locale??r.locale??Tj,i=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,a=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,o=qn(t,n?.in);if(!rje(o))throw new RangeError("Invalid time value");let c=e.match(eNe).map(f=>{const m=f[0];if(m==="p"||m==="P"){const g=Vje[m];return g(f,s.formatLong)}return f}).join("").match(Jje).map(f=>{if(f==="''")return{isToken:!1,value:"'"};const m=f[0];if(m==="'")return{isToken:!1,value:sNe(f)};if(iD[m])return{isToken:!0,value:f};if(m.match(rNe))throw new RangeError("Format string contains an unescaped latin alphabet character `"+m+"`");return{isToken:!1,value:f}});s.localize.preprocessor&&(c=s.localize.preprocessor(o,c));const h={firstWeekContainsDate:i,weekStartsOn:a,locale:s};return c.map(f=>{if(!f.isToken)return f.value;const m=f.value;(!n?.useAdditionalWeekYearTokens&&Yje(m)||!n?.useAdditionalDayOfYearTokens&&Xje(m))&&Kje(m,e,String(t));const g=iD[m[0]];return g(o,m,s.localize,h)}).join("")}function sNe(t){const e=t.match(tNe);return e?e[1].replace(nNe,"'"):t}function iNe(t,e){const n=qn(t,e?.in),r=n.getFullYear(),s=n.getMonth(),i=Br(n,0);return i.setFullYear(r,s+1,0),i.setHours(0,0,0,0),i.getDate()}function aNe(t,e){return qn(t,e?.in).getMonth()}function lNe(t,e){return qn(t,e?.in).getFullYear()}function oNe(t,e){return+qn(t)>+qn(e)}function cNe(t,e){return+qn(t)<+qn(e)}function uNe(t,e,n){const[r,s]=Vu(n?.in,t,e);return+Tc(r,n)==+Tc(s,n)}function dNe(t,e,n){const[r,s]=Vu(n?.in,t,e);return r.getFullYear()===s.getFullYear()&&r.getMonth()===s.getMonth()}function hNe(t,e,n){const[r,s]=Vu(n?.in,t,e);return r.getFullYear()===s.getFullYear()}function fNe(t,e,n){const r=qn(t,n?.in),s=r.getFullYear(),i=r.getDate(),a=Br(t,0);a.setFullYear(s,e,15),a.setHours(0,0,0,0);const o=iNe(a);return r.setMonth(e,Math.min(i,o)),r}function mNe(t,e,n){const r=qn(t,n?.in);return isNaN(+r)?Br(t,NaN):(r.setFullYear(e),r)}const cD=5,pNe=4;function gNe(t,e){const n=e.startOfMonth(t),r=n.getDay()>0?n.getDay():7,s=e.addDays(t,-r+1),i=e.addDays(s,cD*7-1);return e.getMonth(t)===e.getMonth(i)?cD:pNe}function KV(t,e){const n=e.startOfMonth(t),r=n.getDay();return r===1?n:r===0?e.addDays(n,-6):e.addDays(n,-1*(r-1))}function xNe(t,e){const n=KV(t,e),r=gNe(t,e);return e.addDays(n,r*7-1)}class Di{constructor(e,n){this.Date=Date,this.today=()=>this.overrides?.today?this.overrides.today():this.options.timeZone?vs.tz(this.options.timeZone):new this.Date,this.newDate=(r,s,i)=>this.overrides?.newDate?this.overrides.newDate(r,s,i):this.options.timeZone?new vs(r,s,i,this.options.timeZone):new Date(r,s,i),this.addDays=(r,s)=>this.overrides?.addDays?this.overrides.addDays(r,s):IV(r,s),this.addMonths=(r,s)=>this.overrides?.addMonths?this.overrides.addMonths(r,s):BV(r,s),this.addWeeks=(r,s)=>this.overrides?.addWeeks?this.overrides.addWeeks(r,s):ZOe(r,s),this.addYears=(r,s)=>this.overrides?.addYears?this.overrides.addYears(r,s):JOe(r,s),this.differenceInCalendarDays=(r,s)=>this.overrides?.differenceInCalendarDays?this.overrides.differenceInCalendarDays(r,s):FV(r,s),this.differenceInCalendarMonths=(r,s)=>this.overrides?.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(r,s):sje(r,s),this.eachMonthOfInterval=r=>this.overrides?.eachMonthOfInterval?this.overrides.eachMonthOfInterval(r):aje(r),this.eachYearOfInterval=r=>{const s=this.overrides?.eachYearOfInterval?this.overrides.eachYearOfInterval(r):cje(r),i=new Set(s.map(o=>this.getYear(o)));if(i.size===s.length)return s;const a=[];return i.forEach(o=>{a.push(new Date(o,0,1))}),a},this.endOfBroadcastWeek=r=>this.overrides?.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(r):xNe(r,this),this.endOfISOWeek=r=>this.overrides?.endOfISOWeek?this.overrides.endOfISOWeek(r):uje(r),this.endOfMonth=r=>this.overrides?.endOfMonth?this.overrides.endOfMonth(r):ije(r),this.endOfWeek=(r,s)=>this.overrides?.endOfWeek?this.overrides.endOfWeek(r,s):VV(r,this.options),this.endOfYear=r=>this.overrides?.endOfYear?this.overrides.endOfYear(r):oje(r),this.format=(r,s,i)=>{const a=this.overrides?.format?this.overrides.format(r,s,this.options):S1(r,s,this.options);return this.options.numerals&&this.options.numerals!=="latn"?this.replaceDigits(a):a},this.getISOWeek=r=>this.overrides?.getISOWeek?this.overrides.getISOWeek(r):WV(r),this.getMonth=(r,s)=>this.overrides?.getMonth?this.overrides.getMonth(r,this.options):aNe(r,this.options),this.getYear=(r,s)=>this.overrides?.getYear?this.overrides.getYear(r,this.options):lNe(r,this.options),this.getWeek=(r,s)=>this.overrides?.getWeek?this.overrides.getWeek(r,this.options):XV(r,this.options),this.isAfter=(r,s)=>this.overrides?.isAfter?this.overrides.isAfter(r,s):oNe(r,s),this.isBefore=(r,s)=>this.overrides?.isBefore?this.overrides.isBefore(r,s):cNe(r,s),this.isDate=r=>this.overrides?.isDate?this.overrides.isDate(r):$V(r),this.isSameDay=(r,s)=>this.overrides?.isSameDay?this.overrides.isSameDay(r,s):nje(r,s),this.isSameMonth=(r,s)=>this.overrides?.isSameMonth?this.overrides.isSameMonth(r,s):dNe(r,s),this.isSameYear=(r,s)=>this.overrides?.isSameYear?this.overrides.isSameYear(r,s):hNe(r,s),this.max=r=>this.overrides?.max?this.overrides.max(r):eje(r),this.min=r=>this.overrides?.min?this.overrides.min(r):tje(r),this.setMonth=(r,s)=>this.overrides?.setMonth?this.overrides.setMonth(r,s):fNe(r,s),this.setYear=(r,s)=>this.overrides?.setYear?this.overrides.setYear(r,s):mNe(r,s),this.startOfBroadcastWeek=(r,s)=>this.overrides?.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(r,this):KV(r,this),this.startOfDay=r=>this.overrides?.startOfDay?this.overrides.startOfDay(r):C0(r),this.startOfISOWeek=r=>this.overrides?.startOfISOWeek?this.overrides.startOfISOWeek(r):N0(r),this.startOfMonth=r=>this.overrides?.startOfMonth?this.overrides.startOfMonth(r):lje(r),this.startOfWeek=(r,s)=>this.overrides?.startOfWeek?this.overrides.startOfWeek(r,this.options):Tc(r,this.options),this.startOfYear=r=>this.overrides?.startOfYear?this.overrides.startOfYear(r):HV(r),this.options={locale:Tj,...e},this.overrides=n}getDigitMap(){const{numerals:e="latn"}=this.options,n=new Intl.NumberFormat("en-US",{numberingSystem:e}),r={};for(let s=0;s<10;s++)r[s.toString()]=n.format(s);return r}replaceDigits(e){const n=this.getDigitMap();return e.replace(/\d/g,r=>n[r]||r)}formatNumber(e){return this.replaceDigits(e.toString())}getMonthYearOrder(){const e=this.options.locale?.code;return e&&Di.yearFirstLocales.has(e)?"year-first":"month-first"}formatMonthYear(e){const{locale:n,timeZone:r,numerals:s}=this.options,i=n?.code;if(i&&Di.yearFirstLocales.has(i))try{return new Intl.DateTimeFormat(i,{month:"long",year:"numeric",timeZone:r,numberingSystem:s}).format(e)}catch{}const a=this.getMonthYearOrder()==="year-first"?"y LLLL":"LLLL y";return this.format(e,a)}}Di.yearFirstLocales=new Set(["eu","hu","ja","ja-Hira","ja-JP","ko","ko-KR","lt","lt-LT","lv","lv-LV","mn","mn-MN","zh","zh-CN","zh-HK","zh-TW"]);const bl=new Di;class ZV{constructor(e,n,r=bl){this.date=e,this.displayMonth=n,this.outside=!!(n&&!r.isSameMonth(e,n)),this.dateLib=r}isEqualTo(e){return this.dateLib.isSameDay(e.date,this.date)&&this.dateLib.isSameMonth(e.displayMonth,this.displayMonth)}}class vNe{constructor(e,n){this.date=e,this.weeks=n}}class yNe{constructor(e,n){this.days=n,this.weekNumber=e}}function bNe(t){return he.createElement("button",{...t})}function wNe(t){return he.createElement("span",{...t})}function SNe(t){const{size:e=24,orientation:n="left",className:r}=t;return he.createElement("svg",{className:r,width:e,height:e,viewBox:"0 0 24 24"},n==="up"&&he.createElement("polygon",{points:"6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28"}),n==="down"&&he.createElement("polygon",{points:"6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72"}),n==="left"&&he.createElement("polygon",{points:"16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20"}),n==="right"&&he.createElement("polygon",{points:"8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20"}))}function kNe(t){const{day:e,modifiers:n,...r}=t;return he.createElement("td",{...r})}function ONe(t){const{day:e,modifiers:n,...r}=t,s=he.useRef(null);return he.useEffect(()=>{n.focused&&s.current?.focus()},[n.focused]),he.createElement("button",{ref:s,...r})}var gt;(function(t){t.Root="root",t.Chevron="chevron",t.Day="day",t.DayButton="day_button",t.CaptionLabel="caption_label",t.Dropdowns="dropdowns",t.Dropdown="dropdown",t.DropdownRoot="dropdown_root",t.Footer="footer",t.MonthGrid="month_grid",t.MonthCaption="month_caption",t.MonthsDropdown="months_dropdown",t.Month="month",t.Months="months",t.Nav="nav",t.NextMonthButton="button_next",t.PreviousMonthButton="button_previous",t.Week="week",t.Weeks="weeks",t.Weekday="weekday",t.Weekdays="weekdays",t.WeekNumber="week_number",t.WeekNumberHeader="week_number_header",t.YearsDropdown="years_dropdown"})(gt||(gt={}));var ur;(function(t){t.disabled="disabled",t.hidden="hidden",t.outside="outside",t.focused="focused",t.today="today"})(ur||(ur={}));var ka;(function(t){t.range_end="range_end",t.range_middle="range_middle",t.range_start="range_start",t.selected="selected"})(ka||(ka={}));var Ni;(function(t){t.weeks_before_enter="weeks_before_enter",t.weeks_before_exit="weeks_before_exit",t.weeks_after_enter="weeks_after_enter",t.weeks_after_exit="weeks_after_exit",t.caption_after_enter="caption_after_enter",t.caption_after_exit="caption_after_exit",t.caption_before_enter="caption_before_enter",t.caption_before_exit="caption_before_exit"})(Ni||(Ni={}));function jNe(t){const{options:e,className:n,components:r,classNames:s,...i}=t,a=[s[gt.Dropdown],n].join(" "),o=e?.find(({value:c})=>c===i.value);return he.createElement("span",{"data-disabled":i.disabled,className:s[gt.DropdownRoot]},he.createElement(r.Select,{className:a,...i},e?.map(({value:c,label:h,disabled:f})=>he.createElement(r.Option,{key:c,value:c,disabled:f},h))),he.createElement("span",{className:s[gt.CaptionLabel],"aria-hidden":!0},o?.label,he.createElement(r.Chevron,{orientation:"down",size:18,className:s[gt.Chevron]})))}function NNe(t){return he.createElement("div",{...t})}function CNe(t){return he.createElement("div",{...t})}function TNe(t){const{calendarMonth:e,displayIndex:n,...r}=t;return he.createElement("div",{...r},t.children)}function ENe(t){const{calendarMonth:e,displayIndex:n,...r}=t;return he.createElement("div",{...r})}function _Ne(t){return he.createElement("table",{...t})}function MNe(t){return he.createElement("div",{...t})}const JV=b.createContext(void 0);function gp(){const t=b.useContext(JV);if(t===void 0)throw new Error("useDayPicker() must be used within a custom component.");return t}function ANe(t){const{components:e}=gp();return he.createElement(e.Dropdown,{...t})}function RNe(t){const{onPreviousClick:e,onNextClick:n,previousMonth:r,nextMonth:s,...i}=t,{components:a,classNames:o,labels:{labelPrevious:c,labelNext:h}}=gp(),f=b.useCallback(g=>{s&&n?.(g)},[s,n]),m=b.useCallback(g=>{r&&e?.(g)},[r,e]);return he.createElement("nav",{...i},he.createElement(a.PreviousMonthButton,{type:"button",className:o[gt.PreviousMonthButton],tabIndex:r?void 0:-1,"aria-disabled":r?void 0:!0,"aria-label":c(r),onClick:m},he.createElement(a.Chevron,{disabled:r?void 0:!0,className:o[gt.Chevron],orientation:"left"})),he.createElement(a.NextMonthButton,{type:"button",className:o[gt.NextMonthButton],tabIndex:s?void 0:-1,"aria-disabled":s?void 0:!0,"aria-label":h(s),onClick:f},he.createElement(a.Chevron,{disabled:s?void 0:!0,orientation:"right",className:o[gt.Chevron]})))}function DNe(t){const{components:e}=gp();return he.createElement(e.Button,{...t})}function zNe(t){return he.createElement("option",{...t})}function PNe(t){const{components:e}=gp();return he.createElement(e.Button,{...t})}function LNe(t){const{rootRef:e,...n}=t;return he.createElement("div",{...n,ref:e})}function INe(t){return he.createElement("select",{...t})}function BNe(t){const{week:e,...n}=t;return he.createElement("tr",{...n})}function qNe(t){return he.createElement("th",{...t})}function FNe(t){return he.createElement("thead",{"aria-hidden":!0},he.createElement("tr",{...t}))}function $Ne(t){const{week:e,...n}=t;return he.createElement("th",{...n})}function QNe(t){return he.createElement("th",{...t})}function HNe(t){return he.createElement("tbody",{...t})}function VNe(t){const{components:e}=gp();return he.createElement(e.Dropdown,{...t})}const UNe=Object.freeze(Object.defineProperty({__proto__:null,Button:bNe,CaptionLabel:wNe,Chevron:SNe,Day:kNe,DayButton:ONe,Dropdown:jNe,DropdownNav:NNe,Footer:CNe,Month:TNe,MonthCaption:ENe,MonthGrid:_Ne,Months:MNe,MonthsDropdown:ANe,Nav:RNe,NextMonthButton:DNe,Option:zNe,PreviousMonthButton:PNe,Root:LNe,Select:INe,Week:BNe,WeekNumber:$Ne,WeekNumberHeader:QNe,Weekday:qNe,Weekdays:FNe,Weeks:HNe,YearsDropdown:VNe},Symbol.toStringTag,{value:"Module"}));function no(t,e,n=!1,r=bl){let{from:s,to:i}=t;const{differenceInCalendarDays:a,isSameDay:o}=r;return s&&i?(a(i,s)<0&&([s,i]=[i,s]),a(e,s)>=(n?1:0)&&a(i,e)>=(n?1:0)):!n&&i?o(i,e):!n&&s?o(s,e):!1}function eU(t){return!!(t&&typeof t=="object"&&"before"in t&&"after"in t)}function Ej(t){return!!(t&&typeof t=="object"&&"from"in t)}function tU(t){return!!(t&&typeof t=="object"&&"after"in t)}function nU(t){return!!(t&&typeof t=="object"&&"before"in t)}function rU(t){return!!(t&&typeof t=="object"&&"dayOfWeek"in t)}function sU(t,e){return Array.isArray(t)&&t.every(e.isDate)}function ro(t,e,n=bl){const r=Array.isArray(e)?e:[e],{isSameDay:s,differenceInCalendarDays:i,isAfter:a}=n;return r.some(o=>{if(typeof o=="boolean")return o;if(n.isDate(o))return s(t,o);if(sU(o,n))return o.includes(t);if(Ej(o))return no(o,t,!1,n);if(rU(o))return Array.isArray(o.dayOfWeek)?o.dayOfWeek.includes(t.getDay()):o.dayOfWeek===t.getDay();if(eU(o)){const c=i(o.before,t),h=i(o.after,t),f=c>0,m=h<0;return a(o.before,o.after)?m&&f:f||m}return tU(o)?i(t,o.after)>0:nU(o)?i(o.before,t)>0:typeof o=="function"?o(t):!1})}function WNe(t,e,n,r,s){const{disabled:i,hidden:a,modifiers:o,showOutsideDays:c,broadcastCalendar:h,today:f}=e,{isSameDay:m,isSameMonth:g,startOfMonth:x,isBefore:y,endOfMonth:w,isAfter:S}=s,k=n&&x(n),N=r&&w(r),C={[ur.focused]:[],[ur.outside]:[],[ur.disabled]:[],[ur.hidden]:[],[ur.today]:[]},T={};for(const _ of t){const{date:E,displayMonth:M}=_,q=!!(M&&!g(E,M)),L=!!(k&&y(E,k)),I=!!(N&&S(E,N)),$=!!(i&&ro(E,i,s)),V=!!(a&&ro(E,a,s))||L||I||!h&&!c&&q||h&&c===!1&&q,ee=m(E,f??s.today());q&&C.outside.push(_),$&&C.disabled.push(_),V&&C.hidden.push(_),ee&&C.today.push(_),o&&Object.keys(o).forEach(z=>{const H=o?.[z];H&&ro(E,H,s)&&(T[z]?T[z].push(_):T[z]=[_])})}return _=>{const E={[ur.focused]:!1,[ur.disabled]:!1,[ur.hidden]:!1,[ur.outside]:!1,[ur.today]:!1},M={};for(const q in C){const L=C[q];E[q]=L.some(I=>I===_)}for(const q in T)M[q]=T[q].some(L=>L===_);return{...E,...M}}}function GNe(t,e,n={}){return Object.entries(t).filter(([,s])=>s===!0).reduce((s,[i])=>(n[i]?s.push(n[i]):e[ur[i]]?s.push(e[ur[i]]):e[ka[i]]&&s.push(e[ka[i]]),s),[e[gt.Day]])}function XNe(t){return{...UNe,...t}}function YNe(t){const e={"data-mode":t.mode??void 0,"data-required":"required"in t?t.required:void 0,"data-multiple-months":t.numberOfMonths&&t.numberOfMonths>1||void 0,"data-week-numbers":t.showWeekNumber||void 0,"data-broadcast-calendar":t.broadcastCalendar||void 0,"data-nav-layout":t.navLayout||void 0};return Object.entries(t).forEach(([n,r])=>{n.startsWith("data-")&&(e[n]=r)}),e}function _j(){const t={};for(const e in gt)t[gt[e]]=`rdp-${gt[e]}`;for(const e in ur)t[ur[e]]=`rdp-${ur[e]}`;for(const e in ka)t[ka[e]]=`rdp-${ka[e]}`;for(const e in Ni)t[Ni[e]]=`rdp-${Ni[e]}`;return t}function iU(t,e,n){return(n??new Di(e)).formatMonthYear(t)}const KNe=iU;function ZNe(t,e,n){return(n??new Di(e)).format(t,"d")}function JNe(t,e=bl){return e.format(t,"LLLL")}function e7e(t,e,n){return(n??new Di(e)).format(t,"cccccc")}function t7e(t,e=bl){return t<10?e.formatNumber(`0${t.toLocaleString()}`):e.formatNumber(`${t.toLocaleString()}`)}function n7e(){return""}function aU(t,e=bl){return e.format(t,"yyyy")}const r7e=aU,s7e=Object.freeze(Object.defineProperty({__proto__:null,formatCaption:iU,formatDay:ZNe,formatMonthCaption:KNe,formatMonthDropdown:JNe,formatWeekNumber:t7e,formatWeekNumberHeader:n7e,formatWeekdayName:e7e,formatYearCaption:r7e,formatYearDropdown:aU},Symbol.toStringTag,{value:"Module"}));function i7e(t){return t?.formatMonthCaption&&!t.formatCaption&&(t.formatCaption=t.formatMonthCaption),t?.formatYearCaption&&!t.formatYearDropdown&&(t.formatYearDropdown=t.formatYearCaption),{...s7e,...t}}function a7e(t,e,n,r,s){const{startOfMonth:i,startOfYear:a,endOfYear:o,eachMonthOfInterval:c,getMonth:h}=s;return c({start:a(t),end:o(t)}).map(g=>{const x=r.formatMonthDropdown(g,s),y=h(g),w=e&&gi(n)||!1;return{value:y,label:x,disabled:w}})}function l7e(t,e={},n={}){let r={...e?.[gt.Day]};return Object.entries(t).filter(([,s])=>s===!0).forEach(([s])=>{r={...r,...n?.[s]}}),r}function o7e(t,e,n){const r=t.today(),s=e?t.startOfISOWeek(r):t.startOfWeek(r),i=[];for(let a=0;a<7;a++){const o=t.addDays(s,a);i.push(o)}return i}function c7e(t,e,n,r,s=!1){if(!t||!e)return;const{startOfYear:i,endOfYear:a,eachYearOfInterval:o,getYear:c}=r,h=i(t),f=a(e),m=o({start:h,end:f});return s&&m.reverse(),m.map(g=>{const x=n.formatYearDropdown(g,r);return{value:c(g),label:x,disabled:!1}})}function lU(t,e,n,r){let s=(r??new Di(n)).format(t,"PPPP");return e.today&&(s=`Today, ${s}`),e.selected&&(s=`${s}, selected`),s}const u7e=lU;function oU(t,e,n){return(n??new Di(e)).formatMonthYear(t)}const d7e=oU;function h7e(t,e,n,r){let s=(r??new Di(n)).format(t,"PPPP");return e?.today&&(s=`Today, ${s}`),s}function f7e(t){return"Choose the Month"}function m7e(){return""}function p7e(t){return"Go to the Next Month"}function g7e(t){return"Go to the Previous Month"}function x7e(t,e,n){return(n??new Di(e)).format(t,"cccc")}function v7e(t,e){return`Week ${t}`}function y7e(t){return"Week Number"}function b7e(t){return"Choose the Year"}const w7e=Object.freeze(Object.defineProperty({__proto__:null,labelCaption:d7e,labelDay:u7e,labelDayButton:lU,labelGrid:oU,labelGridcell:h7e,labelMonthDropdown:f7e,labelNav:m7e,labelNext:p7e,labelPrevious:g7e,labelWeekNumber:v7e,labelWeekNumberHeader:y7e,labelWeekday:x7e,labelYearDropdown:b7e},Symbol.toStringTag,{value:"Module"})),xp=t=>t instanceof HTMLElement?t:null,S3=t=>[...t.querySelectorAll("[data-animated-month]")??[]],S7e=t=>xp(t.querySelector("[data-animated-month]")),k3=t=>xp(t.querySelector("[data-animated-caption]")),O3=t=>xp(t.querySelector("[data-animated-weeks]")),k7e=t=>xp(t.querySelector("[data-animated-nav]")),O7e=t=>xp(t.querySelector("[data-animated-weekdays]"));function j7e(t,e,{classNames:n,months:r,focused:s,dateLib:i}){const a=b.useRef(null),o=b.useRef(r),c=b.useRef(!1);b.useLayoutEffect(()=>{const h=o.current;if(o.current=r,!e||!t.current||!(t.current instanceof HTMLElement)||r.length===0||h.length===0||r.length!==h.length)return;const f=i.isSameMonth(r[0].date,h[0].date),m=i.isAfter(r[0].date,h[0].date),g=m?n[Ni.caption_after_enter]:n[Ni.caption_before_enter],x=m?n[Ni.weeks_after_enter]:n[Ni.weeks_before_enter],y=a.current,w=t.current.cloneNode(!0);if(w instanceof HTMLElement?(S3(w).forEach(C=>{if(!(C instanceof HTMLElement))return;const T=S7e(C);T&&C.contains(T)&&C.removeChild(T);const _=k3(C);_&&_.classList.remove(g);const E=O3(C);E&&E.classList.remove(x)}),a.current=w):a.current=null,c.current||f||s)return;const S=y instanceof HTMLElement?S3(y):[],k=S3(t.current);if(k?.every(N=>N instanceof HTMLElement)&&S&&S.every(N=>N instanceof HTMLElement)){c.current=!0,t.current.style.isolation="isolate";const N=k7e(t.current);N&&(N.style.zIndex="1"),k.forEach((C,T)=>{const _=S[T];if(!_)return;C.style.position="relative",C.style.overflow="hidden";const E=k3(C);E&&E.classList.add(g);const M=O3(C);M&&M.classList.add(x);const q=()=>{c.current=!1,t.current&&(t.current.style.isolation=""),N&&(N.style.zIndex=""),E&&E.classList.remove(g),M&&M.classList.remove(x),C.style.position="",C.style.overflow="",C.contains(_)&&C.removeChild(_)};_.style.pointerEvents="none",_.style.position="absolute",_.style.overflow="hidden",_.setAttribute("aria-hidden","true");const L=O7e(_);L&&(L.style.opacity="0");const I=k3(_);I&&(I.classList.add(m?n[Ni.caption_before_exit]:n[Ni.caption_after_exit]),I.addEventListener("animationend",q));const $=O3(_);$&&$.classList.add(m?n[Ni.weeks_before_exit]:n[Ni.weeks_after_exit]),C.insertBefore(_,C.firstChild)})}})}function N7e(t,e,n,r){const s=t[0],i=t[t.length-1],{ISOWeek:a,fixedWeeks:o,broadcastCalendar:c}=n??{},{addDays:h,differenceInCalendarDays:f,differenceInCalendarMonths:m,endOfBroadcastWeek:g,endOfISOWeek:x,endOfMonth:y,endOfWeek:w,isAfter:S,startOfBroadcastWeek:k,startOfISOWeek:N,startOfWeek:C}=r,T=c?k(s,r):a?N(s):C(s),_=c?g(i):a?x(y(i)):w(y(i)),E=f(_,T),M=m(i,s)+1,q=[];for(let $=0;$<=E;$++){const V=h(T,$);if(e&&S(V,e))break;q.push(V)}const I=(c?35:42)*M;if(o&&q.length{const s=r.weeks.reduce((i,a)=>i.concat(a.days.slice()),e.slice());return n.concat(s.slice())},e.slice())}function T7e(t,e,n,r){const{numberOfMonths:s=1}=n,i=[];for(let a=0;ae)break;i.push(o)}return i}function uD(t,e,n,r){const{month:s,defaultMonth:i,today:a=r.today(),numberOfMonths:o=1}=t;let c=s||i||a;const{differenceInCalendarMonths:h,addMonths:f,startOfMonth:m}=r;if(n&&h(n,c){const k=n.broadcastCalendar?m(S,r):n.ISOWeek?g(S):x(S),N=n.broadcastCalendar?i(S):n.ISOWeek?a(o(S)):c(o(S)),C=e.filter(M=>M>=k&&M<=N),T=n.broadcastCalendar?35:42;if(n.fixedWeeks&&C.length{const L=T-C.length;return q>N&&q<=s(N,L)});C.push(...M)}const _=C.reduce((M,q)=>{const L=n.ISOWeek?h(q):f(q),I=M.find(V=>V.weekNumber===L),$=new ZV(q,S,r);return I?I.days.push($):M.push(new yNe(L,[$])),M},[]),E=new vNe(S,_);return w.push(E),w},[]);return n.reverseMonths?y.reverse():y}function _7e(t,e){let{startMonth:n,endMonth:r}=t;const{startOfYear:s,startOfDay:i,startOfMonth:a,endOfMonth:o,addYears:c,endOfYear:h,newDate:f,today:m}=e,{fromYear:g,toYear:x,fromMonth:y,toMonth:w}=t;!n&&y&&(n=y),!n&&g&&(n=e.newDate(g,0,1)),!r&&w&&(r=w),!r&&x&&(r=f(x,11,31));const S=t.captionLayout==="dropdown"||t.captionLayout==="dropdown-years";return n?n=a(n):g?n=f(g,0,1):!n&&S&&(n=s(c(t.today??m(),-100))),r?r=o(r):x?r=f(x,11,31):!r&&S&&(r=h(t.today??m())),[n&&i(n),r&&i(r)]}function M7e(t,e,n,r){if(n.disableNavigation)return;const{pagedNavigation:s,numberOfMonths:i=1}=n,{startOfMonth:a,addMonths:o,differenceInCalendarMonths:c}=r,h=s?i:1,f=a(t);if(!e)return o(f,h);if(!(c(e,t)n.concat(r.weeks.slice()),e.slice())}function Dy(t,e){const[n,r]=b.useState(t);return[e===void 0?n:e,r]}function D7e(t,e){const[n,r]=_7e(t,e),{startOfMonth:s,endOfMonth:i}=e,a=uD(t,n,r,e),[o,c]=Dy(a,t.month?a:void 0);b.useEffect(()=>{const E=uD(t,n,r,e);c(E)},[t.timeZone]);const h=T7e(o,r,t,e),f=N7e(h,t.endMonth?i(t.endMonth):void 0,t,e),m=E7e(h,f,t,e),g=R7e(m),x=C7e(m),y=A7e(o,n,t,e),w=M7e(o,r,t,e),{disableNavigation:S,onMonthChange:k}=t,N=E=>g.some(M=>M.days.some(q=>q.isEqualTo(E))),C=E=>{if(S)return;let M=s(E);n&&Ms(r)&&(M=s(r)),c(M),k?.(M)};return{months:m,weeks:g,days:x,navStart:n,navEnd:r,previousMonth:y,nextMonth:w,goToMonth:C,goToDay:E=>{N(E)||C(E.date)}}}var Wa;(function(t){t[t.Today=0]="Today",t[t.Selected=1]="Selected",t[t.LastFocused=2]="LastFocused",t[t.FocusedModifier=3]="FocusedModifier"})(Wa||(Wa={}));function dD(t){return!t[ur.disabled]&&!t[ur.hidden]&&!t[ur.outside]}function z7e(t,e,n,r){let s,i=-1;for(const a of t){const o=e(a);dD(o)&&(o[ur.focused]&&idD(e(a)))),s}function P7e(t,e,n,r,s,i,a){const{ISOWeek:o,broadcastCalendar:c}=i,{addDays:h,addMonths:f,addWeeks:m,addYears:g,endOfBroadcastWeek:x,endOfISOWeek:y,endOfWeek:w,max:S,min:k,startOfBroadcastWeek:N,startOfISOWeek:C,startOfWeek:T}=a;let E={day:h,week:m,month:f,year:g,startOfWeek:M=>c?N(M,a):o?C(M):T(M),endOfWeek:M=>c?x(M):o?y(M):w(M)}[t](n,e==="after"?1:-1);return e==="before"&&r?E=S([r,E]):e==="after"&&s&&(E=k([s,E])),E}function cU(t,e,n,r,s,i,a,o=0){if(o>365)return;const c=P7e(t,e,n.date,r,s,i,a),h=!!(i.disabled&&ro(c,i.disabled,a)),f=!!(i.hidden&&ro(c,i.hidden,a)),m=c,g=new ZV(c,m,a);return!h&&!f?g:cU(t,e,g,r,s,i,a,o+1)}function L7e(t,e,n,r,s){const{autoFocus:i}=t,[a,o]=b.useState(),c=z7e(e.days,n,r||(()=>!1),a),[h,f]=b.useState(i?c:void 0);return{isFocusTarget:w=>!!c?.isEqualTo(w),setFocused:f,focused:h,blur:()=>{o(h),f(void 0)},moveFocus:(w,S)=>{if(!h)return;const k=cU(w,S,h,e.navStart,e.navEnd,t,s);k&&(t.disableNavigation&&!e.days.some(C=>C.isEqualTo(k))||(e.goToDay(k),f(k)))}}}function I7e(t,e){const{selected:n,required:r,onSelect:s}=t,[i,a]=Dy(n,s?n:void 0),o=s?n:i,{isSameDay:c}=e,h=x=>o?.some(y=>c(y,x))??!1,{min:f,max:m}=t;return{selected:o,select:(x,y,w)=>{let S=[...o??[]];if(h(x)){if(o?.length===f||r&&o?.length===1)return;S=o?.filter(k=>!c(k,x))}else o?.length===m?S=[x]:S=[...S,x];return s||a(S),s?.(S,x,y,w),S},isSelected:h}}function B7e(t,e,n=0,r=0,s=!1,i=bl){const{from:a,to:o}=e||{},{isSameDay:c,isAfter:h,isBefore:f}=i;let m;if(!a&&!o)m={from:t,to:n>0?void 0:t};else if(a&&!o)c(a,t)?n===0?m={from:a,to:t}:s?m={from:a,to:void 0}:m=void 0:f(t,a)?m={from:t,to:a}:m={from:a,to:t};else if(a&&o)if(c(a,t)&&c(o,t))s?m={from:a,to:o}:m=void 0;else if(c(a,t))m={from:a,to:n>0?void 0:t};else if(c(o,t))m={from:t,to:n>0?void 0:t};else if(f(t,a))m={from:t,to:o};else if(h(t,a))m={from:a,to:t};else if(h(t,o))m={from:a,to:t};else throw new Error("Invalid range");if(m?.from&&m?.to){const g=i.differenceInCalendarDays(m.to,m.from);r>0&&g>r?m={from:t,to:void 0}:n>1&&gtypeof o!="function").some(o=>typeof o=="boolean"?o:n.isDate(o)?no(t,o,!1,n):sU(o,n)?o.some(c=>no(t,c,!1,n)):Ej(o)?o.from&&o.to?hD(t,{from:o.from,to:o.to},n):!1:rU(o)?q7e(t,o.dayOfWeek,n):eU(o)?n.isAfter(o.before,o.after)?hD(t,{from:n.addDays(o.after,1),to:n.addDays(o.before,-1)},n):ro(t.from,o,n)||ro(t.to,o,n):tU(o)||nU(o)?ro(t.from,o,n)||ro(t.to,o,n):!1))return!0;const a=r.filter(o=>typeof o=="function");if(a.length){let o=t.from;const c=n.differenceInCalendarDays(t.to,t.from);for(let h=0;h<=c;h++){if(a.some(f=>f(o)))return!0;o=n.addDays(o,1)}}return!1}function $7e(t,e){const{disabled:n,excludeDisabled:r,selected:s,required:i,onSelect:a}=t,[o,c]=Dy(s,a?s:void 0),h=a?s:o;return{selected:h,select:(g,x,y)=>{const{min:w,max:S}=t,k=g?B7e(g,h,w,S,i,e):void 0;return r&&n&&k?.from&&k.to&&F7e({from:k.from,to:k.to},n,e)&&(k.from=g,k.to=void 0),a||c(k),a?.(k,g,x,y),k},isSelected:g=>h&&no(h,g,!1,e)}}function Q7e(t,e){const{selected:n,required:r,onSelect:s}=t,[i,a]=Dy(n,s?n:void 0),o=s?n:i,{isSameDay:c}=e;return{selected:o,select:(m,g,x)=>{let y=m;return!r&&o&&o&&c(m,o)&&(y=void 0),s||a(y),s?.(y,m,g,x),y},isSelected:m=>o?c(o,m):!1}}function H7e(t,e){const n=Q7e(t,e),r=I7e(t,e),s=$7e(t,e);switch(t.mode){case"single":return n;case"multiple":return r;case"range":return s;default:return}}function V7e(t){let e=t;e.timeZone&&(e={...t},e.today&&(e.today=new vs(e.today,e.timeZone)),e.month&&(e.month=new vs(e.month,e.timeZone)),e.defaultMonth&&(e.defaultMonth=new vs(e.defaultMonth,e.timeZone)),e.startMonth&&(e.startMonth=new vs(e.startMonth,e.timeZone)),e.endMonth&&(e.endMonth=new vs(e.endMonth,e.timeZone)),e.mode==="single"&&e.selected?e.selected=new vs(e.selected,e.timeZone):e.mode==="multiple"&&e.selected?e.selected=e.selected?.map(pt=>new vs(pt,e.timeZone)):e.mode==="range"&&e.selected&&(e.selected={from:e.selected.from?new vs(e.selected.from,e.timeZone):void 0,to:e.selected.to?new vs(e.selected.to,e.timeZone):void 0}));const{components:n,formatters:r,labels:s,dateLib:i,locale:a,classNames:o}=b.useMemo(()=>{const pt={...Tj,...e.locale};return{dateLib:new Di({locale:pt,weekStartsOn:e.broadcastCalendar?1:e.weekStartsOn,firstWeekContainsDate:e.firstWeekContainsDate,useAdditionalWeekYearTokens:e.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:e.useAdditionalDayOfYearTokens,timeZone:e.timeZone,numerals:e.numerals},e.dateLib),components:XNe(e.components),formatters:i7e(e.formatters),labels:{...w7e,...e.labels},locale:pt,classNames:{..._j(),...e.classNames}}},[e.locale,e.broadcastCalendar,e.weekStartsOn,e.firstWeekContainsDate,e.useAdditionalWeekYearTokens,e.useAdditionalDayOfYearTokens,e.timeZone,e.numerals,e.dateLib,e.components,e.formatters,e.labels,e.classNames]),{captionLayout:c,mode:h,navLayout:f,numberOfMonths:m=1,onDayBlur:g,onDayClick:x,onDayFocus:y,onDayKeyDown:w,onDayMouseEnter:S,onDayMouseLeave:k,onNextClick:N,onPrevClick:C,showWeekNumber:T,styles:_}=e,{formatCaption:E,formatDay:M,formatMonthDropdown:q,formatWeekNumber:L,formatWeekNumberHeader:I,formatWeekdayName:$,formatYearDropdown:V}=r,ee=D7e(e,i),{days:z,months:H,navStart:P,navEnd:W,previousMonth:J,nextMonth:X,goToMonth:R}=ee,se=WNe(z,e,P,W,i),{isSelected:G,select:F,selected:U}=H7e(e,i)??{},{blur:te,focused:ne,isFocusTarget:Y,moveFocus:ae,setFocused:re}=L7e(e,ee,se,G??(()=>!1),i),{labelDayButton:le,labelGridcell:_e,labelGrid:Ge,labelMonthDropdown:tt,labelNav:Xe,labelPrevious:je,labelNext:Qe,labelWeekday:He,labelWeekNumber:$e,labelWeekNumberHeader:bt,labelYearDropdown:lt}=s,xn=b.useMemo(()=>o7e(i,e.ISOWeek),[i,e.ISOWeek]),_n=h!==void 0||x!==void 0,Cn=b.useCallback(()=>{J&&(R(J),C?.(J))},[J,R,C]),Dt=b.useCallback(()=>{X&&(R(X),N?.(X))},[R,X,N]),xt=b.useCallback((pt,kn)=>vt=>{vt.preventDefault(),vt.stopPropagation(),re(pt),F?.(pt.date,kn,vt),x?.(pt.date,kn,vt)},[F,x,re]),Te=b.useCallback((pt,kn)=>vt=>{re(pt),y?.(pt.date,kn,vt)},[y,re]),Re=b.useCallback((pt,kn)=>vt=>{te(),g?.(pt.date,kn,vt)},[te,g]),qe=b.useCallback((pt,kn)=>vt=>{const Gt={ArrowLeft:[vt.shiftKey?"month":"day",e.dir==="rtl"?"after":"before"],ArrowRight:[vt.shiftKey?"month":"day",e.dir==="rtl"?"before":"after"],ArrowDown:[vt.shiftKey?"year":"week","after"],ArrowUp:[vt.shiftKey?"year":"week","before"],PageUp:[vt.shiftKey?"year":"month","before"],PageDown:[vt.shiftKey?"year":"month","after"],Home:["startOfWeek","before"],End:["endOfWeek","after"]};if(Gt[vt.key]){vt.preventDefault(),vt.stopPropagation();const[Vt,ot]=Gt[vt.key];ae(Vt,ot)}w?.(pt.date,kn,vt)},[ae,w,e.dir]),rt=b.useCallback((pt,kn)=>vt=>{S?.(pt.date,kn,vt)},[S]),wt=b.useCallback((pt,kn)=>vt=>{k?.(pt.date,kn,vt)},[k]),jt=b.useCallback(pt=>kn=>{const vt=Number(kn.target.value),Gt=i.setMonth(i.startOfMonth(pt),vt);R(Gt)},[i,R]),Ne=b.useCallback(pt=>kn=>{const vt=Number(kn.target.value),Gt=i.setYear(i.startOfMonth(pt),vt);R(Gt)},[i,R]),{className:ie,style:xe}=b.useMemo(()=>({className:[o[gt.Root],e.className].filter(Boolean).join(" "),style:{..._?.[gt.Root],...e.style}}),[o,e.className,e.style,_]),Je=YNe(e),dt=b.useRef(null);j7e(dt,!!e.animate,{classNames:o,months:H,focused:ne,dateLib:i});const er={dayPickerProps:e,selected:U,select:F,isSelected:G,months:H,nextMonth:X,previousMonth:J,goToMonth:R,getModifiers:se,components:n,classNames:o,styles:_,labels:s,formatters:r};return he.createElement(JV.Provider,{value:er},he.createElement(n.Root,{rootRef:e.animate?dt:void 0,className:ie,style:xe,dir:e.dir,id:e.id,lang:e.lang,nonce:e.nonce,title:e.title,role:e.role,"aria-label":e["aria-label"],"aria-labelledby":e["aria-labelledby"],...Je},he.createElement(n.Months,{className:o[gt.Months],style:_?.[gt.Months]},!e.hideNavigation&&!f&&he.createElement(n.Nav,{"data-animated-nav":e.animate?"true":void 0,className:o[gt.Nav],style:_?.[gt.Nav],"aria-label":Xe(),onPreviousClick:Cn,onNextClick:Dt,previousMonth:J,nextMonth:X}),H.map((pt,kn)=>he.createElement(n.Month,{"data-animated-month":e.animate?"true":void 0,className:o[gt.Month],style:_?.[gt.Month],key:kn,displayIndex:kn,calendarMonth:pt},f==="around"&&!e.hideNavigation&&kn===0&&he.createElement(n.PreviousMonthButton,{type:"button",className:o[gt.PreviousMonthButton],tabIndex:J?void 0:-1,"aria-disabled":J?void 0:!0,"aria-label":je(J),onClick:Cn,"data-animated-button":e.animate?"true":void 0},he.createElement(n.Chevron,{disabled:J?void 0:!0,className:o[gt.Chevron],orientation:e.dir==="rtl"?"right":"left"})),he.createElement(n.MonthCaption,{"data-animated-caption":e.animate?"true":void 0,className:o[gt.MonthCaption],style:_?.[gt.MonthCaption],calendarMonth:pt,displayIndex:kn},c?.startsWith("dropdown")?he.createElement(n.DropdownNav,{className:o[gt.Dropdowns],style:_?.[gt.Dropdowns]},(()=>{const vt=c==="dropdown"||c==="dropdown-months"?he.createElement(n.MonthsDropdown,{key:"month",className:o[gt.MonthsDropdown],"aria-label":tt(),classNames:o,components:n,disabled:!!e.disableNavigation,onChange:jt(pt.date),options:a7e(pt.date,P,W,r,i),style:_?.[gt.Dropdown],value:i.getMonth(pt.date)}):he.createElement("span",{key:"month"},q(pt.date,i)),Gt=c==="dropdown"||c==="dropdown-years"?he.createElement(n.YearsDropdown,{key:"year",className:o[gt.YearsDropdown],"aria-label":lt(i.options),classNames:o,components:n,disabled:!!e.disableNavigation,onChange:Ne(pt.date),options:c7e(P,W,r,i,!!e.reverseYears),style:_?.[gt.Dropdown],value:i.getYear(pt.date)}):he.createElement("span",{key:"year"},V(pt.date,i));return i.getMonthYearOrder()==="year-first"?[Gt,vt]:[vt,Gt]})(),he.createElement("span",{role:"status","aria-live":"polite",style:{border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap",wordWrap:"normal"}},E(pt.date,i.options,i))):he.createElement(n.CaptionLabel,{className:o[gt.CaptionLabel],role:"status","aria-live":"polite"},E(pt.date,i.options,i))),f==="around"&&!e.hideNavigation&&kn===m-1&&he.createElement(n.NextMonthButton,{type:"button",className:o[gt.NextMonthButton],tabIndex:X?void 0:-1,"aria-disabled":X?void 0:!0,"aria-label":Qe(X),onClick:Dt,"data-animated-button":e.animate?"true":void 0},he.createElement(n.Chevron,{disabled:X?void 0:!0,className:o[gt.Chevron],orientation:e.dir==="rtl"?"left":"right"})),kn===m-1&&f==="after"&&!e.hideNavigation&&he.createElement(n.Nav,{"data-animated-nav":e.animate?"true":void 0,className:o[gt.Nav],style:_?.[gt.Nav],"aria-label":Xe(),onPreviousClick:Cn,onNextClick:Dt,previousMonth:J,nextMonth:X}),he.createElement(n.MonthGrid,{role:"grid","aria-multiselectable":h==="multiple"||h==="range","aria-label":Ge(pt.date,i.options,i)||void 0,className:o[gt.MonthGrid],style:_?.[gt.MonthGrid]},!e.hideWeekdays&&he.createElement(n.Weekdays,{"data-animated-weekdays":e.animate?"true":void 0,className:o[gt.Weekdays],style:_?.[gt.Weekdays]},T&&he.createElement(n.WeekNumberHeader,{"aria-label":bt(i.options),className:o[gt.WeekNumberHeader],style:_?.[gt.WeekNumberHeader],scope:"col"},I()),xn.map(vt=>he.createElement(n.Weekday,{"aria-label":He(vt,i.options,i),className:o[gt.Weekday],key:String(vt),style:_?.[gt.Weekday],scope:"col"},$(vt,i.options,i)))),he.createElement(n.Weeks,{"data-animated-weeks":e.animate?"true":void 0,className:o[gt.Weeks],style:_?.[gt.Weeks]},pt.weeks.map(vt=>he.createElement(n.Week,{className:o[gt.Week],key:vt.weekNumber,style:_?.[gt.Week],week:vt},T&&he.createElement(n.WeekNumber,{week:vt,style:_?.[gt.WeekNumber],"aria-label":$e(vt.weekNumber,{locale:a}),className:o[gt.WeekNumber],scope:"row",role:"rowheader"},L(vt.weekNumber,i)),vt.days.map(Gt=>{const{date:Vt}=Gt,ot=se(Gt);if(ot[ur.focused]=!ot.hidden&&!!ne?.isEqualTo(Gt),ot[ka.selected]=G?.(Vt)||ot.selected,Ej(U)){const{from:pr,to:Cr}=U;ot[ka.range_start]=!!(pr&&Cr&&i.isSameDay(Vt,pr)),ot[ka.range_end]=!!(pr&&Cr&&i.isSameDay(Vt,Cr)),ot[ka.range_middle]=no(U,Vt,!0,i)}const mr=l7e(ot,_,e.modifiersStyles),Yr=GNe(ot,o,e.modifiersClassNames),Kr=!_n&&!ot.hidden?_e(Vt,ot,i.options,i):void 0;return he.createElement(n.Day,{key:`${i.format(Vt,"yyyy-MM-dd")}_${i.format(Gt.displayMonth,"yyyy-MM")}`,day:Gt,modifiers:ot,className:Yr.join(" "),style:mr,role:"gridcell","aria-selected":ot.selected||void 0,"aria-label":Kr,"data-day":i.format(Vt,"yyyy-MM-dd"),"data-month":Gt.outside?i.format(Vt,"yyyy-MM"):void 0,"data-selected":ot.selected||void 0,"data-disabled":ot.disabled||void 0,"data-hidden":ot.hidden||void 0,"data-outside":Gt.outside||void 0,"data-focused":ot.focused||void 0,"data-today":ot.today||void 0},!ot.hidden&&_n?he.createElement(n.DayButton,{className:o[gt.DayButton],style:_?.[gt.DayButton],type:"button",day:Gt,modifiers:ot,disabled:ot.disabled||void 0,tabIndex:Y(Gt)?0:-1,"aria-label":le(Vt,ot,i.options,i),onClick:xt(Gt,ot),onBlur:Re(Gt,ot),onFocus:Te(Gt,ot),onKeyDown:qe(Gt,ot),onMouseEnter:rt(Gt,ot),onMouseLeave:wt(Gt,ot)},M(Vt,i.options,i)):!ot.hidden&&M(Gt.date,i.options,i))})))))))),e.footer&&he.createElement(n.Footer,{className:o[gt.Footer],style:_?.[gt.Footer],role:"status","aria-live":"polite"},e.footer)))}function fD({className:t,classNames:e,showOutsideDays:n=!0,captionLayout:r="label",buttonVariant:s="ghost",formatters:i,components:a,...o}){const c=_j();return l.jsx(V7e,{showOutsideDays:n,className:ye("bg-background group/calendar p-3 [--cell-size:2rem] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,t),captionLayout:r,formatters:{formatMonthDropdown:h=>h.toLocaleString("default",{month:"short"}),...i},classNames:{root:ye("w-fit",c.root),months:ye("relative flex flex-col gap-4 md:flex-row",c.months),month:ye("flex w-full flex-col gap-4",c.month),nav:ye("absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1",c.nav),button_previous:ye(Qm({variant:s}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",c.button_previous),button_next:ye(Qm({variant:s}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",c.button_next),month_caption:ye("flex h-[--cell-size] w-full items-center justify-center px-[--cell-size]",c.month_caption),dropdowns:ye("flex h-[--cell-size] w-full items-center justify-center gap-1.5 text-sm font-medium",c.dropdowns),dropdown_root:ye("has-focus:border-ring border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] relative rounded-md border",c.dropdown_root),dropdown:ye("bg-popover absolute inset-0 opacity-0",c.dropdown),caption_label:ye("select-none font-medium",r==="label"?"text-sm":"[&>svg]:text-muted-foreground flex h-8 items-center gap-1 rounded-md pl-2 pr-1 text-sm [&>svg]:size-3.5",c.caption_label),table:"w-full border-collapse",weekdays:ye("flex",c.weekdays),weekday:ye("text-muted-foreground flex-1 select-none rounded-md text-[0.8rem] font-normal",c.weekday),week:ye("mt-2 flex w-full",c.week),week_number_header:ye("w-[--cell-size] select-none",c.week_number_header),week_number:ye("text-muted-foreground select-none text-[0.8rem]",c.week_number),day:ye("group/day relative aspect-square h-full w-full select-none p-0 text-center [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md",c.day),range_start:ye("bg-accent rounded-l-md",c.range_start),range_middle:ye("rounded-none",c.range_middle),range_end:ye("bg-accent rounded-r-md",c.range_end),today:ye("bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",c.today),outside:ye("text-muted-foreground aria-selected:text-muted-foreground",c.outside),disabled:ye("text-muted-foreground opacity-50",c.disabled),hidden:ye("invisible",c.hidden),...e},components:{Root:({className:h,rootRef:f,...m})=>l.jsx("div",{"data-slot":"calendar",ref:f,className:ye(h),...m}),Chevron:({className:h,orientation:f,...m})=>f==="left"?l.jsx(qu,{className:ye("size-4",h),...m}):f==="right"?l.jsx(Fu,{className:ye("size-4",h),...m}):l.jsx(Nu,{className:ye("size-4",h),...m}),DayButton:U7e,WeekNumber:({children:h,...f})=>l.jsx("td",{...f,children:l.jsx("div",{className:"flex size-[--cell-size] items-center justify-center text-center",children:h})}),...a},...o})}function U7e({className:t,day:e,modifiers:n,...r}){const s=_j(),i=b.useRef(null);return b.useEffect(()=>{n.focused&&i.current?.focus()},[n.focused]),l.jsx(fe,{ref:i,variant:"ghost",size:"icon","data-day":e.date.toLocaleDateString(),"data-selected-single":n.selected&&!n.range_start&&!n.range_end&&!n.range_middle,"data-range-start":n.range_start,"data-range-end":n.range_end,"data-range-middle":n.range_middle,className:ye("data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 flex aspect-square h-auto w-full min-w-[--cell-size] flex-col gap-1 font-normal leading-none data-[range-end=true]:rounded-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] [&>span]:text-xs [&>span]:opacity-70",s.day,t),...r})}class W7e{ws=null;reconnectTimeout=null;reconnectAttempts=0;maxReconnectAttempts=10;heartbeatInterval=null;logCallbacks=new Set;connectionCallbacks=new Set;isConnected=!1;logCache=[];maxCacheSize=1e3;getWebSocketUrl(){{const e=window.location.protocol==="https:"?"wss:":"ws:",n=window.location.host;return`${e}//${n}/ws/logs`}}connect(){if(this.ws?.readyState===WebSocket.OPEN||this.ws?.readyState===WebSocket.CONNECTING)return;const e=this.getWebSocketUrl();try{this.ws=new WebSocket(e),this.ws.onopen=()=>{this.isConnected=!0,this.reconnectAttempts=0,this.notifyConnection(!0),this.startHeartbeat()},this.ws.onmessage=n=>{try{if(n.data==="pong")return;const r=JSON.parse(n.data);this.notifyLog(r)}catch(r){console.error("解析日志消息失败:",r)}},this.ws.onerror=n=>{console.error("❌ WebSocket 错误:",n),this.isConnected=!1,this.notifyConnection(!1)},this.ws.onclose=()=>{this.isConnected=!1,this.notifyConnection(!1),this.stopHeartbeat(),this.attemptReconnect()}}catch(n){console.error("创建 WebSocket 连接失败:",n),this.attemptReconnect()}}attemptReconnect(){if(this.reconnectAttempts>=this.maxReconnectAttempts)return;this.reconnectAttempts+=1;const e=Math.min(1e3*this.reconnectAttempts,1e4);this.reconnectTimeout=window.setTimeout(()=>{this.connect()},e)}startHeartbeat(){this.heartbeatInterval=window.setInterval(()=>{this.ws?.readyState===WebSocket.OPEN&&this.ws.send("ping")},3e4)}stopHeartbeat(){this.heartbeatInterval!==null&&(clearInterval(this.heartbeatInterval),this.heartbeatInterval=null)}disconnect(){this.reconnectTimeout!==null&&(clearTimeout(this.reconnectTimeout),this.reconnectTimeout=null),this.stopHeartbeat(),this.ws&&(this.ws.close(),this.ws=null),this.isConnected=!1,this.reconnectAttempts=0}onLog(e){return this.logCallbacks.add(e),()=>this.logCallbacks.delete(e)}onConnectionChange(e){return this.connectionCallbacks.add(e),e(this.isConnected),()=>this.connectionCallbacks.delete(e)}notifyLog(e){this.logCache.some(r=>r.id===e.id)||(this.logCache.push(e),this.logCache.length>this.maxCacheSize&&(this.logCache=this.logCache.slice(-this.maxCacheSize)),this.logCallbacks.forEach(r=>{try{r(e)}catch(s){console.error("日志回调执行失败:",s)}}))}notifyConnection(e){this.connectionCallbacks.forEach(n=>{try{n(e)}catch(r){console.error("连接状态回调执行失败:",r)}})}getAllLogs(){return[...this.logCache]}clearLogs(){this.logCache=[]}getConnectionStatus(){return this.isConnected}}const Hd=new W7e;typeof window<"u"&&Hd.connect();const G7e={lessThanXSeconds:{one:"不到 1 秒",other:"不到 {{count}} 秒"},xSeconds:{one:"1 秒",other:"{{count}} 秒"},halfAMinute:"半分钟",lessThanXMinutes:{one:"不到 1 分钟",other:"不到 {{count}} 分钟"},xMinutes:{one:"1 分钟",other:"{{count}} 分钟"},xHours:{one:"1 小时",other:"{{count}} 小时"},aboutXHours:{one:"大约 1 小时",other:"大约 {{count}} 小时"},xDays:{one:"1 天",other:"{{count}} 天"},aboutXWeeks:{one:"大约 1 个星期",other:"大约 {{count}} 个星期"},xWeeks:{one:"1 个星期",other:"{{count}} 个星期"},aboutXMonths:{one:"大约 1 个月",other:"大约 {{count}} 个月"},xMonths:{one:"1 个月",other:"{{count}} 个月"},aboutXYears:{one:"大约 1 年",other:"大约 {{count}} 年"},xYears:{one:"1 年",other:"{{count}} 年"},overXYears:{one:"超过 1 年",other:"超过 {{count}} 年"},almostXYears:{one:"将近 1 年",other:"将近 {{count}} 年"}},X7e=(t,e,n)=>{let r;const s=G7e[t];return typeof s=="string"?r=s:e===1?r=s.one:r=s.other.replace("{{count}}",String(e)),n?.addSuffix?n.comparison&&n.comparison>0?r+"内":r+"前":r},Y7e={full:"y'年'M'月'd'日' EEEE",long:"y'年'M'月'd'日'",medium:"yyyy-MM-dd",short:"yy-MM-dd"},K7e={full:"zzzz a h:mm:ss",long:"z a h:mm:ss",medium:"a h:mm:ss",short:"a h:mm"},Z7e={full:"{{date}} {{time}}",long:"{{date}} {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},J7e={date:dh({formats:Y7e,defaultWidth:"full"}),time:dh({formats:K7e,defaultWidth:"full"}),dateTime:dh({formats:Z7e,defaultWidth:"full"})};function mD(t,e,n){const r="eeee p";return uNe(t,e,n)?r:t.getTime()>e.getTime()?"'下个'"+r:"'上个'"+r}const e8e={lastWeek:mD,yesterday:"'昨天' p",today:"'今天' p",tomorrow:"'明天' p",nextWeek:mD,other:"PP p"},t8e=(t,e,n,r)=>{const s=e8e[t];return typeof s=="function"?s(e,n,r):s},n8e={narrow:["前","公元"],abbreviated:["前","公元"],wide:["公元前","公元"]},r8e={narrow:["1","2","3","4"],abbreviated:["第一季","第二季","第三季","第四季"],wide:["第一季度","第二季度","第三季度","第四季度"]},s8e={narrow:["一","二","三","四","五","六","七","八","九","十","十一","十二"],abbreviated:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],wide:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]},i8e={narrow:["日","一","二","三","四","五","六"],short:["日","一","二","三","四","五","六"],abbreviated:["周日","周一","周二","周三","周四","周五","周六"],wide:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"]},a8e={narrow:{am:"上",pm:"下",midnight:"凌晨",noon:"午",morning:"早",afternoon:"下午",evening:"晚",night:"夜"},abbreviated:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"},wide:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"}},l8e={narrow:{am:"上",pm:"下",midnight:"凌晨",noon:"午",morning:"早",afternoon:"下午",evening:"晚",night:"夜"},abbreviated:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"},wide:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"}},o8e=(t,e)=>{const n=Number(t);switch(e?.unit){case"date":return n.toString()+"日";case"hour":return n.toString()+"时";case"minute":return n.toString()+"分";case"second":return n.toString()+"秒";default:return"第 "+n.toString()}},c8e={ordinalNumber:o8e,era:Ka({values:n8e,defaultWidth:"wide"}),quarter:Ka({values:r8e,defaultWidth:"wide",argumentCallback:t=>t-1}),month:Ka({values:s8e,defaultWidth:"wide"}),day:Ka({values:i8e,defaultWidth:"wide"}),dayPeriod:Ka({values:a8e,defaultWidth:"wide",formattingValues:l8e,defaultFormattingWidth:"wide"})},u8e=/^(第\s*)?\d+(日|时|分|秒)?/i,d8e=/\d+/i,h8e={narrow:/^(前)/i,abbreviated:/^(前)/i,wide:/^(公元前|公元)/i},f8e={any:[/^(前)/i,/^(公元)/i]},m8e={narrow:/^[1234]/i,abbreviated:/^第[一二三四]刻/i,wide:/^第[一二三四]刻钟/i},p8e={any:[/(1|一)/i,/(2|二)/i,/(3|三)/i,/(4|四)/i]},g8e={narrow:/^(一|二|三|四|五|六|七|八|九|十[二一])/i,abbreviated:/^(一|二|三|四|五|六|七|八|九|十[二一]|\d|1[12])月/i,wide:/^(一|二|三|四|五|六|七|八|九|十[二一])月/i},x8e={narrow:[/^一/i,/^二/i,/^三/i,/^四/i,/^五/i,/^六/i,/^七/i,/^八/i,/^九/i,/^十(?!(一|二))/i,/^十一/i,/^十二/i],any:[/^一|1/i,/^二|2/i,/^三|3/i,/^四|4/i,/^五|5/i,/^六|6/i,/^七|7/i,/^八|8/i,/^九|9/i,/^十(?!(一|二))|10/i,/^十一|11/i,/^十二|12/i]},v8e={narrow:/^[一二三四五六日]/i,short:/^[一二三四五六日]/i,abbreviated:/^周[一二三四五六日]/i,wide:/^星期[一二三四五六日]/i},y8e={any:[/日/i,/一/i,/二/i,/三/i,/四/i,/五/i,/六/i]},b8e={any:/^(上午?|下午?|午夜|[中正]午|早上?|下午|晚上?|凌晨|)/i},w8e={any:{am:/^上午?/i,pm:/^下午?/i,midnight:/^午夜/i,noon:/^[中正]午/i,morning:/^早上/i,afternoon:/^下午/i,evening:/^晚上?/i,night:/^凌晨/i}},S8e={ordinalNumber:UV({matchPattern:u8e,parsePattern:d8e,valueCallback:t=>parseInt(t,10)}),era:Za({matchPatterns:h8e,defaultMatchWidth:"wide",parsePatterns:f8e,defaultParseWidth:"any"}),quarter:Za({matchPatterns:m8e,defaultMatchWidth:"wide",parsePatterns:p8e,defaultParseWidth:"any",valueCallback:t=>t+1}),month:Za({matchPatterns:g8e,defaultMatchWidth:"wide",parsePatterns:x8e,defaultParseWidth:"any"}),day:Za({matchPatterns:v8e,defaultMatchWidth:"wide",parsePatterns:y8e,defaultParseWidth:"any"}),dayPeriod:Za({matchPatterns:b8e,defaultMatchWidth:"any",parsePatterns:w8e,defaultParseWidth:"any"})},$x={code:"zh-CN",formatDistance:X7e,formatLong:J7e,formatRelative:t8e,localize:c8e,match:S8e,options:{weekStartsOn:1,firstWeekContainsDate:4}},Qx={xs:{label:"小",rowHeight:28,class:"text-[10px] sm:text-xs"},sm:{label:"中",rowHeight:36,class:"text-xs sm:text-sm"},base:{label:"大",rowHeight:44,class:"text-sm sm:text-base"}};function k8e(){const[t,e]=b.useState([]),[n,r]=b.useState(""),[s,i]=b.useState("all"),[a,o]=b.useState("all"),[c,h]=b.useState(void 0),[f,m]=b.useState(void 0),[g,x]=b.useState(!0),[y,w]=b.useState(!1),[S,k]=b.useState("xs"),[N,C]=b.useState(4),T=b.useRef(null);b.useEffect(()=>{const P=Hd.getAllLogs();e(P);const W=Hd.onLog(()=>{e(Hd.getAllLogs())}),J=Hd.onConnectionChange(X=>{w(X)});return()=>{W(),J()}},[]);const _=b.useMemo(()=>{const P=new Set(t.map(W=>W.module));return Array.from(P).sort()},[t]),E=P=>{switch(P){case"DEBUG":return"text-muted-foreground";case"INFO":return"text-blue-500 dark:text-blue-400";case"WARNING":return"text-yellow-600 dark:text-yellow-500";case"ERROR":return"text-red-600 dark:text-red-500";case"CRITICAL":return"text-red-700 dark:text-red-400 font-bold";default:return"text-foreground"}},M=P=>{switch(P){case"DEBUG":return"bg-gray-800/30 dark:bg-gray-800/50";case"INFO":return"bg-blue-900/20 dark:bg-blue-500/20";case"WARNING":return"bg-yellow-900/20 dark:bg-yellow-500/20";case"ERROR":return"bg-red-900/20 dark:bg-red-500/20";case"CRITICAL":return"bg-red-900/30 dark:bg-red-600/30";default:return"bg-gray-800/20 dark:bg-gray-800/30"}},q=()=>{window.location.reload()},L=()=>{Hd.clearLogs(),e([])},I=()=>{const P=ee.map(R=>`${R.timestamp} [${R.level.padEnd(8)}] [${R.module}] ${R.message}`).join(` -`),W=new Blob([P],{type:"text/plain;charset=utf-8"}),J=URL.createObjectURL(W),X=document.createElement("a");X.href=J,X.download=`logs-${S1(new Date,"yyyy-MM-dd-HHmmss")}.txt`,X.click(),URL.revokeObjectURL(J)},$=()=>{x(!g)},V=()=>{h(void 0),m(void 0)},ee=b.useMemo(()=>t.filter(P=>{const W=n===""||P.message.toLowerCase().includes(n.toLowerCase())||P.module.toLowerCase().includes(n.toLowerCase()),J=s==="all"||P.level===s,X=a==="all"||P.module===a;let R=!0;if(c||f){const se=new Date(P.timestamp);if(c){const G=new Date(c);G.setHours(0,0,0,0),R=R&&se>=G}if(f){const G=new Date(f);G.setHours(23,59,59,999),R=R&&se<=G}}return W&&J&&X&&R}),[t,n,s,a,c,f]),z=Qx[S].rowHeight+N,H=HOe({count:ee.length,getScrollElement:()=>T.current,estimateSize:()=>z,overscan:15});return b.useEffect(()=>{g&&ee.length>0&&H.scrollToIndex(ee.length-1,{align:"end",behavior:"auto"})},[ee.length,g,H]),l.jsxs("div",{className:"h-full flex flex-col overflow-hidden",children:[l.jsxs("div",{className:"flex-shrink-0 space-y-4 p-3 sm:p-4 lg:p-6",children:[l.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3",children:[l.jsxs("div",{children:[l.jsx("h1",{className:"text-xl sm:text-2xl lg:text-3xl font-bold",children:"日志查看器"}),l.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mt-1",children:"实时查看和分析麦麦运行日志"})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("div",{className:ye("h-2.5 w-2.5 sm:h-3 sm:w-3 rounded-full",y?"bg-green-500 animate-pulse":"bg-red-500")}),l.jsx("span",{className:"text-xs sm:text-sm text-muted-foreground",children:y?"已连接":"未连接"})]})]}),l.jsx(Tt,{className:"p-3 sm:p-4",children:l.jsxs("div",{className:"flex flex-col gap-3 sm:gap-4",children:[l.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:gap-4",children:[l.jsxs("div",{className:"flex-1 relative",children:[l.jsx(li,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),l.jsx(Pe,{placeholder:"搜索日志...",value:n,onChange:P=>r(P.target.value),className:"pl-9 h-9 text-sm"})]}),l.jsxs(zt,{value:s,onValueChange:i,children:[l.jsxs(At,{className:"w-full sm:w-[140px] lg:w-[180px] h-9 text-sm",children:[l.jsx(_3,{className:"h-4 w-4 mr-2"}),l.jsx(Pt,{placeholder:"级别"})]}),l.jsxs(Rt,{children:[l.jsx(ze,{value:"all",children:"全部级别"}),l.jsx(ze,{value:"DEBUG",children:"DEBUG"}),l.jsx(ze,{value:"INFO",children:"INFO"}),l.jsx(ze,{value:"WARNING",children:"WARNING"}),l.jsx(ze,{value:"ERROR",children:"ERROR"}),l.jsx(ze,{value:"CRITICAL",children:"CRITICAL"})]})]}),l.jsxs(zt,{value:a,onValueChange:o,children:[l.jsxs(At,{className:"w-full sm:w-[160px] lg:w-[200px] h-9 text-sm",children:[l.jsx(_3,{className:"h-4 w-4 mr-2"}),l.jsx(Pt,{placeholder:"模块"})]}),l.jsxs(Rt,{children:[l.jsx(ze,{value:"all",children:"全部模块"}),_.map(P=>l.jsx(ze,{value:P,children:P},P))]})]})]}),l.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:gap-4",children:[l.jsxs(uo,{children:[l.jsx(ho,{asChild:!0,children:l.jsxs(fe,{variant:"outline",size:"sm",className:ye("w-full sm:w-[200px] lg:w-[240px] justify-start text-left font-normal h-9",!c&&"text-muted-foreground"),children:[l.jsx(IC,{className:"mr-2 h-4 w-4"}),l.jsx("span",{className:"text-xs sm:text-sm",children:c?S1(c,"PPP",{locale:$x}):"开始日期"})]})}),l.jsx(ol,{className:"w-auto p-0",align:"start",children:l.jsx(fD,{mode:"single",selected:c,onSelect:h,initialFocus:!0,locale:$x})})]}),l.jsxs(uo,{children:[l.jsx(ho,{asChild:!0,children:l.jsxs(fe,{variant:"outline",size:"sm",className:ye("w-full sm:w-[200px] lg:w-[240px] justify-start text-left font-normal h-9",!f&&"text-muted-foreground"),children:[l.jsx(IC,{className:"mr-2 h-4 w-4"}),l.jsx("span",{className:"text-xs sm:text-sm",children:f?S1(f,"PPP",{locale:$x}):"结束日期"})]})}),l.jsx(ol,{className:"w-auto p-0",align:"start",children:l.jsx(fD,{mode:"single",selected:f,onSelect:m,initialFocus:!0,locale:$x})})]}),(c||f)&&l.jsxs(fe,{variant:"outline",size:"sm",onClick:V,className:"w-full sm:w-auto h-9",children:[l.jsx(R0,{className:"h-4 w-4 sm:mr-2"}),l.jsx("span",{className:"hidden sm:inline text-sm",children:"清除时间筛选"}),l.jsx("span",{className:"sm:hidden text-sm",children:"清除"})]})]}),l.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:flex-wrap sm:items-center",children:[l.jsxs("div",{className:"flex gap-2 flex-wrap",children:[l.jsxs(fe,{variant:g?"default":"outline",size:"sm",onClick:$,className:"flex-1 sm:flex-none h-9",children:[g?l.jsx(HK,{className:"h-4 w-4"}):l.jsx(VK,{className:"h-4 w-4"}),l.jsx("span",{className:"ml-2 text-sm",children:g?"自动滚动":"已暂停"})]}),l.jsxs(fe,{variant:"outline",size:"sm",onClick:q,className:"flex-1 sm:flex-none h-9",children:[l.jsx(ti,{className:"h-4 w-4"}),l.jsx("span",{className:"ml-2 text-sm",children:"刷新"})]}),l.jsxs(fe,{variant:"outline",size:"sm",onClick:L,className:"flex-1 sm:flex-none h-9",children:[l.jsx(ln,{className:"h-4 w-4"}),l.jsx("span",{className:"ml-2 text-sm",children:"清空"})]}),l.jsxs(fe,{variant:"outline",size:"sm",onClick:I,className:"flex-1 sm:flex-none h-9",children:[l.jsx(bu,{className:"h-4 w-4"}),l.jsx("span",{className:"ml-2 text-sm",children:"导出"})]})]}),l.jsx("div",{className:"flex-1 hidden sm:block"}),l.jsxs("div",{className:"text-xs sm:text-sm text-muted-foreground flex items-center justify-center sm:justify-end",children:[l.jsxs("span",{className:"font-mono",children:[ee.length," / ",t.length]}),l.jsx("span",{className:"ml-1",children:"条日志"})]})]}),l.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:gap-6 pt-2 border-t border-border/50",children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[l.jsx(UK,{className:"h-4 w-4"}),l.jsx("span",{children:"字号"})]}),l.jsx("div",{className:"flex gap-1",children:Object.keys(Qx).map(P=>l.jsx(fe,{variant:S===P?"default":"outline",size:"sm",onClick:()=>k(P),className:"h-7 px-3 text-xs",children:Qx[P].label},P))})]}),l.jsxs("div",{className:"flex items-center gap-3 flex-1 max-w-xs",children:[l.jsx("span",{className:"text-sm text-muted-foreground whitespace-nowrap",children:"行距"}),l.jsx($0,{value:[N],onValueChange:([P])=>C(P),min:0,max:12,step:2,className:"flex-1"}),l.jsxs("span",{className:"text-xs text-muted-foreground w-8",children:[N,"px"]})]})]})]})})]}),l.jsx("div",{className:"flex-1 min-h-0 px-3 sm:px-4 lg:px-6 pb-3 sm:pb-4 lg:pb-6",children:l.jsx(Tt,{className:"bg-black dark:bg-gray-950 border-gray-800 dark:border-gray-900 h-full",children:l.jsx(on,{viewportRef:T,className:"h-full",children:l.jsx("div",{className:ye("p-2 sm:p-3 font-mono relative",Qx[S].class),style:{height:`${H.getTotalSize()}px`},children:ee.length===0?l.jsx("div",{className:"text-gray-500 dark:text-gray-600 text-center py-8 text-sm",children:"暂无日志数据"}):H.getVirtualItems().map(P=>{const W=ee[P.index];return l.jsxs("div",{"data-index":P.index,ref:H.measureElement,className:ye("absolute top-0 left-0 w-full px-2 sm:px-3 rounded hover:bg-white/5 transition-colors group",M(W.level)),style:{transform:`translateY(${P.start}px)`,paddingTop:`${N/2}px`,paddingBottom:`${N/2}px`},children:[l.jsxs("div",{className:"flex flex-col gap-0.5 sm:hidden",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-gray-500 dark:text-gray-600",children:W.timestamp}),l.jsxs("span",{className:ye("font-semibold",E(W.level)),children:["[",W.level,"]"]})]}),l.jsx("div",{className:"text-cyan-400 dark:text-cyan-500 truncate",children:W.module}),l.jsx("div",{className:"text-gray-300 dark:text-gray-400 whitespace-pre-wrap break-words",children:W.message})]}),l.jsxs("div",{className:"hidden sm:flex gap-2 items-start",children:[l.jsx("span",{className:"text-gray-500 dark:text-gray-600 flex-shrink-0 w-[130px] lg:w-[160px]",children:W.timestamp}),l.jsxs("span",{className:ye("flex-shrink-0 w-[65px] lg:w-[75px] font-semibold",E(W.level)),children:["[",W.level,"]"]}),l.jsx("span",{className:"text-cyan-400 dark:text-cyan-500 flex-shrink-0 w-[100px] lg:w-[130px] truncate",children:W.module}),l.jsx("span",{className:"text-gray-300 dark:text-gray-400 flex-1 whitespace-pre-wrap break-words",children:W.message})]})]},P.key)})})})})})]})}const O8e="Mai-with-u",j8e="plugin-repo",N8e="main",C8e="plugin_details.json";async function T8e(){try{const t=await mt("/api/webui/plugins/fetch-raw",{method:"POST",headers:Nt(),body:JSON.stringify({owner:O8e,repo:j8e,branch:N8e,file_path:C8e})});if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);const e=await t.json();if(!e.success||!e.data)throw new Error(e.error||"获取插件列表失败");return JSON.parse(e.data).filter(s=>!s?.id||!s?.manifest?(console.warn("跳过无效插件数据:",s),!1):!s.manifest.name||!s.manifest.version?(console.warn("跳过缺少必需字段的插件:",s.id),!1):!0).map(s=>({id:s.id,manifest:{manifest_version:s.manifest.manifest_version||1,name:s.manifest.name,version:s.manifest.version,description:s.manifest.description||"",author:s.manifest.author||{name:"Unknown"},license:s.manifest.license||"Unknown",host_application:s.manifest.host_application||{min_version:"0.0.0"},homepage_url:s.manifest.homepage_url,repository_url:s.manifest.repository_url,keywords:s.manifest.keywords||[],categories:s.manifest.categories||[],default_locale:s.manifest.default_locale||"zh-CN",locales_path:s.manifest.locales_path},downloads:0,rating:0,review_count:0,installed:!1,published_at:new Date().toISOString(),updated_at:new Date().toISOString()}))}catch(t){throw console.error("Failed to fetch plugin list:",t),t}}async function E8e(){try{const t=await mt("/api/webui/plugins/git-status");if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);return await t.json()}catch(t){return console.error("Failed to check Git status:",t),{installed:!1,error:"无法检测 Git 安装状态"}}}async function _8e(){try{const t=await mt("/api/webui/plugins/version");if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);return await t.json()}catch(t){return console.error("Failed to get Maimai version:",t),{version:"0.0.0",version_major:0,version_minor:0,version_patch:0}}}function M8e(t,e,n){const r=t.split(".").map(o=>parseInt(o)||0),s=r[0]||0,i=r[1]||0,a=r[2]||0;if(n.version_majorparseInt(m)||0),c=o[0]||0,h=o[1]||0,f=o[2]||0;if(n.version_major>c||n.version_major===c&&n.version_minor>h||n.version_major===c&&n.version_minor===h&&n.version_patch>f)return!1}return!0}function A8e(t,e){const n=window.location.protocol==="https:"?"wss:":"ws:",r=window.location.host,s=new WebSocket(`${n}//${r}/api/webui/ws/plugin-progress`);return s.onopen=()=>{console.log("Plugin progress WebSocket connected");const i=setInterval(()=>{s.readyState===WebSocket.OPEN?s.send("ping"):clearInterval(i)},3e4)},s.onmessage=i=>{try{if(i.data==="pong")return;const a=JSON.parse(i.data);t(a)}catch(a){console.error("Failed to parse progress data:",a)}},s.onerror=i=>{console.error("Plugin progress WebSocket error:",i),e?.(i)},s.onclose=()=>{console.log("Plugin progress WebSocket disconnected")},s}async function Hx(){try{const t=await mt("/api/webui/plugins/installed",{headers:Nt()});if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);const e=await t.json();if(!e.success)throw new Error(e.message||"获取已安装插件列表失败");return e.plugins||[]}catch(t){return console.error("Failed to get installed plugins:",t),[]}}function Vx(t,e){return e.some(n=>n.id===t)}function Ux(t,e){const n=e.find(r=>r.id===t);if(n)return n.manifest?.version||n.version}async function R8e(t,e,n="main"){const r=await mt("/api/webui/plugins/install",{method:"POST",headers:Nt(),body:JSON.stringify({plugin_id:t,repository_url:e,branch:n})});if(!r.ok){const s=await r.json();throw new Error(s.detail||"安装失败")}return await r.json()}async function D8e(t){const e=await mt("/api/webui/plugins/uninstall",{method:"POST",headers:Nt(),body:JSON.stringify({plugin_id:t})});if(!e.ok){const n=await e.json();throw new Error(n.detail||"卸载失败")}return await e.json()}async function z8e(t,e,n="main"){const r=await mt("/api/webui/plugins/update",{method:"POST",headers:Nt(),body:JSON.stringify({plugin_id:t,repository_url:e,branch:n})});if(!r.ok){const s=await r.json();throw new Error(s.detail||"更新失败")}return await r.json()}const vp="https://maibot-plugin-stats.maibot-webui.workers.dev";async function uU(t){try{const e=await fetch(`${vp}/stats/${t}`);return e.ok?await e.json():(console.error("Failed to fetch plugin stats:",e.statusText),null)}catch(e){return console.error("Error fetching plugin stats:",e),null}}async function P8e(t,e){try{const n=e||Mj(),r=await fetch(`${vp}/stats/like`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:t,user_id:n})}),s=await r.json();return r.status===429?{success:!1,error:"操作过于频繁,请稍后再试"}:r.ok?{success:!0,...s}:{success:!1,error:s.error||"点赞失败"}}catch(n){return console.error("Error liking plugin:",n),{success:!1,error:"网络错误"}}}async function L8e(t,e){try{const n=e||Mj(),r=await fetch(`${vp}/stats/dislike`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:t,user_id:n})}),s=await r.json();return r.status===429?{success:!1,error:"操作过于频繁,请稍后再试"}:r.ok?{success:!0,...s}:{success:!1,error:s.error||"点踩失败"}}catch(n){return console.error("Error disliking plugin:",n),{success:!1,error:"网络错误"}}}async function I8e(t,e,n,r){if(e<1||e>5)return{success:!1,error:"评分必须在 1-5 之间"};try{const s=r||Mj(),i=await fetch(`${vp}/stats/rate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:t,rating:e,comment:n,user_id:s})}),a=await i.json();return i.status===429?{success:!1,error:"每天最多评分 3 次"}:i.ok?{success:!0,...a}:{success:!1,error:a.error||"评分失败"}}catch(s){return console.error("Error rating plugin:",s),{success:!1,error:"网络错误"}}}async function B8e(t){try{const e=await fetch(`${vp}/stats/download`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:t})}),n=await e.json();return e.status===429?(console.warn("Download recording rate limited"),{success:!0}):e.ok?{success:!0,...n}:(console.error("Failed to record download:",n.error),{success:!1,error:n.error})}catch(e){return console.error("Error recording download:",e),{success:!1,error:"网络错误"}}}function q8e(){const t=navigator,e=[navigator.userAgent,navigator.language,navigator.languages?.join(",")||"",navigator.platform,navigator.hardwareConcurrency||0,screen.width,screen.height,screen.colorDepth,screen.pixelDepth,new Date().getTimezoneOffset(),Intl.DateTimeFormat().resolvedOptions().timeZone,navigator.maxTouchPoints||0,t.deviceMemory||0].join("|");let n=0;for(let r=0;r{i(!0);const k=await uU(t);k&&r(k),i(!1)};b.useEffect(()=>{x()},[t]);const y=async()=>{const k=await P8e(t);k.success?(g({title:"已点赞",description:"感谢你的支持!"}),x()):g({title:"点赞失败",description:k.error||"未知错误",variant:"destructive"})},w=async()=>{const k=await L8e(t);k.success?(g({title:"已反馈",description:"感谢你的反馈!"}),x()):g({title:"操作失败",description:k.error||"未知错误",variant:"destructive"})},S=async()=>{if(a===0){g({title:"请选择评分",description:"至少选择 1 颗星",variant:"destructive"});return}const k=await I8e(t,a,c||void 0);k.success?(g({title:"评分成功",description:"感谢你的评价!"}),m(!1),o(0),h(""),x()):g({title:"评分失败",description:k.error||"未知错误",variant:"destructive"})};return s?l.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx(bu,{className:"h-4 w-4"}),l.jsx("span",{children:"-"})]}),l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx(sc,{className:"h-4 w-4"}),l.jsx("span",{children:"-"})]})]}):n?e?l.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[l.jsxs("div",{className:"flex items-center gap-1",title:`下载量: ${n.downloads.toLocaleString()}`,children:[l.jsx(bu,{className:"h-4 w-4"}),l.jsx("span",{children:n.downloads.toLocaleString()})]}),l.jsxs("div",{className:"flex items-center gap-1",title:`评分: ${n.rating.toFixed(1)} (${n.rating_count} 条评价)`,children:[l.jsx(sc,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),l.jsx("span",{children:n.rating.toFixed(1)})]}),l.jsxs("div",{className:"flex items-center gap-1",title:`点赞数: ${n.likes}`,children:[l.jsx(K2,{className:"h-4 w-4"}),l.jsx("span",{children:n.likes})]})]}):l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4",children:[l.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[l.jsx(bu,{className:"h-5 w-5 text-muted-foreground mb-1"}),l.jsx("span",{className:"text-2xl font-bold",children:n.downloads.toLocaleString()}),l.jsx("span",{className:"text-xs text-muted-foreground",children:"下载量"})]}),l.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[l.jsx(sc,{className:"h-5 w-5 text-yellow-400 mb-1 fill-yellow-400"}),l.jsx("span",{className:"text-2xl font-bold",children:n.rating.toFixed(1)}),l.jsxs("span",{className:"text-xs text-muted-foreground",children:[n.rating_count," 条评价"]})]}),l.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[l.jsx(K2,{className:"h-5 w-5 text-green-500 mb-1"}),l.jsx("span",{className:"text-2xl font-bold",children:n.likes}),l.jsx("span",{className:"text-xs text-muted-foreground",children:"点赞"})]}),l.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[l.jsx(BC,{className:"h-5 w-5 text-red-500 mb-1"}),l.jsx("span",{className:"text-2xl font-bold",children:n.dislikes}),l.jsx("span",{className:"text-xs text-muted-foreground",children:"点踩"})]})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsxs(fe,{variant:"outline",size:"sm",onClick:y,children:[l.jsx(K2,{className:"h-4 w-4 mr-1"}),"点赞"]}),l.jsxs(fe,{variant:"outline",size:"sm",onClick:w,children:[l.jsx(BC,{className:"h-4 w-4 mr-1"}),"点踩"]}),l.jsxs(fr,{open:f,onOpenChange:m,children:[l.jsx(Bh,{asChild:!0,children:l.jsxs(fe,{variant:"default",size:"sm",children:[l.jsx(sc,{className:"h-4 w-4 mr-1"}),"评分"]})}),l.jsxs(rr,{children:[l.jsxs(sr,{children:[l.jsx(ir,{children:"为插件评分"}),l.jsx(Ir,{children:"分享你的使用体验,帮助其他用户"})]}),l.jsxs("div",{className:"space-y-4 py-4",children:[l.jsxs("div",{className:"flex flex-col items-center gap-2",children:[l.jsx("div",{className:"flex gap-2",children:[1,2,3,4,5].map(k=>l.jsx("button",{onClick:()=>o(k),className:"focus:outline-none",children:l.jsx(sc,{className:`h-8 w-8 transition-colors ${k<=a?"fill-yellow-400 text-yellow-400":"text-muted-foreground hover:text-yellow-300"}`})},k))}),l.jsxs("span",{className:"text-sm text-muted-foreground",children:[a===0&&"点击星星进行评分",a===1&&"很差",a===2&&"一般",a===3&&"还行",a===4&&"不错",a===5&&"非常好"]})]}),l.jsxs("div",{children:[l.jsx("label",{className:"text-sm font-medium mb-2 block",children:"评论(可选)"}),l.jsx(dr,{value:c,onChange:k=>h(k.target.value),placeholder:"分享你的使用体验...",rows:4,maxLength:500}),l.jsxs("div",{className:"text-xs text-muted-foreground mt-1 text-right",children:[c.length," / 500"]})]})]}),l.jsxs(ts,{children:[l.jsx(fe,{variant:"outline",onClick:()=>m(!1),children:"取消"}),l.jsx(fe,{onClick:S,disabled:a===0,children:"提交评分"})]})]})]})]}),n.recent_ratings&&n.recent_ratings.length>0&&l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"text-sm font-semibold",children:"最近评价"}),l.jsx("div",{className:"space-y-3",children:n.recent_ratings.map((k,N)=>l.jsxs("div",{className:"p-3 rounded-lg border bg-muted/50",children:[l.jsxs("div",{className:"flex items-center justify-between mb-2",children:[l.jsx("div",{className:"flex gap-1",children:[1,2,3,4,5].map(C=>l.jsx(sc,{className:`h-3 w-3 ${C<=k.rating?"fill-yellow-400 text-yellow-400":"text-muted-foreground"}`},C))}),l.jsx("span",{className:"text-xs text-muted-foreground",children:new Date(k.created_at).toLocaleDateString()})]}),k.comment&&l.jsx("p",{className:"text-sm text-muted-foreground",children:k.comment})]},N))})]})]}):null}const pD={"Group Management":"群组管理","Entertainment & Interaction":"娱乐互动","Utility Tools":"实用工具","Content Generation":"内容生成",Multimedia:"多媒体","External Integration":"外部集成","Data Analysis & Insights":"数据分析与洞察",Other:"其他"};function $8e(){const t=Ma(),[e,n]=b.useState(null),[r,s]=b.useState(""),[i,a]=b.useState("all"),[o,c]=b.useState("all"),[h,f]=b.useState(!0),[m,g]=b.useState([]),[x,y]=b.useState(!0),[w,S]=b.useState(null),[k,N]=b.useState(null),[C,T]=b.useState(null),[_,E]=b.useState(null),[,M]=b.useState([]),[q,L]=b.useState({}),{toast:I}=Gr(),$=async R=>{const se=R.map(async U=>{try{const te=await uU(U.id);return{id:U.id,stats:te}}catch(te){return console.warn(`Failed to load stats for ${U.id}:`,te),{id:U.id,stats:null}}}),G=await Promise.all(se),F={};G.forEach(({id:U,stats:te})=>{te&&(F[U]=te)}),L(F)};b.useEffect(()=>{let R=null,se=!1;return(async()=>{if(R=A8e(F=>{se||(T(F),F.stage==="success"?setTimeout(()=>{se||T(null)},2e3):F.stage==="error"&&(y(!1),S(F.error||"加载失败")))},F=>{console.error("WebSocket error:",F),se||I({title:"WebSocket 连接失败",description:"无法实时显示加载进度",variant:"destructive"})}),await new Promise(F=>{if(!R){F();return}const U=()=>{R&&R.readyState===WebSocket.OPEN?(console.log("WebSocket connected, starting to load plugins"),F()):R&&R.readyState===WebSocket.CLOSED?(console.warn("WebSocket closed before loading plugins"),F()):setTimeout(U,100)};U()}),!se){const F=await E8e();N(F),F.installed||I({title:"Git 未安装",description:F.error||"请先安装 Git 才能使用插件安装功能",variant:"destructive"})}if(!se){const F=await _8e();E(F)}if(!se)try{y(!0),S(null);const F=await T8e();if(!se){const U=await Hx();M(U);const te=F.map(ne=>{const Y=Vx(ne.id,U),ae=Ux(ne.id,U);return{...ne,installed:Y,installed_version:ae}});for(const ne of U)!te.some(ae=>ae.id===ne.id)&&ne.manifest&&te.push({id:ne.id,manifest:{manifest_version:ne.manifest.manifest_version||1,name:ne.manifest.name,version:ne.manifest.version,description:ne.manifest.description||"",author:ne.manifest.author,license:ne.manifest.license||"Unknown",host_application:ne.manifest.host_application,homepage_url:ne.manifest.homepage_url,repository_url:ne.manifest.repository_url,keywords:ne.manifest.keywords||[],categories:ne.manifest.categories||[],default_locale:ne.manifest.default_locale||"zh-CN",locales_path:ne.manifest.locales_path},downloads:0,rating:0,review_count:0,installed:!0,installed_version:ne.manifest.version,published_at:new Date().toISOString(),updated_at:new Date().toISOString()});g(te),$(te)}}catch(F){if(!se){const U=F instanceof Error?F.message:"加载插件列表失败";S(U),I({title:"加载失败",description:U,variant:"destructive"})}}finally{se||y(!1)}})(),()=>{se=!0,R&&R.close()}},[I]);const V=R=>{if(!R.installed&&_&&!ee(R))return l.jsxs(In,{variant:"destructive",className:"gap-1",children:[l.jsx(ju,{className:"h-3 w-3"}),"不兼容"]});if(R.installed){const se=R.installed_version?.trim(),G=R.manifest.version?.trim();if(se!==G){const F=se?.split(".").map(Number)||[0,0,0],U=G?.split(".").map(Number)||[0,0,0];for(let te=0;te<3;te++){if((U[te]||0)>(F[te]||0))return l.jsxs(In,{variant:"outline",className:"gap-1 text-orange-600 border-orange-600",children:[l.jsx(ju,{className:"h-3 w-3"}),"可更新"]});if((U[te]||0)<(F[te]||0))break}}return l.jsxs(In,{variant:"default",className:"gap-1",children:[l.jsx(xc,{className:"h-3 w-3"}),"已安装"]})}return null},ee=R=>!_||!R.manifest?.host_application?!0:M8e(R.manifest.host_application.min_version,R.manifest.host_application.max_version,_),z=R=>{if(!R.installed||!R.installed_version||!R.manifest?.version)return!1;const se=R.installed_version.trim(),G=R.manifest.version.trim();if(se===G)return!1;const F=se.split(".").map(Number),U=G.split(".").map(Number);for(let te=0;te<3;te++){if((U[te]||0)>(F[te]||0))return!0;if((U[te]||0)<(F[te]||0))return!1}return!1},H=m.filter(R=>{if(!R.manifest)return console.warn("[过滤] 跳过无 manifest 的插件:",R.id),!1;const se=r===""||R.manifest.name?.toLowerCase().includes(r.toLowerCase())||R.manifest.description?.toLowerCase().includes(r.toLowerCase())||R.manifest.keywords&&R.manifest.keywords.some(te=>te.toLowerCase().includes(r.toLowerCase())),G=i==="all"||R.manifest.categories&&R.manifest.categories.includes(i);let F=!0;o==="installed"?F=R.installed===!0:o==="updates"&&(F=R.installed===!0&&z(R));const U=!h||!_||ee(R);return se&&G&&F&&U}),P=()=>{n(null)},W=async R=>{if(!k?.installed){I({title:"无法安装",description:"Git 未安装",variant:"destructive"});return}if(_&&!ee(R)){I({title:"无法安装",description:"插件与当前麦麦版本不兼容",variant:"destructive"});return}try{await R8e(R.id,R.manifest.repository_url||"","main"),B8e(R.id).catch(G=>{console.warn("Failed to record download:",G)}),I({title:"安装成功",description:`${R.manifest.name} 已成功安装`});const se=await Hx();M(se),g(G=>G.map(F=>{if(F.id===R.id){const U=Vx(F.id,se),te=Ux(F.id,se);return{...F,installed:U,installed_version:te}}return F}))}catch(se){I({title:"安装失败",description:se instanceof Error?se.message:"未知错误",variant:"destructive"})}},J=async R=>{try{await D8e(R.id),I({title:"卸载成功",description:`${R.manifest.name} 已成功卸载`});const se=await Hx();M(se),g(G=>G.map(F=>{if(F.id===R.id){const U=Vx(F.id,se),te=Ux(F.id,se);return{...F,installed:U,installed_version:te}}return F}))}catch(se){I({title:"卸载失败",description:se instanceof Error?se.message:"未知错误",variant:"destructive"})}},X=async R=>{if(!k?.installed){I({title:"无法更新",description:"Git 未安装",variant:"destructive"});return}try{const se=await z8e(R.id,R.manifest.repository_url||"","main");I({title:"更新成功",description:`${R.manifest.name} 已从 ${se.old_version} 更新到 ${se.new_version}`});const G=await Hx();M(G),g(F=>F.map(U=>{if(U.id===R.id){const te=Vx(U.id,G),ne=Ux(U.id,G);return{...U,installed:te,installed_version:ne}}return U}))}catch(se){I({title:"更新失败",description:se instanceof Error?se.message:"未知错误",variant:"destructive"})}};return l.jsx(on,{className:"h-full",children:l.jsxs("div",{className:"space-y-6 p-4 sm:p-6",children:[l.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[l.jsxs("div",{children:[l.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"插件市场"}),l.jsx("p",{className:"text-muted-foreground mt-2",children:"浏览和管理麦麦的插件"})]}),l.jsxs(fe,{onClick:()=>t({to:"/plugin-mirrors"}),children:[l.jsx(WK,{className:"h-4 w-4 mr-2"}),"配置镜像源"]})]}),k&&!k.installed&&l.jsxs(Tt,{className:"border-orange-600 bg-orange-50 dark:bg-orange-950/20",children:[l.jsx(vn,{children:l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx(ja,{className:"h-5 w-5 text-orange-600"}),l.jsxs("div",{children:[l.jsx(yn,{className:"text-lg text-orange-900 dark:text-orange-100",children:"Git 未安装"}),l.jsx(zr,{className:"text-orange-800 dark:text-orange-200",children:k.error||"请先安装 Git 才能使用插件安装功能"})]})]})}),l.jsx(En,{children:l.jsxs("p",{className:"text-sm text-orange-800 dark:text-orange-200",children:["您可以从 ",l.jsx("a",{href:"https://git-scm.com/downloads",target:"_blank",rel:"noopener noreferrer",className:"underline font-medium",children:"git-scm.com"})," 下载并安装 Git。 安装完成后,请重启麦麦应用。"]})})]}),l.jsx(Tt,{className:"p-4",children:l.jsxs("div",{className:"flex flex-col gap-4",children:[l.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[l.jsxs("div",{className:"flex-1 relative",children:[l.jsx(li,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),l.jsx(Pe,{placeholder:"搜索插件...",value:r,onChange:R=>s(R.target.value),className:"pl-9"})]}),l.jsxs(zt,{value:i,onValueChange:a,children:[l.jsx(At,{className:"w-full sm:w-[200px]",children:l.jsx(Pt,{placeholder:"选择分类"})}),l.jsxs(Rt,{children:[l.jsx(ze,{value:"all",children:"全部分类"}),l.jsx(ze,{value:"Group Management",children:"群组管理"}),l.jsx(ze,{value:"Entertainment & Interaction",children:"娱乐互动"}),l.jsx(ze,{value:"Utility Tools",children:"实用工具"}),l.jsx(ze,{value:"Content Generation",children:"内容生成"}),l.jsx(ze,{value:"Multimedia",children:"多媒体"}),l.jsx(ze,{value:"External Integration",children:"外部集成"}),l.jsx(ze,{value:"Data Analysis & Insights",children:"数据分析与洞察"}),l.jsx(ze,{value:"Other",children:"其他"})]})]})]}),l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(ii,{id:"compatible-only",checked:h,onCheckedChange:R=>f(R===!0)}),l.jsx("label",{htmlFor:"compatible-only",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer",children:"只显示兼容当前版本的插件"})]})]})}),l.jsx(na,{value:o,onValueChange:c,className:"w-full",children:l.jsxs(_i,{className:"grid w-full grid-cols-3",children:[l.jsxs(Et,{value:"all",children:["全部插件 (",m.filter(R=>{if(!R.manifest)return!1;const se=r===""||R.manifest.name?.toLowerCase().includes(r.toLowerCase())||R.manifest.description?.toLowerCase().includes(r.toLowerCase())||R.manifest.keywords&&R.manifest.keywords.some(U=>U.toLowerCase().includes(r.toLowerCase())),G=i==="all"||R.manifest.categories&&R.manifest.categories.includes(i),F=!h||!_||ee(R);return se&&G&&F}).length,")"]}),l.jsxs(Et,{value:"installed",children:["已安装 (",m.filter(R=>{if(!R.manifest)return!1;const se=r===""||R.manifest.name?.toLowerCase().includes(r.toLowerCase())||R.manifest.description?.toLowerCase().includes(r.toLowerCase())||R.manifest.keywords&&R.manifest.keywords.some(U=>U.toLowerCase().includes(r.toLowerCase())),G=i==="all"||R.manifest.categories&&R.manifest.categories.includes(i),F=!h||!_||ee(R);return R.installed&&se&&G&&F}).length,")"]}),l.jsxs(Et,{value:"updates",children:["可更新 (",m.filter(R=>{if(!R.manifest)return!1;const se=r===""||R.manifest.name?.toLowerCase().includes(r.toLowerCase())||R.manifest.description?.toLowerCase().includes(r.toLowerCase())||R.manifest.keywords&&R.manifest.keywords.some(U=>U.toLowerCase().includes(r.toLowerCase())),G=i==="all"||R.manifest.categories&&R.manifest.categories.includes(i),F=!h||!_||ee(R);return R.installed&&z(R)&&se&&G&&F}).length,")"]})]})}),C&&C.stage==="loading"&&l.jsx(Tt,{className:"p-4",children:l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(hh,{className:"h-4 w-4 animate-spin"}),l.jsxs("span",{className:"text-sm font-medium",children:[C.operation==="fetch"&&"加载插件列表",C.operation==="install"&&`安装插件${C.plugin_id?`: ${C.plugin_id}`:""}`,C.operation==="uninstall"&&`卸载插件${C.plugin_id?`: ${C.plugin_id}`:""}`,C.operation==="update"&&`更新插件${C.plugin_id?`: ${C.plugin_id}`:""}`]})]}),l.jsxs("span",{className:"text-sm font-medium",children:[C.progress,"%"]})]}),l.jsx(F0,{value:C.progress,className:"h-2"}),l.jsx("div",{className:"text-xs text-muted-foreground",children:C.message}),C.operation==="fetch"&&C.total_plugins>0&&l.jsxs("div",{className:"text-xs text-muted-foreground text-center",children:["已加载 ",C.loaded_plugins," / ",C.total_plugins," 个插件"]})]})}),C&&C.stage==="error"&&C.error&&l.jsx(Tt,{className:"border-destructive bg-destructive/10",children:l.jsx(vn,{children:l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx(ja,{className:"h-5 w-5 text-destructive"}),l.jsxs("div",{children:[l.jsx(yn,{className:"text-lg text-destructive",children:"加载失败"}),l.jsx(zr,{className:"text-destructive/80",children:C.error})]})]})})}),x?l.jsxs("div",{className:"flex items-center justify-center py-12",children:[l.jsx(hh,{className:"h-8 w-8 animate-spin text-muted-foreground"}),l.jsx("span",{className:"ml-3 text-muted-foreground",children:"加载插件列表中..."})]}):w?l.jsx(Tt,{className:"p-6",children:l.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[l.jsx(ja,{className:"h-12 w-12 text-destructive mb-4"}),l.jsx("h3",{className:"text-lg font-semibold mb-2",children:"加载失败"}),l.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:w}),l.jsx(fe,{onClick:()=>window.location.reload(),children:"重新加载"})]})}):H.length===0?l.jsx(Tt,{className:"p-6",children:l.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[l.jsx(li,{className:"h-12 w-12 text-muted-foreground mb-4"}),l.jsx("h3",{className:"text-lg font-semibold mb-2",children:"未找到插件"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:r||i!=="all"?"尝试调整搜索条件或筛选器":"暂无可用插件"})]})}):l.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:H.map(R=>l.jsxs(Tt,{className:"flex flex-col hover:shadow-lg transition-shadow h-full",children:[l.jsxs(vn,{children:[l.jsxs("div",{className:"flex items-start justify-between gap-2",children:[l.jsx(yn,{className:"text-xl",children:R.manifest?.name||R.id}),l.jsxs("div",{className:"flex flex-col gap-1",children:[R.manifest?.categories&&R.manifest.categories[0]&&l.jsx(In,{variant:"secondary",className:"text-xs whitespace-nowrap",children:pD[R.manifest.categories[0]]||R.manifest.categories[0]}),V(R)]})]}),l.jsx(zr,{className:"line-clamp-2",children:R.manifest?.description||"无描述"})]}),l.jsx(En,{className:"flex-1",children:l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx(bu,{className:"h-4 w-4"}),l.jsx("span",{children:(q[R.id]?.downloads??R.downloads??0).toLocaleString()})]}),l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx(sc,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),l.jsx("span",{children:(q[R.id]?.rating??R.rating??0).toFixed(1)})]})]}),l.jsxs("div",{className:"flex flex-wrap gap-2",children:[R.manifest?.keywords&&R.manifest.keywords.slice(0,3).map(se=>l.jsx(In,{variant:"outline",className:"text-xs",children:se},se)),R.manifest?.keywords&&R.manifest.keywords.length>3&&l.jsxs(In,{variant:"outline",className:"text-xs",children:["+",R.manifest.keywords.length-3]})]}),l.jsxs("div",{className:"text-xs text-muted-foreground pt-2 border-t space-y-1",children:[l.jsxs("div",{children:["v",R.manifest?.version||"unknown"," · ",R.manifest?.author?.name||"Unknown"]}),R.manifest?.host_application&&l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx("span",{children:"支持:"}),l.jsxs("span",{className:"font-medium",children:[R.manifest.host_application.min_version,R.manifest.host_application.max_version?` - ${R.manifest.host_application.max_version}`:" - 最新版本"]})]})]})]})}),l.jsx(Uz,{className:"pt-4",children:l.jsxs("div",{className:"flex items-center justify-end gap-2 w-full",children:[l.jsx(fe,{variant:"outline",size:"sm",onClick:()=>n(R),children:"查看详情"}),R.installed?z(R)?l.jsxs(fe,{size:"sm",disabled:!k?.installed,title:k?.installed?void 0:"Git 未安装",onClick:()=>X(R),children:[l.jsx(ti,{className:"h-4 w-4 mr-1"}),"更新"]}):l.jsxs(fe,{variant:"destructive",size:"sm",disabled:!k?.installed,title:k?.installed?void 0:"Git 未安装",onClick:()=>J(R),children:[l.jsx(ln,{className:"h-4 w-4 mr-1"}),"卸载"]}):l.jsxs(fe,{size:"sm",disabled:!k?.installed||C?.operation==="install"||_!==null&&!ee(R),title:k?.installed?_!==null&&!ee(R)?`不兼容当前版本 (需要 ${R.manifest?.host_application?.min_version||"未知"}${R.manifest?.host_application?.max_version?` - ${R.manifest.host_application.max_version}`:"+"},当前 ${_?.version})`:void 0:"Git 未安装",onClick:()=>W(R),children:[l.jsx(bu,{className:"h-4 w-4 mr-1"}),C?.operation==="install"&&C?.plugin_id===R.id?"安装中...":"安装"]})]})})]},R.id))}),l.jsx(fr,{open:e!==null,onOpenChange:P,children:e&&e.manifest&&l.jsxs(rr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[l.jsx(sr,{children:l.jsxs("div",{className:"flex items-start justify-between gap-4",children:[l.jsxs("div",{className:"space-y-2 flex-1",children:[l.jsx(ir,{className:"text-2xl",children:e.manifest.name}),l.jsxs(Ir,{children:["作者: ",e.manifest.author?.name||"Unknown",e.manifest.author?.url&&l.jsx("a",{href:e.manifest.author.url,target:"_blank",rel:"noopener noreferrer",className:"ml-2 text-primary hover:underline",children:l.jsx(Kd,{className:"h-3 w-3 inline"})})]})]}),l.jsxs("div",{className:"flex flex-col gap-2",children:[e.manifest.categories&&e.manifest.categories[0]&&l.jsx(In,{variant:"secondary",children:pD[e.manifest.categories[0]]||e.manifest.categories[0]}),V(e)]})]})}),l.jsxs("div",{className:"space-y-6",children:[l.jsx(F8e,{pluginId:e.id}),l.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-4",children:[l.jsxs("div",{children:[l.jsx("p",{className:"text-sm font-medium",children:"版本"}),l.jsxs("p",{className:"text-sm text-muted-foreground",children:["v",e.manifest?.version||"unknown"]}),e.installed&&e.installed_version&&l.jsxs("p",{className:"text-xs text-muted-foreground",children:["已安装: v",e.installed_version]})]}),l.jsxs("div",{children:[l.jsx("p",{className:"text-sm font-medium",children:"下载量"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:(q[e.id]?.downloads??e.downloads??0).toLocaleString()})]}),l.jsxs("div",{children:[l.jsx("p",{className:"text-sm font-medium",children:"评分"}),l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx(sc,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),l.jsxs("span",{className:"text-sm text-muted-foreground",children:[(q[e.id]?.rating??e.rating??0).toFixed(1)," (",q[e.id]?.rating_count??e.review_count??0,")"]})]})]}),l.jsxs("div",{children:[l.jsx("p",{className:"text-sm font-medium",children:"许可证"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:e.manifest.license||"Unknown"})]}),l.jsxs("div",{className:"col-span-2",children:[l.jsx("p",{className:"text-sm font-medium",children:"支持版本"}),l.jsxs("p",{className:"text-sm text-muted-foreground",children:[e.manifest.host_application?.min_version||"未知",e.manifest.host_application?.max_version?` - ${e.manifest.host_application.max_version}`:" - 最新版本"]})]})]}),l.jsxs("div",{children:[l.jsx("p",{className:"text-sm font-medium mb-2",children:"关键词"}),l.jsx("div",{className:"flex flex-wrap gap-2",children:e.manifest.keywords&&e.manifest.keywords.map(R=>l.jsx(In,{variant:"outline",children:R},R))})]}),e.detailed_description&&l.jsxs("div",{children:[l.jsx("p",{className:"text-sm font-medium mb-2",children:"详细说明"}),l.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-line",children:e.detailed_description})]}),!e.detailed_description&&l.jsxs("div",{children:[l.jsx("p",{className:"text-sm font-medium mb-2",children:"说明"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:e.manifest.description||"无描述"})]}),l.jsxs("div",{className:"space-y-2",children:[e.manifest.homepage_url&&l.jsxs("div",{className:"text-sm",children:[l.jsx("span",{className:"font-medium",children:"主页: "}),l.jsx("a",{href:e.manifest.homepage_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:e.manifest.homepage_url})]}),e.manifest.repository_url&&l.jsxs("div",{className:"text-sm",children:[l.jsx("span",{className:"font-medium",children:"仓库: "}),l.jsx("a",{href:e.manifest.repository_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:e.manifest.repository_url})]})]})]}),l.jsxs(ts,{children:[e.manifest.homepage_url&&l.jsxs(fe,{onClick:()=>window.open(e.manifest.homepage_url,"_blank"),children:[l.jsx(Kd,{className:"h-4 w-4 mr-2"}),"访问主页"]}),e.manifest.repository_url&&l.jsxs(fe,{variant:"outline",onClick:()=>window.open(e.manifest.repository_url,"_blank"),children:[l.jsx(Kd,{className:"h-4 w-4 mr-2"}),"查看仓库"]})]})]})})]})})}function Q8e(){return l.jsx(on,{className:"h-full",children:l.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[l.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[l.jsxs("div",{children:[l.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"插件配置"}),l.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理和配置已安装的插件"})]}),l.jsxs("div",{className:"flex gap-2",children:[l.jsxs(fe,{variant:"outline",size:"sm",children:[l.jsx(ti,{className:"h-4 w-4 mr-2"}),"刷新"]}),l.jsxs(fe,{size:"sm",children:[l.jsx(yu,{className:"h-4 w-4 mr-2"}),"全局设置"]})]})]}),l.jsxs("div",{className:"grid gap-4 grid-cols-1 xs:grid-cols-2 lg:grid-cols-4",children:[l.jsxs(Tt,{children:[l.jsxs(vn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[l.jsx(yn,{className:"text-sm font-medium",children:"已安装插件"}),l.jsx(mh,{className:"h-4 w-4 text-muted-foreground"})]}),l.jsxs(En,{children:[l.jsx("div",{className:"text-2xl font-bold",children:"0"}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"正在加载..."})]})]}),l.jsxs(Tt,{children:[l.jsxs(vn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[l.jsx(yn,{className:"text-sm font-medium",children:"已启用"}),l.jsx(xc,{className:"h-4 w-4 text-green-600"})]}),l.jsxs(En,{children:[l.jsx("div",{className:"text-2xl font-bold",children:"0"}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"运行中的插件"})]})]}),l.jsxs(Tt,{children:[l.jsxs(vn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[l.jsx(yn,{className:"text-sm font-medium",children:"已禁用"}),l.jsx(ju,{className:"h-4 w-4 text-orange-600"})]}),l.jsxs(En,{children:[l.jsx("div",{className:"text-2xl font-bold",children:"0"}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"未激活的插件"})]})]}),l.jsxs(Tt,{children:[l.jsxs(vn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[l.jsx(yn,{className:"text-sm font-medium",children:"可更新"}),l.jsx(ti,{className:"h-4 w-4 text-blue-600"})]}),l.jsxs(En,{children:[l.jsx("div",{className:"text-2xl font-bold",children:"0"}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"有新版本可用"})]})]})]}),l.jsxs(Tt,{children:[l.jsxs(vn,{children:[l.jsx(yn,{children:"已安装的插件"}),l.jsx(zr,{children:"查看和管理已安装插件的配置"})]}),l.jsx(En,{children:l.jsxs("div",{className:"flex flex-col items-center justify-center py-12 space-y-4",children:[l.jsx(mh,{className:"h-16 w-16 text-muted-foreground/50"}),l.jsxs("div",{className:"text-center space-y-2",children:[l.jsx("p",{className:"text-lg font-medium text-muted-foreground",children:"插件配置功能开发中"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"即将支持插件的启用/禁用、参数配置等功能"})]}),l.jsx("div",{className:"flex gap-2",children:l.jsx(fe,{variant:"outline",asChild:!0,children:l.jsxs("a",{href:"/plugins",children:[l.jsx(Kd,{className:"h-4 w-4 mr-2"}),"前往插件市场"]})})})]})})]}),l.jsx(Tt,{className:"border-blue-200 bg-blue-50 dark:bg-blue-950/20 dark:border-blue-900",children:l.jsx(En,{className:"pt-6",children:l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx(ju,{className:"h-5 w-5 text-blue-600 mt-0.5 flex-shrink-0"}),l.jsxs("div",{className:"space-y-1",children:[l.jsx("p",{className:"text-sm font-medium text-blue-900 dark:text-blue-100",children:"开发进行中"}),l.jsxs("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:["插件配置功能正在积极开发中。目前您可以通过",l.jsx("strong",{children:"插件市场"}),"安装和卸载插件,完整的配置管理功能即将推出。"]})]})]})})})]})})}function H8e(){const t=Ma(),{toast:e}=Gr(),[n,r]=b.useState([]),[s,i]=b.useState(!0),[a,o]=b.useState(null),[c,h]=b.useState(null),[f,m]=b.useState(!1),[g,x]=b.useState(!1),[y,w]=b.useState({id:"",name:"",raw_prefix:"",clone_prefix:"",enabled:!0,priority:1}),S=b.useCallback(async()=>{try{i(!0),o(null);const M=localStorage.getItem("access-token"),q=await fetch("/api/webui/plugins/mirrors",{headers:{Authorization:`Bearer ${M}`}});if(!q.ok)throw new Error("获取镜像源列表失败");const L=await q.json();r(L.mirrors||[])}catch(M){const q=M instanceof Error?M.message:"加载镜像源失败";o(q),e({title:"加载失败",description:q,variant:"destructive"})}finally{i(!1)}},[e]);b.useEffect(()=>{S()},[S]);const k=async()=>{try{const M=localStorage.getItem("access-token"),q=await fetch("/api/webui/plugins/mirrors",{method:"POST",headers:{Authorization:`Bearer ${M}`,"Content-Type":"application/json"},body:JSON.stringify(y)});if(!q.ok){const L=await q.json();throw new Error(L.detail||"添加镜像源失败")}e({title:"添加成功",description:"镜像源已添加"}),m(!1),w({id:"",name:"",raw_prefix:"",clone_prefix:"",enabled:!0,priority:1}),S()}catch(M){e({title:"添加失败",description:M instanceof Error?M.message:"未知错误",variant:"destructive"})}},N=async()=>{if(c)try{const M=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${c.id}`,{method:"PUT",headers:{Authorization:`Bearer ${M}`,"Content-Type":"application/json"},body:JSON.stringify({name:y.name,raw_prefix:y.raw_prefix,clone_prefix:y.clone_prefix,enabled:y.enabled,priority:y.priority})})).ok)throw new Error("更新镜像源失败");e({title:"更新成功",description:"镜像源已更新"}),x(!1),h(null),S()}catch(M){e({title:"更新失败",description:M instanceof Error?M.message:"未知错误",variant:"destructive"})}},C=async M=>{if(confirm("确定要删除这个镜像源吗?"))try{const q=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${M}`,{method:"DELETE",headers:{Authorization:`Bearer ${q}`}})).ok)throw new Error("删除镜像源失败");e({title:"删除成功",description:"镜像源已删除"}),S()}catch(q){e({title:"删除失败",description:q instanceof Error?q.message:"未知错误",variant:"destructive"})}},T=async M=>{try{const q=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${M.id}`,{method:"PUT",headers:{Authorization:`Bearer ${q}`,"Content-Type":"application/json"},body:JSON.stringify({enabled:!M.enabled})})).ok)throw new Error("更新状态失败");S()}catch(q){e({title:"更新失败",description:q instanceof Error?q.message:"未知错误",variant:"destructive"})}},_=M=>{h(M),w({id:M.id,name:M.name,raw_prefix:M.raw_prefix,clone_prefix:M.clone_prefix,enabled:M.enabled,priority:M.priority}),x(!0)},E=async(M,q)=>{const L=q==="up"?M.priority-1:M.priority+1;if(!(L<1))try{const I=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${M.id}`,{method:"PUT",headers:{Authorization:`Bearer ${I}`,"Content-Type":"application/json"},body:JSON.stringify({priority:L})})).ok)throw new Error("更新优先级失败");S()}catch(I){e({title:"更新失败",description:I instanceof Error?I.message:"未知错误",variant:"destructive"})}};return l.jsx(on,{className:"h-full",children:l.jsxs("div",{className:"space-y-6 p-4 sm:p-6",children:[l.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[l.jsxs("div",{className:"flex items-center gap-4",children:[l.jsx(fe,{variant:"ghost",size:"icon",onClick:()=>t({to:"/plugins"}),children:l.jsx(sz,{className:"h-5 w-5"})}),l.jsxs("div",{children:[l.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"镜像源配置"}),l.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"管理 Git 克隆和文件下载的镜像源"})]})]}),l.jsxs(fe,{onClick:()=>m(!0),children:[l.jsx(gs,{className:"h-4 w-4 mr-2"}),"添加镜像源"]})]}),s?l.jsx(Tt,{className:"p-6",children:l.jsx("div",{className:"flex items-center justify-center py-8",children:l.jsx(hh,{className:"h-8 w-8 animate-spin text-primary"})})}):a?l.jsx(Tt,{className:"p-6",children:l.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[l.jsx(ja,{className:"h-12 w-12 text-destructive mb-4"}),l.jsx("h3",{className:"text-lg font-semibold mb-2",children:"加载失败"}),l.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:a}),l.jsx(fe,{onClick:S,children:"重新加载"})]})}):l.jsxs(Tt,{children:[l.jsx("div",{className:"hidden md:block",children:l.jsxs(Vh,{children:[l.jsx(Uh,{children:l.jsxs(ps,{children:[l.jsx(tn,{children:"状态"}),l.jsx(tn,{children:"名称"}),l.jsx(tn,{children:"ID"}),l.jsx(tn,{children:"优先级"}),l.jsx(tn,{className:"text-right",children:"操作"})]})}),l.jsx(Wh,{children:n.map(M=>l.jsxs(ps,{children:[l.jsx(It,{children:l.jsx(_t,{checked:M.enabled,onCheckedChange:()=>T(M)})}),l.jsx(It,{children:l.jsxs("div",{children:[l.jsx("div",{className:"font-medium",children:M.name}),l.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:["Raw: ",M.raw_prefix]})]})}),l.jsx(It,{children:l.jsx(In,{variant:"outline",children:M.id})}),l.jsx(It,{children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"font-mono",children:M.priority}),l.jsxs("div",{className:"flex flex-col gap-1",children:[l.jsx(fe,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>E(M,"up"),disabled:M.priority===1,children:l.jsx(Fm,{className:"h-3 w-3"})}),l.jsx(fe,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>E(M,"down"),children:l.jsx(Nu,{className:"h-3 w-3"})})]})]})}),l.jsx(It,{className:"text-right",children:l.jsxs("div",{className:"flex items-center justify-end gap-2",children:[l.jsx(fe,{variant:"ghost",size:"icon",onClick:()=>_(M),children:l.jsx(fh,{className:"h-4 w-4"})}),l.jsx(fe,{variant:"ghost",size:"icon",onClick:()=>C(M.id),children:l.jsx(ln,{className:"h-4 w-4 text-destructive"})})]})})]},M.id))})]})}),l.jsx("div",{className:"md:hidden p-4 space-y-4",children:n.map(M=>l.jsx(Tt,{className:"p-4",children:l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{className:"flex items-start justify-between",children:[l.jsxs("div",{className:"flex-1",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("h3",{className:"font-semibold",children:M.name}),M.enabled&&l.jsx(In,{variant:"default",className:"text-xs",children:"启用"})]}),l.jsx(In,{variant:"outline",className:"mt-1 text-xs",children:M.id})]}),l.jsx(_t,{checked:M.enabled,onCheckedChange:()=>T(M)})]}),l.jsxs("div",{className:"text-sm space-y-1",children:[l.jsxs("div",{className:"text-muted-foreground",children:[l.jsx("span",{className:"font-medium",children:"Raw: "}),l.jsx("span",{className:"break-all",children:M.raw_prefix})]}),l.jsxs("div",{className:"text-muted-foreground",children:[l.jsx("span",{className:"font-medium",children:"优先级: "}),l.jsx("span",{className:"font-mono",children:M.priority})]})]}),l.jsxs("div",{className:"flex items-center gap-2 pt-2 border-t",children:[l.jsxs(fe,{variant:"outline",size:"sm",className:"flex-1",onClick:()=>_(M),children:[l.jsx(fh,{className:"h-4 w-4 mr-1"}),"编辑"]}),l.jsx(fe,{variant:"outline",size:"sm",onClick:()=>E(M,"up"),disabled:M.priority===1,children:l.jsx(Fm,{className:"h-4 w-4"})}),l.jsx(fe,{variant:"outline",size:"sm",onClick:()=>E(M,"down"),children:l.jsx(Nu,{className:"h-4 w-4"})}),l.jsx(fe,{variant:"destructive",size:"sm",onClick:()=>C(M.id),children:l.jsx(ln,{className:"h-4 w-4"})})]})]})},M.id))})]}),l.jsx(fr,{open:f,onOpenChange:m,children:l.jsxs(rr,{className:"max-w-lg",children:[l.jsxs(sr,{children:[l.jsx(ir,{children:"添加镜像源"}),l.jsx(Ir,{children:"添加新的 Git 镜像源配置"})]}),l.jsxs("div",{className:"space-y-4 py-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(de,{htmlFor:"add-id",children:"镜像源 ID *"}),l.jsx(Pe,{id:"add-id",placeholder:"例如: my-mirror",value:y.id,onChange:M=>w({...y,id:M.target.value})})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(de,{htmlFor:"add-name",children:"名称 *"}),l.jsx(Pe,{id:"add-name",placeholder:"例如: 我的镜像源",value:y.name,onChange:M=>w({...y,name:M.target.value})})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(de,{htmlFor:"add-raw",children:"Raw 文件前缀 *"}),l.jsx(Pe,{id:"add-raw",placeholder:"https://example.com/raw",value:y.raw_prefix,onChange:M=>w({...y,raw_prefix:M.target.value})})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(de,{htmlFor:"add-clone",children:"克隆前缀 *"}),l.jsx(Pe,{id:"add-clone",placeholder:"https://example.com/clone",value:y.clone_prefix,onChange:M=>w({...y,clone_prefix:M.target.value})})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(de,{htmlFor:"add-priority",children:"优先级"}),l.jsx(Pe,{id:"add-priority",type:"number",min:"1",value:y.priority,onChange:M=>w({...y,priority:parseInt(M.target.value)||1})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"数字越小优先级越高"})]}),l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(_t,{id:"add-enabled",checked:y.enabled,onCheckedChange:M=>w({...y,enabled:M})}),l.jsx(de,{htmlFor:"add-enabled",children:"启用此镜像源"})]})]}),l.jsxs(ts,{children:[l.jsx(fe,{variant:"outline",onClick:()=>m(!1),children:"取消"}),l.jsx(fe,{onClick:k,children:"添加"})]})]})}),l.jsx(fr,{open:g,onOpenChange:x,children:l.jsxs(rr,{className:"max-w-lg",children:[l.jsxs(sr,{children:[l.jsx(ir,{children:"编辑镜像源"}),l.jsx(Ir,{children:"修改镜像源配置"})]}),l.jsxs("div",{className:"space-y-4 py-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(de,{children:"镜像源 ID"}),l.jsx(Pe,{value:y.id,disabled:!0})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(de,{htmlFor:"edit-name",children:"名称 *"}),l.jsx(Pe,{id:"edit-name",value:y.name,onChange:M=>w({...y,name:M.target.value})})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(de,{htmlFor:"edit-raw",children:"Raw 文件前缀 *"}),l.jsx(Pe,{id:"edit-raw",value:y.raw_prefix,onChange:M=>w({...y,raw_prefix:M.target.value})})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(de,{htmlFor:"edit-clone",children:"克隆前缀 *"}),l.jsx(Pe,{id:"edit-clone",value:y.clone_prefix,onChange:M=>w({...y,clone_prefix:M.target.value})})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(de,{htmlFor:"edit-priority",children:"优先级"}),l.jsx(Pe,{id:"edit-priority",type:"number",min:"1",value:y.priority,onChange:M=>w({...y,priority:parseInt(M.target.value)||1})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"数字越小优先级越高"})]}),l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(_t,{id:"edit-enabled",checked:y.enabled,onCheckedChange:M=>w({...y,enabled:M})}),l.jsx(de,{htmlFor:"edit-enabled",children:"启用此镜像源"})]})]}),l.jsxs(ts,{children:[l.jsx(fe,{variant:"outline",onClick:()=>x(!1),children:"取消"}),l.jsx(fe,{onClick:N,children:"保存"})]})]})})]})})}const V8e=Ih("pointer-events-none inline-flex select-none items-center gap-1 rounded border bg-muted px-1.5 font-mono font-medium opacity-100",{variants:{size:{sm:"h-5 text-[10px]",default:"h-6 text-xs",lg:"h-7 text-sm"}},defaultVariants:{size:"default"}}),dU=b.forwardRef(({className:t,size:e,abbrTitle:n,children:r,...s},i)=>l.jsx("kbd",{className:ye(V8e({size:e,className:t})),ref:i,...s,children:n?l.jsx("abbr",{title:n,children:r}):r}));dU.displayName="Kbd";const U8e=[{icon:qm,title:"首页",description:"查看仪表板概览",path:"/",category:"概览"},{icon:io,title:"麦麦主程序配置",description:"配置麦麦的核心设置",path:"/config/bot",category:"配置"},{icon:lz,title:"麦麦模型提供商配置",description:"配置模型提供商",path:"/config/modelProvider",category:"配置"},{icon:oz,title:"麦麦模型配置",description:"配置模型参数",path:"/config/model",category:"配置"},{icon:Jk,title:"表情包管理",description:"管理麦麦的表情包",path:"/resource/emoji",category:"资源"},{icon:A0,title:"表达方式管理",description:"管理麦麦的表达方式",path:"/resource/expression",category:"资源"},{icon:cz,title:"人物信息管理",description:"管理人物信息",path:"/resource/person",category:"资源"},{icon:GK,title:"统计信息",description:"查看使用统计",path:"/statistics",category:"监控"},{icon:mh,title:"插件市场",description:"浏览和安装插件",path:"/plugins",category:"扩展"},{icon:j1,title:"日志查看器",description:"查看系统日志",path:"/logs",category:"监控"},{icon:yu,title:"系统设置",description:"配置系统参数",path:"/settings",category:"系统"}];function W8e({open:t,onOpenChange:e}){const[n,r]=b.useState(""),[s,i]=b.useState(0),a=Ma(),o=U8e.filter(f=>f.title.toLowerCase().includes(n.toLowerCase())||f.description.toLowerCase().includes(n.toLowerCase())||f.category.toLowerCase().includes(n.toLowerCase()));b.useEffect(()=>{t&&(r(""),i(0))},[t]);const c=b.useCallback(f=>{a({to:f}),e(!1)},[a,e]),h=b.useCallback(f=>{f.key==="ArrowDown"?(f.preventDefault(),i(m=>(m+1)%o.length)):f.key==="ArrowUp"?(f.preventDefault(),i(m=>(m-1+o.length)%o.length)):f.key==="Enter"&&o[s]&&(f.preventDefault(),c(o[s].path))},[o,s,c]);return l.jsx(fr,{open:t,onOpenChange:e,children:l.jsxs(rr,{className:"max-w-2xl p-0 gap-0",children:[l.jsxs(sr,{className:"px-4 pt-4 pb-0",children:[l.jsx(ir,{className:"sr-only",children:"搜索"}),l.jsxs("div",{className:"relative",children:[l.jsx(li,{className:"absolute left-3 top-1/2 h-5 w-5 -translate-y-1/2 text-muted-foreground"}),l.jsx(Pe,{value:n,onChange:f=>{r(f.target.value),i(0)},onKeyDown:h,placeholder:"搜索页面...",className:"h-12 pl-11 text-base border-0 focus-visible:ring-0 shadow-none",autoFocus:!0})]})]}),l.jsx("div",{className:"border-t",children:l.jsx(on,{className:"h-[400px]",children:o.length>0?l.jsx("div",{className:"p-2",children:o.map((f,m)=>{const g=f.icon;return l.jsxs("button",{onClick:()=>c(f.path),onMouseEnter:()=>i(m),className:ye("w-full flex items-center gap-3 px-3 py-2.5 rounded-md text-left transition-colors",m===s?"bg-accent text-accent-foreground":"hover:bg-accent/50"),children:[l.jsx(g,{className:"h-5 w-5 flex-shrink-0"}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"font-medium text-sm",children:f.title}),l.jsx("div",{className:"text-xs text-muted-foreground truncate",children:f.description})]}),l.jsx("div",{className:"text-xs text-muted-foreground px-2 py-1 bg-muted rounded",children:f.category})]},f.path)})}):l.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[l.jsx(li,{className:"h-12 w-12 text-muted-foreground/50 mb-4"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:n?"未找到匹配的页面":"输入关键词开始搜索"})]})})}),l.jsx("div",{className:"border-t px-4 py-3 flex items-center justify-between text-xs text-muted-foreground",children:l.jsxs("div",{className:"flex items-center gap-4",children:[l.jsxs("span",{className:"flex items-center gap-1",children:[l.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"↑"}),l.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"↓"}),"导航"]}),l.jsxs("span",{className:"flex items-center gap-1",children:[l.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"Enter"}),"选择"]}),l.jsxs("span",{className:"flex items-center gap-1",children:[l.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"Esc"}),"关闭"]})]})})]})})}function G8e(t){const e=X8e(t),n=b.forwardRef((r,s)=>{const{children:i,...a}=r,o=b.Children.toArray(i),c=o.find(K8e);if(c){const h=c.props.children,f=o.map(m=>m===c?b.Children.count(h)>1?b.Children.only(null):b.isValidElement(h)?h.props.children:null:m);return l.jsx(e,{...a,ref:s,children:b.isValidElement(h)?b.cloneElement(h,void 0,f):null})}return l.jsx(e,{...a,ref:s,children:i})});return n.displayName=`${t}.Slot`,n}function X8e(t){const e=b.forwardRef((n,r)=>{const{children:s,...i}=n;if(b.isValidElement(s)){const a=J8e(s),o=Z8e(i,s.props);return s.type!==b.Fragment&&(o.ref=r?gc(r,a):a),b.cloneElement(s,o)}return b.Children.count(s)>1?b.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var Y8e=Symbol("radix.slottable");function K8e(t){return b.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===Y8e}function Z8e(t,e){const n={...e};for(const r in e){const s=t[r],i=e[r];/^on[A-Z]/.test(r)?s&&i?n[r]=(...o)=>{const c=i(...o);return s(...o),c}:s&&(n[r]=s):r==="style"?n[r]={...s,...i}:r==="className"&&(n[r]=[s,i].filter(Boolean).join(" "))}return{...t,...n}}function J8e(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var Ek=["Enter"," "],eCe=["ArrowDown","PageUp","Home"],hU=["ArrowUp","PageDown","End"],tCe=[...eCe,...hU],nCe={ltr:[...Ek,"ArrowRight"],rtl:[...Ek,"ArrowLeft"]},rCe={ltr:["ArrowLeft"],rtl:["ArrowRight"]},yp="Menu",[T0,sCe,iCe]=jv(yp),[Uu,fU]=ua(yp,[iCe,Rh,Bv]),bp=Rh(),mU=Bv(),[pU,Lc]=Uu(yp),[aCe,wp]=Uu(yp),gU=t=>{const{__scopeMenu:e,open:n=!1,children:r,dir:s,onOpenChange:i,modal:a=!0}=t,o=bp(e),[c,h]=b.useState(null),f=b.useRef(!1),m=bs(i),g=M0(s);return b.useEffect(()=>{const x=()=>{f.current=!0,document.addEventListener("pointerdown",y,{capture:!0,once:!0}),document.addEventListener("pointermove",y,{capture:!0,once:!0})},y=()=>f.current=!1;return document.addEventListener("keydown",x,{capture:!0}),()=>{document.removeEventListener("keydown",x,{capture:!0}),document.removeEventListener("pointerdown",y,{capture:!0}),document.removeEventListener("pointermove",y,{capture:!0})}},[]),l.jsx(_v,{...o,children:l.jsx(pU,{scope:e,open:n,onOpenChange:m,content:c,onContentChange:h,children:l.jsx(aCe,{scope:e,onClose:b.useCallback(()=>m(!1),[m]),isUsingKeyboardRef:f,dir:g,modal:a,children:r})})})};gU.displayName=yp;var lCe="MenuAnchor",Aj=b.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,s=bp(n);return l.jsx(Mv,{...s,...r,ref:e})});Aj.displayName=lCe;var Rj="MenuPortal",[oCe,xU]=Uu(Rj,{forceMount:void 0}),vU=t=>{const{__scopeMenu:e,forceMount:n,children:r,container:s}=t,i=Lc(Rj,e);return l.jsx(oCe,{scope:e,forceMount:n,children:l.jsx(Ps,{present:n||i.open,children:l.jsx(Ev,{asChild:!0,container:s,children:r})})})};vU.displayName=Rj;var ia="MenuContent",[cCe,Dj]=Uu(ia),yU=b.forwardRef((t,e)=>{const n=xU(ia,t.__scopeMenu),{forceMount:r=n.forceMount,...s}=t,i=Lc(ia,t.__scopeMenu),a=wp(ia,t.__scopeMenu);return l.jsx(T0.Provider,{scope:t.__scopeMenu,children:l.jsx(Ps,{present:r||i.open,children:l.jsx(T0.Slot,{scope:t.__scopeMenu,children:a.modal?l.jsx(uCe,{...s,ref:e}):l.jsx(dCe,{...s,ref:e})})})})}),uCe=b.forwardRef((t,e)=>{const n=Lc(ia,t.__scopeMenu),r=b.useRef(null),s=Dn(e,r);return b.useEffect(()=>{const i=r.current;if(i)return GD(i)},[]),l.jsx(zj,{...t,ref:s,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Ze(t.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),dCe=b.forwardRef((t,e)=>{const n=Lc(ia,t.__scopeMenu);return l.jsx(zj,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),hCe=G8e("MenuContent.ScrollLock"),zj=b.forwardRef((t,e)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:s,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEntryFocus:c,onEscapeKeyDown:h,onPointerDownOutside:f,onFocusOutside:m,onInteractOutside:g,onDismiss:x,disableOutsideScroll:y,...w}=t,S=Lc(ia,n),k=wp(ia,n),N=bp(n),C=mU(n),T=sCe(n),[_,E]=b.useState(null),M=b.useRef(null),q=Dn(e,M,S.onContentChange),L=b.useRef(0),I=b.useRef(""),$=b.useRef(0),V=b.useRef(null),ee=b.useRef("right"),z=b.useRef(0),H=y?XD:b.Fragment,P=y?{as:hCe,allowPinchZoom:!0}:void 0,W=X=>{const R=I.current+X,se=T().filter(Y=>!Y.disabled),G=document.activeElement,F=se.find(Y=>Y.ref.current===G)?.textValue,U=se.map(Y=>Y.textValue),te=OCe(U,R,F),ne=se.find(Y=>Y.textValue===te)?.ref.current;(function Y(ae){I.current=ae,window.clearTimeout(L.current),ae!==""&&(L.current=window.setTimeout(()=>Y(""),1e3))})(R),ne&&setTimeout(()=>ne.focus())};b.useEffect(()=>()=>window.clearTimeout(L.current),[]),YD();const J=b.useCallback(X=>ee.current===V.current?.side&&NCe(X,V.current?.area),[]);return l.jsx(cCe,{scope:n,searchRef:I,onItemEnter:b.useCallback(X=>{J(X)&&X.preventDefault()},[J]),onItemLeave:b.useCallback(X=>{J(X)||(M.current?.focus(),E(null))},[J]),onTriggerLeave:b.useCallback(X=>{J(X)&&X.preventDefault()},[J]),pointerGraceTimerRef:$,onPointerGraceIntentChange:b.useCallback(X=>{V.current=X},[]),children:l.jsx(H,{...P,children:l.jsx(KD,{asChild:!0,trapped:s,onMountAutoFocus:Ze(i,X=>{X.preventDefault(),M.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:a,children:l.jsx(Yk,{asChild:!0,disableOutsidePointerEvents:o,onEscapeKeyDown:h,onPointerDownOutside:f,onFocusOutside:m,onInteractOutside:g,onDismiss:x,children:l.jsx(Zz,{asChild:!0,...C,dir:k.dir,orientation:"vertical",loop:r,currentTabStopId:_,onCurrentTabStopIdChange:E,onEntryFocus:Ze(c,X=>{k.isUsingKeyboardRef.current||X.preventDefault()}),preventScrollOnEntryFocus:!0,children:l.jsx(Kk,{role:"menu","aria-orientation":"vertical","data-state":PU(S.open),"data-radix-menu-content":"",dir:k.dir,...N,...w,ref:q,style:{outline:"none",...w.style},onKeyDown:Ze(w.onKeyDown,X=>{const se=X.target.closest("[data-radix-menu-content]")===X.currentTarget,G=X.ctrlKey||X.altKey||X.metaKey,F=X.key.length===1;se&&(X.key==="Tab"&&X.preventDefault(),!G&&F&&W(X.key));const U=M.current;if(X.target!==U||!tCe.includes(X.key))return;X.preventDefault();const ne=T().filter(Y=>!Y.disabled).map(Y=>Y.ref.current);hU.includes(X.key)&&ne.reverse(),SCe(ne)}),onBlur:Ze(t.onBlur,X=>{X.currentTarget.contains(X.target)||(window.clearTimeout(L.current),I.current="")}),onPointerMove:Ze(t.onPointerMove,E0(X=>{const R=X.target,se=z.current!==X.clientX;if(X.currentTarget.contains(R)&&se){const G=X.clientX>z.current?"right":"left";ee.current=G,z.current=X.clientX}}))})})})})})})});yU.displayName=ia;var fCe="MenuGroup",Pj=b.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return l.jsx(nn.div,{role:"group",...r,ref:e})});Pj.displayName=fCe;var mCe="MenuLabel",bU=b.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return l.jsx(nn.div,{...r,ref:e})});bU.displayName=mCe;var wv="MenuItem",gD="menu.itemSelect",zy=b.forwardRef((t,e)=>{const{disabled:n=!1,onSelect:r,...s}=t,i=b.useRef(null),a=wp(wv,t.__scopeMenu),o=Dj(wv,t.__scopeMenu),c=Dn(e,i),h=b.useRef(!1),f=()=>{const m=i.current;if(!n&&m){const g=new CustomEvent(gD,{bubbles:!0,cancelable:!0});m.addEventListener(gD,x=>r?.(x),{once:!0}),JD(m,g),g.defaultPrevented?h.current=!1:a.onClose()}};return l.jsx(wU,{...s,ref:c,disabled:n,onClick:Ze(t.onClick,f),onPointerDown:m=>{t.onPointerDown?.(m),h.current=!0},onPointerUp:Ze(t.onPointerUp,m=>{h.current||m.currentTarget?.click()}),onKeyDown:Ze(t.onKeyDown,m=>{const g=o.searchRef.current!=="";n||g&&m.key===" "||Ek.includes(m.key)&&(m.currentTarget.click(),m.preventDefault())})})});zy.displayName=wv;var wU=b.forwardRef((t,e)=>{const{__scopeMenu:n,disabled:r=!1,textValue:s,...i}=t,a=Dj(wv,n),o=mU(n),c=b.useRef(null),h=Dn(e,c),[f,m]=b.useState(!1),[g,x]=b.useState("");return b.useEffect(()=>{const y=c.current;y&&x((y.textContent??"").trim())},[i.children]),l.jsx(T0.ItemSlot,{scope:n,disabled:r,textValue:s??g,children:l.jsx(Jz,{asChild:!0,...o,focusable:!r,children:l.jsx(nn.div,{role:"menuitem","data-highlighted":f?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...i,ref:h,onPointerMove:Ze(t.onPointerMove,E0(y=>{r?a.onItemLeave(y):(a.onItemEnter(y),y.defaultPrevented||y.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Ze(t.onPointerLeave,E0(y=>a.onItemLeave(y))),onFocus:Ze(t.onFocus,()=>m(!0)),onBlur:Ze(t.onBlur,()=>m(!1))})})})}),pCe="MenuCheckboxItem",SU=b.forwardRef((t,e)=>{const{checked:n=!1,onCheckedChange:r,...s}=t;return l.jsx(CU,{scope:t.__scopeMenu,checked:n,children:l.jsx(zy,{role:"menuitemcheckbox","aria-checked":Sv(n)?"mixed":n,...s,ref:e,"data-state":Bj(n),onSelect:Ze(s.onSelect,()=>r?.(Sv(n)?!0:!n),{checkForDefaultPrevented:!1})})})});SU.displayName=pCe;var kU="MenuRadioGroup",[gCe,xCe]=Uu(kU,{value:void 0,onValueChange:()=>{}}),OU=b.forwardRef((t,e)=>{const{value:n,onValueChange:r,...s}=t,i=bs(r);return l.jsx(gCe,{scope:t.__scopeMenu,value:n,onValueChange:i,children:l.jsx(Pj,{...s,ref:e})})});OU.displayName=kU;var jU="MenuRadioItem",NU=b.forwardRef((t,e)=>{const{value:n,...r}=t,s=xCe(jU,t.__scopeMenu),i=n===s.value;return l.jsx(CU,{scope:t.__scopeMenu,checked:i,children:l.jsx(zy,{role:"menuitemradio","aria-checked":i,...r,ref:e,"data-state":Bj(i),onSelect:Ze(r.onSelect,()=>s.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});NU.displayName=jU;var Lj="MenuItemIndicator",[CU,vCe]=Uu(Lj,{checked:!1}),TU=b.forwardRef((t,e)=>{const{__scopeMenu:n,forceMount:r,...s}=t,i=vCe(Lj,n);return l.jsx(Ps,{present:r||Sv(i.checked)||i.checked===!0,children:l.jsx(nn.span,{...s,ref:e,"data-state":Bj(i.checked)})})});TU.displayName=Lj;var yCe="MenuSeparator",EU=b.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return l.jsx(nn.div,{role:"separator","aria-orientation":"horizontal",...r,ref:e})});EU.displayName=yCe;var bCe="MenuArrow",_U=b.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,s=bp(n);return l.jsx(Zk,{...s,...r,ref:e})});_U.displayName=bCe;var Ij="MenuSub",[wCe,MU]=Uu(Ij),AU=t=>{const{__scopeMenu:e,children:n,open:r=!1,onOpenChange:s}=t,i=Lc(Ij,e),a=bp(e),[o,c]=b.useState(null),[h,f]=b.useState(null),m=bs(s);return b.useEffect(()=>(i.open===!1&&m(!1),()=>m(!1)),[i.open,m]),l.jsx(_v,{...a,children:l.jsx(pU,{scope:e,open:r,onOpenChange:m,content:h,onContentChange:f,children:l.jsx(wCe,{scope:e,contentId:Ei(),triggerId:Ei(),trigger:o,onTriggerChange:c,children:n})})})};AU.displayName=Ij;var km="MenuSubTrigger",RU=b.forwardRef((t,e)=>{const n=Lc(km,t.__scopeMenu),r=wp(km,t.__scopeMenu),s=MU(km,t.__scopeMenu),i=Dj(km,t.__scopeMenu),a=b.useRef(null),{pointerGraceTimerRef:o,onPointerGraceIntentChange:c}=i,h={__scopeMenu:t.__scopeMenu},f=b.useCallback(()=>{a.current&&window.clearTimeout(a.current),a.current=null},[]);return b.useEffect(()=>f,[f]),b.useEffect(()=>{const m=o.current;return()=>{window.clearTimeout(m),c(null)}},[o,c]),l.jsx(Aj,{asChild:!0,...h,children:l.jsx(wU,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":s.contentId,"data-state":PU(n.open),...t,ref:gc(e,s.onTriggerChange),onClick:m=>{t.onClick?.(m),!(t.disabled||m.defaultPrevented)&&(m.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:Ze(t.onPointerMove,E0(m=>{i.onItemEnter(m),!m.defaultPrevented&&!t.disabled&&!n.open&&!a.current&&(i.onPointerGraceIntentChange(null),a.current=window.setTimeout(()=>{n.onOpenChange(!0),f()},100))})),onPointerLeave:Ze(t.onPointerLeave,E0(m=>{f();const g=n.content?.getBoundingClientRect();if(g){const x=n.content?.dataset.side,y=x==="right",w=y?-5:5,S=g[y?"left":"right"],k=g[y?"right":"left"];i.onPointerGraceIntentChange({area:[{x:m.clientX+w,y:m.clientY},{x:S,y:g.top},{x:k,y:g.top},{x:k,y:g.bottom},{x:S,y:g.bottom}],side:x}),window.clearTimeout(o.current),o.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(m),m.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:Ze(t.onKeyDown,m=>{const g=i.searchRef.current!=="";t.disabled||g&&m.key===" "||nCe[r.dir].includes(m.key)&&(n.onOpenChange(!0),n.content?.focus(),m.preventDefault())})})})});RU.displayName=km;var DU="MenuSubContent",zU=b.forwardRef((t,e)=>{const n=xU(ia,t.__scopeMenu),{forceMount:r=n.forceMount,...s}=t,i=Lc(ia,t.__scopeMenu),a=wp(ia,t.__scopeMenu),o=MU(DU,t.__scopeMenu),c=b.useRef(null),h=Dn(e,c);return l.jsx(T0.Provider,{scope:t.__scopeMenu,children:l.jsx(Ps,{present:r||i.open,children:l.jsx(T0.Slot,{scope:t.__scopeMenu,children:l.jsx(zj,{id:o.contentId,"aria-labelledby":o.triggerId,...s,ref:h,align:"start",side:a.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:f=>{a.isUsingKeyboardRef.current&&c.current?.focus(),f.preventDefault()},onCloseAutoFocus:f=>f.preventDefault(),onFocusOutside:Ze(t.onFocusOutside,f=>{f.target!==o.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:Ze(t.onEscapeKeyDown,f=>{a.onClose(),f.preventDefault()}),onKeyDown:Ze(t.onKeyDown,f=>{const m=f.currentTarget.contains(f.target),g=rCe[a.dir].includes(f.key);m&&g&&(i.onOpenChange(!1),o.trigger?.focus(),f.preventDefault())})})})})})});zU.displayName=DU;function PU(t){return t?"open":"closed"}function Sv(t){return t==="indeterminate"}function Bj(t){return Sv(t)?"indeterminate":t?"checked":"unchecked"}function SCe(t){const e=document.activeElement;for(const n of t)if(n===e||(n.focus(),document.activeElement!==e))return}function kCe(t,e){return t.map((n,r)=>t[(e+r)%t.length])}function OCe(t,e,n){const s=e.length>1&&Array.from(e).every(h=>h===e[0])?e[0]:e,i=n?t.indexOf(n):-1;let a=kCe(t,Math.max(i,0));s.length===1&&(a=a.filter(h=>h!==n));const c=a.find(h=>h.toLowerCase().startsWith(s.toLowerCase()));return c!==n?c:void 0}function jCe(t,e){const{x:n,y:r}=t;let s=!1;for(let i=0,a=e.length-1;ir!=g>r&&n<(m-h)*(r-f)/(g-f)+h&&(s=!s)}return s}function NCe(t,e){if(!e)return!1;const n={x:t.clientX,y:t.clientY};return jCe(n,e)}function E0(t){return e=>e.pointerType==="mouse"?t(e):void 0}var CCe=gU,TCe=Aj,ECe=vU,_Ce=yU,MCe=Pj,ACe=bU,RCe=zy,DCe=SU,zCe=OU,PCe=NU,LCe=TU,ICe=EU,BCe=_U,qCe=AU,FCe=RU,$Ce=zU,qj="ContextMenu",[QCe]=ua(qj,[fU]),Ns=fU(),[HCe,LU]=QCe(qj),IU=t=>{const{__scopeContextMenu:e,children:n,onOpenChange:r,dir:s,modal:i=!0}=t,[a,o]=b.useState(!1),c=Ns(e),h=bs(r),f=b.useCallback(m=>{o(m),h(m)},[h]);return l.jsx(HCe,{scope:e,open:a,onOpenChange:f,modal:i,children:l.jsx(CCe,{...c,dir:s,open:a,onOpenChange:f,modal:i,children:n})})};IU.displayName=qj;var BU="ContextMenuTrigger",qU=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,disabled:r=!1,...s}=t,i=LU(BU,n),a=Ns(n),o=b.useRef({x:0,y:0}),c=b.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...o.current})}),h=b.useRef(0),f=b.useCallback(()=>window.clearTimeout(h.current),[]),m=g=>{o.current={x:g.clientX,y:g.clientY},i.onOpenChange(!0)};return b.useEffect(()=>f,[f]),b.useEffect(()=>void(r&&f()),[r,f]),l.jsxs(l.Fragment,{children:[l.jsx(TCe,{...a,virtualRef:c}),l.jsx(nn.span,{"data-state":i.open?"open":"closed","data-disabled":r?"":void 0,...s,ref:e,style:{WebkitTouchCallout:"none",...t.style},onContextMenu:r?t.onContextMenu:Ze(t.onContextMenu,g=>{f(),m(g),g.preventDefault()}),onPointerDown:r?t.onPointerDown:Ze(t.onPointerDown,Wx(g=>{f(),h.current=window.setTimeout(()=>m(g),700)})),onPointerMove:r?t.onPointerMove:Ze(t.onPointerMove,Wx(f)),onPointerCancel:r?t.onPointerCancel:Ze(t.onPointerCancel,Wx(f)),onPointerUp:r?t.onPointerUp:Ze(t.onPointerUp,Wx(f))})]})});qU.displayName=BU;var VCe="ContextMenuPortal",FU=t=>{const{__scopeContextMenu:e,...n}=t,r=Ns(e);return l.jsx(ECe,{...r,...n})};FU.displayName=VCe;var $U="ContextMenuContent",QU=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=LU($U,n),i=Ns(n),a=b.useRef(!1);return l.jsx(_Ce,{...i,...r,ref:e,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:o=>{t.onCloseAutoFocus?.(o),!o.defaultPrevented&&a.current&&o.preventDefault(),a.current=!1},onInteractOutside:o=>{t.onInteractOutside?.(o),!o.defaultPrevented&&!s.modal&&(a.current=!0)},style:{...t.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});QU.displayName=$U;var UCe="ContextMenuGroup",WCe=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=Ns(n);return l.jsx(MCe,{...s,...r,ref:e})});WCe.displayName=UCe;var GCe="ContextMenuLabel",HU=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=Ns(n);return l.jsx(ACe,{...s,...r,ref:e})});HU.displayName=GCe;var XCe="ContextMenuItem",VU=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=Ns(n);return l.jsx(RCe,{...s,...r,ref:e})});VU.displayName=XCe;var YCe="ContextMenuCheckboxItem",UU=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=Ns(n);return l.jsx(DCe,{...s,...r,ref:e})});UU.displayName=YCe;var KCe="ContextMenuRadioGroup",ZCe=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=Ns(n);return l.jsx(zCe,{...s,...r,ref:e})});ZCe.displayName=KCe;var JCe="ContextMenuRadioItem",WU=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=Ns(n);return l.jsx(PCe,{...s,...r,ref:e})});WU.displayName=JCe;var e9e="ContextMenuItemIndicator",GU=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=Ns(n);return l.jsx(LCe,{...s,...r,ref:e})});GU.displayName=e9e;var t9e="ContextMenuSeparator",XU=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=Ns(n);return l.jsx(ICe,{...s,...r,ref:e})});XU.displayName=t9e;var n9e="ContextMenuArrow",r9e=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=Ns(n);return l.jsx(BCe,{...s,...r,ref:e})});r9e.displayName=n9e;var YU="ContextMenuSub",KU=t=>{const{__scopeContextMenu:e,children:n,onOpenChange:r,open:s,defaultOpen:i}=t,a=Ns(e),[o,c]=wo({prop:s,defaultProp:i??!1,onChange:r,caller:YU});return l.jsx(qCe,{...a,open:o,onOpenChange:c,children:n})};KU.displayName=YU;var s9e="ContextMenuSubTrigger",ZU=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=Ns(n);return l.jsx(FCe,{...s,...r,ref:e})});ZU.displayName=s9e;var i9e="ContextMenuSubContent",JU=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=Ns(n);return l.jsx($Ce,{...s,...r,ref:e,style:{...t.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});JU.displayName=i9e;function Wx(t){return e=>e.pointerType!=="mouse"?t(e):void 0}var a9e=IU,l9e=qU,o9e=FU,eW=QU,tW=HU,nW=VU,rW=UU,sW=WU,iW=GU,aW=XU,c9e=KU,lW=ZU,oW=JU;const u9e=a9e,d9e=l9e,h9e=c9e,cW=b.forwardRef(({className:t,inset:e,children:n,...r},s)=>l.jsxs(lW,{ref:s,className:ye("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",e&&"pl-8",t),...r,children:[n,l.jsx(Fu,{className:"ml-auto h-4 w-4"})]}));cW.displayName=lW.displayName;const uW=b.forwardRef(({className:t,...e},n)=>l.jsx(oW,{ref:n,className:ye("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-context-menu-content-transform-origin]",t),...e}));uW.displayName=oW.displayName;const dW=b.forwardRef(({className:t,...e},n)=>l.jsx(o9e,{children:l.jsx(eW,{ref:n,className:ye("z-50 max-h-[--radix-context-menu-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-context-menu-content-transform-origin]",t),...e})}));dW.displayName=eW.displayName;const ba=b.forwardRef(({className:t,inset:e,...n},r)=>l.jsx(nW,{ref:r,className:ye("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e&&"pl-8",t),...n}));ba.displayName=nW.displayName;const f9e=b.forwardRef(({className:t,children:e,checked:n,...r},s)=>l.jsxs(rW,{ref:s,className:ye("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),checked:n,...r,children:[l.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:l.jsx(iW,{children:l.jsx(so,{className:"h-4 w-4"})})}),e]}));f9e.displayName=rW.displayName;const m9e=b.forwardRef(({className:t,children:e,...n},r)=>l.jsxs(sW,{ref:r,className:ye("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...n,children:[l.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:l.jsx(iW,{children:l.jsx(XK,{className:"h-2 w-2 fill-current"})})}),e]}));m9e.displayName=sW.displayName;const p9e=b.forwardRef(({className:t,inset:e,...n},r)=>l.jsx(tW,{ref:r,className:ye("px-2 py-1.5 text-sm font-semibold text-foreground",e&&"pl-8",t),...n}));p9e.displayName=tW.displayName;const Om=b.forwardRef(({className:t,...e},n)=>l.jsx(aW,{ref:n,className:ye("-mx-1 my-1 h-px bg-border",t),...e}));Om.displayName=aW.displayName;const Vd=({className:t,...e})=>l.jsx("span",{className:ye("ml-auto text-xs tracking-widest text-muted-foreground",t),...e});Vd.displayName="ContextMenuShortcut";var g9e=Symbol("radix.slottable");function x9e(t){const e=({children:n})=>l.jsx(l.Fragment,{children:n});return e.displayName=`${t}.Slottable`,e.__radixId=g9e,e}var[Py]=ua("Tooltip",[Rh]),Ly=Rh(),hW="TooltipProvider",v9e=700,_k="tooltip.open",[y9e,Fj]=Py(hW),fW=t=>{const{__scopeTooltip:e,delayDuration:n=v9e,skipDelayDuration:r=300,disableHoverableContent:s=!1,children:i}=t,a=b.useRef(!0),o=b.useRef(!1),c=b.useRef(0);return b.useEffect(()=>{const h=c.current;return()=>window.clearTimeout(h)},[]),l.jsx(y9e,{scope:e,isOpenDelayedRef:a,delayDuration:n,onOpen:b.useCallback(()=>{window.clearTimeout(c.current),a.current=!1},[]),onClose:b.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>a.current=!0,r)},[r]),isPointerInTransitRef:o,onPointerInTransitChange:b.useCallback(h=>{o.current=h},[]),disableHoverableContent:s,children:i})};fW.displayName=hW;var _0="Tooltip",[b9e,Sp]=Py(_0),mW=t=>{const{__scopeTooltip:e,children:n,open:r,defaultOpen:s,onOpenChange:i,disableHoverableContent:a,delayDuration:o}=t,c=Fj(_0,t.__scopeTooltip),h=Ly(e),[f,m]=b.useState(null),g=Ei(),x=b.useRef(0),y=a??c.disableHoverableContent,w=o??c.delayDuration,S=b.useRef(!1),[k,N]=wo({prop:r,defaultProp:s??!1,onChange:M=>{M?(c.onOpen(),document.dispatchEvent(new CustomEvent(_k))):c.onClose(),i?.(M)},caller:_0}),C=b.useMemo(()=>k?S.current?"delayed-open":"instant-open":"closed",[k]),T=b.useCallback(()=>{window.clearTimeout(x.current),x.current=0,S.current=!1,N(!0)},[N]),_=b.useCallback(()=>{window.clearTimeout(x.current),x.current=0,N(!1)},[N]),E=b.useCallback(()=>{window.clearTimeout(x.current),x.current=window.setTimeout(()=>{S.current=!0,N(!0),x.current=0},w)},[w,N]);return b.useEffect(()=>()=>{x.current&&(window.clearTimeout(x.current),x.current=0)},[]),l.jsx(_v,{...h,children:l.jsx(b9e,{scope:e,contentId:g,open:k,stateAttribute:C,trigger:f,onTriggerChange:m,onTriggerEnter:b.useCallback(()=>{c.isOpenDelayedRef.current?E():T()},[c.isOpenDelayedRef,E,T]),onTriggerLeave:b.useCallback(()=>{y?_():(window.clearTimeout(x.current),x.current=0)},[_,y]),onOpen:T,onClose:_,disableHoverableContent:y,children:n})})};mW.displayName=_0;var Mk="TooltipTrigger",pW=b.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,s=Sp(Mk,n),i=Fj(Mk,n),a=Ly(n),o=b.useRef(null),c=Dn(e,o,s.onTriggerChange),h=b.useRef(!1),f=b.useRef(!1),m=b.useCallback(()=>h.current=!1,[]);return b.useEffect(()=>()=>document.removeEventListener("pointerup",m),[m]),l.jsx(Mv,{asChild:!0,...a,children:l.jsx(nn.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...r,ref:c,onPointerMove:Ze(t.onPointerMove,g=>{g.pointerType!=="touch"&&!f.current&&!i.isPointerInTransitRef.current&&(s.onTriggerEnter(),f.current=!0)}),onPointerLeave:Ze(t.onPointerLeave,()=>{s.onTriggerLeave(),f.current=!1}),onPointerDown:Ze(t.onPointerDown,()=>{s.open&&s.onClose(),h.current=!0,document.addEventListener("pointerup",m,{once:!0})}),onFocus:Ze(t.onFocus,()=>{h.current||s.onOpen()}),onBlur:Ze(t.onBlur,s.onClose),onClick:Ze(t.onClick,s.onClose)})})});pW.displayName=Mk;var $j="TooltipPortal",[w9e,S9e]=Py($j,{forceMount:void 0}),gW=t=>{const{__scopeTooltip:e,forceMount:n,children:r,container:s}=t,i=Sp($j,e);return l.jsx(w9e,{scope:e,forceMount:n,children:l.jsx(Ps,{present:n||i.open,children:l.jsx(Ev,{asChild:!0,container:s,children:r})})})};gW.displayName=$j;var Ah="TooltipContent",xW=b.forwardRef((t,e)=>{const n=S9e(Ah,t.__scopeTooltip),{forceMount:r=n.forceMount,side:s="top",...i}=t,a=Sp(Ah,t.__scopeTooltip);return l.jsx(Ps,{present:r||a.open,children:a.disableHoverableContent?l.jsx(vW,{side:s,...i,ref:e}):l.jsx(k9e,{side:s,...i,ref:e})})}),k9e=b.forwardRef((t,e)=>{const n=Sp(Ah,t.__scopeTooltip),r=Fj(Ah,t.__scopeTooltip),s=b.useRef(null),i=Dn(e,s),[a,o]=b.useState(null),{trigger:c,onClose:h}=n,f=s.current,{onPointerInTransitChange:m}=r,g=b.useCallback(()=>{o(null),m(!1)},[m]),x=b.useCallback((y,w)=>{const S=y.currentTarget,k={x:y.clientX,y:y.clientY},N=T9e(k,S.getBoundingClientRect()),C=E9e(k,N),T=_9e(w.getBoundingClientRect()),_=A9e([...C,...T]);o(_),m(!0)},[m]);return b.useEffect(()=>()=>g(),[g]),b.useEffect(()=>{if(c&&f){const y=S=>x(S,f),w=S=>x(S,c);return c.addEventListener("pointerleave",y),f.addEventListener("pointerleave",w),()=>{c.removeEventListener("pointerleave",y),f.removeEventListener("pointerleave",w)}}},[c,f,x,g]),b.useEffect(()=>{if(a){const y=w=>{const S=w.target,k={x:w.clientX,y:w.clientY},N=c?.contains(S)||f?.contains(S),C=!M9e(k,a);N?g():C&&(g(),h())};return document.addEventListener("pointermove",y),()=>document.removeEventListener("pointermove",y)}},[c,f,a,h,g]),l.jsx(vW,{...t,ref:i})}),[O9e,j9e]=Py(_0,{isInside:!1}),N9e=x9e("TooltipContent"),vW=b.forwardRef((t,e)=>{const{__scopeTooltip:n,children:r,"aria-label":s,onEscapeKeyDown:i,onPointerDownOutside:a,...o}=t,c=Sp(Ah,n),h=Ly(n),{onClose:f}=c;return b.useEffect(()=>(document.addEventListener(_k,f),()=>document.removeEventListener(_k,f)),[f]),b.useEffect(()=>{if(c.trigger){const m=g=>{g.target?.contains(c.trigger)&&f()};return window.addEventListener("scroll",m,{capture:!0}),()=>window.removeEventListener("scroll",m,{capture:!0})}},[c.trigger,f]),l.jsx(Yk,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:m=>m.preventDefault(),onDismiss:f,children:l.jsxs(Kk,{"data-state":c.stateAttribute,...h,...o,ref:e,style:{...o.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:[l.jsx(N9e,{children:r}),l.jsx(O9e,{scope:n,isInside:!0,children:l.jsx(kK,{id:c.contentId,role:"tooltip",children:s||r})})]})})});xW.displayName=Ah;var yW="TooltipArrow",C9e=b.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,s=Ly(n);return j9e(yW,n).isInside?null:l.jsx(Zk,{...s,...r,ref:e})});C9e.displayName=yW;function T9e(t,e){const n=Math.abs(e.top-t.y),r=Math.abs(e.bottom-t.y),s=Math.abs(e.right-t.x),i=Math.abs(e.left-t.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 E9e(t,e,n=5){const r=[];switch(e){case"top":r.push({x:t.x-n,y:t.y+n},{x:t.x+n,y:t.y+n});break;case"bottom":r.push({x:t.x-n,y:t.y-n},{x:t.x+n,y:t.y-n});break;case"left":r.push({x:t.x+n,y:t.y-n},{x:t.x+n,y:t.y+n});break;case"right":r.push({x:t.x-n,y:t.y-n},{x:t.x-n,y:t.y+n});break}return r}function _9e(t){const{top:e,right:n,bottom:r,left:s}=t;return[{x:s,y:e},{x:n,y:e},{x:n,y:r},{x:s,y:r}]}function M9e(t,e){const{x:n,y:r}=t;let s=!1;for(let i=0,a=e.length-1;ir!=g>r&&n<(m-h)*(r-f)/(g-f)+h&&(s=!s)}return s}function A9e(t){const e=t.slice();return e.sort((n,r)=>n.xr.x?1:n.yr.y?1:0),R9e(e)}function R9e(t){if(t.length<=1)return t.slice();const e=[];for(let r=0;r=2;){const i=e[e.length-1],a=e[e.length-2];if((i.x-a.x)*(s.y-a.y)>=(i.y-a.y)*(s.x-a.x))e.pop();else break}e.push(s)}e.pop();const n=[];for(let r=t.length-1;r>=0;r--){const s=t[r];for(;n.length>=2;){const i=n[n.length-1],a=n[n.length-2];if((i.x-a.x)*(s.y-a.y)>=(i.y-a.y)*(s.x-a.x))n.pop();else break}n.push(s)}return n.pop(),e.length===1&&n.length===1&&e[0].x===n[0].x&&e[0].y===n[0].y?e:e.concat(n)}var D9e=fW,z9e=mW,P9e=pW,L9e=gW,bW=xW;const I9e=D9e,B9e=z9e,q9e=P9e,wW=b.forwardRef(({className:t,sideOffset:e=4,...n},r)=>l.jsx(L9e,{children:l.jsx(bW,{ref:r,sideOffset:e,className:ye("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-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 origin-[--radix-tooltip-content-transform-origin]",t),...n})}));wW.displayName=bW.displayName;function F9e({children:t}){Gte();const[e,n]=b.useState(!0),[r,s]=b.useState(!1),[i,a]=b.useState(!1),{theme:o,setTheme:c}=f6(),h=aY(),f=Ma();b.useEffect(()=>{const w=S=>{(S.metaKey||S.ctrlKey)&&S.key==="k"&&(S.preventDefault(),a(!0))};return window.addEventListener("keydown",w),()=>window.removeEventListener("keydown",w)},[]);const m=[{title:"概览",items:[{icon:qm,label:"首页",path:"/"}]},{title:"麦麦配置编辑",items:[{icon:io,label:"麦麦主程序配置",path:"/config/bot"},{icon:lz,label:"AI模型厂商配置",path:"/config/modelProvider"},{icon:oz,label:"模型管理与分配",path:"/config/model"},{icon:qC,label:"麦麦适配器配置",path:"/config/adapter"}]},{title:"麦麦资源管理",items:[{icon:Jk,label:"表情包管理",path:"/resource/emoji"},{icon:A0,label:"表达方式管理",path:"/resource/expression"},{icon:cz,label:"人物信息管理",path:"/resource/person"},{icon:az,label:"知识库图谱可视化",path:"/resource/knowledge-graph"}]},{title:"扩展与监控",items:[{icon:mh,label:"插件市场",path:"/plugins"},{icon:qC,label:"插件配置",path:"/plugin-config"},{icon:j1,label:"日志查看器",path:"/logs"}]},{title:"系统",items:[{icon:yu,label:"系统设置",path:"/settings"}]}],x=o==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":o,y=()=>{localStorage.removeItem("access-token"),f({to:"/auth"})};return l.jsx(I9e,{delayDuration:300,children:l.jsxs("div",{className:"flex h-screen overflow-hidden",children:[l.jsxs("aside",{className:ye("fixed inset-y-0 left-0 z-50 flex flex-col border-r bg-card transition-all duration-300 lg:relative lg:z-0","w-64 lg:w-auto",e?"lg:w-64":"lg:w-16",r?"translate-x-0":"-translate-x-full lg:translate-x-0"),children:[l.jsx("div",{className:"flex h-16 items-center border-b px-4",children:l.jsxs("div",{className:ye("relative flex items-center justify-center flex-1 transition-all overflow-hidden","lg:flex-1",!e&&"lg:flex-none lg:w-8"),children:[l.jsxs("div",{className:ye("flex items-baseline gap-2",!e&&"lg:hidden"),children:[l.jsx("span",{className:"font-bold text-xl text-primary-gradient whitespace-nowrap",children:"MaiBot WebUI"}),l.jsx("span",{className:"text-xs text-primary/60 whitespace-nowrap",children:Ote()})]}),!e&&l.jsx("span",{className:"hidden lg:block font-bold text-primary-gradient text-2xl",children:"M"})]})}),l.jsx(on,{className:ye("flex-1 overflow-x-hidden",!e&&"lg:w-16"),children:l.jsx("nav",{className:ye("p-4",!e&&"lg:p-2 lg:w-16"),children:l.jsx("ul",{className:ye("space-y-6",!e&&"lg:space-y-3 lg:w-full"),children:m.map((w,S)=>l.jsxs("li",{children:[l.jsx("div",{className:ye("px-3 h-[1.25rem]","mb-2",!e&&"lg:mb-1 lg:invisible"),children:l.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground/60 whitespace-nowrap",children:w.title})}),!e&&S>0&&l.jsx("div",{className:"hidden lg:block mb-2 border-t border-border"}),l.jsx("ul",{className:"space-y-1",children:w.items.map(k=>{const N=h({to:k.path}),C=k.icon,T=l.jsxs(l.Fragment,{children:[N&&l.jsx("div",{className:"absolute left-0 top-1/2 h-8 w-1 -translate-y-1/2 rounded-r-full bg-primary transition-opacity duration-300"}),l.jsxs("div",{className:ye("flex items-center transition-all duration-300",e?"gap-3":"gap-3 lg:gap-0"),children:[l.jsx(C,{className:ye("h-5 w-5 flex-shrink-0",N&&"text-primary"),strokeWidth:2,fill:"none"}),l.jsx("span",{className:ye("text-sm font-medium whitespace-nowrap transition-all duration-300",N&&"font-semibold",e?"opacity-100 max-w-[200px]":"opacity-100 max-w-[200px] lg:opacity-0 lg:max-w-0 lg:overflow-hidden"),children:k.label})]})]});return l.jsx("li",{className:"relative",children:l.jsxs(B9e,{children:[l.jsx(q9e,{asChild:!0,children:l.jsx(lY,{to:k.path,className:ye("relative flex items-center rounded-lg py-2 transition-all duration-300","hover:bg-accent hover:text-accent-foreground",N?"bg-accent text-foreground":"text-muted-foreground hover:text-foreground",e?"px-3":"px-3 lg:px-0 lg:justify-center lg:w-12 lg:mx-auto"),onClick:()=>s(!1),children:T})}),!e&&l.jsx(wW,{side:"right",className:"hidden lg:block",children:l.jsx("p",{children:k.label})})]})},k.path)})})]},w.title))})})})]}),r&&l.jsx("div",{className:"fixed inset-0 z-40 bg-black/50 lg:hidden",onClick:()=>s(!1)}),l.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[l.jsxs("header",{className:"flex h-16 items-center justify-between border-b bg-card/80 backdrop-blur-md px-4 sticky top-0 z-10",children:[l.jsxs("div",{className:"flex items-center gap-4",children:[l.jsx("button",{onClick:()=>s(!r),className:"rounded-lg p-2 hover:bg-accent lg:hidden",children:l.jsx(YK,{className:"h-5 w-5"})}),l.jsx("button",{onClick:()=>n(!e),className:"hidden rounded-lg p-2 hover:bg-accent lg:block",title:e?"收起侧边栏":"展开侧边栏",children:l.jsx(qu,{className:ye("h-5 w-5 transition-transform",!e&&"rotate-180")})})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsxs("button",{onClick:()=>a(!0),className:"relative hidden md:flex items-center w-64 h-9 pl-9 pr-16 bg-background/50 border rounded-md hover:bg-accent/50 transition-colors text-left",children:[l.jsx(li,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),l.jsx("span",{className:"text-sm text-muted-foreground",children:"搜索..."}),l.jsxs(dU,{size:"sm",className:"absolute right-2 top-1/2 -translate-y-1/2",children:[l.jsx("span",{className:"text-xs",children:"⌘"}),"K"]})]}),l.jsx(W8e,{open:i,onOpenChange:a}),l.jsxs(fe,{variant:"ghost",size:"sm",onClick:()=>window.open("https://docs.mai-mai.org","_blank"),className:"gap-2",title:"查看麦麦文档",children:[l.jsx(KK,{className:"h-4 w-4"}),l.jsx("span",{className:"hidden sm:inline",children:"麦麦文档"})]}),l.jsx("button",{onClick:w=>{cte(x==="dark"?"light":"dark",c,w)},className:"rounded-lg p-2 hover:bg-accent",title:x==="dark"?"切换到浅色模式":"切换到深色模式",children:x==="dark"?l.jsx(T3,{className:"h-5 w-5"}):l.jsx(E3,{className:"h-5 w-5"})}),l.jsx("div",{className:"h-6 w-px bg-border"}),l.jsxs(fe,{variant:"ghost",size:"sm",onClick:y,className:"gap-2",title:"登出系统",children:[l.jsx(FC,{className:"h-4 w-4"}),l.jsx("span",{className:"hidden sm:inline",children:"登出"})]})]})]}),l.jsxs(u9e,{children:[l.jsx(d9e,{asChild:!0,children:l.jsx("main",{className:"flex-1 overflow-hidden bg-background",children:t})}),l.jsxs(dW,{className:"w-64",children:[l.jsxs(ba,{onClick:()=>f({to:"/"}),children:[l.jsx(qm,{className:"mr-2 h-4 w-4"}),"首页"]}),l.jsxs(ba,{onClick:()=>f({to:"/settings"}),children:[l.jsx(yu,{className:"mr-2 h-4 w-4"}),"系统设置"]}),l.jsxs(ba,{onClick:()=>f({to:"/logs"}),children:[l.jsx(j1,{className:"mr-2 h-4 w-4"}),"日志查看器"]}),l.jsx(Om,{}),l.jsxs(h9e,{children:[l.jsxs(cW,{children:[l.jsx(tz,{className:"mr-2 h-4 w-4"}),"切换主题"]}),l.jsxs(uW,{className:"w-48",children:[l.jsxs(ba,{onClick:()=>c("light"),disabled:o==="light",children:[l.jsx(T3,{className:"mr-2 h-4 w-4"}),"浅色",o==="light"&&l.jsx(Vd,{children:"✓"})]}),l.jsxs(ba,{onClick:()=>c("dark"),disabled:o==="dark",children:[l.jsx(E3,{className:"mr-2 h-4 w-4"}),"深色",o==="dark"&&l.jsx(Vd,{children:"✓"})]}),l.jsxs(ba,{onClick:()=>c("system"),disabled:o==="system",children:[l.jsx(yu,{className:"mr-2 h-4 w-4"}),"跟随系统",o==="system"&&l.jsx(Vd,{children:"✓"})]})]})]}),l.jsx(Om,{}),l.jsxs(ba,{onClick:()=>window.location.reload(),children:[l.jsx(ZK,{className:"mr-2 h-4 w-4"}),"刷新页面",l.jsx(Vd,{children:"⌘R"})]}),l.jsxs(ba,{onClick:()=>a(!0),children:[l.jsx(li,{className:"mr-2 h-4 w-4"}),"搜索",l.jsx(Vd,{children:"⌘K"})]}),l.jsx(Om,{}),l.jsxs(ba,{onClick:()=>window.open("https://docs.mai-mai.org","_blank"),children:[l.jsx(Kd,{className:"mr-2 h-4 w-4"}),"麦麦文档"]}),l.jsx(Om,{}),l.jsxs(ba,{onClick:y,className:"text-destructive focus:text-destructive",children:[l.jsx(FC,{className:"mr-2 h-4 w-4"}),"登出系统"]})]})]})]})]})})}var Iy="Collapsible",[$9e]=ua(Iy),[Q9e,Qj]=$9e(Iy),SW=b.forwardRef((t,e)=>{const{__scopeCollapsible:n,open:r,defaultOpen:s,disabled:i,onOpenChange:a,...o}=t,[c,h]=wo({prop:r,defaultProp:s??!1,onChange:a,caller:Iy});return l.jsx(Q9e,{scope:n,disabled:i,contentId:Ei(),open:c,onOpenToggle:b.useCallback(()=>h(f=>!f),[h]),children:l.jsx(nn.div,{"data-state":Vj(c),"data-disabled":i?"":void 0,...o,ref:e})})});SW.displayName=Iy;var kW="CollapsibleTrigger",OW=b.forwardRef((t,e)=>{const{__scopeCollapsible:n,...r}=t,s=Qj(kW,n);return l.jsx(nn.button,{type:"button","aria-controls":s.contentId,"aria-expanded":s.open||!1,"data-state":Vj(s.open),"data-disabled":s.disabled?"":void 0,disabled:s.disabled,...r,ref:e,onClick:Ze(t.onClick,s.onOpenToggle)})});OW.displayName=kW;var Hj="CollapsibleContent",jW=b.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=Qj(Hj,t.__scopeCollapsible);return l.jsx(Ps,{present:n||s.open,children:({present:i})=>l.jsx(H9e,{...r,ref:e,present:i})})});jW.displayName=Hj;var H9e=b.forwardRef((t,e)=>{const{__scopeCollapsible:n,present:r,children:s,...i}=t,a=Qj(Hj,n),[o,c]=b.useState(r),h=b.useRef(null),f=Dn(e,h),m=b.useRef(0),g=m.current,x=b.useRef(0),y=x.current,w=a.open||o,S=b.useRef(w),k=b.useRef(void 0);return b.useEffect(()=>{const N=requestAnimationFrame(()=>S.current=!1);return()=>cancelAnimationFrame(N)},[]),Qk(()=>{const N=h.current;if(N){k.current=k.current||{transitionDuration:N.style.transitionDuration,animationName:N.style.animationName},N.style.transitionDuration="0s",N.style.animationName="none";const C=N.getBoundingClientRect();m.current=C.height,x.current=C.width,S.current||(N.style.transitionDuration=k.current.transitionDuration,N.style.animationName=k.current.animationName),c(r)}},[a.open,r]),l.jsx(nn.div,{"data-state":Vj(a.open),"data-disabled":a.disabled?"":void 0,id:a.contentId,hidden:!w,...i,ref:f,style:{"--radix-collapsible-content-height":g?`${g}px`:void 0,"--radix-collapsible-content-width":y?`${y}px`:void 0,...t.style},children:w&&s})});function Vj(t){return t?"open":"closed"}var V9e=SW;const xD=V9e,vD=OW,yD=jW;function U9e(t){const e=t.split(` -`).slice(1),n=[];for(const r of e){const s=r.trim();if(!s.startsWith("at "))continue;const i=s.match(/at\s+(?:(.+?)\s+\()?(.+?):(\d+):(\d+)\)?$/);i?n.push({functionName:i[1]||"",fileName:i[2],lineNumber:i[3],columnNumber:i[4],raw:s}):n.push({functionName:"",fileName:"",lineNumber:"",columnNumber:"",raw:s})}return n}function W9e({error:t,errorInfo:e}){const[n,r]=b.useState(!0),[s,i]=b.useState(!1),[a,o]=b.useState(!1),c=t.stack?U9e(t.stack):[],h=async()=>{const f=` + color: hsl(${Math.max(0,Math.min(120-120*S,120))}deg 100% 31%);`,n?.key)}return(h=n?.onChange)==null||h.call(n,s),s}return i.updateDeps=a=>{r=a},i}function JR(t,e){if(t===void 0)throw new Error("Unexpected undefined");return t}const Ije=(t,e)=>Math.abs(t-e)<1.01,Bje=(t,e,n)=>{let r;return function(...s){t.clearTimeout(r),r=t.setTimeout(()=>e.apply(this,s),n)}},eD=t=>{const{offsetWidth:e,offsetHeight:n}=t;return{width:e,height:n}},qje=t=>t,Fje=t=>{const e=Math.max(t.startIndex-t.overscan,0),n=Math.min(t.endIndex+t.overscan,t.count-1),r=[];for(let s=e;s<=n;s++)r.push(s);return r},$je=(t,e)=>{const n=t.scrollElement;if(!n)return;const r=t.targetWindow;if(!r)return;const s=a=>{const{width:o,height:c}=a;e({width:Math.round(o),height:Math.round(c)})};if(s(eD(n)),!r.ResizeObserver)return()=>{};const i=new r.ResizeObserver(a=>{const o=()=>{const c=a[0];if(c?.borderBoxSize){const h=c.borderBoxSize[0];if(h){s({width:h.inlineSize,height:h.blockSize});return}}s(eD(n))};t.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(o):o()});return i.observe(n,{box:"border-box"}),()=>{i.unobserve(n)}},tD={passive:!0},nD=typeof window>"u"?!0:"onscrollend"in window,Qje=(t,e)=>{const n=t.scrollElement;if(!n)return;const r=t.targetWindow;if(!r)return;let s=0;const i=t.options.useScrollendEvent&&nD?()=>{}:Bje(r,()=>{e(s,!1)},t.options.isScrollingResetDelay),a=f=>()=>{const{horizontal:m,isRtl:g}=t.options;s=m?n.scrollLeft*(g&&-1||1):n.scrollTop,i(),e(s,f)},o=a(!0),c=a(!1);c(),n.addEventListener("scroll",o,tD);const h=t.options.useScrollendEvent&&nD;return h&&n.addEventListener("scrollend",c,tD),()=>{n.removeEventListener("scroll",o),h&&n.removeEventListener("scrollend",c)}},Hje=(t,e,n)=>{if(e?.borderBoxSize){const r=e.borderBoxSize[0];if(r)return Math.round(r[n.options.horizontal?"inlineSize":"blockSize"])}return t[n.options.horizontal?"offsetWidth":"offsetHeight"]},Vje=(t,{adjustments:e=0,behavior:n},r)=>{var s,i;const a=t+e;(i=(s=r.scrollElement)==null?void 0:s.scrollTo)==null||i.call(s,{[r.options.horizontal?"left":"top"]:a,behavior:n})};class Uje{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.measurementsCache=[],this.itemSizeCache=new Map,this.pendingMeasuredCacheIndexes=[],this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.observer=(()=>{let n=null;const r=()=>n||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:n=new this.targetWindow.ResizeObserver(s=>{s.forEach(i=>{const a=()=>{this._measureElement(i.target,i)};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()})}));return{disconnect:()=>{var s;(s=r())==null||s.disconnect(),n=null},observe:s=>{var i;return(i=r())==null?void 0:i.observe(s,{box:"border-box"})},unobserve:s=>{var i;return(i=r())==null?void 0:i.unobserve(s)}}})(),this.range=null,this.setOptions=n=>{Object.entries(n).forEach(([r,s])=>{typeof s>"u"&&delete n[r]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:qje,rangeExtractor:Fje,onChange:()=>{},measureElement:Hje,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,...n}},this.notify=n=>{var r,s;(s=(r=this.options).onChange)==null||s.call(r,this,n)},this.maybeNotify=Pd(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),n=>{this.notify(n)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(n=>n()),this.unsubs=[],this.observer.disconnect(),this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var n;const r=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==r){if(this.cleanup(),!r){this.maybeNotify();return}this.scrollElement=r,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((n=this.scrollElement)==null?void 0:n.window)??null,this.elementsCache.forEach(s=>{this.observer.observe(s)}),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0}),this.unsubs.push(this.options.observeElementRect(this,s=>{this.scrollRect=s,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(s,i)=>{this.scrollAdjustments=0,this.scrollDirection=i?this.getScrollOffset()this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(n,r)=>{const s=new Map,i=new Map;for(let a=r-1;a>=0;a--){const o=n[a];if(s.has(o.lane))continue;const c=i.get(o.lane);if(c==null||o.end>c.end?i.set(o.lane,o):o.enda.end===o.end?a.index-o.index:a.end-o.end)[0]:void 0},this.getMeasurementOptions=Pd(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled],(n,r,s,i,a)=>(this.pendingMeasuredCacheIndexes=[],{count:n,paddingStart:r,scrollMargin:s,getItemKey:i,enabled:a}),{key:!1}),this.getMeasurements=Pd(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:n,paddingStart:r,scrollMargin:s,getItemKey:i,enabled:a},o)=>{if(!a)return this.measurementsCache=[],this.itemSizeCache.clear(),[];this.measurementsCache.length===0&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(f=>{this.itemSizeCache.set(f.key,f.size)}));const c=this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[];const h=this.measurementsCache.slice(0,c);for(let f=c;fthis.options.debug}),this.calculateRange=Pd(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,r,s,i)=>this.range=n.length>0&&r>0?Wje({measurements:n,outerSize:r,scrollOffset:s,lanes:i}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=Pd(()=>{let n=null,r=null;const s=this.calculateRange();return s&&(n=s.startIndex,r=s.endIndex),this.maybeNotify.updateDeps([this.isScrolling,n,r]),[this.options.rangeExtractor,this.options.overscan,this.options.count,n,r]},(n,r,s,i,a)=>i===null||a===null?[]:n({startIndex:i,endIndex:a,overscan:r,count:s}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=n=>{const r=this.options.indexAttribute,s=n.getAttribute(r);return s?parseInt(s,10):(console.warn(`Missing attribute name '${r}={index}' on measured element.`),-1)},this._measureElement=(n,r)=>{const s=this.indexFromElement(n),i=this.measurementsCache[s];if(!i)return;const a=i.key,o=this.elementsCache.get(a);o!==n&&(o&&this.observer.unobserve(o),this.observer.observe(n),this.elementsCache.set(a,n)),n.isConnected&&this.resizeItem(s,this.options.measureElement(n,r,this))},this.resizeItem=(n,r)=>{const s=this.measurementsCache[n];if(!s)return;const i=this.itemSizeCache.get(s.key)??s.size,a=r-i;a!==0&&((this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(s,a,this):s.start{if(!n){this.elementsCache.forEach((r,s)=>{r.isConnected||(this.observer.unobserve(r),this.elementsCache.delete(s))});return}this._measureElement(n,void 0)},this.getVirtualItems=Pd(()=>[this.getVirtualIndexes(),this.getMeasurements()],(n,r)=>{const s=[];for(let i=0,a=n.length;ithis.options.debug}),this.getVirtualItemForOffset=n=>{const r=this.getMeasurements();if(r.length!==0)return JR(r[LV(0,r.length-1,s=>JR(r[s]).start,n)])},this.getOffsetForAlignment=(n,r,s=0)=>{const i=this.getSize(),a=this.getScrollOffset();r==="auto"&&(r=n>=a+i?"end":"start"),r==="center"?n+=(s-i)/2:r==="end"&&(n-=i);const o=this.getTotalSize()+this.options.scrollMargin-i;return Math.max(Math.min(o,n),0)},this.getOffsetForIndex=(n,r="auto")=>{n=Math.max(0,Math.min(n,this.options.count-1));const s=this.measurementsCache[n];if(!s)return;const i=this.getSize(),a=this.getScrollOffset();if(r==="auto")if(s.end>=a+i-this.options.scrollPaddingEnd)r="end";else if(s.start<=a+this.options.scrollPaddingStart)r="start";else return[a,r];const o=r==="end"?s.end+this.options.scrollPaddingEnd:s.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(o,r,s.size),r]},this.isDynamicMode=()=>this.elementsCache.size>0,this.scrollToOffset=(n,{align:r="start",behavior:s}={})=>{s==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(n,r),{adjustments:void 0,behavior:s})},this.scrollToIndex=(n,{align:r="auto",behavior:s}={})=>{s==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),n=Math.max(0,Math.min(n,this.options.count-1));let i=0;const a=10,o=h=>{if(!this.targetWindow)return;const f=this.getOffsetForIndex(n,h);if(!f){console.warn("Failed to get offset for index:",n);return}const[m,g]=f;this._scrollToOffset(m,{adjustments:void 0,behavior:s}),this.targetWindow.requestAnimationFrame(()=>{const x=this.getScrollOffset(),y=this.getOffsetForIndex(n,g);if(!y){console.warn("Failed to get offset for index:",n);return}Ije(y[0],x)||c(g)})},c=h=>{this.targetWindow&&(i++,io(h)):console.warn(`Failed to scroll to index ${n} after ${a} attempts.`))};o(r)},this.scrollBy=(n,{behavior:r}={})=>{r==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getScrollOffset()+n,{adjustments:void 0,behavior:r})},this.getTotalSize=()=>{var n;const r=this.getMeasurements();let s;if(r.length===0)s=this.options.paddingStart;else if(this.options.lanes===1)s=((n=r[r.length-1])==null?void 0:n.end)??0;else{const i=Array(this.options.lanes).fill(null);let a=r.length-1;for(;a>=0&&i.some(o=>o===null);){const o=r[a];i[o.lane]===null&&(i[o.lane]=o.end),a--}s=Math.max(...i.filter(o=>o!==null))}return Math.max(s-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(n,{adjustments:r,behavior:s})=>{this.options.scrollToFn(n,{behavior:s,adjustments:r},this)},this.measure=()=>{this.itemSizeCache=new Map,this.notify(!1)},this.setOptions(e)}}const LV=(t,e,n,r)=>{for(;t<=e;){const s=(t+e)/2|0,i=n(s);if(ir)e=s-1;else return s}return t>0?t-1:0};function Wje({measurements:t,outerSize:e,scrollOffset:n,lanes:r}){const s=t.length-1,i=c=>t[c].start;if(t.length<=r)return{startIndex:0,endIndex:s};let a=LV(0,s,i,n),o=a;if(r===1)for(;o1){const c=Array(r).fill(0);for(;of=0&&h.some(f=>f>=n);){const f=t[a];h[f.lane]=f.start,a--}a=Math.max(0,a-a%r),o=Math.min(s,o+(r-1-o%r))}return{startIndex:a,endIndex:o}}const rD=typeof document<"u"?b.useLayoutEffect:b.useEffect;function Gje(t){const e=b.useReducer(()=>({}),{})[1],n={...t,onChange:(s,i)=>{var a;i?fu.flushSync(e):e(),(a=t.onChange)==null||a.call(t,s,i)}},[r]=b.useState(()=>new Uje(n));return r.setOptions(n),rD(()=>r._didMount(),[]),rD(()=>r._willUpdate()),r}function Xje(t){return Gje({observeElementRect:$je,observeElementOffset:Qje,scrollToFn:Vje,...t})}function Yje(t,e,n="long"){return new Intl.DateTimeFormat("en-US",{hour:"numeric",timeZone:t,timeZoneName:n}).format(e).split(/\s/g).slice(2).join(" ")}const Kje={},km={};function yu(t,e){try{const r=(Kje[t]||=new Intl.DateTimeFormat("en-US",{timeZone:t,timeZoneName:"longOffset"}).format)(e).split("GMT")[1];return r in km?km[r]:sD(r,r.split(":"))}catch{if(t in km)return km[t];const n=t?.match(Zje);return n?sD(t,n.slice(1)):NaN}}const Zje=/([+-]\d\d):?(\d\d)?/;function sD(t,e){const n=+(e[0]||0),r=+(e[1]||0),s=+(e[2]||0)/60;return km[t]=n*60+r>0?n*60+r+s:n*60-r-s}class ll extends Date{constructor(...e){super(),e.length>1&&typeof e[e.length-1]=="string"&&(this.timeZone=e.pop()),this.internal=new Date,isNaN(yu(this.timeZone,this))?this.setTime(NaN):e.length?typeof e[0]=="number"&&(e.length===1||e.length===2&&typeof e[1]!="number")?this.setTime(e[0]):typeof e[0]=="string"?this.setTime(+new Date(e[0])):e[0]instanceof Date?this.setTime(+e[0]):(this.setTime(+new Date(...e)),IV(this),Dk(this)):this.setTime(Date.now())}static tz(e,...n){return n.length?new ll(...n,e):new ll(Date.now(),e)}withTimeZone(e){return new ll(+this,e)}getTimezoneOffset(){const e=-yu(this.timeZone,this);return e>0?Math.floor(e):Math.ceil(e)}setTime(e){return Date.prototype.setTime.apply(this,arguments),Dk(this),+this}[Symbol.for("constructDateFrom")](e){return new ll(+new Date(e),this.timeZone)}}const iD=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(t=>{if(!iD.test(t))return;const e=t.replace(iD,"$1UTC");ll.prototype[e]&&(t.startsWith("get")?ll.prototype[t]=function(){return this.internal[e]()}:(ll.prototype[t]=function(){return Date.prototype[e].apply(this.internal,arguments),Jje(this),+this},ll.prototype[e]=function(){return Date.prototype[e].apply(this,arguments),Dk(this),+this}))});function Dk(t){t.internal.setTime(+t),t.internal.setUTCSeconds(t.internal.getUTCSeconds()-Math.round(-yu(t.timeZone,t)*60))}function Jje(t){Date.prototype.setFullYear.call(t,t.internal.getUTCFullYear(),t.internal.getUTCMonth(),t.internal.getUTCDate()),Date.prototype.setHours.call(t,t.internal.getUTCHours(),t.internal.getUTCMinutes(),t.internal.getUTCSeconds(),t.internal.getUTCMilliseconds()),IV(t)}function IV(t){const e=yu(t.timeZone,t),n=e>0?Math.floor(e):Math.ceil(e),r=new Date(+t);r.setUTCHours(r.getUTCHours()-1);const s=-new Date(+t).getTimezoneOffset(),i=-new Date(+r).getTimezoneOffset(),a=s-i,o=Date.prototype.getHours.apply(t)!==t.internal.getUTCHours();a&&o&&t.internal.setUTCMinutes(t.internal.getUTCMinutes()+a);const c=s-n;c&&Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+c);const h=new Date(+t);h.setUTCSeconds(0);const f=s>0?h.getSeconds():(h.getSeconds()-60)%60,m=Math.round(-(yu(t.timeZone,t)*60))%60;(m||f)&&(t.internal.setUTCSeconds(t.internal.getUTCSeconds()+m),Date.prototype.setUTCSeconds.call(t,Date.prototype.getUTCSeconds.call(t)+m+f));const g=yu(t.timeZone,t),x=g>0?Math.floor(g):Math.ceil(g),w=-new Date(+t).getTimezoneOffset()-x,S=x!==n,k=w-c;if(S&&k){Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+k);const N=yu(t.timeZone,t),C=N>0?Math.floor(N):Math.ceil(N),T=x-C;T&&(t.internal.setUTCMinutes(t.internal.getUTCMinutes()+T),Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+T))}}class ks extends ll{static tz(e,...n){return n.length?new ks(...n,e):new ks(Date.now(),e)}toISOString(){const[e,n,r]=this.tzComponents(),s=`${e}${n}:${r}`;return this.internal.toISOString().slice(0,-1)+s}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[e,n,r,s]=this.internal.toUTCString().split(" ");return`${e?.slice(0,-1)} ${r} ${n} ${s}`}toTimeString(){const e=this.internal.toUTCString().split(" ")[4],[n,r,s]=this.tzComponents();return`${e} GMT${n}${r}${s} (${Yje(this.timeZone,this)})`}toLocaleString(e,n){return Date.prototype.toLocaleString.call(this,e,{...n,timeZone:n?.timeZone||this.timeZone})}toLocaleDateString(e,n){return Date.prototype.toLocaleDateString.call(this,e,{...n,timeZone:n?.timeZone||this.timeZone})}toLocaleTimeString(e,n){return Date.prototype.toLocaleTimeString.call(this,e,{...n,timeZone:n?.timeZone||this.timeZone})}tzComponents(){const e=this.getTimezoneOffset(),n=e>0?"-":"+",r=String(Math.floor(Math.abs(e)/60)).padStart(2,"0"),s=String(Math.abs(e)%60).padStart(2,"0");return[n,r,s]}withTimeZone(e){return new ks(+this,e)}[Symbol.for("constructDateFrom")](e){return new ks(+new Date(e),this.timeZone)}}const BV=6048e5,eOe=864e5,aD=Symbol.for("constructDateFrom");function Vr(t,e){return typeof t=="function"?t(e):t&&typeof t=="object"&&aD in t?t[aD](e):t instanceof Date?new t.constructor(e):new Date(e)}function Hn(t,e){return Vr(e||t,t)}function qV(t,e,n){const r=Hn(t,n?.in);return isNaN(e)?Vr(t,NaN):(e&&r.setDate(r.getDate()+e),r)}function FV(t,e,n){const r=Hn(t,n?.in);if(isNaN(e))return Vr(t,NaN);if(!e)return r;const s=r.getDate(),i=Vr(t,r.getTime());i.setMonth(r.getMonth()+e+1,0);const a=i.getDate();return s>=a?i:(r.setFullYear(i.getFullYear(),i.getMonth(),s),r)}let tOe={};function vp(){return tOe}function Ec(t,e){const n=vp(),r=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,s=Hn(t,e?.in),i=s.getDay(),a=(i=i.getTime()?r+1:n.getTime()>=o.getTime()?r:r-1}function lD(t){const e=Hn(t),n=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return n.setUTCFullYear(e.getFullYear()),+t-+n}function Wu(t,...e){const n=Vr.bind(null,t||e.find(r=>typeof r=="object"));return e.map(n)}function _0(t,e){const n=Hn(t,e?.in);return n.setHours(0,0,0,0),n}function QV(t,e,n){const[r,s]=Wu(n?.in,t,e),i=_0(r),a=_0(s),o=+i-lD(i),c=+a-lD(a);return Math.round((o-c)/eOe)}function nOe(t,e){const n=$V(t,e),r=Vr(t,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),E0(r)}function rOe(t,e,n){return qV(t,e*7,n)}function sOe(t,e,n){return FV(t,e*12,n)}function iOe(t,e){let n,r=e?.in;return t.forEach(s=>{!r&&typeof s=="object"&&(r=Vr.bind(null,s));const i=Hn(s,r);(!n||n{!r&&typeof s=="object"&&(r=Vr.bind(null,s));const i=Hn(s,r);(!n||n>i||isNaN(+i))&&(n=i)}),Vr(r,n||NaN)}function lOe(t,e,n){const[r,s]=Wu(n?.in,t,e);return+_0(r)==+_0(s)}function HV(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function oOe(t){return!(!HV(t)&&typeof t!="number"||isNaN(+Hn(t)))}function cOe(t,e,n){const[r,s]=Wu(n?.in,t,e),i=r.getFullYear()-s.getFullYear(),a=r.getMonth()-s.getMonth();return i*12+a}function uOe(t,e){const n=Hn(t,e?.in),r=n.getMonth();return n.setFullYear(n.getFullYear(),r+1,0),n.setHours(23,59,59,999),n}function VV(t,e){const[n,r]=Wu(t,e.start,e.end);return{start:n,end:r}}function dOe(t,e){const{start:n,end:r}=VV(e?.in,t);let s=+n>+r;const i=s?+n:+r,a=s?r:n;a.setHours(0,0,0,0),a.setDate(1);let o=1;const c=[];for(;+a<=i;)c.push(Vr(n,a)),a.setMonth(a.getMonth()+o);return s?c.reverse():c}function hOe(t,e){const n=Hn(t,e?.in);return n.setDate(1),n.setHours(0,0,0,0),n}function fOe(t,e){const n=Hn(t,e?.in),r=n.getFullYear();return n.setFullYear(r+1,0,0),n.setHours(23,59,59,999),n}function UV(t,e){const n=Hn(t,e?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}function mOe(t,e){const{start:n,end:r}=VV(e?.in,t);let s=+n>+r;const i=s?+n:+r,a=s?r:n;a.setHours(0,0,0,0),a.setMonth(0,1);let o=1;const c=[];for(;+a<=i;)c.push(Vr(n,a)),a.setFullYear(a.getFullYear()+o);return s?c.reverse():c}function WV(t,e){const n=vp(),r=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,s=Hn(t,e?.in),i=s.getDay(),a=(i{let r;const s=gOe[t];return typeof s=="string"?r=s:e===1?r=s.one:r=s.other.replace("{{count}}",e.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r};function fh(t){return(e={})=>{const n=e.width?String(e.width):t.defaultWidth;return t.formats[n]||t.formats[t.defaultWidth]}}const vOe={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},yOe={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},bOe={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},wOe={date:fh({formats:vOe,defaultWidth:"full"}),time:fh({formats:yOe,defaultWidth:"full"}),dateTime:fh({formats:bOe,defaultWidth:"full"})},SOe={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},kOe=(t,e,n,r)=>SOe[t];function el(t){return(e,n)=>{const r=n?.context?String(n.context):"standalone";let s;if(r==="formatting"&&t.formattingValues){const a=t.defaultFormattingWidth||t.defaultWidth,o=n?.width?String(n.width):a;s=t.formattingValues[o]||t.formattingValues[a]}else{const a=t.defaultWidth,o=n?.width?String(n.width):t.defaultWidth;s=t.values[o]||t.values[a]}const i=t.argumentCallback?t.argumentCallback(e):e;return s[i]}}const jOe={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},OOe={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},NOe={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},COe={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},TOe={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},EOe={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},_Oe=(t,e)=>{const n=Number(t),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},MOe={ordinalNumber:_Oe,era:el({values:jOe,defaultWidth:"wide"}),quarter:el({values:OOe,defaultWidth:"wide",argumentCallback:t=>t-1}),month:el({values:NOe,defaultWidth:"wide"}),day:el({values:COe,defaultWidth:"wide"}),dayPeriod:el({values:TOe,defaultWidth:"wide",formattingValues:EOe,defaultFormattingWidth:"wide"})};function tl(t){return(e,n={})=>{const r=n.width,s=r&&t.matchPatterns[r]||t.matchPatterns[t.defaultMatchWidth],i=e.match(s);if(!i)return null;const a=i[0],o=r&&t.parsePatterns[r]||t.parsePatterns[t.defaultParseWidth],c=Array.isArray(o)?ROe(o,m=>m.test(a)):AOe(o,m=>m.test(a));let h;h=t.valueCallback?t.valueCallback(c):c,h=n.valueCallback?n.valueCallback(h):h;const f=e.slice(a.length);return{value:h,rest:f}}}function AOe(t,e){for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&e(t[n]))return n}function ROe(t,e){for(let n=0;n{const r=e.match(t.matchPattern);if(!r)return null;const s=r[0],i=e.match(t.parsePattern);if(!i)return null;let a=t.valueCallback?t.valueCallback(i[0]):i[0];a=n.valueCallback?n.valueCallback(a):a;const o=e.slice(s.length);return{value:a,rest:o}}}const DOe=/^(\d+)(th|st|nd|rd)?/i,zOe=/\d+/i,POe={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},LOe={any:[/^b/i,/^(a|c)/i]},IOe={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},BOe={any:[/1/i,/2/i,/3/i,/4/i]},qOe={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},FOe={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},$Oe={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},QOe={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},HOe={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},VOe={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},UOe={ordinalNumber:GV({matchPattern:DOe,parsePattern:zOe,valueCallback:t=>parseInt(t,10)}),era:tl({matchPatterns:POe,defaultMatchWidth:"wide",parsePatterns:LOe,defaultParseWidth:"any"}),quarter:tl({matchPatterns:IOe,defaultMatchWidth:"wide",parsePatterns:BOe,defaultParseWidth:"any",valueCallback:t=>t+1}),month:tl({matchPatterns:qOe,defaultMatchWidth:"wide",parsePatterns:FOe,defaultParseWidth:"any"}),day:tl({matchPatterns:$Oe,defaultMatchWidth:"wide",parsePatterns:QOe,defaultParseWidth:"any"}),dayPeriod:tl({matchPatterns:HOe,defaultMatchWidth:"any",parsePatterns:VOe,defaultParseWidth:"any"})},EO={code:"en-US",formatDistance:xOe,formatLong:wOe,formatRelative:kOe,localize:MOe,match:UOe,options:{weekStartsOn:0,firstWeekContainsDate:1}};function WOe(t,e){const n=Hn(t,e?.in);return QV(n,UV(n))+1}function XV(t,e){const n=Hn(t,e?.in),r=+E0(n)-+nOe(n);return Math.round(r/BV)+1}function YV(t,e){const n=Hn(t,e?.in),r=n.getFullYear(),s=vp(),i=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??s.firstWeekContainsDate??s.locale?.options?.firstWeekContainsDate??1,a=Vr(e?.in||t,0);a.setFullYear(r+1,0,i),a.setHours(0,0,0,0);const o=Ec(a,e),c=Vr(e?.in||t,0);c.setFullYear(r,0,i),c.setHours(0,0,0,0);const h=Ec(c,e);return+n>=+o?r+1:+n>=+h?r:r-1}function GOe(t,e){const n=vp(),r=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,s=YV(t,e),i=Vr(e?.in||t,0);return i.setFullYear(s,0,r),i.setHours(0,0,0,0),Ec(i,e)}function KV(t,e){const n=Hn(t,e?.in),r=+Ec(n,e)-+GOe(n,e);return Math.round(r/BV)+1}function Ln(t,e){const n=t<0?"-":"",r=Math.abs(t).toString().padStart(e,"0");return n+r}const rc={y(t,e){const n=t.getFullYear(),r=n>0?n:1-n;return Ln(e==="yy"?r%100:r,e.length)},M(t,e){const n=t.getMonth();return e==="M"?String(n+1):Ln(n+1,2)},d(t,e){return Ln(t.getDate(),e.length)},a(t,e){const n=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h(t,e){return Ln(t.getHours()%12||12,e.length)},H(t,e){return Ln(t.getHours(),e.length)},m(t,e){return Ln(t.getMinutes(),e.length)},s(t,e){return Ln(t.getSeconds(),e.length)},S(t,e){const n=e.length,r=t.getMilliseconds(),s=Math.trunc(r*Math.pow(10,n-3));return Ln(s,e.length)}},Ld={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},oD={G:function(t,e,n){const r=t.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});case"GGGG":default:return n.era(r,{width:"wide"})}},y:function(t,e,n){if(e==="yo"){const r=t.getFullYear(),s=r>0?r:1-r;return n.ordinalNumber(s,{unit:"year"})}return rc.y(t,e)},Y:function(t,e,n,r){const s=YV(t,r),i=s>0?s:1-s;if(e==="YY"){const a=i%100;return Ln(a,2)}return e==="Yo"?n.ordinalNumber(i,{unit:"year"}):Ln(i,e.length)},R:function(t,e){const n=$V(t);return Ln(n,e.length)},u:function(t,e){const n=t.getFullYear();return Ln(n,e.length)},Q:function(t,e,n){const r=Math.ceil((t.getMonth()+1)/3);switch(e){case"Q":return String(r);case"QQ":return Ln(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(t,e,n){const r=Math.ceil((t.getMonth()+1)/3);switch(e){case"q":return String(r);case"qq":return Ln(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(t,e,n){const r=t.getMonth();switch(e){case"M":case"MM":return rc.M(t,e);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(t,e,n){const r=t.getMonth();switch(e){case"L":return String(r+1);case"LL":return Ln(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(t,e,n,r){const s=KV(t,r);return e==="wo"?n.ordinalNumber(s,{unit:"week"}):Ln(s,e.length)},I:function(t,e,n){const r=XV(t);return e==="Io"?n.ordinalNumber(r,{unit:"week"}):Ln(r,e.length)},d:function(t,e,n){return e==="do"?n.ordinalNumber(t.getDate(),{unit:"date"}):rc.d(t,e)},D:function(t,e,n){const r=WOe(t);return e==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):Ln(r,e.length)},E:function(t,e,n){const r=t.getDay();switch(e){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});case"EEEE":default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(t,e,n,r){const s=t.getDay(),i=(s-r.weekStartsOn+8)%7||7;switch(e){case"e":return String(i);case"ee":return Ln(i,2);case"eo":return n.ordinalNumber(i,{unit:"day"});case"eee":return n.day(s,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(s,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(s,{width:"short",context:"formatting"});case"eeee":default:return n.day(s,{width:"wide",context:"formatting"})}},c:function(t,e,n,r){const s=t.getDay(),i=(s-r.weekStartsOn+8)%7||7;switch(e){case"c":return String(i);case"cc":return Ln(i,e.length);case"co":return n.ordinalNumber(i,{unit:"day"});case"ccc":return n.day(s,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(s,{width:"narrow",context:"standalone"});case"cccccc":return n.day(s,{width:"short",context:"standalone"});case"cccc":default:return n.day(s,{width:"wide",context:"standalone"})}},i:function(t,e,n){const r=t.getDay(),s=r===0?7:r;switch(e){case"i":return String(s);case"ii":return Ln(s,e.length);case"io":return n.ordinalNumber(s,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});case"iiii":default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(t,e,n){const s=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(s,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},b:function(t,e,n){const r=t.getHours();let s;switch(r===12?s=Ld.noon:r===0?s=Ld.midnight:s=r/12>=1?"pm":"am",e){case"b":case"bb":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(s,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},B:function(t,e,n){const r=t.getHours();let s;switch(r>=17?s=Ld.evening:r>=12?s=Ld.afternoon:r>=4?s=Ld.morning:s=Ld.night,e){case"B":case"BB":case"BBB":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(s,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},h:function(t,e,n){if(e==="ho"){let r=t.getHours()%12;return r===0&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return rc.h(t,e)},H:function(t,e,n){return e==="Ho"?n.ordinalNumber(t.getHours(),{unit:"hour"}):rc.H(t,e)},K:function(t,e,n){const r=t.getHours()%12;return e==="Ko"?n.ordinalNumber(r,{unit:"hour"}):Ln(r,e.length)},k:function(t,e,n){let r=t.getHours();return r===0&&(r=24),e==="ko"?n.ordinalNumber(r,{unit:"hour"}):Ln(r,e.length)},m:function(t,e,n){return e==="mo"?n.ordinalNumber(t.getMinutes(),{unit:"minute"}):rc.m(t,e)},s:function(t,e,n){return e==="so"?n.ordinalNumber(t.getSeconds(),{unit:"second"}):rc.s(t,e)},S:function(t,e){return rc.S(t,e)},X:function(t,e,n){const r=t.getTimezoneOffset();if(r===0)return"Z";switch(e){case"X":return uD(r);case"XXXX":case"XX":return uu(r);case"XXXXX":case"XXX":default:return uu(r,":")}},x:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"x":return uD(r);case"xxxx":case"xx":return uu(r);case"xxxxx":case"xxx":default:return uu(r,":")}},O:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+cD(r,":");case"OOOO":default:return"GMT"+uu(r,":")}},z:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+cD(r,":");case"zzzz":default:return"GMT"+uu(r,":")}},t:function(t,e,n){const r=Math.trunc(+t/1e3);return Ln(r,e.length)},T:function(t,e,n){return Ln(+t,e.length)}};function cD(t,e=""){const n=t>0?"-":"+",r=Math.abs(t),s=Math.trunc(r/60),i=r%60;return i===0?n+String(s):n+String(s)+e+Ln(i,2)}function uD(t,e){return t%60===0?(t>0?"-":"+")+Ln(Math.abs(t)/60,2):uu(t,e)}function uu(t,e=""){const n=t>0?"-":"+",r=Math.abs(t),s=Ln(Math.trunc(r/60),2),i=Ln(r%60,2);return n+s+e+i}const dD=(t,e)=>{switch(t){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});case"PPPP":default:return e.date({width:"full"})}},ZV=(t,e)=>{switch(t){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});case"pppp":default:return e.time({width:"full"})}},XOe=(t,e)=>{const n=t.match(/(P+)(p+)?/)||[],r=n[1],s=n[2];if(!s)return dD(t,e);let i;switch(r){case"P":i=e.dateTime({width:"short"});break;case"PP":i=e.dateTime({width:"medium"});break;case"PPP":i=e.dateTime({width:"long"});break;case"PPPP":default:i=e.dateTime({width:"full"});break}return i.replace("{{date}}",dD(r,e)).replace("{{time}}",ZV(s,e))},YOe={p:ZV,P:XOe},KOe=/^D+$/,ZOe=/^Y+$/,JOe=["D","DD","YY","YYYY"];function eNe(t){return KOe.test(t)}function tNe(t){return ZOe.test(t)}function nNe(t,e,n){const r=rNe(t,e,n);if(console.warn(r),JOe.includes(t))throw new RangeError(r)}function rNe(t,e,n){const r=t[0]==="Y"?"years":"days of the month";return`Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${e}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const sNe=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,iNe=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,aNe=/^'([^]*?)'?$/,lNe=/''/g,oNe=/[a-zA-Z]/;function j1(t,e,n){const r=vp(),s=n?.locale??r.locale??EO,i=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,a=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,o=Hn(t,n?.in);if(!oOe(o))throw new RangeError("Invalid time value");let c=e.match(iNe).map(f=>{const m=f[0];if(m==="p"||m==="P"){const g=YOe[m];return g(f,s.formatLong)}return f}).join("").match(sNe).map(f=>{if(f==="''")return{isToken:!1,value:"'"};const m=f[0];if(m==="'")return{isToken:!1,value:cNe(f)};if(oD[m])return{isToken:!0,value:f};if(m.match(oNe))throw new RangeError("Format string contains an unescaped latin alphabet character `"+m+"`");return{isToken:!1,value:f}});s.localize.preprocessor&&(c=s.localize.preprocessor(o,c));const h={firstWeekContainsDate:i,weekStartsOn:a,locale:s};return c.map(f=>{if(!f.isToken)return f.value;const m=f.value;(!n?.useAdditionalWeekYearTokens&&tNe(m)||!n?.useAdditionalDayOfYearTokens&&eNe(m))&&nNe(m,e,String(t));const g=oD[m[0]];return g(o,m,s.localize,h)}).join("")}function cNe(t){const e=t.match(aNe);return e?e[1].replace(lNe,"'"):t}function uNe(t,e){const n=Hn(t,e?.in),r=n.getFullYear(),s=n.getMonth(),i=Vr(n,0);return i.setFullYear(r,s+1,0),i.setHours(0,0,0,0),i.getDate()}function dNe(t,e){return Hn(t,e?.in).getMonth()}function hNe(t,e){return Hn(t,e?.in).getFullYear()}function fNe(t,e){return+Hn(t)>+Hn(e)}function mNe(t,e){return+Hn(t)<+Hn(e)}function pNe(t,e,n){const[r,s]=Wu(n?.in,t,e);return+Ec(r,n)==+Ec(s,n)}function gNe(t,e,n){const[r,s]=Wu(n?.in,t,e);return r.getFullYear()===s.getFullYear()&&r.getMonth()===s.getMonth()}function xNe(t,e,n){const[r,s]=Wu(n?.in,t,e);return r.getFullYear()===s.getFullYear()}function vNe(t,e,n){const r=Hn(t,n?.in),s=r.getFullYear(),i=r.getDate(),a=Vr(t,0);a.setFullYear(s,e,15),a.setHours(0,0,0,0);const o=uNe(a);return r.setMonth(e,Math.min(i,o)),r}function yNe(t,e,n){const r=Hn(t,n?.in);return isNaN(+r)?Vr(t,NaN):(r.setFullYear(e),r)}const hD=5,bNe=4;function wNe(t,e){const n=e.startOfMonth(t),r=n.getDay()>0?n.getDay():7,s=e.addDays(t,-r+1),i=e.addDays(s,hD*7-1);return e.getMonth(t)===e.getMonth(i)?hD:bNe}function JV(t,e){const n=e.startOfMonth(t),r=n.getDay();return r===1?n:r===0?e.addDays(n,-6):e.addDays(n,-1*(r-1))}function SNe(t,e){const n=JV(t,e),r=wNe(t,e);return e.addDays(n,r*7-1)}class zi{constructor(e,n){this.Date=Date,this.today=()=>this.overrides?.today?this.overrides.today():this.options.timeZone?ks.tz(this.options.timeZone):new this.Date,this.newDate=(r,s,i)=>this.overrides?.newDate?this.overrides.newDate(r,s,i):this.options.timeZone?new ks(r,s,i,this.options.timeZone):new Date(r,s,i),this.addDays=(r,s)=>this.overrides?.addDays?this.overrides.addDays(r,s):qV(r,s),this.addMonths=(r,s)=>this.overrides?.addMonths?this.overrides.addMonths(r,s):FV(r,s),this.addWeeks=(r,s)=>this.overrides?.addWeeks?this.overrides.addWeeks(r,s):rOe(r,s),this.addYears=(r,s)=>this.overrides?.addYears?this.overrides.addYears(r,s):sOe(r,s),this.differenceInCalendarDays=(r,s)=>this.overrides?.differenceInCalendarDays?this.overrides.differenceInCalendarDays(r,s):QV(r,s),this.differenceInCalendarMonths=(r,s)=>this.overrides?.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(r,s):cOe(r,s),this.eachMonthOfInterval=r=>this.overrides?.eachMonthOfInterval?this.overrides.eachMonthOfInterval(r):dOe(r),this.eachYearOfInterval=r=>{const s=this.overrides?.eachYearOfInterval?this.overrides.eachYearOfInterval(r):mOe(r),i=new Set(s.map(o=>this.getYear(o)));if(i.size===s.length)return s;const a=[];return i.forEach(o=>{a.push(new Date(o,0,1))}),a},this.endOfBroadcastWeek=r=>this.overrides?.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(r):SNe(r,this),this.endOfISOWeek=r=>this.overrides?.endOfISOWeek?this.overrides.endOfISOWeek(r):pOe(r),this.endOfMonth=r=>this.overrides?.endOfMonth?this.overrides.endOfMonth(r):uOe(r),this.endOfWeek=(r,s)=>this.overrides?.endOfWeek?this.overrides.endOfWeek(r,s):WV(r,this.options),this.endOfYear=r=>this.overrides?.endOfYear?this.overrides.endOfYear(r):fOe(r),this.format=(r,s,i)=>{const a=this.overrides?.format?this.overrides.format(r,s,this.options):j1(r,s,this.options);return this.options.numerals&&this.options.numerals!=="latn"?this.replaceDigits(a):a},this.getISOWeek=r=>this.overrides?.getISOWeek?this.overrides.getISOWeek(r):XV(r),this.getMonth=(r,s)=>this.overrides?.getMonth?this.overrides.getMonth(r,this.options):dNe(r,this.options),this.getYear=(r,s)=>this.overrides?.getYear?this.overrides.getYear(r,this.options):hNe(r,this.options),this.getWeek=(r,s)=>this.overrides?.getWeek?this.overrides.getWeek(r,this.options):KV(r,this.options),this.isAfter=(r,s)=>this.overrides?.isAfter?this.overrides.isAfter(r,s):fNe(r,s),this.isBefore=(r,s)=>this.overrides?.isBefore?this.overrides.isBefore(r,s):mNe(r,s),this.isDate=r=>this.overrides?.isDate?this.overrides.isDate(r):HV(r),this.isSameDay=(r,s)=>this.overrides?.isSameDay?this.overrides.isSameDay(r,s):lOe(r,s),this.isSameMonth=(r,s)=>this.overrides?.isSameMonth?this.overrides.isSameMonth(r,s):gNe(r,s),this.isSameYear=(r,s)=>this.overrides?.isSameYear?this.overrides.isSameYear(r,s):xNe(r,s),this.max=r=>this.overrides?.max?this.overrides.max(r):iOe(r),this.min=r=>this.overrides?.min?this.overrides.min(r):aOe(r),this.setMonth=(r,s)=>this.overrides?.setMonth?this.overrides.setMonth(r,s):vNe(r,s),this.setYear=(r,s)=>this.overrides?.setYear?this.overrides.setYear(r,s):yNe(r,s),this.startOfBroadcastWeek=(r,s)=>this.overrides?.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(r,this):JV(r,this),this.startOfDay=r=>this.overrides?.startOfDay?this.overrides.startOfDay(r):_0(r),this.startOfISOWeek=r=>this.overrides?.startOfISOWeek?this.overrides.startOfISOWeek(r):E0(r),this.startOfMonth=r=>this.overrides?.startOfMonth?this.overrides.startOfMonth(r):hOe(r),this.startOfWeek=(r,s)=>this.overrides?.startOfWeek?this.overrides.startOfWeek(r,this.options):Ec(r,this.options),this.startOfYear=r=>this.overrides?.startOfYear?this.overrides.startOfYear(r):UV(r),this.options={locale:EO,...e},this.overrides=n}getDigitMap(){const{numerals:e="latn"}=this.options,n=new Intl.NumberFormat("en-US",{numberingSystem:e}),r={};for(let s=0;s<10;s++)r[s.toString()]=n.format(s);return r}replaceDigits(e){const n=this.getDigitMap();return e.replace(/\d/g,r=>n[r]||r)}formatNumber(e){return this.replaceDigits(e.toString())}getMonthYearOrder(){const e=this.options.locale?.code;return e&&zi.yearFirstLocales.has(e)?"year-first":"month-first"}formatMonthYear(e){const{locale:n,timeZone:r,numerals:s}=this.options,i=n?.code;if(i&&zi.yearFirstLocales.has(i))try{return new Intl.DateTimeFormat(i,{month:"long",year:"numeric",timeZone:r,numberingSystem:s}).format(e)}catch{}const a=this.getMonthYearOrder()==="year-first"?"y LLLL":"LLLL y";return this.format(e,a)}}zi.yearFirstLocales=new Set(["eu","hu","ja","ja-Hira","ja-JP","ko","ko-KR","lt","lt-LT","lv","lv-LV","mn","mn-MN","zh","zh-CN","zh-HK","zh-TW"]);const kl=new zi;class eU{constructor(e,n,r=kl){this.date=e,this.displayMonth=n,this.outside=!!(n&&!r.isSameMonth(e,n)),this.dateLib=r}isEqualTo(e){return this.dateLib.isSameDay(e.date,this.date)&&this.dateLib.isSameMonth(e.displayMonth,this.displayMonth)}}class kNe{constructor(e,n){this.date=e,this.weeks=n}}class jNe{constructor(e,n){this.days=n,this.weekNumber=e}}function ONe(t){return he.createElement("button",{...t})}function NNe(t){return he.createElement("span",{...t})}function CNe(t){const{size:e=24,orientation:n="left",className:r}=t;return he.createElement("svg",{className:r,width:e,height:e,viewBox:"0 0 24 24"},n==="up"&&he.createElement("polygon",{points:"6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28"}),n==="down"&&he.createElement("polygon",{points:"6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72"}),n==="left"&&he.createElement("polygon",{points:"16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20"}),n==="right"&&he.createElement("polygon",{points:"8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20"}))}function TNe(t){const{day:e,modifiers:n,...r}=t;return he.createElement("td",{...r})}function ENe(t){const{day:e,modifiers:n,...r}=t,s=he.useRef(null);return he.useEffect(()=>{n.focused&&s.current?.focus()},[n.focused]),he.createElement("button",{ref:s,...r})}var yt;(function(t){t.Root="root",t.Chevron="chevron",t.Day="day",t.DayButton="day_button",t.CaptionLabel="caption_label",t.Dropdowns="dropdowns",t.Dropdown="dropdown",t.DropdownRoot="dropdown_root",t.Footer="footer",t.MonthGrid="month_grid",t.MonthCaption="month_caption",t.MonthsDropdown="months_dropdown",t.Month="month",t.Months="months",t.Nav="nav",t.NextMonthButton="button_next",t.PreviousMonthButton="button_previous",t.Week="week",t.Weeks="weeks",t.Weekday="weekday",t.Weekdays="weekdays",t.WeekNumber="week_number",t.WeekNumberHeader="week_number_header",t.YearsDropdown="years_dropdown"})(yt||(yt={}));var mr;(function(t){t.disabled="disabled",t.hidden="hidden",t.outside="outside",t.focused="focused",t.today="today"})(mr||(mr={}));var ja;(function(t){t.range_end="range_end",t.range_middle="range_middle",t.range_start="range_start",t.selected="selected"})(ja||(ja={}));var Ci;(function(t){t.weeks_before_enter="weeks_before_enter",t.weeks_before_exit="weeks_before_exit",t.weeks_after_enter="weeks_after_enter",t.weeks_after_exit="weeks_after_exit",t.caption_after_enter="caption_after_enter",t.caption_after_exit="caption_after_exit",t.caption_before_enter="caption_before_enter",t.caption_before_exit="caption_before_exit"})(Ci||(Ci={}));function _Ne(t){const{options:e,className:n,components:r,classNames:s,...i}=t,a=[s[yt.Dropdown],n].join(" "),o=e?.find(({value:c})=>c===i.value);return he.createElement("span",{"data-disabled":i.disabled,className:s[yt.DropdownRoot]},he.createElement(r.Select,{className:a,...i},e?.map(({value:c,label:h,disabled:f})=>he.createElement(r.Option,{key:c,value:c,disabled:f},h))),he.createElement("span",{className:s[yt.CaptionLabel],"aria-hidden":!0},o?.label,he.createElement(r.Chevron,{orientation:"down",size:18,className:s[yt.Chevron]})))}function MNe(t){return he.createElement("div",{...t})}function ANe(t){return he.createElement("div",{...t})}function RNe(t){const{calendarMonth:e,displayIndex:n,...r}=t;return he.createElement("div",{...r},t.children)}function DNe(t){const{calendarMonth:e,displayIndex:n,...r}=t;return he.createElement("div",{...r})}function zNe(t){return he.createElement("table",{...t})}function PNe(t){return he.createElement("div",{...t})}const tU=b.createContext(void 0);function yp(){const t=b.useContext(tU);if(t===void 0)throw new Error("useDayPicker() must be used within a custom component.");return t}function LNe(t){const{components:e}=yp();return he.createElement(e.Dropdown,{...t})}function INe(t){const{onPreviousClick:e,onNextClick:n,previousMonth:r,nextMonth:s,...i}=t,{components:a,classNames:o,labels:{labelPrevious:c,labelNext:h}}=yp(),f=b.useCallback(g=>{s&&n?.(g)},[s,n]),m=b.useCallback(g=>{r&&e?.(g)},[r,e]);return he.createElement("nav",{...i},he.createElement(a.PreviousMonthButton,{type:"button",className:o[yt.PreviousMonthButton],tabIndex:r?void 0:-1,"aria-disabled":r?void 0:!0,"aria-label":c(r),onClick:m},he.createElement(a.Chevron,{disabled:r?void 0:!0,className:o[yt.Chevron],orientation:"left"})),he.createElement(a.NextMonthButton,{type:"button",className:o[yt.NextMonthButton],tabIndex:s?void 0:-1,"aria-disabled":s?void 0:!0,"aria-label":h(s),onClick:f},he.createElement(a.Chevron,{disabled:s?void 0:!0,orientation:"right",className:o[yt.Chevron]})))}function BNe(t){const{components:e}=yp();return he.createElement(e.Button,{...t})}function qNe(t){return he.createElement("option",{...t})}function FNe(t){const{components:e}=yp();return he.createElement(e.Button,{...t})}function $Ne(t){const{rootRef:e,...n}=t;return he.createElement("div",{...n,ref:e})}function QNe(t){return he.createElement("select",{...t})}function HNe(t){const{week:e,...n}=t;return he.createElement("tr",{...n})}function VNe(t){return he.createElement("th",{...t})}function UNe(t){return he.createElement("thead",{"aria-hidden":!0},he.createElement("tr",{...t}))}function WNe(t){const{week:e,...n}=t;return he.createElement("th",{...n})}function GNe(t){return he.createElement("th",{...t})}function XNe(t){return he.createElement("tbody",{...t})}function YNe(t){const{components:e}=yp();return he.createElement(e.Dropdown,{...t})}const KNe=Object.freeze(Object.defineProperty({__proto__:null,Button:ONe,CaptionLabel:NNe,Chevron:CNe,Day:TNe,DayButton:ENe,Dropdown:_Ne,DropdownNav:MNe,Footer:ANe,Month:RNe,MonthCaption:DNe,MonthGrid:zNe,Months:PNe,MonthsDropdown:LNe,Nav:INe,NextMonthButton:BNe,Option:qNe,PreviousMonthButton:FNe,Root:$Ne,Select:QNe,Week:HNe,WeekNumber:WNe,WeekNumberHeader:GNe,Weekday:VNe,Weekdays:UNe,Weeks:XNe,YearsDropdown:YNe},Symbol.toStringTag,{value:"Module"}));function io(t,e,n=!1,r=kl){let{from:s,to:i}=t;const{differenceInCalendarDays:a,isSameDay:o}=r;return s&&i?(a(i,s)<0&&([s,i]=[i,s]),a(e,s)>=(n?1:0)&&a(i,e)>=(n?1:0)):!n&&i?o(i,e):!n&&s?o(s,e):!1}function nU(t){return!!(t&&typeof t=="object"&&"before"in t&&"after"in t)}function _O(t){return!!(t&&typeof t=="object"&&"from"in t)}function rU(t){return!!(t&&typeof t=="object"&&"after"in t)}function sU(t){return!!(t&&typeof t=="object"&&"before"in t)}function iU(t){return!!(t&&typeof t=="object"&&"dayOfWeek"in t)}function aU(t,e){return Array.isArray(t)&&t.every(e.isDate)}function ao(t,e,n=kl){const r=Array.isArray(e)?e:[e],{isSameDay:s,differenceInCalendarDays:i,isAfter:a}=n;return r.some(o=>{if(typeof o=="boolean")return o;if(n.isDate(o))return s(t,o);if(aU(o,n))return o.includes(t);if(_O(o))return io(o,t,!1,n);if(iU(o))return Array.isArray(o.dayOfWeek)?o.dayOfWeek.includes(t.getDay()):o.dayOfWeek===t.getDay();if(nU(o)){const c=i(o.before,t),h=i(o.after,t),f=c>0,m=h<0;return a(o.before,o.after)?m&&f:f||m}return rU(o)?i(t,o.after)>0:sU(o)?i(o.before,t)>0:typeof o=="function"?o(t):!1})}function ZNe(t,e,n,r,s){const{disabled:i,hidden:a,modifiers:o,showOutsideDays:c,broadcastCalendar:h,today:f}=e,{isSameDay:m,isSameMonth:g,startOfMonth:x,isBefore:y,endOfMonth:w,isAfter:S}=s,k=n&&x(n),N=r&&w(r),C={[mr.focused]:[],[mr.outside]:[],[mr.disabled]:[],[mr.hidden]:[],[mr.today]:[]},T={};for(const _ of t){const{date:E,displayMonth:M}=_,L=!!(M&&!g(E,M)),P=!!(k&&y(E,k)),I=!!(N&&S(E,N)),Q=!!(i&&ao(E,i,s)),U=!!(a&&ao(E,a,s))||P||I||!h&&!c&&L||h&&c===!1&&L,ee=m(E,f??s.today());L&&C.outside.push(_),Q&&C.disabled.push(_),U&&C.hidden.push(_),ee&&C.today.push(_),o&&Object.keys(o).forEach(z=>{const H=o?.[z];H&&ao(E,H,s)&&(T[z]?T[z].push(_):T[z]=[_])})}return _=>{const E={[mr.focused]:!1,[mr.disabled]:!1,[mr.hidden]:!1,[mr.outside]:!1,[mr.today]:!1},M={};for(const L in C){const P=C[L];E[L]=P.some(I=>I===_)}for(const L in T)M[L]=T[L].some(P=>P===_);return{...E,...M}}}function JNe(t,e,n={}){return Object.entries(t).filter(([,s])=>s===!0).reduce((s,[i])=>(n[i]?s.push(n[i]):e[mr[i]]?s.push(e[mr[i]]):e[ja[i]]&&s.push(e[ja[i]]),s),[e[yt.Day]])}function e7e(t){return{...KNe,...t}}function t7e(t){const e={"data-mode":t.mode??void 0,"data-required":"required"in t?t.required:void 0,"data-multiple-months":t.numberOfMonths&&t.numberOfMonths>1||void 0,"data-week-numbers":t.showWeekNumber||void 0,"data-broadcast-calendar":t.broadcastCalendar||void 0,"data-nav-layout":t.navLayout||void 0};return Object.entries(t).forEach(([n,r])=>{n.startsWith("data-")&&(e[n]=r)}),e}function MO(){const t={};for(const e in yt)t[yt[e]]=`rdp-${yt[e]}`;for(const e in mr)t[mr[e]]=`rdp-${mr[e]}`;for(const e in ja)t[ja[e]]=`rdp-${ja[e]}`;for(const e in Ci)t[Ci[e]]=`rdp-${Ci[e]}`;return t}function lU(t,e,n){return(n??new zi(e)).formatMonthYear(t)}const n7e=lU;function r7e(t,e,n){return(n??new zi(e)).format(t,"d")}function s7e(t,e=kl){return e.format(t,"LLLL")}function i7e(t,e,n){return(n??new zi(e)).format(t,"cccccc")}function a7e(t,e=kl){return t<10?e.formatNumber(`0${t.toLocaleString()}`):e.formatNumber(`${t.toLocaleString()}`)}function l7e(){return""}function oU(t,e=kl){return e.format(t,"yyyy")}const o7e=oU,c7e=Object.freeze(Object.defineProperty({__proto__:null,formatCaption:lU,formatDay:r7e,formatMonthCaption:n7e,formatMonthDropdown:s7e,formatWeekNumber:a7e,formatWeekNumberHeader:l7e,formatWeekdayName:i7e,formatYearCaption:o7e,formatYearDropdown:oU},Symbol.toStringTag,{value:"Module"}));function u7e(t){return t?.formatMonthCaption&&!t.formatCaption&&(t.formatCaption=t.formatMonthCaption),t?.formatYearCaption&&!t.formatYearDropdown&&(t.formatYearDropdown=t.formatYearCaption),{...c7e,...t}}function d7e(t,e,n,r,s){const{startOfMonth:i,startOfYear:a,endOfYear:o,eachMonthOfInterval:c,getMonth:h}=s;return c({start:a(t),end:o(t)}).map(g=>{const x=r.formatMonthDropdown(g,s),y=h(g),w=e&&gi(n)||!1;return{value:y,label:x,disabled:w}})}function h7e(t,e={},n={}){let r={...e?.[yt.Day]};return Object.entries(t).filter(([,s])=>s===!0).forEach(([s])=>{r={...r,...n?.[s]}}),r}function f7e(t,e,n){const r=t.today(),s=e?t.startOfISOWeek(r):t.startOfWeek(r),i=[];for(let a=0;a<7;a++){const o=t.addDays(s,a);i.push(o)}return i}function m7e(t,e,n,r,s=!1){if(!t||!e)return;const{startOfYear:i,endOfYear:a,eachYearOfInterval:o,getYear:c}=r,h=i(t),f=a(e),m=o({start:h,end:f});return s&&m.reverse(),m.map(g=>{const x=n.formatYearDropdown(g,r);return{value:c(g),label:x,disabled:!1}})}function cU(t,e,n,r){let s=(r??new zi(n)).format(t,"PPPP");return e.today&&(s=`Today, ${s}`),e.selected&&(s=`${s}, selected`),s}const p7e=cU;function uU(t,e,n){return(n??new zi(e)).formatMonthYear(t)}const g7e=uU;function x7e(t,e,n,r){let s=(r??new zi(n)).format(t,"PPPP");return e?.today&&(s=`Today, ${s}`),s}function v7e(t){return"Choose the Month"}function y7e(){return""}function b7e(t){return"Go to the Next Month"}function w7e(t){return"Go to the Previous Month"}function S7e(t,e,n){return(n??new zi(e)).format(t,"cccc")}function k7e(t,e){return`Week ${t}`}function j7e(t){return"Week Number"}function O7e(t){return"Choose the Year"}const N7e=Object.freeze(Object.defineProperty({__proto__:null,labelCaption:g7e,labelDay:p7e,labelDayButton:cU,labelGrid:uU,labelGridcell:x7e,labelMonthDropdown:v7e,labelNav:y7e,labelNext:b7e,labelPrevious:w7e,labelWeekNumber:k7e,labelWeekNumberHeader:j7e,labelWeekday:S7e,labelYearDropdown:O7e},Symbol.toStringTag,{value:"Module"})),bp=t=>t instanceof HTMLElement?t:null,T3=t=>[...t.querySelectorAll("[data-animated-month]")??[]],C7e=t=>bp(t.querySelector("[data-animated-month]")),E3=t=>bp(t.querySelector("[data-animated-caption]")),_3=t=>bp(t.querySelector("[data-animated-weeks]")),T7e=t=>bp(t.querySelector("[data-animated-nav]")),E7e=t=>bp(t.querySelector("[data-animated-weekdays]"));function _7e(t,e,{classNames:n,months:r,focused:s,dateLib:i}){const a=b.useRef(null),o=b.useRef(r),c=b.useRef(!1);b.useLayoutEffect(()=>{const h=o.current;if(o.current=r,!e||!t.current||!(t.current instanceof HTMLElement)||r.length===0||h.length===0||r.length!==h.length)return;const f=i.isSameMonth(r[0].date,h[0].date),m=i.isAfter(r[0].date,h[0].date),g=m?n[Ci.caption_after_enter]:n[Ci.caption_before_enter],x=m?n[Ci.weeks_after_enter]:n[Ci.weeks_before_enter],y=a.current,w=t.current.cloneNode(!0);if(w instanceof HTMLElement?(T3(w).forEach(C=>{if(!(C instanceof HTMLElement))return;const T=C7e(C);T&&C.contains(T)&&C.removeChild(T);const _=E3(C);_&&_.classList.remove(g);const E=_3(C);E&&E.classList.remove(x)}),a.current=w):a.current=null,c.current||f||s)return;const S=y instanceof HTMLElement?T3(y):[],k=T3(t.current);if(k?.every(N=>N instanceof HTMLElement)&&S&&S.every(N=>N instanceof HTMLElement)){c.current=!0,t.current.style.isolation="isolate";const N=T7e(t.current);N&&(N.style.zIndex="1"),k.forEach((C,T)=>{const _=S[T];if(!_)return;C.style.position="relative",C.style.overflow="hidden";const E=E3(C);E&&E.classList.add(g);const M=_3(C);M&&M.classList.add(x);const L=()=>{c.current=!1,t.current&&(t.current.style.isolation=""),N&&(N.style.zIndex=""),E&&E.classList.remove(g),M&&M.classList.remove(x),C.style.position="",C.style.overflow="",C.contains(_)&&C.removeChild(_)};_.style.pointerEvents="none",_.style.position="absolute",_.style.overflow="hidden",_.setAttribute("aria-hidden","true");const P=E7e(_);P&&(P.style.opacity="0");const I=E3(_);I&&(I.classList.add(m?n[Ci.caption_before_exit]:n[Ci.caption_after_exit]),I.addEventListener("animationend",L));const Q=_3(_);Q&&Q.classList.add(m?n[Ci.weeks_before_exit]:n[Ci.weeks_after_exit]),C.insertBefore(_,C.firstChild)})}})}function M7e(t,e,n,r){const s=t[0],i=t[t.length-1],{ISOWeek:a,fixedWeeks:o,broadcastCalendar:c}=n??{},{addDays:h,differenceInCalendarDays:f,differenceInCalendarMonths:m,endOfBroadcastWeek:g,endOfISOWeek:x,endOfMonth:y,endOfWeek:w,isAfter:S,startOfBroadcastWeek:k,startOfISOWeek:N,startOfWeek:C}=r,T=c?k(s,r):a?N(s):C(s),_=c?g(i):a?x(y(i)):w(y(i)),E=f(_,T),M=m(i,s)+1,L=[];for(let Q=0;Q<=E;Q++){const U=h(T,Q);if(e&&S(U,e))break;L.push(U)}const I=(c?35:42)*M;if(o&&L.length{const s=r.weeks.reduce((i,a)=>i.concat(a.days.slice()),e.slice());return n.concat(s.slice())},e.slice())}function R7e(t,e,n,r){const{numberOfMonths:s=1}=n,i=[];for(let a=0;ae)break;i.push(o)}return i}function fD(t,e,n,r){const{month:s,defaultMonth:i,today:a=r.today(),numberOfMonths:o=1}=t;let c=s||i||a;const{differenceInCalendarMonths:h,addMonths:f,startOfMonth:m}=r;if(n&&h(n,c){const k=n.broadcastCalendar?m(S,r):n.ISOWeek?g(S):x(S),N=n.broadcastCalendar?i(S):n.ISOWeek?a(o(S)):c(o(S)),C=e.filter(M=>M>=k&&M<=N),T=n.broadcastCalendar?35:42;if(n.fixedWeeks&&C.length{const P=T-C.length;return L>N&&L<=s(N,P)});C.push(...M)}const _=C.reduce((M,L)=>{const P=n.ISOWeek?h(L):f(L),I=M.find(U=>U.weekNumber===P),Q=new eU(L,S,r);return I?I.days.push(Q):M.push(new jNe(P,[Q])),M},[]),E=new kNe(S,_);return w.push(E),w},[]);return n.reverseMonths?y.reverse():y}function z7e(t,e){let{startMonth:n,endMonth:r}=t;const{startOfYear:s,startOfDay:i,startOfMonth:a,endOfMonth:o,addYears:c,endOfYear:h,newDate:f,today:m}=e,{fromYear:g,toYear:x,fromMonth:y,toMonth:w}=t;!n&&y&&(n=y),!n&&g&&(n=e.newDate(g,0,1)),!r&&w&&(r=w),!r&&x&&(r=f(x,11,31));const S=t.captionLayout==="dropdown"||t.captionLayout==="dropdown-years";return n?n=a(n):g?n=f(g,0,1):!n&&S&&(n=s(c(t.today??m(),-100))),r?r=o(r):x?r=f(x,11,31):!r&&S&&(r=h(t.today??m())),[n&&i(n),r&&i(r)]}function P7e(t,e,n,r){if(n.disableNavigation)return;const{pagedNavigation:s,numberOfMonths:i=1}=n,{startOfMonth:a,addMonths:o,differenceInCalendarMonths:c}=r,h=s?i:1,f=a(t);if(!e)return o(f,h);if(!(c(e,t)n.concat(r.weeks.slice()),e.slice())}function qy(t,e){const[n,r]=b.useState(t);return[e===void 0?n:e,r]}function B7e(t,e){const[n,r]=z7e(t,e),{startOfMonth:s,endOfMonth:i}=e,a=fD(t,n,r,e),[o,c]=qy(a,t.month?a:void 0);b.useEffect(()=>{const E=fD(t,n,r,e);c(E)},[t.timeZone]);const h=R7e(o,r,t,e),f=M7e(h,t.endMonth?i(t.endMonth):void 0,t,e),m=D7e(h,f,t,e),g=I7e(m),x=A7e(m),y=L7e(o,n,t,e),w=P7e(o,r,t,e),{disableNavigation:S,onMonthChange:k}=t,N=E=>g.some(M=>M.days.some(L=>L.isEqualTo(E))),C=E=>{if(S)return;let M=s(E);n&&Ms(r)&&(M=s(r)),c(M),k?.(M)};return{months:m,weeks:g,days:x,navStart:n,navEnd:r,previousMonth:y,nextMonth:w,goToMonth:C,goToDay:E=>{N(E)||C(E.date)}}}var Ya;(function(t){t[t.Today=0]="Today",t[t.Selected=1]="Selected",t[t.LastFocused=2]="LastFocused",t[t.FocusedModifier=3]="FocusedModifier"})(Ya||(Ya={}));function mD(t){return!t[mr.disabled]&&!t[mr.hidden]&&!t[mr.outside]}function q7e(t,e,n,r){let s,i=-1;for(const a of t){const o=e(a);mD(o)&&(o[mr.focused]&&imD(e(a)))),s}function F7e(t,e,n,r,s,i,a){const{ISOWeek:o,broadcastCalendar:c}=i,{addDays:h,addMonths:f,addWeeks:m,addYears:g,endOfBroadcastWeek:x,endOfISOWeek:y,endOfWeek:w,max:S,min:k,startOfBroadcastWeek:N,startOfISOWeek:C,startOfWeek:T}=a;let E={day:h,week:m,month:f,year:g,startOfWeek:M=>c?N(M,a):o?C(M):T(M),endOfWeek:M=>c?x(M):o?y(M):w(M)}[t](n,e==="after"?1:-1);return e==="before"&&r?E=S([r,E]):e==="after"&&s&&(E=k([s,E])),E}function dU(t,e,n,r,s,i,a,o=0){if(o>365)return;const c=F7e(t,e,n.date,r,s,i,a),h=!!(i.disabled&&ao(c,i.disabled,a)),f=!!(i.hidden&&ao(c,i.hidden,a)),m=c,g=new eU(c,m,a);return!h&&!f?g:dU(t,e,g,r,s,i,a,o+1)}function $7e(t,e,n,r,s){const{autoFocus:i}=t,[a,o]=b.useState(),c=q7e(e.days,n,r||(()=>!1),a),[h,f]=b.useState(i?c:void 0);return{isFocusTarget:w=>!!c?.isEqualTo(w),setFocused:f,focused:h,blur:()=>{o(h),f(void 0)},moveFocus:(w,S)=>{if(!h)return;const k=dU(w,S,h,e.navStart,e.navEnd,t,s);k&&(t.disableNavigation&&!e.days.some(C=>C.isEqualTo(k))||(e.goToDay(k),f(k)))}}}function Q7e(t,e){const{selected:n,required:r,onSelect:s}=t,[i,a]=qy(n,s?n:void 0),o=s?n:i,{isSameDay:c}=e,h=x=>o?.some(y=>c(y,x))??!1,{min:f,max:m}=t;return{selected:o,select:(x,y,w)=>{let S=[...o??[]];if(h(x)){if(o?.length===f||r&&o?.length===1)return;S=o?.filter(k=>!c(k,x))}else o?.length===m?S=[x]:S=[...S,x];return s||a(S),s?.(S,x,y,w),S},isSelected:h}}function H7e(t,e,n=0,r=0,s=!1,i=kl){const{from:a,to:o}=e||{},{isSameDay:c,isAfter:h,isBefore:f}=i;let m;if(!a&&!o)m={from:t,to:n>0?void 0:t};else if(a&&!o)c(a,t)?n===0?m={from:a,to:t}:s?m={from:a,to:void 0}:m=void 0:f(t,a)?m={from:t,to:a}:m={from:a,to:t};else if(a&&o)if(c(a,t)&&c(o,t))s?m={from:a,to:o}:m=void 0;else if(c(a,t))m={from:a,to:n>0?void 0:t};else if(c(o,t))m={from:t,to:n>0?void 0:t};else if(f(t,a))m={from:t,to:o};else if(h(t,a))m={from:a,to:t};else if(h(t,o))m={from:a,to:t};else throw new Error("Invalid range");if(m?.from&&m?.to){const g=i.differenceInCalendarDays(m.to,m.from);r>0&&g>r?m={from:t,to:void 0}:n>1&&gtypeof o!="function").some(o=>typeof o=="boolean"?o:n.isDate(o)?io(t,o,!1,n):aU(o,n)?o.some(c=>io(t,c,!1,n)):_O(o)?o.from&&o.to?pD(t,{from:o.from,to:o.to},n):!1:iU(o)?V7e(t,o.dayOfWeek,n):nU(o)?n.isAfter(o.before,o.after)?pD(t,{from:n.addDays(o.after,1),to:n.addDays(o.before,-1)},n):ao(t.from,o,n)||ao(t.to,o,n):rU(o)||sU(o)?ao(t.from,o,n)||ao(t.to,o,n):!1))return!0;const a=r.filter(o=>typeof o=="function");if(a.length){let o=t.from;const c=n.differenceInCalendarDays(t.to,t.from);for(let h=0;h<=c;h++){if(a.some(f=>f(o)))return!0;o=n.addDays(o,1)}}return!1}function W7e(t,e){const{disabled:n,excludeDisabled:r,selected:s,required:i,onSelect:a}=t,[o,c]=qy(s,a?s:void 0),h=a?s:o;return{selected:h,select:(g,x,y)=>{const{min:w,max:S}=t,k=g?H7e(g,h,w,S,i,e):void 0;return r&&n&&k?.from&&k.to&&U7e({from:k.from,to:k.to},n,e)&&(k.from=g,k.to=void 0),a||c(k),a?.(k,g,x,y),k},isSelected:g=>h&&io(h,g,!1,e)}}function G7e(t,e){const{selected:n,required:r,onSelect:s}=t,[i,a]=qy(n,s?n:void 0),o=s?n:i,{isSameDay:c}=e;return{selected:o,select:(m,g,x)=>{let y=m;return!r&&o&&o&&c(m,o)&&(y=void 0),s||a(y),s?.(y,m,g,x),y},isSelected:m=>o?c(o,m):!1}}function X7e(t,e){const n=G7e(t,e),r=Q7e(t,e),s=W7e(t,e);switch(t.mode){case"single":return n;case"multiple":return r;case"range":return s;default:return}}function Y7e(t){let e=t;e.timeZone&&(e={...t},e.today&&(e.today=new ks(e.today,e.timeZone)),e.month&&(e.month=new ks(e.month,e.timeZone)),e.defaultMonth&&(e.defaultMonth=new ks(e.defaultMonth,e.timeZone)),e.startMonth&&(e.startMonth=new ks(e.startMonth,e.timeZone)),e.endMonth&&(e.endMonth=new ks(e.endMonth,e.timeZone)),e.mode==="single"&&e.selected?e.selected=new ks(e.selected,e.timeZone):e.mode==="multiple"&&e.selected?e.selected=e.selected?.map(ft=>new ks(ft,e.timeZone)):e.mode==="range"&&e.selected&&(e.selected={from:e.selected.from?new ks(e.selected.from,e.timeZone):void 0,to:e.selected.to?new ks(e.selected.to,e.timeZone):void 0}));const{components:n,formatters:r,labels:s,dateLib:i,locale:a,classNames:o}=b.useMemo(()=>{const ft={...EO,...e.locale};return{dateLib:new zi({locale:ft,weekStartsOn:e.broadcastCalendar?1:e.weekStartsOn,firstWeekContainsDate:e.firstWeekContainsDate,useAdditionalWeekYearTokens:e.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:e.useAdditionalDayOfYearTokens,timeZone:e.timeZone,numerals:e.numerals},e.dateLib),components:e7e(e.components),formatters:u7e(e.formatters),labels:{...N7e,...e.labels},locale:ft,classNames:{...MO(),...e.classNames}}},[e.locale,e.broadcastCalendar,e.weekStartsOn,e.firstWeekContainsDate,e.useAdditionalWeekYearTokens,e.useAdditionalDayOfYearTokens,e.timeZone,e.numerals,e.dateLib,e.components,e.formatters,e.labels,e.classNames]),{captionLayout:c,mode:h,navLayout:f,numberOfMonths:m=1,onDayBlur:g,onDayClick:x,onDayFocus:y,onDayKeyDown:w,onDayMouseEnter:S,onDayMouseLeave:k,onNextClick:N,onPrevClick:C,showWeekNumber:T,styles:_}=e,{formatCaption:E,formatDay:M,formatMonthDropdown:L,formatWeekNumber:P,formatWeekNumberHeader:I,formatWeekdayName:Q,formatYearDropdown:U}=r,ee=B7e(e,i),{days:z,months:H,navStart:B,navEnd:X,previousMonth:J,nextMonth:G,goToMonth:R}=ee,se=ZNe(z,e,B,X,i),{isSelected:W,select:F,selected:V}=X7e(e,i)??{},{blur:te,focused:ne,isFocusTarget:K,moveFocus:ie,setFocused:re}=$7e(e,ee,se,W??(()=>!1),i),{labelDayButton:ae,labelGridcell:_e,labelGrid:Ue,labelMonthDropdown:Xe,labelNav:Ze,labelPrevious:Oe,labelNext:He,labelWeekday:Ve,labelWeekNumber:Be,labelWeekNumberHeader:ut,labelYearDropdown:rt}=s,rn=b.useMemo(()=>f7e(i,e.ISOWeek),[i,e.ISOWeek]),Rn=h!==void 0||x!==void 0,Tn=b.useCallback(()=>{J&&(R(J),C?.(J))},[J,R,C]),Mt=b.useCallback(()=>{G&&(R(G),N?.(G))},[R,G,N]),vt=b.useCallback((ft,mn)=>gt=>{gt.preventDefault(),gt.stopPropagation(),re(ft),F?.(ft.date,mn,gt),x?.(ft.date,mn,gt)},[F,x,re]),Ce=b.useCallback((ft,mn)=>gt=>{re(ft),y?.(ft.date,mn,gt)},[y,re]),Le=b.useCallback((ft,mn)=>gt=>{te(),g?.(ft.date,mn,gt)},[te,g]),Ge=b.useCallback((ft,mn)=>gt=>{const Nt={ArrowLeft:[gt.shiftKey?"month":"day",e.dir==="rtl"?"after":"before"],ArrowRight:[gt.shiftKey?"month":"day",e.dir==="rtl"?"before":"after"],ArrowDown:[gt.shiftKey?"year":"week","after"],ArrowUp:[gt.shiftKey?"year":"week","before"],PageUp:[gt.shiftKey?"year":"month","before"],PageDown:[gt.shiftKey?"year":"month","after"],Home:["startOfWeek","before"],End:["endOfWeek","after"]};if(Nt[gt.key]){gt.preventDefault(),gt.stopPropagation();const[Ot,it]=Nt[gt.key];ie(Ot,it)}w?.(ft.date,mn,gt)},[ie,w,e.dir]),lt=b.useCallback((ft,mn)=>gt=>{S?.(ft.date,mn,gt)},[S]),jt=b.useCallback((ft,mn)=>gt=>{k?.(ft.date,mn,gt)},[k]),Tt=b.useCallback(ft=>mn=>{const gt=Number(mn.target.value),Nt=i.setMonth(i.startOfMonth(ft),gt);R(Nt)},[i,R]),ke=b.useCallback(ft=>mn=>{const gt=Number(mn.target.value),Nt=i.setYear(i.startOfMonth(ft),gt);R(Nt)},[i,R]),{className:Te,style:qe}=b.useMemo(()=>({className:[o[yt.Root],e.className].filter(Boolean).join(" "),style:{..._?.[yt.Root],...e.style}}),[o,e.className,e.style,_]),Rt=t7e(e),At=b.useRef(null);_7e(At,!!e.animate,{classNames:o,months:H,focused:ne,dateLib:i});const vr={dayPickerProps:e,selected:V,select:F,isSelected:W,months:H,nextMonth:G,previousMonth:J,goToMonth:R,getModifiers:se,components:n,classNames:o,styles:_,labels:s,formatters:r};return he.createElement(tU.Provider,{value:vr},he.createElement(n.Root,{rootRef:e.animate?At:void 0,className:Te,style:qe,dir:e.dir,id:e.id,lang:e.lang,nonce:e.nonce,title:e.title,role:e.role,"aria-label":e["aria-label"],"aria-labelledby":e["aria-labelledby"],...Rt},he.createElement(n.Months,{className:o[yt.Months],style:_?.[yt.Months]},!e.hideNavigation&&!f&&he.createElement(n.Nav,{"data-animated-nav":e.animate?"true":void 0,className:o[yt.Nav],style:_?.[yt.Nav],"aria-label":Ze(),onPreviousClick:Tn,onNextClick:Mt,previousMonth:J,nextMonth:G}),H.map((ft,mn)=>he.createElement(n.Month,{"data-animated-month":e.animate?"true":void 0,className:o[yt.Month],style:_?.[yt.Month],key:mn,displayIndex:mn,calendarMonth:ft},f==="around"&&!e.hideNavigation&&mn===0&&he.createElement(n.PreviousMonthButton,{type:"button",className:o[yt.PreviousMonthButton],tabIndex:J?void 0:-1,"aria-disabled":J?void 0:!0,"aria-label":Oe(J),onClick:Tn,"data-animated-button":e.animate?"true":void 0},he.createElement(n.Chevron,{disabled:J?void 0:!0,className:o[yt.Chevron],orientation:e.dir==="rtl"?"right":"left"})),he.createElement(n.MonthCaption,{"data-animated-caption":e.animate?"true":void 0,className:o[yt.MonthCaption],style:_?.[yt.MonthCaption],calendarMonth:ft,displayIndex:mn},c?.startsWith("dropdown")?he.createElement(n.DropdownNav,{className:o[yt.Dropdowns],style:_?.[yt.Dropdowns]},(()=>{const gt=c==="dropdown"||c==="dropdown-months"?he.createElement(n.MonthsDropdown,{key:"month",className:o[yt.MonthsDropdown],"aria-label":Xe(),classNames:o,components:n,disabled:!!e.disableNavigation,onChange:Tt(ft.date),options:d7e(ft.date,B,X,r,i),style:_?.[yt.Dropdown],value:i.getMonth(ft.date)}):he.createElement("span",{key:"month"},L(ft.date,i)),Nt=c==="dropdown"||c==="dropdown-years"?he.createElement(n.YearsDropdown,{key:"year",className:o[yt.YearsDropdown],"aria-label":rt(i.options),classNames:o,components:n,disabled:!!e.disableNavigation,onChange:ke(ft.date),options:m7e(B,X,r,i,!!e.reverseYears),style:_?.[yt.Dropdown],value:i.getYear(ft.date)}):he.createElement("span",{key:"year"},U(ft.date,i));return i.getMonthYearOrder()==="year-first"?[Nt,gt]:[gt,Nt]})(),he.createElement("span",{role:"status","aria-live":"polite",style:{border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap",wordWrap:"normal"}},E(ft.date,i.options,i))):he.createElement(n.CaptionLabel,{className:o[yt.CaptionLabel],role:"status","aria-live":"polite"},E(ft.date,i.options,i))),f==="around"&&!e.hideNavigation&&mn===m-1&&he.createElement(n.NextMonthButton,{type:"button",className:o[yt.NextMonthButton],tabIndex:G?void 0:-1,"aria-disabled":G?void 0:!0,"aria-label":He(G),onClick:Mt,"data-animated-button":e.animate?"true":void 0},he.createElement(n.Chevron,{disabled:G?void 0:!0,className:o[yt.Chevron],orientation:e.dir==="rtl"?"left":"right"})),mn===m-1&&f==="after"&&!e.hideNavigation&&he.createElement(n.Nav,{"data-animated-nav":e.animate?"true":void 0,className:o[yt.Nav],style:_?.[yt.Nav],"aria-label":Ze(),onPreviousClick:Tn,onNextClick:Mt,previousMonth:J,nextMonth:G}),he.createElement(n.MonthGrid,{role:"grid","aria-multiselectable":h==="multiple"||h==="range","aria-label":Ue(ft.date,i.options,i)||void 0,className:o[yt.MonthGrid],style:_?.[yt.MonthGrid]},!e.hideWeekdays&&he.createElement(n.Weekdays,{"data-animated-weekdays":e.animate?"true":void 0,className:o[yt.Weekdays],style:_?.[yt.Weekdays]},T&&he.createElement(n.WeekNumberHeader,{"aria-label":ut(i.options),className:o[yt.WeekNumberHeader],style:_?.[yt.WeekNumberHeader],scope:"col"},I()),rn.map(gt=>he.createElement(n.Weekday,{"aria-label":Ve(gt,i.options,i),className:o[yt.Weekday],key:String(gt),style:_?.[yt.Weekday],scope:"col"},Q(gt,i.options,i)))),he.createElement(n.Weeks,{"data-animated-weeks":e.animate?"true":void 0,className:o[yt.Weeks],style:_?.[yt.Weeks]},ft.weeks.map(gt=>he.createElement(n.Week,{className:o[yt.Week],key:gt.weekNumber,style:_?.[yt.Week],week:gt},T&&he.createElement(n.WeekNumber,{week:gt,style:_?.[yt.WeekNumber],"aria-label":Be(gt.weekNumber,{locale:a}),className:o[yt.WeekNumber],scope:"row",role:"rowheader"},P(gt.weekNumber,i)),gt.days.map(Nt=>{const{date:Ot}=Nt,it=se(Nt);if(it[mr.focused]=!it.hidden&&!!ne?.isEqualTo(Nt),it[ja.selected]=W?.(Ot)||it.selected,_O(V)){const{from:ge,to:ze}=V;it[ja.range_start]=!!(ge&&ze&&i.isSameDay(Ot,ge)),it[ja.range_end]=!!(ge&&ze&&i.isSameDay(Ot,ze)),it[ja.range_middle]=io(V,Ot,!0,i)}const Vn=h7e(it,_,e.modifiersStyles),jr=JNe(it,o,e.modifiersClassNames),Or=!Rn&&!it.hidden?_e(Ot,it,i.options,i):void 0;return he.createElement(n.Day,{key:`${i.format(Ot,"yyyy-MM-dd")}_${i.format(Nt.displayMonth,"yyyy-MM")}`,day:Nt,modifiers:it,className:jr.join(" "),style:Vn,role:"gridcell","aria-selected":it.selected||void 0,"aria-label":Or,"data-day":i.format(Ot,"yyyy-MM-dd"),"data-month":Nt.outside?i.format(Ot,"yyyy-MM"):void 0,"data-selected":it.selected||void 0,"data-disabled":it.disabled||void 0,"data-hidden":it.hidden||void 0,"data-outside":Nt.outside||void 0,"data-focused":it.focused||void 0,"data-today":it.today||void 0},!it.hidden&&Rn?he.createElement(n.DayButton,{className:o[yt.DayButton],style:_?.[yt.DayButton],type:"button",day:Nt,modifiers:it,disabled:it.disabled||void 0,tabIndex:K(Nt)?0:-1,"aria-label":ae(Ot,it,i.options,i),onClick:vt(Nt,it),onBlur:Le(Nt,it),onFocus:Ce(Nt,it),onKeyDown:Ge(Nt,it),onMouseEnter:lt(Nt,it),onMouseLeave:jt(Nt,it)},M(Ot,i.options,i)):!it.hidden&&M(Nt.date,i.options,i))})))))))),e.footer&&he.createElement(n.Footer,{className:o[yt.Footer],style:_?.[yt.Footer],role:"status","aria-live":"polite"},e.footer)))}function gD({className:t,classNames:e,showOutsideDays:n=!0,captionLayout:r="label",buttonVariant:s="ghost",formatters:i,components:a,...o}){const c=MO();return l.jsx(Y7e,{showOutsideDays:n,className:ve("bg-background group/calendar p-3 [--cell-size:2rem] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,t),captionLayout:r,formatters:{formatMonthDropdown:h=>h.toLocaleString("default",{month:"short"}),...i},classNames:{root:ve("w-fit",c.root),months:ve("relative flex flex-col gap-4 md:flex-row",c.months),month:ve("flex w-full flex-col gap-4",c.month),nav:ve("absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1",c.nav),button_previous:ve(Hm({variant:s}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",c.button_previous),button_next:ve(Hm({variant:s}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",c.button_next),month_caption:ve("flex h-[--cell-size] w-full items-center justify-center px-[--cell-size]",c.month_caption),dropdowns:ve("flex h-[--cell-size] w-full items-center justify-center gap-1.5 text-sm font-medium",c.dropdowns),dropdown_root:ve("has-focus:border-ring border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] relative rounded-md border",c.dropdown_root),dropdown:ve("bg-popover absolute inset-0 opacity-0",c.dropdown),caption_label:ve("select-none font-medium",r==="label"?"text-sm":"[&>svg]:text-muted-foreground flex h-8 items-center gap-1 rounded-md pl-2 pr-1 text-sm [&>svg]:size-3.5",c.caption_label),table:"w-full border-collapse",weekdays:ve("flex",c.weekdays),weekday:ve("text-muted-foreground flex-1 select-none rounded-md text-[0.8rem] font-normal",c.weekday),week:ve("mt-2 flex w-full",c.week),week_number_header:ve("w-[--cell-size] select-none",c.week_number_header),week_number:ve("text-muted-foreground select-none text-[0.8rem]",c.week_number),day:ve("group/day relative aspect-square h-full w-full select-none p-0 text-center [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md",c.day),range_start:ve("bg-accent rounded-l-md",c.range_start),range_middle:ve("rounded-none",c.range_middle),range_end:ve("bg-accent rounded-r-md",c.range_end),today:ve("bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",c.today),outside:ve("text-muted-foreground aria-selected:text-muted-foreground",c.outside),disabled:ve("text-muted-foreground opacity-50",c.disabled),hidden:ve("invisible",c.hidden),...e},components:{Root:({className:h,rootRef:f,...m})=>l.jsx("div",{"data-slot":"calendar",ref:f,className:ve(h),...m}),Chevron:({className:h,orientation:f,...m})=>f==="left"?l.jsx($u,{className:ve("size-4",h),...m}):f==="right"?l.jsx(Qu,{className:ve("size-4",h),...m}):l.jsx(Tu,{className:ve("size-4",h),...m}),DayButton:K7e,WeekNumber:({children:h,...f})=>l.jsx("td",{...f,children:l.jsx("div",{className:"flex size-[--cell-size] items-center justify-center text-center",children:h})}),...a},...o})}function K7e({className:t,day:e,modifiers:n,...r}){const s=MO(),i=b.useRef(null);return b.useEffect(()=>{n.focused&&i.current?.focus()},[n.focused]),l.jsx(de,{ref:i,variant:"ghost",size:"icon","data-day":e.date.toLocaleDateString(),"data-selected-single":n.selected&&!n.range_start&&!n.range_end&&!n.range_middle,"data-range-start":n.range_start,"data-range-end":n.range_end,"data-range-middle":n.range_middle,className:ve("data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 flex aspect-square h-auto w-full min-w-[--cell-size] flex-col gap-1 font-normal leading-none data-[range-end=true]:rounded-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] [&>span]:text-xs [&>span]:opacity-70",s.day,t),...r})}class Z7e{ws=null;reconnectTimeout=null;reconnectAttempts=0;maxReconnectAttempts=10;heartbeatInterval=null;logCallbacks=new Set;connectionCallbacks=new Set;isConnected=!1;logCache=[];maxCacheSize=1e3;getWebSocketUrl(){{const e=window.location.protocol==="https:"?"wss:":"ws:",n=window.location.host;return`${e}//${n}/ws/logs`}}connect(){if(this.ws?.readyState===WebSocket.OPEN||this.ws?.readyState===WebSocket.CONNECTING)return;const e=this.getWebSocketUrl();try{this.ws=new WebSocket(e),this.ws.onopen=()=>{this.isConnected=!0,this.reconnectAttempts=0,this.notifyConnection(!0),this.startHeartbeat()},this.ws.onmessage=n=>{try{if(n.data==="pong")return;const r=JSON.parse(n.data);this.notifyLog(r)}catch(r){console.error("解析日志消息失败:",r)}},this.ws.onerror=n=>{console.error("❌ WebSocket 错误:",n),this.isConnected=!1,this.notifyConnection(!1)},this.ws.onclose=()=>{this.isConnected=!1,this.notifyConnection(!1),this.stopHeartbeat(),this.attemptReconnect()}}catch(n){console.error("创建 WebSocket 连接失败:",n),this.attemptReconnect()}}attemptReconnect(){if(this.reconnectAttempts>=this.maxReconnectAttempts)return;this.reconnectAttempts+=1;const e=Math.min(1e3*this.reconnectAttempts,1e4);this.reconnectTimeout=window.setTimeout(()=>{this.connect()},e)}startHeartbeat(){this.heartbeatInterval=window.setInterval(()=>{this.ws?.readyState===WebSocket.OPEN&&this.ws.send("ping")},3e4)}stopHeartbeat(){this.heartbeatInterval!==null&&(clearInterval(this.heartbeatInterval),this.heartbeatInterval=null)}disconnect(){this.reconnectTimeout!==null&&(clearTimeout(this.reconnectTimeout),this.reconnectTimeout=null),this.stopHeartbeat(),this.ws&&(this.ws.close(),this.ws=null),this.isConnected=!1,this.reconnectAttempts=0}onLog(e){return this.logCallbacks.add(e),()=>this.logCallbacks.delete(e)}onConnectionChange(e){return this.connectionCallbacks.add(e),e(this.isConnected),()=>this.connectionCallbacks.delete(e)}notifyLog(e){this.logCache.some(r=>r.id===e.id)||(this.logCache.push(e),this.logCache.length>this.maxCacheSize&&(this.logCache=this.logCache.slice(-this.maxCacheSize)),this.logCallbacks.forEach(r=>{try{r(e)}catch(s){console.error("日志回调执行失败:",s)}}))}notifyConnection(e){this.connectionCallbacks.forEach(n=>{try{n(e)}catch(r){console.error("连接状态回调执行失败:",r)}})}getAllLogs(){return[...this.logCache]}clearLogs(){this.logCache=[]}getConnectionStatus(){return this.isConnected}}const Ud=new Z7e;typeof window<"u"&&Ud.connect();const J7e={lessThanXSeconds:{one:"不到 1 秒",other:"不到 {{count}} 秒"},xSeconds:{one:"1 秒",other:"{{count}} 秒"},halfAMinute:"半分钟",lessThanXMinutes:{one:"不到 1 分钟",other:"不到 {{count}} 分钟"},xMinutes:{one:"1 分钟",other:"{{count}} 分钟"},xHours:{one:"1 小时",other:"{{count}} 小时"},aboutXHours:{one:"大约 1 小时",other:"大约 {{count}} 小时"},xDays:{one:"1 天",other:"{{count}} 天"},aboutXWeeks:{one:"大约 1 个星期",other:"大约 {{count}} 个星期"},xWeeks:{one:"1 个星期",other:"{{count}} 个星期"},aboutXMonths:{one:"大约 1 个月",other:"大约 {{count}} 个月"},xMonths:{one:"1 个月",other:"{{count}} 个月"},aboutXYears:{one:"大约 1 年",other:"大约 {{count}} 年"},xYears:{one:"1 年",other:"{{count}} 年"},overXYears:{one:"超过 1 年",other:"超过 {{count}} 年"},almostXYears:{one:"将近 1 年",other:"将近 {{count}} 年"}},e8e=(t,e,n)=>{let r;const s=J7e[t];return typeof s=="string"?r=s:e===1?r=s.one:r=s.other.replace("{{count}}",String(e)),n?.addSuffix?n.comparison&&n.comparison>0?r+"内":r+"前":r},t8e={full:"y'年'M'月'd'日' EEEE",long:"y'年'M'月'd'日'",medium:"yyyy-MM-dd",short:"yy-MM-dd"},n8e={full:"zzzz a h:mm:ss",long:"z a h:mm:ss",medium:"a h:mm:ss",short:"a h:mm"},r8e={full:"{{date}} {{time}}",long:"{{date}} {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},s8e={date:fh({formats:t8e,defaultWidth:"full"}),time:fh({formats:n8e,defaultWidth:"full"}),dateTime:fh({formats:r8e,defaultWidth:"full"})};function xD(t,e,n){const r="eeee p";return pNe(t,e,n)?r:t.getTime()>e.getTime()?"'下个'"+r:"'上个'"+r}const i8e={lastWeek:xD,yesterday:"'昨天' p",today:"'今天' p",tomorrow:"'明天' p",nextWeek:xD,other:"PP p"},a8e=(t,e,n,r)=>{const s=i8e[t];return typeof s=="function"?s(e,n,r):s},l8e={narrow:["前","公元"],abbreviated:["前","公元"],wide:["公元前","公元"]},o8e={narrow:["1","2","3","4"],abbreviated:["第一季","第二季","第三季","第四季"],wide:["第一季度","第二季度","第三季度","第四季度"]},c8e={narrow:["一","二","三","四","五","六","七","八","九","十","十一","十二"],abbreviated:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],wide:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]},u8e={narrow:["日","一","二","三","四","五","六"],short:["日","一","二","三","四","五","六"],abbreviated:["周日","周一","周二","周三","周四","周五","周六"],wide:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"]},d8e={narrow:{am:"上",pm:"下",midnight:"凌晨",noon:"午",morning:"早",afternoon:"下午",evening:"晚",night:"夜"},abbreviated:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"},wide:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"}},h8e={narrow:{am:"上",pm:"下",midnight:"凌晨",noon:"午",morning:"早",afternoon:"下午",evening:"晚",night:"夜"},abbreviated:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"},wide:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"}},f8e=(t,e)=>{const n=Number(t);switch(e?.unit){case"date":return n.toString()+"日";case"hour":return n.toString()+"时";case"minute":return n.toString()+"分";case"second":return n.toString()+"秒";default:return"第 "+n.toString()}},m8e={ordinalNumber:f8e,era:el({values:l8e,defaultWidth:"wide"}),quarter:el({values:o8e,defaultWidth:"wide",argumentCallback:t=>t-1}),month:el({values:c8e,defaultWidth:"wide"}),day:el({values:u8e,defaultWidth:"wide"}),dayPeriod:el({values:d8e,defaultWidth:"wide",formattingValues:h8e,defaultFormattingWidth:"wide"})},p8e=/^(第\s*)?\d+(日|时|分|秒)?/i,g8e=/\d+/i,x8e={narrow:/^(前)/i,abbreviated:/^(前)/i,wide:/^(公元前|公元)/i},v8e={any:[/^(前)/i,/^(公元)/i]},y8e={narrow:/^[1234]/i,abbreviated:/^第[一二三四]刻/i,wide:/^第[一二三四]刻钟/i},b8e={any:[/(1|一)/i,/(2|二)/i,/(3|三)/i,/(4|四)/i]},w8e={narrow:/^(一|二|三|四|五|六|七|八|九|十[二一])/i,abbreviated:/^(一|二|三|四|五|六|七|八|九|十[二一]|\d|1[12])月/i,wide:/^(一|二|三|四|五|六|七|八|九|十[二一])月/i},S8e={narrow:[/^一/i,/^二/i,/^三/i,/^四/i,/^五/i,/^六/i,/^七/i,/^八/i,/^九/i,/^十(?!(一|二))/i,/^十一/i,/^十二/i],any:[/^一|1/i,/^二|2/i,/^三|3/i,/^四|4/i,/^五|5/i,/^六|6/i,/^七|7/i,/^八|8/i,/^九|9/i,/^十(?!(一|二))|10/i,/^十一|11/i,/^十二|12/i]},k8e={narrow:/^[一二三四五六日]/i,short:/^[一二三四五六日]/i,abbreviated:/^周[一二三四五六日]/i,wide:/^星期[一二三四五六日]/i},j8e={any:[/日/i,/一/i,/二/i,/三/i,/四/i,/五/i,/六/i]},O8e={any:/^(上午?|下午?|午夜|[中正]午|早上?|下午|晚上?|凌晨|)/i},N8e={any:{am:/^上午?/i,pm:/^下午?/i,midnight:/^午夜/i,noon:/^[中正]午/i,morning:/^早上/i,afternoon:/^下午/i,evening:/^晚上?/i,night:/^凌晨/i}},C8e={ordinalNumber:GV({matchPattern:p8e,parsePattern:g8e,valueCallback:t=>parseInt(t,10)}),era:tl({matchPatterns:x8e,defaultMatchWidth:"wide",parsePatterns:v8e,defaultParseWidth:"any"}),quarter:tl({matchPatterns:y8e,defaultMatchWidth:"wide",parsePatterns:b8e,defaultParseWidth:"any",valueCallback:t=>t+1}),month:tl({matchPatterns:w8e,defaultMatchWidth:"wide",parsePatterns:S8e,defaultParseWidth:"any"}),day:tl({matchPatterns:k8e,defaultMatchWidth:"wide",parsePatterns:j8e,defaultParseWidth:"any"}),dayPeriod:tl({matchPatterns:O8e,defaultMatchWidth:"any",parsePatterns:N8e,defaultParseWidth:"any"})},Hx={code:"zh-CN",formatDistance:e8e,formatLong:s8e,formatRelative:a8e,localize:m8e,match:C8e,options:{weekStartsOn:1,firstWeekContainsDate:4}},Vx={xs:{label:"小",rowHeight:28,class:"text-[10px] sm:text-xs"},sm:{label:"中",rowHeight:36,class:"text-xs sm:text-sm"},base:{label:"大",rowHeight:44,class:"text-sm sm:text-base"}};function T8e(){const[t,e]=b.useState([]),[n,r]=b.useState(""),[s,i]=b.useState("all"),[a,o]=b.useState("all"),[c,h]=b.useState(void 0),[f,m]=b.useState(void 0),[g,x]=b.useState(!0),[y,w]=b.useState(!1),[S,k]=b.useState("xs"),[N,C]=b.useState(4),T=b.useRef(null);b.useEffect(()=>{const B=Ud.getAllLogs();e(B);const X=Ud.onLog(()=>{e(Ud.getAllLogs())}),J=Ud.onConnectionChange(G=>{w(G)});return()=>{X(),J()}},[]);const _=b.useMemo(()=>{const B=new Set(t.map(X=>X.module));return Array.from(B).sort()},[t]),E=B=>{switch(B){case"DEBUG":return"text-muted-foreground";case"INFO":return"text-blue-500 dark:text-blue-400";case"WARNING":return"text-yellow-600 dark:text-yellow-500";case"ERROR":return"text-red-600 dark:text-red-500";case"CRITICAL":return"text-red-700 dark:text-red-400 font-bold";default:return"text-foreground"}},M=B=>{switch(B){case"DEBUG":return"bg-gray-800/30 dark:bg-gray-800/50";case"INFO":return"bg-blue-900/20 dark:bg-blue-500/20";case"WARNING":return"bg-yellow-900/20 dark:bg-yellow-500/20";case"ERROR":return"bg-red-900/20 dark:bg-red-500/20";case"CRITICAL":return"bg-red-900/30 dark:bg-red-600/30";default:return"bg-gray-800/20 dark:bg-gray-800/30"}},L=()=>{window.location.reload()},P=()=>{Ud.clearLogs(),e([])},I=()=>{const B=ee.map(R=>`${R.timestamp} [${R.level.padEnd(8)}] [${R.module}] ${R.message}`).join(` +`),X=new Blob([B],{type:"text/plain;charset=utf-8"}),J=URL.createObjectURL(X),G=document.createElement("a");G.href=J,G.download=`logs-${j1(new Date,"yyyy-MM-dd-HHmmss")}.txt`,G.click(),URL.revokeObjectURL(J)},Q=()=>{x(!g)},U=()=>{h(void 0),m(void 0)},ee=b.useMemo(()=>t.filter(B=>{const X=n===""||B.message.toLowerCase().includes(n.toLowerCase())||B.module.toLowerCase().includes(n.toLowerCase()),J=s==="all"||B.level===s,G=a==="all"||B.module===a;let R=!0;if(c||f){const se=new Date(B.timestamp);if(c){const W=new Date(c);W.setHours(0,0,0,0),R=R&&se>=W}if(f){const W=new Date(f);W.setHours(23,59,59,999),R=R&&se<=W}}return X&&J&&G&&R}),[t,n,s,a,c,f]),z=Vx[S].rowHeight+N,H=Xje({count:ee.length,getScrollElement:()=>T.current,estimateSize:()=>z,overscan:15});return b.useEffect(()=>{g&&ee.length>0&&H.scrollToIndex(ee.length-1,{align:"end",behavior:"auto"})},[ee.length,g,H]),l.jsxs("div",{className:"h-full flex flex-col overflow-hidden",children:[l.jsxs("div",{className:"flex-shrink-0 space-y-4 p-3 sm:p-4 lg:p-6",children:[l.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3",children:[l.jsxs("div",{children:[l.jsx("h1",{className:"text-xl sm:text-2xl lg:text-3xl font-bold",children:"日志查看器"}),l.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mt-1",children:"实时查看和分析麦麦运行日志"})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("div",{className:ve("h-2.5 w-2.5 sm:h-3 sm:w-3 rounded-full",y?"bg-green-500 animate-pulse":"bg-red-500")}),l.jsx("span",{className:"text-xs sm:text-sm text-muted-foreground",children:y?"已连接":"未连接"})]})]}),l.jsx(Dt,{className:"p-3 sm:p-4",children:l.jsxs("div",{className:"flex flex-col gap-3 sm:gap-4",children:[l.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:gap-4",children:[l.jsxs("div",{className:"flex-1 relative",children:[l.jsx(ci,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),l.jsx(Pe,{placeholder:"搜索日志...",value:n,onChange:B=>r(B.target.value),className:"pl-9 h-9 text-sm"})]}),l.jsxs(qt,{value:s,onValueChange:i,children:[l.jsxs(It,{className:"w-full sm:w-[140px] lg:w-[180px] h-9 text-sm",children:[l.jsx(P3,{className:"h-4 w-4 mr-2"}),l.jsx(Ft,{placeholder:"级别"})]}),l.jsxs(Bt,{children:[l.jsx(De,{value:"all",children:"全部级别"}),l.jsx(De,{value:"DEBUG",children:"DEBUG"}),l.jsx(De,{value:"INFO",children:"INFO"}),l.jsx(De,{value:"WARNING",children:"WARNING"}),l.jsx(De,{value:"ERROR",children:"ERROR"}),l.jsx(De,{value:"CRITICAL",children:"CRITICAL"})]})]}),l.jsxs(qt,{value:a,onValueChange:o,children:[l.jsxs(It,{className:"w-full sm:w-[160px] lg:w-[200px] h-9 text-sm",children:[l.jsx(P3,{className:"h-4 w-4 mr-2"}),l.jsx(Ft,{placeholder:"模块"})]}),l.jsxs(Bt,{children:[l.jsx(De,{value:"all",children:"全部模块"}),_.map(B=>l.jsx(De,{value:B,children:B},B))]})]})]}),l.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:gap-4",children:[l.jsxs(ul,{children:[l.jsx(dl,{asChild:!0,children:l.jsxs(de,{variant:"outline",size:"sm",className:ve("w-full sm:w-[200px] lg:w-[240px] justify-start text-left font-normal h-9",!c&&"text-muted-foreground"),children:[l.jsx(BC,{className:"mr-2 h-4 w-4"}),l.jsx("span",{className:"text-xs sm:text-sm",children:c?j1(c,"PPP",{locale:Hx}):"开始日期"})]})}),l.jsx(Ea,{className:"w-auto p-0",align:"start",children:l.jsx(gD,{mode:"single",selected:c,onSelect:h,initialFocus:!0,locale:Hx})})]}),l.jsxs(ul,{children:[l.jsx(dl,{asChild:!0,children:l.jsxs(de,{variant:"outline",size:"sm",className:ve("w-full sm:w-[200px] lg:w-[240px] justify-start text-left font-normal h-9",!f&&"text-muted-foreground"),children:[l.jsx(BC,{className:"mr-2 h-4 w-4"}),l.jsx("span",{className:"text-xs sm:text-sm",children:f?j1(f,"PPP",{locale:Hx}):"结束日期"})]})}),l.jsx(Ea,{className:"w-auto p-0",align:"start",children:l.jsx(gD,{mode:"single",selected:f,onSelect:m,initialFocus:!0,locale:Hx})})]}),(c||f)&&l.jsxs(de,{variant:"outline",size:"sm",onClick:U,className:"w-full sm:w-auto h-9",children:[l.jsx(P0,{className:"h-4 w-4 sm:mr-2"}),l.jsx("span",{className:"hidden sm:inline text-sm",children:"清除时间筛选"}),l.jsx("span",{className:"sm:hidden text-sm",children:"清除"})]})]}),l.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:flex-wrap sm:items-center",children:[l.jsxs("div",{className:"flex gap-2 flex-wrap",children:[l.jsxs(de,{variant:g?"default":"outline",size:"sm",onClick:Q,className:"flex-1 sm:flex-none h-9",children:[g?l.jsx(UK,{className:"h-4 w-4"}):l.jsx(WK,{className:"h-4 w-4"}),l.jsx("span",{className:"ml-2 text-sm",children:g?"自动滚动":"已暂停"})]}),l.jsxs(de,{variant:"outline",size:"sm",onClick:L,className:"flex-1 sm:flex-none h-9",children:[l.jsx(Ls,{className:"h-4 w-4"}),l.jsx("span",{className:"ml-2 text-sm",children:"刷新"})]}),l.jsxs(de,{variant:"outline",size:"sm",onClick:P,className:"flex-1 sm:flex-none h-9",children:[l.jsx(fn,{className:"h-4 w-4"}),l.jsx("span",{className:"ml-2 text-sm",children:"清空"})]}),l.jsxs(de,{variant:"outline",size:"sm",onClick:I,className:"flex-1 sm:flex-none h-9",children:[l.jsx(Su,{className:"h-4 w-4"}),l.jsx("span",{className:"ml-2 text-sm",children:"导出"})]})]}),l.jsx("div",{className:"flex-1 hidden sm:block"}),l.jsxs("div",{className:"text-xs sm:text-sm text-muted-foreground flex items-center justify-center sm:justify-end",children:[l.jsxs("span",{className:"font-mono",children:[ee.length," / ",t.length]}),l.jsx("span",{className:"ml-1",children:"条日志"})]})]}),l.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:gap-6 pt-2 border-t border-border/50",children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[l.jsx(GK,{className:"h-4 w-4"}),l.jsx("span",{children:"字号"})]}),l.jsx("div",{className:"flex gap-1",children:Object.keys(Vx).map(B=>l.jsx(de,{variant:S===B?"default":"outline",size:"sm",onClick:()=>k(B),className:"h-7 px-3 text-xs",children:Vx[B].label},B))})]}),l.jsxs("div",{className:"flex items-center gap-3 flex-1 max-w-xs",children:[l.jsx("span",{className:"text-sm text-muted-foreground whitespace-nowrap",children:"行距"}),l.jsx(V0,{value:[N],onValueChange:([B])=>C(B),min:0,max:12,step:2,className:"flex-1"}),l.jsxs("span",{className:"text-xs text-muted-foreground w-8",children:[N,"px"]})]})]})]})})]}),l.jsx("div",{className:"flex-1 min-h-0 px-3 sm:px-4 lg:px-6 pb-3 sm:pb-4 lg:pb-6",children:l.jsx(Dt,{className:"bg-black dark:bg-gray-950 border-gray-800 dark:border-gray-900 h-full",children:l.jsx(hn,{viewportRef:T,className:"h-full",children:l.jsx("div",{className:ve("p-2 sm:p-3 font-mono relative",Vx[S].class),style:{height:`${H.getTotalSize()}px`},children:ee.length===0?l.jsx("div",{className:"text-gray-500 dark:text-gray-600 text-center py-8 text-sm",children:"暂无日志数据"}):H.getVirtualItems().map(B=>{const X=ee[B.index];return l.jsxs("div",{"data-index":B.index,ref:H.measureElement,className:ve("absolute top-0 left-0 w-full px-2 sm:px-3 rounded hover:bg-white/5 transition-colors group",M(X.level)),style:{transform:`translateY(${B.start}px)`,paddingTop:`${N/2}px`,paddingBottom:`${N/2}px`},children:[l.jsxs("div",{className:"flex flex-col gap-0.5 sm:hidden",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-gray-500 dark:text-gray-600",children:X.timestamp}),l.jsxs("span",{className:ve("font-semibold",E(X.level)),children:["[",X.level,"]"]})]}),l.jsx("div",{className:"text-cyan-400 dark:text-cyan-500 truncate",children:X.module}),l.jsx("div",{className:"text-gray-300 dark:text-gray-400 whitespace-pre-wrap break-words",children:X.message})]}),l.jsxs("div",{className:"hidden sm:flex gap-2 items-start",children:[l.jsx("span",{className:"text-gray-500 dark:text-gray-600 flex-shrink-0 w-[130px] lg:w-[160px]",children:X.timestamp}),l.jsxs("span",{className:ve("flex-shrink-0 w-[65px] lg:w-[75px] font-semibold",E(X.level)),children:["[",X.level,"]"]}),l.jsx("span",{className:"text-cyan-400 dark:text-cyan-500 flex-shrink-0 w-[100px] lg:w-[130px] truncate",children:X.module}),l.jsx("span",{className:"text-gray-300 dark:text-gray-400 flex-1 whitespace-pre-wrap break-words",children:X.message})]})]},B.key)})})})})})]})}const E8e="Mai-with-u",_8e="plugin-repo",M8e="main",A8e="plugin_details.json";async function R8e(){try{const t=await pt("/api/webui/plugins/fetch-raw",{method:"POST",headers:Ct(),body:JSON.stringify({owner:E8e,repo:_8e,branch:M8e,file_path:A8e})});if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);const e=await t.json();if(!e.success||!e.data)throw new Error(e.error||"获取插件列表失败");return JSON.parse(e.data).filter(s=>!s?.id||!s?.manifest?(console.warn("跳过无效插件数据:",s),!1):!s.manifest.name||!s.manifest.version?(console.warn("跳过缺少必需字段的插件:",s.id),!1):!0).map(s=>({id:s.id,manifest:{manifest_version:s.manifest.manifest_version||1,name:s.manifest.name,version:s.manifest.version,description:s.manifest.description||"",author:s.manifest.author||{name:"Unknown"},license:s.manifest.license||"Unknown",host_application:s.manifest.host_application||{min_version:"0.0.0"},homepage_url:s.manifest.homepage_url,repository_url:s.manifest.repository_url,keywords:s.manifest.keywords||[],categories:s.manifest.categories||[],default_locale:s.manifest.default_locale||"zh-CN",locales_path:s.manifest.locales_path},downloads:0,rating:0,review_count:0,installed:!1,published_at:new Date().toISOString(),updated_at:new Date().toISOString()}))}catch(t){throw console.error("Failed to fetch plugin list:",t),t}}async function D8e(){try{const t=await pt("/api/webui/plugins/git-status");if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);return await t.json()}catch(t){return console.error("Failed to check Git status:",t),{installed:!1,error:"无法检测 Git 安装状态"}}}async function z8e(){try{const t=await pt("/api/webui/plugins/version");if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);return await t.json()}catch(t){return console.error("Failed to get Maimai version:",t),{version:"0.0.0",version_major:0,version_minor:0,version_patch:0}}}function P8e(t,e,n){const r=t.split(".").map(o=>parseInt(o)||0),s=r[0]||0,i=r[1]||0,a=r[2]||0;if(n.version_majorparseInt(m)||0),c=o[0]||0,h=o[1]||0,f=o[2]||0;if(n.version_major>c||n.version_major===c&&n.version_minor>h||n.version_major===c&&n.version_minor===h&&n.version_patch>f)return!1}return!0}function L8e(t,e){const n=window.location.protocol==="https:"?"wss:":"ws:",r=window.location.host,s=new WebSocket(`${n}//${r}/api/webui/ws/plugin-progress`);return s.onopen=()=>{console.log("Plugin progress WebSocket connected");const i=setInterval(()=>{s.readyState===WebSocket.OPEN?s.send("ping"):clearInterval(i)},3e4)},s.onmessage=i=>{try{if(i.data==="pong")return;const a=JSON.parse(i.data);t(a)}catch(a){console.error("Failed to parse progress data:",a)}},s.onerror=i=>{console.error("Plugin progress WebSocket error:",i),e?.(i)},s.onclose=()=>{console.log("Plugin progress WebSocket disconnected")},s}async function Ux(){try{const t=await pt("/api/webui/plugins/installed",{headers:Ct()});if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);const e=await t.json();if(!e.success)throw new Error(e.message||"获取已安装插件列表失败");return e.plugins||[]}catch(t){return console.error("Failed to get installed plugins:",t),[]}}function Wx(t,e){return e.some(n=>n.id===t)}function Gx(t,e){const n=e.find(r=>r.id===t);if(n)return n.manifest?.version||n.version}async function I8e(t,e,n="main"){const r=await pt("/api/webui/plugins/install",{method:"POST",headers:Ct(),body:JSON.stringify({plugin_id:t,repository_url:e,branch:n})});if(!r.ok){const s=await r.json();throw new Error(s.detail||"安装失败")}return await r.json()}async function B8e(t){const e=await pt("/api/webui/plugins/uninstall",{method:"POST",headers:Ct(),body:JSON.stringify({plugin_id:t})});if(!e.ok){const n=await e.json();throw new Error(n.detail||"卸载失败")}return await e.json()}async function q8e(t,e,n="main"){const r=await pt("/api/webui/plugins/update",{method:"POST",headers:Ct(),body:JSON.stringify({plugin_id:t,repository_url:e,branch:n})});if(!r.ok){const s=await r.json();throw new Error(s.detail||"更新失败")}return await r.json()}const wp="https://maibot-plugin-stats.maibot-webui.workers.dev";async function hU(t){try{const e=await fetch(`${wp}/stats/${t}`);return e.ok?await e.json():(console.error("Failed to fetch plugin stats:",e.statusText),null)}catch(e){return console.error("Error fetching plugin stats:",e),null}}async function F8e(t,e){try{const n=e||AO(),r=await fetch(`${wp}/stats/like`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:t,user_id:n})}),s=await r.json();return r.status===429?{success:!1,error:"操作过于频繁,请稍后再试"}:r.ok?{success:!0,...s}:{success:!1,error:s.error||"点赞失败"}}catch(n){return console.error("Error liking plugin:",n),{success:!1,error:"网络错误"}}}async function $8e(t,e){try{const n=e||AO(),r=await fetch(`${wp}/stats/dislike`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:t,user_id:n})}),s=await r.json();return r.status===429?{success:!1,error:"操作过于频繁,请稍后再试"}:r.ok?{success:!0,...s}:{success:!1,error:s.error||"点踩失败"}}catch(n){return console.error("Error disliking plugin:",n),{success:!1,error:"网络错误"}}}async function Q8e(t,e,n,r){if(e<1||e>5)return{success:!1,error:"评分必须在 1-5 之间"};try{const s=r||AO(),i=await fetch(`${wp}/stats/rate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:t,rating:e,comment:n,user_id:s})}),a=await i.json();return i.status===429?{success:!1,error:"每天最多评分 3 次"}:i.ok?{success:!0,...a}:{success:!1,error:a.error||"评分失败"}}catch(s){return console.error("Error rating plugin:",s),{success:!1,error:"网络错误"}}}async function H8e(t){try{const e=await fetch(`${wp}/stats/download`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:t})}),n=await e.json();return e.status===429?(console.warn("Download recording rate limited"),{success:!0}):e.ok?{success:!0,...n}:(console.error("Failed to record download:",n.error),{success:!1,error:n.error})}catch(e){return console.error("Error recording download:",e),{success:!1,error:"网络错误"}}}function V8e(){const t=navigator,e=[navigator.userAgent,navigator.language,navigator.languages?.join(",")||"",navigator.platform,navigator.hardwareConcurrency||0,screen.width,screen.height,screen.colorDepth,screen.pixelDepth,new Date().getTimezoneOffset(),Intl.DateTimeFormat().resolvedOptions().timeZone,navigator.maxTouchPoints||0,t.deviceMemory||0].join("|");let n=0;for(let r=0;r{i(!0);const k=await hU(t);k&&r(k),i(!1)};b.useEffect(()=>{x()},[t]);const y=async()=>{const k=await F8e(t);k.success?(g({title:"已点赞",description:"感谢你的支持!"}),x()):g({title:"点赞失败",description:k.error||"未知错误",variant:"destructive"})},w=async()=>{const k=await $8e(t);k.success?(g({title:"已反馈",description:"感谢你的反馈!"}),x()):g({title:"操作失败",description:k.error||"未知错误",variant:"destructive"})},S=async()=>{if(a===0){g({title:"请选择评分",description:"至少选择 1 颗星",variant:"destructive"});return}const k=await Q8e(t,a,c||void 0);k.success?(g({title:"评分成功",description:"感谢你的评价!"}),m(!1),o(0),h(""),x()):g({title:"评分失败",description:k.error||"未知错误",variant:"destructive"})};return s?l.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx(Su,{className:"h-4 w-4"}),l.jsx("span",{children:"-"})]}),l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx(sc,{className:"h-4 w-4"}),l.jsx("span",{children:"-"})]})]}):n?e?l.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[l.jsxs("div",{className:"flex items-center gap-1",title:`下载量: ${n.downloads.toLocaleString()}`,children:[l.jsx(Su,{className:"h-4 w-4"}),l.jsx("span",{children:n.downloads.toLocaleString()})]}),l.jsxs("div",{className:"flex items-center gap-1",title:`评分: ${n.rating.toFixed(1)} (${n.rating_count} 条评价)`,children:[l.jsx(sc,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),l.jsx("span",{children:n.rating.toFixed(1)})]}),l.jsxs("div",{className:"flex items-center gap-1",title:`点赞数: ${n.likes}`,children:[l.jsx(rw,{className:"h-4 w-4"}),l.jsx("span",{children:n.likes})]})]}):l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4",children:[l.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[l.jsx(Su,{className:"h-5 w-5 text-muted-foreground mb-1"}),l.jsx("span",{className:"text-2xl font-bold",children:n.downloads.toLocaleString()}),l.jsx("span",{className:"text-xs text-muted-foreground",children:"下载量"})]}),l.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[l.jsx(sc,{className:"h-5 w-5 text-yellow-400 mb-1 fill-yellow-400"}),l.jsx("span",{className:"text-2xl font-bold",children:n.rating.toFixed(1)}),l.jsxs("span",{className:"text-xs text-muted-foreground",children:[n.rating_count," 条评价"]})]}),l.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[l.jsx(rw,{className:"h-5 w-5 text-green-500 mb-1"}),l.jsx("span",{className:"text-2xl font-bold",children:n.likes}),l.jsx("span",{className:"text-xs text-muted-foreground",children:"点赞"})]}),l.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[l.jsx(qC,{className:"h-5 w-5 text-red-500 mb-1"}),l.jsx("span",{className:"text-2xl font-bold",children:n.dislikes}),l.jsx("span",{className:"text-xs text-muted-foreground",children:"点踩"})]})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsxs(de,{variant:"outline",size:"sm",onClick:y,children:[l.jsx(rw,{className:"h-4 w-4 mr-1"}),"点赞"]}),l.jsxs(de,{variant:"outline",size:"sm",onClick:w,children:[l.jsx(qC,{className:"h-4 w-4 mr-1"}),"点踩"]}),l.jsxs(xr,{open:f,onOpenChange:m,children:[l.jsx(Bh,{asChild:!0,children:l.jsxs(de,{variant:"default",size:"sm",children:[l.jsx(sc,{className:"h-4 w-4 mr-1"}),"评分"]})}),l.jsxs(lr,{children:[l.jsxs(or,{children:[l.jsx(cr,{children:"为插件评分"}),l.jsx(Hr,{children:"分享你的使用体验,帮助其他用户"})]}),l.jsxs("div",{className:"space-y-4 py-4",children:[l.jsxs("div",{className:"flex flex-col items-center gap-2",children:[l.jsx("div",{className:"flex gap-2",children:[1,2,3,4,5].map(k=>l.jsx("button",{onClick:()=>o(k),className:"focus:outline-none",children:l.jsx(sc,{className:`h-8 w-8 transition-colors ${k<=a?"fill-yellow-400 text-yellow-400":"text-muted-foreground hover:text-yellow-300"}`})},k))}),l.jsxs("span",{className:"text-sm text-muted-foreground",children:[a===0&&"点击星星进行评分",a===1&&"很差",a===2&&"一般",a===3&&"还行",a===4&&"不错",a===5&&"非常好"]})]}),l.jsxs("div",{children:[l.jsx("label",{className:"text-sm font-medium mb-2 block",children:"评论(可选)"}),l.jsx(pr,{value:c,onChange:k=>h(k.target.value),placeholder:"分享你的使用体验...",rows:4,maxLength:500}),l.jsxs("div",{className:"text-xs text-muted-foreground mt-1 text-right",children:[c.length," / 500"]})]})]}),l.jsxs(as,{children:[l.jsx(de,{variant:"outline",onClick:()=>m(!1),children:"取消"}),l.jsx(de,{onClick:S,disabled:a===0,children:"提交评分"})]})]})]})]}),n.recent_ratings&&n.recent_ratings.length>0&&l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"text-sm font-semibold",children:"最近评价"}),l.jsx("div",{className:"space-y-3",children:n.recent_ratings.map((k,N)=>l.jsxs("div",{className:"p-3 rounded-lg border bg-muted/50",children:[l.jsxs("div",{className:"flex items-center justify-between mb-2",children:[l.jsx("div",{className:"flex gap-1",children:[1,2,3,4,5].map(C=>l.jsx(sc,{className:`h-3 w-3 ${C<=k.rating?"fill-yellow-400 text-yellow-400":"text-muted-foreground"}`},C))}),l.jsx("span",{className:"text-xs text-muted-foreground",children:new Date(k.created_at).toLocaleDateString()})]}),k.comment&&l.jsx("p",{className:"text-sm text-muted-foreground",children:k.comment})]},N))})]})]}):null}const vD={"Group Management":"群组管理","Entertainment & Interaction":"娱乐互动","Utility Tools":"实用工具","Content Generation":"内容生成",Multimedia:"多媒体","External Integration":"外部集成","Data Analysis & Insights":"数据分析与洞察",Other:"其他"};function W8e(){const t=Da(),[e,n]=b.useState(null),[r,s]=b.useState(""),[i,a]=b.useState("all"),[o,c]=b.useState("all"),[h,f]=b.useState(!0),[m,g]=b.useState([]),[x,y]=b.useState(!0),[w,S]=b.useState(null),[k,N]=b.useState(null),[C,T]=b.useState(null),[_,E]=b.useState(null),[,M]=b.useState([]),[L,P]=b.useState({}),{toast:I}=ts(),Q=async R=>{const se=R.map(async V=>{try{const te=await hU(V.id);return{id:V.id,stats:te}}catch(te){return console.warn(`Failed to load stats for ${V.id}:`,te),{id:V.id,stats:null}}}),W=await Promise.all(se),F={};W.forEach(({id:V,stats:te})=>{te&&(F[V]=te)}),P(F)};b.useEffect(()=>{let R=null,se=!1;return(async()=>{if(R=L8e(F=>{se||(T(F),F.stage==="success"?setTimeout(()=>{se||T(null)},2e3):F.stage==="error"&&(y(!1),S(F.error||"加载失败")))},F=>{console.error("WebSocket error:",F),se||I({title:"WebSocket 连接失败",description:"无法实时显示加载进度",variant:"destructive"})}),await new Promise(F=>{if(!R){F();return}const V=()=>{R&&R.readyState===WebSocket.OPEN?(console.log("WebSocket connected, starting to load plugins"),F()):R&&R.readyState===WebSocket.CLOSED?(console.warn("WebSocket closed before loading plugins"),F()):setTimeout(V,100)};V()}),!se){const F=await D8e();N(F),F.installed||I({title:"Git 未安装",description:F.error||"请先安装 Git 才能使用插件安装功能",variant:"destructive"})}if(!se){const F=await z8e();E(F)}if(!se)try{y(!0),S(null);const F=await R8e();if(!se){const V=await Ux();M(V);const te=F.map(ne=>{const K=Wx(ne.id,V),ie=Gx(ne.id,V);return{...ne,installed:K,installed_version:ie}});for(const ne of V)!te.some(ie=>ie.id===ne.id)&&ne.manifest&&te.push({id:ne.id,manifest:{manifest_version:ne.manifest.manifest_version||1,name:ne.manifest.name,version:ne.manifest.version,description:ne.manifest.description||"",author:ne.manifest.author,license:ne.manifest.license||"Unknown",host_application:ne.manifest.host_application,homepage_url:ne.manifest.homepage_url,repository_url:ne.manifest.repository_url,keywords:ne.manifest.keywords||[],categories:ne.manifest.categories||[],default_locale:ne.manifest.default_locale||"zh-CN",locales_path:ne.manifest.locales_path},downloads:0,rating:0,review_count:0,installed:!0,installed_version:ne.manifest.version,published_at:new Date().toISOString(),updated_at:new Date().toISOString()});g(te),Q(te)}}catch(F){if(!se){const V=F instanceof Error?F.message:"加载插件列表失败";S(V),I({title:"加载失败",description:V,variant:"destructive"})}}finally{se||y(!1)}})(),()=>{se=!0,R&&R.close()}},[I]);const U=R=>{if(!R.installed&&_&&!ee(R))return l.jsxs(In,{variant:"destructive",className:"gap-1",children:[l.jsx(Cu,{className:"h-3 w-3"}),"不兼容"]});if(R.installed){const se=R.installed_version?.trim(),W=R.manifest.version?.trim();if(se!==W){const F=se?.split(".").map(Number)||[0,0,0],V=W?.split(".").map(Number)||[0,0,0];for(let te=0;te<3;te++){if((V[te]||0)>(F[te]||0))return l.jsxs(In,{variant:"outline",className:"gap-1 text-orange-600 border-orange-600",children:[l.jsx(Cu,{className:"h-3 w-3"}),"可更新"]});if((V[te]||0)<(F[te]||0))break}}return l.jsxs(In,{variant:"default",className:"gap-1",children:[l.jsx(xc,{className:"h-3 w-3"}),"已安装"]})}return null},ee=R=>!_||!R.manifest?.host_application?!0:P8e(R.manifest.host_application.min_version,R.manifest.host_application.max_version,_),z=R=>{if(!R.installed||!R.installed_version||!R.manifest?.version)return!1;const se=R.installed_version.trim(),W=R.manifest.version.trim();if(se===W)return!1;const F=se.split(".").map(Number),V=W.split(".").map(Number);for(let te=0;te<3;te++){if((V[te]||0)>(F[te]||0))return!0;if((V[te]||0)<(F[te]||0))return!1}return!1},H=m.filter(R=>{if(!R.manifest)return console.warn("[过滤] 跳过无 manifest 的插件:",R.id),!1;const se=r===""||R.manifest.name?.toLowerCase().includes(r.toLowerCase())||R.manifest.description?.toLowerCase().includes(r.toLowerCase())||R.manifest.keywords&&R.manifest.keywords.some(te=>te.toLowerCase().includes(r.toLowerCase())),W=i==="all"||R.manifest.categories&&R.manifest.categories.includes(i);let F=!0;o==="installed"?F=R.installed===!0:o==="updates"&&(F=R.installed===!0&&z(R));const V=!h||!_||ee(R);return se&&W&&F&&V}),B=()=>{n(null)},X=async R=>{if(!k?.installed){I({title:"无法安装",description:"Git 未安装",variant:"destructive"});return}if(_&&!ee(R)){I({title:"无法安装",description:"插件与当前麦麦版本不兼容",variant:"destructive"});return}try{await I8e(R.id,R.manifest.repository_url||"","main"),H8e(R.id).catch(W=>{console.warn("Failed to record download:",W)}),I({title:"安装成功",description:`${R.manifest.name} 已成功安装`});const se=await Ux();M(se),g(W=>W.map(F=>{if(F.id===R.id){const V=Wx(F.id,se),te=Gx(F.id,se);return{...F,installed:V,installed_version:te}}return F}))}catch(se){I({title:"安装失败",description:se instanceof Error?se.message:"未知错误",variant:"destructive"})}},J=async R=>{try{await B8e(R.id),I({title:"卸载成功",description:`${R.manifest.name} 已成功卸载`});const se=await Ux();M(se),g(W=>W.map(F=>{if(F.id===R.id){const V=Wx(F.id,se),te=Gx(F.id,se);return{...F,installed:V,installed_version:te}}return F}))}catch(se){I({title:"卸载失败",description:se instanceof Error?se.message:"未知错误",variant:"destructive"})}},G=async R=>{if(!k?.installed){I({title:"无法更新",description:"Git 未安装",variant:"destructive"});return}try{const se=await q8e(R.id,R.manifest.repository_url||"","main");I({title:"更新成功",description:`${R.manifest.name} 已从 ${se.old_version} 更新到 ${se.new_version}`});const W=await Ux();M(W),g(F=>F.map(V=>{if(V.id===R.id){const te=Wx(V.id,W),ne=Gx(V.id,W);return{...V,installed:te,installed_version:ne}}return V}))}catch(se){I({title:"更新失败",description:se instanceof Error?se.message:"未知错误",variant:"destructive"})}};return l.jsx(hn,{className:"h-full",children:l.jsxs("div",{className:"space-y-6 p-4 sm:p-6",children:[l.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[l.jsxs("div",{children:[l.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"插件市场"}),l.jsx("p",{className:"text-muted-foreground mt-2",children:"浏览和管理麦麦的插件"})]}),l.jsxs(de,{onClick:()=>t({to:"/plugin-mirrors"}),children:[l.jsx(XK,{className:"h-4 w-4 mr-2"}),"配置镜像源"]})]}),k&&!k.installed&&l.jsxs(Dt,{className:"border-orange-600 bg-orange-50 dark:bg-orange-950/20",children:[l.jsx(kn,{children:l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx(Oa,{className:"h-5 w-5 text-orange-600"}),l.jsxs("div",{children:[l.jsx(jn,{className:"text-lg text-orange-900 dark:text-orange-100",children:"Git 未安装"}),l.jsx(Fr,{className:"text-orange-800 dark:text-orange-200",children:k.error||"请先安装 Git 才能使用插件安装功能"})]})]})}),l.jsx(Dn,{children:l.jsxs("p",{className:"text-sm text-orange-800 dark:text-orange-200",children:["您可以从 ",l.jsx("a",{href:"https://git-scm.com/downloads",target:"_blank",rel:"noopener noreferrer",className:"underline font-medium",children:"git-scm.com"})," 下载并安装 Git。 安装完成后,请重启麦麦应用。"]})})]}),l.jsx(Dt,{className:"p-4",children:l.jsxs("div",{className:"flex flex-col gap-4",children:[l.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[l.jsxs("div",{className:"flex-1 relative",children:[l.jsx(ci,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),l.jsx(Pe,{placeholder:"搜索插件...",value:r,onChange:R=>s(R.target.value),className:"pl-9"})]}),l.jsxs(qt,{value:i,onValueChange:a,children:[l.jsx(It,{className:"w-full sm:w-[200px]",children:l.jsx(Ft,{placeholder:"选择分类"})}),l.jsxs(Bt,{children:[l.jsx(De,{value:"all",children:"全部分类"}),l.jsx(De,{value:"Group Management",children:"群组管理"}),l.jsx(De,{value:"Entertainment & Interaction",children:"娱乐互动"}),l.jsx(De,{value:"Utility Tools",children:"实用工具"}),l.jsx(De,{value:"Content Generation",children:"内容生成"}),l.jsx(De,{value:"Multimedia",children:"多媒体"}),l.jsx(De,{value:"External Integration",children:"外部集成"}),l.jsx(De,{value:"Data Analysis & Insights",children:"数据分析与洞察"}),l.jsx(De,{value:"Other",children:"其他"})]})]})]}),l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(li,{id:"compatible-only",checked:h,onCheckedChange:R=>f(R===!0)}),l.jsx("label",{htmlFor:"compatible-only",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer",children:"只显示兼容当前版本的插件"})]})]})}),l.jsx(sa,{value:o,onValueChange:c,className:"w-full",children:l.jsxs(Mi,{className:"grid w-full grid-cols-3",children:[l.jsxs(zt,{value:"all",children:["全部插件 (",m.filter(R=>{if(!R.manifest)return!1;const se=r===""||R.manifest.name?.toLowerCase().includes(r.toLowerCase())||R.manifest.description?.toLowerCase().includes(r.toLowerCase())||R.manifest.keywords&&R.manifest.keywords.some(V=>V.toLowerCase().includes(r.toLowerCase())),W=i==="all"||R.manifest.categories&&R.manifest.categories.includes(i),F=!h||!_||ee(R);return se&&W&&F}).length,")"]}),l.jsxs(zt,{value:"installed",children:["已安装 (",m.filter(R=>{if(!R.manifest)return!1;const se=r===""||R.manifest.name?.toLowerCase().includes(r.toLowerCase())||R.manifest.description?.toLowerCase().includes(r.toLowerCase())||R.manifest.keywords&&R.manifest.keywords.some(V=>V.toLowerCase().includes(r.toLowerCase())),W=i==="all"||R.manifest.categories&&R.manifest.categories.includes(i),F=!h||!_||ee(R);return R.installed&&se&&W&&F}).length,")"]}),l.jsxs(zt,{value:"updates",children:["可更新 (",m.filter(R=>{if(!R.manifest)return!1;const se=r===""||R.manifest.name?.toLowerCase().includes(r.toLowerCase())||R.manifest.description?.toLowerCase().includes(r.toLowerCase())||R.manifest.keywords&&R.manifest.keywords.some(V=>V.toLowerCase().includes(r.toLowerCase())),W=i==="all"||R.manifest.categories&&R.manifest.categories.includes(i),F=!h||!_||ee(R);return R.installed&&z(R)&&se&&W&&F}).length,")"]})]})}),C&&C.stage==="loading"&&l.jsx(Dt,{className:"p-4",children:l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(vc,{className:"h-4 w-4 animate-spin"}),l.jsxs("span",{className:"text-sm font-medium",children:[C.operation==="fetch"&&"加载插件列表",C.operation==="install"&&`安装插件${C.plugin_id?`: ${C.plugin_id}`:""}`,C.operation==="uninstall"&&`卸载插件${C.plugin_id?`: ${C.plugin_id}`:""}`,C.operation==="update"&&`更新插件${C.plugin_id?`: ${C.plugin_id}`:""}`]})]}),l.jsxs("span",{className:"text-sm font-medium",children:[C.progress,"%"]})]}),l.jsx(H0,{value:C.progress,className:"h-2"}),l.jsx("div",{className:"text-xs text-muted-foreground",children:C.message}),C.operation==="fetch"&&C.total_plugins>0&&l.jsxs("div",{className:"text-xs text-muted-foreground text-center",children:["已加载 ",C.loaded_plugins," / ",C.total_plugins," 个插件"]})]})}),C&&C.stage==="error"&&C.error&&l.jsx(Dt,{className:"border-destructive bg-destructive/10",children:l.jsx(kn,{children:l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx(Oa,{className:"h-5 w-5 text-destructive"}),l.jsxs("div",{children:[l.jsx(jn,{className:"text-lg text-destructive",children:"加载失败"}),l.jsx(Fr,{className:"text-destructive/80",children:C.error})]})]})})}),x?l.jsxs("div",{className:"flex items-center justify-center py-12",children:[l.jsx(vc,{className:"h-8 w-8 animate-spin text-muted-foreground"}),l.jsx("span",{className:"ml-3 text-muted-foreground",children:"加载插件列表中..."})]}):w?l.jsx(Dt,{className:"p-6",children:l.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[l.jsx(Oa,{className:"h-12 w-12 text-destructive mb-4"}),l.jsx("h3",{className:"text-lg font-semibold mb-2",children:"加载失败"}),l.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:w}),l.jsx(de,{onClick:()=>window.location.reload(),children:"重新加载"})]})}):H.length===0?l.jsx(Dt,{className:"p-6",children:l.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[l.jsx(ci,{className:"h-12 w-12 text-muted-foreground mb-4"}),l.jsx("h3",{className:"text-lg font-semibold mb-2",children:"未找到插件"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:r||i!=="all"?"尝试调整搜索条件或筛选器":"暂无可用插件"})]})}):l.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:H.map(R=>l.jsxs(Dt,{className:"flex flex-col hover:shadow-lg transition-shadow h-full",children:[l.jsxs(kn,{children:[l.jsxs("div",{className:"flex items-start justify-between gap-2",children:[l.jsx(jn,{className:"text-xl",children:R.manifest?.name||R.id}),l.jsxs("div",{className:"flex flex-col gap-1",children:[R.manifest?.categories&&R.manifest.categories[0]&&l.jsx(In,{variant:"secondary",className:"text-xs whitespace-nowrap",children:vD[R.manifest.categories[0]]||R.manifest.categories[0]}),U(R)]})]}),l.jsx(Fr,{className:"line-clamp-2",children:R.manifest?.description||"无描述"})]}),l.jsx(Dn,{className:"flex-1",children:l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx(Su,{className:"h-4 w-4"}),l.jsx("span",{children:(L[R.id]?.downloads??R.downloads??0).toLocaleString()})]}),l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx(sc,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),l.jsx("span",{children:(L[R.id]?.rating??R.rating??0).toFixed(1)})]})]}),l.jsxs("div",{className:"flex flex-wrap gap-2",children:[R.manifest?.keywords&&R.manifest.keywords.slice(0,3).map(se=>l.jsx(In,{variant:"outline",className:"text-xs",children:se},se)),R.manifest?.keywords&&R.manifest.keywords.length>3&&l.jsxs(In,{variant:"outline",className:"text-xs",children:["+",R.manifest.keywords.length-3]})]}),l.jsxs("div",{className:"text-xs text-muted-foreground pt-2 border-t space-y-1",children:[l.jsxs("div",{children:["v",R.manifest?.version||"unknown"," · ",R.manifest?.author?.name||"Unknown"]}),R.manifest?.host_application&&l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx("span",{children:"支持:"}),l.jsxs("span",{className:"font-medium",children:[R.manifest.host_application.min_version,R.manifest.host_application.max_version?` - ${R.manifest.host_application.max_version}`:" - 最新版本"]})]})]})]})}),l.jsx(Gz,{className:"pt-4",children:l.jsxs("div",{className:"flex items-center justify-end gap-2 w-full",children:[l.jsx(de,{variant:"outline",size:"sm",onClick:()=>n(R),children:"查看详情"}),R.installed?z(R)?l.jsxs(de,{size:"sm",disabled:!k?.installed,title:k?.installed?void 0:"Git 未安装",onClick:()=>G(R),children:[l.jsx(Ls,{className:"h-4 w-4 mr-1"}),"更新"]}):l.jsxs(de,{variant:"destructive",size:"sm",disabled:!k?.installed,title:k?.installed?void 0:"Git 未安装",onClick:()=>J(R),children:[l.jsx(fn,{className:"h-4 w-4 mr-1"}),"卸载"]}):l.jsxs(de,{size:"sm",disabled:!k?.installed||C?.operation==="install"||_!==null&&!ee(R),title:k?.installed?_!==null&&!ee(R)?`不兼容当前版本 (需要 ${R.manifest?.host_application?.min_version||"未知"}${R.manifest?.host_application?.max_version?` - ${R.manifest.host_application.max_version}`:"+"},当前 ${_?.version})`:void 0:"Git 未安装",onClick:()=>X(R),children:[l.jsx(Su,{className:"h-4 w-4 mr-1"}),C?.operation==="install"&&C?.plugin_id===R.id?"安装中...":"安装"]})]})})]},R.id))}),l.jsx(xr,{open:e!==null,onOpenChange:B,children:e&&e.manifest&&l.jsxs(lr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[l.jsx(or,{children:l.jsxs("div",{className:"flex items-start justify-between gap-4",children:[l.jsxs("div",{className:"space-y-2 flex-1",children:[l.jsx(cr,{className:"text-2xl",children:e.manifest.name}),l.jsxs(Hr,{children:["作者: ",e.manifest.author?.name||"Unknown",e.manifest.author?.url&&l.jsx("a",{href:e.manifest.author.url,target:"_blank",rel:"noopener noreferrer",className:"ml-2 text-primary hover:underline",children:l.jsx(Jd,{className:"h-3 w-3 inline"})})]})]}),l.jsxs("div",{className:"flex flex-col gap-2",children:[e.manifest.categories&&e.manifest.categories[0]&&l.jsx(In,{variant:"secondary",children:vD[e.manifest.categories[0]]||e.manifest.categories[0]}),U(e)]})]})}),l.jsxs("div",{className:"space-y-6",children:[l.jsx(U8e,{pluginId:e.id}),l.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-4",children:[l.jsxs("div",{children:[l.jsx("p",{className:"text-sm font-medium",children:"版本"}),l.jsxs("p",{className:"text-sm text-muted-foreground",children:["v",e.manifest?.version||"unknown"]}),e.installed&&e.installed_version&&l.jsxs("p",{className:"text-xs text-muted-foreground",children:["已安装: v",e.installed_version]})]}),l.jsxs("div",{children:[l.jsx("p",{className:"text-sm font-medium",children:"下载量"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:(L[e.id]?.downloads??e.downloads??0).toLocaleString()})]}),l.jsxs("div",{children:[l.jsx("p",{className:"text-sm font-medium",children:"评分"}),l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx(sc,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),l.jsxs("span",{className:"text-sm text-muted-foreground",children:[(L[e.id]?.rating??e.rating??0).toFixed(1)," (",L[e.id]?.rating_count??e.review_count??0,")"]})]})]}),l.jsxs("div",{children:[l.jsx("p",{className:"text-sm font-medium",children:"许可证"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:e.manifest.license||"Unknown"})]}),l.jsxs("div",{className:"col-span-2",children:[l.jsx("p",{className:"text-sm font-medium",children:"支持版本"}),l.jsxs("p",{className:"text-sm text-muted-foreground",children:[e.manifest.host_application?.min_version||"未知",e.manifest.host_application?.max_version?` - ${e.manifest.host_application.max_version}`:" - 最新版本"]})]})]}),l.jsxs("div",{children:[l.jsx("p",{className:"text-sm font-medium mb-2",children:"关键词"}),l.jsx("div",{className:"flex flex-wrap gap-2",children:e.manifest.keywords&&e.manifest.keywords.map(R=>l.jsx(In,{variant:"outline",children:R},R))})]}),e.detailed_description&&l.jsxs("div",{children:[l.jsx("p",{className:"text-sm font-medium mb-2",children:"详细说明"}),l.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-line",children:e.detailed_description})]}),!e.detailed_description&&l.jsxs("div",{children:[l.jsx("p",{className:"text-sm font-medium mb-2",children:"说明"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:e.manifest.description||"无描述"})]}),l.jsxs("div",{className:"space-y-2",children:[e.manifest.homepage_url&&l.jsxs("div",{className:"text-sm",children:[l.jsx("span",{className:"font-medium",children:"主页: "}),l.jsx("a",{href:e.manifest.homepage_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:e.manifest.homepage_url})]}),e.manifest.repository_url&&l.jsxs("div",{className:"text-sm",children:[l.jsx("span",{className:"font-medium",children:"仓库: "}),l.jsx("a",{href:e.manifest.repository_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:e.manifest.repository_url})]})]})]}),l.jsxs(as,{children:[e.manifest.homepage_url&&l.jsxs(de,{onClick:()=>window.open(e.manifest.homepage_url,"_blank"),children:[l.jsx(Jd,{className:"h-4 w-4 mr-2"}),"访问主页"]}),e.manifest.repository_url&&l.jsxs(de,{variant:"outline",onClick:()=>window.open(e.manifest.repository_url,"_blank"),children:[l.jsx(Jd,{className:"h-4 w-4 mr-2"}),"查看仓库"]})]})]})})]})})}function G8e(){return l.jsx(hn,{className:"h-full",children:l.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[l.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[l.jsxs("div",{children:[l.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"插件配置"}),l.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理和配置已安装的插件"})]}),l.jsxs("div",{className:"flex gap-2",children:[l.jsxs(de,{variant:"outline",size:"sm",children:[l.jsx(Ls,{className:"h-4 w-4 mr-2"}),"刷新"]}),l.jsxs(de,{size:"sm",children:[l.jsx(bu,{className:"h-4 w-4 mr-2"}),"全局设置"]})]})]}),l.jsxs("div",{className:"grid gap-4 grid-cols-1 xs:grid-cols-2 lg:grid-cols-4",children:[l.jsxs(Dt,{children:[l.jsxs(kn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[l.jsx(jn,{className:"text-sm font-medium",children:"已安装插件"}),l.jsx(mh,{className:"h-4 w-4 text-muted-foreground"})]}),l.jsxs(Dn,{children:[l.jsx("div",{className:"text-2xl font-bold",children:"0"}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"正在加载..."})]})]}),l.jsxs(Dt,{children:[l.jsxs(kn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[l.jsx(jn,{className:"text-sm font-medium",children:"已启用"}),l.jsx(xc,{className:"h-4 w-4 text-green-600"})]}),l.jsxs(Dn,{children:[l.jsx("div",{className:"text-2xl font-bold",children:"0"}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"运行中的插件"})]})]}),l.jsxs(Dt,{children:[l.jsxs(kn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[l.jsx(jn,{className:"text-sm font-medium",children:"已禁用"}),l.jsx(Cu,{className:"h-4 w-4 text-orange-600"})]}),l.jsxs(Dn,{children:[l.jsx("div",{className:"text-2xl font-bold",children:"0"}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"未激活的插件"})]})]}),l.jsxs(Dt,{children:[l.jsxs(kn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[l.jsx(jn,{className:"text-sm font-medium",children:"可更新"}),l.jsx(Ls,{className:"h-4 w-4 text-blue-600"})]}),l.jsxs(Dn,{children:[l.jsx("div",{className:"text-2xl font-bold",children:"0"}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"有新版本可用"})]})]})]}),l.jsxs(Dt,{children:[l.jsxs(kn,{children:[l.jsx(jn,{children:"已安装的插件"}),l.jsx(Fr,{children:"查看和管理已安装插件的配置"})]}),l.jsx(Dn,{children:l.jsxs("div",{className:"flex flex-col items-center justify-center py-12 space-y-4",children:[l.jsx(mh,{className:"h-16 w-16 text-muted-foreground/50"}),l.jsxs("div",{className:"text-center space-y-2",children:[l.jsx("p",{className:"text-lg font-medium text-muted-foreground",children:"插件配置功能开发中"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"即将支持插件的启用/禁用、参数配置等功能"})]}),l.jsx("div",{className:"flex gap-2",children:l.jsx(de,{variant:"outline",asChild:!0,children:l.jsxs("a",{href:"/plugins",children:[l.jsx(Jd,{className:"h-4 w-4 mr-2"}),"前往插件市场"]})})})]})})]}),l.jsx(Dt,{className:"border-blue-200 bg-blue-50 dark:bg-blue-950/20 dark:border-blue-900",children:l.jsx(Dn,{className:"pt-6",children:l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx(Cu,{className:"h-5 w-5 text-blue-600 mt-0.5 flex-shrink-0"}),l.jsxs("div",{className:"space-y-1",children:[l.jsx("p",{className:"text-sm font-medium text-blue-900 dark:text-blue-100",children:"开发进行中"}),l.jsxs("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:["插件配置功能正在积极开发中。目前您可以通过",l.jsx("strong",{children:"插件市场"}),"安装和卸载插件,完整的配置管理功能即将推出。"]})]})]})})})]})})}function X8e(){const t=Da(),{toast:e}=ts(),[n,r]=b.useState([]),[s,i]=b.useState(!0),[a,o]=b.useState(null),[c,h]=b.useState(null),[f,m]=b.useState(!1),[g,x]=b.useState(!1),[y,w]=b.useState({id:"",name:"",raw_prefix:"",clone_prefix:"",enabled:!0,priority:1}),S=b.useCallback(async()=>{try{i(!0),o(null);const M=localStorage.getItem("access-token"),L=await fetch("/api/webui/plugins/mirrors",{headers:{Authorization:`Bearer ${M}`}});if(!L.ok)throw new Error("获取镜像源列表失败");const P=await L.json();r(P.mirrors||[])}catch(M){const L=M instanceof Error?M.message:"加载镜像源失败";o(L),e({title:"加载失败",description:L,variant:"destructive"})}finally{i(!1)}},[e]);b.useEffect(()=>{S()},[S]);const k=async()=>{try{const M=localStorage.getItem("access-token"),L=await fetch("/api/webui/plugins/mirrors",{method:"POST",headers:{Authorization:`Bearer ${M}`,"Content-Type":"application/json"},body:JSON.stringify(y)});if(!L.ok){const P=await L.json();throw new Error(P.detail||"添加镜像源失败")}e({title:"添加成功",description:"镜像源已添加"}),m(!1),w({id:"",name:"",raw_prefix:"",clone_prefix:"",enabled:!0,priority:1}),S()}catch(M){e({title:"添加失败",description:M instanceof Error?M.message:"未知错误",variant:"destructive"})}},N=async()=>{if(c)try{const M=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${c.id}`,{method:"PUT",headers:{Authorization:`Bearer ${M}`,"Content-Type":"application/json"},body:JSON.stringify({name:y.name,raw_prefix:y.raw_prefix,clone_prefix:y.clone_prefix,enabled:y.enabled,priority:y.priority})})).ok)throw new Error("更新镜像源失败");e({title:"更新成功",description:"镜像源已更新"}),x(!1),h(null),S()}catch(M){e({title:"更新失败",description:M instanceof Error?M.message:"未知错误",variant:"destructive"})}},C=async M=>{if(confirm("确定要删除这个镜像源吗?"))try{const L=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${M}`,{method:"DELETE",headers:{Authorization:`Bearer ${L}`}})).ok)throw new Error("删除镜像源失败");e({title:"删除成功",description:"镜像源已删除"}),S()}catch(L){e({title:"删除失败",description:L instanceof Error?L.message:"未知错误",variant:"destructive"})}},T=async M=>{try{const L=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${M.id}`,{method:"PUT",headers:{Authorization:`Bearer ${L}`,"Content-Type":"application/json"},body:JSON.stringify({enabled:!M.enabled})})).ok)throw new Error("更新状态失败");S()}catch(L){e({title:"更新失败",description:L instanceof Error?L.message:"未知错误",variant:"destructive"})}},_=M=>{h(M),w({id:M.id,name:M.name,raw_prefix:M.raw_prefix,clone_prefix:M.clone_prefix,enabled:M.enabled,priority:M.priority}),x(!0)},E=async(M,L)=>{const P=L==="up"?M.priority-1:M.priority+1;if(!(P<1))try{const I=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${M.id}`,{method:"PUT",headers:{Authorization:`Bearer ${I}`,"Content-Type":"application/json"},body:JSON.stringify({priority:P})})).ok)throw new Error("更新优先级失败");S()}catch(I){e({title:"更新失败",description:I instanceof Error?I.message:"未知错误",variant:"destructive"})}};return l.jsx(hn,{className:"h-full",children:l.jsxs("div",{className:"space-y-6 p-4 sm:p-6",children:[l.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[l.jsxs("div",{className:"flex items-center gap-4",children:[l.jsx(de,{variant:"ghost",size:"icon",onClick:()=>t({to:"/plugins"}),children:l.jsx(lz,{className:"h-5 w-5"})}),l.jsxs("div",{children:[l.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"镜像源配置"}),l.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"管理 Git 克隆和文件下载的镜像源"})]})]}),l.jsxs(de,{onClick:()=>m(!0),children:[l.jsx(ws,{className:"h-4 w-4 mr-2"}),"添加镜像源"]})]}),s?l.jsx(Dt,{className:"p-6",children:l.jsx("div",{className:"flex items-center justify-center py-8",children:l.jsx(vc,{className:"h-8 w-8 animate-spin text-primary"})})}):a?l.jsx(Dt,{className:"p-6",children:l.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[l.jsx(Oa,{className:"h-12 w-12 text-destructive mb-4"}),l.jsx("h3",{className:"text-lg font-semibold mb-2",children:"加载失败"}),l.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:a}),l.jsx(de,{onClick:S,children:"重新加载"})]})}):l.jsxs(Dt,{children:[l.jsx("div",{className:"hidden md:block",children:l.jsxs(Vh,{children:[l.jsx(Uh,{children:l.jsxs(bs,{children:[l.jsx(ln,{children:"状态"}),l.jsx(ln,{children:"名称"}),l.jsx(ln,{children:"ID"}),l.jsx(ln,{children:"优先级"}),l.jsx(ln,{className:"text-right",children:"操作"})]})}),l.jsx(Wh,{children:n.map(M=>l.jsxs(bs,{children:[l.jsx(Qt,{children:l.jsx(Pt,{checked:M.enabled,onCheckedChange:()=>T(M)})}),l.jsx(Qt,{children:l.jsxs("div",{children:[l.jsx("div",{className:"font-medium",children:M.name}),l.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:["Raw: ",M.raw_prefix]})]})}),l.jsx(Qt,{children:l.jsx(In,{variant:"outline",children:M.id})}),l.jsx(Qt,{children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"font-mono",children:M.priority}),l.jsxs("div",{className:"flex flex-col gap-1",children:[l.jsx(de,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>E(M,"up"),disabled:M.priority===1,children:l.jsx($m,{className:"h-3 w-3"})}),l.jsx(de,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>E(M,"down"),children:l.jsx(Tu,{className:"h-3 w-3"})})]})]})}),l.jsx(Qt,{className:"text-right",children:l.jsxs("div",{className:"flex items-center justify-end gap-2",children:[l.jsx(de,{variant:"ghost",size:"icon",onClick:()=>_(M),children:l.jsx(wu,{className:"h-4 w-4"})}),l.jsx(de,{variant:"ghost",size:"icon",onClick:()=>C(M.id),children:l.jsx(fn,{className:"h-4 w-4 text-destructive"})})]})})]},M.id))})]})}),l.jsx("div",{className:"md:hidden p-4 space-y-4",children:n.map(M=>l.jsx(Dt,{className:"p-4",children:l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{className:"flex items-start justify-between",children:[l.jsxs("div",{className:"flex-1",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("h3",{className:"font-semibold",children:M.name}),M.enabled&&l.jsx(In,{variant:"default",className:"text-xs",children:"启用"})]}),l.jsx(In,{variant:"outline",className:"mt-1 text-xs",children:M.id})]}),l.jsx(Pt,{checked:M.enabled,onCheckedChange:()=>T(M)})]}),l.jsxs("div",{className:"text-sm space-y-1",children:[l.jsxs("div",{className:"text-muted-foreground",children:[l.jsx("span",{className:"font-medium",children:"Raw: "}),l.jsx("span",{className:"break-all",children:M.raw_prefix})]}),l.jsxs("div",{className:"text-muted-foreground",children:[l.jsx("span",{className:"font-medium",children:"优先级: "}),l.jsx("span",{className:"font-mono",children:M.priority})]})]}),l.jsxs("div",{className:"flex items-center gap-2 pt-2 border-t",children:[l.jsxs(de,{variant:"outline",size:"sm",className:"flex-1",onClick:()=>_(M),children:[l.jsx(wu,{className:"h-4 w-4 mr-1"}),"编辑"]}),l.jsx(de,{variant:"outline",size:"sm",onClick:()=>E(M,"up"),disabled:M.priority===1,children:l.jsx($m,{className:"h-4 w-4"})}),l.jsx(de,{variant:"outline",size:"sm",onClick:()=>E(M,"down"),children:l.jsx(Tu,{className:"h-4 w-4"})}),l.jsx(de,{variant:"destructive",size:"sm",onClick:()=>C(M.id),children:l.jsx(fn,{className:"h-4 w-4"})})]})]})},M.id))})]}),l.jsx(xr,{open:f,onOpenChange:m,children:l.jsxs(lr,{className:"max-w-lg",children:[l.jsxs(or,{children:[l.jsx(cr,{children:"添加镜像源"}),l.jsx(Hr,{children:"添加新的 Git 镜像源配置"})]}),l.jsxs("div",{className:"space-y-4 py-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{htmlFor:"add-id",children:"镜像源 ID *"}),l.jsx(Pe,{id:"add-id",placeholder:"例如: my-mirror",value:y.id,onChange:M=>w({...y,id:M.target.value})})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{htmlFor:"add-name",children:"名称 *"}),l.jsx(Pe,{id:"add-name",placeholder:"例如: 我的镜像源",value:y.name,onChange:M=>w({...y,name:M.target.value})})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{htmlFor:"add-raw",children:"Raw 文件前缀 *"}),l.jsx(Pe,{id:"add-raw",placeholder:"https://example.com/raw",value:y.raw_prefix,onChange:M=>w({...y,raw_prefix:M.target.value})})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{htmlFor:"add-clone",children:"克隆前缀 *"}),l.jsx(Pe,{id:"add-clone",placeholder:"https://example.com/clone",value:y.clone_prefix,onChange:M=>w({...y,clone_prefix:M.target.value})})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{htmlFor:"add-priority",children:"优先级"}),l.jsx(Pe,{id:"add-priority",type:"number",min:"1",value:y.priority,onChange:M=>w({...y,priority:parseInt(M.target.value)||1})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"数字越小优先级越高"})]}),l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(Pt,{id:"add-enabled",checked:y.enabled,onCheckedChange:M=>w({...y,enabled:M})}),l.jsx(ue,{htmlFor:"add-enabled",children:"启用此镜像源"})]})]}),l.jsxs(as,{children:[l.jsx(de,{variant:"outline",onClick:()=>m(!1),children:"取消"}),l.jsx(de,{onClick:k,children:"添加"})]})]})}),l.jsx(xr,{open:g,onOpenChange:x,children:l.jsxs(lr,{className:"max-w-lg",children:[l.jsxs(or,{children:[l.jsx(cr,{children:"编辑镜像源"}),l.jsx(Hr,{children:"修改镜像源配置"})]}),l.jsxs("div",{className:"space-y-4 py-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{children:"镜像源 ID"}),l.jsx(Pe,{value:y.id,disabled:!0})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{htmlFor:"edit-name",children:"名称 *"}),l.jsx(Pe,{id:"edit-name",value:y.name,onChange:M=>w({...y,name:M.target.value})})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{htmlFor:"edit-raw",children:"Raw 文件前缀 *"}),l.jsx(Pe,{id:"edit-raw",value:y.raw_prefix,onChange:M=>w({...y,raw_prefix:M.target.value})})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{htmlFor:"edit-clone",children:"克隆前缀 *"}),l.jsx(Pe,{id:"edit-clone",value:y.clone_prefix,onChange:M=>w({...y,clone_prefix:M.target.value})})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ue,{htmlFor:"edit-priority",children:"优先级"}),l.jsx(Pe,{id:"edit-priority",type:"number",min:"1",value:y.priority,onChange:M=>w({...y,priority:parseInt(M.target.value)||1})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"数字越小优先级越高"})]}),l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(Pt,{id:"edit-enabled",checked:y.enabled,onCheckedChange:M=>w({...y,enabled:M})}),l.jsx(ue,{htmlFor:"edit-enabled",children:"启用此镜像源"})]})]}),l.jsxs(as,{children:[l.jsx(de,{variant:"outline",onClick:()=>x(!1),children:"取消"}),l.jsx(de,{onClick:N,children:"保存"})]})]})})]})})}const Y8e=Ih("pointer-events-none inline-flex select-none items-center gap-1 rounded border bg-muted px-1.5 font-mono font-medium opacity-100",{variants:{size:{sm:"h-5 text-[10px]",default:"h-6 text-xs",lg:"h-7 text-sm"}},defaultVariants:{size:"default"}}),fU=b.forwardRef(({className:t,size:e,abbrTitle:n,children:r,...s},i)=>l.jsx("kbd",{className:ve(Y8e({size:e,className:t})),ref:i,...s,children:n?l.jsx("abbr",{title:n,children:r}):r}));fU.displayName="Kbd";const K8e=[{icon:Fm,title:"首页",description:"查看仪表板概览",path:"/",category:"概览"},{icon:lo,title:"麦麦主程序配置",description:"配置麦麦的核心设置",path:"/config/bot",category:"配置"},{icon:cz,title:"麦麦模型提供商配置",description:"配置模型提供商",path:"/config/modelProvider",category:"配置"},{icon:uz,title:"麦麦模型配置",description:"配置模型参数",path:"/config/model",category:"配置"},{icon:i6,title:"表情包管理",description:"管理麦麦的表情包",path:"/resource/emoji",category:"资源"},{icon:z0,title:"表达方式管理",description:"管理麦麦的表达方式",path:"/resource/expression",category:"资源"},{icon:dz,title:"人物信息管理",description:"管理人物信息",path:"/resource/person",category:"资源"},{icon:YK,title:"统计信息",description:"查看使用统计",path:"/statistics",category:"监控"},{icon:mh,title:"插件市场",description:"浏览和安装插件",path:"/plugins",category:"扩展"},{icon:C1,title:"日志查看器",description:"查看系统日志",path:"/logs",category:"监控"},{icon:bu,title:"系统设置",description:"配置系统参数",path:"/settings",category:"系统"}];function Z8e({open:t,onOpenChange:e}){const[n,r]=b.useState(""),[s,i]=b.useState(0),a=Da(),o=K8e.filter(f=>f.title.toLowerCase().includes(n.toLowerCase())||f.description.toLowerCase().includes(n.toLowerCase())||f.category.toLowerCase().includes(n.toLowerCase()));b.useEffect(()=>{t&&(r(""),i(0))},[t]);const c=b.useCallback(f=>{a({to:f}),e(!1)},[a,e]),h=b.useCallback(f=>{f.key==="ArrowDown"?(f.preventDefault(),i(m=>(m+1)%o.length)):f.key==="ArrowUp"?(f.preventDefault(),i(m=>(m-1+o.length)%o.length)):f.key==="Enter"&&o[s]&&(f.preventDefault(),c(o[s].path))},[o,s,c]);return l.jsx(xr,{open:t,onOpenChange:e,children:l.jsxs(lr,{className:"max-w-2xl p-0 gap-0",children:[l.jsxs(or,{className:"px-4 pt-4 pb-0",children:[l.jsx(cr,{className:"sr-only",children:"搜索"}),l.jsxs("div",{className:"relative",children:[l.jsx(ci,{className:"absolute left-3 top-1/2 h-5 w-5 -translate-y-1/2 text-muted-foreground"}),l.jsx(Pe,{value:n,onChange:f=>{r(f.target.value),i(0)},onKeyDown:h,placeholder:"搜索页面...",className:"h-12 pl-11 text-base border-0 focus-visible:ring-0 shadow-none",autoFocus:!0})]})]}),l.jsx("div",{className:"border-t",children:l.jsx(hn,{className:"h-[400px]",children:o.length>0?l.jsx("div",{className:"p-2",children:o.map((f,m)=>{const g=f.icon;return l.jsxs("button",{onClick:()=>c(f.path),onMouseEnter:()=>i(m),className:ve("w-full flex items-center gap-3 px-3 py-2.5 rounded-md text-left transition-colors",m===s?"bg-accent text-accent-foreground":"hover:bg-accent/50"),children:[l.jsx(g,{className:"h-5 w-5 flex-shrink-0"}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"font-medium text-sm",children:f.title}),l.jsx("div",{className:"text-xs text-muted-foreground truncate",children:f.description})]}),l.jsx("div",{className:"text-xs text-muted-foreground px-2 py-1 bg-muted rounded",children:f.category})]},f.path)})}):l.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[l.jsx(ci,{className:"h-12 w-12 text-muted-foreground/50 mb-4"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:n?"未找到匹配的页面":"输入关键词开始搜索"})]})})}),l.jsx("div",{className:"border-t px-4 py-3 flex items-center justify-between text-xs text-muted-foreground",children:l.jsxs("div",{className:"flex items-center gap-4",children:[l.jsxs("span",{className:"flex items-center gap-1",children:[l.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"↑"}),l.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"↓"}),"导航"]}),l.jsxs("span",{className:"flex items-center gap-1",children:[l.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"Enter"}),"选择"]}),l.jsxs("span",{className:"flex items-center gap-1",children:[l.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"Esc"}),"关闭"]})]})})]})})}function J8e(t){const e=eCe(t),n=b.forwardRef((r,s)=>{const{children:i,...a}=r,o=b.Children.toArray(i),c=o.find(nCe);if(c){const h=c.props.children,f=o.map(m=>m===c?b.Children.count(h)>1?b.Children.only(null):b.isValidElement(h)?h.props.children:null:m);return l.jsx(e,{...a,ref:s,children:b.isValidElement(h)?b.cloneElement(h,void 0,f):null})}return l.jsx(e,{...a,ref:s,children:i})});return n.displayName=`${t}.Slot`,n}function eCe(t){const e=b.forwardRef((n,r)=>{const{children:s,...i}=n;if(b.isValidElement(s)){const a=sCe(s),o=rCe(i,s.props);return s.type!==b.Fragment&&(o.ref=r?gc(r,a):a),b.cloneElement(s,o)}return b.Children.count(s)>1?b.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var tCe=Symbol("radix.slottable");function nCe(t){return b.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===tCe}function rCe(t,e){const n={...e};for(const r in e){const s=t[r],i=e[r];/^on[A-Z]/.test(r)?s&&i?n[r]=(...o)=>{const c=i(...o);return s(...o),c}:s&&(n[r]=s):r==="style"?n[r]={...s,...i}:r==="className"&&(n[r]=[s,i].filter(Boolean).join(" "))}return{...t,...n}}function sCe(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var zk=["Enter"," "],iCe=["ArrowDown","PageUp","Home"],mU=["ArrowUp","PageDown","End"],aCe=[...iCe,...mU],lCe={ltr:[...zk,"ArrowRight"],rtl:[...zk,"ArrowLeft"]},oCe={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Sp="Menu",[M0,cCe,uCe]=Cv(Sp),[Gu,pU]=ha(Sp,[uCe,Rh,Fv]),kp=Rh(),gU=Fv(),[xU,Ic]=Gu(Sp),[dCe,jp]=Gu(Sp),vU=t=>{const{__scopeMenu:e,open:n=!1,children:r,dir:s,onOpenChange:i,modal:a=!0}=t,o=kp(e),[c,h]=b.useState(null),f=b.useRef(!1),m=Os(i),g=D0(s);return b.useEffect(()=>{const x=()=>{f.current=!0,document.addEventListener("pointerdown",y,{capture:!0,once:!0}),document.addEventListener("pointermove",y,{capture:!0,once:!0})},y=()=>f.current=!1;return document.addEventListener("keydown",x,{capture:!0}),()=>{document.removeEventListener("keydown",x,{capture:!0}),document.removeEventListener("pointerdown",y,{capture:!0}),document.removeEventListener("pointermove",y,{capture:!0})}},[]),l.jsx(Av,{...o,children:l.jsx(xU,{scope:e,open:n,onOpenChange:m,content:c,onContentChange:h,children:l.jsx(dCe,{scope:e,onClose:b.useCallback(()=>m(!1),[m]),isUsingKeyboardRef:f,dir:g,modal:a,children:r})})})};vU.displayName=Sp;var hCe="MenuAnchor",RO=b.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,s=kp(n);return l.jsx(Rv,{...s,...r,ref:e})});RO.displayName=hCe;var DO="MenuPortal",[fCe,yU]=Gu(DO,{forceMount:void 0}),bU=t=>{const{__scopeMenu:e,forceMount:n,children:r,container:s}=t,i=Ic(DO,e);return l.jsx(fCe,{scope:e,forceMount:n,children:l.jsx(Fs,{present:n||i.open,children:l.jsx(Mv,{asChild:!0,container:s,children:r})})})};bU.displayName=DO;var la="MenuContent",[mCe,zO]=Gu(la),wU=b.forwardRef((t,e)=>{const n=yU(la,t.__scopeMenu),{forceMount:r=n.forceMount,...s}=t,i=Ic(la,t.__scopeMenu),a=jp(la,t.__scopeMenu);return l.jsx(M0.Provider,{scope:t.__scopeMenu,children:l.jsx(Fs,{present:r||i.open,children:l.jsx(M0.Slot,{scope:t.__scopeMenu,children:a.modal?l.jsx(pCe,{...s,ref:e}):l.jsx(gCe,{...s,ref:e})})})})}),pCe=b.forwardRef((t,e)=>{const n=Ic(la,t.__scopeMenu),r=b.useRef(null),s=Bn(e,r);return b.useEffect(()=>{const i=r.current;if(i)return KD(i)},[]),l.jsx(PO,{...t,ref:s,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:tt(t.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),gCe=b.forwardRef((t,e)=>{const n=Ic(la,t.__scopeMenu);return l.jsx(PO,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),xCe=J8e("MenuContent.ScrollLock"),PO=b.forwardRef((t,e)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:s,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEntryFocus:c,onEscapeKeyDown:h,onPointerDownOutside:f,onFocusOutside:m,onInteractOutside:g,onDismiss:x,disableOutsideScroll:y,...w}=t,S=Ic(la,n),k=jp(la,n),N=kp(n),C=gU(n),T=cCe(n),[_,E]=b.useState(null),M=b.useRef(null),L=Bn(e,M,S.onContentChange),P=b.useRef(0),I=b.useRef(""),Q=b.useRef(0),U=b.useRef(null),ee=b.useRef("right"),z=b.useRef(0),H=y?ZD:b.Fragment,B=y?{as:xCe,allowPinchZoom:!0}:void 0,X=G=>{const R=I.current+G,se=T().filter(K=>!K.disabled),W=document.activeElement,F=se.find(K=>K.ref.current===W)?.textValue,V=se.map(K=>K.textValue),te=ECe(V,R,F),ne=se.find(K=>K.textValue===te)?.ref.current;(function K(ie){I.current=ie,window.clearTimeout(P.current),ie!==""&&(P.current=window.setTimeout(()=>K(""),1e3))})(R),ne&&setTimeout(()=>ne.focus())};b.useEffect(()=>()=>window.clearTimeout(P.current),[]),JD();const J=b.useCallback(G=>ee.current===U.current?.side&&MCe(G,U.current?.area),[]);return l.jsx(mCe,{scope:n,searchRef:I,onItemEnter:b.useCallback(G=>{J(G)&&G.preventDefault()},[J]),onItemLeave:b.useCallback(G=>{J(G)||(M.current?.focus(),E(null))},[J]),onTriggerLeave:b.useCallback(G=>{J(G)&&G.preventDefault()},[J]),pointerGraceTimerRef:Q,onPointerGraceIntentChange:b.useCallback(G=>{U.current=G},[]),children:l.jsx(H,{...B,children:l.jsx(ez,{asChild:!0,trapped:s,onMountAutoFocus:tt(i,G=>{G.preventDefault(),M.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:a,children:l.jsx(n6,{asChild:!0,disableOutsidePointerEvents:o,onEscapeKeyDown:h,onPointerDownOutside:f,onFocusOutside:m,onInteractOutside:g,onDismiss:x,children:l.jsx(eP,{asChild:!0,...C,dir:k.dir,orientation:"vertical",loop:r,currentTabStopId:_,onCurrentTabStopIdChange:E,onEntryFocus:tt(c,G=>{k.isUsingKeyboardRef.current||G.preventDefault()}),preventScrollOnEntryFocus:!0,children:l.jsx(r6,{role:"menu","aria-orientation":"vertical","data-state":IU(S.open),"data-radix-menu-content":"",dir:k.dir,...N,...w,ref:L,style:{outline:"none",...w.style},onKeyDown:tt(w.onKeyDown,G=>{const se=G.target.closest("[data-radix-menu-content]")===G.currentTarget,W=G.ctrlKey||G.altKey||G.metaKey,F=G.key.length===1;se&&(G.key==="Tab"&&G.preventDefault(),!W&&F&&X(G.key));const V=M.current;if(G.target!==V||!aCe.includes(G.key))return;G.preventDefault();const ne=T().filter(K=>!K.disabled).map(K=>K.ref.current);mU.includes(G.key)&&ne.reverse(),CCe(ne)}),onBlur:tt(t.onBlur,G=>{G.currentTarget.contains(G.target)||(window.clearTimeout(P.current),I.current="")}),onPointerMove:tt(t.onPointerMove,A0(G=>{const R=G.target,se=z.current!==G.clientX;if(G.currentTarget.contains(R)&&se){const W=G.clientX>z.current?"right":"left";ee.current=W,z.current=G.clientX}}))})})})})})})});wU.displayName=la;var vCe="MenuGroup",LO=b.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return l.jsx(on.div,{role:"group",...r,ref:e})});LO.displayName=vCe;var yCe="MenuLabel",SU=b.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return l.jsx(on.div,{...r,ref:e})});SU.displayName=yCe;var kv="MenuItem",yD="menu.itemSelect",Fy=b.forwardRef((t,e)=>{const{disabled:n=!1,onSelect:r,...s}=t,i=b.useRef(null),a=jp(kv,t.__scopeMenu),o=zO(kv,t.__scopeMenu),c=Bn(e,i),h=b.useRef(!1),f=()=>{const m=i.current;if(!n&&m){const g=new CustomEvent(yD,{bubbles:!0,cancelable:!0});m.addEventListener(yD,x=>r?.(x),{once:!0}),nz(m,g),g.defaultPrevented?h.current=!1:a.onClose()}};return l.jsx(kU,{...s,ref:c,disabled:n,onClick:tt(t.onClick,f),onPointerDown:m=>{t.onPointerDown?.(m),h.current=!0},onPointerUp:tt(t.onPointerUp,m=>{h.current||m.currentTarget?.click()}),onKeyDown:tt(t.onKeyDown,m=>{const g=o.searchRef.current!=="";n||g&&m.key===" "||zk.includes(m.key)&&(m.currentTarget.click(),m.preventDefault())})})});Fy.displayName=kv;var kU=b.forwardRef((t,e)=>{const{__scopeMenu:n,disabled:r=!1,textValue:s,...i}=t,a=zO(kv,n),o=gU(n),c=b.useRef(null),h=Bn(e,c),[f,m]=b.useState(!1),[g,x]=b.useState("");return b.useEffect(()=>{const y=c.current;y&&x((y.textContent??"").trim())},[i.children]),l.jsx(M0.ItemSlot,{scope:n,disabled:r,textValue:s??g,children:l.jsx(tP,{asChild:!0,...o,focusable:!r,children:l.jsx(on.div,{role:"menuitem","data-highlighted":f?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...i,ref:h,onPointerMove:tt(t.onPointerMove,A0(y=>{r?a.onItemLeave(y):(a.onItemEnter(y),y.defaultPrevented||y.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:tt(t.onPointerLeave,A0(y=>a.onItemLeave(y))),onFocus:tt(t.onFocus,()=>m(!0)),onBlur:tt(t.onBlur,()=>m(!1))})})})}),bCe="MenuCheckboxItem",jU=b.forwardRef((t,e)=>{const{checked:n=!1,onCheckedChange:r,...s}=t;return l.jsx(EU,{scope:t.__scopeMenu,checked:n,children:l.jsx(Fy,{role:"menuitemcheckbox","aria-checked":jv(n)?"mixed":n,...s,ref:e,"data-state":qO(n),onSelect:tt(s.onSelect,()=>r?.(jv(n)?!0:!n),{checkForDefaultPrevented:!1})})})});jU.displayName=bCe;var OU="MenuRadioGroup",[wCe,SCe]=Gu(OU,{value:void 0,onValueChange:()=>{}}),NU=b.forwardRef((t,e)=>{const{value:n,onValueChange:r,...s}=t,i=Os(r);return l.jsx(wCe,{scope:t.__scopeMenu,value:n,onValueChange:i,children:l.jsx(LO,{...s,ref:e})})});NU.displayName=OU;var CU="MenuRadioItem",TU=b.forwardRef((t,e)=>{const{value:n,...r}=t,s=SCe(CU,t.__scopeMenu),i=n===s.value;return l.jsx(EU,{scope:t.__scopeMenu,checked:i,children:l.jsx(Fy,{role:"menuitemradio","aria-checked":i,...r,ref:e,"data-state":qO(i),onSelect:tt(r.onSelect,()=>s.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});TU.displayName=CU;var IO="MenuItemIndicator",[EU,kCe]=Gu(IO,{checked:!1}),_U=b.forwardRef((t,e)=>{const{__scopeMenu:n,forceMount:r,...s}=t,i=kCe(IO,n);return l.jsx(Fs,{present:r||jv(i.checked)||i.checked===!0,children:l.jsx(on.span,{...s,ref:e,"data-state":qO(i.checked)})})});_U.displayName=IO;var jCe="MenuSeparator",MU=b.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return l.jsx(on.div,{role:"separator","aria-orientation":"horizontal",...r,ref:e})});MU.displayName=jCe;var OCe="MenuArrow",AU=b.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,s=kp(n);return l.jsx(s6,{...s,...r,ref:e})});AU.displayName=OCe;var BO="MenuSub",[NCe,RU]=Gu(BO),DU=t=>{const{__scopeMenu:e,children:n,open:r=!1,onOpenChange:s}=t,i=Ic(BO,e),a=kp(e),[o,c]=b.useState(null),[h,f]=b.useState(null),m=Os(s);return b.useEffect(()=>(i.open===!1&&m(!1),()=>m(!1)),[i.open,m]),l.jsx(Av,{...a,children:l.jsx(xU,{scope:e,open:r,onOpenChange:m,content:h,onContentChange:f,children:l.jsx(NCe,{scope:e,contentId:_i(),triggerId:_i(),trigger:o,onTriggerChange:c,children:n})})})};DU.displayName=BO;var jm="MenuSubTrigger",zU=b.forwardRef((t,e)=>{const n=Ic(jm,t.__scopeMenu),r=jp(jm,t.__scopeMenu),s=RU(jm,t.__scopeMenu),i=zO(jm,t.__scopeMenu),a=b.useRef(null),{pointerGraceTimerRef:o,onPointerGraceIntentChange:c}=i,h={__scopeMenu:t.__scopeMenu},f=b.useCallback(()=>{a.current&&window.clearTimeout(a.current),a.current=null},[]);return b.useEffect(()=>f,[f]),b.useEffect(()=>{const m=o.current;return()=>{window.clearTimeout(m),c(null)}},[o,c]),l.jsx(RO,{asChild:!0,...h,children:l.jsx(kU,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":s.contentId,"data-state":IU(n.open),...t,ref:gc(e,s.onTriggerChange),onClick:m=>{t.onClick?.(m),!(t.disabled||m.defaultPrevented)&&(m.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:tt(t.onPointerMove,A0(m=>{i.onItemEnter(m),!m.defaultPrevented&&!t.disabled&&!n.open&&!a.current&&(i.onPointerGraceIntentChange(null),a.current=window.setTimeout(()=>{n.onOpenChange(!0),f()},100))})),onPointerLeave:tt(t.onPointerLeave,A0(m=>{f();const g=n.content?.getBoundingClientRect();if(g){const x=n.content?.dataset.side,y=x==="right",w=y?-5:5,S=g[y?"left":"right"],k=g[y?"right":"left"];i.onPointerGraceIntentChange({area:[{x:m.clientX+w,y:m.clientY},{x:S,y:g.top},{x:k,y:g.top},{x:k,y:g.bottom},{x:S,y:g.bottom}],side:x}),window.clearTimeout(o.current),o.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(m),m.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:tt(t.onKeyDown,m=>{const g=i.searchRef.current!=="";t.disabled||g&&m.key===" "||lCe[r.dir].includes(m.key)&&(n.onOpenChange(!0),n.content?.focus(),m.preventDefault())})})})});zU.displayName=jm;var PU="MenuSubContent",LU=b.forwardRef((t,e)=>{const n=yU(la,t.__scopeMenu),{forceMount:r=n.forceMount,...s}=t,i=Ic(la,t.__scopeMenu),a=jp(la,t.__scopeMenu),o=RU(PU,t.__scopeMenu),c=b.useRef(null),h=Bn(e,c);return l.jsx(M0.Provider,{scope:t.__scopeMenu,children:l.jsx(Fs,{present:r||i.open,children:l.jsx(M0.Slot,{scope:t.__scopeMenu,children:l.jsx(PO,{id:o.contentId,"aria-labelledby":o.triggerId,...s,ref:h,align:"start",side:a.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:f=>{a.isUsingKeyboardRef.current&&c.current?.focus(),f.preventDefault()},onCloseAutoFocus:f=>f.preventDefault(),onFocusOutside:tt(t.onFocusOutside,f=>{f.target!==o.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:tt(t.onEscapeKeyDown,f=>{a.onClose(),f.preventDefault()}),onKeyDown:tt(t.onKeyDown,f=>{const m=f.currentTarget.contains(f.target),g=oCe[a.dir].includes(f.key);m&&g&&(i.onOpenChange(!1),o.trigger?.focus(),f.preventDefault())})})})})})});LU.displayName=PU;function IU(t){return t?"open":"closed"}function jv(t){return t==="indeterminate"}function qO(t){return jv(t)?"indeterminate":t?"checked":"unchecked"}function CCe(t){const e=document.activeElement;for(const n of t)if(n===e||(n.focus(),document.activeElement!==e))return}function TCe(t,e){return t.map((n,r)=>t[(e+r)%t.length])}function ECe(t,e,n){const s=e.length>1&&Array.from(e).every(h=>h===e[0])?e[0]:e,i=n?t.indexOf(n):-1;let a=TCe(t,Math.max(i,0));s.length===1&&(a=a.filter(h=>h!==n));const c=a.find(h=>h.toLowerCase().startsWith(s.toLowerCase()));return c!==n?c:void 0}function _Ce(t,e){const{x:n,y:r}=t;let s=!1;for(let i=0,a=e.length-1;ir!=g>r&&n<(m-h)*(r-f)/(g-f)+h&&(s=!s)}return s}function MCe(t,e){if(!e)return!1;const n={x:t.clientX,y:t.clientY};return _Ce(n,e)}function A0(t){return e=>e.pointerType==="mouse"?t(e):void 0}var ACe=vU,RCe=RO,DCe=bU,zCe=wU,PCe=LO,LCe=SU,ICe=Fy,BCe=jU,qCe=NU,FCe=TU,$Ce=_U,QCe=MU,HCe=AU,VCe=DU,UCe=zU,WCe=LU,FO="ContextMenu",[GCe]=ha(FO,[pU]),Ms=pU(),[XCe,BU]=GCe(FO),qU=t=>{const{__scopeContextMenu:e,children:n,onOpenChange:r,dir:s,modal:i=!0}=t,[a,o]=b.useState(!1),c=Ms(e),h=Os(r),f=b.useCallback(m=>{o(m),h(m)},[h]);return l.jsx(XCe,{scope:e,open:a,onOpenChange:f,modal:i,children:l.jsx(ACe,{...c,dir:s,open:a,onOpenChange:f,modal:i,children:n})})};qU.displayName=FO;var FU="ContextMenuTrigger",$U=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,disabled:r=!1,...s}=t,i=BU(FU,n),a=Ms(n),o=b.useRef({x:0,y:0}),c=b.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...o.current})}),h=b.useRef(0),f=b.useCallback(()=>window.clearTimeout(h.current),[]),m=g=>{o.current={x:g.clientX,y:g.clientY},i.onOpenChange(!0)};return b.useEffect(()=>f,[f]),b.useEffect(()=>void(r&&f()),[r,f]),l.jsxs(l.Fragment,{children:[l.jsx(RCe,{...a,virtualRef:c}),l.jsx(on.span,{"data-state":i.open?"open":"closed","data-disabled":r?"":void 0,...s,ref:e,style:{WebkitTouchCallout:"none",...t.style},onContextMenu:r?t.onContextMenu:tt(t.onContextMenu,g=>{f(),m(g),g.preventDefault()}),onPointerDown:r?t.onPointerDown:tt(t.onPointerDown,Xx(g=>{f(),h.current=window.setTimeout(()=>m(g),700)})),onPointerMove:r?t.onPointerMove:tt(t.onPointerMove,Xx(f)),onPointerCancel:r?t.onPointerCancel:tt(t.onPointerCancel,Xx(f)),onPointerUp:r?t.onPointerUp:tt(t.onPointerUp,Xx(f))})]})});$U.displayName=FU;var YCe="ContextMenuPortal",QU=t=>{const{__scopeContextMenu:e,...n}=t,r=Ms(e);return l.jsx(DCe,{...r,...n})};QU.displayName=YCe;var HU="ContextMenuContent",VU=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=BU(HU,n),i=Ms(n),a=b.useRef(!1);return l.jsx(zCe,{...i,...r,ref:e,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:o=>{t.onCloseAutoFocus?.(o),!o.defaultPrevented&&a.current&&o.preventDefault(),a.current=!1},onInteractOutside:o=>{t.onInteractOutside?.(o),!o.defaultPrevented&&!s.modal&&(a.current=!0)},style:{...t.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});VU.displayName=HU;var KCe="ContextMenuGroup",ZCe=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=Ms(n);return l.jsx(PCe,{...s,...r,ref:e})});ZCe.displayName=KCe;var JCe="ContextMenuLabel",UU=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=Ms(n);return l.jsx(LCe,{...s,...r,ref:e})});UU.displayName=JCe;var e9e="ContextMenuItem",WU=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=Ms(n);return l.jsx(ICe,{...s,...r,ref:e})});WU.displayName=e9e;var t9e="ContextMenuCheckboxItem",GU=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=Ms(n);return l.jsx(BCe,{...s,...r,ref:e})});GU.displayName=t9e;var n9e="ContextMenuRadioGroup",r9e=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=Ms(n);return l.jsx(qCe,{...s,...r,ref:e})});r9e.displayName=n9e;var s9e="ContextMenuRadioItem",XU=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=Ms(n);return l.jsx(FCe,{...s,...r,ref:e})});XU.displayName=s9e;var i9e="ContextMenuItemIndicator",YU=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=Ms(n);return l.jsx($Ce,{...s,...r,ref:e})});YU.displayName=i9e;var a9e="ContextMenuSeparator",KU=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=Ms(n);return l.jsx(QCe,{...s,...r,ref:e})});KU.displayName=a9e;var l9e="ContextMenuArrow",o9e=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=Ms(n);return l.jsx(HCe,{...s,...r,ref:e})});o9e.displayName=l9e;var ZU="ContextMenuSub",JU=t=>{const{__scopeContextMenu:e,children:n,onOpenChange:r,open:s,defaultOpen:i}=t,a=Ms(e),[o,c]=wo({prop:s,defaultProp:i??!1,onChange:r,caller:ZU});return l.jsx(VCe,{...a,open:o,onOpenChange:c,children:n})};JU.displayName=ZU;var c9e="ContextMenuSubTrigger",eW=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=Ms(n);return l.jsx(UCe,{...s,...r,ref:e})});eW.displayName=c9e;var u9e="ContextMenuSubContent",tW=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=Ms(n);return l.jsx(WCe,{...s,...r,ref:e,style:{...t.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});tW.displayName=u9e;function Xx(t){return e=>e.pointerType!=="mouse"?t(e):void 0}var d9e=qU,h9e=$U,f9e=QU,nW=VU,rW=UU,sW=WU,iW=GU,aW=XU,lW=YU,oW=KU,m9e=JU,cW=eW,uW=tW;const p9e=d9e,g9e=h9e,x9e=m9e,dW=b.forwardRef(({className:t,inset:e,children:n,...r},s)=>l.jsxs(cW,{ref:s,className:ve("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",e&&"pl-8",t),...r,children:[n,l.jsx(Qu,{className:"ml-auto h-4 w-4"})]}));dW.displayName=cW.displayName;const hW=b.forwardRef(({className:t,...e},n)=>l.jsx(uW,{ref:n,className:ve("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-context-menu-content-transform-origin]",t),...e}));hW.displayName=uW.displayName;const fW=b.forwardRef(({className:t,...e},n)=>l.jsx(f9e,{children:l.jsx(nW,{ref:n,className:ve("z-50 max-h-[--radix-context-menu-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-context-menu-content-transform-origin]",t),...e})}));fW.displayName=nW.displayName;const wa=b.forwardRef(({className:t,inset:e,...n},r)=>l.jsx(sW,{ref:r,className:ve("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e&&"pl-8",t),...n}));wa.displayName=sW.displayName;const v9e=b.forwardRef(({className:t,children:e,checked:n,...r},s)=>l.jsxs(iW,{ref:s,className:ve("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),checked:n,...r,children:[l.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:l.jsx(lW,{children:l.jsx(ol,{className:"h-4 w-4"})})}),e]}));v9e.displayName=iW.displayName;const y9e=b.forwardRef(({className:t,children:e,...n},r)=>l.jsxs(aW,{ref:r,className:ve("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...n,children:[l.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:l.jsx(lW,{children:l.jsx(KK,{className:"h-2 w-2 fill-current"})})}),e]}));y9e.displayName=aW.displayName;const b9e=b.forwardRef(({className:t,inset:e,...n},r)=>l.jsx(rW,{ref:r,className:ve("px-2 py-1.5 text-sm font-semibold text-foreground",e&&"pl-8",t),...n}));b9e.displayName=rW.displayName;const Om=b.forwardRef(({className:t,...e},n)=>l.jsx(oW,{ref:n,className:ve("-mx-1 my-1 h-px bg-border",t),...e}));Om.displayName=oW.displayName;const Wd=({className:t,...e})=>l.jsx("span",{className:ve("ml-auto text-xs tracking-widest text-muted-foreground",t),...e});Wd.displayName="ContextMenuShortcut";var w9e=Symbol("radix.slottable");function S9e(t){const e=({children:n})=>l.jsx(l.Fragment,{children:n});return e.displayName=`${t}.Slottable`,e.__radixId=w9e,e}var[$y]=ha("Tooltip",[Rh]),Qy=Rh(),mW="TooltipProvider",k9e=700,Pk="tooltip.open",[j9e,$O]=$y(mW),pW=t=>{const{__scopeTooltip:e,delayDuration:n=k9e,skipDelayDuration:r=300,disableHoverableContent:s=!1,children:i}=t,a=b.useRef(!0),o=b.useRef(!1),c=b.useRef(0);return b.useEffect(()=>{const h=c.current;return()=>window.clearTimeout(h)},[]),l.jsx(j9e,{scope:e,isOpenDelayedRef:a,delayDuration:n,onOpen:b.useCallback(()=>{window.clearTimeout(c.current),a.current=!1},[]),onClose:b.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>a.current=!0,r)},[r]),isPointerInTransitRef:o,onPointerInTransitChange:b.useCallback(h=>{o.current=h},[]),disableHoverableContent:s,children:i})};pW.displayName=mW;var R0="Tooltip",[O9e,Op]=$y(R0),gW=t=>{const{__scopeTooltip:e,children:n,open:r,defaultOpen:s,onOpenChange:i,disableHoverableContent:a,delayDuration:o}=t,c=$O(R0,t.__scopeTooltip),h=Qy(e),[f,m]=b.useState(null),g=_i(),x=b.useRef(0),y=a??c.disableHoverableContent,w=o??c.delayDuration,S=b.useRef(!1),[k,N]=wo({prop:r,defaultProp:s??!1,onChange:M=>{M?(c.onOpen(),document.dispatchEvent(new CustomEvent(Pk))):c.onClose(),i?.(M)},caller:R0}),C=b.useMemo(()=>k?S.current?"delayed-open":"instant-open":"closed",[k]),T=b.useCallback(()=>{window.clearTimeout(x.current),x.current=0,S.current=!1,N(!0)},[N]),_=b.useCallback(()=>{window.clearTimeout(x.current),x.current=0,N(!1)},[N]),E=b.useCallback(()=>{window.clearTimeout(x.current),x.current=window.setTimeout(()=>{S.current=!0,N(!0),x.current=0},w)},[w,N]);return b.useEffect(()=>()=>{x.current&&(window.clearTimeout(x.current),x.current=0)},[]),l.jsx(Av,{...h,children:l.jsx(O9e,{scope:e,contentId:g,open:k,stateAttribute:C,trigger:f,onTriggerChange:m,onTriggerEnter:b.useCallback(()=>{c.isOpenDelayedRef.current?E():T()},[c.isOpenDelayedRef,E,T]),onTriggerLeave:b.useCallback(()=>{y?_():(window.clearTimeout(x.current),x.current=0)},[_,y]),onOpen:T,onClose:_,disableHoverableContent:y,children:n})})};gW.displayName=R0;var Lk="TooltipTrigger",xW=b.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,s=Op(Lk,n),i=$O(Lk,n),a=Qy(n),o=b.useRef(null),c=Bn(e,o,s.onTriggerChange),h=b.useRef(!1),f=b.useRef(!1),m=b.useCallback(()=>h.current=!1,[]);return b.useEffect(()=>()=>document.removeEventListener("pointerup",m),[m]),l.jsx(Rv,{asChild:!0,...a,children:l.jsx(on.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...r,ref:c,onPointerMove:tt(t.onPointerMove,g=>{g.pointerType!=="touch"&&!f.current&&!i.isPointerInTransitRef.current&&(s.onTriggerEnter(),f.current=!0)}),onPointerLeave:tt(t.onPointerLeave,()=>{s.onTriggerLeave(),f.current=!1}),onPointerDown:tt(t.onPointerDown,()=>{s.open&&s.onClose(),h.current=!0,document.addEventListener("pointerup",m,{once:!0})}),onFocus:tt(t.onFocus,()=>{h.current||s.onOpen()}),onBlur:tt(t.onBlur,s.onClose),onClick:tt(t.onClick,s.onClose)})})});xW.displayName=Lk;var QO="TooltipPortal",[N9e,C9e]=$y(QO,{forceMount:void 0}),vW=t=>{const{__scopeTooltip:e,forceMount:n,children:r,container:s}=t,i=Op(QO,e);return l.jsx(N9e,{scope:e,forceMount:n,children:l.jsx(Fs,{present:n||i.open,children:l.jsx(Mv,{asChild:!0,container:s,children:r})})})};vW.displayName=QO;var Ah="TooltipContent",yW=b.forwardRef((t,e)=>{const n=C9e(Ah,t.__scopeTooltip),{forceMount:r=n.forceMount,side:s="top",...i}=t,a=Op(Ah,t.__scopeTooltip);return l.jsx(Fs,{present:r||a.open,children:a.disableHoverableContent?l.jsx(bW,{side:s,...i,ref:e}):l.jsx(T9e,{side:s,...i,ref:e})})}),T9e=b.forwardRef((t,e)=>{const n=Op(Ah,t.__scopeTooltip),r=$O(Ah,t.__scopeTooltip),s=b.useRef(null),i=Bn(e,s),[a,o]=b.useState(null),{trigger:c,onClose:h}=n,f=s.current,{onPointerInTransitChange:m}=r,g=b.useCallback(()=>{o(null),m(!1)},[m]),x=b.useCallback((y,w)=>{const S=y.currentTarget,k={x:y.clientX,y:y.clientY},N=R9e(k,S.getBoundingClientRect()),C=D9e(k,N),T=z9e(w.getBoundingClientRect()),_=L9e([...C,...T]);o(_),m(!0)},[m]);return b.useEffect(()=>()=>g(),[g]),b.useEffect(()=>{if(c&&f){const y=S=>x(S,f),w=S=>x(S,c);return c.addEventListener("pointerleave",y),f.addEventListener("pointerleave",w),()=>{c.removeEventListener("pointerleave",y),f.removeEventListener("pointerleave",w)}}},[c,f,x,g]),b.useEffect(()=>{if(a){const y=w=>{const S=w.target,k={x:w.clientX,y:w.clientY},N=c?.contains(S)||f?.contains(S),C=!P9e(k,a);N?g():C&&(g(),h())};return document.addEventListener("pointermove",y),()=>document.removeEventListener("pointermove",y)}},[c,f,a,h,g]),l.jsx(bW,{...t,ref:i})}),[E9e,_9e]=$y(R0,{isInside:!1}),M9e=S9e("TooltipContent"),bW=b.forwardRef((t,e)=>{const{__scopeTooltip:n,children:r,"aria-label":s,onEscapeKeyDown:i,onPointerDownOutside:a,...o}=t,c=Op(Ah,n),h=Qy(n),{onClose:f}=c;return b.useEffect(()=>(document.addEventListener(Pk,f),()=>document.removeEventListener(Pk,f)),[f]),b.useEffect(()=>{if(c.trigger){const m=g=>{g.target?.contains(c.trigger)&&f()};return window.addEventListener("scroll",m,{capture:!0}),()=>window.removeEventListener("scroll",m,{capture:!0})}},[c.trigger,f]),l.jsx(n6,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:m=>m.preventDefault(),onDismiss:f,children:l.jsxs(r6,{"data-state":c.stateAttribute,...h,...o,ref:e,style:{...o.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:[l.jsx(M9e,{children:r}),l.jsx(E9e,{scope:n,isInside:!0,children:l.jsx(OK,{id:c.contentId,role:"tooltip",children:s||r})})]})})});yW.displayName=Ah;var wW="TooltipArrow",A9e=b.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,s=Qy(n);return _9e(wW,n).isInside?null:l.jsx(s6,{...s,...r,ref:e})});A9e.displayName=wW;function R9e(t,e){const n=Math.abs(e.top-t.y),r=Math.abs(e.bottom-t.y),s=Math.abs(e.right-t.x),i=Math.abs(e.left-t.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 D9e(t,e,n=5){const r=[];switch(e){case"top":r.push({x:t.x-n,y:t.y+n},{x:t.x+n,y:t.y+n});break;case"bottom":r.push({x:t.x-n,y:t.y-n},{x:t.x+n,y:t.y-n});break;case"left":r.push({x:t.x+n,y:t.y-n},{x:t.x+n,y:t.y+n});break;case"right":r.push({x:t.x-n,y:t.y-n},{x:t.x-n,y:t.y+n});break}return r}function z9e(t){const{top:e,right:n,bottom:r,left:s}=t;return[{x:s,y:e},{x:n,y:e},{x:n,y:r},{x:s,y:r}]}function P9e(t,e){const{x:n,y:r}=t;let s=!1;for(let i=0,a=e.length-1;ir!=g>r&&n<(m-h)*(r-f)/(g-f)+h&&(s=!s)}return s}function L9e(t){const e=t.slice();return e.sort((n,r)=>n.xr.x?1:n.yr.y?1:0),I9e(e)}function I9e(t){if(t.length<=1)return t.slice();const e=[];for(let r=0;r=2;){const i=e[e.length-1],a=e[e.length-2];if((i.x-a.x)*(s.y-a.y)>=(i.y-a.y)*(s.x-a.x))e.pop();else break}e.push(s)}e.pop();const n=[];for(let r=t.length-1;r>=0;r--){const s=t[r];for(;n.length>=2;){const i=n[n.length-1],a=n[n.length-2];if((i.x-a.x)*(s.y-a.y)>=(i.y-a.y)*(s.x-a.x))n.pop();else break}n.push(s)}return n.pop(),e.length===1&&n.length===1&&e[0].x===n[0].x&&e[0].y===n[0].y?e:e.concat(n)}var B9e=pW,q9e=gW,F9e=xW,$9e=vW,SW=yW;const Q9e=B9e,H9e=q9e,V9e=F9e,kW=b.forwardRef(({className:t,sideOffset:e=4,...n},r)=>l.jsx($9e,{children:l.jsx(SW,{ref:r,sideOffset:e,className:ve("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-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 origin-[--radix-tooltip-content-transform-origin]",t),...n})}));kW.displayName=SW.displayName;function U9e({children:t}){Yte();const[e,n]=b.useState(!0),[r,s]=b.useState(!1),[i,a]=b.useState(!1),{theme:o,setTheme:c}=b6(),h=oY(),f=Da();b.useEffect(()=>{const w=S=>{(S.metaKey||S.ctrlKey)&&S.key==="k"&&(S.preventDefault(),a(!0))};return window.addEventListener("keydown",w),()=>window.removeEventListener("keydown",w)},[]);const m=[{title:"概览",items:[{icon:Fm,label:"首页",path:"/"}]},{title:"麦麦配置编辑",items:[{icon:lo,label:"麦麦主程序配置",path:"/config/bot"},{icon:cz,label:"AI模型厂商配置",path:"/config/modelProvider"},{icon:uz,label:"模型管理与分配",path:"/config/model"},{icon:FC,label:"麦麦适配器配置",path:"/config/adapter"}]},{title:"麦麦资源管理",items:[{icon:i6,label:"表情包管理",path:"/resource/emoji"},{icon:z0,label:"表达方式管理",path:"/resource/expression"},{icon:dz,label:"人物信息管理",path:"/resource/person"},{icon:oz,label:"知识库图谱可视化",path:"/resource/knowledge-graph"}]},{title:"扩展与监控",items:[{icon:mh,label:"插件市场",path:"/plugins"},{icon:FC,label:"插件配置",path:"/plugin-config"},{icon:C1,label:"日志查看器",path:"/logs"}]},{title:"系统",items:[{icon:bu,label:"系统设置",path:"/settings"}]}],x=o==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":o,y=()=>{localStorage.removeItem("access-token"),f({to:"/auth"})};return l.jsx(Q9e,{delayDuration:300,children:l.jsxs("div",{className:"flex h-screen overflow-hidden",children:[l.jsxs("aside",{className:ve("fixed inset-y-0 left-0 z-50 flex flex-col border-r bg-card transition-all duration-300 lg:relative lg:z-0","w-64 lg:w-auto",e?"lg:w-64":"lg:w-16",r?"translate-x-0":"-translate-x-full lg:translate-x-0"),children:[l.jsx("div",{className:"flex h-16 items-center border-b px-4",children:l.jsxs("div",{className:ve("relative flex items-center justify-center flex-1 transition-all overflow-hidden","lg:flex-1",!e&&"lg:flex-none lg:w-8"),children:[l.jsxs("div",{className:ve("flex items-baseline gap-2",!e&&"lg:hidden"),children:[l.jsx("span",{className:"font-bold text-xl text-primary-gradient whitespace-nowrap",children:"MaiBot WebUI"}),l.jsx("span",{className:"text-xs text-primary/60 whitespace-nowrap",children:Nte()})]}),!e&&l.jsx("span",{className:"hidden lg:block font-bold text-primary-gradient text-2xl",children:"M"})]})}),l.jsx(hn,{className:ve("flex-1 overflow-x-hidden",!e&&"lg:w-16"),children:l.jsx("nav",{className:ve("p-4",!e&&"lg:p-2 lg:w-16"),children:l.jsx("ul",{className:ve("space-y-6",!e&&"lg:space-y-3 lg:w-full"),children:m.map((w,S)=>l.jsxs("li",{children:[l.jsx("div",{className:ve("px-3 h-[1.25rem]","mb-2",!e&&"lg:mb-1 lg:invisible"),children:l.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground/60 whitespace-nowrap",children:w.title})}),!e&&S>0&&l.jsx("div",{className:"hidden lg:block mb-2 border-t border-border"}),l.jsx("ul",{className:"space-y-1",children:w.items.map(k=>{const N=h({to:k.path}),C=k.icon,T=l.jsxs(l.Fragment,{children:[N&&l.jsx("div",{className:"absolute left-0 top-1/2 h-8 w-1 -translate-y-1/2 rounded-r-full bg-primary transition-opacity duration-300"}),l.jsxs("div",{className:ve("flex items-center transition-all duration-300",e?"gap-3":"gap-3 lg:gap-0"),children:[l.jsx(C,{className:ve("h-5 w-5 flex-shrink-0",N&&"text-primary"),strokeWidth:2,fill:"none"}),l.jsx("span",{className:ve("text-sm font-medium whitespace-nowrap transition-all duration-300",N&&"font-semibold",e?"opacity-100 max-w-[200px]":"opacity-100 max-w-[200px] lg:opacity-0 lg:max-w-0 lg:overflow-hidden"),children:k.label})]})]});return l.jsx("li",{className:"relative",children:l.jsxs(H9e,{children:[l.jsx(V9e,{asChild:!0,children:l.jsx(cY,{to:k.path,className:ve("relative flex items-center rounded-lg py-2 transition-all duration-300","hover:bg-accent hover:text-accent-foreground",N?"bg-accent text-foreground":"text-muted-foreground hover:text-foreground",e?"px-3":"px-3 lg:px-0 lg:justify-center lg:w-12 lg:mx-auto"),onClick:()=>s(!1),children:T})}),!e&&l.jsx(kW,{side:"right",className:"hidden lg:block",children:l.jsx("p",{children:k.label})})]})},k.path)})})]},w.title))})})})]}),r&&l.jsx("div",{className:"fixed inset-0 z-40 bg-black/50 lg:hidden",onClick:()=>s(!1)}),l.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[l.jsxs("header",{className:"flex h-16 items-center justify-between border-b bg-card/80 backdrop-blur-md px-4 sticky top-0 z-10",children:[l.jsxs("div",{className:"flex items-center gap-4",children:[l.jsx("button",{onClick:()=>s(!r),className:"rounded-lg p-2 hover:bg-accent lg:hidden",children:l.jsx(ZK,{className:"h-5 w-5"})}),l.jsx("button",{onClick:()=>n(!e),className:"hidden rounded-lg p-2 hover:bg-accent lg:block",title:e?"收起侧边栏":"展开侧边栏",children:l.jsx($u,{className:ve("h-5 w-5 transition-transform",!e&&"rotate-180")})})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsxs("button",{onClick:()=>a(!0),className:"relative hidden md:flex items-center w-64 h-9 pl-9 pr-16 bg-background/50 border rounded-md hover:bg-accent/50 transition-colors text-left",children:[l.jsx(ci,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),l.jsx("span",{className:"text-sm text-muted-foreground",children:"搜索..."}),l.jsxs(fU,{size:"sm",className:"absolute right-2 top-1/2 -translate-y-1/2",children:[l.jsx("span",{className:"text-xs",children:"⌘"}),"K"]})]}),l.jsx(Z8e,{open:i,onOpenChange:a}),l.jsxs(de,{variant:"ghost",size:"sm",onClick:()=>window.open("https://docs.mai-mai.org","_blank"),className:"gap-2",title:"查看麦麦文档",children:[l.jsx(JK,{className:"h-4 w-4"}),l.jsx("span",{className:"hidden sm:inline",children:"麦麦文档"})]}),l.jsx("button",{onClick:w=>{dte(x==="dark"?"light":"dark",c,w)},className:"rounded-lg p-2 hover:bg-accent",title:x==="dark"?"切换到浅色模式":"切换到深色模式",children:x==="dark"?l.jsx(D3,{className:"h-5 w-5"}):l.jsx(z3,{className:"h-5 w-5"})}),l.jsx("div",{className:"h-6 w-px bg-border"}),l.jsxs(de,{variant:"ghost",size:"sm",onClick:y,className:"gap-2",title:"登出系统",children:[l.jsx($C,{className:"h-4 w-4"}),l.jsx("span",{className:"hidden sm:inline",children:"登出"})]})]})]}),l.jsxs(p9e,{children:[l.jsx(g9e,{asChild:!0,children:l.jsx("main",{className:"flex-1 overflow-hidden bg-background",children:t})}),l.jsxs(fW,{className:"w-64",children:[l.jsxs(wa,{onClick:()=>f({to:"/"}),children:[l.jsx(Fm,{className:"mr-2 h-4 w-4"}),"首页"]}),l.jsxs(wa,{onClick:()=>f({to:"/settings"}),children:[l.jsx(bu,{className:"mr-2 h-4 w-4"}),"系统设置"]}),l.jsxs(wa,{onClick:()=>f({to:"/logs"}),children:[l.jsx(C1,{className:"mr-2 h-4 w-4"}),"日志查看器"]}),l.jsx(Om,{}),l.jsxs(x9e,{children:[l.jsxs(dW,{children:[l.jsx(sz,{className:"mr-2 h-4 w-4"}),"切换主题"]}),l.jsxs(hW,{className:"w-48",children:[l.jsxs(wa,{onClick:()=>c("light"),disabled:o==="light",children:[l.jsx(D3,{className:"mr-2 h-4 w-4"}),"浅色",o==="light"&&l.jsx(Wd,{children:"✓"})]}),l.jsxs(wa,{onClick:()=>c("dark"),disabled:o==="dark",children:[l.jsx(z3,{className:"mr-2 h-4 w-4"}),"深色",o==="dark"&&l.jsx(Wd,{children:"✓"})]}),l.jsxs(wa,{onClick:()=>c("system"),disabled:o==="system",children:[l.jsx(bu,{className:"mr-2 h-4 w-4"}),"跟随系统",o==="system"&&l.jsx(Wd,{children:"✓"})]})]})]}),l.jsx(Om,{}),l.jsxs(wa,{onClick:()=>window.location.reload(),children:[l.jsx(eZ,{className:"mr-2 h-4 w-4"}),"刷新页面",l.jsx(Wd,{children:"⌘R"})]}),l.jsxs(wa,{onClick:()=>a(!0),children:[l.jsx(ci,{className:"mr-2 h-4 w-4"}),"搜索",l.jsx(Wd,{children:"⌘K"})]}),l.jsx(Om,{}),l.jsxs(wa,{onClick:()=>window.open("https://docs.mai-mai.org","_blank"),children:[l.jsx(Jd,{className:"mr-2 h-4 w-4"}),"麦麦文档"]}),l.jsx(Om,{}),l.jsxs(wa,{onClick:y,className:"text-destructive focus:text-destructive",children:[l.jsx($C,{className:"mr-2 h-4 w-4"}),"登出系统"]})]})]})]})]})})}var Hy="Collapsible",[W9e]=ha(Hy),[G9e,HO]=W9e(Hy),jW=b.forwardRef((t,e)=>{const{__scopeCollapsible:n,open:r,defaultOpen:s,disabled:i,onOpenChange:a,...o}=t,[c,h]=wo({prop:r,defaultProp:s??!1,onChange:a,caller:Hy});return l.jsx(G9e,{scope:n,disabled:i,contentId:_i(),open:c,onOpenToggle:b.useCallback(()=>h(f=>!f),[h]),children:l.jsx(on.div,{"data-state":UO(c),"data-disabled":i?"":void 0,...o,ref:e})})});jW.displayName=Hy;var OW="CollapsibleTrigger",NW=b.forwardRef((t,e)=>{const{__scopeCollapsible:n,...r}=t,s=HO(OW,n);return l.jsx(on.button,{type:"button","aria-controls":s.contentId,"aria-expanded":s.open||!1,"data-state":UO(s.open),"data-disabled":s.disabled?"":void 0,disabled:s.disabled,...r,ref:e,onClick:tt(t.onClick,s.onOpenToggle)})});NW.displayName=OW;var VO="CollapsibleContent",CW=b.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=HO(VO,t.__scopeCollapsible);return l.jsx(Fs,{present:n||s.open,children:({present:i})=>l.jsx(X9e,{...r,ref:e,present:i})})});CW.displayName=VO;var X9e=b.forwardRef((t,e)=>{const{__scopeCollapsible:n,present:r,children:s,...i}=t,a=HO(VO,n),[o,c]=b.useState(r),h=b.useRef(null),f=Bn(e,h),m=b.useRef(0),g=m.current,x=b.useRef(0),y=x.current,w=a.open||o,S=b.useRef(w),k=b.useRef(void 0);return b.useEffect(()=>{const N=requestAnimationFrame(()=>S.current=!1);return()=>cancelAnimationFrame(N)},[]),Xk(()=>{const N=h.current;if(N){k.current=k.current||{transitionDuration:N.style.transitionDuration,animationName:N.style.animationName},N.style.transitionDuration="0s",N.style.animationName="none";const C=N.getBoundingClientRect();m.current=C.height,x.current=C.width,S.current||(N.style.transitionDuration=k.current.transitionDuration,N.style.animationName=k.current.animationName),c(r)}},[a.open,r]),l.jsx(on.div,{"data-state":UO(a.open),"data-disabled":a.disabled?"":void 0,id:a.contentId,hidden:!w,...i,ref:f,style:{"--radix-collapsible-content-height":g?`${g}px`:void 0,"--radix-collapsible-content-width":y?`${y}px`:void 0,...t.style},children:w&&s})});function UO(t){return t?"open":"closed"}var Y9e=jW;const bD=Y9e,wD=NW,SD=CW;function K9e(t){const e=t.split(` +`).slice(1),n=[];for(const r of e){const s=r.trim();if(!s.startsWith("at "))continue;const i=s.match(/at\s+(?:(.+?)\s+\()?(.+?):(\d+):(\d+)\)?$/);i?n.push({functionName:i[1]||"",fileName:i[2],lineNumber:i[3],columnNumber:i[4],raw:s}):n.push({functionName:"",fileName:"",lineNumber:"",columnNumber:"",raw:s})}return n}function Z9e({error:t,errorInfo:e}){const[n,r]=b.useState(!0),[s,i]=b.useState(!1),[a,o]=b.useState(!1),c=t.stack?K9e(t.stack):[],h=async()=>{const f=` Error: ${t.name} Message: ${t.message} @@ -378,4 +378,4 @@ ${e?.componentStack||"No component stack available"} URL: ${window.location.href} User Agent: ${navigator.userAgent} Time: ${new Date().toISOString()} - `.trim();try{await navigator.clipboard.writeText(f),o(!0),setTimeout(()=>o(!1),2e3)}catch(m){console.error("Failed to copy:",m)}};return l.jsxs("div",{className:"space-y-4",children:[l.jsxs(il,{variant:"destructive",className:"border-red-500/50 bg-red-500/10",children:[l.jsx(ja,{className:"h-4 w-4"}),l.jsxs(al,{className:"font-mono text-sm",children:[l.jsxs("span",{className:"font-semibold",children:[t.name,":"]})," ",t.message]})]}),c.length>0&&l.jsxs(xD,{open:n,onOpenChange:r,children:[l.jsx(vD,{asChild:!0,children:l.jsxs(fe,{variant:"ghost",className:"w-full justify-between p-3 h-auto",children:[l.jsxs("span",{className:"font-semibold text-sm flex items-center gap-2",children:[l.jsx(JK,{className:"h-4 w-4"}),"Stack Trace (",c.length," frames)"]}),n?l.jsx(Fm,{className:"h-4 w-4"}):l.jsx(Nu,{className:"h-4 w-4"})]})}),l.jsx(yD,{children:l.jsx(on,{className:"h-[280px] rounded-md border bg-muted/30",children:l.jsx("div",{className:"p-3 space-y-1",children:c.map((f,m)=>l.jsx("div",{className:"font-mono text-xs p-2 rounded hover:bg-muted/50 transition-colors",children:l.jsxs("div",{className:"flex items-start gap-2",children:[l.jsxs("span",{className:"text-muted-foreground w-6 text-right flex-shrink-0",children:[m+1,"."]}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("span",{className:"text-primary font-medium",children:f.functionName}),f.fileName&&l.jsxs("div",{className:"text-muted-foreground mt-0.5 break-all",children:[f.fileName,f.lineNumber&&l.jsxs("span",{className:"text-yellow-600 dark:text-yellow-400",children:[":",f.lineNumber,":",f.columnNumber]})]})]})]})},m))})})})]}),e?.componentStack&&l.jsxs(xD,{open:s,onOpenChange:i,children:[l.jsx(vD,{asChild:!0,children:l.jsxs(fe,{variant:"ghost",className:"w-full justify-between p-3 h-auto",children:[l.jsxs("span",{className:"font-semibold text-sm flex items-center gap-2",children:[l.jsx(ja,{className:"h-4 w-4"}),"Component Stack"]}),s?l.jsx(Fm,{className:"h-4 w-4"}):l.jsx(Nu,{className:"h-4 w-4"})]})}),l.jsx(yD,{children:l.jsx(on,{className:"h-[200px] rounded-md border bg-muted/30",children:l.jsx("pre",{className:"p-3 font-mono text-xs whitespace-pre-wrap text-muted-foreground",children:e.componentStack})})})]}),l.jsx(fe,{variant:"outline",size:"sm",onClick:h,className:"w-full",children:a?l.jsxs(l.Fragment,{children:[l.jsx(so,{className:"mr-2 h-4 w-4 text-green-500"}),"已复制到剪贴板"]}):l.jsxs(l.Fragment,{children:[l.jsx(k1,{className:"mr-2 h-4 w-4"}),"复制错误信息"]})})]})}function NW({error:t,errorInfo:e}){const n=()=>{window.location.href="/"},r=()=>{window.location.reload()};return l.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background p-4",children:l.jsxs(Tt,{className:"w-full max-w-2xl shadow-lg",children:[l.jsxs(vn,{className:"text-center pb-2",children:[l.jsx("div",{className:"mx-auto flex h-16 w-16 items-center justify-center rounded-full bg-red-100 dark:bg-red-900/30 mb-4",children:l.jsx(ja,{className:"h-8 w-8 text-red-600 dark:text-red-400"})}),l.jsx(yn,{className:"text-2xl font-bold",children:"页面出现了问题"}),l.jsx(zr,{className:"text-base mt-2",children:"应用程序遇到了意外错误。您可以尝试刷新页面或返回首页。"})]}),l.jsxs(En,{className:"space-y-4",children:[l.jsx(W9e,{error:t,errorInfo:e}),l.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 pt-2",children:[l.jsxs(fe,{onClick:r,className:"flex-1",children:[l.jsx(ti,{className:"mr-2 h-4 w-4"}),"刷新页面"]}),l.jsxs(fe,{onClick:n,variant:"outline",className:"flex-1",children:[l.jsx(qm,{className:"mr-2 h-4 w-4"}),"返回首页"]})]}),l.jsx("p",{className:"text-xs text-center text-muted-foreground pt-2",children:"如果问题持续存在,请将错误信息复制并反馈给开发者"})]})]})})}class G9e extends b.Component{constructor(e){super(e),this.state={hasError:!1,error:null,errorInfo:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,n){console.error("ErrorBoundary caught an error:",e,n),this.setState({errorInfo:n})}handleReset=()=>{this.setState({hasError:!1,error:null,errorInfo:null})};render(){return this.state.hasError&&this.state.error?this.props.fallback?this.props.fallback:l.jsx(NW,{error:this.state.error,errorInfo:this.state.errorInfo}):this.props.children}}function CW({error:t}){return l.jsx(NW,{error:t,errorInfo:null})}const kp=oY({component:()=>l.jsxs(l.Fragment,{children:[l.jsx(wD,{}),!1]}),beforeLoad:()=>{if(window.location.pathname==="/"&&!dL())throw uY({to:"/auth"})}}),X9e=ss({getParentRoute:()=>kp,path:"/auth",component:Xte}),Y9e=ss({getParentRoute:()=>kp,path:"/setup",component:vne}),Is=ss({getParentRoute:()=>kp,id:"protected",component:()=>l.jsx(F9e,{children:l.jsx(wD,{})}),errorComponent:({error:t})=>l.jsx(CW,{error:t})}),K9e=ss({getParentRoute:()=>Is,path:"/",component:lte}),Z9e=ss({getParentRoute:()=>Is,path:"/config/bot",component:phe}),J9e=ss({getParentRoute:()=>Is,path:"/config/modelProvider",component:sfe}),eTe=ss({getParentRoute:()=>Is,path:"/config/model",component:Gme}),tTe=ss({getParentRoute:()=>Is,path:"/config/adapter",component:Yme}),nTe=ss({getParentRoute:()=>Is,path:"/resource/emoji",component:bwe}),rTe=ss({getParentRoute:()=>Is,path:"/resource/expression",component:Mwe}),sTe=ss({getParentRoute:()=>Is,path:"/resource/person",component:$we}),iTe=ss({getParentRoute:()=>Is,path:"/resource/knowledge-graph",component:AOe}),aTe=ss({getParentRoute:()=>Is,path:"/logs",component:k8e}),lTe=ss({getParentRoute:()=>Is,path:"/plugins",component:$8e}),oTe=ss({getParentRoute:()=>Is,path:"/plugin-config",component:Q8e}),cTe=ss({getParentRoute:()=>Is,path:"/plugin-mirrors",component:H8e}),uTe=ss({getParentRoute:()=>Is,path:"/settings",component:Fte}),dTe=ss({getParentRoute:()=>kp,path:"*",component:mL}),hTe=kp.addChildren([X9e,Y9e,Is.addChildren([K9e,Z9e,J9e,eTe,tTe,nTe,rTe,sTe,iTe,lTe,oTe,cTe,aTe,uTe]),dTe]),fTe=cY({routeTree:hTe,defaultNotFoundComponent:mL,defaultErrorComponent:({error:t})=>l.jsx(CW,{error:t})});function mTe({children:t,defaultTheme:e="system",storageKey:n="ui-theme",...r}){const[s,i]=b.useState(()=>localStorage.getItem(n)||e);b.useEffect(()=>{const o=window.document.documentElement;if(o.classList.remove("light","dark"),s==="system"){const c=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";o.classList.add(c);return}o.classList.add(s)},[s]),b.useEffect(()=>{const o=localStorage.getItem("accent-color");if(o){const c=document.documentElement,f={blue:{hsl:"221.2 83.2% 53.3%",darkHsl:"217.2 91.2% 59.8%",gradient:null},purple:{hsl:"271 91% 65%",darkHsl:"270 95% 75%",gradient:null},green:{hsl:"142 71% 45%",darkHsl:"142 76% 36%",gradient:null},orange:{hsl:"25 95% 53%",darkHsl:"20 90% 48%",gradient:null},pink:{hsl:"330 81% 60%",darkHsl:"330 85% 70%",gradient:null},red:{hsl:"0 84% 60%",darkHsl:"0 90% 70%",gradient:null},"gradient-sunset":{hsl:"15 95% 60%",darkHsl:"15 95% 65%",gradient:"linear-gradient(135deg, hsl(25 95% 53%) 0%, hsl(330 81% 60%) 100%)"},"gradient-ocean":{hsl:"200 90% 55%",darkHsl:"200 90% 60%",gradient:"linear-gradient(135deg, hsl(221.2 83.2% 53.3%) 0%, hsl(189 94% 43%) 100%)"},"gradient-forest":{hsl:"150 70% 45%",darkHsl:"150 75% 40%",gradient:"linear-gradient(135deg, hsl(142 71% 45%) 0%, hsl(158 64% 52%) 100%)"},"gradient-aurora":{hsl:"310 85% 65%",darkHsl:"310 90% 70%",gradient:"linear-gradient(135deg, hsl(271 91% 65%) 0%, hsl(330 81% 60%) 100%)"},"gradient-fire":{hsl:"15 95% 55%",darkHsl:"15 95% 60%",gradient:"linear-gradient(135deg, hsl(0 84% 60%) 0%, hsl(25 95% 53%) 100%)"},"gradient-twilight":{hsl:"250 90% 60%",darkHsl:"250 95% 65%",gradient:"linear-gradient(135deg, hsl(239 84% 67%) 0%, hsl(271 91% 65%) 100%)"}}[o];f&&(c.style.setProperty("--primary",f.hsl),f.gradient?(c.style.setProperty("--primary-gradient",f.gradient),c.classList.add("has-gradient")):(c.style.removeProperty("--primary-gradient"),c.classList.remove("has-gradient")))}},[]);const a={theme:s,setTheme:o=>{localStorage.setItem(n,o),i(o)}};return l.jsx(zP.Provider,{...r,value:a,children:t})}function pTe({children:t,defaultEnabled:e=!0,defaultWavesEnabled:n=!0,storageKey:r="enable-animations",wavesStorageKey:s="enable-waves-background"}){const[i,a]=b.useState(()=>{const f=localStorage.getItem(r);return f!==null?f==="true":e}),[o,c]=b.useState(()=>{const f=localStorage.getItem(s);return f!==null?f==="true":n});b.useEffect(()=>{const f=document.documentElement;i?f.classList.remove("no-animations"):f.classList.add("no-animations"),localStorage.setItem(r,String(i))},[i,r]),b.useEffect(()=>{localStorage.setItem(s,String(o))},[o,s]);const h={enableAnimations:i,setEnableAnimations:a,enableWavesBackground:o,setEnableWavesBackground:c};return l.jsx(PP.Provider,{value:h,children:t})}var Uj="ToastProvider",[Wj,gTe,xTe]=jv("Toast"),[TW]=ua("Toast",[xTe]),[vTe,By]=TW(Uj),EW=t=>{const{__scopeToast:e,label:n="Notification",duration:r=5e3,swipeDirection:s="right",swipeThreshold:i=50,children:a}=t,[o,c]=b.useState(null),[h,f]=b.useState(0),m=b.useRef(!1),g=b.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${Uj}\`. Expected non-empty \`string\`.`),l.jsx(Wj.Provider,{scope:e,children:l.jsx(vTe,{scope:e,label:n,duration:r,swipeDirection:s,swipeThreshold:i,toastCount:h,viewport:o,onViewportChange:c,onToastAdd:b.useCallback(()=>f(x=>x+1),[]),onToastRemove:b.useCallback(()=>f(x=>x-1),[]),isFocusedToastEscapeKeyDownRef:m,isClosePausedRef:g,children:a})})};EW.displayName=Uj;var _W="ToastViewport",yTe=["F8"],Ak="toast.viewportPause",Rk="toast.viewportResume",MW=b.forwardRef((t,e)=>{const{__scopeToast:n,hotkey:r=yTe,label:s="Notifications ({hotkey})",...i}=t,a=By(_W,n),o=gTe(n),c=b.useRef(null),h=b.useRef(null),f=b.useRef(null),m=b.useRef(null),g=Dn(e,m,a.onViewportChange),x=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),y=a.toastCount>0;b.useEffect(()=>{const S=k=>{r.length!==0&&r.every(C=>k[C]||k.code===C)&&m.current?.focus()};return document.addEventListener("keydown",S),()=>document.removeEventListener("keydown",S)},[r]),b.useEffect(()=>{const S=c.current,k=m.current;if(y&&S&&k){const N=()=>{if(!a.isClosePausedRef.current){const E=new CustomEvent(Ak);k.dispatchEvent(E),a.isClosePausedRef.current=!0}},C=()=>{if(a.isClosePausedRef.current){const E=new CustomEvent(Rk);k.dispatchEvent(E),a.isClosePausedRef.current=!1}},T=E=>{!S.contains(E.relatedTarget)&&C()},_=()=>{S.contains(document.activeElement)||C()};return S.addEventListener("focusin",N),S.addEventListener("focusout",T),S.addEventListener("pointermove",N),S.addEventListener("pointerleave",_),window.addEventListener("blur",N),window.addEventListener("focus",C),()=>{S.removeEventListener("focusin",N),S.removeEventListener("focusout",T),S.removeEventListener("pointermove",N),S.removeEventListener("pointerleave",_),window.removeEventListener("blur",N),window.removeEventListener("focus",C)}}},[y,a.isClosePausedRef]);const w=b.useCallback(({tabbingDirection:S})=>{const N=o().map(C=>{const T=C.ref.current,_=[T,...ATe(T)];return S==="forwards"?_:_.reverse()});return(S==="forwards"?N.reverse():N).flat()},[o]);return b.useEffect(()=>{const S=m.current;if(S){const k=N=>{const C=N.altKey||N.ctrlKey||N.metaKey;if(N.key==="Tab"&&!C){const _=document.activeElement,E=N.shiftKey;if(N.target===S&&E){h.current?.focus();return}const L=w({tabbingDirection:E?"backwards":"forwards"}),I=L.findIndex($=>$===_);j3(L.slice(I+1))?N.preventDefault():E?h.current?.focus():f.current?.focus()}};return S.addEventListener("keydown",k),()=>S.removeEventListener("keydown",k)}},[o,w]),l.jsxs(OK,{ref:c,role:"region","aria-label":s.replace("{hotkey}",x),tabIndex:-1,style:{pointerEvents:y?void 0:"none"},children:[y&&l.jsx(Dk,{ref:h,onFocusFromOutsideViewport:()=>{const S=w({tabbingDirection:"forwards"});j3(S)}}),l.jsx(Wj.Slot,{scope:n,children:l.jsx(nn.ol,{tabIndex:-1,...i,ref:g})}),y&&l.jsx(Dk,{ref:f,onFocusFromOutsideViewport:()=>{const S=w({tabbingDirection:"backwards"});j3(S)}})]})});MW.displayName=_W;var AW="ToastFocusProxy",Dk=b.forwardRef((t,e)=>{const{__scopeToast:n,onFocusFromOutsideViewport:r,...s}=t,i=By(AW,n);return l.jsx(ez,{tabIndex:0,...s,ref:e,style:{position:"fixed"},onFocus:a=>{const o=a.relatedTarget;!i.viewport?.contains(o)&&r()}})});Dk.displayName=AW;var Op="Toast",bTe="toast.swipeStart",wTe="toast.swipeMove",STe="toast.swipeCancel",kTe="toast.swipeEnd",RW=b.forwardRef((t,e)=>{const{forceMount:n,open:r,defaultOpen:s,onOpenChange:i,...a}=t,[o,c]=wo({prop:r,defaultProp:s??!0,onChange:i,caller:Op});return l.jsx(Ps,{present:n||o,children:l.jsx(NTe,{open:o,...a,ref:e,onClose:()=>c(!1),onPause:bs(t.onPause),onResume:bs(t.onResume),onSwipeStart:Ze(t.onSwipeStart,h=>{h.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:Ze(t.onSwipeMove,h=>{const{x:f,y:m}=h.detail.delta;h.currentTarget.setAttribute("data-swipe","move"),h.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${f}px`),h.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${m}px`)}),onSwipeCancel:Ze(t.onSwipeCancel,h=>{h.currentTarget.setAttribute("data-swipe","cancel"),h.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),h.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),h.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),h.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:Ze(t.onSwipeEnd,h=>{const{x:f,y:m}=h.detail.delta;h.currentTarget.setAttribute("data-swipe","end"),h.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),h.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),h.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${f}px`),h.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${m}px`),c(!1)})})})});RW.displayName=Op;var[OTe,jTe]=TW(Op,{onClose(){}}),NTe=b.forwardRef((t,e)=>{const{__scopeToast:n,type:r="foreground",duration:s,open:i,onClose:a,onEscapeKeyDown:o,onPause:c,onResume:h,onSwipeStart:f,onSwipeMove:m,onSwipeCancel:g,onSwipeEnd:x,...y}=t,w=By(Op,n),[S,k]=b.useState(null),N=Dn(e,z=>k(z)),C=b.useRef(null),T=b.useRef(null),_=s||w.duration,E=b.useRef(0),M=b.useRef(_),q=b.useRef(0),{onToastAdd:L,onToastRemove:I}=w,$=bs(()=>{S?.contains(document.activeElement)&&w.viewport?.focus(),a()}),V=b.useCallback(z=>{!z||z===1/0||(window.clearTimeout(q.current),E.current=new Date().getTime(),q.current=window.setTimeout($,z))},[$]);b.useEffect(()=>{const z=w.viewport;if(z){const H=()=>{V(M.current),h?.()},P=()=>{const W=new Date().getTime()-E.current;M.current=M.current-W,window.clearTimeout(q.current),c?.()};return z.addEventListener(Ak,P),z.addEventListener(Rk,H),()=>{z.removeEventListener(Ak,P),z.removeEventListener(Rk,H)}}},[w.viewport,_,c,h,V]),b.useEffect(()=>{i&&!w.isClosePausedRef.current&&V(_)},[i,_,w.isClosePausedRef,V]),b.useEffect(()=>(L(),()=>I()),[L,I]);const ee=b.useMemo(()=>S?qW(S):null,[S]);return w.viewport?l.jsxs(l.Fragment,{children:[ee&&l.jsx(CTe,{__scopeToast:n,role:"status","aria-live":r==="foreground"?"assertive":"polite",children:ee}),l.jsx(OTe,{scope:n,onClose:$,children:hu.createPortal(l.jsx(Wj.ItemSlot,{scope:n,children:l.jsx(jK,{asChild:!0,onEscapeKeyDown:Ze(o,()=>{w.isFocusedToastEscapeKeyDownRef.current||$(),w.isFocusedToastEscapeKeyDownRef.current=!1}),children:l.jsx(nn.li,{tabIndex:0,"data-state":i?"open":"closed","data-swipe-direction":w.swipeDirection,...y,ref:N,style:{userSelect:"none",touchAction:"none",...t.style},onKeyDown:Ze(t.onKeyDown,z=>{z.key==="Escape"&&(o?.(z.nativeEvent),z.nativeEvent.defaultPrevented||(w.isFocusedToastEscapeKeyDownRef.current=!0,$()))}),onPointerDown:Ze(t.onPointerDown,z=>{z.button===0&&(C.current={x:z.clientX,y:z.clientY})}),onPointerMove:Ze(t.onPointerMove,z=>{if(!C.current)return;const H=z.clientX-C.current.x,P=z.clientY-C.current.y,W=!!T.current,J=["left","right"].includes(w.swipeDirection),X=["left","up"].includes(w.swipeDirection)?Math.min:Math.max,R=J?X(0,H):0,se=J?0:X(0,P),G=z.pointerType==="touch"?10:2,F={x:R,y:se},U={originalEvent:z,delta:F};W?(T.current=F,Gx(wTe,m,U,{discrete:!1})):bD(F,w.swipeDirection,G)?(T.current=F,Gx(bTe,f,U,{discrete:!1}),z.target.setPointerCapture(z.pointerId)):(Math.abs(H)>G||Math.abs(P)>G)&&(C.current=null)}),onPointerUp:Ze(t.onPointerUp,z=>{const H=T.current,P=z.target;if(P.hasPointerCapture(z.pointerId)&&P.releasePointerCapture(z.pointerId),T.current=null,C.current=null,H){const W=z.currentTarget,J={originalEvent:z,delta:H};bD(H,w.swipeDirection,w.swipeThreshold)?Gx(kTe,x,J,{discrete:!0}):Gx(STe,g,J,{discrete:!0}),W.addEventListener("click",X=>X.preventDefault(),{once:!0})}})})})}),w.viewport)})]}):null}),CTe=t=>{const{__scopeToast:e,children:n,...r}=t,s=By(Op,e),[i,a]=b.useState(!1),[o,c]=b.useState(!1);return _Te(()=>a(!0)),b.useEffect(()=>{const h=window.setTimeout(()=>c(!0),1e3);return()=>window.clearTimeout(h)},[]),o?null:l.jsx(Ev,{asChild:!0,children:l.jsx(ez,{...r,children:i&&l.jsxs(l.Fragment,{children:[s.label," ",n]})})})},TTe="ToastTitle",DW=b.forwardRef((t,e)=>{const{__scopeToast:n,...r}=t;return l.jsx(nn.div,{...r,ref:e})});DW.displayName=TTe;var ETe="ToastDescription",zW=b.forwardRef((t,e)=>{const{__scopeToast:n,...r}=t;return l.jsx(nn.div,{...r,ref:e})});zW.displayName=ETe;var PW="ToastAction",LW=b.forwardRef((t,e)=>{const{altText:n,...r}=t;return n.trim()?l.jsx(BW,{altText:n,asChild:!0,children:l.jsx(Gj,{...r,ref:e})}):(console.error(`Invalid prop \`altText\` supplied to \`${PW}\`. Expected non-empty \`string\`.`),null)});LW.displayName=PW;var IW="ToastClose",Gj=b.forwardRef((t,e)=>{const{__scopeToast:n,...r}=t,s=jTe(IW,n);return l.jsx(BW,{asChild:!0,children:l.jsx(nn.button,{type:"button",...r,ref:e,onClick:Ze(t.onClick,s.onClose)})})});Gj.displayName=IW;var BW=b.forwardRef((t,e)=>{const{__scopeToast:n,altText:r,...s}=t;return l.jsx(nn.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":r||void 0,...s,ref:e})});function qW(t){const e=[];return Array.from(t.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&e.push(r.textContent),MTe(r)){const s=r.ariaHidden||r.hidden||r.style.display==="none",i=r.dataset.radixToastAnnounceExclude==="";if(!s)if(i){const a=r.dataset.radixToastAnnounceAlt;a&&e.push(a)}else e.push(...qW(r))}}),e}function Gx(t,e,n,{discrete:r}){const s=n.originalEvent.currentTarget,i=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:n});e&&s.addEventListener(t,e,{once:!0}),r?JD(s,i):s.dispatchEvent(i)}var bD=(t,e,n=0)=>{const r=Math.abs(t.x),s=Math.abs(t.y),i=r>s;return e==="left"||e==="right"?i&&r>n:!i&&s>n};function _Te(t=()=>{}){const e=bs(t);Qk(()=>{let n=0,r=0;return n=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(e)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[e])}function MTe(t){return t.nodeType===t.ELEMENT_NODE}function ATe(t){const e=[],n=document.createTreeWalker(t,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();)e.push(n.currentNode);return e}function j3(t){const e=document.activeElement;return t.some(n=>n===e?!0:(n.focus(),document.activeElement!==e))}var RTe=EW,FW=MW,$W=RW,QW=DW,HW=zW,VW=LW,UW=Gj;const DTe=RTe,WW=b.forwardRef(({className:t,...e},n)=>l.jsx(FW,{ref:n,className:ye("fixed bottom-0 right-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:max-w-[420px] gap-2",t),...e}));WW.displayName=FW.displayName;const zTe=Ih("group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md border p-4 pr-6 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-slide-in-from-right data-[state=open]:animate-fade-in data-[state=closed]:animate-slide-out-to-right data-[state=closed]:animate-fade-out data-[swipe=end]:animate-slide-out-to-right",{variants:{variant:{default:"border bg-primary/5 text-foreground backdrop-blur-sm",destructive:"destructive group border-destructive bg-destructive/10 text-destructive-foreground backdrop-blur-sm"}},defaultVariants:{variant:"default"}}),GW=b.forwardRef(({className:t,variant:e,...n},r)=>l.jsx($W,{ref:r,className:ye(zTe({variant:e}),t),...n}));GW.displayName=$W.displayName;const PTe=b.forwardRef(({className:t,...e},n)=>l.jsx(VW,{ref:n,className:ye("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors hover:bg-secondary focus:outline-none focus:ring-1 focus:ring-ring disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",t),...e}));PTe.displayName=VW.displayName;const XW=b.forwardRef(({className:t,...e},n)=>l.jsx(UW,{ref:n,className:ye("absolute right-1 top-1 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-1 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",t),"toast-close":"",...e,children:l.jsx(R0,{className:"h-4 w-4"})}));XW.displayName=UW.displayName;const YW=b.forwardRef(({className:t,...e},n)=>l.jsx(QW,{ref:n,className:ye("text-sm font-semibold [&+div]:text-xs",t),...e}));YW.displayName=QW.displayName;const KW=b.forwardRef(({className:t,...e},n)=>l.jsx(HW,{ref:n,className:ye("text-sm opacity-90",t),...e}));KW.displayName=HW.displayName;function LTe(){const{toasts:t}=Gr();return l.jsxs(DTe,{children:[t.map(function({id:e,title:n,description:r,action:s,...i}){return l.jsxs(GW,{...i,children:[l.jsxs("div",{className:"grid gap-1",children:[n&&l.jsx(YW,{children:n}),r&&l.jsx(KW,{children:r})]}),s,l.jsx(XW,{})]},e)}),l.jsx(WW,{})]})}sZ.createRoot(document.getElementById("root")).render(l.jsx(b.StrictMode,{children:l.jsx(G9e,{children:l.jsx(mTe,{defaultTheme:"system",children:l.jsxs(pTe,{children:[l.jsx(dY,{router:fTe}),l.jsx(LTe,{})]})})})})); + `.trim();try{await navigator.clipboard.writeText(f),o(!0),setTimeout(()=>o(!1),2e3)}catch(m){console.error("Failed to copy:",m)}};return l.jsxs("div",{className:"space-y-4",children:[l.jsxs(Na,{variant:"destructive",className:"border-red-500/50 bg-red-500/10",children:[l.jsx(Oa,{className:"h-4 w-4"}),l.jsxs(Ca,{className:"font-mono text-sm",children:[l.jsxs("span",{className:"font-semibold",children:[t.name,":"]})," ",t.message]})]}),c.length>0&&l.jsxs(bD,{open:n,onOpenChange:r,children:[l.jsx(wD,{asChild:!0,children:l.jsxs(de,{variant:"ghost",className:"w-full justify-between p-3 h-auto",children:[l.jsxs("span",{className:"font-semibold text-sm flex items-center gap-2",children:[l.jsx(tZ,{className:"h-4 w-4"}),"Stack Trace (",c.length," frames)"]}),n?l.jsx($m,{className:"h-4 w-4"}):l.jsx(Tu,{className:"h-4 w-4"})]})}),l.jsx(SD,{children:l.jsx(hn,{className:"h-[280px] rounded-md border bg-muted/30",children:l.jsx("div",{className:"p-3 space-y-1",children:c.map((f,m)=>l.jsx("div",{className:"font-mono text-xs p-2 rounded hover:bg-muted/50 transition-colors",children:l.jsxs("div",{className:"flex items-start gap-2",children:[l.jsxs("span",{className:"text-muted-foreground w-6 text-right flex-shrink-0",children:[m+1,"."]}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("span",{className:"text-primary font-medium",children:f.functionName}),f.fileName&&l.jsxs("div",{className:"text-muted-foreground mt-0.5 break-all",children:[f.fileName,f.lineNumber&&l.jsxs("span",{className:"text-yellow-600 dark:text-yellow-400",children:[":",f.lineNumber,":",f.columnNumber]})]})]})]})},m))})})})]}),e?.componentStack&&l.jsxs(bD,{open:s,onOpenChange:i,children:[l.jsx(wD,{asChild:!0,children:l.jsxs(de,{variant:"ghost",className:"w-full justify-between p-3 h-auto",children:[l.jsxs("span",{className:"font-semibold text-sm flex items-center gap-2",children:[l.jsx(Oa,{className:"h-4 w-4"}),"Component Stack"]}),s?l.jsx($m,{className:"h-4 w-4"}):l.jsx(Tu,{className:"h-4 w-4"})]})}),l.jsx(SD,{children:l.jsx(hn,{className:"h-[200px] rounded-md border bg-muted/30",children:l.jsx("pre",{className:"p-3 font-mono text-xs whitespace-pre-wrap text-muted-foreground",children:e.componentStack})})})]}),l.jsx(de,{variant:"outline",size:"sm",onClick:h,className:"w-full",children:a?l.jsxs(l.Fragment,{children:[l.jsx(ol,{className:"mr-2 h-4 w-4 text-green-500"}),"已复制到剪贴板"]}):l.jsxs(l.Fragment,{children:[l.jsx(O1,{className:"mr-2 h-4 w-4"}),"复制错误信息"]})})]})}function TW({error:t,errorInfo:e}){const n=()=>{window.location.href="/"},r=()=>{window.location.reload()};return l.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background p-4",children:l.jsxs(Dt,{className:"w-full max-w-2xl shadow-lg",children:[l.jsxs(kn,{className:"text-center pb-2",children:[l.jsx("div",{className:"mx-auto flex h-16 w-16 items-center justify-center rounded-full bg-red-100 dark:bg-red-900/30 mb-4",children:l.jsx(Oa,{className:"h-8 w-8 text-red-600 dark:text-red-400"})}),l.jsx(jn,{className:"text-2xl font-bold",children:"页面出现了问题"}),l.jsx(Fr,{className:"text-base mt-2",children:"应用程序遇到了意外错误。您可以尝试刷新页面或返回首页。"})]}),l.jsxs(Dn,{className:"space-y-4",children:[l.jsx(Z9e,{error:t,errorInfo:e}),l.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 pt-2",children:[l.jsxs(de,{onClick:r,className:"flex-1",children:[l.jsx(Ls,{className:"mr-2 h-4 w-4"}),"刷新页面"]}),l.jsxs(de,{onClick:n,variant:"outline",className:"flex-1",children:[l.jsx(Fm,{className:"mr-2 h-4 w-4"}),"返回首页"]})]}),l.jsx("p",{className:"text-xs text-center text-muted-foreground pt-2",children:"如果问题持续存在,请将错误信息复制并反馈给开发者"})]})]})})}class J9e extends b.Component{constructor(e){super(e),this.state={hasError:!1,error:null,errorInfo:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,n){console.error("ErrorBoundary caught an error:",e,n),this.setState({errorInfo:n})}handleReset=()=>{this.setState({hasError:!1,error:null,errorInfo:null})};render(){return this.state.hasError&&this.state.error?this.props.fallback?this.props.fallback:l.jsx(TW,{error:this.state.error,errorInfo:this.state.errorInfo}):this.props.children}}function EW({error:t}){return l.jsx(TW,{error:t,errorInfo:null})}const Np=uY({component:()=>l.jsxs(l.Fragment,{children:[l.jsx(jD,{}),!1]}),beforeLoad:()=>{if(window.location.pathname==="/"&&!fL())throw hY({to:"/auth"})}}),eTe=cs({getParentRoute:()=>Np,path:"/auth",component:Kte}),tTe=cs({getParentRoute:()=>Np,path:"/setup",component:bne}),Qs=cs({getParentRoute:()=>Np,id:"protected",component:()=>l.jsx(U9e,{children:l.jsx(jD,{})}),errorComponent:({error:t})=>l.jsx(EW,{error:t})}),nTe=cs({getParentRoute:()=>Qs,path:"/",component:cte}),rTe=cs({getParentRoute:()=>Qs,path:"/config/bot",component:vhe}),sTe=cs({getParentRoute:()=>Qs,path:"/config/modelProvider",component:ofe}),iTe=cs({getParentRoute:()=>Qs,path:"/config/model",component:Jme}),aTe=cs({getParentRoute:()=>Qs,path:"/config/adapter",component:t0e}),lTe=cs({getParentRoute:()=>Qs,path:"/resource/emoji",component:Owe}),oTe=cs({getParentRoute:()=>Qs,path:"/resource/expression",component:Pwe}),cTe=cs({getParentRoute:()=>Qs,path:"/resource/person",component:Wwe}),uTe=cs({getParentRoute:()=>Qs,path:"/resource/knowledge-graph",component:Lje}),dTe=cs({getParentRoute:()=>Qs,path:"/logs",component:T8e}),hTe=cs({getParentRoute:()=>Qs,path:"/plugins",component:W8e}),fTe=cs({getParentRoute:()=>Qs,path:"/plugin-config",component:G8e}),mTe=cs({getParentRoute:()=>Qs,path:"/plugin-mirrors",component:X8e}),pTe=cs({getParentRoute:()=>Qs,path:"/settings",component:Qte}),gTe=cs({getParentRoute:()=>Np,path:"*",component:gL}),xTe=Np.addChildren([eTe,tTe,Qs.addChildren([nTe,rTe,sTe,iTe,aTe,lTe,oTe,cTe,uTe,hTe,fTe,mTe,dTe,pTe]),gTe]),vTe=dY({routeTree:xTe,defaultNotFoundComponent:gL,defaultErrorComponent:({error:t})=>l.jsx(EW,{error:t})});function yTe({children:t,defaultTheme:e="system",storageKey:n="ui-theme",...r}){const[s,i]=b.useState(()=>localStorage.getItem(n)||e);b.useEffect(()=>{const o=window.document.documentElement;if(o.classList.remove("light","dark"),s==="system"){const c=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";o.classList.add(c);return}o.classList.add(s)},[s]),b.useEffect(()=>{const o=localStorage.getItem("accent-color");if(o){const c=document.documentElement,f={blue:{hsl:"221.2 83.2% 53.3%",darkHsl:"217.2 91.2% 59.8%",gradient:null},purple:{hsl:"271 91% 65%",darkHsl:"270 95% 75%",gradient:null},green:{hsl:"142 71% 45%",darkHsl:"142 76% 36%",gradient:null},orange:{hsl:"25 95% 53%",darkHsl:"20 90% 48%",gradient:null},pink:{hsl:"330 81% 60%",darkHsl:"330 85% 70%",gradient:null},red:{hsl:"0 84% 60%",darkHsl:"0 90% 70%",gradient:null},"gradient-sunset":{hsl:"15 95% 60%",darkHsl:"15 95% 65%",gradient:"linear-gradient(135deg, hsl(25 95% 53%) 0%, hsl(330 81% 60%) 100%)"},"gradient-ocean":{hsl:"200 90% 55%",darkHsl:"200 90% 60%",gradient:"linear-gradient(135deg, hsl(221.2 83.2% 53.3%) 0%, hsl(189 94% 43%) 100%)"},"gradient-forest":{hsl:"150 70% 45%",darkHsl:"150 75% 40%",gradient:"linear-gradient(135deg, hsl(142 71% 45%) 0%, hsl(158 64% 52%) 100%)"},"gradient-aurora":{hsl:"310 85% 65%",darkHsl:"310 90% 70%",gradient:"linear-gradient(135deg, hsl(271 91% 65%) 0%, hsl(330 81% 60%) 100%)"},"gradient-fire":{hsl:"15 95% 55%",darkHsl:"15 95% 60%",gradient:"linear-gradient(135deg, hsl(0 84% 60%) 0%, hsl(25 95% 53%) 100%)"},"gradient-twilight":{hsl:"250 90% 60%",darkHsl:"250 95% 65%",gradient:"linear-gradient(135deg, hsl(239 84% 67%) 0%, hsl(271 91% 65%) 100%)"}}[o];f&&(c.style.setProperty("--primary",f.hsl),f.gradient?(c.style.setProperty("--primary-gradient",f.gradient),c.classList.add("has-gradient")):(c.style.removeProperty("--primary-gradient"),c.classList.remove("has-gradient")))}},[]);const a={theme:s,setTheme:o=>{localStorage.setItem(n,o),i(o)}};return l.jsx(LP.Provider,{...r,value:a,children:t})}function bTe({children:t,defaultEnabled:e=!0,defaultWavesEnabled:n=!0,storageKey:r="enable-animations",wavesStorageKey:s="enable-waves-background"}){const[i,a]=b.useState(()=>{const f=localStorage.getItem(r);return f!==null?f==="true":e}),[o,c]=b.useState(()=>{const f=localStorage.getItem(s);return f!==null?f==="true":n});b.useEffect(()=>{const f=document.documentElement;i?f.classList.remove("no-animations"):f.classList.add("no-animations"),localStorage.setItem(r,String(i))},[i,r]),b.useEffect(()=>{localStorage.setItem(s,String(o))},[o,s]);const h={enableAnimations:i,setEnableAnimations:a,enableWavesBackground:o,setEnableWavesBackground:c};return l.jsx(IP.Provider,{value:h,children:t})}var WO="ToastProvider",[GO,wTe,STe]=Cv("Toast"),[_W]=ha("Toast",[STe]),[kTe,Vy]=_W(WO),MW=t=>{const{__scopeToast:e,label:n="Notification",duration:r=5e3,swipeDirection:s="right",swipeThreshold:i=50,children:a}=t,[o,c]=b.useState(null),[h,f]=b.useState(0),m=b.useRef(!1),g=b.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${WO}\`. Expected non-empty \`string\`.`),l.jsx(GO.Provider,{scope:e,children:l.jsx(kTe,{scope:e,label:n,duration:r,swipeDirection:s,swipeThreshold:i,toastCount:h,viewport:o,onViewportChange:c,onToastAdd:b.useCallback(()=>f(x=>x+1),[]),onToastRemove:b.useCallback(()=>f(x=>x-1),[]),isFocusedToastEscapeKeyDownRef:m,isClosePausedRef:g,children:a})})};MW.displayName=WO;var AW="ToastViewport",jTe=["F8"],Ik="toast.viewportPause",Bk="toast.viewportResume",RW=b.forwardRef((t,e)=>{const{__scopeToast:n,hotkey:r=jTe,label:s="Notifications ({hotkey})",...i}=t,a=Vy(AW,n),o=wTe(n),c=b.useRef(null),h=b.useRef(null),f=b.useRef(null),m=b.useRef(null),g=Bn(e,m,a.onViewportChange),x=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),y=a.toastCount>0;b.useEffect(()=>{const S=k=>{r.length!==0&&r.every(C=>k[C]||k.code===C)&&m.current?.focus()};return document.addEventListener("keydown",S),()=>document.removeEventListener("keydown",S)},[r]),b.useEffect(()=>{const S=c.current,k=m.current;if(y&&S&&k){const N=()=>{if(!a.isClosePausedRef.current){const E=new CustomEvent(Ik);k.dispatchEvent(E),a.isClosePausedRef.current=!0}},C=()=>{if(a.isClosePausedRef.current){const E=new CustomEvent(Bk);k.dispatchEvent(E),a.isClosePausedRef.current=!1}},T=E=>{!S.contains(E.relatedTarget)&&C()},_=()=>{S.contains(document.activeElement)||C()};return S.addEventListener("focusin",N),S.addEventListener("focusout",T),S.addEventListener("pointermove",N),S.addEventListener("pointerleave",_),window.addEventListener("blur",N),window.addEventListener("focus",C),()=>{S.removeEventListener("focusin",N),S.removeEventListener("focusout",T),S.removeEventListener("pointermove",N),S.removeEventListener("pointerleave",_),window.removeEventListener("blur",N),window.removeEventListener("focus",C)}}},[y,a.isClosePausedRef]);const w=b.useCallback(({tabbingDirection:S})=>{const N=o().map(C=>{const T=C.ref.current,_=[T,...LTe(T)];return S==="forwards"?_:_.reverse()});return(S==="forwards"?N.reverse():N).flat()},[o]);return b.useEffect(()=>{const S=m.current;if(S){const k=N=>{const C=N.altKey||N.ctrlKey||N.metaKey;if(N.key==="Tab"&&!C){const _=document.activeElement,E=N.shiftKey;if(N.target===S&&E){h.current?.focus();return}const P=w({tabbingDirection:E?"backwards":"forwards"}),I=P.findIndex(Q=>Q===_);M3(P.slice(I+1))?N.preventDefault():E?h.current?.focus():f.current?.focus()}};return S.addEventListener("keydown",k),()=>S.removeEventListener("keydown",k)}},[o,w]),l.jsxs(NK,{ref:c,role:"region","aria-label":s.replace("{hotkey}",x),tabIndex:-1,style:{pointerEvents:y?void 0:"none"},children:[y&&l.jsx(qk,{ref:h,onFocusFromOutsideViewport:()=>{const S=w({tabbingDirection:"forwards"});M3(S)}}),l.jsx(GO.Slot,{scope:n,children:l.jsx(on.ol,{tabIndex:-1,...i,ref:g})}),y&&l.jsx(qk,{ref:f,onFocusFromOutsideViewport:()=>{const S=w({tabbingDirection:"backwards"});M3(S)}})]})});RW.displayName=AW;var DW="ToastFocusProxy",qk=b.forwardRef((t,e)=>{const{__scopeToast:n,onFocusFromOutsideViewport:r,...s}=t,i=Vy(DW,n);return l.jsx(rz,{tabIndex:0,...s,ref:e,style:{position:"fixed"},onFocus:a=>{const o=a.relatedTarget;!i.viewport?.contains(o)&&r()}})});qk.displayName=DW;var Cp="Toast",OTe="toast.swipeStart",NTe="toast.swipeMove",CTe="toast.swipeCancel",TTe="toast.swipeEnd",zW=b.forwardRef((t,e)=>{const{forceMount:n,open:r,defaultOpen:s,onOpenChange:i,...a}=t,[o,c]=wo({prop:r,defaultProp:s??!0,onChange:i,caller:Cp});return l.jsx(Fs,{present:n||o,children:l.jsx(MTe,{open:o,...a,ref:e,onClose:()=>c(!1),onPause:Os(t.onPause),onResume:Os(t.onResume),onSwipeStart:tt(t.onSwipeStart,h=>{h.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:tt(t.onSwipeMove,h=>{const{x:f,y:m}=h.detail.delta;h.currentTarget.setAttribute("data-swipe","move"),h.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${f}px`),h.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${m}px`)}),onSwipeCancel:tt(t.onSwipeCancel,h=>{h.currentTarget.setAttribute("data-swipe","cancel"),h.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),h.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),h.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),h.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:tt(t.onSwipeEnd,h=>{const{x:f,y:m}=h.detail.delta;h.currentTarget.setAttribute("data-swipe","end"),h.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),h.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),h.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${f}px`),h.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${m}px`),c(!1)})})})});zW.displayName=Cp;var[ETe,_Te]=_W(Cp,{onClose(){}}),MTe=b.forwardRef((t,e)=>{const{__scopeToast:n,type:r="foreground",duration:s,open:i,onClose:a,onEscapeKeyDown:o,onPause:c,onResume:h,onSwipeStart:f,onSwipeMove:m,onSwipeCancel:g,onSwipeEnd:x,...y}=t,w=Vy(Cp,n),[S,k]=b.useState(null),N=Bn(e,z=>k(z)),C=b.useRef(null),T=b.useRef(null),_=s||w.duration,E=b.useRef(0),M=b.useRef(_),L=b.useRef(0),{onToastAdd:P,onToastRemove:I}=w,Q=Os(()=>{S?.contains(document.activeElement)&&w.viewport?.focus(),a()}),U=b.useCallback(z=>{!z||z===1/0||(window.clearTimeout(L.current),E.current=new Date().getTime(),L.current=window.setTimeout(Q,z))},[Q]);b.useEffect(()=>{const z=w.viewport;if(z){const H=()=>{U(M.current),h?.()},B=()=>{const X=new Date().getTime()-E.current;M.current=M.current-X,window.clearTimeout(L.current),c?.()};return z.addEventListener(Ik,B),z.addEventListener(Bk,H),()=>{z.removeEventListener(Ik,B),z.removeEventListener(Bk,H)}}},[w.viewport,_,c,h,U]),b.useEffect(()=>{i&&!w.isClosePausedRef.current&&U(_)},[i,_,w.isClosePausedRef,U]),b.useEffect(()=>(P(),()=>I()),[P,I]);const ee=b.useMemo(()=>S?$W(S):null,[S]);return w.viewport?l.jsxs(l.Fragment,{children:[ee&&l.jsx(ATe,{__scopeToast:n,role:"status","aria-live":r==="foreground"?"assertive":"polite",children:ee}),l.jsx(ETe,{scope:n,onClose:Q,children:fu.createPortal(l.jsx(GO.ItemSlot,{scope:n,children:l.jsx(CK,{asChild:!0,onEscapeKeyDown:tt(o,()=>{w.isFocusedToastEscapeKeyDownRef.current||Q(),w.isFocusedToastEscapeKeyDownRef.current=!1}),children:l.jsx(on.li,{tabIndex:0,"data-state":i?"open":"closed","data-swipe-direction":w.swipeDirection,...y,ref:N,style:{userSelect:"none",touchAction:"none",...t.style},onKeyDown:tt(t.onKeyDown,z=>{z.key==="Escape"&&(o?.(z.nativeEvent),z.nativeEvent.defaultPrevented||(w.isFocusedToastEscapeKeyDownRef.current=!0,Q()))}),onPointerDown:tt(t.onPointerDown,z=>{z.button===0&&(C.current={x:z.clientX,y:z.clientY})}),onPointerMove:tt(t.onPointerMove,z=>{if(!C.current)return;const H=z.clientX-C.current.x,B=z.clientY-C.current.y,X=!!T.current,J=["left","right"].includes(w.swipeDirection),G=["left","up"].includes(w.swipeDirection)?Math.min:Math.max,R=J?G(0,H):0,se=J?0:G(0,B),W=z.pointerType==="touch"?10:2,F={x:R,y:se},V={originalEvent:z,delta:F};X?(T.current=F,Yx(NTe,m,V,{discrete:!1})):kD(F,w.swipeDirection,W)?(T.current=F,Yx(OTe,f,V,{discrete:!1}),z.target.setPointerCapture(z.pointerId)):(Math.abs(H)>W||Math.abs(B)>W)&&(C.current=null)}),onPointerUp:tt(t.onPointerUp,z=>{const H=T.current,B=z.target;if(B.hasPointerCapture(z.pointerId)&&B.releasePointerCapture(z.pointerId),T.current=null,C.current=null,H){const X=z.currentTarget,J={originalEvent:z,delta:H};kD(H,w.swipeDirection,w.swipeThreshold)?Yx(TTe,x,J,{discrete:!0}):Yx(CTe,g,J,{discrete:!0}),X.addEventListener("click",G=>G.preventDefault(),{once:!0})}})})})}),w.viewport)})]}):null}),ATe=t=>{const{__scopeToast:e,children:n,...r}=t,s=Vy(Cp,e),[i,a]=b.useState(!1),[o,c]=b.useState(!1);return zTe(()=>a(!0)),b.useEffect(()=>{const h=window.setTimeout(()=>c(!0),1e3);return()=>window.clearTimeout(h)},[]),o?null:l.jsx(Mv,{asChild:!0,children:l.jsx(rz,{...r,children:i&&l.jsxs(l.Fragment,{children:[s.label," ",n]})})})},RTe="ToastTitle",PW=b.forwardRef((t,e)=>{const{__scopeToast:n,...r}=t;return l.jsx(on.div,{...r,ref:e})});PW.displayName=RTe;var DTe="ToastDescription",LW=b.forwardRef((t,e)=>{const{__scopeToast:n,...r}=t;return l.jsx(on.div,{...r,ref:e})});LW.displayName=DTe;var IW="ToastAction",BW=b.forwardRef((t,e)=>{const{altText:n,...r}=t;return n.trim()?l.jsx(FW,{altText:n,asChild:!0,children:l.jsx(XO,{...r,ref:e})}):(console.error(`Invalid prop \`altText\` supplied to \`${IW}\`. Expected non-empty \`string\`.`),null)});BW.displayName=IW;var qW="ToastClose",XO=b.forwardRef((t,e)=>{const{__scopeToast:n,...r}=t,s=_Te(qW,n);return l.jsx(FW,{asChild:!0,children:l.jsx(on.button,{type:"button",...r,ref:e,onClick:tt(t.onClick,s.onClose)})})});XO.displayName=qW;var FW=b.forwardRef((t,e)=>{const{__scopeToast:n,altText:r,...s}=t;return l.jsx(on.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":r||void 0,...s,ref:e})});function $W(t){const e=[];return Array.from(t.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&e.push(r.textContent),PTe(r)){const s=r.ariaHidden||r.hidden||r.style.display==="none",i=r.dataset.radixToastAnnounceExclude==="";if(!s)if(i){const a=r.dataset.radixToastAnnounceAlt;a&&e.push(a)}else e.push(...$W(r))}}),e}function Yx(t,e,n,{discrete:r}){const s=n.originalEvent.currentTarget,i=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:n});e&&s.addEventListener(t,e,{once:!0}),r?nz(s,i):s.dispatchEvent(i)}var kD=(t,e,n=0)=>{const r=Math.abs(t.x),s=Math.abs(t.y),i=r>s;return e==="left"||e==="right"?i&&r>n:!i&&s>n};function zTe(t=()=>{}){const e=Os(t);Xk(()=>{let n=0,r=0;return n=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(e)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[e])}function PTe(t){return t.nodeType===t.ELEMENT_NODE}function LTe(t){const e=[],n=document.createTreeWalker(t,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();)e.push(n.currentNode);return e}function M3(t){const e=document.activeElement;return t.some(n=>n===e?!0:(n.focus(),document.activeElement!==e))}var ITe=MW,QW=RW,HW=zW,VW=PW,UW=LW,WW=BW,GW=XO;const BTe=ITe,XW=b.forwardRef(({className:t,...e},n)=>l.jsx(QW,{ref:n,className:ve("fixed bottom-0 right-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:max-w-[420px] gap-2",t),...e}));XW.displayName=QW.displayName;const qTe=Ih("group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md border p-4 pr-6 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-slide-in-from-right data-[state=open]:animate-fade-in data-[state=closed]:animate-slide-out-to-right data-[state=closed]:animate-fade-out data-[swipe=end]:animate-slide-out-to-right",{variants:{variant:{default:"border bg-primary/5 text-foreground backdrop-blur-sm",destructive:"destructive group border-destructive bg-destructive/10 text-destructive-foreground backdrop-blur-sm"}},defaultVariants:{variant:"default"}}),YW=b.forwardRef(({className:t,variant:e,...n},r)=>l.jsx(HW,{ref:r,className:ve(qTe({variant:e}),t),...n}));YW.displayName=HW.displayName;const FTe=b.forwardRef(({className:t,...e},n)=>l.jsx(WW,{ref:n,className:ve("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors hover:bg-secondary focus:outline-none focus:ring-1 focus:ring-ring disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",t),...e}));FTe.displayName=WW.displayName;const KW=b.forwardRef(({className:t,...e},n)=>l.jsx(GW,{ref:n,className:ve("absolute right-1 top-1 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-1 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",t),"toast-close":"",...e,children:l.jsx(P0,{className:"h-4 w-4"})}));KW.displayName=GW.displayName;const ZW=b.forwardRef(({className:t,...e},n)=>l.jsx(VW,{ref:n,className:ve("text-sm font-semibold [&+div]:text-xs",t),...e}));ZW.displayName=VW.displayName;const JW=b.forwardRef(({className:t,...e},n)=>l.jsx(UW,{ref:n,className:ve("text-sm opacity-90",t),...e}));JW.displayName=UW.displayName;function $Te(){const{toasts:t}=ts();return l.jsxs(BTe,{children:[t.map(function({id:e,title:n,description:r,action:s,...i}){return l.jsxs(YW,{...i,children:[l.jsxs("div",{className:"grid gap-1",children:[n&&l.jsx(ZW,{children:n}),r&&l.jsx(JW,{children:r})]}),s,l.jsx(KW,{})]},e)}),l.jsx(XW,{})]})}aZ.createRoot(document.getElementById("root")).render(l.jsx(b.StrictMode,{children:l.jsx(J9e,{children:l.jsx(yTe,{defaultTheme:"system",children:l.jsxs(bTe,{children:[l.jsx(fY,{router:vTe}),l.jsx($Te,{})]})})})})); diff --git a/webui/dist/index.html b/webui/dist/index.html index 8a7238d5..12fade0d 100644 --- a/webui/dist/index.html +++ b/webui/dist/index.html @@ -7,7 +7,7 @@ MaiBot Dashboard - + diff --git a/webui/dist/maimai.ico b/webui/dist/maimai.ico index 578b11cd..3c1b131e 100644 Binary files a/webui/dist/maimai.ico and b/webui/dist/maimai.ico differ diff --git a/webui/dist/vite.svg b/webui/dist/vite.svg deleted file mode 100644 index e7b8dfb1..00000000 --- a/webui/dist/vite.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file