MaiBot/webui/dist/assets/index-JgAL2W8G.js

408 lines
2.1 MiB
Raw Blame History

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

import{r as b,j as o,u as Zi,R as ae,c as J1,b as pa,d as pJ,e as gJ,f as xJ,L as vJ,g as yJ,h as ms,k as bJ,l as wJ,O as Bz,m as SJ}from"./router-DQNkr8RI.js";import{a as kJ,b as OJ,g as gd}from"./react-vendor-Dtc2IqVY.js";import{c as Fz,R as jJ,T as NJ,L as CJ,a as TJ,C as Ux,X as Wx,Y as Dm,b as EJ,B as v4,d as Gx,P as _J,e as AJ,f as MJ,_ as RJ,g as DJ,h as Ge,i as PJ,j as x9,k as zJ,l as v9,m as IJ,n as LJ,o as BJ,r as qz,p as FJ,q as pj,s as $z,t as xd,u as gj,v as qJ,w as $J,x as Hz,y as Qz,z as Vz,A as xj,D as vj,E as yj,F as HJ,G as QJ,H as VJ,I as UJ,J as WJ,K as GJ,M as XJ,N as bj,O as Iy,Q as YJ,S as KJ,U as wj,V as ZJ,W as JJ,Z as Uz,$ as Wz,a0 as Gz,a1 as Xz,a2 as Ly,a3 as Yz,a4 as Kz,a5 as eee,a6 as tee,a7 as nee,a8 as ree,a9 as see,aa as iee,ab as aee,ac as oee,ad as Zz,ae as Jz,af as lee,ag as cee,ah as uee,ai as dee,aj as hee,ak as fee,al as mee,am as pee,an as gee,ao as xee,ap as vee,aq as yee,ar as bee,as as wee,at as See,au as kee}from"./charts-Cdq_Jxe7.js";import{c as Ra,a as By,u as Ui,P as xn,b as nt,d as Yn,e as Ep,f as Xl,g as Rs,h as ii,i as Uh,j as Sj,k as Fy,S as Oee,l as eI,m as tI,R as nI,O as qy,n as kj,C as $y,o as Hy,T as Oj,D as jj,p as Nj,q as rI,r as sI,W as jee,s as iI,I as Nee,t as aI,v as oI,w as Cee,x as lI,V as Tee,L as cI,y as uI,z as Eee,A as _ee,B as dI,E as Aee,F as Mee,G as Qc,H as Qy,J as vf,K as hI,M as fI,N as mI,Q as pI,U as Cj,X as Tj,Y as Vy,Z as Uy,_ as Ej,$ as gI,a0 as Ree,a1 as xI,a2 as Dee,a3 as Pee,a4 as vI,a5 as zee}from"./ui-vendor-BgfqR_Xz.js";import{R as Ps,A as Iee,D as Lee,a as ek,Z as tk,C as _h,M as Wh,T as Bee,X as _p,P as yI,S as Fee,b as Xu,I as Oa,c as Wa,d as Ro,e as Mv,E as Rv,f as Ea,g as Vc,h as qee,i as $ee,j as nk,k as rk,L as y9,K as bI,l as Uc,m as Wy,n as Hee,F as zl,o as Ah,p as Po,q as Qee,B as a0,U as Dv,r as _j,s as Vee,t as Uee,u as Ni,H as D0,v as wI,w as nd,x as P0,y as Wee,z as Gee,G as Gy,J as Aj,N as Ls,O as Sn,Q as Pv,V as Yu,W as Ap,Y as vd,_ as yd,$ as Mp,a0 as Mj,a1 as Xee,a2 as Yee,a3 as Kee,a4 as Gh,a5 as b9,a6 as Zee,a7 as Ku,a8 as sk,a9 as z0,aa as Jee,ab as ik,ac as ete,ad as SI,ae as w9,af as tte,ag as nte,ah as rte,ai as Ac,aj as y4,ak as S9,al as ste,am as ite,an as ate,ao as ote,ap as lte,aq as kI,ar as OI,as as jI,at as cte,au as ute,av as k9,aw as dte,ax as hte,ay as O9,az as fte,aA as mte}from"./icons-wa0wi-vG.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 b4={exports:{}},Pm={},w4={exports:{}},S4={};var j9;function pte(){return j9||(j9=1,(function(t){function e(F,Y){var J=F.length;F.push(Y);e:for(;0<J;){var X=J-1>>>1,R=F[X];if(0<s(R,Y))F[X]=Y,F[J]=R,J=X;else break e}}function n(F){return F.length===0?null:F[0]}function r(F){if(F.length===0)return null;var Y=F[0],J=F.pop();if(J!==Y){F[0]=J;e:for(var X=0,R=F.length,ie=R>>>1;X<ie;){var G=2*(X+1)-1,I=F[G],V=G+1,ee=F[V];if(0>s(I,J))V<R&&0>s(ee,I)?(F[X]=ee,F[V]=J,X=V):(F[X]=I,F[G]=J,X=G);else if(V<R&&0>s(ee,J))F[X]=ee,F[V]=J,X=V;else break e}}return Y}function s(F,Y){var J=F.sortIndex-Y.sortIndex;return J!==0?J:F.id-Y.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,l=a.now();t.unstable_now=function(){return a.now()-l}}var c=[],d=[],h=1,m=null,g=3,x=!1,y=!1,w=!1,S=!1,k=typeof setTimeout=="function"?setTimeout:null,j=typeof clearTimeout=="function"?clearTimeout:null,N=typeof setImmediate<"u"?setImmediate:null;function T(F){for(var Y=n(d);Y!==null;){if(Y.callback===null)r(d);else if(Y.startTime<=F)r(d),Y.sortIndex=Y.expirationTime,e(c,Y);else break;Y=n(d)}}function E(F){if(w=!1,T(F),!y)if(n(c)!==null)y=!0,_||(_=!0,U());else{var Y=n(d);Y!==null&&Q(E,Y.startTime-F)}}var _=!1,A=-1,L=5,P=-1;function B(){return S?!0:!(t.unstable_now()-P<L)}function $(){if(S=!1,_){var F=t.unstable_now();P=F;var Y=!0;try{e:{y=!1,w&&(w=!1,j(A),A=-1),x=!0;var J=g;try{t:{for(T(F),m=n(c);m!==null&&!(m.expirationTime>F&&B());){var X=m.callback;if(typeof X=="function"){m.callback=null,g=m.priorityLevel;var R=X(m.expirationTime<=F);if(F=t.unstable_now(),typeof R=="function"){m.callback=R,T(F),Y=!0;break t}m===n(c)&&r(c),T(F)}else r(c);m=n(c)}if(m!==null)Y=!0;else{var ie=n(d);ie!==null&&Q(E,ie.startTime-F),Y=!1}}break e}finally{m=null,g=J,x=!1}Y=void 0}}finally{Y?U():_=!1}}}var U;if(typeof N=="function")U=function(){N($)};else if(typeof MessageChannel<"u"){var te=new MessageChannel,z=te.port2;te.port1.onmessage=$,U=function(){z.postMessage(null)}}else U=function(){k($,0)};function Q(F,Y){A=k(function(){F(t.unstable_now())},Y)}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(F){F.callback=null},t.unstable_forceFrameRate=function(F){0>F||125<F?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):L=0<F?Math.floor(1e3/F):5},t.unstable_getCurrentPriorityLevel=function(){return g},t.unstable_next=function(F){switch(g){case 1:case 2:case 3:var Y=3;break;default:Y=g}var J=g;g=Y;try{return F()}finally{g=J}},t.unstable_requestPaint=function(){S=!0},t.unstable_runWithPriority=function(F,Y){switch(F){case 1:case 2:case 3:case 4:case 5:break;default:F=3}var J=g;g=F;try{return Y()}finally{g=J}},t.unstable_scheduleCallback=function(F,Y,J){var X=t.unstable_now();switch(typeof J=="object"&&J!==null?(J=J.delay,J=typeof J=="number"&&0<J?X+J:X):J=X,F){case 1:var R=-1;break;case 2:R=250;break;case 5:R=1073741823;break;case 4:R=1e4;break;default:R=5e3}return R=J+R,F={id:h++,callback:Y,priorityLevel:F,startTime:J,expirationTime:R,sortIndex:-1},J>X?(F.sortIndex=J,e(d,F),n(c)===null&&F===n(d)&&(w?(j(A),A=-1):w=!0,Q(E,J-X))):(F.sortIndex=R,e(c,F),y||x||(y=!0,_||(_=!0,U()))),F},t.unstable_shouldYield=B,t.unstable_wrapCallback=function(F){var Y=g;return function(){var J=g;g=Y;try{return F.apply(this,arguments)}finally{g=J}}}})(S4)),S4}var N9;function gte(){return N9||(N9=1,w4.exports=pte()),w4.exports}var C9;function xte(){if(C9)return Pm;C9=1;var t=gte(),e=kJ(),n=OJ();function r(u){var f="https://react.dev/errors/"+u;if(1<arguments.length){f+="?args[]="+encodeURIComponent(arguments[1]);for(var p=2;p<arguments.length;p++)f+="&args[]="+encodeURIComponent(arguments[p])}return"Minified React error #"+u+"; visit "+f+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(u){return!(!u||u.nodeType!==1&&u.nodeType!==9&&u.nodeType!==11)}function i(u){var f=u,p=u;if(u.alternate)for(;f.return;)f=f.return;else{u=f;do f=u,(f.flags&4098)!==0&&(p=f.return),u=f.return;while(u)}return f.tag===3?p:null}function a(u){if(u.tag===13){var f=u.memoizedState;if(f===null&&(u=u.alternate,u!==null&&(f=u.memoizedState)),f!==null)return f.dehydrated}return null}function l(u){if(u.tag===31){var f=u.memoizedState;if(f===null&&(u=u.alternate,u!==null&&(f=u.memoizedState)),f!==null)return f.dehydrated}return null}function c(u){if(i(u)!==u)throw Error(r(188))}function d(u){var f=u.alternate;if(!f){if(f=i(u),f===null)throw Error(r(188));return f!==u?null:u}for(var p=u,v=f;;){var O=p.return;if(O===null)break;var C=O.alternate;if(C===null){if(v=O.return,v!==null){p=v;continue}break}if(O.child===C.child){for(C=O.child;C;){if(C===p)return c(O),u;if(C===v)return c(O),f;C=C.sibling}throw Error(r(188))}if(p.return!==v.return)p=O,v=C;else{for(var q=!1,K=O.child;K;){if(K===p){q=!0,p=O,v=C;break}if(K===v){q=!0,v=O,p=C;break}K=K.sibling}if(!q){for(K=C.child;K;){if(K===p){q=!0,p=C,v=O;break}if(K===v){q=!0,v=C,p=O;break}K=K.sibling}if(!q)throw Error(r(189))}}if(p.alternate!==v)throw Error(r(190))}if(p.tag!==3)throw Error(r(188));return p.stateNode.current===p?u:f}function h(u){var f=u.tag;if(f===5||f===26||f===27||f===6)return u;for(u=u.child;u!==null;){if(f=h(u),f!==null)return f;u=u.sibling}return null}var m=Object.assign,g=Symbol.for("react.element"),x=Symbol.for("react.transitional.element"),y=Symbol.for("react.portal"),w=Symbol.for("react.fragment"),S=Symbol.for("react.strict_mode"),k=Symbol.for("react.profiler"),j=Symbol.for("react.consumer"),N=Symbol.for("react.context"),T=Symbol.for("react.forward_ref"),E=Symbol.for("react.suspense"),_=Symbol.for("react.suspense_list"),A=Symbol.for("react.memo"),L=Symbol.for("react.lazy"),P=Symbol.for("react.activity"),B=Symbol.for("react.memo_cache_sentinel"),$=Symbol.iterator;function U(u){return u===null||typeof u!="object"?null:(u=$&&u[$]||u["@@iterator"],typeof u=="function"?u:null)}var te=Symbol.for("react.client.reference");function z(u){if(u==null)return null;if(typeof u=="function")return u.$$typeof===te?null:u.displayName||u.name||null;if(typeof u=="string")return u;switch(u){case w:return"Fragment";case k:return"Profiler";case S:return"StrictMode";case E:return"Suspense";case _:return"SuspenseList";case P:return"Activity"}if(typeof u=="object")switch(u.$$typeof){case y:return"Portal";case N:return u.displayName||"Context";case j:return(u._context.displayName||"Context")+".Consumer";case T:var f=u.render;return u=u.displayName,u||(u=f.displayName||f.name||"",u=u!==""?"ForwardRef("+u+")":"ForwardRef"),u;case A:return f=u.displayName||null,f!==null?f:z(u.type)||"Memo";case L:f=u._payload,u=u._init;try{return z(u(f))}catch{}}return null}var Q=Array.isArray,F=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Y=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,J={pending:!1,data:null,method:null,action:null},X=[],R=-1;function ie(u){return{current:u}}function G(u){0>R||(u.current=X[R],X[R]=null,R--)}function I(u,f){R++,X[R]=u.current,u.current=f}var V=ie(null),ee=ie(null),ne=ie(null),W=ie(null);function se(u,f){switch(I(ne,f),I(ee,u),I(V,null),f.nodeType){case 9:case 11:u=(u=f.documentElement)&&(u=u.namespaceURI)?FT(u):0;break;default:if(u=f.tagName,f=f.namespaceURI)f=FT(f),u=qT(f,u);else switch(u){case"svg":u=1;break;case"math":u=2;break;default:u=0}}G(V),I(V,u)}function re(){G(V),G(ee),G(ne)}function oe(u){u.memoizedState!==null&&I(W,u);var f=V.current,p=qT(f,u.type);f!==p&&(I(ee,u),I(V,p))}function Te(u){ee.current===u&&(G(V),G(ee)),W.current===u&&(G(W),_m._currentValue=J)}var We,Ye;function Je(u){if(We===void 0)try{throw Error()}catch(p){var f=p.stack.trim().match(/\n( *(at )?)/);We=f&&f[1]||"",Ye=-1<p.stack.indexOf(`
at`)?" (<anonymous>)":-1<p.stack.indexOf("@")?"@unknown:0:0":""}return`
`+We+u+Ye}var Oe=!1;function Ve(u,f){if(!u||Oe)return"";Oe=!0;var p=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var v={DetermineComponentFrameRoot:function(){try{if(f){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(Ce){var Se=Ce}Reflect.construct(u,[],Re)}else{try{Re.call()}catch(Ce){Se=Ce}u.call(Re.prototype)}}else{try{throw Error()}catch(Ce){Se=Ce}(Re=u())&&typeof Re.catch=="function"&&Re.catch(function(){})}}catch(Ce){if(Ce&&Se&&typeof Ce.stack=="string")return[Ce.stack,Se.stack]}return[null,null]}};v.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var O=Object.getOwnPropertyDescriptor(v.DetermineComponentFrameRoot,"name");O&&O.configurable&&Object.defineProperty(v.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var C=v.DetermineComponentFrameRoot(),q=C[0],K=C[1];if(q&&K){var ue=q.split(`
`),we=K.split(`
`);for(O=v=0;v<ue.length&&!ue[v].includes("DetermineComponentFrameRoot");)v++;for(;O<we.length&&!we[O].includes("DetermineComponentFrameRoot");)O++;if(v===ue.length||O===we.length)for(v=ue.length-1,O=we.length-1;1<=v&&0<=O&&ue[v]!==we[O];)O--;for(;1<=v&&0<=O;v--,O--)if(ue[v]!==we[O]){if(v!==1||O!==1)do if(v--,O--,0>O||ue[v]!==we[O]){var Ee=`
`+ue[v].replace(" at new "," at ");return u.displayName&&Ee.includes("<anonymous>")&&(Ee=Ee.replace("<anonymous>",u.displayName)),Ee}while(1<=v&&0<=O);break}}}finally{Oe=!1,Error.prepareStackTrace=p}return(p=u?u.displayName||u.name:"")?Je(p):""}function Ue(u,f){switch(u.tag){case 26:case 27:case 5:return Je(u.type);case 16:return Je("Lazy");case 13:return u.child!==f&&f!==null?Je("Suspense Fallback"):Je("Suspense");case 19:return Je("SuspenseList");case 0:case 15:return Ve(u.type,!1);case 11:return Ve(u.type.render,!1);case 1:return Ve(u.type,!0);case 31:return Je("Activity");default:return""}}function He(u){try{var f="",p=null;do f+=Ue(u,p),p=u,u=u.return;while(u);return f}catch(v){return`
Error generating stack: `+v.message+`
`+v.stack}}var Ot=Object.prototype.hasOwnProperty,xt=t.unstable_scheduleCallback,kn=t.unstable_cancelCallback,It=t.unstable_shouldYield,Yt=t.unstable_requestPaint,_t=t.unstable_now,mt=t.unstable_getCurrentPriorityLevel,Ne=t.unstable_ImmediatePriority,Ie=t.unstable_UserBlockingPriority,st=t.unstable_NormalPriority,yt=t.unstable_LowPriority,Pt=t.unstable_IdlePriority,Mt=t.log,zn=t.unstable_setDisableYieldValue,Fe=null,rt=null;function tn(u){if(typeof Mt=="function"&&zn(u),rt&&typeof rt.setStrictMode=="function")try{rt.setStrictMode(Fe,u)}catch{}}var Rt=Math.clz32?Math.clz32:it,ke=Math.log,Pe=Math.LN2;function it(u){return u>>>=0,u===0?32:31-(ke(u)/Pe|0)|0}var ot=256,nn=262144,Kt=4194304;function pt(u){var f=u&42;if(f!==0)return f;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 xr(u,f,p){var v=u.pendingLanes;if(v===0)return 0;var O=0,C=u.suspendedLanes,q=u.pingedLanes;u=u.warmLanes;var K=v&134217727;return K!==0?(v=K&~C,v!==0?O=pt(v):(q&=K,q!==0?O=pt(q):p||(p=K&~u,p!==0&&(O=pt(p))))):(K=v&~C,K!==0?O=pt(K):q!==0?O=pt(q):p||(p=v&~u,p!==0&&(O=pt(p)))),O===0?0:f!==0&&f!==O&&(f&C)===0&&(C=O&-O,p=f&-f,C>=p||C===32&&(p&4194048)!==0)?f:O}function Ur(u,f){return(u.pendingLanes&~(u.suspendedLanes&~u.pingedLanes)&f)===0}function Wr(u,f){switch(u){case 1:case 2:case 4:case 8:case 64:return f+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 f+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 vr(){var u=Kt;return Kt<<=1,(Kt&62914560)===0&&(Kt=4194304),u}function In(u){for(var f=[],p=0;31>p;p++)f.push(u);return f}function cr(u,f){u.pendingLanes|=f,f!==268435456&&(u.suspendedLanes=0,u.pingedLanes=0,u.warmLanes=0)}function nr(u,f,p,v,O,C){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 K=u.entanglements,ue=u.expirationTimes,we=u.hiddenUpdates;for(p=q&~p;0<p;){var Ee=31-Rt(p),Re=1<<Ee;K[Ee]=0,ue[Ee]=-1;var Se=we[Ee];if(Se!==null)for(we[Ee]=null,Ee=0;Ee<Se.length;Ee++){var Ce=Se[Ee];Ce!==null&&(Ce.lane&=-536870913)}p&=~Re}v!==0&&gs(u,v,0),C!==0&&O===0&&u.tag!==0&&(u.suspendedLanes|=C&~(q&~f))}function gs(u,f,p){u.pendingLanes|=f,u.suspendedLanes&=~f;var v=31-Rt(f);u.entangledLanes|=f,u.entanglements[v]=u.entanglements[v]|1073741824|p&261930}function xs(u,f){var p=u.entangledLanes|=f;for(u=u.entanglements;p;){var v=31-Rt(p),O=1<<v;O&f|u[v]&f&&(u[v]|=f),p&=~O}}function js(u,f){var p=f&-f;return p=(p&42)!==0?1:ge(p),(p&(u.suspendedLanes|f))!==0?0:p}function ge(u){switch(u){case 2:u=1;break;case 8:u=4;break;case 32:u=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:u=128;break;case 268435456:u=134217728;break;default:u=0}return u}function Le(u){return u&=-u,2<u?8<u?(u&134217727)!==0?32:268435456:8:2}function Ct(){var u=Y.p;return u!==0?u:(u=window.event,u===void 0?32:u9(u.type))}function vn(u,f){var p=Y.p;try{return Y.p=u,f()}finally{Y.p=p}}var Fr=Math.random().toString(36).slice(2),Cr="__reactFiber$"+Fr,Tr="__reactProps$"+Fr,Ns="__reactContainer$"+Fr,Qf="__reactEvents$"+Fr,lw="__reactListeners$"+Fr,cw="__reactHandles$"+Fr,Eg="__reactResources$"+Fr,mu="__reactMarker$"+Fr;function Vf(u){delete u[Cr],delete u[Tr],delete u[Qf],delete u[lw],delete u[cw]}function ec(u){var f=u[Cr];if(f)return f;for(var p=u.parentNode;p;){if(f=p[Ns]||p[Cr]){if(p=f.alternate,f.child!==null||p!==null&&p.child!==null)for(u=GT(u);u!==null;){if(p=u[Cr])return p;u=GT(u)}return f}u=p,p=u.parentNode}return null}function Yo(u){if(u=u[Cr]||u[Ns]){var f=u.tag;if(f===5||f===6||f===13||f===31||f===26||f===27||f===3)return u}return null}function pu(u){var f=u.tag;if(f===5||f===26||f===27||f===6)return u.stateNode;throw Error(r(33))}function tc(u){var f=u[Eg];return f||(f=u[Eg]={hoistableStyles:new Map,hoistableScripts:new Map}),f}function Gr(u){u[mu]=!0}var _g=new Set,Ag={};function Ko(u,f){Zo(u,f),Zo(u+"Capture",f)}function Zo(u,f){for(Ag[u]=f,u=0;u<f.length;u++)_g.add(f[u])}var uw=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),Mg={},Rg={};function Uf(u){return Ot.call(Rg,u)?!0:Ot.call(Mg,u)?!1:uw.test(u)?Rg[u]=!0:(Mg[u]=!0,!1)}function Dg(u,f,p){if(Uf(f))if(p===null)u.removeAttribute(f);else{switch(typeof p){case"undefined":case"function":case"symbol":u.removeAttribute(f);return;case"boolean":var v=f.toLowerCase().slice(0,5);if(v!=="data-"&&v!=="aria-"){u.removeAttribute(f);return}}u.setAttribute(f,""+p)}}function Pg(u,f,p){if(p===null)u.removeAttribute(f);else{switch(typeof p){case"undefined":case"function":case"symbol":case"boolean":u.removeAttribute(f);return}u.setAttribute(f,""+p)}}function Jo(u,f,p,v){if(v===null)u.removeAttribute(p);else{switch(typeof v){case"undefined":case"function":case"symbol":case"boolean":u.removeAttribute(p);return}u.setAttributeNS(f,p,""+v)}}function ea(u){switch(typeof u){case"bigint":case"boolean":case"number":case"string":case"undefined":return u;case"object":return u;default:return""}}function M7(u){var f=u.type;return(u=u.nodeName)&&u.toLowerCase()==="input"&&(f==="checkbox"||f==="radio")}function lK(u,f,p){var v=Object.getOwnPropertyDescriptor(u.constructor.prototype,f);if(!u.hasOwnProperty(f)&&typeof v<"u"&&typeof v.get=="function"&&typeof v.set=="function"){var O=v.get,C=v.set;return Object.defineProperty(u,f,{configurable:!0,get:function(){return O.call(this)},set:function(q){p=""+q,C.call(this,q)}}),Object.defineProperty(u,f,{enumerable:v.enumerable}),{getValue:function(){return p},setValue:function(q){p=""+q},stopTracking:function(){u._valueTracker=null,delete u[f]}}}}function dw(u){if(!u._valueTracker){var f=M7(u)?"checked":"value";u._valueTracker=lK(u,f,""+u[f])}}function R7(u){if(!u)return!1;var f=u._valueTracker;if(!f)return!0;var p=f.getValue(),v="";return u&&(v=M7(u)?u.checked?"true":"false":u.value),u=v,u!==p?(f.setValue(u),!0):!1}function zg(u){if(u=u||(typeof document<"u"?document:void 0),typeof u>"u")return null;try{return u.activeElement||u.body}catch{return u.body}}var cK=/[\n"\\]/g;function ta(u){return u.replace(cK,function(f){return"\\"+f.charCodeAt(0).toString(16)+" "})}function hw(u,f,p,v,O,C,q,K){u.name="",q!=null&&typeof q!="function"&&typeof q!="symbol"&&typeof q!="boolean"?u.type=q:u.removeAttribute("type"),f!=null?q==="number"?(f===0&&u.value===""||u.value!=f)&&(u.value=""+ea(f)):u.value!==""+ea(f)&&(u.value=""+ea(f)):q!=="submit"&&q!=="reset"||u.removeAttribute("value"),f!=null?fw(u,q,ea(f)):p!=null?fw(u,q,ea(p)):v!=null&&u.removeAttribute("value"),O==null&&C!=null&&(u.defaultChecked=!!C),O!=null&&(u.checked=O&&typeof O!="function"&&typeof O!="symbol"),K!=null&&typeof K!="function"&&typeof K!="symbol"&&typeof K!="boolean"?u.name=""+ea(K):u.removeAttribute("name")}function D7(u,f,p,v,O,C,q,K){if(C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"&&(u.type=C),f!=null||p!=null){if(!(C!=="submit"&&C!=="reset"||f!=null)){dw(u);return}p=p!=null?""+ea(p):"",f=f!=null?""+ea(f):p,K||f===u.value||(u.value=f),u.defaultValue=f}v=v??O,v=typeof v!="function"&&typeof v!="symbol"&&!!v,u.checked=K?u.checked:!!v,u.defaultChecked=!!v,q!=null&&typeof q!="function"&&typeof q!="symbol"&&typeof q!="boolean"&&(u.name=q),dw(u)}function fw(u,f,p){f==="number"&&zg(u.ownerDocument)===u||u.defaultValue===""+p||(u.defaultValue=""+p)}function Nd(u,f,p,v){if(u=u.options,f){f={};for(var O=0;O<p.length;O++)f["$"+p[O]]=!0;for(p=0;p<u.length;p++)O=f.hasOwnProperty("$"+u[p].value),u[p].selected!==O&&(u[p].selected=O),O&&v&&(u[p].defaultSelected=!0)}else{for(p=""+ea(p),f=null,O=0;O<u.length;O++){if(u[O].value===p){u[O].selected=!0,v&&(u[O].defaultSelected=!0);return}f!==null||u[O].disabled||(f=u[O])}f!==null&&(f.selected=!0)}}function P7(u,f,p){if(f!=null&&(f=""+ea(f),f!==u.value&&(u.value=f),p==null)){u.defaultValue!==f&&(u.defaultValue=f);return}u.defaultValue=p!=null?""+ea(p):""}function z7(u,f,p,v){if(f==null){if(v!=null){if(p!=null)throw Error(r(92));if(Q(v)){if(1<v.length)throw Error(r(93));v=v[0]}p=v}p==null&&(p=""),f=p}p=ea(f),u.defaultValue=p,v=u.textContent,v===p&&v!==""&&v!==null&&(u.value=v),dw(u)}function Cd(u,f){if(f){var p=u.firstChild;if(p&&p===u.lastChild&&p.nodeType===3){p.nodeValue=f;return}}u.textContent=f}var uK=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function I7(u,f,p){var v=f.indexOf("--")===0;p==null||typeof p=="boolean"||p===""?v?u.setProperty(f,""):f==="float"?u.cssFloat="":u[f]="":v?u.setProperty(f,p):typeof p!="number"||p===0||uK.has(f)?f==="float"?u.cssFloat=p:u[f]=(""+p).trim():u[f]=p+"px"}function L7(u,f,p){if(f!=null&&typeof f!="object")throw Error(r(62));if(u=u.style,p!=null){for(var v in p)!p.hasOwnProperty(v)||f!=null&&f.hasOwnProperty(v)||(v.indexOf("--")===0?u.setProperty(v,""):v==="float"?u.cssFloat="":u[v]="");for(var O in f)v=f[O],f.hasOwnProperty(O)&&p[O]!==v&&I7(u,O,v)}else for(var C in f)f.hasOwnProperty(C)&&I7(u,C,f[C])}function mw(u){if(u.indexOf("-")===-1)return!1;switch(u){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var dK=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),hK=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Ig(u){return hK.test(""+u)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":u}function el(){}var pw=null;function gw(u){return u=u.target||u.srcElement||window,u.correspondingUseElement&&(u=u.correspondingUseElement),u.nodeType===3?u.parentNode:u}var Td=null,Ed=null;function B7(u){var f=Yo(u);if(f&&(u=f.stateNode)){var p=u[Tr]||null;e:switch(u=f.stateNode,f.type){case"input":if(hw(u,p.value,p.defaultValue,p.defaultValue,p.checked,p.defaultChecked,p.type,p.name),f=p.name,p.type==="radio"&&f!=null){for(p=u;p.parentNode;)p=p.parentNode;for(p=p.querySelectorAll('input[name="'+ta(""+f)+'"][type="radio"]'),f=0;f<p.length;f++){var v=p[f];if(v!==u&&v.form===u.form){var O=v[Tr]||null;if(!O)throw Error(r(90));hw(v,O.value,O.defaultValue,O.defaultValue,O.checked,O.defaultChecked,O.type,O.name)}}for(f=0;f<p.length;f++)v=p[f],v.form===u.form&&R7(v)}break e;case"textarea":P7(u,p.value,p.defaultValue);break e;case"select":f=p.value,f!=null&&Nd(u,!!p.multiple,f,!1)}}}var xw=!1;function F7(u,f,p){if(xw)return u(f,p);xw=!0;try{var v=u(f);return v}finally{if(xw=!1,(Td!==null||Ed!==null)&&(Ox(),Td&&(f=Td,u=Ed,Ed=Td=null,B7(f),u)))for(f=0;f<u.length;f++)B7(u[f])}}function Wf(u,f){var p=u.stateNode;if(p===null)return null;var v=p[Tr]||null;if(v===null)return null;p=v[f];e:switch(f){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(v=!v.disabled)||(u=u.type,v=!(u==="button"||u==="input"||u==="select"||u==="textarea")),u=!v;break e;default:u=!1}if(u)return null;if(p&&typeof p!="function")throw Error(r(231,f,typeof p));return p}var tl=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),vw=!1;if(tl)try{var Gf={};Object.defineProperty(Gf,"passive",{get:function(){vw=!0}}),window.addEventListener("test",Gf,Gf),window.removeEventListener("test",Gf,Gf)}catch{vw=!1}var nc=null,yw=null,Lg=null;function q7(){if(Lg)return Lg;var u,f=yw,p=f.length,v,O="value"in nc?nc.value:nc.textContent,C=O.length;for(u=0;u<p&&f[u]===O[u];u++);var q=p-u;for(v=1;v<=q&&f[p-v]===O[C-v];v++);return Lg=O.slice(u,1<v?1-v:void 0)}function Bg(u){var f=u.keyCode;return"charCode"in u?(u=u.charCode,u===0&&f===13&&(u=13)):u=f,u===10&&(u=13),32<=u||u===13?u:0}function Fg(){return!0}function $7(){return!1}function oi(u){function f(p,v,O,C,q){this._reactName=p,this._targetInst=O,this.type=v,this.nativeEvent=C,this.target=q,this.currentTarget=null;for(var K in u)u.hasOwnProperty(K)&&(p=u[K],this[K]=p?p(C):C[K]);return this.isDefaultPrevented=(C.defaultPrevented!=null?C.defaultPrevented:C.returnValue===!1)?Fg:$7,this.isPropagationStopped=$7,this}return m(f.prototype,{preventDefault:function(){this.defaultPrevented=!0;var p=this.nativeEvent;p&&(p.preventDefault?p.preventDefault():typeof p.returnValue!="unknown"&&(p.returnValue=!1),this.isDefaultPrevented=Fg)},stopPropagation:function(){var p=this.nativeEvent;p&&(p.stopPropagation?p.stopPropagation():typeof p.cancelBubble!="unknown"&&(p.cancelBubble=!0),this.isPropagationStopped=Fg)},persist:function(){},isPersistent:Fg}),f}var gu={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(u){return u.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},qg=oi(gu),Xf=m({},gu,{view:0,detail:0}),fK=oi(Xf),bw,ww,Yf,$g=m({},Xf,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:kw,button:0,buttons:0,relatedTarget:function(u){return u.relatedTarget===void 0?u.fromElement===u.srcElement?u.toElement:u.fromElement:u.relatedTarget},movementX:function(u){return"movementX"in u?u.movementX:(u!==Yf&&(Yf&&u.type==="mousemove"?(bw=u.screenX-Yf.screenX,ww=u.screenY-Yf.screenY):ww=bw=0,Yf=u),bw)},movementY:function(u){return"movementY"in u?u.movementY:ww}}),H7=oi($g),mK=m({},$g,{dataTransfer:0}),pK=oi(mK),gK=m({},Xf,{relatedTarget:0}),Sw=oi(gK),xK=m({},gu,{animationName:0,elapsedTime:0,pseudoElement:0}),vK=oi(xK),yK=m({},gu,{clipboardData:function(u){return"clipboardData"in u?u.clipboardData:window.clipboardData}}),bK=oi(yK),wK=m({},gu,{data:0}),Q7=oi(wK),SK={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},kK={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},OK={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function jK(u){var f=this.nativeEvent;return f.getModifierState?f.getModifierState(u):(u=OK[u])?!!f[u]:!1}function kw(){return jK}var NK=m({},Xf,{key:function(u){if(u.key){var f=SK[u.key]||u.key;if(f!=="Unidentified")return f}return u.type==="keypress"?(u=Bg(u),u===13?"Enter":String.fromCharCode(u)):u.type==="keydown"||u.type==="keyup"?kK[u.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:kw,charCode:function(u){return u.type==="keypress"?Bg(u):0},keyCode:function(u){return u.type==="keydown"||u.type==="keyup"?u.keyCode:0},which:function(u){return u.type==="keypress"?Bg(u):u.type==="keydown"||u.type==="keyup"?u.keyCode:0}}),CK=oi(NK),TK=m({},$g,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),V7=oi(TK),EK=m({},Xf,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:kw}),_K=oi(EK),AK=m({},gu,{propertyName:0,elapsedTime:0,pseudoElement:0}),MK=oi(AK),RK=m({},$g,{deltaX:function(u){return"deltaX"in u?u.deltaX:"wheelDeltaX"in u?-u.wheelDeltaX:0},deltaY:function(u){return"deltaY"in u?u.deltaY:"wheelDeltaY"in u?-u.wheelDeltaY:"wheelDelta"in u?-u.wheelDelta:0},deltaZ:0,deltaMode:0}),DK=oi(RK),PK=m({},gu,{newState:0,oldState:0}),zK=oi(PK),IK=[9,13,27,32],Ow=tl&&"CompositionEvent"in window,Kf=null;tl&&"documentMode"in document&&(Kf=document.documentMode);var LK=tl&&"TextEvent"in window&&!Kf,U7=tl&&(!Ow||Kf&&8<Kf&&11>=Kf),W7=" ",G7=!1;function X7(u,f){switch(u){case"keyup":return IK.indexOf(f.keyCode)!==-1;case"keydown":return f.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Y7(u){return u=u.detail,typeof u=="object"&&"data"in u?u.data:null}var _d=!1;function BK(u,f){switch(u){case"compositionend":return Y7(f);case"keypress":return f.which!==32?null:(G7=!0,W7);case"textInput":return u=f.data,u===W7&&G7?null:u;default:return null}}function FK(u,f){if(_d)return u==="compositionend"||!Ow&&X7(u,f)?(u=q7(),Lg=yw=nc=null,_d=!1,u):null;switch(u){case"paste":return null;case"keypress":if(!(f.ctrlKey||f.altKey||f.metaKey)||f.ctrlKey&&f.altKey){if(f.char&&1<f.char.length)return f.char;if(f.which)return String.fromCharCode(f.which)}return null;case"compositionend":return U7&&f.locale!=="ko"?null:f.data;default:return null}}var qK={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function K7(u){var f=u&&u.nodeName&&u.nodeName.toLowerCase();return f==="input"?!!qK[u.type]:f==="textarea"}function Z7(u,f,p,v){Td?Ed?Ed.push(v):Ed=[v]:Td=v,f=Ax(f,"onChange"),0<f.length&&(p=new qg("onChange","change",null,p,v),u.push({event:p,listeners:f}))}var Zf=null,Jf=null;function $K(u){DT(u,0)}function Hg(u){var f=pu(u);if(R7(f))return u}function J7(u,f){if(u==="change")return f}var eC=!1;if(tl){var jw;if(tl){var Nw="oninput"in document;if(!Nw){var tC=document.createElement("div");tC.setAttribute("oninput","return;"),Nw=typeof tC.oninput=="function"}jw=Nw}else jw=!1;eC=jw&&(!document.documentMode||9<document.documentMode)}function nC(){Zf&&(Zf.detachEvent("onpropertychange",rC),Jf=Zf=null)}function rC(u){if(u.propertyName==="value"&&Hg(Jf)){var f=[];Z7(f,Jf,u,gw(u)),F7($K,f)}}function HK(u,f,p){u==="focusin"?(nC(),Zf=f,Jf=p,Zf.attachEvent("onpropertychange",rC)):u==="focusout"&&nC()}function QK(u){if(u==="selectionchange"||u==="keyup"||u==="keydown")return Hg(Jf)}function VK(u,f){if(u==="click")return Hg(f)}function UK(u,f){if(u==="input"||u==="change")return Hg(f)}function WK(u,f){return u===f&&(u!==0||1/u===1/f)||u!==u&&f!==f}var Ai=typeof Object.is=="function"?Object.is:WK;function em(u,f){if(Ai(u,f))return!0;if(typeof u!="object"||u===null||typeof f!="object"||f===null)return!1;var p=Object.keys(u),v=Object.keys(f);if(p.length!==v.length)return!1;for(v=0;v<p.length;v++){var O=p[v];if(!Ot.call(f,O)||!Ai(u[O],f[O]))return!1}return!0}function sC(u){for(;u&&u.firstChild;)u=u.firstChild;return u}function iC(u,f){var p=sC(u);u=0;for(var v;p;){if(p.nodeType===3){if(v=u+p.textContent.length,u<=f&&v>=f)return{node:p,offset:f-u};u=v}e:{for(;p;){if(p.nextSibling){p=p.nextSibling;break e}p=p.parentNode}p=void 0}p=sC(p)}}function aC(u,f){return u&&f?u===f?!0:u&&u.nodeType===3?!1:f&&f.nodeType===3?aC(u,f.parentNode):"contains"in u?u.contains(f):u.compareDocumentPosition?!!(u.compareDocumentPosition(f)&16):!1:!1}function oC(u){u=u!=null&&u.ownerDocument!=null&&u.ownerDocument.defaultView!=null?u.ownerDocument.defaultView:window;for(var f=zg(u.document);f instanceof u.HTMLIFrameElement;){try{var p=typeof f.contentWindow.location.href=="string"}catch{p=!1}if(p)u=f.contentWindow;else break;f=zg(u.document)}return f}function Cw(u){var f=u&&u.nodeName&&u.nodeName.toLowerCase();return f&&(f==="input"&&(u.type==="text"||u.type==="search"||u.type==="tel"||u.type==="url"||u.type==="password")||f==="textarea"||u.contentEditable==="true")}var GK=tl&&"documentMode"in document&&11>=document.documentMode,Ad=null,Tw=null,tm=null,Ew=!1;function lC(u,f,p){var v=p.window===p?p.document:p.nodeType===9?p:p.ownerDocument;Ew||Ad==null||Ad!==zg(v)||(v=Ad,"selectionStart"in v&&Cw(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}),tm&&em(tm,v)||(tm=v,v=Ax(Tw,"onSelect"),0<v.length&&(f=new qg("onSelect","select",null,f,p),u.push({event:f,listeners:v}),f.target=Ad)))}function xu(u,f){var p={};return p[u.toLowerCase()]=f.toLowerCase(),p["Webkit"+u]="webkit"+f,p["Moz"+u]="moz"+f,p}var Md={animationend:xu("Animation","AnimationEnd"),animationiteration:xu("Animation","AnimationIteration"),animationstart:xu("Animation","AnimationStart"),transitionrun:xu("Transition","TransitionRun"),transitionstart:xu("Transition","TransitionStart"),transitioncancel:xu("Transition","TransitionCancel"),transitionend:xu("Transition","TransitionEnd")},_w={},cC={};tl&&(cC=document.createElement("div").style,"AnimationEvent"in window||(delete Md.animationend.animation,delete Md.animationiteration.animation,delete Md.animationstart.animation),"TransitionEvent"in window||delete Md.transitionend.transition);function vu(u){if(_w[u])return _w[u];if(!Md[u])return u;var f=Md[u],p;for(p in f)if(f.hasOwnProperty(p)&&p in cC)return _w[u]=f[p];return u}var uC=vu("animationend"),dC=vu("animationiteration"),hC=vu("animationstart"),XK=vu("transitionrun"),YK=vu("transitionstart"),KK=vu("transitioncancel"),fC=vu("transitionend"),mC=new Map,Aw="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");Aw.push("scrollEnd");function Ia(u,f){mC.set(u,f),Ko(f,[u])}var Qg=typeof reportError=="function"?reportError:function(u){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var f=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof u=="object"&&u!==null&&typeof u.message=="string"?String(u.message):String(u),error:u});if(!window.dispatchEvent(f))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",u);return}console.error(u)},na=[],Rd=0,Mw=0;function Vg(){for(var u=Rd,f=Mw=Rd=0;f<u;){var p=na[f];na[f++]=null;var v=na[f];na[f++]=null;var O=na[f];na[f++]=null;var C=na[f];if(na[f++]=null,v!==null&&O!==null){var q=v.pending;q===null?O.next=O:(O.next=q.next,q.next=O),v.pending=O}C!==0&&pC(p,O,C)}}function Ug(u,f,p,v){na[Rd++]=u,na[Rd++]=f,na[Rd++]=p,na[Rd++]=v,Mw|=v,u.lanes|=v,u=u.alternate,u!==null&&(u.lanes|=v)}function Rw(u,f,p,v){return Ug(u,f,p,v),Wg(u)}function yu(u,f){return Ug(u,null,null,f),Wg(u)}function pC(u,f,p){u.lanes|=p;var v=u.alternate;v!==null&&(v.lanes|=p);for(var O=!1,C=u.return;C!==null;)C.childLanes|=p,v=C.alternate,v!==null&&(v.childLanes|=p),C.tag===22&&(u=C.stateNode,u===null||u._visibility&1||(O=!0)),u=C,C=C.return;return u.tag===3?(C=u.stateNode,O&&f!==null&&(O=31-Rt(p),u=C.hiddenUpdates,v=u[O],v===null?u[O]=[f]:v.push(f),f.lane=p|536870912),C):null}function Wg(u){if(50<km)throw km=0,$2=null,Error(r(185));for(var f=u.return;f!==null;)u=f,f=u.return;return u.tag===3?u.stateNode:null}var Dd={};function ZK(u,f,p,v){this.tag=u,this.key=p,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=f,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=v,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Mi(u,f,p,v){return new ZK(u,f,p,v)}function Dw(u){return u=u.prototype,!(!u||!u.isReactComponent)}function nl(u,f){var p=u.alternate;return p===null?(p=Mi(u.tag,f,u.key,u.mode),p.elementType=u.elementType,p.type=u.type,p.stateNode=u.stateNode,p.alternate=u,u.alternate=p):(p.pendingProps=f,p.type=u.type,p.flags=0,p.subtreeFlags=0,p.deletions=null),p.flags=u.flags&65011712,p.childLanes=u.childLanes,p.lanes=u.lanes,p.child=u.child,p.memoizedProps=u.memoizedProps,p.memoizedState=u.memoizedState,p.updateQueue=u.updateQueue,f=u.dependencies,p.dependencies=f===null?null:{lanes:f.lanes,firstContext:f.firstContext},p.sibling=u.sibling,p.index=u.index,p.ref=u.ref,p.refCleanup=u.refCleanup,p}function gC(u,f){u.flags&=65011714;var p=u.alternate;return p===null?(u.childLanes=0,u.lanes=f,u.child=null,u.subtreeFlags=0,u.memoizedProps=null,u.memoizedState=null,u.updateQueue=null,u.dependencies=null,u.stateNode=null):(u.childLanes=p.childLanes,u.lanes=p.lanes,u.child=p.child,u.subtreeFlags=0,u.deletions=null,u.memoizedProps=p.memoizedProps,u.memoizedState=p.memoizedState,u.updateQueue=p.updateQueue,u.type=p.type,f=p.dependencies,u.dependencies=f===null?null:{lanes:f.lanes,firstContext:f.firstContext}),u}function Gg(u,f,p,v,O,C){var q=0;if(v=u,typeof u=="function")Dw(u)&&(q=1);else if(typeof u=="string")q=rJ(u,p,V.current)?26:u==="html"||u==="head"||u==="body"?27:5;else e:switch(u){case P:return u=Mi(31,p,f,O),u.elementType=P,u.lanes=C,u;case w:return bu(p.children,O,C,f);case S:q=8,O|=24;break;case k:return u=Mi(12,p,f,O|2),u.elementType=k,u.lanes=C,u;case E:return u=Mi(13,p,f,O),u.elementType=E,u.lanes=C,u;case _:return u=Mi(19,p,f,O),u.elementType=_,u.lanes=C,u;default:if(typeof u=="object"&&u!==null)switch(u.$$typeof){case N:q=10;break e;case j:q=9;break e;case T:q=11;break e;case A:q=14;break e;case L:q=16,v=null;break e}q=29,p=Error(r(130,u===null?"null":typeof u,"")),v=null}return f=Mi(q,p,f,O),f.elementType=u,f.type=v,f.lanes=C,f}function bu(u,f,p,v){return u=Mi(7,u,v,f),u.lanes=p,u}function Pw(u,f,p){return u=Mi(6,u,null,f),u.lanes=p,u}function xC(u){var f=Mi(18,null,null,0);return f.stateNode=u,f}function zw(u,f,p){return f=Mi(4,u.children!==null?u.children:[],u.key,f),f.lanes=p,f.stateNode={containerInfo:u.containerInfo,pendingChildren:null,implementation:u.implementation},f}var vC=new WeakMap;function ra(u,f){if(typeof u=="object"&&u!==null){var p=vC.get(u);return p!==void 0?p:(f={value:u,source:f,stack:He(f)},vC.set(u,f),f)}return{value:u,source:f,stack:He(f)}}var Pd=[],zd=0,Xg=null,nm=0,sa=[],ia=0,rc=null,ao=1,oo="";function rl(u,f){Pd[zd++]=nm,Pd[zd++]=Xg,Xg=u,nm=f}function yC(u,f,p){sa[ia++]=ao,sa[ia++]=oo,sa[ia++]=rc,rc=u;var v=ao;u=oo;var O=32-Rt(v)-1;v&=~(1<<O),p+=1;var C=32-Rt(f)+O;if(30<C){var q=O-O%5;C=(v&(1<<q)-1).toString(32),v>>=q,O-=q,ao=1<<32-Rt(f)+O|p<<O|v,oo=C+u}else ao=1<<C|p<<O|v,oo=u}function Iw(u){u.return!==null&&(rl(u,1),yC(u,1,0))}function Lw(u){for(;u===Xg;)Xg=Pd[--zd],Pd[zd]=null,nm=Pd[--zd],Pd[zd]=null;for(;u===rc;)rc=sa[--ia],sa[ia]=null,oo=sa[--ia],sa[ia]=null,ao=sa[--ia],sa[ia]=null}function bC(u,f){sa[ia++]=ao,sa[ia++]=oo,sa[ia++]=rc,ao=f.id,oo=f.overflow,rc=u}var Cs=null,fr=null,yn=!1,sc=null,aa=!1,Bw=Error(r(519));function ic(u){var f=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw rm(ra(f,u)),Bw}function wC(u){var f=u.stateNode,p=u.type,v=u.memoizedProps;switch(f[Cr]=u,f[Tr]=v,p){case"dialog":cn("cancel",f),cn("close",f);break;case"iframe":case"object":case"embed":cn("load",f);break;case"video":case"audio":for(p=0;p<jm.length;p++)cn(jm[p],f);break;case"source":cn("error",f);break;case"img":case"image":case"link":cn("error",f),cn("load",f);break;case"details":cn("toggle",f);break;case"input":cn("invalid",f),D7(f,v.value,v.defaultValue,v.checked,v.defaultChecked,v.type,v.name,!0);break;case"select":cn("invalid",f);break;case"textarea":cn("invalid",f),z7(f,v.value,v.defaultValue,v.children)}p=v.children,typeof p!="string"&&typeof p!="number"&&typeof p!="bigint"||f.textContent===""+p||v.suppressHydrationWarning===!0||LT(f.textContent,p)?(v.popover!=null&&(cn("beforetoggle",f),cn("toggle",f)),v.onScroll!=null&&cn("scroll",f),v.onScrollEnd!=null&&cn("scrollend",f),v.onClick!=null&&(f.onclick=el),f=!0):f=!1,f||ic(u,!0)}function SC(u){for(Cs=u.return;Cs;)switch(Cs.tag){case 5:case 31:case 13:aa=!1;return;case 27:case 3:aa=!0;return;default:Cs=Cs.return}}function Id(u){if(u!==Cs)return!1;if(!yn)return SC(u),yn=!0,!1;var f=u.tag,p;if((p=f!==3&&f!==27)&&((p=f===5)&&(p=u.type,p=!(p!=="form"&&p!=="button")||r4(u.type,u.memoizedProps)),p=!p),p&&fr&&ic(u),SC(u),f===13){if(u=u.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(r(317));fr=WT(u)}else if(f===31){if(u=u.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(r(317));fr=WT(u)}else f===27?(f=fr,yc(u.type)?(u=l4,l4=null,fr=u):fr=f):fr=Cs?la(u.stateNode.nextSibling):null;return!0}function wu(){fr=Cs=null,yn=!1}function Fw(){var u=sc;return u!==null&&(di===null?di=u:di.push.apply(di,u),sc=null),u}function rm(u){sc===null?sc=[u]:sc.push(u)}var qw=ie(null),Su=null,sl=null;function ac(u,f,p){I(qw,f._currentValue),f._currentValue=p}function il(u){u._currentValue=qw.current,G(qw)}function $w(u,f,p){for(;u!==null;){var v=u.alternate;if((u.childLanes&f)!==f?(u.childLanes|=f,v!==null&&(v.childLanes|=f)):v!==null&&(v.childLanes&f)!==f&&(v.childLanes|=f),u===p)break;u=u.return}}function Hw(u,f,p,v){var O=u.child;for(O!==null&&(O.return=u);O!==null;){var C=O.dependencies;if(C!==null){var q=O.child;C=C.firstContext;e:for(;C!==null;){var K=C;C=O;for(var ue=0;ue<f.length;ue++)if(K.context===f[ue]){C.lanes|=p,K=C.alternate,K!==null&&(K.lanes|=p),$w(C.return,p,u),v||(q=null);break e}C=K.next}}else if(O.tag===18){if(q=O.return,q===null)throw Error(r(341));q.lanes|=p,C=q.alternate,C!==null&&(C.lanes|=p),$w(q,p,u),q=null}else q=O.child;if(q!==null)q.return=O;else for(q=O;q!==null;){if(q===u){q=null;break}if(O=q.sibling,O!==null){O.return=q.return,q=O;break}q=q.return}O=q}}function Ld(u,f,p,v){u=null;for(var O=f,C=!1;O!==null;){if(!C){if((O.flags&524288)!==0)C=!0;else if((O.flags&262144)!==0)break}if(O.tag===10){var q=O.alternate;if(q===null)throw Error(r(387));if(q=q.memoizedProps,q!==null){var K=O.type;Ai(O.pendingProps.value,q.value)||(u!==null?u.push(K):u=[K])}}else if(O===W.current){if(q=O.alternate,q===null)throw Error(r(387));q.memoizedState.memoizedState!==O.memoizedState.memoizedState&&(u!==null?u.push(_m):u=[_m])}O=O.return}u!==null&&Hw(f,u,p,v),f.flags|=262144}function Yg(u){for(u=u.firstContext;u!==null;){if(!Ai(u.context._currentValue,u.memoizedValue))return!0;u=u.next}return!1}function ku(u){Su=u,sl=null,u=u.dependencies,u!==null&&(u.firstContext=null)}function Ts(u){return kC(Su,u)}function Kg(u,f){return Su===null&&ku(u),kC(u,f)}function kC(u,f){var p=f._currentValue;if(f={context:f,memoizedValue:p,next:null},sl===null){if(u===null)throw Error(r(308));sl=f,u.dependencies={lanes:0,firstContext:f},u.flags|=524288}else sl=sl.next=f;return p}var JK=typeof AbortController<"u"?AbortController:function(){var u=[],f=this.signal={aborted:!1,addEventListener:function(p,v){u.push(v)}};this.abort=function(){f.aborted=!0,u.forEach(function(p){return p()})}},eZ=t.unstable_scheduleCallback,tZ=t.unstable_NormalPriority,Xr={$$typeof:N,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Qw(){return{controller:new JK,data:new Map,refCount:0}}function sm(u){u.refCount--,u.refCount===0&&eZ(tZ,function(){u.controller.abort()})}var im=null,Vw=0,Bd=0,Fd=null;function nZ(u,f){if(im===null){var p=im=[];Vw=0,Bd=G2(),Fd={status:"pending",value:void 0,then:function(v){p.push(v)}}}return Vw++,f.then(OC,OC),f}function OC(){if(--Vw===0&&im!==null){Fd!==null&&(Fd.status="fulfilled");var u=im;im=null,Bd=0,Fd=null;for(var f=0;f<u.length;f++)(0,u[f])()}}function rZ(u,f){var p=[],v={status:"pending",value:null,reason:null,then:function(O){p.push(O)}};return u.then(function(){v.status="fulfilled",v.value=f;for(var O=0;O<p.length;O++)(0,p[O])(f)},function(O){for(v.status="rejected",v.reason=O,O=0;O<p.length;O++)(0,p[O])(void 0)}),v}var jC=F.S;F.S=function(u,f){lT=_t(),typeof f=="object"&&f!==null&&typeof f.then=="function"&&nZ(u,f),jC!==null&&jC(u,f)};var Ou=ie(null);function Uw(){var u=Ou.current;return u!==null?u:rr.pooledCache}function Zg(u,f){f===null?I(Ou,Ou.current):I(Ou,f.pool)}function NC(){var u=Uw();return u===null?null:{parent:Xr._currentValue,pool:u}}var qd=Error(r(460)),Ww=Error(r(474)),Jg=Error(r(542)),ex={then:function(){}};function CC(u){return u=u.status,u==="fulfilled"||u==="rejected"}function TC(u,f,p){switch(p=u[p],p===void 0?u.push(f):p!==f&&(f.then(el,el),f=p),f.status){case"fulfilled":return f.value;case"rejected":throw u=f.reason,_C(u),u;default:if(typeof f.status=="string")f.then(el,el);else{if(u=rr,u!==null&&100<u.shellSuspendCounter)throw Error(r(482));u=f,u.status="pending",u.then(function(v){if(f.status==="pending"){var O=f;O.status="fulfilled",O.value=v}},function(v){if(f.status==="pending"){var O=f;O.status="rejected",O.reason=v}})}switch(f.status){case"fulfilled":return f.value;case"rejected":throw u=f.reason,_C(u),u}throw Nu=f,qd}}function ju(u){try{var f=u._init;return f(u._payload)}catch(p){throw p!==null&&typeof p=="object"&&typeof p.then=="function"?(Nu=p,qd):p}}var Nu=null;function EC(){if(Nu===null)throw Error(r(459));var u=Nu;return Nu=null,u}function _C(u){if(u===qd||u===Jg)throw Error(r(483))}var $d=null,am=0;function tx(u){var f=am;return am+=1,$d===null&&($d=[]),TC($d,u,f)}function om(u,f){f=f.props.ref,u.ref=f!==void 0?f:null}function nx(u,f){throw f.$$typeof===g?Error(r(525)):(u=Object.prototype.toString.call(f),Error(r(31,u==="[object Object]"?"object with keys {"+Object.keys(f).join(", ")+"}":u)))}function AC(u){function f(pe,fe){if(u){var ye=pe.deletions;ye===null?(pe.deletions=[fe],pe.flags|=16):ye.push(fe)}}function p(pe,fe){if(!u)return null;for(;fe!==null;)f(pe,fe),fe=fe.sibling;return null}function v(pe){for(var fe=new Map;pe!==null;)pe.key!==null?fe.set(pe.key,pe):fe.set(pe.index,pe),pe=pe.sibling;return fe}function O(pe,fe){return pe=nl(pe,fe),pe.index=0,pe.sibling=null,pe}function C(pe,fe,ye){return pe.index=ye,u?(ye=pe.alternate,ye!==null?(ye=ye.index,ye<fe?(pe.flags|=67108866,fe):ye):(pe.flags|=67108866,fe)):(pe.flags|=1048576,fe)}function q(pe){return u&&pe.alternate===null&&(pe.flags|=67108866),pe}function K(pe,fe,ye,Ae){return fe===null||fe.tag!==6?(fe=Pw(ye,pe.mode,Ae),fe.return=pe,fe):(fe=O(fe,ye),fe.return=pe,fe)}function ue(pe,fe,ye,Ae){var Nt=ye.type;return Nt===w?Ee(pe,fe,ye.props.children,Ae,ye.key):fe!==null&&(fe.elementType===Nt||typeof Nt=="object"&&Nt!==null&&Nt.$$typeof===L&&ju(Nt)===fe.type)?(fe=O(fe,ye.props),om(fe,ye),fe.return=pe,fe):(fe=Gg(ye.type,ye.key,ye.props,null,pe.mode,Ae),om(fe,ye),fe.return=pe,fe)}function we(pe,fe,ye,Ae){return fe===null||fe.tag!==4||fe.stateNode.containerInfo!==ye.containerInfo||fe.stateNode.implementation!==ye.implementation?(fe=zw(ye,pe.mode,Ae),fe.return=pe,fe):(fe=O(fe,ye.children||[]),fe.return=pe,fe)}function Ee(pe,fe,ye,Ae,Nt){return fe===null||fe.tag!==7?(fe=bu(ye,pe.mode,Ae,Nt),fe.return=pe,fe):(fe=O(fe,ye),fe.return=pe,fe)}function Re(pe,fe,ye){if(typeof fe=="string"&&fe!==""||typeof fe=="number"||typeof fe=="bigint")return fe=Pw(""+fe,pe.mode,ye),fe.return=pe,fe;if(typeof fe=="object"&&fe!==null){switch(fe.$$typeof){case x:return ye=Gg(fe.type,fe.key,fe.props,null,pe.mode,ye),om(ye,fe),ye.return=pe,ye;case y:return fe=zw(fe,pe.mode,ye),fe.return=pe,fe;case L:return fe=ju(fe),Re(pe,fe,ye)}if(Q(fe)||U(fe))return fe=bu(fe,pe.mode,ye,null),fe.return=pe,fe;if(typeof fe.then=="function")return Re(pe,tx(fe),ye);if(fe.$$typeof===N)return Re(pe,Kg(pe,fe),ye);nx(pe,fe)}return null}function Se(pe,fe,ye,Ae){var Nt=fe!==null?fe.key:null;if(typeof ye=="string"&&ye!==""||typeof ye=="number"||typeof ye=="bigint")return Nt!==null?null:K(pe,fe,""+ye,Ae);if(typeof ye=="object"&&ye!==null){switch(ye.$$typeof){case x:return ye.key===Nt?ue(pe,fe,ye,Ae):null;case y:return ye.key===Nt?we(pe,fe,ye,Ae):null;case L:return ye=ju(ye),Se(pe,fe,ye,Ae)}if(Q(ye)||U(ye))return Nt!==null?null:Ee(pe,fe,ye,Ae,null);if(typeof ye.then=="function")return Se(pe,fe,tx(ye),Ae);if(ye.$$typeof===N)return Se(pe,fe,Kg(pe,ye),Ae);nx(pe,ye)}return null}function Ce(pe,fe,ye,Ae,Nt){if(typeof Ae=="string"&&Ae!==""||typeof Ae=="number"||typeof Ae=="bigint")return pe=pe.get(ye)||null,K(fe,pe,""+Ae,Nt);if(typeof Ae=="object"&&Ae!==null){switch(Ae.$$typeof){case x:return pe=pe.get(Ae.key===null?ye:Ae.key)||null,ue(fe,pe,Ae,Nt);case y:return pe=pe.get(Ae.key===null?ye:Ae.key)||null,we(fe,pe,Ae,Nt);case L:return Ae=ju(Ae),Ce(pe,fe,ye,Ae,Nt)}if(Q(Ae)||U(Ae))return pe=pe.get(ye)||null,Ee(fe,pe,Ae,Nt,null);if(typeof Ae.then=="function")return Ce(pe,fe,ye,tx(Ae),Nt);if(Ae.$$typeof===N)return Ce(pe,fe,ye,Kg(fe,Ae),Nt);nx(fe,Ae)}return null}function ut(pe,fe,ye,Ae){for(var Nt=null,Ln=null,vt=fe,Zt=fe=0,fn=null;vt!==null&&Zt<ye.length;Zt++){vt.index>Zt?(fn=vt,vt=null):fn=vt.sibling;var Bn=Se(pe,vt,ye[Zt],Ae);if(Bn===null){vt===null&&(vt=fn);break}u&&vt&&Bn.alternate===null&&f(pe,vt),fe=C(Bn,fe,Zt),Ln===null?Nt=Bn:Ln.sibling=Bn,Ln=Bn,vt=fn}if(Zt===ye.length)return p(pe,vt),yn&&rl(pe,Zt),Nt;if(vt===null){for(;Zt<ye.length;Zt++)vt=Re(pe,ye[Zt],Ae),vt!==null&&(fe=C(vt,fe,Zt),Ln===null?Nt=vt:Ln.sibling=vt,Ln=vt);return yn&&rl(pe,Zt),Nt}for(vt=v(vt);Zt<ye.length;Zt++)fn=Ce(vt,pe,Zt,ye[Zt],Ae),fn!==null&&(u&&fn.alternate!==null&&vt.delete(fn.key===null?Zt:fn.key),fe=C(fn,fe,Zt),Ln===null?Nt=fn:Ln.sibling=fn,Ln=fn);return u&&vt.forEach(function(Oc){return f(pe,Oc)}),yn&&rl(pe,Zt),Nt}function At(pe,fe,ye,Ae){if(ye==null)throw Error(r(151));for(var Nt=null,Ln=null,vt=fe,Zt=fe=0,fn=null,Bn=ye.next();vt!==null&&!Bn.done;Zt++,Bn=ye.next()){vt.index>Zt?(fn=vt,vt=null):fn=vt.sibling;var Oc=Se(pe,vt,Bn.value,Ae);if(Oc===null){vt===null&&(vt=fn);break}u&&vt&&Oc.alternate===null&&f(pe,vt),fe=C(Oc,fe,Zt),Ln===null?Nt=Oc:Ln.sibling=Oc,Ln=Oc,vt=fn}if(Bn.done)return p(pe,vt),yn&&rl(pe,Zt),Nt;if(vt===null){for(;!Bn.done;Zt++,Bn=ye.next())Bn=Re(pe,Bn.value,Ae),Bn!==null&&(fe=C(Bn,fe,Zt),Ln===null?Nt=Bn:Ln.sibling=Bn,Ln=Bn);return yn&&rl(pe,Zt),Nt}for(vt=v(vt);!Bn.done;Zt++,Bn=ye.next())Bn=Ce(vt,pe,Zt,Bn.value,Ae),Bn!==null&&(u&&Bn.alternate!==null&&vt.delete(Bn.key===null?Zt:Bn.key),fe=C(Bn,fe,Zt),Ln===null?Nt=Bn:Ln.sibling=Bn,Ln=Bn);return u&&vt.forEach(function(mJ){return f(pe,mJ)}),yn&&rl(pe,Zt),Nt}function Jn(pe,fe,ye,Ae){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 Nt=ye.key;fe!==null;){if(fe.key===Nt){if(Nt=ye.type,Nt===w){if(fe.tag===7){p(pe,fe.sibling),Ae=O(fe,ye.props.children),Ae.return=pe,pe=Ae;break e}}else if(fe.elementType===Nt||typeof Nt=="object"&&Nt!==null&&Nt.$$typeof===L&&ju(Nt)===fe.type){p(pe,fe.sibling),Ae=O(fe,ye.props),om(Ae,ye),Ae.return=pe,pe=Ae;break e}p(pe,fe);break}else f(pe,fe);fe=fe.sibling}ye.type===w?(Ae=bu(ye.props.children,pe.mode,Ae,ye.key),Ae.return=pe,pe=Ae):(Ae=Gg(ye.type,ye.key,ye.props,null,pe.mode,Ae),om(Ae,ye),Ae.return=pe,pe=Ae)}return q(pe);case y:e:{for(Nt=ye.key;fe!==null;){if(fe.key===Nt)if(fe.tag===4&&fe.stateNode.containerInfo===ye.containerInfo&&fe.stateNode.implementation===ye.implementation){p(pe,fe.sibling),Ae=O(fe,ye.children||[]),Ae.return=pe,pe=Ae;break e}else{p(pe,fe);break}else f(pe,fe);fe=fe.sibling}Ae=zw(ye,pe.mode,Ae),Ae.return=pe,pe=Ae}return q(pe);case L:return ye=ju(ye),Jn(pe,fe,ye,Ae)}if(Q(ye))return ut(pe,fe,ye,Ae);if(U(ye)){if(Nt=U(ye),typeof Nt!="function")throw Error(r(150));return ye=Nt.call(ye),At(pe,fe,ye,Ae)}if(typeof ye.then=="function")return Jn(pe,fe,tx(ye),Ae);if(ye.$$typeof===N)return Jn(pe,fe,Kg(pe,ye),Ae);nx(pe,ye)}return typeof ye=="string"&&ye!==""||typeof ye=="number"||typeof ye=="bigint"?(ye=""+ye,fe!==null&&fe.tag===6?(p(pe,fe.sibling),Ae=O(fe,ye),Ae.return=pe,pe=Ae):(p(pe,fe),Ae=Pw(ye,pe.mode,Ae),Ae.return=pe,pe=Ae),q(pe)):p(pe,fe)}return function(pe,fe,ye,Ae){try{am=0;var Nt=Jn(pe,fe,ye,Ae);return $d=null,Nt}catch(vt){if(vt===qd||vt===Jg)throw vt;var Ln=Mi(29,vt,null,pe.mode);return Ln.lanes=Ae,Ln.return=pe,Ln}finally{}}}var Cu=AC(!0),MC=AC(!1),oc=!1;function Gw(u){u.updateQueue={baseState:u.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Xw(u,f){u=u.updateQueue,f.updateQueue===u&&(f.updateQueue={baseState:u.baseState,firstBaseUpdate:u.firstBaseUpdate,lastBaseUpdate:u.lastBaseUpdate,shared:u.shared,callbacks:null})}function lc(u){return{lane:u,tag:0,payload:null,callback:null,next:null}}function cc(u,f,p){var v=u.updateQueue;if(v===null)return null;if(v=v.shared,(Hn&2)!==0){var O=v.pending;return O===null?f.next=f:(f.next=O.next,O.next=f),v.pending=f,f=Wg(u),pC(u,null,p),f}return Ug(u,v,f,p),Wg(u)}function lm(u,f,p){if(f=f.updateQueue,f!==null&&(f=f.shared,(p&4194048)!==0)){var v=f.lanes;v&=u.pendingLanes,p|=v,f.lanes=p,xs(u,p)}}function Yw(u,f){var p=u.updateQueue,v=u.alternate;if(v!==null&&(v=v.updateQueue,p===v)){var O=null,C=null;if(p=p.firstBaseUpdate,p!==null){do{var q={lane:p.lane,tag:p.tag,payload:p.payload,callback:null,next:null};C===null?O=C=q:C=C.next=q,p=p.next}while(p!==null);C===null?O=C=f:C=C.next=f}else O=C=f;p={baseState:v.baseState,firstBaseUpdate:O,lastBaseUpdate:C,shared:v.shared,callbacks:v.callbacks},u.updateQueue=p;return}u=p.lastBaseUpdate,u===null?p.firstBaseUpdate=f:u.next=f,p.lastBaseUpdate=f}var Kw=!1;function cm(){if(Kw){var u=Fd;if(u!==null)throw u}}function um(u,f,p,v){Kw=!1;var O=u.updateQueue;oc=!1;var C=O.firstBaseUpdate,q=O.lastBaseUpdate,K=O.shared.pending;if(K!==null){O.shared.pending=null;var ue=K,we=ue.next;ue.next=null,q===null?C=we:q.next=we,q=ue;var Ee=u.alternate;Ee!==null&&(Ee=Ee.updateQueue,K=Ee.lastBaseUpdate,K!==q&&(K===null?Ee.firstBaseUpdate=we:K.next=we,Ee.lastBaseUpdate=ue))}if(C!==null){var Re=O.baseState;q=0,Ee=we=ue=null,K=C;do{var Se=K.lane&-536870913,Ce=Se!==K.lane;if(Ce?(hn&Se)===Se:(v&Se)===Se){Se!==0&&Se===Bd&&(Kw=!0),Ee!==null&&(Ee=Ee.next={lane:0,tag:K.tag,payload:K.payload,callback:null,next:null});e:{var ut=u,At=K;Se=f;var Jn=p;switch(At.tag){case 1:if(ut=At.payload,typeof ut=="function"){Re=ut.call(Jn,Re,Se);break e}Re=ut;break e;case 3:ut.flags=ut.flags&-65537|128;case 0:if(ut=At.payload,Se=typeof ut=="function"?ut.call(Jn,Re,Se):ut,Se==null)break e;Re=m({},Re,Se);break e;case 2:oc=!0}}Se=K.callback,Se!==null&&(u.flags|=64,Ce&&(u.flags|=8192),Ce=O.callbacks,Ce===null?O.callbacks=[Se]:Ce.push(Se))}else Ce={lane:Se,tag:K.tag,payload:K.payload,callback:K.callback,next:null},Ee===null?(we=Ee=Ce,ue=Re):Ee=Ee.next=Ce,q|=Se;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=Re),O.baseState=ue,O.firstBaseUpdate=we,O.lastBaseUpdate=Ee,C===null&&(O.shared.lanes=0),mc|=q,u.lanes=q,u.memoizedState=Re}}function RC(u,f){if(typeof u!="function")throw Error(r(191,u));u.call(f)}function DC(u,f){var p=u.callbacks;if(p!==null)for(u.callbacks=null,u=0;u<p.length;u++)RC(p[u],f)}var Hd=ie(null),rx=ie(0);function PC(u,f){u=ml,I(rx,u),I(Hd,f),ml=u|f.baseLanes}function Zw(){I(rx,ml),I(Hd,Hd.current)}function Jw(){ml=rx.current,G(Hd),G(rx)}var Ri=ie(null),oa=null;function uc(u){var f=u.alternate;I(qr,qr.current&1),I(Ri,u),oa===null&&(f===null||Hd.current!==null||f.memoizedState!==null)&&(oa=u)}function e2(u){I(qr,qr.current),I(Ri,u),oa===null&&(oa=u)}function zC(u){u.tag===22?(I(qr,qr.current),I(Ri,u),oa===null&&(oa=u)):dc()}function dc(){I(qr,qr.current),I(Ri,Ri.current)}function Di(u){G(Ri),oa===u&&(oa=null),G(qr)}var qr=ie(0);function sx(u){for(var f=u;f!==null;){if(f.tag===13){var p=f.memoizedState;if(p!==null&&(p=p.dehydrated,p===null||a4(p)||o4(p)))return f}else if(f.tag===19&&(f.memoizedProps.revealOrder==="forwards"||f.memoizedProps.revealOrder==="backwards"||f.memoizedProps.revealOrder==="unstable_legacy-backwards"||f.memoizedProps.revealOrder==="together")){if((f.flags&128)!==0)return f}else if(f.child!==null){f.child.return=f,f=f.child;continue}if(f===u)break;for(;f.sibling===null;){if(f.return===null||f.return===u)return null;f=f.return}f.sibling.return=f.return,f=f.sibling}return null}var al=0,Wt=null,Kn=null,Yr=null,ix=!1,Qd=!1,Tu=!1,ax=0,dm=0,Vd=null,sZ=0;function Pr(){throw Error(r(321))}function t2(u,f){if(f===null)return!1;for(var p=0;p<f.length&&p<u.length;p++)if(!Ai(u[p],f[p]))return!1;return!0}function n2(u,f,p,v,O,C){return al=C,Wt=f,f.memoizedState=null,f.updateQueue=null,f.lanes=0,F.H=u===null||u.memoizedState===null?y8:x2,Tu=!1,C=p(v,O),Tu=!1,Qd&&(C=LC(f,p,v,O)),IC(u),C}function IC(u){F.H=mm;var f=Kn!==null&&Kn.next!==null;if(al=0,Yr=Kn=Wt=null,ix=!1,dm=0,Vd=null,f)throw Error(r(300));u===null||Kr||(u=u.dependencies,u!==null&&Yg(u)&&(Kr=!0))}function LC(u,f,p,v){Wt=u;var O=0;do{if(Qd&&(Vd=null),dm=0,Qd=!1,25<=O)throw Error(r(301));if(O+=1,Yr=Kn=null,u.updateQueue!=null){var C=u.updateQueue;C.lastEffect=null,C.events=null,C.stores=null,C.memoCache!=null&&(C.memoCache.index=0)}F.H=b8,C=f(p,v)}while(Qd);return C}function iZ(){var u=F.H,f=u.useState()[0];return f=typeof f.then=="function"?hm(f):f,u=u.useState()[0],(Kn!==null?Kn.memoizedState:null)!==u&&(Wt.flags|=1024),f}function r2(){var u=ax!==0;return ax=0,u}function s2(u,f,p){f.updateQueue=u.updateQueue,f.flags&=-2053,u.lanes&=~p}function i2(u){if(ix){for(u=u.memoizedState;u!==null;){var f=u.queue;f!==null&&(f.pending=null),u=u.next}ix=!1}al=0,Yr=Kn=Wt=null,Qd=!1,dm=ax=0,Vd=null}function Ys(){var u={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Yr===null?Wt.memoizedState=Yr=u:Yr=Yr.next=u,Yr}function $r(){if(Kn===null){var u=Wt.alternate;u=u!==null?u.memoizedState:null}else u=Kn.next;var f=Yr===null?Wt.memoizedState:Yr.next;if(f!==null)Yr=f,Kn=u;else{if(u===null)throw Wt.alternate===null?Error(r(467)):Error(r(310));Kn=u,u={memoizedState:Kn.memoizedState,baseState:Kn.baseState,baseQueue:Kn.baseQueue,queue:Kn.queue,next:null},Yr===null?Wt.memoizedState=Yr=u:Yr=Yr.next=u}return Yr}function ox(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function hm(u){var f=dm;return dm+=1,Vd===null&&(Vd=[]),u=TC(Vd,u,f),f=Wt,(Yr===null?f.memoizedState:Yr.next)===null&&(f=f.alternate,F.H=f===null||f.memoizedState===null?y8:x2),u}function lx(u){if(u!==null&&typeof u=="object"){if(typeof u.then=="function")return hm(u);if(u.$$typeof===N)return Ts(u)}throw Error(r(438,String(u)))}function a2(u){var f=null,p=Wt.updateQueue;if(p!==null&&(f=p.memoCache),f==null){var v=Wt.alternate;v!==null&&(v=v.updateQueue,v!==null&&(v=v.memoCache,v!=null&&(f={data:v.data.map(function(O){return O.slice()}),index:0})))}if(f==null&&(f={data:[],index:0}),p===null&&(p=ox(),Wt.updateQueue=p),p.memoCache=f,p=f.data[f.index],p===void 0)for(p=f.data[f.index]=Array(u),v=0;v<u;v++)p[v]=B;return f.index++,p}function ol(u,f){return typeof f=="function"?f(u):f}function cx(u){var f=$r();return o2(f,Kn,u)}function o2(u,f,p){var v=u.queue;if(v===null)throw Error(r(311));v.lastRenderedReducer=p;var O=u.baseQueue,C=v.pending;if(C!==null){if(O!==null){var q=O.next;O.next=C.next,C.next=q}f.baseQueue=O=C,v.pending=null}if(C=u.baseState,O===null)u.memoizedState=C;else{f=O.next;var K=q=null,ue=null,we=f,Ee=!1;do{var Re=we.lane&-536870913;if(Re!==we.lane?(hn&Re)===Re:(al&Re)===Re){var Se=we.revertLane;if(Se===0)ue!==null&&(ue=ue.next={lane:0,revertLane:0,gesture:null,action:we.action,hasEagerState:we.hasEagerState,eagerState:we.eagerState,next:null}),Re===Bd&&(Ee=!0);else if((al&Se)===Se){we=we.next,Se===Bd&&(Ee=!0);continue}else Re={lane:0,revertLane:we.revertLane,gesture:null,action:we.action,hasEagerState:we.hasEagerState,eagerState:we.eagerState,next:null},ue===null?(K=ue=Re,q=C):ue=ue.next=Re,Wt.lanes|=Se,mc|=Se;Re=we.action,Tu&&p(C,Re),C=we.hasEagerState?we.eagerState:p(C,Re)}else Se={lane:Re,revertLane:we.revertLane,gesture:we.gesture,action:we.action,hasEagerState:we.hasEagerState,eagerState:we.eagerState,next:null},ue===null?(K=ue=Se,q=C):ue=ue.next=Se,Wt.lanes|=Re,mc|=Re;we=we.next}while(we!==null&&we!==f);if(ue===null?q=C:ue.next=K,!Ai(C,u.memoizedState)&&(Kr=!0,Ee&&(p=Fd,p!==null)))throw p;u.memoizedState=C,u.baseState=q,u.baseQueue=ue,v.lastRenderedState=C}return O===null&&(v.lanes=0),[u.memoizedState,v.dispatch]}function l2(u){var f=$r(),p=f.queue;if(p===null)throw Error(r(311));p.lastRenderedReducer=u;var v=p.dispatch,O=p.pending,C=f.memoizedState;if(O!==null){p.pending=null;var q=O=O.next;do C=u(C,q.action),q=q.next;while(q!==O);Ai(C,f.memoizedState)||(Kr=!0),f.memoizedState=C,f.baseQueue===null&&(f.baseState=C),p.lastRenderedState=C}return[C,v]}function BC(u,f,p){var v=Wt,O=$r(),C=yn;if(C){if(p===void 0)throw Error(r(407));p=p()}else p=f();var q=!Ai((Kn||O).memoizedState,p);if(q&&(O.memoizedState=p,Kr=!0),O=O.queue,d2($C.bind(null,v,O,u),[u]),O.getSnapshot!==f||q||Yr!==null&&Yr.memoizedState.tag&1){if(v.flags|=2048,Ud(9,{destroy:void 0},qC.bind(null,v,O,p,f),null),rr===null)throw Error(r(349));C||(al&127)!==0||FC(v,f,p)}return p}function FC(u,f,p){u.flags|=16384,u={getSnapshot:f,value:p},f=Wt.updateQueue,f===null?(f=ox(),Wt.updateQueue=f,f.stores=[u]):(p=f.stores,p===null?f.stores=[u]:p.push(u))}function qC(u,f,p,v){f.value=p,f.getSnapshot=v,HC(f)&&QC(u)}function $C(u,f,p){return p(function(){HC(f)&&QC(u)})}function HC(u){var f=u.getSnapshot;u=u.value;try{var p=f();return!Ai(u,p)}catch{return!0}}function QC(u){var f=yu(u,2);f!==null&&hi(f,u,2)}function c2(u){var f=Ys();if(typeof u=="function"){var p=u;if(u=p(),Tu){tn(!0);try{p()}finally{tn(!1)}}}return f.memoizedState=f.baseState=u,f.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ol,lastRenderedState:u},f}function VC(u,f,p,v){return u.baseState=p,o2(u,Kn,typeof v=="function"?v:ol)}function aZ(u,f,p,v,O){if(hx(u))throw Error(r(485));if(u=f.action,u!==null){var C={payload:O,action:u,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(q){C.listeners.push(q)}};F.T!==null?p(!0):C.isTransition=!1,v(C),p=f.pending,p===null?(C.next=f.pending=C,UC(f,C)):(C.next=p.next,f.pending=p.next=C)}}function UC(u,f){var p=f.action,v=f.payload,O=u.state;if(f.isTransition){var C=F.T,q={};F.T=q;try{var K=p(O,v),ue=F.S;ue!==null&&ue(q,K),WC(u,f,K)}catch(we){u2(u,f,we)}finally{C!==null&&q.types!==null&&(C.types=q.types),F.T=C}}else try{C=p(O,v),WC(u,f,C)}catch(we){u2(u,f,we)}}function WC(u,f,p){p!==null&&typeof p=="object"&&typeof p.then=="function"?p.then(function(v){GC(u,f,v)},function(v){return u2(u,f,v)}):GC(u,f,p)}function GC(u,f,p){f.status="fulfilled",f.value=p,XC(f),u.state=p,f=u.pending,f!==null&&(p=f.next,p===f?u.pending=null:(p=p.next,f.next=p,UC(u,p)))}function u2(u,f,p){var v=u.pending;if(u.pending=null,v!==null){v=v.next;do f.status="rejected",f.reason=p,XC(f),f=f.next;while(f!==v)}u.action=null}function XC(u){u=u.listeners;for(var f=0;f<u.length;f++)(0,u[f])()}function YC(u,f){return f}function KC(u,f){if(yn){var p=rr.formState;if(p!==null){e:{var v=Wt;if(yn){if(fr){t:{for(var O=fr,C=aa;O.nodeType!==8;){if(!C){O=null;break t}if(O=la(O.nextSibling),O===null){O=null;break t}}C=O.data,O=C==="F!"||C==="F"?O:null}if(O){fr=la(O.nextSibling),v=O.data==="F!";break e}}ic(v)}v=!1}v&&(f=p[0])}}return p=Ys(),p.memoizedState=p.baseState=f,v={pending:null,lanes:0,dispatch:null,lastRenderedReducer:YC,lastRenderedState:f},p.queue=v,p=g8.bind(null,Wt,v),v.dispatch=p,v=c2(!1),C=g2.bind(null,Wt,!1,v.queue),v=Ys(),O={state:f,dispatch:null,action:u,pending:null},v.queue=O,p=aZ.bind(null,Wt,O,C,p),O.dispatch=p,v.memoizedState=u,[f,p,!1]}function ZC(u){var f=$r();return JC(f,Kn,u)}function JC(u,f,p){if(f=o2(u,f,YC)[0],u=cx(ol)[0],typeof f=="object"&&f!==null&&typeof f.then=="function")try{var v=hm(f)}catch(q){throw q===qd?Jg:q}else v=f;f=$r();var O=f.queue,C=O.dispatch;return p!==f.memoizedState&&(Wt.flags|=2048,Ud(9,{destroy:void 0},oZ.bind(null,O,p),null)),[v,C,u]}function oZ(u,f){u.action=f}function e8(u){var f=$r(),p=Kn;if(p!==null)return JC(f,p,u);$r(),f=f.memoizedState,p=$r();var v=p.queue.dispatch;return p.memoizedState=u,[f,v,!1]}function Ud(u,f,p,v){return u={tag:u,create:p,deps:v,inst:f,next:null},f=Wt.updateQueue,f===null&&(f=ox(),Wt.updateQueue=f),p=f.lastEffect,p===null?f.lastEffect=u.next=u:(v=p.next,p.next=u,u.next=v,f.lastEffect=u),u}function t8(){return $r().memoizedState}function ux(u,f,p,v){var O=Ys();Wt.flags|=u,O.memoizedState=Ud(1|f,{destroy:void 0},p,v===void 0?null:v)}function dx(u,f,p,v){var O=$r();v=v===void 0?null:v;var C=O.memoizedState.inst;Kn!==null&&v!==null&&t2(v,Kn.memoizedState.deps)?O.memoizedState=Ud(f,C,p,v):(Wt.flags|=u,O.memoizedState=Ud(1|f,C,p,v))}function n8(u,f){ux(8390656,8,u,f)}function d2(u,f){dx(2048,8,u,f)}function lZ(u){Wt.flags|=4;var f=Wt.updateQueue;if(f===null)f=ox(),Wt.updateQueue=f,f.events=[u];else{var p=f.events;p===null?f.events=[u]:p.push(u)}}function r8(u){var f=$r().memoizedState;return lZ({ref:f,nextImpl:u}),function(){if((Hn&2)!==0)throw Error(r(440));return f.impl.apply(void 0,arguments)}}function s8(u,f){return dx(4,2,u,f)}function i8(u,f){return dx(4,4,u,f)}function a8(u,f){if(typeof f=="function"){u=u();var p=f(u);return function(){typeof p=="function"?p():f(null)}}if(f!=null)return u=u(),f.current=u,function(){f.current=null}}function o8(u,f,p){p=p!=null?p.concat([u]):null,dx(4,4,a8.bind(null,f,u),p)}function h2(){}function l8(u,f){var p=$r();f=f===void 0?null:f;var v=p.memoizedState;return f!==null&&t2(f,v[1])?v[0]:(p.memoizedState=[u,f],u)}function c8(u,f){var p=$r();f=f===void 0?null:f;var v=p.memoizedState;if(f!==null&&t2(f,v[1]))return v[0];if(v=u(),Tu){tn(!0);try{u()}finally{tn(!1)}}return p.memoizedState=[v,f],v}function f2(u,f,p){return p===void 0||(al&1073741824)!==0&&(hn&261930)===0?u.memoizedState=f:(u.memoizedState=p,u=uT(),Wt.lanes|=u,mc|=u,p)}function u8(u,f,p,v){return Ai(p,f)?p:Hd.current!==null?(u=f2(u,p,v),Ai(u,f)||(Kr=!0),u):(al&42)===0||(al&1073741824)!==0&&(hn&261930)===0?(Kr=!0,u.memoizedState=p):(u=uT(),Wt.lanes|=u,mc|=u,f)}function d8(u,f,p,v,O){var C=Y.p;Y.p=C!==0&&8>C?C:8;var q=F.T,K={};F.T=K,g2(u,!1,f,p);try{var ue=O(),we=F.S;if(we!==null&&we(K,ue),ue!==null&&typeof ue=="object"&&typeof ue.then=="function"){var Ee=rZ(ue,v);fm(u,f,Ee,Ii(u))}else fm(u,f,v,Ii(u))}catch(Re){fm(u,f,{then:function(){},status:"rejected",reason:Re},Ii())}finally{Y.p=C,q!==null&&K.types!==null&&(q.types=K.types),F.T=q}}function cZ(){}function m2(u,f,p,v){if(u.tag!==5)throw Error(r(476));var O=h8(u).queue;d8(u,O,f,J,p===null?cZ:function(){return f8(u),p(v)})}function h8(u){var f=u.memoizedState;if(f!==null)return f;f={memoizedState:J,baseState:J,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ol,lastRenderedState:J},next:null};var p={};return f.next={memoizedState:p,baseState:p,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ol,lastRenderedState:p},next:null},u.memoizedState=f,u=u.alternate,u!==null&&(u.memoizedState=f),f}function f8(u){var f=h8(u);f.next===null&&(f=u.alternate.memoizedState),fm(u,f.next.queue,{},Ii())}function p2(){return Ts(_m)}function m8(){return $r().memoizedState}function p8(){return $r().memoizedState}function uZ(u){for(var f=u.return;f!==null;){switch(f.tag){case 24:case 3:var p=Ii();u=lc(p);var v=cc(f,u,p);v!==null&&(hi(v,f,p),lm(v,f,p)),f={cache:Qw()},u.payload=f;return}f=f.return}}function dZ(u,f,p){var v=Ii();p={lane:v,revertLane:0,gesture:null,action:p,hasEagerState:!1,eagerState:null,next:null},hx(u)?x8(f,p):(p=Rw(u,f,p,v),p!==null&&(hi(p,u,v),v8(p,f,v)))}function g8(u,f,p){var v=Ii();fm(u,f,p,v)}function fm(u,f,p,v){var O={lane:v,revertLane:0,gesture:null,action:p,hasEagerState:!1,eagerState:null,next:null};if(hx(u))x8(f,O);else{var C=u.alternate;if(u.lanes===0&&(C===null||C.lanes===0)&&(C=f.lastRenderedReducer,C!==null))try{var q=f.lastRenderedState,K=C(q,p);if(O.hasEagerState=!0,O.eagerState=K,Ai(K,q))return Ug(u,f,O,0),rr===null&&Vg(),!1}catch{}finally{}if(p=Rw(u,f,O,v),p!==null)return hi(p,u,v),v8(p,f,v),!0}return!1}function g2(u,f,p,v){if(v={lane:2,revertLane:G2(),gesture:null,action:v,hasEagerState:!1,eagerState:null,next:null},hx(u)){if(f)throw Error(r(479))}else f=Rw(u,p,v,2),f!==null&&hi(f,u,2)}function hx(u){var f=u.alternate;return u===Wt||f!==null&&f===Wt}function x8(u,f){Qd=ix=!0;var p=u.pending;p===null?f.next=f:(f.next=p.next,p.next=f),u.pending=f}function v8(u,f,p){if((p&4194048)!==0){var v=f.lanes;v&=u.pendingLanes,p|=v,f.lanes=p,xs(u,p)}}var mm={readContext:Ts,use:lx,useCallback:Pr,useContext:Pr,useEffect:Pr,useImperativeHandle:Pr,useLayoutEffect:Pr,useInsertionEffect:Pr,useMemo:Pr,useReducer:Pr,useRef:Pr,useState:Pr,useDebugValue:Pr,useDeferredValue:Pr,useTransition:Pr,useSyncExternalStore:Pr,useId:Pr,useHostTransitionStatus:Pr,useFormState:Pr,useActionState:Pr,useOptimistic:Pr,useMemoCache:Pr,useCacheRefresh:Pr};mm.useEffectEvent=Pr;var y8={readContext:Ts,use:lx,useCallback:function(u,f){return Ys().memoizedState=[u,f===void 0?null:f],u},useContext:Ts,useEffect:n8,useImperativeHandle:function(u,f,p){p=p!=null?p.concat([u]):null,ux(4194308,4,a8.bind(null,f,u),p)},useLayoutEffect:function(u,f){return ux(4194308,4,u,f)},useInsertionEffect:function(u,f){ux(4,2,u,f)},useMemo:function(u,f){var p=Ys();f=f===void 0?null:f;var v=u();if(Tu){tn(!0);try{u()}finally{tn(!1)}}return p.memoizedState=[v,f],v},useReducer:function(u,f,p){var v=Ys();if(p!==void 0){var O=p(f);if(Tu){tn(!0);try{p(f)}finally{tn(!1)}}}else O=f;return v.memoizedState=v.baseState=O,u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:u,lastRenderedState:O},v.queue=u,u=u.dispatch=dZ.bind(null,Wt,u),[v.memoizedState,u]},useRef:function(u){var f=Ys();return u={current:u},f.memoizedState=u},useState:function(u){u=c2(u);var f=u.queue,p=g8.bind(null,Wt,f);return f.dispatch=p,[u.memoizedState,p]},useDebugValue:h2,useDeferredValue:function(u,f){var p=Ys();return f2(p,u,f)},useTransition:function(){var u=c2(!1);return u=d8.bind(null,Wt,u.queue,!0,!1),Ys().memoizedState=u,[!1,u]},useSyncExternalStore:function(u,f,p){var v=Wt,O=Ys();if(yn){if(p===void 0)throw Error(r(407));p=p()}else{if(p=f(),rr===null)throw Error(r(349));(hn&127)!==0||FC(v,f,p)}O.memoizedState=p;var C={value:p,getSnapshot:f};return O.queue=C,n8($C.bind(null,v,C,u),[u]),v.flags|=2048,Ud(9,{destroy:void 0},qC.bind(null,v,C,p,f),null),p},useId:function(){var u=Ys(),f=rr.identifierPrefix;if(yn){var p=oo,v=ao;p=(v&~(1<<32-Rt(v)-1)).toString(32)+p,f="_"+f+"R_"+p,p=ax++,0<p&&(f+="H"+p.toString(32)),f+="_"}else p=sZ++,f="_"+f+"r_"+p.toString(32)+"_";return u.memoizedState=f},useHostTransitionStatus:p2,useFormState:KC,useActionState:KC,useOptimistic:function(u){var f=Ys();f.memoizedState=f.baseState=u;var p={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return f.queue=p,f=g2.bind(null,Wt,!0,p),p.dispatch=f,[u,f]},useMemoCache:a2,useCacheRefresh:function(){return Ys().memoizedState=uZ.bind(null,Wt)},useEffectEvent:function(u){var f=Ys(),p={impl:u};return f.memoizedState=p,function(){if((Hn&2)!==0)throw Error(r(440));return p.impl.apply(void 0,arguments)}}},x2={readContext:Ts,use:lx,useCallback:l8,useContext:Ts,useEffect:d2,useImperativeHandle:o8,useInsertionEffect:s8,useLayoutEffect:i8,useMemo:c8,useReducer:cx,useRef:t8,useState:function(){return cx(ol)},useDebugValue:h2,useDeferredValue:function(u,f){var p=$r();return u8(p,Kn.memoizedState,u,f)},useTransition:function(){var u=cx(ol)[0],f=$r().memoizedState;return[typeof u=="boolean"?u:hm(u),f]},useSyncExternalStore:BC,useId:m8,useHostTransitionStatus:p2,useFormState:ZC,useActionState:ZC,useOptimistic:function(u,f){var p=$r();return VC(p,Kn,u,f)},useMemoCache:a2,useCacheRefresh:p8};x2.useEffectEvent=r8;var b8={readContext:Ts,use:lx,useCallback:l8,useContext:Ts,useEffect:d2,useImperativeHandle:o8,useInsertionEffect:s8,useLayoutEffect:i8,useMemo:c8,useReducer:l2,useRef:t8,useState:function(){return l2(ol)},useDebugValue:h2,useDeferredValue:function(u,f){var p=$r();return Kn===null?f2(p,u,f):u8(p,Kn.memoizedState,u,f)},useTransition:function(){var u=l2(ol)[0],f=$r().memoizedState;return[typeof u=="boolean"?u:hm(u),f]},useSyncExternalStore:BC,useId:m8,useHostTransitionStatus:p2,useFormState:e8,useActionState:e8,useOptimistic:function(u,f){var p=$r();return Kn!==null?VC(p,Kn,u,f):(p.baseState=u,[u,p.queue.dispatch])},useMemoCache:a2,useCacheRefresh:p8};b8.useEffectEvent=r8;function v2(u,f,p,v){f=u.memoizedState,p=p(v,f),p=p==null?f:m({},f,p),u.memoizedState=p,u.lanes===0&&(u.updateQueue.baseState=p)}var y2={enqueueSetState:function(u,f,p){u=u._reactInternals;var v=Ii(),O=lc(v);O.payload=f,p!=null&&(O.callback=p),f=cc(u,O,v),f!==null&&(hi(f,u,v),lm(f,u,v))},enqueueReplaceState:function(u,f,p){u=u._reactInternals;var v=Ii(),O=lc(v);O.tag=1,O.payload=f,p!=null&&(O.callback=p),f=cc(u,O,v),f!==null&&(hi(f,u,v),lm(f,u,v))},enqueueForceUpdate:function(u,f){u=u._reactInternals;var p=Ii(),v=lc(p);v.tag=2,f!=null&&(v.callback=f),f=cc(u,v,p),f!==null&&(hi(f,u,p),lm(f,u,p))}};function w8(u,f,p,v,O,C,q){return u=u.stateNode,typeof u.shouldComponentUpdate=="function"?u.shouldComponentUpdate(v,C,q):f.prototype&&f.prototype.isPureReactComponent?!em(p,v)||!em(O,C):!0}function S8(u,f,p,v){u=f.state,typeof f.componentWillReceiveProps=="function"&&f.componentWillReceiveProps(p,v),typeof f.UNSAFE_componentWillReceiveProps=="function"&&f.UNSAFE_componentWillReceiveProps(p,v),f.state!==u&&y2.enqueueReplaceState(f,f.state,null)}function Eu(u,f){var p=f;if("ref"in f){p={};for(var v in f)v!=="ref"&&(p[v]=f[v])}if(u=u.defaultProps){p===f&&(p=m({},p));for(var O in u)p[O]===void 0&&(p[O]=u[O])}return p}function k8(u){Qg(u)}function O8(u){console.error(u)}function j8(u){Qg(u)}function fx(u,f){try{var p=u.onUncaughtError;p(f.value,{componentStack:f.stack})}catch(v){setTimeout(function(){throw v})}}function N8(u,f,p){try{var v=u.onCaughtError;v(p.value,{componentStack:p.stack,errorBoundary:f.tag===1?f.stateNode:null})}catch(O){setTimeout(function(){throw O})}}function b2(u,f,p){return p=lc(p),p.tag=3,p.payload={element:null},p.callback=function(){fx(u,f)},p}function C8(u){return u=lc(u),u.tag=3,u}function T8(u,f,p,v){var O=p.type.getDerivedStateFromError;if(typeof O=="function"){var C=v.value;u.payload=function(){return O(C)},u.callback=function(){N8(f,p,v)}}var q=p.stateNode;q!==null&&typeof q.componentDidCatch=="function"&&(u.callback=function(){N8(f,p,v),typeof O!="function"&&(pc===null?pc=new Set([this]):pc.add(this));var K=v.stack;this.componentDidCatch(v.value,{componentStack:K!==null?K:""})})}function hZ(u,f,p,v,O){if(p.flags|=32768,v!==null&&typeof v=="object"&&typeof v.then=="function"){if(f=p.alternate,f!==null&&Ld(f,p,O,!0),p=Ri.current,p!==null){switch(p.tag){case 31:case 13:return oa===null?jx():p.alternate===null&&zr===0&&(zr=3),p.flags&=-257,p.flags|=65536,p.lanes=O,v===ex?p.flags|=16384:(f=p.updateQueue,f===null?p.updateQueue=new Set([v]):f.add(v),V2(u,v,O)),!1;case 22:return p.flags|=65536,v===ex?p.flags|=16384:(f=p.updateQueue,f===null?(f={transitions:null,markerInstances:null,retryQueue:new Set([v])},p.updateQueue=f):(p=f.retryQueue,p===null?f.retryQueue=new Set([v]):p.add(v)),V2(u,v,O)),!1}throw Error(r(435,p.tag))}return V2(u,v,O),jx(),!1}if(yn)return f=Ri.current,f!==null?((f.flags&65536)===0&&(f.flags|=256),f.flags|=65536,f.lanes=O,v!==Bw&&(u=Error(r(422),{cause:v}),rm(ra(u,p)))):(v!==Bw&&(f=Error(r(423),{cause:v}),rm(ra(f,p))),u=u.current.alternate,u.flags|=65536,O&=-O,u.lanes|=O,v=ra(v,p),O=b2(u.stateNode,v,O),Yw(u,O),zr!==4&&(zr=2)),!1;var C=Error(r(520),{cause:v});if(C=ra(C,p),Sm===null?Sm=[C]:Sm.push(C),zr!==4&&(zr=2),f===null)return!0;v=ra(v,p),p=f;do{switch(p.tag){case 3:return p.flags|=65536,u=O&-O,p.lanes|=u,u=b2(p.stateNode,v,u),Yw(p,u),!1;case 1:if(f=p.type,C=p.stateNode,(p.flags&128)===0&&(typeof f.getDerivedStateFromError=="function"||C!==null&&typeof C.componentDidCatch=="function"&&(pc===null||!pc.has(C))))return p.flags|=65536,O&=-O,p.lanes|=O,O=C8(O),T8(O,u,p,v),Yw(p,O),!1}p=p.return}while(p!==null);return!1}var w2=Error(r(461)),Kr=!1;function Es(u,f,p,v){f.child=u===null?MC(f,null,p,v):Cu(f,u.child,p,v)}function E8(u,f,p,v,O){p=p.render;var C=f.ref;if("ref"in v){var q={};for(var K in v)K!=="ref"&&(q[K]=v[K])}else q=v;return ku(f),v=n2(u,f,p,q,C,O),K=r2(),u!==null&&!Kr?(s2(u,f,O),ll(u,f,O)):(yn&&K&&Iw(f),f.flags|=1,Es(u,f,v,O),f.child)}function _8(u,f,p,v,O){if(u===null){var C=p.type;return typeof C=="function"&&!Dw(C)&&C.defaultProps===void 0&&p.compare===null?(f.tag=15,f.type=C,A8(u,f,C,v,O)):(u=Gg(p.type,null,v,f,f.mode,O),u.ref=f.ref,u.return=f,f.child=u)}if(C=u.child,!E2(u,O)){var q=C.memoizedProps;if(p=p.compare,p=p!==null?p:em,p(q,v)&&u.ref===f.ref)return ll(u,f,O)}return f.flags|=1,u=nl(C,v),u.ref=f.ref,u.return=f,f.child=u}function A8(u,f,p,v,O){if(u!==null){var C=u.memoizedProps;if(em(C,v)&&u.ref===f.ref)if(Kr=!1,f.pendingProps=v=C,E2(u,O))(u.flags&131072)!==0&&(Kr=!0);else return f.lanes=u.lanes,ll(u,f,O)}return S2(u,f,p,v,O)}function M8(u,f,p,v){var O=v.children,C=u!==null?u.memoizedState:null;if(u===null&&f.stateNode===null&&(f.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),v.mode==="hidden"){if((f.flags&128)!==0){if(C=C!==null?C.baseLanes|p:p,u!==null){for(v=f.child=u.child,O=0;v!==null;)O=O|v.lanes|v.childLanes,v=v.sibling;v=O&~C}else v=0,f.child=null;return R8(u,f,C,p,v)}if((p&536870912)!==0)f.memoizedState={baseLanes:0,cachePool:null},u!==null&&Zg(f,C!==null?C.cachePool:null),C!==null?PC(f,C):Zw(),zC(f);else return v=f.lanes=536870912,R8(u,f,C!==null?C.baseLanes|p:p,p,v)}else C!==null?(Zg(f,C.cachePool),PC(f,C),dc(),f.memoizedState=null):(u!==null&&Zg(f,null),Zw(),dc());return Es(u,f,O,p),f.child}function pm(u,f){return u!==null&&u.tag===22||f.stateNode!==null||(f.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),f.sibling}function R8(u,f,p,v,O){var C=Uw();return C=C===null?null:{parent:Xr._currentValue,pool:C},f.memoizedState={baseLanes:p,cachePool:C},u!==null&&Zg(f,null),Zw(),zC(f),u!==null&&Ld(u,f,v,!0),f.childLanes=O,null}function mx(u,f){return f=gx({mode:f.mode,children:f.children},u.mode),f.ref=u.ref,u.child=f,f.return=u,f}function D8(u,f,p){return Cu(f,u.child,null,p),u=mx(f,f.pendingProps),u.flags|=2,Di(f),f.memoizedState=null,u}function fZ(u,f,p){var v=f.pendingProps,O=(f.flags&128)!==0;if(f.flags&=-129,u===null){if(yn){if(v.mode==="hidden")return u=mx(f,v),f.lanes=536870912,pm(null,u);if(e2(f),(u=fr)?(u=UT(u,aa),u=u!==null&&u.data==="&"?u:null,u!==null&&(f.memoizedState={dehydrated:u,treeContext:rc!==null?{id:ao,overflow:oo}:null,retryLane:536870912,hydrationErrors:null},p=xC(u),p.return=f,f.child=p,Cs=f,fr=null)):u=null,u===null)throw ic(f);return f.lanes=536870912,null}return mx(f,v)}var C=u.memoizedState;if(C!==null){var q=C.dehydrated;if(e2(f),O)if(f.flags&256)f.flags&=-257,f=D8(u,f,p);else if(f.memoizedState!==null)f.child=u.child,f.flags|=128,f=null;else throw Error(r(558));else if(Kr||Ld(u,f,p,!1),O=(p&u.childLanes)!==0,Kr||O){if(v=rr,v!==null&&(q=js(v,p),q!==0&&q!==C.retryLane))throw C.retryLane=q,yu(u,q),hi(v,u,q),w2;jx(),f=D8(u,f,p)}else u=C.treeContext,fr=la(q.nextSibling),Cs=f,yn=!0,sc=null,aa=!1,u!==null&&bC(f,u),f=mx(f,v),f.flags|=4096;return f}return u=nl(u.child,{mode:v.mode,children:v.children}),u.ref=f.ref,f.child=u,u.return=f,u}function px(u,f){var p=f.ref;if(p===null)u!==null&&u.ref!==null&&(f.flags|=4194816);else{if(typeof p!="function"&&typeof p!="object")throw Error(r(284));(u===null||u.ref!==p)&&(f.flags|=4194816)}}function S2(u,f,p,v,O){return ku(f),p=n2(u,f,p,v,void 0,O),v=r2(),u!==null&&!Kr?(s2(u,f,O),ll(u,f,O)):(yn&&v&&Iw(f),f.flags|=1,Es(u,f,p,O),f.child)}function P8(u,f,p,v,O,C){return ku(f),f.updateQueue=null,p=LC(f,v,p,O),IC(u),v=r2(),u!==null&&!Kr?(s2(u,f,C),ll(u,f,C)):(yn&&v&&Iw(f),f.flags|=1,Es(u,f,p,C),f.child)}function z8(u,f,p,v,O){if(ku(f),f.stateNode===null){var C=Dd,q=p.contextType;typeof q=="object"&&q!==null&&(C=Ts(q)),C=new p(v,C),f.memoizedState=C.state!==null&&C.state!==void 0?C.state:null,C.updater=y2,f.stateNode=C,C._reactInternals=f,C=f.stateNode,C.props=v,C.state=f.memoizedState,C.refs={},Gw(f),q=p.contextType,C.context=typeof q=="object"&&q!==null?Ts(q):Dd,C.state=f.memoizedState,q=p.getDerivedStateFromProps,typeof q=="function"&&(v2(f,p,q,v),C.state=f.memoizedState),typeof p.getDerivedStateFromProps=="function"||typeof C.getSnapshotBeforeUpdate=="function"||typeof C.UNSAFE_componentWillMount!="function"&&typeof C.componentWillMount!="function"||(q=C.state,typeof C.componentWillMount=="function"&&C.componentWillMount(),typeof C.UNSAFE_componentWillMount=="function"&&C.UNSAFE_componentWillMount(),q!==C.state&&y2.enqueueReplaceState(C,C.state,null),um(f,v,C,O),cm(),C.state=f.memoizedState),typeof C.componentDidMount=="function"&&(f.flags|=4194308),v=!0}else if(u===null){C=f.stateNode;var K=f.memoizedProps,ue=Eu(p,K);C.props=ue;var we=C.context,Ee=p.contextType;q=Dd,typeof Ee=="object"&&Ee!==null&&(q=Ts(Ee));var Re=p.getDerivedStateFromProps;Ee=typeof Re=="function"||typeof C.getSnapshotBeforeUpdate=="function",K=f.pendingProps!==K,Ee||typeof C.UNSAFE_componentWillReceiveProps!="function"&&typeof C.componentWillReceiveProps!="function"||(K||we!==q)&&S8(f,C,v,q),oc=!1;var Se=f.memoizedState;C.state=Se,um(f,v,C,O),cm(),we=f.memoizedState,K||Se!==we||oc?(typeof Re=="function"&&(v2(f,p,Re,v),we=f.memoizedState),(ue=oc||w8(f,p,ue,v,Se,we,q))?(Ee||typeof C.UNSAFE_componentWillMount!="function"&&typeof C.componentWillMount!="function"||(typeof C.componentWillMount=="function"&&C.componentWillMount(),typeof C.UNSAFE_componentWillMount=="function"&&C.UNSAFE_componentWillMount()),typeof C.componentDidMount=="function"&&(f.flags|=4194308)):(typeof C.componentDidMount=="function"&&(f.flags|=4194308),f.memoizedProps=v,f.memoizedState=we),C.props=v,C.state=we,C.context=q,v=ue):(typeof C.componentDidMount=="function"&&(f.flags|=4194308),v=!1)}else{C=f.stateNode,Xw(u,f),q=f.memoizedProps,Ee=Eu(p,q),C.props=Ee,Re=f.pendingProps,Se=C.context,we=p.contextType,ue=Dd,typeof we=="object"&&we!==null&&(ue=Ts(we)),K=p.getDerivedStateFromProps,(we=typeof K=="function"||typeof C.getSnapshotBeforeUpdate=="function")||typeof C.UNSAFE_componentWillReceiveProps!="function"&&typeof C.componentWillReceiveProps!="function"||(q!==Re||Se!==ue)&&S8(f,C,v,ue),oc=!1,Se=f.memoizedState,C.state=Se,um(f,v,C,O),cm();var Ce=f.memoizedState;q!==Re||Se!==Ce||oc||u!==null&&u.dependencies!==null&&Yg(u.dependencies)?(typeof K=="function"&&(v2(f,p,K,v),Ce=f.memoizedState),(Ee=oc||w8(f,p,Ee,v,Se,Ce,ue)||u!==null&&u.dependencies!==null&&Yg(u.dependencies))?(we||typeof C.UNSAFE_componentWillUpdate!="function"&&typeof C.componentWillUpdate!="function"||(typeof C.componentWillUpdate=="function"&&C.componentWillUpdate(v,Ce,ue),typeof C.UNSAFE_componentWillUpdate=="function"&&C.UNSAFE_componentWillUpdate(v,Ce,ue)),typeof C.componentDidUpdate=="function"&&(f.flags|=4),typeof C.getSnapshotBeforeUpdate=="function"&&(f.flags|=1024)):(typeof C.componentDidUpdate!="function"||q===u.memoizedProps&&Se===u.memoizedState||(f.flags|=4),typeof C.getSnapshotBeforeUpdate!="function"||q===u.memoizedProps&&Se===u.memoizedState||(f.flags|=1024),f.memoizedProps=v,f.memoizedState=Ce),C.props=v,C.state=Ce,C.context=ue,v=Ee):(typeof C.componentDidUpdate!="function"||q===u.memoizedProps&&Se===u.memoizedState||(f.flags|=4),typeof C.getSnapshotBeforeUpdate!="function"||q===u.memoizedProps&&Se===u.memoizedState||(f.flags|=1024),v=!1)}return C=v,px(u,f),v=(f.flags&128)!==0,C||v?(C=f.stateNode,p=v&&typeof p.getDerivedStateFromError!="function"?null:C.render(),f.flags|=1,u!==null&&v?(f.child=Cu(f,u.child,null,O),f.child=Cu(f,null,p,O)):Es(u,f,p,O),f.memoizedState=C.state,u=f.child):u=ll(u,f,O),u}function I8(u,f,p,v){return wu(),f.flags|=256,Es(u,f,p,v),f.child}var k2={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function O2(u){return{baseLanes:u,cachePool:NC()}}function j2(u,f,p){return u=u!==null?u.childLanes&~p:0,f&&(u|=zi),u}function L8(u,f,p){var v=f.pendingProps,O=!1,C=(f.flags&128)!==0,q;if((q=C)||(q=u!==null&&u.memoizedState===null?!1:(qr.current&2)!==0),q&&(O=!0,f.flags&=-129),q=(f.flags&32)!==0,f.flags&=-33,u===null){if(yn){if(O?uc(f):dc(),(u=fr)?(u=UT(u,aa),u=u!==null&&u.data!=="&"?u:null,u!==null&&(f.memoizedState={dehydrated:u,treeContext:rc!==null?{id:ao,overflow:oo}:null,retryLane:536870912,hydrationErrors:null},p=xC(u),p.return=f,f.child=p,Cs=f,fr=null)):u=null,u===null)throw ic(f);return o4(u)?f.lanes=32:f.lanes=536870912,null}var K=v.children;return v=v.fallback,O?(dc(),O=f.mode,K=gx({mode:"hidden",children:K},O),v=bu(v,O,p,null),K.return=f,v.return=f,K.sibling=v,f.child=K,v=f.child,v.memoizedState=O2(p),v.childLanes=j2(u,q,p),f.memoizedState=k2,pm(null,v)):(uc(f),N2(f,K))}var ue=u.memoizedState;if(ue!==null&&(K=ue.dehydrated,K!==null)){if(C)f.flags&256?(uc(f),f.flags&=-257,f=C2(u,f,p)):f.memoizedState!==null?(dc(),f.child=u.child,f.flags|=128,f=null):(dc(),K=v.fallback,O=f.mode,v=gx({mode:"visible",children:v.children},O),K=bu(K,O,p,null),K.flags|=2,v.return=f,K.return=f,v.sibling=K,f.child=v,Cu(f,u.child,null,p),v=f.child,v.memoizedState=O2(p),v.childLanes=j2(u,q,p),f.memoizedState=k2,f=pm(null,v));else if(uc(f),o4(K)){if(q=K.nextSibling&&K.nextSibling.dataset,q)var we=q.dgst;q=we,v=Error(r(419)),v.stack="",v.digest=q,rm({value:v,source:null,stack:null}),f=C2(u,f,p)}else if(Kr||Ld(u,f,p,!1),q=(p&u.childLanes)!==0,Kr||q){if(q=rr,q!==null&&(v=js(q,p),v!==0&&v!==ue.retryLane))throw ue.retryLane=v,yu(u,v),hi(q,u,v),w2;a4(K)||jx(),f=C2(u,f,p)}else a4(K)?(f.flags|=192,f.child=u.child,f=null):(u=ue.treeContext,fr=la(K.nextSibling),Cs=f,yn=!0,sc=null,aa=!1,u!==null&&bC(f,u),f=N2(f,v.children),f.flags|=4096);return f}return O?(dc(),K=v.fallback,O=f.mode,ue=u.child,we=ue.sibling,v=nl(ue,{mode:"hidden",children:v.children}),v.subtreeFlags=ue.subtreeFlags&65011712,we!==null?K=nl(we,K):(K=bu(K,O,p,null),K.flags|=2),K.return=f,v.return=f,v.sibling=K,f.child=v,pm(null,v),v=f.child,K=u.child.memoizedState,K===null?K=O2(p):(O=K.cachePool,O!==null?(ue=Xr._currentValue,O=O.parent!==ue?{parent:ue,pool:ue}:O):O=NC(),K={baseLanes:K.baseLanes|p,cachePool:O}),v.memoizedState=K,v.childLanes=j2(u,q,p),f.memoizedState=k2,pm(u.child,v)):(uc(f),p=u.child,u=p.sibling,p=nl(p,{mode:"visible",children:v.children}),p.return=f,p.sibling=null,u!==null&&(q=f.deletions,q===null?(f.deletions=[u],f.flags|=16):q.push(u)),f.child=p,f.memoizedState=null,p)}function N2(u,f){return f=gx({mode:"visible",children:f},u.mode),f.return=u,u.child=f}function gx(u,f){return u=Mi(22,u,null,f),u.lanes=0,u}function C2(u,f,p){return Cu(f,u.child,null,p),u=N2(f,f.pendingProps.children),u.flags|=2,f.memoizedState=null,u}function B8(u,f,p){u.lanes|=f;var v=u.alternate;v!==null&&(v.lanes|=f),$w(u.return,f,p)}function T2(u,f,p,v,O,C){var q=u.memoizedState;q===null?u.memoizedState={isBackwards:f,rendering:null,renderingStartTime:0,last:v,tail:p,tailMode:O,treeForkCount:C}:(q.isBackwards=f,q.rendering=null,q.renderingStartTime=0,q.last=v,q.tail=p,q.tailMode=O,q.treeForkCount=C)}function F8(u,f,p){var v=f.pendingProps,O=v.revealOrder,C=v.tail;v=v.children;var q=qr.current,K=(q&2)!==0;if(K?(q=q&1|2,f.flags|=128):q&=1,I(qr,q),Es(u,f,v,p),v=yn?nm:0,!K&&u!==null&&(u.flags&128)!==0)e:for(u=f.child;u!==null;){if(u.tag===13)u.memoizedState!==null&&B8(u,p,f);else if(u.tag===19)B8(u,p,f);else if(u.child!==null){u.child.return=u,u=u.child;continue}if(u===f)break e;for(;u.sibling===null;){if(u.return===null||u.return===f)break e;u=u.return}u.sibling.return=u.return,u=u.sibling}switch(O){case"forwards":for(p=f.child,O=null;p!==null;)u=p.alternate,u!==null&&sx(u)===null&&(O=p),p=p.sibling;p=O,p===null?(O=f.child,f.child=null):(O=p.sibling,p.sibling=null),T2(f,!1,O,p,C,v);break;case"backwards":case"unstable_legacy-backwards":for(p=null,O=f.child,f.child=null;O!==null;){if(u=O.alternate,u!==null&&sx(u)===null){f.child=O;break}u=O.sibling,O.sibling=p,p=O,O=u}T2(f,!0,p,null,C,v);break;case"together":T2(f,!1,null,null,void 0,v);break;default:f.memoizedState=null}return f.child}function ll(u,f,p){if(u!==null&&(f.dependencies=u.dependencies),mc|=f.lanes,(p&f.childLanes)===0)if(u!==null){if(Ld(u,f,p,!1),(p&f.childLanes)===0)return null}else return null;if(u!==null&&f.child!==u.child)throw Error(r(153));if(f.child!==null){for(u=f.child,p=nl(u,u.pendingProps),f.child=p,p.return=f;u.sibling!==null;)u=u.sibling,p=p.sibling=nl(u,u.pendingProps),p.return=f;p.sibling=null}return f.child}function E2(u,f){return(u.lanes&f)!==0?!0:(u=u.dependencies,!!(u!==null&&Yg(u)))}function mZ(u,f,p){switch(f.tag){case 3:se(f,f.stateNode.containerInfo),ac(f,Xr,u.memoizedState.cache),wu();break;case 27:case 5:oe(f);break;case 4:se(f,f.stateNode.containerInfo);break;case 10:ac(f,f.type,f.memoizedProps.value);break;case 31:if(f.memoizedState!==null)return f.flags|=128,e2(f),null;break;case 13:var v=f.memoizedState;if(v!==null)return v.dehydrated!==null?(uc(f),f.flags|=128,null):(p&f.child.childLanes)!==0?L8(u,f,p):(uc(f),u=ll(u,f,p),u!==null?u.sibling:null);uc(f);break;case 19:var O=(u.flags&128)!==0;if(v=(p&f.childLanes)!==0,v||(Ld(u,f,p,!1),v=(p&f.childLanes)!==0),O){if(v)return F8(u,f,p);f.flags|=128}if(O=f.memoizedState,O!==null&&(O.rendering=null,O.tail=null,O.lastEffect=null),I(qr,qr.current),v)break;return null;case 22:return f.lanes=0,M8(u,f,p,f.pendingProps);case 24:ac(f,Xr,u.memoizedState.cache)}return ll(u,f,p)}function q8(u,f,p){if(u!==null)if(u.memoizedProps!==f.pendingProps)Kr=!0;else{if(!E2(u,p)&&(f.flags&128)===0)return Kr=!1,mZ(u,f,p);Kr=(u.flags&131072)!==0}else Kr=!1,yn&&(f.flags&1048576)!==0&&yC(f,nm,f.index);switch(f.lanes=0,f.tag){case 16:e:{var v=f.pendingProps;if(u=ju(f.elementType),f.type=u,typeof u=="function")Dw(u)?(v=Eu(u,v),f.tag=1,f=z8(null,f,u,v,p)):(f.tag=0,f=S2(null,f,u,v,p));else{if(u!=null){var O=u.$$typeof;if(O===T){f.tag=11,f=E8(null,f,u,v,p);break e}else if(O===A){f.tag=14,f=_8(null,f,u,v,p);break e}}throw f=z(u)||u,Error(r(306,f,""))}}return f;case 0:return S2(u,f,f.type,f.pendingProps,p);case 1:return v=f.type,O=Eu(v,f.pendingProps),z8(u,f,v,O,p);case 3:e:{if(se(f,f.stateNode.containerInfo),u===null)throw Error(r(387));v=f.pendingProps;var C=f.memoizedState;O=C.element,Xw(u,f),um(f,v,null,p);var q=f.memoizedState;if(v=q.cache,ac(f,Xr,v),v!==C.cache&&Hw(f,[Xr],p,!0),cm(),v=q.element,C.isDehydrated)if(C={element:v,isDehydrated:!1,cache:q.cache},f.updateQueue.baseState=C,f.memoizedState=C,f.flags&256){f=I8(u,f,v,p);break e}else if(v!==O){O=ra(Error(r(424)),f),rm(O),f=I8(u,f,v,p);break e}else{switch(u=f.stateNode.containerInfo,u.nodeType){case 9:u=u.body;break;default:u=u.nodeName==="HTML"?u.ownerDocument.body:u}for(fr=la(u.firstChild),Cs=f,yn=!0,sc=null,aa=!0,p=MC(f,null,v,p),f.child=p;p;)p.flags=p.flags&-3|4096,p=p.sibling}else{if(wu(),v===O){f=ll(u,f,p);break e}Es(u,f,v,p)}f=f.child}return f;case 26:return px(u,f),u===null?(p=ZT(f.type,null,f.pendingProps,null))?f.memoizedState=p:yn||(p=f.type,u=f.pendingProps,v=Mx(ne.current).createElement(p),v[Cr]=f,v[Tr]=u,_s(v,p,u),Gr(v),f.stateNode=v):f.memoizedState=ZT(f.type,u.memoizedProps,f.pendingProps,u.memoizedState),null;case 27:return oe(f),u===null&&yn&&(v=f.stateNode=XT(f.type,f.pendingProps,ne.current),Cs=f,aa=!0,O=fr,yc(f.type)?(l4=O,fr=la(v.firstChild)):fr=O),Es(u,f,f.pendingProps.children,p),px(u,f),u===null&&(f.flags|=4194304),f.child;case 5:return u===null&&yn&&((O=v=fr)&&(v=QZ(v,f.type,f.pendingProps,aa),v!==null?(f.stateNode=v,Cs=f,fr=la(v.firstChild),aa=!1,O=!0):O=!1),O||ic(f)),oe(f),O=f.type,C=f.pendingProps,q=u!==null?u.memoizedProps:null,v=C.children,r4(O,C)?v=null:q!==null&&r4(O,q)&&(f.flags|=32),f.memoizedState!==null&&(O=n2(u,f,iZ,null,null,p),_m._currentValue=O),px(u,f),Es(u,f,v,p),f.child;case 6:return u===null&&yn&&((u=p=fr)&&(p=VZ(p,f.pendingProps,aa),p!==null?(f.stateNode=p,Cs=f,fr=null,u=!0):u=!1),u||ic(f)),null;case 13:return L8(u,f,p);case 4:return se(f,f.stateNode.containerInfo),v=f.pendingProps,u===null?f.child=Cu(f,null,v,p):Es(u,f,v,p),f.child;case 11:return E8(u,f,f.type,f.pendingProps,p);case 7:return Es(u,f,f.pendingProps,p),f.child;case 8:return Es(u,f,f.pendingProps.children,p),f.child;case 12:return Es(u,f,f.pendingProps.children,p),f.child;case 10:return v=f.pendingProps,ac(f,f.type,v.value),Es(u,f,v.children,p),f.child;case 9:return O=f.type._context,v=f.pendingProps.children,ku(f),O=Ts(O),v=v(O),f.flags|=1,Es(u,f,v,p),f.child;case 14:return _8(u,f,f.type,f.pendingProps,p);case 15:return A8(u,f,f.type,f.pendingProps,p);case 19:return F8(u,f,p);case 31:return fZ(u,f,p);case 22:return M8(u,f,p,f.pendingProps);case 24:return ku(f),v=Ts(Xr),u===null?(O=Uw(),O===null&&(O=rr,C=Qw(),O.pooledCache=C,C.refCount++,C!==null&&(O.pooledCacheLanes|=p),O=C),f.memoizedState={parent:v,cache:O},Gw(f),ac(f,Xr,O)):((u.lanes&p)!==0&&(Xw(u,f),um(f,null,null,p),cm()),O=u.memoizedState,C=f.memoizedState,O.parent!==v?(O={parent:v,cache:v},f.memoizedState=O,f.lanes===0&&(f.memoizedState=f.updateQueue.baseState=O),ac(f,Xr,v)):(v=C.cache,ac(f,Xr,v),v!==O.cache&&Hw(f,[Xr],p,!0))),Es(u,f,f.pendingProps.children,p),f.child;case 29:throw f.pendingProps}throw Error(r(156,f.tag))}function cl(u){u.flags|=4}function _2(u,f,p,v,O){if((f=(u.mode&32)!==0)&&(f=!1),f){if(u.flags|=16777216,(O&335544128)===O)if(u.stateNode.complete)u.flags|=8192;else if(mT())u.flags|=8192;else throw Nu=ex,Ww}else u.flags&=-16777217}function $8(u,f){if(f.type!=="stylesheet"||(f.state.loading&4)!==0)u.flags&=-16777217;else if(u.flags|=16777216,!r9(f))if(mT())u.flags|=8192;else throw Nu=ex,Ww}function xx(u,f){f!==null&&(u.flags|=4),u.flags&16384&&(f=u.tag!==22?vr():536870912,u.lanes|=f,Yd|=f)}function gm(u,f){if(!yn)switch(u.tailMode){case"hidden":f=u.tail;for(var p=null;f!==null;)f.alternate!==null&&(p=f),f=f.sibling;p===null?u.tail=null:p.sibling=null;break;case"collapsed":p=u.tail;for(var v=null;p!==null;)p.alternate!==null&&(v=p),p=p.sibling;v===null?f||u.tail===null?u.tail=null:u.tail.sibling=null:v.sibling=null}}function mr(u){var f=u.alternate!==null&&u.alternate.child===u.child,p=0,v=0;if(f)for(var O=u.child;O!==null;)p|=O.lanes|O.childLanes,v|=O.subtreeFlags&65011712,v|=O.flags&65011712,O.return=u,O=O.sibling;else for(O=u.child;O!==null;)p|=O.lanes|O.childLanes,v|=O.subtreeFlags,v|=O.flags,O.return=u,O=O.sibling;return u.subtreeFlags|=v,u.childLanes=p,f}function pZ(u,f,p){var v=f.pendingProps;switch(Lw(f),f.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return mr(f),null;case 1:return mr(f),null;case 3:return p=f.stateNode,v=null,u!==null&&(v=u.memoizedState.cache),f.memoizedState.cache!==v&&(f.flags|=2048),il(Xr),re(),p.pendingContext&&(p.context=p.pendingContext,p.pendingContext=null),(u===null||u.child===null)&&(Id(f)?cl(f):u===null||u.memoizedState.isDehydrated&&(f.flags&256)===0||(f.flags|=1024,Fw())),mr(f),null;case 26:var O=f.type,C=f.memoizedState;return u===null?(cl(f),C!==null?(mr(f),$8(f,C)):(mr(f),_2(f,O,null,v,p))):C?C!==u.memoizedState?(cl(f),mr(f),$8(f,C)):(mr(f),f.flags&=-16777217):(u=u.memoizedProps,u!==v&&cl(f),mr(f),_2(f,O,u,v,p)),null;case 27:if(Te(f),p=ne.current,O=f.type,u!==null&&f.stateNode!=null)u.memoizedProps!==v&&cl(f);else{if(!v){if(f.stateNode===null)throw Error(r(166));return mr(f),null}u=V.current,Id(f)?wC(f):(u=XT(O,v,p),f.stateNode=u,cl(f))}return mr(f),null;case 5:if(Te(f),O=f.type,u!==null&&f.stateNode!=null)u.memoizedProps!==v&&cl(f);else{if(!v){if(f.stateNode===null)throw Error(r(166));return mr(f),null}if(C=V.current,Id(f))wC(f);else{var q=Mx(ne.current);switch(C){case 1:C=q.createElementNS("http://www.w3.org/2000/svg",O);break;case 2:C=q.createElementNS("http://www.w3.org/1998/Math/MathML",O);break;default:switch(O){case"svg":C=q.createElementNS("http://www.w3.org/2000/svg",O);break;case"math":C=q.createElementNS("http://www.w3.org/1998/Math/MathML",O);break;case"script":C=q.createElement("div"),C.innerHTML="<script><\/script>",C=C.removeChild(C.firstChild);break;case"select":C=typeof v.is=="string"?q.createElement("select",{is:v.is}):q.createElement("select"),v.multiple?C.multiple=!0:v.size&&(C.size=v.size);break;default:C=typeof v.is=="string"?q.createElement(O,{is:v.is}):q.createElement(O)}}C[Cr]=f,C[Tr]=v;e:for(q=f.child;q!==null;){if(q.tag===5||q.tag===6)C.appendChild(q.stateNode);else if(q.tag!==4&&q.tag!==27&&q.child!==null){q.child.return=q,q=q.child;continue}if(q===f)break e;for(;q.sibling===null;){if(q.return===null||q.return===f)break e;q=q.return}q.sibling.return=q.return,q=q.sibling}f.stateNode=C;e:switch(_s(C,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&&cl(f)}}return mr(f),_2(f,f.type,u===null?null:u.memoizedProps,f.pendingProps,p),null;case 6:if(u&&f.stateNode!=null)u.memoizedProps!==v&&cl(f);else{if(typeof v!="string"&&f.stateNode===null)throw Error(r(166));if(u=ne.current,Id(f)){if(u=f.stateNode,p=f.memoizedProps,v=null,O=Cs,O!==null)switch(O.tag){case 27:case 5:v=O.memoizedProps}u[Cr]=f,u=!!(u.nodeValue===p||v!==null&&v.suppressHydrationWarning===!0||LT(u.nodeValue,p)),u||ic(f,!0)}else u=Mx(u).createTextNode(v),u[Cr]=f,f.stateNode=u}return mr(f),null;case 31:if(p=f.memoizedState,u===null||u.memoizedState!==null){if(v=Id(f),p!==null){if(u===null){if(!v)throw Error(r(318));if(u=f.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(r(557));u[Cr]=f}else wu(),(f.flags&128)===0&&(f.memoizedState=null),f.flags|=4;mr(f),u=!1}else p=Fw(),u!==null&&u.memoizedState!==null&&(u.memoizedState.hydrationErrors=p),u=!0;if(!u)return f.flags&256?(Di(f),f):(Di(f),null);if((f.flags&128)!==0)throw Error(r(558))}return mr(f),null;case 13:if(v=f.memoizedState,u===null||u.memoizedState!==null&&u.memoizedState.dehydrated!==null){if(O=Id(f),v!==null&&v.dehydrated!==null){if(u===null){if(!O)throw Error(r(318));if(O=f.memoizedState,O=O!==null?O.dehydrated:null,!O)throw Error(r(317));O[Cr]=f}else wu(),(f.flags&128)===0&&(f.memoizedState=null),f.flags|=4;mr(f),O=!1}else O=Fw(),u!==null&&u.memoizedState!==null&&(u.memoizedState.hydrationErrors=O),O=!0;if(!O)return f.flags&256?(Di(f),f):(Di(f),null)}return Di(f),(f.flags&128)!==0?(f.lanes=p,f):(p=v!==null,u=u!==null&&u.memoizedState!==null,p&&(v=f.child,O=null,v.alternate!==null&&v.alternate.memoizedState!==null&&v.alternate.memoizedState.cachePool!==null&&(O=v.alternate.memoizedState.cachePool.pool),C=null,v.memoizedState!==null&&v.memoizedState.cachePool!==null&&(C=v.memoizedState.cachePool.pool),C!==O&&(v.flags|=2048)),p!==u&&p&&(f.child.flags|=8192),xx(f,f.updateQueue),mr(f),null);case 4:return re(),u===null&&Z2(f.stateNode.containerInfo),mr(f),null;case 10:return il(f.type),mr(f),null;case 19:if(G(qr),v=f.memoizedState,v===null)return mr(f),null;if(O=(f.flags&128)!==0,C=v.rendering,C===null)if(O)gm(v,!1);else{if(zr!==0||u!==null&&(u.flags&128)!==0)for(u=f.child;u!==null;){if(C=sx(u),C!==null){for(f.flags|=128,gm(v,!1),u=C.updateQueue,f.updateQueue=u,xx(f,u),f.subtreeFlags=0,u=p,p=f.child;p!==null;)gC(p,u),p=p.sibling;return I(qr,qr.current&1|2),yn&&rl(f,v.treeForkCount),f.child}u=u.sibling}v.tail!==null&&_t()>Sx&&(f.flags|=128,O=!0,gm(v,!1),f.lanes=4194304)}else{if(!O)if(u=sx(C),u!==null){if(f.flags|=128,O=!0,u=u.updateQueue,f.updateQueue=u,xx(f,u),gm(v,!0),v.tail===null&&v.tailMode==="hidden"&&!C.alternate&&!yn)return mr(f),null}else 2*_t()-v.renderingStartTime>Sx&&p!==536870912&&(f.flags|=128,O=!0,gm(v,!1),f.lanes=4194304);v.isBackwards?(C.sibling=f.child,f.child=C):(u=v.last,u!==null?u.sibling=C:f.child=C,v.last=C)}return v.tail!==null?(u=v.tail,v.rendering=u,v.tail=u.sibling,v.renderingStartTime=_t(),u.sibling=null,p=qr.current,I(qr,O?p&1|2:p&1),yn&&rl(f,v.treeForkCount),u):(mr(f),null);case 22:case 23:return Di(f),Jw(),v=f.memoizedState!==null,u!==null?u.memoizedState!==null!==v&&(f.flags|=8192):v&&(f.flags|=8192),v?(p&536870912)!==0&&(f.flags&128)===0&&(mr(f),f.subtreeFlags&6&&(f.flags|=8192)):mr(f),p=f.updateQueue,p!==null&&xx(f,p.retryQueue),p=null,u!==null&&u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(p=u.memoizedState.cachePool.pool),v=null,f.memoizedState!==null&&f.memoizedState.cachePool!==null&&(v=f.memoizedState.cachePool.pool),v!==p&&(f.flags|=2048),u!==null&&G(Ou),null;case 24:return p=null,u!==null&&(p=u.memoizedState.cache),f.memoizedState.cache!==p&&(f.flags|=2048),il(Xr),mr(f),null;case 25:return null;case 30:return null}throw Error(r(156,f.tag))}function gZ(u,f){switch(Lw(f),f.tag){case 1:return u=f.flags,u&65536?(f.flags=u&-65537|128,f):null;case 3:return il(Xr),re(),u=f.flags,(u&65536)!==0&&(u&128)===0?(f.flags=u&-65537|128,f):null;case 26:case 27:case 5:return Te(f),null;case 31:if(f.memoizedState!==null){if(Di(f),f.alternate===null)throw Error(r(340));wu()}return u=f.flags,u&65536?(f.flags=u&-65537|128,f):null;case 13:if(Di(f),u=f.memoizedState,u!==null&&u.dehydrated!==null){if(f.alternate===null)throw Error(r(340));wu()}return u=f.flags,u&65536?(f.flags=u&-65537|128,f):null;case 19:return G(qr),null;case 4:return re(),null;case 10:return il(f.type),null;case 22:case 23:return Di(f),Jw(),u!==null&&G(Ou),u=f.flags,u&65536?(f.flags=u&-65537|128,f):null;case 24:return il(Xr),null;case 25:return null;default:return null}}function H8(u,f){switch(Lw(f),f.tag){case 3:il(Xr),re();break;case 26:case 27:case 5:Te(f);break;case 4:re();break;case 31:f.memoizedState!==null&&Di(f);break;case 13:Di(f);break;case 19:G(qr);break;case 10:il(f.type);break;case 22:case 23:Di(f),Jw(),u!==null&&G(Ou);break;case 24:il(Xr)}}function xm(u,f){try{var p=f.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 C=p.create,q=p.inst;v=C(),q.destroy=v}p=p.next}while(p!==O)}}catch(K){Un(f,f.return,K)}}function hc(u,f,p){try{var v=f.updateQueue,O=v!==null?v.lastEffect:null;if(O!==null){var C=O.next;v=C;do{if((v.tag&u)===u){var q=v.inst,K=q.destroy;if(K!==void 0){q.destroy=void 0,O=f;var ue=p,we=K;try{we()}catch(Ee){Un(O,ue,Ee)}}}v=v.next}while(v!==C)}}catch(Ee){Un(f,f.return,Ee)}}function Q8(u){var f=u.updateQueue;if(f!==null){var p=u.stateNode;try{DC(f,p)}catch(v){Un(u,u.return,v)}}}function V8(u,f,p){p.props=Eu(u.type,u.memoizedProps),p.state=u.memoizedState;try{p.componentWillUnmount()}catch(v){Un(u,f,v)}}function vm(u,f){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){Un(u,f,O)}}function lo(u,f){var p=u.ref,v=u.refCleanup;if(p!==null)if(typeof v=="function")try{v()}catch(O){Un(u,f,O)}finally{u.refCleanup=null,u=u.alternate,u!=null&&(u.refCleanup=null)}else if(typeof p=="function")try{p(null)}catch(O){Un(u,f,O)}else p.current=null}function U8(u){var f=u.type,p=u.memoizedProps,v=u.stateNode;try{e:switch(f){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){Un(u,u.return,O)}}function A2(u,f,p){try{var v=u.stateNode;LZ(v,u.type,p,f),v[Tr]=f}catch(O){Un(u,u.return,O)}}function W8(u){return u.tag===5||u.tag===3||u.tag===26||u.tag===27&&yc(u.type)||u.tag===4}function M2(u){e:for(;;){for(;u.sibling===null;){if(u.return===null||W8(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&&yc(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 R2(u,f,p){var v=u.tag;if(v===5||v===6)u=u.stateNode,f?(p.nodeType===9?p.body:p.nodeName==="HTML"?p.ownerDocument.body:p).insertBefore(u,f):(f=p.nodeType===9?p.body:p.nodeName==="HTML"?p.ownerDocument.body:p,f.appendChild(u),p=p._reactRootContainer,p!=null||f.onclick!==null||(f.onclick=el));else if(v!==4&&(v===27&&yc(u.type)&&(p=u.stateNode,f=null),u=u.child,u!==null))for(R2(u,f,p),u=u.sibling;u!==null;)R2(u,f,p),u=u.sibling}function vx(u,f,p){var v=u.tag;if(v===5||v===6)u=u.stateNode,f?p.insertBefore(u,f):p.appendChild(u);else if(v!==4&&(v===27&&yc(u.type)&&(p=u.stateNode),u=u.child,u!==null))for(vx(u,f,p),u=u.sibling;u!==null;)vx(u,f,p),u=u.sibling}function G8(u){var f=u.stateNode,p=u.memoizedProps;try{for(var v=u.type,O=f.attributes;O.length;)f.removeAttributeNode(O[0]);_s(f,v,p),f[Cr]=u,f[Tr]=p}catch(C){Un(u,u.return,C)}}var ul=!1,Zr=!1,D2=!1,X8=typeof WeakSet=="function"?WeakSet:Set,vs=null;function xZ(u,f){if(u=u.containerInfo,t4=Bx,u=oC(u),Cw(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,C=v.focusNode;v=v.focusOffset;try{p.nodeType,C.nodeType}catch{p=null;break e}var q=0,K=-1,ue=-1,we=0,Ee=0,Re=u,Se=null;t:for(;;){for(var Ce;Re!==p||O!==0&&Re.nodeType!==3||(K=q+O),Re!==C||v!==0&&Re.nodeType!==3||(ue=q+v),Re.nodeType===3&&(q+=Re.nodeValue.length),(Ce=Re.firstChild)!==null;)Se=Re,Re=Ce;for(;;){if(Re===u)break t;if(Se===p&&++we===O&&(K=q),Se===C&&++Ee===v&&(ue=q),(Ce=Re.nextSibling)!==null)break;Re=Se,Se=Re.parentNode}Re=Ce}p=K===-1||ue===-1?null:{start:K,end:ue}}else p=null}p=p||{start:0,end:0}}else p=null;for(n4={focusedElem:u,selectionRange:p},Bx=!1,vs=f;vs!==null;)if(f=vs,u=f.child,(f.subtreeFlags&1028)!==0&&u!==null)u.return=f,vs=u;else for(;vs!==null;){switch(f=vs,C=f.alternate,u=f.flags,f.tag){case 0:if((u&4)!==0&&(u=f.updateQueue,u=u!==null?u.events:null,u!==null))for(p=0;p<u.length;p++)O=u[p],O.ref.impl=O.nextImpl;break;case 11:case 15:break;case 1:if((u&1024)!==0&&C!==null){u=void 0,p=f,O=C.memoizedProps,C=C.memoizedState,v=p.stateNode;try{var ut=Eu(p.type,O);u=v.getSnapshotBeforeUpdate(ut,C),v.__reactInternalSnapshotBeforeUpdate=u}catch(At){Un(p,p.return,At)}}break;case 3:if((u&1024)!==0){if(u=f.stateNode.containerInfo,p=u.nodeType,p===9)i4(u);else if(p===1)switch(u.nodeName){case"HEAD":case"HTML":case"BODY":i4(u);break;default:u.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((u&1024)!==0)throw Error(r(163))}if(u=f.sibling,u!==null){u.return=f.return,vs=u;break}vs=f.return}}function Y8(u,f,p){var v=p.flags;switch(p.tag){case 0:case 11:case 15:hl(u,p),v&4&&xm(5,p);break;case 1:if(hl(u,p),v&4)if(u=p.stateNode,f===null)try{u.componentDidMount()}catch(q){Un(p,p.return,q)}else{var O=Eu(p.type,f.memoizedProps);f=f.memoizedState;try{u.componentDidUpdate(O,f,u.__reactInternalSnapshotBeforeUpdate)}catch(q){Un(p,p.return,q)}}v&64&&Q8(p),v&512&&vm(p,p.return);break;case 3:if(hl(u,p),v&64&&(u=p.updateQueue,u!==null)){if(f=null,p.child!==null)switch(p.child.tag){case 27:case 5:f=p.child.stateNode;break;case 1:f=p.child.stateNode}try{DC(u,f)}catch(q){Un(p,p.return,q)}}break;case 27:f===null&&v&4&&G8(p);case 26:case 5:hl(u,p),f===null&&v&4&&U8(p),v&512&&vm(p,p.return);break;case 12:hl(u,p);break;case 31:hl(u,p),v&4&&J8(u,p);break;case 13:hl(u,p),v&4&&eT(u,p),v&64&&(u=p.memoizedState,u!==null&&(u=u.dehydrated,u!==null&&(p=NZ.bind(null,p),UZ(u,p))));break;case 22:if(v=p.memoizedState!==null||ul,!v){f=f!==null&&f.memoizedState!==null||Zr,O=ul;var C=Zr;ul=v,(Zr=f)&&!C?fl(u,p,(p.subtreeFlags&8772)!==0):hl(u,p),ul=O,Zr=C}break;case 30:break;default:hl(u,p)}}function K8(u){var f=u.alternate;f!==null&&(u.alternate=null,K8(f)),u.child=null,u.deletions=null,u.sibling=null,u.tag===5&&(f=u.stateNode,f!==null&&Vf(f)),u.stateNode=null,u.return=null,u.dependencies=null,u.memoizedProps=null,u.memoizedState=null,u.pendingProps=null,u.stateNode=null,u.updateQueue=null}var yr=null,li=!1;function dl(u,f,p){for(p=p.child;p!==null;)Z8(u,f,p),p=p.sibling}function Z8(u,f,p){if(rt&&typeof rt.onCommitFiberUnmount=="function")try{rt.onCommitFiberUnmount(Fe,p)}catch{}switch(p.tag){case 26:Zr||lo(p,f),dl(u,f,p),p.memoizedState?p.memoizedState.count--:p.stateNode&&(p=p.stateNode,p.parentNode.removeChild(p));break;case 27:Zr||lo(p,f);var v=yr,O=li;yc(p.type)&&(yr=p.stateNode,li=!1),dl(u,f,p),Cm(p.stateNode),yr=v,li=O;break;case 5:Zr||lo(p,f);case 6:if(v=yr,O=li,yr=null,dl(u,f,p),yr=v,li=O,yr!==null)if(li)try{(yr.nodeType===9?yr.body:yr.nodeName==="HTML"?yr.ownerDocument.body:yr).removeChild(p.stateNode)}catch(C){Un(p,f,C)}else try{yr.removeChild(p.stateNode)}catch(C){Un(p,f,C)}break;case 18:yr!==null&&(li?(u=yr,QT(u.nodeType===9?u.body:u.nodeName==="HTML"?u.ownerDocument.body:u,p.stateNode),sh(u)):QT(yr,p.stateNode));break;case 4:v=yr,O=li,yr=p.stateNode.containerInfo,li=!0,dl(u,f,p),yr=v,li=O;break;case 0:case 11:case 14:case 15:hc(2,p,f),Zr||hc(4,p,f),dl(u,f,p);break;case 1:Zr||(lo(p,f),v=p.stateNode,typeof v.componentWillUnmount=="function"&&V8(p,f,v)),dl(u,f,p);break;case 21:dl(u,f,p);break;case 22:Zr=(v=Zr)||p.memoizedState!==null,dl(u,f,p),Zr=v;break;default:dl(u,f,p)}}function J8(u,f){if(f.memoizedState===null&&(u=f.alternate,u!==null&&(u=u.memoizedState,u!==null))){u=u.dehydrated;try{sh(u)}catch(p){Un(f,f.return,p)}}}function eT(u,f){if(f.memoizedState===null&&(u=f.alternate,u!==null&&(u=u.memoizedState,u!==null&&(u=u.dehydrated,u!==null))))try{sh(u)}catch(p){Un(f,f.return,p)}}function vZ(u){switch(u.tag){case 31:case 13:case 19:var f=u.stateNode;return f===null&&(f=u.stateNode=new X8),f;case 22:return u=u.stateNode,f=u._retryCache,f===null&&(f=u._retryCache=new X8),f;default:throw Error(r(435,u.tag))}}function yx(u,f){var p=vZ(u);f.forEach(function(v){if(!p.has(v)){p.add(v);var O=CZ.bind(null,u,v);v.then(O,O)}})}function ci(u,f){var p=f.deletions;if(p!==null)for(var v=0;v<p.length;v++){var O=p[v],C=u,q=f,K=q;e:for(;K!==null;){switch(K.tag){case 27:if(yc(K.type)){yr=K.stateNode,li=!1;break e}break;case 5:yr=K.stateNode,li=!1;break e;case 3:case 4:yr=K.stateNode.containerInfo,li=!0;break e}K=K.return}if(yr===null)throw Error(r(160));Z8(C,q,O),yr=null,li=!1,C=O.alternate,C!==null&&(C.return=null),O.return=null}if(f.subtreeFlags&13886)for(f=f.child;f!==null;)tT(f,u),f=f.sibling}var La=null;function tT(u,f){var p=u.alternate,v=u.flags;switch(u.tag){case 0:case 11:case 14:case 15:ci(f,u),ui(u),v&4&&(hc(3,u,u.return),xm(3,u),hc(5,u,u.return));break;case 1:ci(f,u),ui(u),v&512&&(Zr||p===null||lo(p,p.return)),v&64&&ul&&(u=u.updateQueue,u!==null&&(v=u.callbacks,v!==null&&(p=u.shared.hiddenCallbacks,u.shared.hiddenCallbacks=p===null?v:p.concat(v))));break;case 26:var O=La;if(ci(f,u),ui(u),v&512&&(Zr||p===null||lo(p,p.return)),v&4){var C=p!==null?p.memoizedState:null;if(v=u.memoizedState,p===null)if(v===null)if(u.stateNode===null){e:{v=u.type,p=u.memoizedProps,O=O.ownerDocument||O;t:switch(v){case"title":C=O.getElementsByTagName("title")[0],(!C||C[mu]||C[Cr]||C.namespaceURI==="http://www.w3.org/2000/svg"||C.hasAttribute("itemprop"))&&(C=O.createElement(v),O.head.insertBefore(C,O.querySelector("head > title"))),_s(C,v,p),C[Cr]=u,Gr(C),v=C;break e;case"link":var q=t9("link","href",O).get(v+(p.href||""));if(q){for(var K=0;K<q.length;K++)if(C=q[K],C.getAttribute("href")===(p.href==null||p.href===""?null:p.href)&&C.getAttribute("rel")===(p.rel==null?null:p.rel)&&C.getAttribute("title")===(p.title==null?null:p.title)&&C.getAttribute("crossorigin")===(p.crossOrigin==null?null:p.crossOrigin)){q.splice(K,1);break t}}C=O.createElement(v),_s(C,v,p),O.head.appendChild(C);break;case"meta":if(q=t9("meta","content",O).get(v+(p.content||""))){for(K=0;K<q.length;K++)if(C=q[K],C.getAttribute("content")===(p.content==null?null:""+p.content)&&C.getAttribute("name")===(p.name==null?null:p.name)&&C.getAttribute("property")===(p.property==null?null:p.property)&&C.getAttribute("http-equiv")===(p.httpEquiv==null?null:p.httpEquiv)&&C.getAttribute("charset")===(p.charSet==null?null:p.charSet)){q.splice(K,1);break t}}C=O.createElement(v),_s(C,v,p),O.head.appendChild(C);break;default:throw Error(r(468,v))}C[Cr]=u,Gr(C),v=C}u.stateNode=v}else n9(O,u.type,u.stateNode);else u.stateNode=e9(O,v,u.memoizedProps);else C!==v?(C===null?p.stateNode!==null&&(p=p.stateNode,p.parentNode.removeChild(p)):C.count--,v===null?n9(O,u.type,u.stateNode):e9(O,v,u.memoizedProps)):v===null&&u.stateNode!==null&&A2(u,u.memoizedProps,p.memoizedProps)}break;case 27:ci(f,u),ui(u),v&512&&(Zr||p===null||lo(p,p.return)),p!==null&&v&4&&A2(u,u.memoizedProps,p.memoizedProps);break;case 5:if(ci(f,u),ui(u),v&512&&(Zr||p===null||lo(p,p.return)),u.flags&32){O=u.stateNode;try{Cd(O,"")}catch(ut){Un(u,u.return,ut)}}v&4&&u.stateNode!=null&&(O=u.memoizedProps,A2(u,O,p!==null?p.memoizedProps:O)),v&1024&&(D2=!0);break;case 6:if(ci(f,u),ui(u),v&4){if(u.stateNode===null)throw Error(r(162));v=u.memoizedProps,p=u.stateNode;try{p.nodeValue=v}catch(ut){Un(u,u.return,ut)}}break;case 3:if(Px=null,O=La,La=Rx(f.containerInfo),ci(f,u),La=O,ui(u),v&4&&p!==null&&p.memoizedState.isDehydrated)try{sh(f.containerInfo)}catch(ut){Un(u,u.return,ut)}D2&&(D2=!1,nT(u));break;case 4:v=La,La=Rx(u.stateNode.containerInfo),ci(f,u),ui(u),La=v;break;case 12:ci(f,u),ui(u);break;case 31:ci(f,u),ui(u),v&4&&(v=u.updateQueue,v!==null&&(u.updateQueue=null,yx(u,v)));break;case 13:ci(f,u),ui(u),u.child.flags&8192&&u.memoizedState!==null!=(p!==null&&p.memoizedState!==null)&&(wx=_t()),v&4&&(v=u.updateQueue,v!==null&&(u.updateQueue=null,yx(u,v)));break;case 22:O=u.memoizedState!==null;var ue=p!==null&&p.memoizedState!==null,we=ul,Ee=Zr;if(ul=we||O,Zr=Ee||ue,ci(f,u),Zr=Ee,ul=we,ui(u),v&8192)e:for(f=u.stateNode,f._visibility=O?f._visibility&-2:f._visibility|1,O&&(p===null||ue||ul||Zr||_u(u)),p=null,f=u;;){if(f.tag===5||f.tag===26){if(p===null){ue=p=f;try{if(C=ue.stateNode,O)q=C.style,typeof q.setProperty=="function"?q.setProperty("display","none","important"):q.display="none";else{K=ue.stateNode;var Re=ue.memoizedProps.style,Se=Re!=null&&Re.hasOwnProperty("display")?Re.display:null;K.style.display=Se==null||typeof Se=="boolean"?"":(""+Se).trim()}}catch(ut){Un(ue,ue.return,ut)}}}else if(f.tag===6){if(p===null){ue=f;try{ue.stateNode.nodeValue=O?"":ue.memoizedProps}catch(ut){Un(ue,ue.return,ut)}}}else if(f.tag===18){if(p===null){ue=f;try{var Ce=ue.stateNode;O?VT(Ce,!0):VT(ue.stateNode,!1)}catch(ut){Un(ue,ue.return,ut)}}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===u)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===u)break e;for(;f.sibling===null;){if(f.return===null||f.return===u)break e;p===f&&(p=null),f=f.return}p===f&&(p=null),f.sibling.return=f.return,f=f.sibling}v&4&&(v=u.updateQueue,v!==null&&(p=v.retryQueue,p!==null&&(v.retryQueue=null,yx(u,p))));break;case 19:ci(f,u),ui(u),v&4&&(v=u.updateQueue,v!==null&&(u.updateQueue=null,yx(u,v)));break;case 30:break;case 21:break;default:ci(f,u),ui(u)}}function ui(u){var f=u.flags;if(f&2){try{for(var p,v=u.return;v!==null;){if(W8(v)){p=v;break}v=v.return}if(p==null)throw Error(r(160));switch(p.tag){case 27:var O=p.stateNode,C=M2(u);vx(u,C,O);break;case 5:var q=p.stateNode;p.flags&32&&(Cd(q,""),p.flags&=-33);var K=M2(u);vx(u,K,q);break;case 3:case 4:var ue=p.stateNode.containerInfo,we=M2(u);R2(u,we,ue);break;default:throw Error(r(161))}}catch(Ee){Un(u,u.return,Ee)}u.flags&=-3}f&4096&&(u.flags&=-4097)}function nT(u){if(u.subtreeFlags&1024)for(u=u.child;u!==null;){var f=u;nT(f),f.tag===5&&f.flags&1024&&f.stateNode.reset(),u=u.sibling}}function hl(u,f){if(f.subtreeFlags&8772)for(f=f.child;f!==null;)Y8(u,f.alternate,f),f=f.sibling}function _u(u){for(u=u.child;u!==null;){var f=u;switch(f.tag){case 0:case 11:case 14:case 15:hc(4,f,f.return),_u(f);break;case 1:lo(f,f.return);var p=f.stateNode;typeof p.componentWillUnmount=="function"&&V8(f,f.return,p),_u(f);break;case 27:Cm(f.stateNode);case 26:case 5:lo(f,f.return),_u(f);break;case 22:f.memoizedState===null&&_u(f);break;case 30:_u(f);break;default:_u(f)}u=u.sibling}}function fl(u,f,p){for(p=p&&(f.subtreeFlags&8772)!==0,f=f.child;f!==null;){var v=f.alternate,O=u,C=f,q=C.flags;switch(C.tag){case 0:case 11:case 15:fl(O,C,p),xm(4,C);break;case 1:if(fl(O,C,p),v=C,O=v.stateNode,typeof O.componentDidMount=="function")try{O.componentDidMount()}catch(we){Un(v,v.return,we)}if(v=C,O=v.updateQueue,O!==null){var K=v.stateNode;try{var ue=O.shared.hiddenCallbacks;if(ue!==null)for(O.shared.hiddenCallbacks=null,O=0;O<ue.length;O++)RC(ue[O],K)}catch(we){Un(v,v.return,we)}}p&&q&64&&Q8(C),vm(C,C.return);break;case 27:G8(C);case 26:case 5:fl(O,C,p),p&&v===null&&q&4&&U8(C),vm(C,C.return);break;case 12:fl(O,C,p);break;case 31:fl(O,C,p),p&&q&4&&J8(O,C);break;case 13:fl(O,C,p),p&&q&4&&eT(O,C);break;case 22:C.memoizedState===null&&fl(O,C,p),vm(C,C.return);break;case 30:break;default:fl(O,C,p)}f=f.sibling}}function P2(u,f){var p=null;u!==null&&u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(p=u.memoizedState.cachePool.pool),u=null,f.memoizedState!==null&&f.memoizedState.cachePool!==null&&(u=f.memoizedState.cachePool.pool),u!==p&&(u!=null&&u.refCount++,p!=null&&sm(p))}function z2(u,f){u=null,f.alternate!==null&&(u=f.alternate.memoizedState.cache),f=f.memoizedState.cache,f!==u&&(f.refCount++,u!=null&&sm(u))}function Ba(u,f,p,v){if(f.subtreeFlags&10256)for(f=f.child;f!==null;)rT(u,f,p,v),f=f.sibling}function rT(u,f,p,v){var O=f.flags;switch(f.tag){case 0:case 11:case 15:Ba(u,f,p,v),O&2048&&xm(9,f);break;case 1:Ba(u,f,p,v);break;case 3:Ba(u,f,p,v),O&2048&&(u=null,f.alternate!==null&&(u=f.alternate.memoizedState.cache),f=f.memoizedState.cache,f!==u&&(f.refCount++,u!=null&&sm(u)));break;case 12:if(O&2048){Ba(u,f,p,v),u=f.stateNode;try{var C=f.memoizedProps,q=C.id,K=C.onPostCommit;typeof K=="function"&&K(q,f.alternate===null?"mount":"update",u.passiveEffectDuration,-0)}catch(ue){Un(f,f.return,ue)}}else Ba(u,f,p,v);break;case 31:Ba(u,f,p,v);break;case 13:Ba(u,f,p,v);break;case 23:break;case 22:C=f.stateNode,q=f.alternate,f.memoizedState!==null?C._visibility&2?Ba(u,f,p,v):ym(u,f):C._visibility&2?Ba(u,f,p,v):(C._visibility|=2,Wd(u,f,p,v,(f.subtreeFlags&10256)!==0||!1)),O&2048&&P2(q,f);break;case 24:Ba(u,f,p,v),O&2048&&z2(f.alternate,f);break;default:Ba(u,f,p,v)}}function Wd(u,f,p,v,O){for(O=O&&((f.subtreeFlags&10256)!==0||!1),f=f.child;f!==null;){var C=u,q=f,K=p,ue=v,we=q.flags;switch(q.tag){case 0:case 11:case 15:Wd(C,q,K,ue,O),xm(8,q);break;case 23:break;case 22:var Ee=q.stateNode;q.memoizedState!==null?Ee._visibility&2?Wd(C,q,K,ue,O):ym(C,q):(Ee._visibility|=2,Wd(C,q,K,ue,O)),O&&we&2048&&P2(q.alternate,q);break;case 24:Wd(C,q,K,ue,O),O&&we&2048&&z2(q.alternate,q);break;default:Wd(C,q,K,ue,O)}f=f.sibling}}function ym(u,f){if(f.subtreeFlags&10256)for(f=f.child;f!==null;){var p=u,v=f,O=v.flags;switch(v.tag){case 22:ym(p,v),O&2048&&P2(v.alternate,v);break;case 24:ym(p,v),O&2048&&z2(v.alternate,v);break;default:ym(p,v)}f=f.sibling}}var bm=8192;function Gd(u,f,p){if(u.subtreeFlags&bm)for(u=u.child;u!==null;)sT(u,f,p),u=u.sibling}function sT(u,f,p){switch(u.tag){case 26:Gd(u,f,p),u.flags&bm&&u.memoizedState!==null&&sJ(p,La,u.memoizedState,u.memoizedProps);break;case 5:Gd(u,f,p);break;case 3:case 4:var v=La;La=Rx(u.stateNode.containerInfo),Gd(u,f,p),La=v;break;case 22:u.memoizedState===null&&(v=u.alternate,v!==null&&v.memoizedState!==null?(v=bm,bm=16777216,Gd(u,f,p),bm=v):Gd(u,f,p));break;default:Gd(u,f,p)}}function iT(u){var f=u.alternate;if(f!==null&&(u=f.child,u!==null)){f.child=null;do f=u.sibling,u.sibling=null,u=f;while(u!==null)}}function wm(u){var f=u.deletions;if((u.flags&16)!==0){if(f!==null)for(var p=0;p<f.length;p++){var v=f[p];vs=v,oT(v,u)}iT(u)}if(u.subtreeFlags&10256)for(u=u.child;u!==null;)aT(u),u=u.sibling}function aT(u){switch(u.tag){case 0:case 11:case 15:wm(u),u.flags&2048&&hc(9,u,u.return);break;case 3:wm(u);break;case 12:wm(u);break;case 22:var f=u.stateNode;u.memoizedState!==null&&f._visibility&2&&(u.return===null||u.return.tag!==13)?(f._visibility&=-3,bx(u)):wm(u);break;default:wm(u)}}function bx(u){var f=u.deletions;if((u.flags&16)!==0){if(f!==null)for(var p=0;p<f.length;p++){var v=f[p];vs=v,oT(v,u)}iT(u)}for(u=u.child;u!==null;){switch(f=u,f.tag){case 0:case 11:case 15:hc(8,f,f.return),bx(f);break;case 22:p=f.stateNode,p._visibility&2&&(p._visibility&=-3,bx(f));break;default:bx(f)}u=u.sibling}}function oT(u,f){for(;vs!==null;){var p=vs;switch(p.tag){case 0:case 11:case 15:hc(8,p,f);break;case 23:case 22:if(p.memoizedState!==null&&p.memoizedState.cachePool!==null){var v=p.memoizedState.cachePool.pool;v!=null&&v.refCount++}break;case 24:sm(p.memoizedState.cache)}if(v=p.child,v!==null)v.return=p,vs=v;else e:for(p=u;vs!==null;){v=vs;var O=v.sibling,C=v.return;if(K8(v),v===p){vs=null;break e}if(O!==null){O.return=C,vs=O;break e}vs=C}}}var yZ={getCacheForType:function(u){var f=Ts(Xr),p=f.data.get(u);return p===void 0&&(p=u(),f.data.set(u,p)),p},cacheSignal:function(){return Ts(Xr).controller.signal}},bZ=typeof WeakMap=="function"?WeakMap:Map,Hn=0,rr=null,ln=null,hn=0,Vn=0,Pi=null,fc=!1,Xd=!1,I2=!1,ml=0,zr=0,mc=0,Au=0,L2=0,zi=0,Yd=0,Sm=null,di=null,B2=!1,wx=0,lT=0,Sx=1/0,kx=null,pc=null,ls=0,gc=null,Kd=null,pl=0,F2=0,q2=null,cT=null,km=0,$2=null;function Ii(){return(Hn&2)!==0&&hn!==0?hn&-hn:F.T!==null?G2():Ct()}function uT(){if(zi===0)if((hn&536870912)===0||yn){var u=nn;nn<<=1,(nn&3932160)===0&&(nn=262144),zi=u}else zi=536870912;return u=Ri.current,u!==null&&(u.flags|=32),zi}function hi(u,f,p){(u===rr&&(Vn===2||Vn===9)||u.cancelPendingCommit!==null)&&(Zd(u,0),xc(u,hn,zi,!1)),cr(u,p),((Hn&2)===0||u!==rr)&&(u===rr&&((Hn&2)===0&&(Au|=p),zr===4&&xc(u,hn,zi,!1)),co(u))}function dT(u,f,p){if((Hn&6)!==0)throw Error(r(327));var v=!p&&(f&127)===0&&(f&u.expiredLanes)===0||Ur(u,f),O=v?kZ(u,f):Q2(u,f,!0),C=v;do{if(O===0){Xd&&!v&&xc(u,f,0,!1);break}else{if(p=u.current.alternate,C&&!wZ(p)){O=Q2(u,f,!1),C=!1;continue}if(O===2){if(C=f,u.errorRecoveryDisabledLanes&C)var q=0;else q=u.pendingLanes&-536870913,q=q!==0?q:q&536870912?536870912:0;if(q!==0){f=q;e:{var K=u;O=Sm;var ue=K.current.memoizedState.isDehydrated;if(ue&&(Zd(K,q).flags|=256),q=Q2(K,q,!1),q!==2){if(I2&&!ue){K.errorRecoveryDisabledLanes|=C,Au|=C,O=4;break e}C=di,di=O,C!==null&&(di===null?di=C:di.push.apply(di,C))}O=q}if(C=!1,O!==2)continue}}if(O===1){Zd(u,0),xc(u,f,0,!0);break}e:{switch(v=u,C=O,C){case 0:case 1:throw Error(r(345));case 4:if((f&4194048)!==f)break;case 6:xc(v,f,zi,!fc);break e;case 2:di=null;break;case 3:case 5:break;default:throw Error(r(329))}if((f&62914560)===f&&(O=wx+300-_t(),10<O)){if(xc(v,f,zi,!fc),xr(v,0,!0)!==0)break e;pl=f,v.timeoutHandle=$T(hT.bind(null,v,p,di,kx,B2,f,zi,Au,Yd,fc,C,"Throttled",-0,0),O);break e}hT(v,p,di,kx,B2,f,zi,Au,Yd,fc,C,null,-0,0)}}break}while(!0);co(u)}function hT(u,f,p,v,O,C,q,K,ue,we,Ee,Re,Se,Ce){if(u.timeoutHandle=-1,Re=f.subtreeFlags,Re&8192||(Re&16785408)===16785408){Re={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:el},sT(f,C,Re);var ut=(C&62914560)===C?wx-_t():(C&4194048)===C?lT-_t():0;if(ut=iJ(Re,ut),ut!==null){pl=C,u.cancelPendingCommit=ut(bT.bind(null,u,f,C,p,v,O,q,K,ue,Ee,Re,null,Se,Ce)),xc(u,C,q,!we);return}}bT(u,f,C,p,v,O,q,K,ue)}function wZ(u){for(var f=u;;){var p=f.tag;if((p===0||p===11||p===15)&&f.flags&16384&&(p=f.updateQueue,p!==null&&(p=p.stores,p!==null)))for(var v=0;v<p.length;v++){var O=p[v],C=O.getSnapshot;O=O.value;try{if(!Ai(C(),O))return!1}catch{return!1}}if(p=f.child,f.subtreeFlags&16384&&p!==null)p.return=f,f=p;else{if(f===u)break;for(;f.sibling===null;){if(f.return===null||f.return===u)return!0;f=f.return}f.sibling.return=f.return,f=f.sibling}}return!0}function xc(u,f,p,v){f&=~L2,f&=~Au,u.suspendedLanes|=f,u.pingedLanes&=~f,v&&(u.warmLanes|=f),v=u.expirationTimes;for(var O=f;0<O;){var C=31-Rt(O),q=1<<C;v[C]=-1,O&=~q}p!==0&&gs(u,p,f)}function Ox(){return(Hn&6)===0?(Om(0),!1):!0}function H2(){if(ln!==null){if(Vn===0)var u=ln.return;else u=ln,sl=Su=null,i2(u),$d=null,am=0,u=ln;for(;u!==null;)H8(u.alternate,u),u=u.return;ln=null}}function Zd(u,f){var p=u.timeoutHandle;p!==-1&&(u.timeoutHandle=-1,qZ(p)),p=u.cancelPendingCommit,p!==null&&(u.cancelPendingCommit=null,p()),pl=0,H2(),rr=u,ln=p=nl(u.current,null),hn=f,Vn=0,Pi=null,fc=!1,Xd=Ur(u,f),I2=!1,Yd=zi=L2=Au=mc=zr=0,di=Sm=null,B2=!1,(f&8)!==0&&(f|=f&32);var v=u.entangledLanes;if(v!==0)for(u=u.entanglements,v&=f;0<v;){var O=31-Rt(v),C=1<<O;f|=u[O],v&=~C}return ml=f,Vg(),p}function fT(u,f){Wt=null,F.H=mm,f===qd||f===Jg?(f=EC(),Vn=3):f===Ww?(f=EC(),Vn=4):Vn=f===w2?8:f!==null&&typeof f=="object"&&typeof f.then=="function"?6:1,Pi=f,ln===null&&(zr=1,fx(u,ra(f,u.current)))}function mT(){var u=Ri.current;return u===null?!0:(hn&4194048)===hn?oa===null:(hn&62914560)===hn||(hn&536870912)!==0?u===oa:!1}function pT(){var u=F.H;return F.H=mm,u===null?mm:u}function gT(){var u=F.A;return F.A=yZ,u}function jx(){zr=4,fc||(hn&4194048)!==hn&&Ri.current!==null||(Xd=!0),(mc&134217727)===0&&(Au&134217727)===0||rr===null||xc(rr,hn,zi,!1)}function Q2(u,f,p){var v=Hn;Hn|=2;var O=pT(),C=gT();(rr!==u||hn!==f)&&(kx=null,Zd(u,f)),f=!1;var q=zr;e:do try{if(Vn!==0&&ln!==null){var K=ln,ue=Pi;switch(Vn){case 8:H2(),q=6;break e;case 3:case 2:case 9:case 6:Ri.current===null&&(f=!0);var we=Vn;if(Vn=0,Pi=null,Jd(u,K,ue,we),p&&Xd){q=0;break e}break;default:we=Vn,Vn=0,Pi=null,Jd(u,K,ue,we)}}SZ(),q=zr;break}catch(Ee){fT(u,Ee)}while(!0);return f&&u.shellSuspendCounter++,sl=Su=null,Hn=v,F.H=O,F.A=C,ln===null&&(rr=null,hn=0,Vg()),q}function SZ(){for(;ln!==null;)xT(ln)}function kZ(u,f){var p=Hn;Hn|=2;var v=pT(),O=gT();rr!==u||hn!==f?(kx=null,Sx=_t()+500,Zd(u,f)):Xd=Ur(u,f);e:do try{if(Vn!==0&&ln!==null){f=ln;var C=Pi;t:switch(Vn){case 1:Vn=0,Pi=null,Jd(u,f,C,1);break;case 2:case 9:if(CC(C)){Vn=0,Pi=null,vT(f);break}f=function(){Vn!==2&&Vn!==9||rr!==u||(Vn=7),co(u)},C.then(f,f);break e;case 3:Vn=7;break e;case 4:Vn=5;break e;case 7:CC(C)?(Vn=0,Pi=null,vT(f)):(Vn=0,Pi=null,Jd(u,f,C,7));break;case 5:var q=null;switch(ln.tag){case 26:q=ln.memoizedState;case 5:case 27:var K=ln;if(q?r9(q):K.stateNode.complete){Vn=0,Pi=null;var ue=K.sibling;if(ue!==null)ln=ue;else{var we=K.return;we!==null?(ln=we,Nx(we)):ln=null}break t}}Vn=0,Pi=null,Jd(u,f,C,5);break;case 6:Vn=0,Pi=null,Jd(u,f,C,6);break;case 8:H2(),zr=6;break e;default:throw Error(r(462))}}OZ();break}catch(Ee){fT(u,Ee)}while(!0);return sl=Su=null,F.H=v,F.A=O,Hn=p,ln!==null?0:(rr=null,hn=0,Vg(),zr)}function OZ(){for(;ln!==null&&!It();)xT(ln)}function xT(u){var f=q8(u.alternate,u,ml);u.memoizedProps=u.pendingProps,f===null?Nx(u):ln=f}function vT(u){var f=u,p=f.alternate;switch(f.tag){case 15:case 0:f=P8(p,f,f.pendingProps,f.type,void 0,hn);break;case 11:f=P8(p,f,f.pendingProps,f.type.render,f.ref,hn);break;case 5:i2(f);default:H8(p,f),f=ln=gC(f,ml),f=q8(p,f,ml)}u.memoizedProps=u.pendingProps,f===null?Nx(u):ln=f}function Jd(u,f,p,v){sl=Su=null,i2(f),$d=null,am=0;var O=f.return;try{if(hZ(u,O,f,p,hn)){zr=1,fx(u,ra(p,u.current)),ln=null;return}}catch(C){if(O!==null)throw ln=O,C;zr=1,fx(u,ra(p,u.current)),ln=null;return}f.flags&32768?(yn||v===1?u=!0:Xd||(hn&536870912)!==0?u=!1:(fc=u=!0,(v===2||v===9||v===3||v===6)&&(v=Ri.current,v!==null&&v.tag===13&&(v.flags|=16384))),yT(f,u)):Nx(f)}function Nx(u){var f=u;do{if((f.flags&32768)!==0){yT(f,fc);return}u=f.return;var p=pZ(f.alternate,f,ml);if(p!==null){ln=p;return}if(f=f.sibling,f!==null){ln=f;return}ln=f=u}while(f!==null);zr===0&&(zr=5)}function yT(u,f){do{var p=gZ(u.alternate,u);if(p!==null){p.flags&=32767,ln=p;return}if(p=u.return,p!==null&&(p.flags|=32768,p.subtreeFlags=0,p.deletions=null),!f&&(u=u.sibling,u!==null)){ln=u;return}ln=u=p}while(u!==null);zr=6,ln=null}function bT(u,f,p,v,O,C,q,K,ue){u.cancelPendingCommit=null;do Cx();while(ls!==0);if((Hn&6)!==0)throw Error(r(327));if(f!==null){if(f===u.current)throw Error(r(177));if(C=f.lanes|f.childLanes,C|=Mw,nr(u,p,C,q,K,ue),u===rr&&(ln=rr=null,hn=0),Kd=f,gc=u,pl=p,F2=C,q2=O,cT=v,(f.subtreeFlags&10256)!==0||(f.flags&10256)!==0?(u.callbackNode=null,u.callbackPriority=0,TZ(st,function(){return jT(),null})):(u.callbackNode=null,u.callbackPriority=0),v=(f.flags&13878)!==0,(f.subtreeFlags&13878)!==0||v){v=F.T,F.T=null,O=Y.p,Y.p=2,q=Hn,Hn|=4;try{xZ(u,f,p)}finally{Hn=q,Y.p=O,F.T=v}}ls=1,wT(),ST(),kT()}}function wT(){if(ls===1){ls=0;var u=gc,f=Kd,p=(f.flags&13878)!==0;if((f.subtreeFlags&13878)!==0||p){p=F.T,F.T=null;var v=Y.p;Y.p=2;var O=Hn;Hn|=4;try{tT(f,u);var C=n4,q=oC(u.containerInfo),K=C.focusedElem,ue=C.selectionRange;if(q!==K&&K&&K.ownerDocument&&aC(K.ownerDocument.documentElement,K)){if(ue!==null&&Cw(K)){var we=ue.start,Ee=ue.end;if(Ee===void 0&&(Ee=we),"selectionStart"in K)K.selectionStart=we,K.selectionEnd=Math.min(Ee,K.value.length);else{var Re=K.ownerDocument||document,Se=Re&&Re.defaultView||window;if(Se.getSelection){var Ce=Se.getSelection(),ut=K.textContent.length,At=Math.min(ue.start,ut),Jn=ue.end===void 0?At:Math.min(ue.end,ut);!Ce.extend&&At>Jn&&(q=Jn,Jn=At,At=q);var pe=iC(K,At),fe=iC(K,Jn);if(pe&&fe&&(Ce.rangeCount!==1||Ce.anchorNode!==pe.node||Ce.anchorOffset!==pe.offset||Ce.focusNode!==fe.node||Ce.focusOffset!==fe.offset)){var ye=Re.createRange();ye.setStart(pe.node,pe.offset),Ce.removeAllRanges(),At>Jn?(Ce.addRange(ye),Ce.extend(fe.node,fe.offset)):(ye.setEnd(fe.node,fe.offset),Ce.addRange(ye))}}}}for(Re=[],Ce=K;Ce=Ce.parentNode;)Ce.nodeType===1&&Re.push({element:Ce,left:Ce.scrollLeft,top:Ce.scrollTop});for(typeof K.focus=="function"&&K.focus(),K=0;K<Re.length;K++){var Ae=Re[K];Ae.element.scrollLeft=Ae.left,Ae.element.scrollTop=Ae.top}}Bx=!!t4,n4=t4=null}finally{Hn=O,Y.p=v,F.T=p}}u.current=f,ls=2}}function ST(){if(ls===2){ls=0;var u=gc,f=Kd,p=(f.flags&8772)!==0;if((f.subtreeFlags&8772)!==0||p){p=F.T,F.T=null;var v=Y.p;Y.p=2;var O=Hn;Hn|=4;try{Y8(u,f.alternate,f)}finally{Hn=O,Y.p=v,F.T=p}}ls=3}}function kT(){if(ls===4||ls===3){ls=0,Yt();var u=gc,f=Kd,p=pl,v=cT;(f.subtreeFlags&10256)!==0||(f.flags&10256)!==0?ls=5:(ls=0,Kd=gc=null,OT(u,u.pendingLanes));var O=u.pendingLanes;if(O===0&&(pc=null),Le(p),f=f.stateNode,rt&&typeof rt.onCommitFiberRoot=="function")try{rt.onCommitFiberRoot(Fe,f,void 0,(f.current.flags&128)===128)}catch{}if(v!==null){f=F.T,O=Y.p,Y.p=2,F.T=null;try{for(var C=u.onRecoverableError,q=0;q<v.length;q++){var K=v[q];C(K.value,{componentStack:K.stack})}}finally{F.T=f,Y.p=O}}(pl&3)!==0&&Cx(),co(u),O=u.pendingLanes,(p&261930)!==0&&(O&42)!==0?u===$2?km++:(km=0,$2=u):km=0,Om(0)}}function OT(u,f){(u.pooledCacheLanes&=f)===0&&(f=u.pooledCache,f!=null&&(u.pooledCache=null,sm(f)))}function Cx(){return wT(),ST(),kT(),jT()}function jT(){if(ls!==5)return!1;var u=gc,f=F2;F2=0;var p=Le(pl),v=F.T,O=Y.p;try{Y.p=32>p?32:p,F.T=null,p=q2,q2=null;var C=gc,q=pl;if(ls=0,Kd=gc=null,pl=0,(Hn&6)!==0)throw Error(r(331));var K=Hn;if(Hn|=4,aT(C.current),rT(C,C.current,q,p),Hn=K,Om(0,!1),rt&&typeof rt.onPostCommitFiberRoot=="function")try{rt.onPostCommitFiberRoot(Fe,C)}catch{}return!0}finally{Y.p=O,F.T=v,OT(u,f)}}function NT(u,f,p){f=ra(p,f),f=b2(u.stateNode,f,2),u=cc(u,f,2),u!==null&&(cr(u,2),co(u))}function Un(u,f,p){if(u.tag===3)NT(u,u,p);else for(;f!==null;){if(f.tag===3){NT(f,u,p);break}else if(f.tag===1){var v=f.stateNode;if(typeof f.type.getDerivedStateFromError=="function"||typeof v.componentDidCatch=="function"&&(pc===null||!pc.has(v))){u=ra(p,u),p=C8(2),v=cc(f,p,2),v!==null&&(T8(p,v,f,u),cr(v,2),co(v));break}}f=f.return}}function V2(u,f,p){var v=u.pingCache;if(v===null){v=u.pingCache=new bZ;var O=new Set;v.set(f,O)}else O=v.get(f),O===void 0&&(O=new Set,v.set(f,O));O.has(p)||(I2=!0,O.add(p),u=jZ.bind(null,u,f,p),f.then(u,u))}function jZ(u,f,p){var v=u.pingCache;v!==null&&v.delete(f),u.pingedLanes|=u.suspendedLanes&p,u.warmLanes&=~p,rr===u&&(hn&p)===p&&(zr===4||zr===3&&(hn&62914560)===hn&&300>_t()-wx?(Hn&2)===0&&Zd(u,0):L2|=p,Yd===hn&&(Yd=0)),co(u)}function CT(u,f){f===0&&(f=vr()),u=yu(u,f),u!==null&&(cr(u,f),co(u))}function NZ(u){var f=u.memoizedState,p=0;f!==null&&(p=f.retryLane),CT(u,p)}function CZ(u,f){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(f),CT(u,p)}function TZ(u,f){return xt(u,f)}var Tx=null,eh=null,U2=!1,Ex=!1,W2=!1,vc=0;function co(u){u!==eh&&u.next===null&&(eh===null?Tx=eh=u:eh=eh.next=u),Ex=!0,U2||(U2=!0,_Z())}function Om(u,f){if(!W2&&Ex){W2=!0;do for(var p=!1,v=Tx;v!==null;){if(u!==0){var O=v.pendingLanes;if(O===0)var C=0;else{var q=v.suspendedLanes,K=v.pingedLanes;C=(1<<31-Rt(42|u)+1)-1,C&=O&~(q&~K),C=C&201326741?C&201326741|1:C?C|2:0}C!==0&&(p=!0,AT(v,C))}else C=hn,C=xr(v,v===rr?C:0,v.cancelPendingCommit!==null||v.timeoutHandle!==-1),(C&3)===0||Ur(v,C)||(p=!0,AT(v,C));v=v.next}while(p);W2=!1}}function EZ(){TT()}function TT(){Ex=U2=!1;var u=0;vc!==0&&FZ()&&(u=vc);for(var f=_t(),p=null,v=Tx;v!==null;){var O=v.next,C=ET(v,f);C===0?(v.next=null,p===null?Tx=O:p.next=O,O===null&&(eh=p)):(p=v,(u!==0||(C&3)!==0)&&(Ex=!0)),v=O}ls!==0&&ls!==5||Om(u),vc!==0&&(vc=0)}function ET(u,f){for(var p=u.suspendedLanes,v=u.pingedLanes,O=u.expirationTimes,C=u.pendingLanes&-62914561;0<C;){var q=31-Rt(C),K=1<<q,ue=O[q];ue===-1?((K&p)===0||(K&v)!==0)&&(O[q]=Wr(K,f)):ue<=f&&(u.expiredLanes|=K),C&=~K}if(f=rr,p=hn,p=xr(u,u===f?p:0,u.cancelPendingCommit!==null||u.timeoutHandle!==-1),v=u.callbackNode,p===0||u===f&&(Vn===2||Vn===9)||u.cancelPendingCommit!==null)return v!==null&&v!==null&&kn(v),u.callbackNode=null,u.callbackPriority=0;if((p&3)===0||Ur(u,p)){if(f=p&-p,f===u.callbackPriority)return f;switch(v!==null&&kn(v),Le(p)){case 2:case 8:p=Ie;break;case 32:p=st;break;case 268435456:p=Pt;break;default:p=st}return v=_T.bind(null,u),p=xt(p,v),u.callbackPriority=f,u.callbackNode=p,f}return v!==null&&v!==null&&kn(v),u.callbackPriority=2,u.callbackNode=null,2}function _T(u,f){if(ls!==0&&ls!==5)return u.callbackNode=null,u.callbackPriority=0,null;var p=u.callbackNode;if(Cx()&&u.callbackNode!==p)return null;var v=hn;return v=xr(u,u===rr?v:0,u.cancelPendingCommit!==null||u.timeoutHandle!==-1),v===0?null:(dT(u,v,f),ET(u,_t()),u.callbackNode!=null&&u.callbackNode===p?_T.bind(null,u):null)}function AT(u,f){if(Cx())return null;dT(u,f,!0)}function _Z(){$Z(function(){(Hn&6)!==0?xt(Ne,EZ):TT()})}function G2(){if(vc===0){var u=Bd;u===0&&(u=ot,ot<<=1,(ot&261888)===0&&(ot=256)),vc=u}return vc}function MT(u){return u==null||typeof u=="symbol"||typeof u=="boolean"?null:typeof u=="function"?u:Ig(""+u)}function RT(u,f){var p=f.ownerDocument.createElement("input");return p.name=f.name,p.value=f.value,u.id&&p.setAttribute("form",u.id),f.parentNode.insertBefore(p,f),u=new FormData(u),p.parentNode.removeChild(p),u}function AZ(u,f,p,v,O){if(f==="submit"&&p&&p.stateNode===O){var C=MT((O[Tr]||null).action),q=v.submitter;q&&(f=(f=q[Tr]||null)?MT(f.formAction):q.getAttribute("formAction"),f!==null&&(C=f,q=null));var K=new qg("action","action",null,v,O);u.push({event:K,listeners:[{instance:null,listener:function(){if(v.defaultPrevented){if(vc!==0){var ue=q?RT(O,q):new FormData(O);m2(p,{pending:!0,data:ue,method:O.method,action:C},null,ue)}}else typeof C=="function"&&(K.preventDefault(),ue=q?RT(O,q):new FormData(O),m2(p,{pending:!0,data:ue,method:O.method,action:C},C,ue))},currentTarget:O}]})}}for(var X2=0;X2<Aw.length;X2++){var Y2=Aw[X2],MZ=Y2.toLowerCase(),RZ=Y2[0].toUpperCase()+Y2.slice(1);Ia(MZ,"on"+RZ)}Ia(uC,"onAnimationEnd"),Ia(dC,"onAnimationIteration"),Ia(hC,"onAnimationStart"),Ia("dblclick","onDoubleClick"),Ia("focusin","onFocus"),Ia("focusout","onBlur"),Ia(XK,"onTransitionRun"),Ia(YK,"onTransitionStart"),Ia(KK,"onTransitionCancel"),Ia(fC,"onTransitionEnd"),Zo("onMouseEnter",["mouseout","mouseover"]),Zo("onMouseLeave",["mouseout","mouseover"]),Zo("onPointerEnter",["pointerout","pointerover"]),Zo("onPointerLeave",["pointerout","pointerover"]),Ko("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Ko("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Ko("onBeforeInput",["compositionend","keypress","textInput","paste"]),Ko("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Ko("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Ko("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var jm="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),DZ=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(jm));function DT(u,f){f=(f&4)!==0;for(var p=0;p<u.length;p++){var v=u[p],O=v.event;v=v.listeners;e:{var C=void 0;if(f)for(var q=v.length-1;0<=q;q--){var K=v[q],ue=K.instance,we=K.currentTarget;if(K=K.listener,ue!==C&&O.isPropagationStopped())break e;C=K,O.currentTarget=we;try{C(O)}catch(Ee){Qg(Ee)}O.currentTarget=null,C=ue}else for(q=0;q<v.length;q++){if(K=v[q],ue=K.instance,we=K.currentTarget,K=K.listener,ue!==C&&O.isPropagationStopped())break e;C=K,O.currentTarget=we;try{C(O)}catch(Ee){Qg(Ee)}O.currentTarget=null,C=ue}}}}function cn(u,f){var p=f[Qf];p===void 0&&(p=f[Qf]=new Set);var v=u+"__bubble";p.has(v)||(PT(f,u,2,!1),p.add(v))}function K2(u,f,p){var v=0;f&&(v|=4),PT(p,u,v,f)}var _x="_reactListening"+Math.random().toString(36).slice(2);function Z2(u){if(!u[_x]){u[_x]=!0,_g.forEach(function(p){p!=="selectionchange"&&(DZ.has(p)||K2(p,!1,u),K2(p,!0,u))});var f=u.nodeType===9?u:u.ownerDocument;f===null||f[_x]||(f[_x]=!0,K2("selectionchange",!1,f))}}function PT(u,f,p,v){switch(u9(f)){case 2:var O=lJ;break;case 8:O=cJ;break;default:O=f4}p=O.bind(null,f,p,u),O=void 0,!vw||f!=="touchstart"&&f!=="touchmove"&&f!=="wheel"||(O=!0),v?O!==void 0?u.addEventListener(f,p,{capture:!0,passive:O}):u.addEventListener(f,p,!0):O!==void 0?u.addEventListener(f,p,{passive:O}):u.addEventListener(f,p,!1)}function J2(u,f,p,v,O){var C=v;if((f&1)===0&&(f&2)===0&&v!==null)e:for(;;){if(v===null)return;var q=v.tag;if(q===3||q===4){var K=v.stateNode.containerInfo;if(K===O)break;if(q===4)for(q=v.return;q!==null;){var ue=q.tag;if((ue===3||ue===4)&&q.stateNode.containerInfo===O)return;q=q.return}for(;K!==null;){if(q=ec(K),q===null)return;if(ue=q.tag,ue===5||ue===6||ue===26||ue===27){v=C=q;continue e}K=K.parentNode}}v=v.return}F7(function(){var we=C,Ee=gw(p),Re=[];e:{var Se=mC.get(u);if(Se!==void 0){var Ce=qg,ut=u;switch(u){case"keypress":if(Bg(p)===0)break e;case"keydown":case"keyup":Ce=CK;break;case"focusin":ut="focus",Ce=Sw;break;case"focusout":ut="blur",Ce=Sw;break;case"beforeblur":case"afterblur":Ce=Sw;break;case"click":if(p.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Ce=H7;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Ce=pK;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Ce=_K;break;case uC:case dC:case hC:Ce=vK;break;case fC:Ce=MK;break;case"scroll":case"scrollend":Ce=fK;break;case"wheel":Ce=DK;break;case"copy":case"cut":case"paste":Ce=bK;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Ce=V7;break;case"toggle":case"beforetoggle":Ce=zK}var At=(f&4)!==0,Jn=!At&&(u==="scroll"||u==="scrollend"),pe=At?Se!==null?Se+"Capture":null:Se;At=[];for(var fe=we,ye;fe!==null;){var Ae=fe;if(ye=Ae.stateNode,Ae=Ae.tag,Ae!==5&&Ae!==26&&Ae!==27||ye===null||pe===null||(Ae=Wf(fe,pe),Ae!=null&&At.push(Nm(fe,Ae,ye))),Jn)break;fe=fe.return}0<At.length&&(Se=new Ce(Se,ut,null,p,Ee),Re.push({event:Se,listeners:At}))}}if((f&7)===0){e:{if(Se=u==="mouseover"||u==="pointerover",Ce=u==="mouseout"||u==="pointerout",Se&&p!==pw&&(ut=p.relatedTarget||p.fromElement)&&(ec(ut)||ut[Ns]))break e;if((Ce||Se)&&(Se=Ee.window===Ee?Ee:(Se=Ee.ownerDocument)?Se.defaultView||Se.parentWindow:window,Ce?(ut=p.relatedTarget||p.toElement,Ce=we,ut=ut?ec(ut):null,ut!==null&&(Jn=i(ut),At=ut.tag,ut!==Jn||At!==5&&At!==27&&At!==6)&&(ut=null)):(Ce=null,ut=we),Ce!==ut)){if(At=H7,Ae="onMouseLeave",pe="onMouseEnter",fe="mouse",(u==="pointerout"||u==="pointerover")&&(At=V7,Ae="onPointerLeave",pe="onPointerEnter",fe="pointer"),Jn=Ce==null?Se:pu(Ce),ye=ut==null?Se:pu(ut),Se=new At(Ae,fe+"leave",Ce,p,Ee),Se.target=Jn,Se.relatedTarget=ye,Ae=null,ec(Ee)===we&&(At=new At(pe,fe+"enter",ut,p,Ee),At.target=ye,At.relatedTarget=Jn,Ae=At),Jn=Ae,Ce&&ut)t:{for(At=PZ,pe=Ce,fe=ut,ye=0,Ae=pe;Ae;Ae=At(Ae))ye++;Ae=0;for(var Nt=fe;Nt;Nt=At(Nt))Ae++;for(;0<ye-Ae;)pe=At(pe),ye--;for(;0<Ae-ye;)fe=At(fe),Ae--;for(;ye--;){if(pe===fe||fe!==null&&pe===fe.alternate){At=pe;break t}pe=At(pe),fe=At(fe)}At=null}else At=null;Ce!==null&&zT(Re,Se,Ce,At,!1),ut!==null&&Jn!==null&&zT(Re,Jn,ut,At,!0)}}e:{if(Se=we?pu(we):window,Ce=Se.nodeName&&Se.nodeName.toLowerCase(),Ce==="select"||Ce==="input"&&Se.type==="file")var Ln=J7;else if(K7(Se))if(eC)Ln=UK;else{Ln=QK;var vt=HK}else Ce=Se.nodeName,!Ce||Ce.toLowerCase()!=="input"||Se.type!=="checkbox"&&Se.type!=="radio"?we&&mw(we.elementType)&&(Ln=J7):Ln=VK;if(Ln&&(Ln=Ln(u,we))){Z7(Re,Ln,p,Ee);break e}vt&&vt(u,Se,we),u==="focusout"&&we&&Se.type==="number"&&we.memoizedProps.value!=null&&fw(Se,"number",Se.value)}switch(vt=we?pu(we):window,u){case"focusin":(K7(vt)||vt.contentEditable==="true")&&(Ad=vt,Tw=we,tm=null);break;case"focusout":tm=Tw=Ad=null;break;case"mousedown":Ew=!0;break;case"contextmenu":case"mouseup":case"dragend":Ew=!1,lC(Re,p,Ee);break;case"selectionchange":if(GK)break;case"keydown":case"keyup":lC(Re,p,Ee)}var Zt;if(Ow)e:{switch(u){case"compositionstart":var fn="onCompositionStart";break e;case"compositionend":fn="onCompositionEnd";break e;case"compositionupdate":fn="onCompositionUpdate";break e}fn=void 0}else _d?X7(u,p)&&(fn="onCompositionEnd"):u==="keydown"&&p.keyCode===229&&(fn="onCompositionStart");fn&&(U7&&p.locale!=="ko"&&(_d||fn!=="onCompositionStart"?fn==="onCompositionEnd"&&_d&&(Zt=q7()):(nc=Ee,yw="value"in nc?nc.value:nc.textContent,_d=!0)),vt=Ax(we,fn),0<vt.length&&(fn=new Q7(fn,u,null,p,Ee),Re.push({event:fn,listeners:vt}),Zt?fn.data=Zt:(Zt=Y7(p),Zt!==null&&(fn.data=Zt)))),(Zt=LK?BK(u,p):FK(u,p))&&(fn=Ax(we,"onBeforeInput"),0<fn.length&&(vt=new Q7("onBeforeInput","beforeinput",null,p,Ee),Re.push({event:vt,listeners:fn}),vt.data=Zt)),AZ(Re,u,we,p,Ee)}DT(Re,f)})}function Nm(u,f,p){return{instance:u,listener:f,currentTarget:p}}function Ax(u,f){for(var p=f+"Capture",v=[];u!==null;){var O=u,C=O.stateNode;if(O=O.tag,O!==5&&O!==26&&O!==27||C===null||(O=Wf(u,p),O!=null&&v.unshift(Nm(u,O,C)),O=Wf(u,f),O!=null&&v.push(Nm(u,O,C))),u.tag===3)return v;u=u.return}return[]}function PZ(u){if(u===null)return null;do u=u.return;while(u&&u.tag!==5&&u.tag!==27);return u||null}function zT(u,f,p,v,O){for(var C=f._reactName,q=[];p!==null&&p!==v;){var K=p,ue=K.alternate,we=K.stateNode;if(K=K.tag,ue!==null&&ue===v)break;K!==5&&K!==26&&K!==27||we===null||(ue=we,O?(we=Wf(p,C),we!=null&&q.unshift(Nm(p,we,ue))):O||(we=Wf(p,C),we!=null&&q.push(Nm(p,we,ue)))),p=p.return}q.length!==0&&u.push({event:f,listeners:q})}var zZ=/\r\n?/g,IZ=/\u0000|\uFFFD/g;function IT(u){return(typeof u=="string"?u:""+u).replace(zZ,`
`).replace(IZ,"")}function LT(u,f){return f=IT(f),IT(u)===f}function Zn(u,f,p,v,O,C){switch(p){case"children":typeof v=="string"?f==="body"||f==="textarea"&&v===""||Cd(u,v):(typeof v=="number"||typeof v=="bigint")&&f!=="body"&&Cd(u,""+v);break;case"className":Pg(u,"class",v);break;case"tabIndex":Pg(u,"tabindex",v);break;case"dir":case"role":case"viewBox":case"width":case"height":Pg(u,p,v);break;case"style":L7(u,v,C);break;case"data":if(f!=="object"){Pg(u,"data",v);break}case"src":case"href":if(v===""&&(f!=="a"||p!=="href")){u.removeAttribute(p);break}if(v==null||typeof v=="function"||typeof v=="symbol"||typeof v=="boolean"){u.removeAttribute(p);break}v=Ig(""+v),u.setAttribute(p,v);break;case"action":case"formAction":if(typeof v=="function"){u.setAttribute(p,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof C=="function"&&(p==="formAction"?(f!=="input"&&Zn(u,f,"name",O.name,O,null),Zn(u,f,"formEncType",O.formEncType,O,null),Zn(u,f,"formMethod",O.formMethod,O,null),Zn(u,f,"formTarget",O.formTarget,O,null)):(Zn(u,f,"encType",O.encType,O,null),Zn(u,f,"method",O.method,O,null),Zn(u,f,"target",O.target,O,null)));if(v==null||typeof v=="symbol"||typeof v=="boolean"){u.removeAttribute(p);break}v=Ig(""+v),u.setAttribute(p,v);break;case"onClick":v!=null&&(u.onclick=el);break;case"onScroll":v!=null&&cn("scroll",u);break;case"onScrollEnd":v!=null&&cn("scrollend",u);break;case"dangerouslySetInnerHTML":if(v!=null){if(typeof v!="object"||!("__html"in v))throw Error(r(61));if(p=v.__html,p!=null){if(O.children!=null)throw Error(r(60));u.innerHTML=p}}break;case"multiple":u.multiple=v&&typeof v!="function"&&typeof v!="symbol";break;case"muted":u.muted=v&&typeof v!="function"&&typeof v!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(v==null||typeof v=="function"||typeof v=="boolean"||typeof v=="symbol"){u.removeAttribute("xlink:href");break}p=Ig(""+v),u.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",p);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":v!=null&&typeof v!="function"&&typeof v!="symbol"?u.setAttribute(p,""+v):u.removeAttribute(p);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":v&&typeof v!="function"&&typeof v!="symbol"?u.setAttribute(p,""):u.removeAttribute(p);break;case"capture":case"download":v===!0?u.setAttribute(p,""):v!==!1&&v!=null&&typeof v!="function"&&typeof v!="symbol"?u.setAttribute(p,v):u.removeAttribute(p);break;case"cols":case"rows":case"size":case"span":v!=null&&typeof v!="function"&&typeof v!="symbol"&&!isNaN(v)&&1<=v?u.setAttribute(p,v):u.removeAttribute(p);break;case"rowSpan":case"start":v==null||typeof v=="function"||typeof v=="symbol"||isNaN(v)?u.removeAttribute(p):u.setAttribute(p,v);break;case"popover":cn("beforetoggle",u),cn("toggle",u),Dg(u,"popover",v);break;case"xlinkActuate":Jo(u,"http://www.w3.org/1999/xlink","xlink:actuate",v);break;case"xlinkArcrole":Jo(u,"http://www.w3.org/1999/xlink","xlink:arcrole",v);break;case"xlinkRole":Jo(u,"http://www.w3.org/1999/xlink","xlink:role",v);break;case"xlinkShow":Jo(u,"http://www.w3.org/1999/xlink","xlink:show",v);break;case"xlinkTitle":Jo(u,"http://www.w3.org/1999/xlink","xlink:title",v);break;case"xlinkType":Jo(u,"http://www.w3.org/1999/xlink","xlink:type",v);break;case"xmlBase":Jo(u,"http://www.w3.org/XML/1998/namespace","xml:base",v);break;case"xmlLang":Jo(u,"http://www.w3.org/XML/1998/namespace","xml:lang",v);break;case"xmlSpace":Jo(u,"http://www.w3.org/XML/1998/namespace","xml:space",v);break;case"is":Dg(u,"is",v);break;case"innerText":case"textContent":break;default:(!(2<p.length)||p[0]!=="o"&&p[0]!=="O"||p[1]!=="n"&&p[1]!=="N")&&(p=dK.get(p)||p,Dg(u,p,v))}}function e4(u,f,p,v,O,C){switch(p){case"style":L7(u,v,C);break;case"dangerouslySetInnerHTML":if(v!=null){if(typeof v!="object"||!("__html"in v))throw Error(r(61));if(p=v.__html,p!=null){if(O.children!=null)throw Error(r(60));u.innerHTML=p}}break;case"children":typeof v=="string"?Cd(u,v):(typeof v=="number"||typeof v=="bigint")&&Cd(u,""+v);break;case"onScroll":v!=null&&cn("scroll",u);break;case"onScrollEnd":v!=null&&cn("scrollend",u);break;case"onClick":v!=null&&(u.onclick=el);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Ag.hasOwnProperty(p))e:{if(p[0]==="o"&&p[1]==="n"&&(O=p.endsWith("Capture"),f=p.slice(2,O?p.length-7:void 0),C=u[Tr]||null,C=C!=null?C[p]:null,typeof C=="function"&&u.removeEventListener(f,C,O),typeof v=="function")){typeof C!="function"&&C!==null&&(p in u?u[p]=null:u.hasAttribute(p)&&u.removeAttribute(p)),u.addEventListener(f,v,O);break e}p in u?u[p]=v:v===!0?u.setAttribute(p,""):Dg(u,p,v)}}}function _s(u,f,p){switch(f){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":cn("error",u),cn("load",u);var v=!1,O=!1,C;for(C in p)if(p.hasOwnProperty(C)){var q=p[C];if(q!=null)switch(C){case"src":v=!0;break;case"srcSet":O=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,f));default:Zn(u,f,C,q,p,null)}}O&&Zn(u,f,"srcSet",p.srcSet,p,null),v&&Zn(u,f,"src",p.src,p,null);return;case"input":cn("invalid",u);var K=C=q=O=null,ue=null,we=null;for(v in p)if(p.hasOwnProperty(v)){var Ee=p[v];if(Ee!=null)switch(v){case"name":O=Ee;break;case"type":q=Ee;break;case"checked":ue=Ee;break;case"defaultChecked":we=Ee;break;case"value":C=Ee;break;case"defaultValue":K=Ee;break;case"children":case"dangerouslySetInnerHTML":if(Ee!=null)throw Error(r(137,f));break;default:Zn(u,f,v,Ee,p,null)}}D7(u,C,K,ue,we,q,O,!1);return;case"select":cn("invalid",u),v=q=C=null;for(O in p)if(p.hasOwnProperty(O)&&(K=p[O],K!=null))switch(O){case"value":C=K;break;case"defaultValue":q=K;break;case"multiple":v=K;default:Zn(u,f,O,K,p,null)}f=C,p=q,u.multiple=!!v,f!=null?Nd(u,!!v,f,!1):p!=null&&Nd(u,!!v,p,!0);return;case"textarea":cn("invalid",u),C=O=v=null;for(q in p)if(p.hasOwnProperty(q)&&(K=p[q],K!=null))switch(q){case"value":v=K;break;case"defaultValue":O=K;break;case"children":C=K;break;case"dangerouslySetInnerHTML":if(K!=null)throw Error(r(91));break;default:Zn(u,f,q,K,p,null)}z7(u,v,O,C);return;case"option":for(ue in p)if(p.hasOwnProperty(ue)&&(v=p[ue],v!=null))switch(ue){case"selected":u.selected=v&&typeof v!="function"&&typeof v!="symbol";break;default:Zn(u,f,ue,v,p,null)}return;case"dialog":cn("beforetoggle",u),cn("toggle",u),cn("cancel",u),cn("close",u);break;case"iframe":case"object":cn("load",u);break;case"video":case"audio":for(v=0;v<jm.length;v++)cn(jm[v],u);break;case"image":cn("error",u),cn("load",u);break;case"details":cn("toggle",u);break;case"embed":case"source":case"link":cn("error",u),cn("load",u);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(we in p)if(p.hasOwnProperty(we)&&(v=p[we],v!=null))switch(we){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,f));default:Zn(u,f,we,v,p,null)}return;default:if(mw(f)){for(Ee in p)p.hasOwnProperty(Ee)&&(v=p[Ee],v!==void 0&&e4(u,f,Ee,v,p,void 0));return}}for(K in p)p.hasOwnProperty(K)&&(v=p[K],v!=null&&Zn(u,f,K,v,p,null))}function LZ(u,f,p,v){switch(f){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var O=null,C=null,q=null,K=null,ue=null,we=null,Ee=null;for(Ce in p){var Re=p[Ce];if(p.hasOwnProperty(Ce)&&Re!=null)switch(Ce){case"checked":break;case"value":break;case"defaultValue":ue=Re;default:v.hasOwnProperty(Ce)||Zn(u,f,Ce,null,v,Re)}}for(var Se in v){var Ce=v[Se];if(Re=p[Se],v.hasOwnProperty(Se)&&(Ce!=null||Re!=null))switch(Se){case"type":C=Ce;break;case"name":O=Ce;break;case"checked":we=Ce;break;case"defaultChecked":Ee=Ce;break;case"value":q=Ce;break;case"defaultValue":K=Ce;break;case"children":case"dangerouslySetInnerHTML":if(Ce!=null)throw Error(r(137,f));break;default:Ce!==Re&&Zn(u,f,Se,Ce,v,Re)}}hw(u,q,K,ue,we,Ee,C,O);return;case"select":Ce=q=K=Se=null;for(C in p)if(ue=p[C],p.hasOwnProperty(C)&&ue!=null)switch(C){case"value":break;case"multiple":Ce=ue;default:v.hasOwnProperty(C)||Zn(u,f,C,null,v,ue)}for(O in v)if(C=v[O],ue=p[O],v.hasOwnProperty(O)&&(C!=null||ue!=null))switch(O){case"value":Se=C;break;case"defaultValue":K=C;break;case"multiple":q=C;default:C!==ue&&Zn(u,f,O,C,v,ue)}f=K,p=q,v=Ce,Se!=null?Nd(u,!!p,Se,!1):!!v!=!!p&&(f!=null?Nd(u,!!p,f,!0):Nd(u,!!p,p?[]:"",!1));return;case"textarea":Ce=Se=null;for(K in p)if(O=p[K],p.hasOwnProperty(K)&&O!=null&&!v.hasOwnProperty(K))switch(K){case"value":break;case"children":break;default:Zn(u,f,K,null,v,O)}for(q in v)if(O=v[q],C=p[q],v.hasOwnProperty(q)&&(O!=null||C!=null))switch(q){case"value":Se=O;break;case"defaultValue":Ce=O;break;case"children":break;case"dangerouslySetInnerHTML":if(O!=null)throw Error(r(91));break;default:O!==C&&Zn(u,f,q,O,v,C)}P7(u,Se,Ce);return;case"option":for(var ut in p)if(Se=p[ut],p.hasOwnProperty(ut)&&Se!=null&&!v.hasOwnProperty(ut))switch(ut){case"selected":u.selected=!1;break;default:Zn(u,f,ut,null,v,Se)}for(ue in v)if(Se=v[ue],Ce=p[ue],v.hasOwnProperty(ue)&&Se!==Ce&&(Se!=null||Ce!=null))switch(ue){case"selected":u.selected=Se&&typeof Se!="function"&&typeof Se!="symbol";break;default:Zn(u,f,ue,Se,v,Ce)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var At in p)Se=p[At],p.hasOwnProperty(At)&&Se!=null&&!v.hasOwnProperty(At)&&Zn(u,f,At,null,v,Se);for(we in v)if(Se=v[we],Ce=p[we],v.hasOwnProperty(we)&&Se!==Ce&&(Se!=null||Ce!=null))switch(we){case"children":case"dangerouslySetInnerHTML":if(Se!=null)throw Error(r(137,f));break;default:Zn(u,f,we,Se,v,Ce)}return;default:if(mw(f)){for(var Jn in p)Se=p[Jn],p.hasOwnProperty(Jn)&&Se!==void 0&&!v.hasOwnProperty(Jn)&&e4(u,f,Jn,void 0,v,Se);for(Ee in v)Se=v[Ee],Ce=p[Ee],!v.hasOwnProperty(Ee)||Se===Ce||Se===void 0&&Ce===void 0||e4(u,f,Ee,Se,v,Ce);return}}for(var pe in p)Se=p[pe],p.hasOwnProperty(pe)&&Se!=null&&!v.hasOwnProperty(pe)&&Zn(u,f,pe,null,v,Se);for(Re in v)Se=v[Re],Ce=p[Re],!v.hasOwnProperty(Re)||Se===Ce||Se==null&&Ce==null||Zn(u,f,Re,Se,v,Ce)}function BT(u){switch(u){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function BZ(){if(typeof performance.getEntriesByType=="function"){for(var u=0,f=0,p=performance.getEntriesByType("resource"),v=0;v<p.length;v++){var O=p[v],C=O.transferSize,q=O.initiatorType,K=O.duration;if(C&&K&&BT(q)){for(q=0,K=O.responseEnd,v+=1;v<p.length;v++){var ue=p[v],we=ue.startTime;if(we>K)break;var Ee=ue.transferSize,Re=ue.initiatorType;Ee&&BT(Re)&&(ue=ue.responseEnd,q+=Ee*(ue<K?1:(K-we)/(ue-we)))}if(--v,f+=8*(C+q)/(O.duration/1e3),u++,10<u)break}}if(0<u)return f/u/1e6}return navigator.connection&&(u=navigator.connection.downlink,typeof u=="number")?u:5}var t4=null,n4=null;function Mx(u){return u.nodeType===9?u:u.ownerDocument}function FT(u){switch(u){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function qT(u,f){if(u===0)switch(f){case"svg":return 1;case"math":return 2;default:return 0}return u===1&&f==="foreignObject"?0:u}function r4(u,f){return u==="textarea"||u==="noscript"||typeof f.children=="string"||typeof f.children=="number"||typeof f.children=="bigint"||typeof f.dangerouslySetInnerHTML=="object"&&f.dangerouslySetInnerHTML!==null&&f.dangerouslySetInnerHTML.__html!=null}var s4=null;function FZ(){var u=window.event;return u&&u.type==="popstate"?u===s4?!1:(s4=u,!0):(s4=null,!1)}var $T=typeof setTimeout=="function"?setTimeout:void 0,qZ=typeof clearTimeout=="function"?clearTimeout:void 0,HT=typeof Promise=="function"?Promise:void 0,$Z=typeof queueMicrotask=="function"?queueMicrotask:typeof HT<"u"?function(u){return HT.resolve(null).then(u).catch(HZ)}:$T;function HZ(u){setTimeout(function(){throw u})}function yc(u){return u==="head"}function QT(u,f){var p=f,v=0;do{var O=p.nextSibling;if(u.removeChild(p),O&&O.nodeType===8)if(p=O.data,p==="/$"||p==="/&"){if(v===0){u.removeChild(O),sh(f);return}v--}else if(p==="$"||p==="$?"||p==="$~"||p==="$!"||p==="&")v++;else if(p==="html")Cm(u.ownerDocument.documentElement);else if(p==="head"){p=u.ownerDocument.head,Cm(p);for(var C=p.firstChild;C;){var q=C.nextSibling,K=C.nodeName;C[mu]||K==="SCRIPT"||K==="STYLE"||K==="LINK"&&C.rel.toLowerCase()==="stylesheet"||p.removeChild(C),C=q}}else p==="body"&&Cm(u.ownerDocument.body);p=O}while(p);sh(f)}function VT(u,f){var p=u;u=0;do{var v=p.nextSibling;if(p.nodeType===1?f?(p._stashedDisplay=p.style.display,p.style.display="none"):(p.style.display=p._stashedDisplay||"",p.getAttribute("style")===""&&p.removeAttribute("style")):p.nodeType===3&&(f?(p._stashedText=p.nodeValue,p.nodeValue=""):p.nodeValue=p._stashedText||""),v&&v.nodeType===8)if(p=v.data,p==="/$"){if(u===0)break;u--}else p!=="$"&&p!=="$?"&&p!=="$~"&&p!=="$!"||u++;p=v}while(p)}function i4(u){var f=u.firstChild;for(f&&f.nodeType===10&&(f=f.nextSibling);f;){var p=f;switch(f=f.nextSibling,p.nodeName){case"HTML":case"HEAD":case"BODY":i4(p),Vf(p);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(p.rel.toLowerCase()==="stylesheet")continue}u.removeChild(p)}}function QZ(u,f,p,v){for(;u.nodeType===1;){var O=p;if(u.nodeName.toLowerCase()!==f.toLowerCase()){if(!v&&(u.nodeName!=="INPUT"||u.type!=="hidden"))break}else if(v){if(!u[mu])switch(f){case"meta":if(!u.hasAttribute("itemprop"))break;return u;case"link":if(C=u.getAttribute("rel"),C==="stylesheet"&&u.hasAttribute("data-precedence"))break;if(C!==O.rel||u.getAttribute("href")!==(O.href==null||O.href===""?null:O.href)||u.getAttribute("crossorigin")!==(O.crossOrigin==null?null:O.crossOrigin)||u.getAttribute("title")!==(O.title==null?null:O.title))break;return u;case"style":if(u.hasAttribute("data-precedence"))break;return u;case"script":if(C=u.getAttribute("src"),(C!==(O.src==null?null:O.src)||u.getAttribute("type")!==(O.type==null?null:O.type)||u.getAttribute("crossorigin")!==(O.crossOrigin==null?null:O.crossOrigin))&&C&&u.hasAttribute("async")&&!u.hasAttribute("itemprop"))break;return u;default:return u}}else if(f==="input"&&u.type==="hidden"){var C=O.name==null?null:""+O.name;if(O.type==="hidden"&&u.getAttribute("name")===C)return u}else return u;if(u=la(u.nextSibling),u===null)break}return null}function VZ(u,f,p){if(f==="")return null;for(;u.nodeType!==3;)if((u.nodeType!==1||u.nodeName!=="INPUT"||u.type!=="hidden")&&!p||(u=la(u.nextSibling),u===null))return null;return u}function UT(u,f){for(;u.nodeType!==8;)if((u.nodeType!==1||u.nodeName!=="INPUT"||u.type!=="hidden")&&!f||(u=la(u.nextSibling),u===null))return null;return u}function a4(u){return u.data==="$?"||u.data==="$~"}function o4(u){return u.data==="$!"||u.data==="$?"&&u.ownerDocument.readyState!=="loading"}function UZ(u,f){var p=u.ownerDocument;if(u.data==="$~")u._reactRetry=f;else if(u.data!=="$?"||p.readyState!=="loading")f();else{var v=function(){f(),p.removeEventListener("DOMContentLoaded",v)};p.addEventListener("DOMContentLoaded",v),u._reactRetry=v}}function la(u){for(;u!=null;u=u.nextSibling){var f=u.nodeType;if(f===1||f===3)break;if(f===8){if(f=u.data,f==="$"||f==="$!"||f==="$?"||f==="$~"||f==="&"||f==="F!"||f==="F")break;if(f==="/$"||f==="/&")return null}}return u}var l4=null;function WT(u){u=u.nextSibling;for(var f=0;u;){if(u.nodeType===8){var p=u.data;if(p==="/$"||p==="/&"){if(f===0)return la(u.nextSibling);f--}else p!=="$"&&p!=="$!"&&p!=="$?"&&p!=="$~"&&p!=="&"||f++}u=u.nextSibling}return null}function GT(u){u=u.previousSibling;for(var f=0;u;){if(u.nodeType===8){var p=u.data;if(p==="$"||p==="$!"||p==="$?"||p==="$~"||p==="&"){if(f===0)return u;f--}else p!=="/$"&&p!=="/&"||f++}u=u.previousSibling}return null}function XT(u,f,p){switch(f=Mx(p),u){case"html":if(u=f.documentElement,!u)throw Error(r(452));return u;case"head":if(u=f.head,!u)throw Error(r(453));return u;case"body":if(u=f.body,!u)throw Error(r(454));return u;default:throw Error(r(451))}}function Cm(u){for(var f=u.attributes;f.length;)u.removeAttributeNode(f[0]);Vf(u)}var ca=new Map,YT=new Set;function Rx(u){return typeof u.getRootNode=="function"?u.getRootNode():u.nodeType===9?u:u.ownerDocument}var gl=Y.d;Y.d={f:WZ,r:GZ,D:XZ,C:YZ,L:KZ,m:ZZ,X:eJ,S:JZ,M:tJ};function WZ(){var u=gl.f(),f=Ox();return u||f}function GZ(u){var f=Yo(u);f!==null&&f.tag===5&&f.type==="form"?f8(f):gl.r(u)}var th=typeof document>"u"?null:document;function KT(u,f,p){var v=th;if(v&&typeof f=="string"&&f){var O=ta(f);O='link[rel="'+u+'"][href="'+O+'"]',typeof p=="string"&&(O+='[crossorigin="'+p+'"]'),YT.has(O)||(YT.add(O),u={rel:u,crossOrigin:p,href:f},v.querySelector(O)===null&&(f=v.createElement("link"),_s(f,"link",u),Gr(f),v.head.appendChild(f)))}}function XZ(u){gl.D(u),KT("dns-prefetch",u,null)}function YZ(u,f){gl.C(u,f),KT("preconnect",u,f)}function KZ(u,f,p){gl.L(u,f,p);var v=th;if(v&&u&&f){var O='link[rel="preload"][as="'+ta(f)+'"]';f==="image"&&p&&p.imageSrcSet?(O+='[imagesrcset="'+ta(p.imageSrcSet)+'"]',typeof p.imageSizes=="string"&&(O+='[imagesizes="'+ta(p.imageSizes)+'"]')):O+='[href="'+ta(u)+'"]';var C=O;switch(f){case"style":C=nh(u);break;case"script":C=rh(u)}ca.has(C)||(u=m({rel:"preload",href:f==="image"&&p&&p.imageSrcSet?void 0:u,as:f},p),ca.set(C,u),v.querySelector(O)!==null||f==="style"&&v.querySelector(Tm(C))||f==="script"&&v.querySelector(Em(C))||(f=v.createElement("link"),_s(f,"link",u),Gr(f),v.head.appendChild(f)))}}function ZZ(u,f){gl.m(u,f);var p=th;if(p&&u){var v=f&&typeof f.as=="string"?f.as:"script",O='link[rel="modulepreload"][as="'+ta(v)+'"][href="'+ta(u)+'"]',C=O;switch(v){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":C=rh(u)}if(!ca.has(C)&&(u=m({rel:"modulepreload",href:u},f),ca.set(C,u),p.querySelector(O)===null)){switch(v){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(p.querySelector(Em(C)))return}v=p.createElement("link"),_s(v,"link",u),Gr(v),p.head.appendChild(v)}}}function JZ(u,f,p){gl.S(u,f,p);var v=th;if(v&&u){var O=tc(v).hoistableStyles,C=nh(u);f=f||"default";var q=O.get(C);if(!q){var K={loading:0,preload:null};if(q=v.querySelector(Tm(C)))K.loading=5;else{u=m({rel:"stylesheet",href:u,"data-precedence":f},p),(p=ca.get(C))&&c4(u,p);var ue=q=v.createElement("link");Gr(ue),_s(ue,"link",u),ue._p=new Promise(function(we,Ee){ue.onload=we,ue.onerror=Ee}),ue.addEventListener("load",function(){K.loading|=1}),ue.addEventListener("error",function(){K.loading|=2}),K.loading|=4,Dx(q,f,v)}q={type:"stylesheet",instance:q,count:1,state:K},O.set(C,q)}}}function eJ(u,f){gl.X(u,f);var p=th;if(p&&u){var v=tc(p).hoistableScripts,O=rh(u),C=v.get(O);C||(C=p.querySelector(Em(O)),C||(u=m({src:u,async:!0},f),(f=ca.get(O))&&u4(u,f),C=p.createElement("script"),Gr(C),_s(C,"link",u),p.head.appendChild(C)),C={type:"script",instance:C,count:1,state:null},v.set(O,C))}}function tJ(u,f){gl.M(u,f);var p=th;if(p&&u){var v=tc(p).hoistableScripts,O=rh(u),C=v.get(O);C||(C=p.querySelector(Em(O)),C||(u=m({src:u,async:!0,type:"module"},f),(f=ca.get(O))&&u4(u,f),C=p.createElement("script"),Gr(C),_s(C,"link",u),p.head.appendChild(C)),C={type:"script",instance:C,count:1,state:null},v.set(O,C))}}function ZT(u,f,p,v){var O=(O=ne.current)?Rx(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"?(f=nh(p.href),p=tc(O).hoistableStyles,v=p.get(f),v||(v={type:"style",instance:null,count:0,state:null},p.set(f,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=nh(p.href);var C=tc(O).hoistableStyles,q=C.get(u);if(q||(O=O.ownerDocument||O,q={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},C.set(u,q),(C=O.querySelector(Tm(u)))&&!C._p&&(q.instance=C,q.state.loading=5),ca.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},ca.set(u,p),C||nJ(O,u,p,q.state))),f&&v===null)throw Error(r(528,""));return q}if(f&&v!==null)throw Error(r(529,""));return null;case"script":return f=p.async,p=p.src,typeof p=="string"&&f&&typeof f!="function"&&typeof f!="symbol"?(f=rh(p),p=tc(O).hoistableScripts,v=p.get(f),v||(v={type:"script",instance:null,count:0,state:null},p.set(f,v)),v):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,u))}}function nh(u){return'href="'+ta(u)+'"'}function Tm(u){return'link[rel="stylesheet"]['+u+"]"}function JT(u){return m({},u,{"data-precedence":u.precedence,precedence:null})}function nJ(u,f,p,v){u.querySelector('link[rel="preload"][as="style"]['+f+"]")?v.loading=1:(f=u.createElement("link"),v.preload=f,f.addEventListener("load",function(){return v.loading|=1}),f.addEventListener("error",function(){return v.loading|=2}),_s(f,"link",p),Gr(f),u.head.appendChild(f))}function rh(u){return'[src="'+ta(u)+'"]'}function Em(u){return"script[async]"+u}function e9(u,f,p){if(f.count++,f.instance===null)switch(f.type){case"style":var v=u.querySelector('style[data-href~="'+ta(p.href)+'"]');if(v)return f.instance=v,Gr(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"),Gr(v),_s(v,"style",O),Dx(v,p.precedence,u),f.instance=v;case"stylesheet":O=nh(p.href);var C=u.querySelector(Tm(O));if(C)return f.state.loading|=4,f.instance=C,Gr(C),C;v=JT(p),(O=ca.get(O))&&c4(v,O),C=(u.ownerDocument||u).createElement("link"),Gr(C);var q=C;return q._p=new Promise(function(K,ue){q.onload=K,q.onerror=ue}),_s(C,"link",v),f.state.loading|=4,Dx(C,p.precedence,u),f.instance=C;case"script":return C=rh(p.src),(O=u.querySelector(Em(C)))?(f.instance=O,Gr(O),O):(v=p,(O=ca.get(C))&&(v=m({},p),u4(v,O)),u=u.ownerDocument||u,O=u.createElement("script"),Gr(O),_s(O,"link",v),u.head.appendChild(O),f.instance=O);case"void":return null;default:throw Error(r(443,f.type))}else f.type==="stylesheet"&&(f.state.loading&4)===0&&(v=f.instance,f.state.loading|=4,Dx(v,p.precedence,u));return f.instance}function Dx(u,f,p){for(var v=p.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),O=v.length?v[v.length-1]:null,C=O,q=0;q<v.length;q++){var K=v[q];if(K.dataset.precedence===f)C=K;else if(C!==O)break}C?C.parentNode.insertBefore(u,C.nextSibling):(f=p.nodeType===9?p.head:p,f.insertBefore(u,f.firstChild))}function c4(u,f){u.crossOrigin==null&&(u.crossOrigin=f.crossOrigin),u.referrerPolicy==null&&(u.referrerPolicy=f.referrerPolicy),u.title==null&&(u.title=f.title)}function u4(u,f){u.crossOrigin==null&&(u.crossOrigin=f.crossOrigin),u.referrerPolicy==null&&(u.referrerPolicy=f.referrerPolicy),u.integrity==null&&(u.integrity=f.integrity)}var Px=null;function t9(u,f,p){if(Px===null){var v=new Map,O=Px=new Map;O.set(p,v)}else O=Px,v=O.get(p),v||(v=new Map,O.set(p,v));if(v.has(u))return v;for(v.set(u,null),p=p.getElementsByTagName(u),O=0;O<p.length;O++){var C=p[O];if(!(C[mu]||C[Cr]||u==="link"&&C.getAttribute("rel")==="stylesheet")&&C.namespaceURI!=="http://www.w3.org/2000/svg"){var q=C.getAttribute(f)||"";q=u+q;var K=v.get(q);K?K.push(C):v.set(q,[C])}}return v}function n9(u,f,p){u=u.ownerDocument||u,u.head.insertBefore(p,f==="title"?u.querySelector("head > title"):null)}function rJ(u,f,p){if(p===1||f.itemProp!=null)return!1;switch(u){case"meta":case"title":return!0;case"style":if(typeof f.precedence!="string"||typeof f.href!="string"||f.href==="")break;return!0;case"link":if(typeof f.rel!="string"||typeof f.href!="string"||f.href===""||f.onLoad||f.onError)break;switch(f.rel){case"stylesheet":return u=f.disabled,typeof f.precedence=="string"&&u==null;default:return!0}case"script":if(f.async&&typeof f.async!="function"&&typeof f.async!="symbol"&&!f.onLoad&&!f.onError&&f.src&&typeof f.src=="string")return!0}return!1}function r9(u){return!(u.type==="stylesheet"&&(u.state.loading&3)===0)}function sJ(u,f,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=nh(v.href),C=f.querySelector(Tm(O));if(C){f=C._p,f!==null&&typeof f=="object"&&typeof f.then=="function"&&(u.count++,u=zx.bind(u),f.then(u,u)),p.state.loading|=4,p.instance=C,Gr(C);return}C=f.ownerDocument||f,v=JT(v),(O=ca.get(O))&&c4(v,O),C=C.createElement("link"),Gr(C);var q=C;q._p=new Promise(function(K,ue){q.onload=K,q.onerror=ue}),_s(C,"link",v),p.instance=C}u.stylesheets===null&&(u.stylesheets=new Map),u.stylesheets.set(p,f),(f=p.state.preload)&&(p.state.loading&3)===0&&(u.count++,p=zx.bind(u),f.addEventListener("load",p),f.addEventListener("error",p))}}var d4=0;function iJ(u,f){return u.stylesheets&&u.count===0&&Lx(u,u.stylesheets),0<u.count||0<u.imgCount?function(p){var v=setTimeout(function(){if(u.stylesheets&&Lx(u,u.stylesheets),u.unsuspend){var C=u.unsuspend;u.unsuspend=null,C()}},6e4+f);0<u.imgBytes&&d4===0&&(d4=62500*BZ());var O=setTimeout(function(){if(u.waitingForImages=!1,u.count===0&&(u.stylesheets&&Lx(u,u.stylesheets),u.unsuspend)){var C=u.unsuspend;u.unsuspend=null,C()}},(u.imgBytes>d4?50:800)+f);return u.unsuspend=p,function(){u.unsuspend=null,clearTimeout(v),clearTimeout(O)}}:null}function zx(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Lx(this,this.stylesheets);else if(this.unsuspend){var u=this.unsuspend;this.unsuspend=null,u()}}}var Ix=null;function Lx(u,f){u.stylesheets=null,u.unsuspend!==null&&(u.count++,Ix=new Map,f.forEach(aJ,u),Ix=null,zx.call(u))}function aJ(u,f){if(!(f.state.loading&4)){var p=Ix.get(u);if(p)var v=p.get(null);else{p=new Map,Ix.set(u,p);for(var O=u.querySelectorAll("link[data-precedence],style[data-precedence]"),C=0;C<O.length;C++){var q=O[C];(q.nodeName==="LINK"||q.getAttribute("media")!=="not all")&&(p.set(q.dataset.precedence,q),v=q)}v&&p.set(null,v)}O=f.instance,q=O.getAttribute("data-precedence"),C=p.get(q)||v,C===v&&p.set(null,O),p.set(q,O),this.count++,v=zx.bind(this),O.addEventListener("load",v),O.addEventListener("error",v),C?C.parentNode.insertBefore(O,C.nextSibling):(u=u.nodeType===9?u.head:u,u.insertBefore(O,u.firstChild)),f.state.loading|=4}}var _m={$$typeof:N,Provider:null,Consumer:null,_currentValue:J,_currentValue2:J,_threadCount:0};function oJ(u,f,p,v,O,C,q,K,ue){this.tag=1,this.containerInfo=u,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=In(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=In(0),this.hiddenUpdates=In(null),this.identifierPrefix=v,this.onUncaughtError=O,this.onCaughtError=C,this.onRecoverableError=q,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=ue,this.incompleteTransitions=new Map}function s9(u,f,p,v,O,C,q,K,ue,we,Ee,Re){return u=new oJ(u,f,p,q,ue,we,Ee,Re,K),f=1,C===!0&&(f|=24),C=Mi(3,null,null,f),u.current=C,C.stateNode=u,f=Qw(),f.refCount++,u.pooledCache=f,f.refCount++,C.memoizedState={element:v,isDehydrated:p,cache:f},Gw(C),u}function i9(u){return u?(u=Dd,u):Dd}function a9(u,f,p,v,O,C){O=i9(O),v.context===null?v.context=O:v.pendingContext=O,v=lc(f),v.payload={element:p},C=C===void 0?null:C,C!==null&&(v.callback=C),p=cc(u,v,f),p!==null&&(hi(p,u,f),lm(p,u,f))}function o9(u,f){if(u=u.memoizedState,u!==null&&u.dehydrated!==null){var p=u.retryLane;u.retryLane=p!==0&&p<f?p:f}}function h4(u,f){o9(u,f),(u=u.alternate)&&o9(u,f)}function l9(u){if(u.tag===13||u.tag===31){var f=yu(u,67108864);f!==null&&hi(f,u,67108864),h4(u,67108864)}}function c9(u){if(u.tag===13||u.tag===31){var f=Ii();f=ge(f);var p=yu(u,f);p!==null&&hi(p,u,f),h4(u,f)}}var Bx=!0;function lJ(u,f,p,v){var O=F.T;F.T=null;var C=Y.p;try{Y.p=2,f4(u,f,p,v)}finally{Y.p=C,F.T=O}}function cJ(u,f,p,v){var O=F.T;F.T=null;var C=Y.p;try{Y.p=8,f4(u,f,p,v)}finally{Y.p=C,F.T=O}}function f4(u,f,p,v){if(Bx){var O=m4(v);if(O===null)J2(u,f,v,Fx,p),d9(u,v);else if(dJ(O,u,f,p,v))v.stopPropagation();else if(d9(u,v),f&4&&-1<uJ.indexOf(u)){for(;O!==null;){var C=Yo(O);if(C!==null)switch(C.tag){case 3:if(C=C.stateNode,C.current.memoizedState.isDehydrated){var q=pt(C.pendingLanes);if(q!==0){var K=C;for(K.pendingLanes|=2,K.entangledLanes|=2;q;){var ue=1<<31-Rt(q);K.entanglements[1]|=ue,q&=~ue}co(C),(Hn&6)===0&&(Sx=_t()+500,Om(0))}}break;case 31:case 13:K=yu(C,2),K!==null&&hi(K,C,2),Ox(),h4(C,2)}if(C=m4(v),C===null&&J2(u,f,v,Fx,p),C===O)break;O=C}O!==null&&v.stopPropagation()}else J2(u,f,v,null,p)}}function m4(u){return u=gw(u),p4(u)}var Fx=null;function p4(u){if(Fx=null,u=ec(u),u!==null){var f=i(u);if(f===null)u=null;else{var p=f.tag;if(p===13){if(u=a(f),u!==null)return u;u=null}else if(p===31){if(u=l(f),u!==null)return u;u=null}else if(p===3){if(f.stateNode.current.memoizedState.isDehydrated)return f.tag===3?f.stateNode.containerInfo:null;u=null}else f!==u&&(u=null)}}return Fx=u,null}function u9(u){switch(u){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(mt()){case Ne:return 2;case Ie:return 8;case st:case yt:return 32;case Pt:return 268435456;default:return 32}default:return 32}}var g4=!1,bc=null,wc=null,Sc=null,Am=new Map,Mm=new Map,kc=[],uJ="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function d9(u,f){switch(u){case"focusin":case"focusout":bc=null;break;case"dragenter":case"dragleave":wc=null;break;case"mouseover":case"mouseout":Sc=null;break;case"pointerover":case"pointerout":Am.delete(f.pointerId);break;case"gotpointercapture":case"lostpointercapture":Mm.delete(f.pointerId)}}function Rm(u,f,p,v,O,C){return u===null||u.nativeEvent!==C?(u={blockedOn:f,domEventName:p,eventSystemFlags:v,nativeEvent:C,targetContainers:[O]},f!==null&&(f=Yo(f),f!==null&&l9(f)),u):(u.eventSystemFlags|=v,f=u.targetContainers,O!==null&&f.indexOf(O)===-1&&f.push(O),u)}function dJ(u,f,p,v,O){switch(f){case"focusin":return bc=Rm(bc,u,f,p,v,O),!0;case"dragenter":return wc=Rm(wc,u,f,p,v,O),!0;case"mouseover":return Sc=Rm(Sc,u,f,p,v,O),!0;case"pointerover":var C=O.pointerId;return Am.set(C,Rm(Am.get(C)||null,u,f,p,v,O)),!0;case"gotpointercapture":return C=O.pointerId,Mm.set(C,Rm(Mm.get(C)||null,u,f,p,v,O)),!0}return!1}function h9(u){var f=ec(u.target);if(f!==null){var p=i(f);if(p!==null){if(f=p.tag,f===13){if(f=a(p),f!==null){u.blockedOn=f,vn(u.priority,function(){c9(p)});return}}else if(f===31){if(f=l(p),f!==null){u.blockedOn=f,vn(u.priority,function(){c9(p)});return}}else if(f===3&&p.stateNode.current.memoizedState.isDehydrated){u.blockedOn=p.tag===3?p.stateNode.containerInfo:null;return}}}u.blockedOn=null}function qx(u){if(u.blockedOn!==null)return!1;for(var f=u.targetContainers;0<f.length;){var p=m4(u.nativeEvent);if(p===null){p=u.nativeEvent;var v=new p.constructor(p.type,p);pw=v,p.target.dispatchEvent(v),pw=null}else return f=Yo(p),f!==null&&l9(f),u.blockedOn=p,!1;f.shift()}return!0}function f9(u,f,p){qx(u)&&p.delete(f)}function hJ(){g4=!1,bc!==null&&qx(bc)&&(bc=null),wc!==null&&qx(wc)&&(wc=null),Sc!==null&&qx(Sc)&&(Sc=null),Am.forEach(f9),Mm.forEach(f9)}function $x(u,f){u.blockedOn===f&&(u.blockedOn=null,g4||(g4=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,hJ)))}var Hx=null;function m9(u){Hx!==u&&(Hx=u,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Hx===u&&(Hx=null);for(var f=0;f<u.length;f+=3){var p=u[f],v=u[f+1],O=u[f+2];if(typeof v!="function"){if(p4(v||p)===null)continue;break}var C=Yo(p);C!==null&&(u.splice(f,3),f-=3,m2(C,{pending:!0,data:O,method:p.method,action:v},v,O))}}))}function sh(u){function f(ue){return $x(ue,u)}bc!==null&&$x(bc,u),wc!==null&&$x(wc,u),Sc!==null&&$x(Sc,u),Am.forEach(f),Mm.forEach(f);for(var p=0;p<kc.length;p++){var v=kc[p];v.blockedOn===u&&(v.blockedOn=null)}for(;0<kc.length&&(p=kc[0],p.blockedOn===null);)h9(p),p.blockedOn===null&&kc.shift();if(p=(u.ownerDocument||u).$$reactFormReplay,p!=null)for(v=0;v<p.length;v+=3){var O=p[v],C=p[v+1],q=O[Tr]||null;if(typeof C=="function")q||m9(p);else if(q){var K=null;if(C&&C.hasAttribute("formAction")){if(O=C,q=C[Tr]||null)K=q.formAction;else if(p4(O)!==null)continue}else K=q.action;typeof K=="function"?p[v+1]=K:(p.splice(v,3),v-=3),m9(p)}}}function p9(){function u(C){C.canIntercept&&C.info==="react-transition"&&C.intercept({handler:function(){return new Promise(function(q){return O=q})},focusReset:"manual",scroll:"manual"})}function f(){O!==null&&(O(),O=null),v||setTimeout(p,20)}function p(){if(!v&&!navigation.transition){var C=navigation.currentEntry;C&&C.url!=null&&navigation.navigate(C.url,{state:C.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var v=!1,O=null;return navigation.addEventListener("navigate",u),navigation.addEventListener("navigatesuccess",f),navigation.addEventListener("navigateerror",f),setTimeout(p,100),function(){v=!0,navigation.removeEventListener("navigate",u),navigation.removeEventListener("navigatesuccess",f),navigation.removeEventListener("navigateerror",f),O!==null&&(O(),O=null)}}}function x4(u){this._internalRoot=u}Qx.prototype.render=x4.prototype.render=function(u){var f=this._internalRoot;if(f===null)throw Error(r(409));var p=f.current,v=Ii();a9(p,v,u,f,null,null)},Qx.prototype.unmount=x4.prototype.unmount=function(){var u=this._internalRoot;if(u!==null){this._internalRoot=null;var f=u.containerInfo;a9(u.current,2,null,u,null,null),Ox(),f[Ns]=null}};function Qx(u){this._internalRoot=u}Qx.prototype.unstable_scheduleHydration=function(u){if(u){var f=Ct();u={blockedOn:null,target:u,priority:f};for(var p=0;p<kc.length&&f!==0&&f<kc[p].priority;p++);kc.splice(p,0,u),p===0&&h9(u)}};var g9=e.version;if(g9!=="19.2.0")throw Error(r(527,g9,"19.2.0"));Y.findDOMNode=function(u){var f=u._reactInternals;if(f===void 0)throw typeof u.render=="function"?Error(r(188)):(u=Object.keys(u).join(","),Error(r(268,u)));return u=d(f),u=u!==null?h(u):null,u=u===null?null:u.stateNode,u};var fJ={bundleType:0,version:"19.2.0",rendererPackageName:"react-dom",currentDispatcherRef:F,reconcilerVersion:"19.2.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Vx=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Vx.isDisabled&&Vx.supportsFiber)try{Fe=Vx.inject(fJ),rt=Vx}catch{}}return Pm.createRoot=function(u,f){if(!s(u))throw Error(r(299));var p=!1,v="",O=k8,C=O8,q=j8;return f!=null&&(f.unstable_strictMode===!0&&(p=!0),f.identifierPrefix!==void 0&&(v=f.identifierPrefix),f.onUncaughtError!==void 0&&(O=f.onUncaughtError),f.onCaughtError!==void 0&&(C=f.onCaughtError),f.onRecoverableError!==void 0&&(q=f.onRecoverableError)),f=s9(u,1,!1,null,null,p,v,null,O,C,q,p9),u[Ns]=f.current,Z2(u),new x4(f)},Pm.hydrateRoot=function(u,f,p){if(!s(u))throw Error(r(299));var v=!1,O="",C=k8,q=O8,K=j8,ue=null;return p!=null&&(p.unstable_strictMode===!0&&(v=!0),p.identifierPrefix!==void 0&&(O=p.identifierPrefix),p.onUncaughtError!==void 0&&(C=p.onUncaughtError),p.onCaughtError!==void 0&&(q=p.onCaughtError),p.onRecoverableError!==void 0&&(K=p.onRecoverableError),p.formState!==void 0&&(ue=p.formState)),f=s9(u,1,!0,f,p??null,v,O,ue,C,q,K,p9),f.context=i9(null),p=f.current,v=Ii(),v=ge(v),O=lc(v),O.callback=null,cc(p,O,v),p=v,f.current.lanes=p,cr(f,p),co(f),u[Ns]=f.current,Z2(u),new Qx(f)},Pm.version="19.2.0",Pm}var T9;function vte(){if(T9)return b4.exports;T9=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),b4.exports=xte(),b4.exports}var yte=vte();function NI(t,e){return function(){return t.apply(e,arguments)}}const{toString:bte}=Object.prototype,{getPrototypeOf:Rj}=Object,{iterator:Xy,toStringTag:CI}=Symbol,Yy=(t=>e=>{const n=bte.call(e);return t[n]||(t[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),eo=t=>(t=t.toLowerCase(),e=>Yy(e)===t),Ky=t=>e=>typeof e===t,{isArray:yf}=Array,Xh=Ky("undefined");function Rp(t){return t!==null&&!Xh(t)&&t.constructor!==null&&!Xh(t.constructor)&&wi(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const TI=eo("ArrayBuffer");function wte(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&TI(t.buffer),e}const Ste=Ky("string"),wi=Ky("function"),EI=Ky("number"),Dp=t=>t!==null&&typeof t=="object",kte=t=>t===!0||t===!1,ev=t=>{if(Yy(t)!=="object")return!1;const e=Rj(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(CI in t)&&!(Xy in t)},Ote=t=>{if(!Dp(t)||Rp(t))return!1;try{return Object.keys(t).length===0&&Object.getPrototypeOf(t)===Object.prototype}catch{return!1}},jte=eo("Date"),Nte=eo("File"),Cte=eo("Blob"),Tte=eo("FileList"),Ete=t=>Dp(t)&&wi(t.pipe),_te=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||wi(t.append)&&((e=Yy(t))==="formdata"||e==="object"&&wi(t.toString)&&t.toString()==="[object FormData]"))},Ate=eo("URLSearchParams"),[Mte,Rte,Dte,Pte]=["ReadableStream","Request","Response","Headers"].map(eo),zte=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Pp(t,e,{allOwnKeys:n=!1}={}){if(t===null||typeof t>"u")return;let r,s;if(typeof t!="object"&&(t=[t]),yf(t))for(r=0,s=t.length;r<s;r++)e.call(null,t[r],r,t);else{if(Rp(t))return;const i=n?Object.getOwnPropertyNames(t):Object.keys(t),a=i.length;let l;for(r=0;r<a;r++)l=i[r],e.call(null,t[l],l,t)}}function _I(t,e){if(Rp(t))return null;e=e.toLowerCase();const n=Object.keys(t);let r=n.length,s;for(;r-- >0;)if(s=n[r],e===s.toLowerCase())return s;return null}const $u=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,AI=t=>!Xh(t)&&t!==$u;function ak(){const{caseless:t,skipUndefined:e}=AI(this)&&this||{},n={},r=(s,i)=>{const a=t&&_I(n,i)||i;ev(n[a])&&ev(s)?n[a]=ak(n[a],s):ev(s)?n[a]=ak({},s):yf(s)?n[a]=s.slice():(!e||!Xh(s))&&(n[a]=s)};for(let s=0,i=arguments.length;s<i;s++)arguments[s]&&Pp(arguments[s],r);return n}const Ite=(t,e,n,{allOwnKeys:r}={})=>(Pp(e,(s,i)=>{n&&wi(s)?t[i]=NI(s,n):t[i]=s},{allOwnKeys:r}),t),Lte=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),Bte=(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)},Fte=(t,e,n,r)=>{let s,i,a;const l={};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))&&!l[a]&&(e[a]=t[a],l[a]=!0);t=n!==!1&&Rj(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},qte=(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},$te=t=>{if(!t)return null;if(yf(t))return t;let e=t.length;if(!EI(e))return null;const n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},Hte=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&Rj(Uint8Array)),Qte=(t,e)=>{const r=(t&&t[Xy]).call(t);let s;for(;(s=r.next())&&!s.done;){const i=s.value;e.call(t,i[0],i[1])}},Vte=(t,e)=>{let n;const r=[];for(;(n=t.exec(e))!==null;)r.push(n);return r},Ute=eo("HTMLFormElement"),Wte=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),E9=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),Gte=eo("RegExp"),MI=(t,e)=>{const n=Object.getOwnPropertyDescriptors(t),r={};Pp(n,(s,i)=>{let a;(a=e(s,i,t))!==!1&&(r[i]=a||s)}),Object.defineProperties(t,r)},Xte=t=>{MI(t,(e,n)=>{if(wi(t)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=t[n];if(wi(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+"'")})}})},Yte=(t,e)=>{const n={},r=s=>{s.forEach(i=>{n[i]=!0})};return yf(t)?r(t):r(String(t).split(e)),n},Kte=()=>{},Zte=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function Jte(t){return!!(t&&wi(t.append)&&t[CI]==="FormData"&&t[Xy])}const ene=t=>{const e=new Array(10),n=(r,s)=>{if(Dp(r)){if(e.indexOf(r)>=0)return;if(Rp(r))return r;if(!("toJSON"in r)){e[s]=r;const i=yf(r)?[]:{};return Pp(r,(a,l)=>{const c=n(a,s+1);!Xh(c)&&(i[l]=c)}),e[s]=void 0,i}}return r};return n(t,0)},tne=eo("AsyncFunction"),nne=t=>t&&(Dp(t)||wi(t))&&wi(t.then)&&wi(t.catch),RI=((t,e)=>t?setImmediate:e?((n,r)=>($u.addEventListener("message",({source:s,data:i})=>{s===$u&&i===n&&r.length&&r.shift()()},!1),s=>{r.push(s),$u.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",wi($u.postMessage)),rne=typeof queueMicrotask<"u"?queueMicrotask.bind($u):typeof process<"u"&&process.nextTick||RI,sne=t=>t!=null&&wi(t[Xy]),je={isArray:yf,isArrayBuffer:TI,isBuffer:Rp,isFormData:_te,isArrayBufferView:wte,isString:Ste,isNumber:EI,isBoolean:kte,isObject:Dp,isPlainObject:ev,isEmptyObject:Ote,isReadableStream:Mte,isRequest:Rte,isResponse:Dte,isHeaders:Pte,isUndefined:Xh,isDate:jte,isFile:Nte,isBlob:Cte,isRegExp:Gte,isFunction:wi,isStream:Ete,isURLSearchParams:Ate,isTypedArray:Hte,isFileList:Tte,forEach:Pp,merge:ak,extend:Ite,trim:zte,stripBOM:Lte,inherits:Bte,toFlatObject:Fte,kindOf:Yy,kindOfTest:eo,endsWith:qte,toArray:$te,forEachEntry:Qte,matchAll:Vte,isHTMLForm:Ute,hasOwnProperty:E9,hasOwnProp:E9,reduceDescriptors:MI,freezeMethods:Xte,toObjectSet:Yte,toCamelCase:Wte,noop:Kte,toFiniteNumber:Zte,findKey:_I,global:$u,isContextDefined:AI,isSpecCompliantForm:Jte,toJSONObject:ene,isAsyncFn:tne,isThenable:nne,setImmediate:RI,asap:rne,isIterable:sne};function Xt(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(Xt,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 DI=Xt.prototype,PI={};["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=>{PI[t]={value:t}});Object.defineProperties(Xt,PI);Object.defineProperty(DI,"isAxiosError",{value:!0});Xt.from=(t,e,n,r,s,i)=>{const a=Object.create(DI);je.toFlatObject(t,a,function(h){return h!==Error.prototype},d=>d!=="isAxiosError");const l=t&&t.message?t.message:"Error",c=e==null&&t?t.code:e;return Xt.call(a,l,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 ine=null;function ok(t){return je.isPlainObject(t)||je.isArray(t)}function zI(t){return je.endsWith(t,"[]")?t.slice(0,-2):t}function _9(t,e,n){return t?t.concat(e).map(function(s,i){return s=zI(s),!n&&i?"["+s+"]":s}).join(n?".":""):e}function ane(t){return je.isArray(t)&&!t.some(ok)}const one=je.toFlatObject(je,{},null,function(e){return/^is[A-Z]/.test(e)});function Zy(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||h,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 d(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 Xt("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 h(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)&&ane(y)||(je.isFileList(y)||je.endsWith(w,"[]"))&&(k=je.toArray(y)))return w=zI(w),k.forEach(function(N,T){!(je.isUndefined(N)||N===null)&&e.append(a===!0?_9([w],T,i):a===null?w:w+"[]",d(N))}),!1}return ok(y)?!0:(e.append(_9(S,w,i),d(y)),!1)}const m=[],g=Object.assign(one,{defaultVisitor:h,convertValue:d,isVisitable:ok});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,j){(!(je.isUndefined(k)||k===null)&&s.call(e,k,je.isString(j)?j.trim():j,w,g))===!0&&x(k,w?w.concat(j):[j])}),m.pop()}}if(!je.isObject(t))throw new TypeError("data must be an object");return x(t),e}function A9(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(r){return e[r]})}function Dj(t,e){this._pairs=[],t&&Zy(t,this,e)}const II=Dj.prototype;II.append=function(e,n){this._pairs.push([e,n])};II.toString=function(e){const n=e?function(r){return e.call(this,r,A9)}:A9;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function lne(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function LI(t,e,n){if(!e)return t;const r=n&&n.encode||lne;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 Dj(e,n).toString(r),i){const a=t.indexOf("#");a!==-1&&(t=t.slice(0,a)),t+=(t.indexOf("?")===-1?"?":"&")+i}return t}class M9{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 BI={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},cne=typeof URLSearchParams<"u"?URLSearchParams:Dj,une=typeof FormData<"u"?FormData:null,dne=typeof Blob<"u"?Blob:null,hne={isBrowser:!0,classes:{URLSearchParams:cne,FormData:une,Blob:dne},protocols:["http","https","file","blob","url","data"]},Pj=typeof window<"u"&&typeof document<"u",lk=typeof navigator=="object"&&navigator||void 0,fne=Pj&&(!lk||["ReactNative","NativeScript","NS"].indexOf(lk.product)<0),mne=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",pne=Pj&&window.location.href||"http://localhost",gne=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Pj,hasStandardBrowserEnv:fne,hasStandardBrowserWebWorkerEnv:mne,navigator:lk,origin:pne},Symbol.toStringTag,{value:"Module"})),Hs={...gne,...hne};function xne(t,e){return Zy(t,new Hs.classes.URLSearchParams,{visitor:function(n,r,s,i){return Hs.isNode&&je.isBuffer(n)?(this.append(r,n.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...e})}function vne(t){return je.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function yne(t){const e={},n=Object.keys(t);let r;const s=n.length;let i;for(r=0;r<s;r++)i=n[r],e[i]=t[i];return e}function FI(t){function e(n,r,s,i){let a=n[i++];if(a==="__proto__")return!0;const l=Number.isFinite(+a),c=i>=n.length;return a=!a&&je.isArray(s)?s.length:a,c?(je.hasOwnProp(s,a)?s[a]=[s[a],r]:s[a]=r,!l):((!s[a]||!je.isObject(s[a]))&&(s[a]=[]),e(n,r,s[a],i)&&je.isArray(s[a])&&(s[a]=yne(s[a])),!l)}if(je.isFormData(t)&&je.isFunction(t.entries)){const n={};return je.forEachEntry(t,(r,s)=>{e(vne(r),s,n,0)}),n}return null}function bne(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 zp={transitional:BI,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(FI(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 l;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return xne(e,this.formSerializer).toString();if((l=je.isFileList(e))||r.indexOf("multipart/form-data")>-1){const c=this.env&&this.env.FormData;return Zy(l?{"files[]":e}:e,c&&new c,this.formSerializer)}}return i||s?(n.setContentType("application/json",!1),bne(e)):e}],transformResponse:[function(e){const n=this.transitional||zp.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(l){if(a)throw l.name==="SyntaxError"?Xt.from(l,Xt.ERR_BAD_RESPONSE,this,null,this.response):l}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Hs.classes.FormData,Blob:Hs.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=>{zp.headers[t]={}});const wne=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"]),Sne=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]&&wne[n])&&(n==="set-cookie"?e[n]?e[n].push(r):e[n]=[r]:e[n]=e[n]?e[n]+", "+r:r)}),e},R9=Symbol("internals");function zm(t){return t&&String(t).trim().toLowerCase()}function tv(t){return t===!1||t==null?t:je.isArray(t)?t.map(tv):String(t)}function kne(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 One=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function k4(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 jne(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,n,r)=>n.toUpperCase()+r)}function Nne(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 Si=class{constructor(e){e&&this.set(e)}set(e,n,r){const s=this;function i(l,c,d){const h=zm(c);if(!h)throw new Error("header name must be a non-empty string");const m=je.findKey(s,h);(!m||s[m]===void 0||d===!0||d===void 0&&s[m]!==!1)&&(s[m||c]=tv(l))}const a=(l,c)=>je.forEach(l,(d,h)=>i(d,h,c));if(je.isPlainObject(e)||e instanceof this.constructor)a(e,n);else if(je.isString(e)&&(e=e.trim())&&!One(e))a(Sne(e),n);else if(je.isObject(e)&&je.isIterable(e)){let l={},c,d;for(const h of e){if(!je.isArray(h))throw TypeError("Object iterator must return a key-value pair");l[d=h[0]]=(c=l[d])?je.isArray(c)?[...c,h[1]]:[c,h[1]]:h[1]}a(l,n)}else e!=null&&i(n,e,r);return this}get(e,n){if(e=zm(e),e){const r=je.findKey(this,e);if(r){const s=this[r];if(!n)return s;if(n===!0)return kne(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=zm(e),e){const r=je.findKey(this,e);return!!(r&&this[r]!==void 0&&(!n||k4(this,this[r],r,n)))}return!1}delete(e,n){const r=this;let s=!1;function i(a){if(a=zm(a),a){const l=je.findKey(r,a);l&&(!n||k4(r,r[l],l,n))&&(delete r[l],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||k4(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]=tv(s),delete n[i];return}const l=e?jne(i):String(i).trim();l!==i&&delete n[i],n[l]=tv(s),r[l]=!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[R9]=this[R9]={accessors:{}}).accessors,s=this.prototype;function i(a){const l=zm(a);r[l]||(Nne(s,a),r[l]=!0)}return je.isArray(e)?e.forEach(i):i(e),this}};Si.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);je.reduceDescriptors(Si.prototype,({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(r){this[n]=r}}});je.freezeMethods(Si);function O4(t,e){const n=this||zp,r=e||n,s=Si.from(r.headers);let i=r.data;return je.forEach(t,function(l){i=l.call(n,i,s.normalize(),e?e.status:void 0)}),s.normalize(),i}function qI(t){return!!(t&&t.__CANCEL__)}function bf(t,e,n){Xt.call(this,t??"canceled",Xt.ERR_CANCELED,e,n),this.name="CanceledError"}je.inherits(bf,Xt,{__CANCEL__:!0});function $I(t,e,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?t(n):e(new Xt("Request failed with status code "+n.status,[Xt.ERR_BAD_REQUEST,Xt.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function Cne(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function Tne(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 d=Date.now(),h=r[i];a||(a=d),n[s]=c,r[s]=d;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),d-a<e)return;const x=h&&d-h;return x?Math.round(g*1e3/x):void 0}}function Ene(t,e){let n=0,r=1e3/e,s,i;const a=(d,h=Date.now())=>{n=h,s=null,i&&(clearTimeout(i),i=null),t(...d)};return[(...d)=>{const h=Date.now(),m=h-n;m>=r?a(d,h):(s=d,i||(i=setTimeout(()=>{i=null,a(s)},r-m)))},()=>s&&a(s)]}const zv=(t,e,n=3)=>{let r=0;const s=Tne(50,250);return Ene(i=>{const a=i.loaded,l=i.lengthComputable?i.total:void 0,c=a-r,d=s(c),h=a<=l;r=a;const m={loaded:a,total:l,progress:l?a/l:void 0,bytes:c,rate:d||void 0,estimated:d&&l&&h?(l-a)/d:void 0,event:i,lengthComputable:l!=null,[e?"download":"upload"]:!0};t(m)},n)},D9=(t,e)=>{const n=t!=null;return[r=>e[0]({lengthComputable:n,total:t,loaded:r}),e[1]]},P9=t=>(...e)=>je.asap(()=>t(...e)),_ne=Hs.hasStandardBrowserEnv?((t,e)=>n=>(n=new URL(n,Hs.origin),t.protocol===n.protocol&&t.host===n.host&&(e||t.port===n.port)))(new URL(Hs.origin),Hs.navigator&&/(msie|trident)/i.test(Hs.navigator.userAgent)):()=>!0,Ane=Hs.hasStandardBrowserEnv?{write(t,e,n,r,s,i,a){if(typeof document>"u")return;const l=[`${t}=${encodeURIComponent(e)}`];je.isNumber(n)&&l.push(`expires=${new Date(n).toUTCString()}`),je.isString(r)&&l.push(`path=${r}`),je.isString(s)&&l.push(`domain=${s}`),i===!0&&l.push("secure"),je.isString(a)&&l.push(`SameSite=${a}`),document.cookie=l.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 Mne(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function Rne(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function HI(t,e,n){let r=!Mne(e);return t&&(r||n==!1)?Rne(t,e):e}const z9=t=>t instanceof Si?{...t}:t;function rd(t,e){e=e||{};const n={};function r(d,h,m,g){return je.isPlainObject(d)&&je.isPlainObject(h)?je.merge.call({caseless:g},d,h):je.isPlainObject(h)?je.merge({},h):je.isArray(h)?h.slice():h}function s(d,h,m,g){if(je.isUndefined(h)){if(!je.isUndefined(d))return r(void 0,d,m,g)}else return r(d,h,m,g)}function i(d,h){if(!je.isUndefined(h))return r(void 0,h)}function a(d,h){if(je.isUndefined(h)){if(!je.isUndefined(d))return r(void 0,d)}else return r(void 0,h)}function l(d,h,m){if(m in e)return r(d,h);if(m in t)return r(void 0,d)}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:l,headers:(d,h,m)=>s(z9(d),z9(h),m,!0)};return je.forEach(Object.keys({...t,...e}),function(h){const m=c[h]||s,g=m(t[h],e[h],h);je.isUndefined(g)&&m!==l||(n[h]=g)}),n}const QI=t=>{const e=rd({},t);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:i,headers:a,auth:l}=e;if(e.headers=a=Si.from(a),e.url=LI(HI(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),l&&a.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):""))),je.isFormData(n)){if(Hs.hasStandardBrowserEnv||Hs.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if(je.isFunction(n.getHeaders)){const c=n.getHeaders(),d=["content-type","content-length"];Object.entries(c).forEach(([h,m])=>{d.includes(h.toLowerCase())&&a.set(h,m)})}}if(Hs.hasStandardBrowserEnv&&(r&&je.isFunction(r)&&(r=r(e)),r||r!==!1&&_ne(e.url))){const c=s&&i&&Ane.read(i);c&&a.set(s,c)}return e},Dne=typeof XMLHttpRequest<"u",Pne=Dne&&function(t){return new Promise(function(n,r){const s=QI(t);let i=s.data;const a=Si.from(s.headers).normalize();let{responseType:l,onUploadProgress:c,onDownloadProgress:d}=s,h,m,g,x,y;function w(){x&&x(),y&&y(),s.cancelToken&&s.cancelToken.unsubscribe(h),s.signal&&s.signal.removeEventListener("abort",h)}let S=new XMLHttpRequest;S.open(s.method.toUpperCase(),s.url,!0),S.timeout=s.timeout;function k(){if(!S)return;const N=Si.from("getAllResponseHeaders"in S&&S.getAllResponseHeaders()),E={data:!l||l==="text"||l==="json"?S.responseText:S.response,status:S.status,statusText:S.statusText,headers:N,config:t,request:S};$I(function(A){n(A),w()},function(A){r(A),w()},E),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 Xt("Request aborted",Xt.ECONNABORTED,t,S)),S=null)},S.onerror=function(T){const E=T&&T.message?T.message:"Network Error",_=new Xt(E,Xt.ERR_NETWORK,t,S);_.event=T||null,r(_),S=null},S.ontimeout=function(){let T=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const E=s.transitional||BI;s.timeoutErrorMessage&&(T=s.timeoutErrorMessage),r(new Xt(T,E.clarifyTimeoutError?Xt.ETIMEDOUT:Xt.ECONNABORTED,t,S)),S=null},i===void 0&&a.setContentType(null),"setRequestHeader"in S&&je.forEach(a.toJSON(),function(T,E){S.setRequestHeader(E,T)}),je.isUndefined(s.withCredentials)||(S.withCredentials=!!s.withCredentials),l&&l!=="json"&&(S.responseType=s.responseType),d&&([g,y]=zv(d,!0),S.addEventListener("progress",g)),c&&S.upload&&([m,x]=zv(c),S.upload.addEventListener("progress",m),S.upload.addEventListener("loadend",x)),(s.cancelToken||s.signal)&&(h=N=>{S&&(r(!N||N.type?new bf(null,t,S):N),S.abort(),S=null)},s.cancelToken&&s.cancelToken.subscribe(h),s.signal&&(s.signal.aborted?h():s.signal.addEventListener("abort",h)));const j=Cne(s.url);if(j&&Hs.protocols.indexOf(j)===-1){r(new Xt("Unsupported protocol "+j+":",Xt.ERR_BAD_REQUEST,t));return}S.send(i||null)})},zne=(t,e)=>{const{length:n}=t=t?t.filter(Boolean):[];if(e||n){let r=new AbortController,s;const i=function(d){if(!s){s=!0,l();const h=d instanceof Error?d:this.reason;r.abort(h instanceof Xt?h:new bf(h instanceof Error?h.message:h))}};let a=e&&setTimeout(()=>{a=null,i(new Xt(`timeout ${e} of ms exceeded`,Xt.ETIMEDOUT))},e);const l=()=>{t&&(a&&clearTimeout(a),a=null,t.forEach(d=>{d.unsubscribe?d.unsubscribe(i):d.removeEventListener("abort",i)}),t=null)};t.forEach(d=>d.addEventListener("abort",i));const{signal:c}=r;return c.unsubscribe=()=>je.asap(l),c}},Ine=function*(t,e){let n=t.byteLength;if(n<e){yield t;return}let r=0,s;for(;r<n;)s=r+e,yield t.slice(r,s),r=s},Lne=async function*(t,e){for await(const n of Bne(t))yield*Ine(n,e)},Bne=async function*(t){if(t[Symbol.asyncIterator]){yield*t;return}const e=t.getReader();try{for(;;){const{done:n,value:r}=await e.read();if(n)break;yield r}}finally{await e.cancel()}},I9=(t,e,n,r)=>{const s=Lne(t,e);let i=0,a,l=c=>{a||(a=!0,r&&r(c))};return new ReadableStream({async pull(c){try{const{done:d,value:h}=await s.next();if(d){l(),c.close();return}let m=h.byteLength;if(n){let g=i+=m;n(g)}c.enqueue(new Uint8Array(h))}catch(d){throw l(d),d}},cancel(c){return l(c),s.return()}},{highWaterMark:2})},L9=64*1024,{isFunction:Xx}=je,Fne=(({Request:t,Response:e})=>({Request:t,Response:e}))(je.global),{ReadableStream:B9,TextEncoder:F9}=je.global,q9=(t,...e)=>{try{return!!t(...e)}catch{return!1}},qne=t=>{t=je.merge.call({skipUndefined:!0},Fne,t);const{fetch:e,Request:n,Response:r}=t,s=e?Xx(e):typeof fetch=="function",i=Xx(n),a=Xx(r);if(!s)return!1;const l=s&&Xx(B9),c=s&&(typeof F9=="function"?(y=>w=>y.encode(w))(new F9):async y=>new Uint8Array(await new n(y).arrayBuffer())),d=i&&l&&q9(()=>{let y=!1;const w=new n(Hs.origin,{body:new B9,method:"POST",get duplex(){return y=!0,"half"}}).headers.has("Content-Type");return y&&!w}),h=a&&l&&q9(()=>je.isReadableStream(new r("").body)),m={stream:h&&(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 Xt(`Response type '${y}' is not supported`,Xt.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(Hs.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:j,cancelToken:N,timeout:T,onDownloadProgress:E,onUploadProgress:_,responseType:A,headers:L,withCredentials:P="same-origin",fetchOptions:B}=QI(y),$=e||fetch;A=A?(A+"").toLowerCase():"text";let U=zne([j,N&&N.toAbortSignal()],T),te=null;const z=U&&U.unsubscribe&&(()=>{U.unsubscribe()});let Q;try{if(_&&d&&S!=="get"&&S!=="head"&&(Q=await x(L,k))!==0){let ie=new n(w,{method:"POST",body:k,duplex:"half"}),G;if(je.isFormData(k)&&(G=ie.headers.get("content-type"))&&L.setContentType(G),ie.body){const[I,V]=D9(Q,zv(P9(_)));k=I9(ie.body,L9,I,V)}}je.isString(P)||(P=P?"include":"omit");const F=i&&"credentials"in n.prototype,Y={...B,signal:U,method:S.toUpperCase(),headers:L.normalize().toJSON(),body:k,duplex:"half",credentials:F?P:void 0};te=i&&new n(w,Y);let J=await(i?$(te,B):$(w,Y));const X=h&&(A==="stream"||A==="response");if(h&&(E||X&&z)){const ie={};["status","statusText","headers"].forEach(ee=>{ie[ee]=J[ee]});const G=je.toFiniteNumber(J.headers.get("content-length")),[I,V]=E&&D9(G,zv(P9(E),!0))||[];J=new r(I9(J.body,L9,I,()=>{V&&V(),z&&z()}),ie)}A=A||"text";let R=await m[je.findKey(m,A)||"text"](J,y);return!X&&z&&z(),await new Promise((ie,G)=>{$I(ie,G,{data:R,headers:Si.from(J.headers),status:J.status,statusText:J.statusText,config:y,request:te})})}catch(F){throw z&&z(),F&&F.name==="TypeError"&&/Load failed|fetch/i.test(F.message)?Object.assign(new Xt("Network Error",Xt.ERR_NETWORK,y,te),{cause:F.cause||F}):Xt.from(F,F&&F.code,y,te)}}},$ne=new Map,VI=t=>{let e=t&&t.env||{};const{fetch:n,Request:r,Response:s}=e,i=[r,s,n];let a=i.length,l=a,c,d,h=$ne;for(;l--;)c=i[l],d=h.get(c),d===void 0&&h.set(c,d=l?new Map:qne(e)),h=d;return d};VI();const zj={http:ine,xhr:Pne,fetch:{get:VI}};je.forEach(zj,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const $9=t=>`- ${t}`,Hne=t=>je.isFunction(t)||t===null||t===!1;function Qne(t,e){t=je.isArray(t)?t:[t];const{length:n}=t;let r,s;const i={};for(let a=0;a<n;a++){r=t[a];let l;if(s=r,!Hne(r)&&(s=zj[(l=String(r)).toLowerCase()],s===void 0))throw new Xt(`Unknown adapter '${l}'`);if(s&&(je.isFunction(s)||(s=s.get(e))))break;i[l||"#"+a]=s}if(!s){const a=Object.entries(i).map(([c,d])=>`adapter ${c} `+(d===!1?"is not supported by the environment":"is not available in the build"));let l=n?a.length>1?`since :
`+a.map($9).join(`
`):" "+$9(a[0]):"as no adapter specified";throw new Xt("There is no suitable adapter to dispatch the request "+l,"ERR_NOT_SUPPORT")}return s}const UI={getAdapter:Qne,adapters:zj};function j4(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new bf(null,t)}function H9(t){return j4(t),t.headers=Si.from(t.headers),t.data=O4.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),UI.getAdapter(t.adapter||zp.adapter,t)(t).then(function(r){return j4(t),r.data=O4.call(t,t.transformResponse,r),r.headers=Si.from(r.headers),r},function(r){return qI(r)||(j4(t),r&&r.response&&(r.response.data=O4.call(t,t.transformResponse,r.response),r.response.headers=Si.from(r.response.headers))),Promise.reject(r)})}const WI="1.13.2",Jy={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{Jy[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}});const Q9={};Jy.transitional=function(e,n,r){function s(i,a){return"[Axios v"+WI+"] Transitional option '"+i+"'"+a+(r?". "+r:"")}return(i,a,l)=>{if(e===!1)throw new Xt(s(a," has been removed"+(n?" in "+n:"")),Xt.ERR_DEPRECATED);return n&&!Q9[a]&&(Q9[a]=!0,console.warn(s(a," has been deprecated since v"+n+" and will be removed in the near future"))),e?e(i,a,l):!0}};Jy.spelling=function(e){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};function Vne(t,e,n){if(typeof t!="object")throw new Xt("options must be an object",Xt.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 l=t[i],c=l===void 0||a(l,i,t);if(c!==!0)throw new Xt("option "+i+" must be "+c,Xt.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new Xt("Unknown option "+i,Xt.ERR_BAD_OPTION)}}const nv={assertOptions:Vne,validators:Jy},uo=nv.validators;let Zu=class{constructor(e){this.defaults=e||{},this.interceptors={request:new M9,response:new M9}}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=rd(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:i}=n;r!==void 0&&nv.assertOptions(r,{silentJSONParsing:uo.transitional(uo.boolean),forcedJSONParsing:uo.transitional(uo.boolean),clarifyTimeoutError:uo.transitional(uo.boolean)},!1),s!=null&&(je.isFunction(s)?n.paramsSerializer={serialize:s}:nv.assertOptions(s,{encode:uo.function,serialize:uo.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),nv.assertOptions(n,{baseUrl:uo.spelling("baseURL"),withXsrfToken:uo.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=Si.concat(a,i);const l=[];let c=!0;this.interceptors.request.forEach(function(w){typeof w.runWhen=="function"&&w.runWhen(n)===!1||(c=c&&w.synchronous,l.unshift(w.fulfilled,w.rejected))});const d=[];this.interceptors.response.forEach(function(w){d.push(w.fulfilled,w.rejected)});let h,m=0,g;if(!c){const y=[H9.bind(this),void 0];for(y.unshift(...l),y.push(...d),g=y.length,h=Promise.resolve(n);m<g;)h=h.then(y[m++],y[m++]);return h}g=l.length;let x=n;for(;m<g;){const y=l[m++],w=l[m++];try{x=y(x)}catch(S){w.call(this,S);break}}try{h=H9.call(this,x)}catch(y){return Promise.reject(y)}for(m=0,g=d.length;m<g;)h=h.then(d[m++],d[m++]);return h}getUri(e){e=rd(this.defaults,e);const n=HI(e.baseURL,e.url,e.allowAbsoluteUrls);return LI(n,e.params,e.paramsSerializer)}};je.forEach(["delete","get","head","options"],function(e){Zu.prototype[e]=function(n,r){return this.request(rd(r||{},{method:e,url:n,data:(r||{}).data}))}});je.forEach(["post","put","patch"],function(e){function n(r){return function(i,a,l){return this.request(rd(l||{},{method:e,headers:r?{"Content-Type":"multipart/form-data"}:{},url:i,data:a}))}}Zu.prototype[e]=n(),Zu.prototype[e+"Form"]=n(!0)});let Une=class GI{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(i){n=i});const r=this;this.promise.then(s=>{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(l=>{r.subscribe(l),i=l}).then(s);return a.cancel=function(){r.unsubscribe(i)},a},e(function(i,a,l){r.reason||(r.reason=new bf(i,a,l),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 GI(function(s){e=s}),cancel:e}}};function Wne(t){return function(n){return t.apply(null,n)}}function Gne(t){return je.isObject(t)&&t.isAxiosError===!0}const ck={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(ck).forEach(([t,e])=>{ck[e]=t});function XI(t){const e=new Zu(t),n=NI(Zu.prototype.request,e);return je.extend(n,Zu.prototype,e,{allOwnKeys:!0}),je.extend(n,e,null,{allOwnKeys:!0}),n.create=function(s){return XI(rd(t,s))},n}const Br=XI(zp);Br.Axios=Zu;Br.CanceledError=bf;Br.CancelToken=Une;Br.isCancel=qI;Br.VERSION=WI;Br.toFormData=Zy;Br.AxiosError=Xt;Br.Cancel=Br.CanceledError;Br.all=function(e){return Promise.all(e)};Br.spread=Wne;Br.isAxiosError=Gne;Br.mergeConfig=rd;Br.AxiosHeaders=Si;Br.formToJSON=t=>FI(je.isHTMLForm(t)?new FormData(t):t);Br.getAdapter=UI.getAdapter;Br.HttpStatusCode=ck;Br.default=Br;const{Axios:nPe,AxiosError:rPe,CanceledError:sPe,isCancel:iPe,CancelToken:aPe,VERSION:oPe,all:lPe,Cancel:cPe,isAxiosError:uPe,spread:dPe,toFormData:hPe,AxiosHeaders:fPe,HttpStatusCode:mPe,formToJSON:pPe,getAdapter:gPe,mergeConfig:xPe}=Br,Xne=(t,e)=>{const n=new Array(t.length+e.length);for(let r=0;r<t.length;r++)n[r]=t[r];for(let r=0;r<e.length;r++)n[t.length+r]=e[r];return n},Yne=(t,e)=>({classGroupId:t,validator:e}),YI=(t=new Map,e=null,n)=>({nextPart:t,validators:e,classGroupId:n}),Iv="-",V9=[],Kne="arbitrary..",Zne=t=>{const e=ere(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:a=>{if(a.startsWith("[")&&a.endsWith("]"))return Jne(a);const l=a.split(Iv),c=l[0]===""&&l.length>1?1:0;return KI(l,c,e)},getConflictingClassGroupIds:(a,l)=>{if(l){const c=r[a],d=n[a];return c?d?Xne(d,c):c:d||V9}return n[a]||V9}}},KI=(t,e,n)=>{if(t.length-e===0)return n.classGroupId;const s=t[e],i=n.nextPart.get(s);if(i){const d=KI(t,e+1,i);if(d)return d}const a=n.validators;if(a===null)return;const l=e===0?t.join(Iv):t.slice(e).join(Iv),c=a.length;for(let d=0;d<c;d++){const h=a[d];if(h.validator(l))return h.classGroupId}},Jne=t=>t.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=t.slice(1,-1),n=e.indexOf(":"),r=e.slice(0,n);return r?Kne+r:void 0})(),ere=t=>{const{theme:e,classGroups:n}=t;return tre(n,e)},tre=(t,e)=>{const n=YI();for(const r in t){const s=t[r];Ij(s,n,r,e)}return n},Ij=(t,e,n,r)=>{const s=t.length;for(let i=0;i<s;i++){const a=t[i];nre(a,e,n,r)}},nre=(t,e,n,r)=>{if(typeof t=="string"){rre(t,e,n);return}if(typeof t=="function"){sre(t,e,n,r);return}ire(t,e,n,r)},rre=(t,e,n)=>{const r=t===""?e:ZI(e,t);r.classGroupId=n},sre=(t,e,n,r)=>{if(are(t)){Ij(t(r),e,n,r);return}e.validators===null&&(e.validators=[]),e.validators.push(Yne(n,t))},ire=(t,e,n,r)=>{const s=Object.entries(t),i=s.length;for(let a=0;a<i;a++){const[l,c]=s[a];Ij(c,ZI(e,l),n,r)}},ZI=(t,e)=>{let n=t;const r=e.split(Iv),s=r.length;for(let i=0;i<s;i++){const a=r[i];let l=n.nextPart.get(a);l||(l=YI(),n.nextPart.set(a,l)),n=l}return n},are=t=>"isThemeGetter"in t&&t.isThemeGetter===!0,ore=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)}}},uk="!",U9=":",lre=[],W9=(t,e,n,r,s)=>({modifiers:t,hasImportantModifier:e,baseClassName:n,maybePostfixModifierPosition:r,isExternal:s}),cre=t=>{const{prefix:e,experimentalParseClassName:n}=t;let r=s=>{const i=[];let a=0,l=0,c=0,d;const h=s.length;for(let w=0;w<h;w++){const S=s[w];if(a===0&&l===0){if(S===U9){i.push(s.slice(c,w)),c=w+1;continue}if(S==="/"){d=w;continue}}S==="["?a++:S==="]"?a--:S==="("?l++:S===")"&&l--}const m=i.length===0?s:s.slice(c);let g=m,x=!1;m.endsWith(uk)?(g=m.slice(0,-1),x=!0):m.startsWith(uk)&&(g=m.slice(1),x=!0);const y=d&&d>c?d-c:void 0;return W9(i,x,g,y)};if(e){const s=e+U9,i=r;r=a=>a.startsWith(s)?i(a.slice(s.length)):W9(lre,!1,a,void 0,!0)}if(n){const s=r;r=i=>n({className:i,parseClassName:s})}return r},ure=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;i<n.length;i++){const a=n[i],l=a[0]==="[",c=e.has(a);l||c?(s.length>0&&(s.sort(),r.push(...s),s=[]),r.push(a)):s.push(a)}return s.length>0&&(s.sort(),r.push(...s)),r}},dre=t=>({cache:ore(t.cacheSize),parseClassName:cre(t),sortModifiers:ure(t),...Zne(t)}),hre=/\s+/,fre=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s,sortModifiers:i}=e,a=[],l=t.trim().split(hre);let c="";for(let d=l.length-1;d>=0;d-=1){const h=l[d],{isExternal:m,modifiers:g,hasImportantModifier:x,baseClassName:y,maybePostfixModifierPosition:w}=n(h);if(m){c=h+(c.length>0?" "+c:c);continue}let S=!!w,k=r(S?y.substring(0,w):y);if(!k){if(!S){c=h+(c.length>0?" "+c:c);continue}if(k=r(y),!k){c=h+(c.length>0?" "+c:c);continue}S=!1}const j=g.length===0?"":g.length===1?g[0]:i(g).join(":"),N=x?j+uk:j,T=N+k;if(a.indexOf(T)>-1)continue;a.push(T);const E=s(k,S);for(let _=0;_<E.length;++_){const A=E[_];a.push(N+A)}c=h+(c.length>0?" "+c:c)}return c},mre=(...t)=>{let e=0,n,r,s="";for(;e<t.length;)(n=t[e++])&&(r=JI(n))&&(s&&(s+=" "),s+=r);return s},JI=t=>{if(typeof t=="string")return t;let e,n="";for(let r=0;r<t.length;r++)t[r]&&(e=JI(t[r]))&&(n&&(n+=" "),n+=e);return n},pre=(t,...e)=>{let n,r,s,i;const a=c=>{const d=e.reduce((h,m)=>m(h),t());return n=dre(d),r=n.cache.get,s=n.cache.set,i=l,l(c)},l=c=>{const d=r(c);if(d)return d;const h=fre(c,n);return s(c,h),h};return i=a,(...c)=>i(mre(...c))},gre=[],cs=t=>{const e=n=>n[t]||gre;return e.isThemeGetter=!0,e},eL=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,tL=/^\((?:(\w[\w-]*):)?(.+)\)$/i,xre=/^\d+\/\d+$/,vre=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,yre=/\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$/,bre=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,wre=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Sre=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ih=t=>xre.test(t),rn=t=>!!t&&!Number.isNaN(Number(t)),jc=t=>!!t&&Number.isInteger(Number(t)),N4=t=>t.endsWith("%")&&rn(t.slice(0,-1)),xl=t=>vre.test(t),kre=()=>!0,Ore=t=>yre.test(t)&&!bre.test(t),nL=()=>!1,jre=t=>wre.test(t),Nre=t=>Sre.test(t),Cre=t=>!dt(t)&&!ht(t),Tre=t=>wf(t,iL,nL),dt=t=>eL.test(t),Mu=t=>wf(t,aL,Ore),C4=t=>wf(t,Rre,rn),G9=t=>wf(t,rL,nL),Ere=t=>wf(t,sL,Nre),Yx=t=>wf(t,oL,jre),ht=t=>tL.test(t),Im=t=>Sf(t,aL),_re=t=>Sf(t,Dre),X9=t=>Sf(t,rL),Are=t=>Sf(t,iL),Mre=t=>Sf(t,sL),Kx=t=>Sf(t,oL,!0),wf=(t,e,n)=>{const r=eL.exec(t);return r?r[1]?e(r[1]):n(r[2]):!1},Sf=(t,e,n=!1)=>{const r=tL.exec(t);return r?r[1]?e(r[1]):n:!1},rL=t=>t==="position"||t==="percentage",sL=t=>t==="image"||t==="url",iL=t=>t==="length"||t==="size"||t==="bg-size",aL=t=>t==="length",Rre=t=>t==="number",Dre=t=>t==="family-name",oL=t=>t==="shadow",Pre=()=>{const t=cs("color"),e=cs("font"),n=cs("text"),r=cs("font-weight"),s=cs("tracking"),i=cs("leading"),a=cs("breakpoint"),l=cs("container"),c=cs("spacing"),d=cs("radius"),h=cs("shadow"),m=cs("inset-shadow"),g=cs("text-shadow"),x=cs("drop-shadow"),y=cs("blur"),w=cs("perspective"),S=cs("aspect"),k=cs("ease"),j=cs("animate"),N=()=>["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"],E=()=>[...T(),ht,dt],_=()=>["auto","hidden","clip","visible","scroll"],A=()=>["auto","contain","none"],L=()=>[ht,dt,c],P=()=>[ih,"full","auto",...L()],B=()=>[jc,"none","subgrid",ht,dt],$=()=>["auto",{span:["full",jc,ht,dt]},jc,ht,dt],U=()=>[jc,"auto",ht,dt],te=()=>["auto","min","max","fr",ht,dt],z=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],Q=()=>["start","end","center","stretch","center-safe","end-safe"],F=()=>["auto",...L()],Y=()=>[ih,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...L()],J=()=>[t,ht,dt],X=()=>[...T(),X9,G9,{position:[ht,dt]}],R=()=>["no-repeat",{repeat:["","x","y","space","round"]}],ie=()=>["auto","cover","contain",Are,Tre,{size:[ht,dt]}],G=()=>[N4,Im,Mu],I=()=>["","none","full",d,ht,dt],V=()=>["",rn,Im,Mu],ee=()=>["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"],W=()=>[rn,N4,X9,G9],se=()=>["","none",y,ht,dt],re=()=>["none",rn,ht,dt],oe=()=>["none",rn,ht,dt],Te=()=>[rn,ht,dt],We=()=>[ih,"full",...L()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[xl],breakpoint:[xl],color:[kre],container:[xl],"drop-shadow":[xl],ease:["in","out","in-out"],font:[Cre],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[xl],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[xl],shadow:[xl],spacing:["px",rn],text:[xl],"text-shadow":[xl],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ih,dt,ht,S]}],container:["container"],columns:[{columns:[rn,dt,ht,l]}],"break-after":[{"break-after":N()}],"break-before":[{"break-before":N()}],"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:E()}],overflow:[{overflow:_()}],"overflow-x":[{"overflow-x":_()}],"overflow-y":[{"overflow-y":_()}],overscroll:[{overscroll:A()}],"overscroll-x":[{"overscroll-x":A()}],"overscroll-y":[{"overscroll-y":A()}],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:[jc,"auto",ht,dt]}],basis:[{basis:[ih,"full","auto",l,...L()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[rn,ih,"auto","initial","none",dt]}],grow:[{grow:["",rn,ht,dt]}],shrink:[{shrink:["",rn,ht,dt]}],order:[{order:[jc,"first","last","none",ht,dt]}],"grid-cols":[{"grid-cols":B()}],"col-start-end":[{col:$()}],"col-start":[{"col-start":U()}],"col-end":[{"col-end":U()}],"grid-rows":[{"grid-rows":B()}],"row-start-end":[{row:$()}],"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":te()}],"auto-rows":[{"auto-rows":te()}],gap:[{gap:L()}],"gap-x":[{"gap-x":L()}],"gap-y":[{"gap-y":L()}],"justify-content":[{justify:[...z(),"normal"]}],"justify-items":[{"justify-items":[...Q(),"normal"]}],"justify-self":[{"justify-self":["auto",...Q()]}],"align-content":[{content:["normal",...z()]}],"align-items":[{items:[...Q(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...Q(),{baseline:["","last"]}]}],"place-content":[{"place-content":z()}],"place-items":[{"place-items":[...Q(),"baseline"]}],"place-self":[{"place-self":["auto",...Q()]}],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:F()}],mx:[{mx:F()}],my:[{my:F()}],ms:[{ms:F()}],me:[{me:F()}],mt:[{mt:F()}],mr:[{mr:F()}],mb:[{mb:F()}],ml:[{ml:F()}],"space-x":[{"space-x":L()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":L()}],"space-y-reverse":["space-y-reverse"],size:[{size:Y()}],w:[{w:[l,"screen",...Y()]}],"min-w":[{"min-w":[l,"screen","none",...Y()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[a]},...Y()]}],h:[{h:["screen","lh",...Y()]}],"min-h":[{"min-h":["screen","lh","none",...Y()]}],"max-h":[{"max-h":["screen","lh",...Y()]}],"font-size":[{text:["base",n,Im,Mu]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,ht,C4]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",N4,dt]}],"font-family":[{font:[_re,dt,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,ht,dt]}],"line-clamp":[{"line-clamp":[rn,"none",ht,C4]}],leading:[{leading:[i,...L()]}],"list-image":[{"list-image":["none",ht,dt]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ht,dt]}],"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:[...ee(),"wavy"]}],"text-decoration-thickness":[{decoration:[rn,"from-font","auto",ht,Mu]}],"text-decoration-color":[{decoration:J()}],"underline-offset":[{"underline-offset":[rn,"auto",ht,dt]}],"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",ht,dt]}],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",ht,dt]}],"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:ie()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},jc,ht,dt],radial:["",ht,dt],conic:[jc,ht,dt]},Mre,Ere]}],"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:I()}],"rounded-s":[{"rounded-s":I()}],"rounded-e":[{"rounded-e":I()}],"rounded-t":[{"rounded-t":I()}],"rounded-r":[{"rounded-r":I()}],"rounded-b":[{"rounded-b":I()}],"rounded-l":[{"rounded-l":I()}],"rounded-ss":[{"rounded-ss":I()}],"rounded-se":[{"rounded-se":I()}],"rounded-ee":[{"rounded-ee":I()}],"rounded-es":[{"rounded-es":I()}],"rounded-tl":[{"rounded-tl":I()}],"rounded-tr":[{"rounded-tr":I()}],"rounded-br":[{"rounded-br":I()}],"rounded-bl":[{"rounded-bl":I()}],"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:[...ee(),"hidden","none"]}],"divide-style":[{divide:[...ee(),"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:[...ee(),"none","hidden"]}],"outline-offset":[{"outline-offset":[rn,ht,dt]}],"outline-w":[{outline:["",rn,Im,Mu]}],"outline-color":[{outline:J()}],shadow:[{shadow:["","none",h,Kx,Yx]}],"shadow-color":[{shadow:J()}],"inset-shadow":[{"inset-shadow":["none",m,Kx,Yx]}],"inset-shadow-color":[{"inset-shadow":J()}],"ring-w":[{ring:V()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:J()}],"ring-offset-w":[{"ring-offset":[rn,Mu]}],"ring-offset-color":[{"ring-offset":J()}],"inset-ring-w":[{"inset-ring":V()}],"inset-ring-color":[{"inset-ring":J()}],"text-shadow":[{"text-shadow":["none",g,Kx,Yx]}],"text-shadow-color":[{"text-shadow":J()}],opacity:[{opacity:[rn,ht,dt]}],"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":[rn]}],"mask-image-linear-from-pos":[{"mask-linear-from":W()}],"mask-image-linear-to-pos":[{"mask-linear-to":W()}],"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":W()}],"mask-image-t-to-pos":[{"mask-t-to":W()}],"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":W()}],"mask-image-r-to-pos":[{"mask-r-to":W()}],"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":W()}],"mask-image-b-to-pos":[{"mask-b-to":W()}],"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":W()}],"mask-image-l-to-pos":[{"mask-l-to":W()}],"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":W()}],"mask-image-x-to-pos":[{"mask-x-to":W()}],"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":W()}],"mask-image-y-to-pos":[{"mask-y-to":W()}],"mask-image-y-from-color":[{"mask-y-from":J()}],"mask-image-y-to-color":[{"mask-y-to":J()}],"mask-image-radial":[{"mask-radial":[ht,dt]}],"mask-image-radial-from-pos":[{"mask-radial-from":W()}],"mask-image-radial-to-pos":[{"mask-radial-to":W()}],"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":[rn]}],"mask-image-conic-from-pos":[{"mask-conic-from":W()}],"mask-image-conic-to-pos":[{"mask-conic-to":W()}],"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:ie()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ht,dt]}],filter:[{filter:["","none",ht,dt]}],blur:[{blur:se()}],brightness:[{brightness:[rn,ht,dt]}],contrast:[{contrast:[rn,ht,dt]}],"drop-shadow":[{"drop-shadow":["","none",x,Kx,Yx]}],"drop-shadow-color":[{"drop-shadow":J()}],grayscale:[{grayscale:["",rn,ht,dt]}],"hue-rotate":[{"hue-rotate":[rn,ht,dt]}],invert:[{invert:["",rn,ht,dt]}],saturate:[{saturate:[rn,ht,dt]}],sepia:[{sepia:["",rn,ht,dt]}],"backdrop-filter":[{"backdrop-filter":["","none",ht,dt]}],"backdrop-blur":[{"backdrop-blur":se()}],"backdrop-brightness":[{"backdrop-brightness":[rn,ht,dt]}],"backdrop-contrast":[{"backdrop-contrast":[rn,ht,dt]}],"backdrop-grayscale":[{"backdrop-grayscale":["",rn,ht,dt]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[rn,ht,dt]}],"backdrop-invert":[{"backdrop-invert":["",rn,ht,dt]}],"backdrop-opacity":[{"backdrop-opacity":[rn,ht,dt]}],"backdrop-saturate":[{"backdrop-saturate":[rn,ht,dt]}],"backdrop-sepia":[{"backdrop-sepia":["",rn,ht,dt]}],"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",ht,dt]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[rn,"initial",ht,dt]}],ease:[{ease:["linear","initial",k,ht,dt]}],delay:[{delay:[rn,ht,dt]}],animate:[{animate:["none",j,ht,dt]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[w,ht,dt]}],"perspective-origin":[{"perspective-origin":E()}],rotate:[{rotate:re()}],"rotate-x":[{"rotate-x":re()}],"rotate-y":[{"rotate-y":re()}],"rotate-z":[{"rotate-z":re()}],scale:[{scale:oe()}],"scale-x":[{"scale-x":oe()}],"scale-y":[{"scale-y":oe()}],"scale-z":[{"scale-z":oe()}],"scale-3d":["scale-3d"],skew:[{skew:Te()}],"skew-x":[{"skew-x":Te()}],"skew-y":[{"skew-y":Te()}],transform:[{transform:[ht,dt,"","none","gpu","cpu"]}],"transform-origin":[{origin:E()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:We()}],"translate-x":[{"translate-x":We()}],"translate-y":[{"translate-y":We()}],"translate-z":[{"translate-z":We()}],"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",ht,dt]}],"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",ht,dt]}],fill:[{fill:["none",...J()]}],"stroke-w":[{stroke:[rn,Im,Mu,C4]}],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"]}},zre=pre(Pre);function xe(...t){return zre(Fz(t))}const qt=b.forwardRef(({className:t,...e},n)=>o.jsx("div",{ref:n,className:xe("rounded-xl border bg-card text-card-foreground shadow",t),...e}));qt.displayName="Card";const Fn=b.forwardRef(({className:t,...e},n)=>o.jsx("div",{ref:n,className:xe("flex flex-col space-y-1.5 p-6",t),...e}));Fn.displayName="CardHeader";const qn=b.forwardRef(({className:t,...e},n)=>o.jsx("div",{ref:n,className:xe("font-semibold leading-none tracking-tight",t),...e}));qn.displayName="CardTitle";const ts=b.forwardRef(({className:t,...e},n)=>o.jsx("div",{ref:n,className:xe("text-sm text-muted-foreground",t),...e}));ts.displayName="CardDescription";const Gn=b.forwardRef(({className:t,...e},n)=>o.jsx("div",{ref:n,className:xe("p-6 pt-0",t),...e}));Gn.displayName="CardContent";const lL=b.forwardRef(({className:t,...e},n)=>o.jsx("div",{ref:n,className:xe("flex items-center p-6 pt-0",t),...e}));lL.displayName="CardFooter";var T4="rovingFocusGroup.onEntryFocus",Ire={bubbles:!1,cancelable:!0},Ip="RovingFocusGroup",[dk,cL,Lre]=By(Ip),[Bre,eb]=Ra(Ip,[Lre]),[Fre,qre]=Bre(Ip),uL=b.forwardRef((t,e)=>o.jsx(dk.Provider,{scope:t.__scopeRovingFocusGroup,children:o.jsx(dk.Slot,{scope:t.__scopeRovingFocusGroup,children:o.jsx($re,{...t,ref:e})})}));uL.displayName=Ip;var $re=b.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:s=!1,dir:i,currentTabStopId:a,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:d,preventScrollOnEntryFocus:h=!1,...m}=t,g=b.useRef(null),x=Yn(e,g),y=Ep(i),[w,S]=Xl({prop:a,defaultProp:l??null,onChange:c,caller:Ip}),[k,j]=b.useState(!1),N=Rs(d),T=cL(n),E=b.useRef(!1),[_,A]=b.useState(0);return b.useEffect(()=>{const L=g.current;if(L)return L.addEventListener(T4,N),()=>L.removeEventListener(T4,N)},[N]),o.jsx(Fre,{scope:n,orientation:r,dir:y,loop:s,currentTabStopId:w,onItemFocus:b.useCallback(L=>S(L),[S]),onItemShiftTab:b.useCallback(()=>j(!0),[]),onFocusableItemAdd:b.useCallback(()=>A(L=>L+1),[]),onFocusableItemRemove:b.useCallback(()=>A(L=>L-1),[]),children:o.jsx(xn.div,{tabIndex:k||_===0?-1:0,"data-orientation":r,...m,ref:x,style:{outline:"none",...t.style},onMouseDown:nt(t.onMouseDown,()=>{E.current=!0}),onFocus:nt(t.onFocus,L=>{const P=!E.current;if(L.target===L.currentTarget&&P&&!k){const B=new CustomEvent(T4,Ire);if(L.currentTarget.dispatchEvent(B),!B.defaultPrevented){const $=T().filter(F=>F.focusable),U=$.find(F=>F.active),te=$.find(F=>F.id===w),Q=[U,te,...$].filter(Boolean).map(F=>F.ref.current);fL(Q,h)}}E.current=!1}),onBlur:nt(t.onBlur,()=>j(!1))})})}),dL="RovingFocusGroupItem",hL=b.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:s=!1,tabStopId:i,children:a,...l}=t,c=Ui(),d=i||c,h=qre(dL,n),m=h.currentTabStopId===d,g=cL(n),{onFocusableItemAdd:x,onFocusableItemRemove:y,currentTabStopId:w}=h;return b.useEffect(()=>{if(r)return x(),()=>y()},[r,x,y]),o.jsx(dk.ItemSlot,{scope:n,id:d,focusable:r,active:s,children:o.jsx(xn.span,{tabIndex:m?0:-1,"data-orientation":h.orientation,...l,ref:e,onMouseDown:nt(t.onMouseDown,S=>{r?h.onItemFocus(d):S.preventDefault()}),onFocus:nt(t.onFocus,()=>h.onItemFocus(d)),onKeyDown:nt(t.onKeyDown,S=>{if(S.key==="Tab"&&S.shiftKey){h.onItemShiftTab();return}if(S.target!==S.currentTarget)return;const k=Vre(S,h.orientation,h.dir);if(k!==void 0){if(S.metaKey||S.ctrlKey||S.altKey||S.shiftKey)return;S.preventDefault();let N=g().filter(T=>T.focusable).map(T=>T.ref.current);if(k==="last")N.reverse();else if(k==="prev"||k==="next"){k==="prev"&&N.reverse();const T=N.indexOf(S.currentTarget);N=h.loop?Ure(N,T+1):N.slice(T+1)}setTimeout(()=>fL(N))}}),children:typeof a=="function"?a({isCurrentTabStop:m,hasTabStop:w!=null}):a})})});hL.displayName=dL;var Hre={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Qre(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function Vre(t,e,n){const r=Qre(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return Hre[r]}function fL(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function Ure(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var mL=uL,pL=hL,tb="Tabs",[Wre]=Ra(tb,[eb]),gL=eb(),[Gre,Lj]=Wre(tb),xL=b.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,onValueChange:s,defaultValue:i,orientation:a="horizontal",dir:l,activationMode:c="automatic",...d}=t,h=Ep(l),[m,g]=Xl({prop:r,onChange:s,defaultProp:i??"",caller:tb});return o.jsx(Gre,{scope:n,baseId:Ui(),value:m,onValueChange:g,orientation:a,dir:h,activationMode:c,children:o.jsx(xn.div,{dir:h,"data-orientation":a,...d,ref:e})})});xL.displayName=tb;var vL="TabsList",yL=b.forwardRef((t,e)=>{const{__scopeTabs:n,loop:r=!0,...s}=t,i=Lj(vL,n),a=gL(n);return o.jsx(mL,{asChild:!0,...a,orientation:i.orientation,dir:i.dir,loop:r,children:o.jsx(xn.div,{role:"tablist","aria-orientation":i.orientation,...s,ref:e})})});yL.displayName=vL;var bL="TabsTrigger",wL=b.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,disabled:s=!1,...i}=t,a=Lj(bL,n),l=gL(n),c=OL(a.baseId,r),d=jL(a.baseId,r),h=r===a.value;return o.jsx(pL,{asChild:!0,...l,focusable:!s,active:h,children:o.jsx(xn.button,{type:"button",role:"tab","aria-selected":h,"aria-controls":d,"data-state":h?"active":"inactive","data-disabled":s?"":void 0,disabled:s,id:c,...i,ref:e,onMouseDown:nt(t.onMouseDown,m=>{!s&&m.button===0&&m.ctrlKey===!1?a.onValueChange(r):m.preventDefault()}),onKeyDown:nt(t.onKeyDown,m=>{[" ","Enter"].includes(m.key)&&a.onValueChange(r)}),onFocus:nt(t.onFocus,()=>{const m=a.activationMode!=="manual";!h&&!s&&m&&a.onValueChange(r)})})})});wL.displayName=bL;var SL="TabsContent",kL=b.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,forceMount:s,children:i,...a}=t,l=Lj(SL,n),c=OL(l.baseId,r),d=jL(l.baseId,r),h=r===l.value,m=b.useRef(h);return b.useEffect(()=>{const g=requestAnimationFrame(()=>m.current=!1);return()=>cancelAnimationFrame(g)},[]),o.jsx(ii,{present:s||h,children:({present:g})=>o.jsx(xn.div,{"data-state":h?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":c,hidden:!g,id:d,tabIndex:0,...a,ref:e,style:{...t.style,animationDuration:m.current?"0s":void 0},children:g&&i})})});kL.displayName=SL;function OL(t,e){return`${t}-trigger-${e}`}function jL(t,e){return`${t}-content-${e}`}var Xre=xL,NL=yL,CL=wL,TL=kL;const ja=Xre,Wi=b.forwardRef(({className:t,...e},n)=>o.jsx(NL,{ref:n,className:xe("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",t),...e}));Wi.displayName=NL.displayName;const Lt=b.forwardRef(({className:t,...e},n)=>o.jsx(CL,{ref:n,className:xe("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}));Lt.displayName=CL.displayName;const un=b.forwardRef(({className:t,...e},n)=>o.jsx(TL,{ref:n,className:xe("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}));un.displayName=TL.displayName;function Yre(t,e){return b.useReducer((n,r)=>e[n][r]??n,t)}var Bj="ScrollArea",[EL]=Ra(Bj),[Kre,Da]=EL(Bj),_L=b.forwardRef((t,e)=>{const{__scopeScrollArea:n,type:r="hover",dir:s,scrollHideDelay:i=600,...a}=t,[l,c]=b.useState(null),[d,h]=b.useState(null),[m,g]=b.useState(null),[x,y]=b.useState(null),[w,S]=b.useState(null),[k,j]=b.useState(0),[N,T]=b.useState(0),[E,_]=b.useState(!1),[A,L]=b.useState(!1),P=Yn(e,$=>c($)),B=Ep(s);return o.jsx(Kre,{scope:n,type:r,dir:B,scrollHideDelay:i,scrollArea:l,viewport:d,onViewportChange:h,content:m,onContentChange:g,scrollbarX:x,onScrollbarXChange:y,scrollbarXEnabled:E,onScrollbarXEnabledChange:_,scrollbarY:w,onScrollbarYChange:S,scrollbarYEnabled:A,onScrollbarYEnabledChange:L,onCornerWidthChange:j,onCornerHeightChange:T,children:o.jsx(xn.div,{dir:B,...a,ref:P,style:{position:"relative","--radix-scroll-area-corner-width":k+"px","--radix-scroll-area-corner-height":N+"px",...t.style}})})});_L.displayName=Bj;var AL="ScrollAreaViewport",ML=b.forwardRef((t,e)=>{const{__scopeScrollArea:n,children:r,nonce:s,...i}=t,a=Da(AL,n),l=b.useRef(null),c=Yn(e,l,a.onViewportChange);return o.jsxs(o.Fragment,{children:[o.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}),o.jsx(xn.div,{"data-radix-scroll-area-viewport":"",...i,ref:c,style:{overflowX:a.scrollbarXEnabled?"scroll":"hidden",overflowY:a.scrollbarYEnabled?"scroll":"hidden",...t.style},children:o.jsx("div",{ref:a.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});ML.displayName=AL;var Fo="ScrollAreaScrollbar",Fj=b.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=Da(Fo,t.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:a}=s,l=t.orientation==="horizontal";return b.useEffect(()=>(l?i(!0):a(!0),()=>{l?i(!1):a(!1)}),[l,i,a]),s.type==="hover"?o.jsx(Zre,{...r,ref:e,forceMount:n}):s.type==="scroll"?o.jsx(Jre,{...r,ref:e,forceMount:n}):s.type==="auto"?o.jsx(RL,{...r,ref:e,forceMount:n}):s.type==="always"?o.jsx(qj,{...r,ref:e}):null});Fj.displayName=Fo;var Zre=b.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=Da(Fo,t.__scopeScrollArea),[i,a]=b.useState(!1);return b.useEffect(()=>{const l=s.scrollArea;let c=0;if(l){const d=()=>{window.clearTimeout(c),a(!0)},h=()=>{c=window.setTimeout(()=>a(!1),s.scrollHideDelay)};return l.addEventListener("pointerenter",d),l.addEventListener("pointerleave",h),()=>{window.clearTimeout(c),l.removeEventListener("pointerenter",d),l.removeEventListener("pointerleave",h)}}},[s.scrollArea,s.scrollHideDelay]),o.jsx(ii,{present:n||i,children:o.jsx(RL,{"data-state":i?"visible":"hidden",...r,ref:e})})}),Jre=b.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=Da(Fo,t.__scopeScrollArea),i=t.orientation==="horizontal",a=rb(()=>c("SCROLL_END"),100),[l,c]=Yre("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(l==="idle"){const d=window.setTimeout(()=>c("HIDE"),s.scrollHideDelay);return()=>window.clearTimeout(d)}},[l,s.scrollHideDelay,c]),b.useEffect(()=>{const d=s.viewport,h=i?"scrollLeft":"scrollTop";if(d){let m=d[h];const g=()=>{const x=d[h];m!==x&&(c("SCROLL"),a()),m=x};return d.addEventListener("scroll",g),()=>d.removeEventListener("scroll",g)}},[s.viewport,i,c,a]),o.jsx(ii,{present:n||l!=="hidden",children:o.jsx(qj,{"data-state":l==="hidden"?"hidden":"visible",...r,ref:e,onPointerEnter:nt(t.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:nt(t.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),RL=b.forwardRef((t,e)=>{const n=Da(Fo,t.__scopeScrollArea),{forceMount:r,...s}=t,[i,a]=b.useState(!1),l=t.orientation==="horizontal",c=rb(()=>{if(n.viewport){const d=n.viewport.offsetWidth<n.viewport.scrollWidth,h=n.viewport.offsetHeight<n.viewport.scrollHeight;a(l?d:h)}},10);return Yh(n.viewport,c),Yh(n.content,c),o.jsx(ii,{present:r||i,children:o.jsx(qj,{"data-state":i?"visible":"hidden",...s,ref:e})})}),qj=b.forwardRef((t,e)=>{const{orientation:n="vertical",...r}=t,s=Da(Fo,t.__scopeScrollArea),i=b.useRef(null),a=b.useRef(0),[l,c]=b.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),d=LL(l.viewport,l.content),h={...r,sizes:l,onSizesChange:c,hasThumb:d>0&&d<1,onThumbChange:g=>i.current=g,onThumbPointerUp:()=>a.current=0,onThumbPointerDown:g=>a.current=g};function m(g,x){return ise(g,a.current,l,x)}return n==="horizontal"?o.jsx(ese,{...h,ref:e,onThumbPositionChange:()=>{if(s.viewport&&i.current){const g=s.viewport.scrollLeft,x=Y9(g,l,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"?o.jsx(tse,{...h,ref:e,onThumbPositionChange:()=>{if(s.viewport&&i.current){const g=s.viewport.scrollTop,x=Y9(g,l);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}),ese=b.forwardRef((t,e)=>{const{sizes:n,onSizesChange:r,...s}=t,i=Da(Fo,t.__scopeScrollArea),[a,l]=b.useState(),c=b.useRef(null),d=Yn(e,c,i.onScrollbarXChange);return b.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),o.jsx(PL,{"data-orientation":"horizontal",...s,ref:d,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":nb(n)+"px",...t.style},onThumbPointerDown:h=>t.onThumbPointerDown(h.x),onDragScroll:h=>t.onDragScroll(h.x),onWheelScroll:(h,m)=>{if(i.viewport){const g=i.viewport.scrollLeft+h.deltaX;t.onWheelScroll(g),FL(g,m)&&h.preventDefault()}},onResize:()=>{c.current&&i.viewport&&a&&r({content:i.viewport.scrollWidth,viewport:i.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:Bv(a.paddingLeft),paddingEnd:Bv(a.paddingRight)}})}})}),tse=b.forwardRef((t,e)=>{const{sizes:n,onSizesChange:r,...s}=t,i=Da(Fo,t.__scopeScrollArea),[a,l]=b.useState(),c=b.useRef(null),d=Yn(e,c,i.onScrollbarYChange);return b.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),o.jsx(PL,{"data-orientation":"vertical",...s,ref:d,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":nb(n)+"px",...t.style},onThumbPointerDown:h=>t.onThumbPointerDown(h.y),onDragScroll:h=>t.onDragScroll(h.y),onWheelScroll:(h,m)=>{if(i.viewport){const g=i.viewport.scrollTop+h.deltaY;t.onWheelScroll(g),FL(g,m)&&h.preventDefault()}},onResize:()=>{c.current&&i.viewport&&a&&r({content:i.viewport.scrollHeight,viewport:i.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:Bv(a.paddingTop),paddingEnd:Bv(a.paddingBottom)}})}})}),[nse,DL]=EL(Fo),PL=b.forwardRef((t,e)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:s,onThumbChange:i,onThumbPointerUp:a,onThumbPointerDown:l,onThumbPositionChange:c,onDragScroll:d,onWheelScroll:h,onResize:m,...g}=t,x=Da(Fo,n),[y,w]=b.useState(null),S=Yn(e,P=>w(P)),k=b.useRef(null),j=b.useRef(""),N=x.viewport,T=r.content-r.viewport,E=Rs(h),_=Rs(c),A=rb(m,10);function L(P){if(k.current){const B=P.clientX-k.current.left,$=P.clientY-k.current.top;d({x:B,y:$})}}return b.useEffect(()=>{const P=B=>{const $=B.target;y?.contains($)&&E(B,T)};return document.addEventListener("wheel",P,{passive:!1}),()=>document.removeEventListener("wheel",P,{passive:!1})},[N,y,T,E]),b.useEffect(_,[r,_]),Yh(y,A),Yh(x.content,A),o.jsx(nse,{scope:n,scrollbar:y,hasThumb:s,onThumbChange:Rs(i),onThumbPointerUp:Rs(a),onThumbPositionChange:_,onThumbPointerDown:Rs(l),children:o.jsx(xn.div,{...g,ref:S,style:{position:"absolute",...g.style},onPointerDown:nt(t.onPointerDown,P=>{P.button===0&&(P.target.setPointerCapture(P.pointerId),k.current=y.getBoundingClientRect(),j.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",x.viewport&&(x.viewport.style.scrollBehavior="auto"),L(P))}),onPointerMove:nt(t.onPointerMove,L),onPointerUp:nt(t.onPointerUp,P=>{const B=P.target;B.hasPointerCapture(P.pointerId)&&B.releasePointerCapture(P.pointerId),document.body.style.webkitUserSelect=j.current,x.viewport&&(x.viewport.style.scrollBehavior=""),k.current=null})})})}),Lv="ScrollAreaThumb",zL=b.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=DL(Lv,t.__scopeScrollArea);return o.jsx(ii,{present:n||s.hasThumb,children:o.jsx(rse,{ref:e,...r})})}),rse=b.forwardRef((t,e)=>{const{__scopeScrollArea:n,style:r,...s}=t,i=Da(Lv,n),a=DL(Lv,n),{onThumbPositionChange:l}=a,c=Yn(e,m=>a.onThumbChange(m)),d=b.useRef(void 0),h=rb(()=>{d.current&&(d.current(),d.current=void 0)},100);return b.useEffect(()=>{const m=i.viewport;if(m){const g=()=>{if(h(),!d.current){const x=ase(m,l);d.current=x,l()}};return l(),m.addEventListener("scroll",g),()=>m.removeEventListener("scroll",g)}},[i.viewport,h,l]),o.jsx(xn.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:nt(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:nt(t.onPointerUp,a.onThumbPointerUp)})});zL.displayName=Lv;var $j="ScrollAreaCorner",IL=b.forwardRef((t,e)=>{const n=Da($j,t.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?o.jsx(sse,{...t,ref:e}):null});IL.displayName=$j;var sse=b.forwardRef((t,e)=>{const{__scopeScrollArea:n,...r}=t,s=Da($j,n),[i,a]=b.useState(0),[l,c]=b.useState(0),d=!!(i&&l);return Yh(s.scrollbarX,()=>{const h=s.scrollbarX?.offsetHeight||0;s.onCornerHeightChange(h),c(h)}),Yh(s.scrollbarY,()=>{const h=s.scrollbarY?.offsetWidth||0;s.onCornerWidthChange(h),a(h)}),d?o.jsx(xn.div,{...r,ref:e,style:{width:i,height:l,position:"absolute",right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null});function Bv(t){return t?parseInt(t,10):0}function LL(t,e){const n=t/e;return isNaN(n)?0:n}function nb(t){const e=LL(t.viewport,t.content),n=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,r=(t.scrollbar.size-n)*e;return Math.max(r,18)}function ise(t,e,n,r="ltr"){const s=nb(n),i=s/2,a=e||i,l=s-a,c=n.scrollbar.paddingStart+a,d=n.scrollbar.size-n.scrollbar.paddingEnd-l,h=n.content-n.viewport,m=r==="ltr"?[0,h]:[h*-1,0];return BL([c,d],m)(t)}function Y9(t,e,n="ltr"){const r=nb(e),s=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,i=e.scrollbar.size-s,a=e.content-e.viewport,l=i-r,c=n==="ltr"?[0,a]:[a*-1,0],d=Sj(t,c);return BL([0,a],[0,l])(d)}function BL(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 FL(t,e){return t>0&&t<e}var ase=(t,e=()=>{})=>{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,l=n.top!==i.top;(a||l)&&e(),n=i,r=window.requestAnimationFrame(s)})(),()=>window.cancelAnimationFrame(r)};function rb(t,e){const n=Rs(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 Yh(t,e){const n=Rs(e);Uh(()=>{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 qL=_L,ose=ML,lse=IL;const gn=b.forwardRef(({className:t,children:e,viewportRef:n,...r},s)=>o.jsxs(qL,{ref:s,className:xe("relative overflow-hidden",t),...r,children:[o.jsx(ose,{ref:n,className:"h-full w-full rounded-[inherit]",children:e}),o.jsx(hk,{}),o.jsx(hk,{orientation:"horizontal"}),o.jsx(lse,{})]}));gn.displayName=qL.displayName;const hk=b.forwardRef(({className:t,orientation:e="vertical",...n},r)=>o.jsx(Fj,{ref:r,orientation:e,className:xe("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:o.jsx(zL,{className:"relative flex-1 rounded-full bg-border"})}));hk.displayName=Fj.displayName;function cse({className:t,...e}){return o.jsx("div",{className:xe("animate-pulse rounded-md bg-primary/10",t),...e})}function use(t,e=[]){let n=[];function r(i,a){const l=b.createContext(a);l.displayName=i+"Context";const c=n.length;n=[...n,a];const d=m=>{const{scope:g,children:x,...y}=m,w=g?.[t]?.[c]||l,S=b.useMemo(()=>y,Object.values(y));return o.jsx(w.Provider,{value:S,children:x})};d.displayName=i+"Provider";function h(m,g){const x=g?.[t]?.[c]||l,y=b.useContext(x);if(y)return y;if(a!==void 0)return a;throw new Error(`\`${m}\` must be used within \`${i}\``)}return[d,h]}const s=()=>{const i=n.map(a=>b.createContext(a));return function(l){const c=l?.[t]||i;return b.useMemo(()=>({[`__scope${t}`]:{...l,[t]:c}}),[l,c])}};return s.scopeName=t,[r,dse(s,...e)]}function dse(...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((l,{useScope:c,scopeName:d})=>{const m=c(i)[`__scope${d}`];return{...l,...m}},{});return b.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return n.scopeName=e.scopeName,n}var hse=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],$L=hse.reduce((t,e)=>{const n=Fy(`Primitive.${e}`),r=b.forwardRef((s,i)=>{const{asChild:a,...l}=s,c=a?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(c,{...l,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),Hj="Progress",Qj=100,[fse]=use(Hj),[mse,pse]=fse(Hj),HL=b.forwardRef((t,e)=>{const{__scopeProgress:n,value:r=null,max:s,getValueLabel:i=gse,...a}=t;(s||s===0)&&!K9(s)&&console.error(xse(`${s}`,"Progress"));const l=K9(s)?s:Qj;r!==null&&!Z9(r,l)&&console.error(vse(`${r}`,"Progress"));const c=Z9(r,l)?r:null,d=Fv(c)?i(c,l):void 0;return o.jsx(mse,{scope:n,value:c,max:l,children:o.jsx($L.div,{"aria-valuemax":l,"aria-valuemin":0,"aria-valuenow":Fv(c)?c:void 0,"aria-valuetext":d,role:"progressbar","data-state":UL(c,l),"data-value":c??void 0,"data-max":l,...a,ref:e})})});HL.displayName=Hj;var QL="ProgressIndicator",VL=b.forwardRef((t,e)=>{const{__scopeProgress:n,...r}=t,s=pse(QL,n);return o.jsx($L.div,{"data-state":UL(s.value,s.max),"data-value":s.value??void 0,"data-max":s.max,...r,ref:e})});VL.displayName=QL;function gse(t,e){return`${Math.round(t/e*100)}%`}function UL(t,e){return t==null?"indeterminate":t===e?"complete":"loading"}function Fv(t){return typeof t=="number"}function K9(t){return Fv(t)&&!isNaN(t)&&t>0}function Z9(t,e){return Fv(t)&&!isNaN(t)&&t<=e&&t>=0}function xse(t,e){return`Invalid prop \`max\` of value \`${t}\` supplied to \`${e}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${Qj}\`.`}function vse(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 ${Qj} if no \`max\` prop is set)
- \`null\` or \`undefined\` if the progress is indeterminate.
Defaulting to \`null\`.`}var WL=HL,yse=VL;const Lp=b.forwardRef(({className:t,value:e,...n},r)=>o.jsx(WL,{ref:r,className:xe("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",t),...n,children:o.jsx(yse,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(e||0)}%)`}})}));Lp.displayName=WL.displayName;const bse={light:"",dark:".dark"},GL=b.createContext(null);function XL(){const t=b.useContext(GL);if(!t)throw new Error("useChart must be used within a <ChartContainer />");return t}const gh=b.forwardRef(({id:t,className:e,children:n,config:r,...s},i)=>{const a=b.useId(),l=`chart-${t||a.replace(/:/g,"")}`;return o.jsx(GL.Provider,{value:{config:r},children:o.jsxs("div",{"data-chart":l,ref:i,className:xe("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:[o.jsx(wse,{id:l,config:r}),o.jsx(jJ,{children:n})]})})});gh.displayName="Chart";const wse=({id:t,config:e})=>{const n=Object.entries(e).filter(([,r])=>r.theme||r.color);return n.length?o.jsx("style",{dangerouslySetInnerHTML:{__html:Object.entries(bse).map(([r,s])=>`
${s} [data-chart=${t}] {
${n.map(([i,a])=>{const l=a.theme?.[r]||a.color;return l?` --color-${i}: ${l};`:null}).join(`
`)}
}
`).join(`
`)}}):null},Lm=NJ,xh=b.forwardRef(({active:t,payload:e,className:n,indicator:r="dot",hideLabel:s=!1,hideIndicator:i=!1,label:a,labelFormatter:l,labelClassName:c,formatter:d,color:h,nameKey:m,labelKey:g},x)=>{const{config:y}=XL(),w=b.useMemo(()=>{if(s||!e?.length)return null;const[k]=e,j=`${g||k?.dataKey||k?.name||"value"}`,N=fk(y,k,j),T=!g&&typeof a=="string"?y[a]?.label||a:N?.label;return l?o.jsx("div",{className:xe("font-medium",c),children:l(T,e)}):T?o.jsx("div",{className:xe("font-medium",c),children:T}):null},[a,l,e,s,c,y,g]);if(!t||!e?.length)return null;const S=e.length===1&&r!=="dot";return o.jsxs("div",{ref:x,className:xe("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,o.jsx("div",{className:"grid gap-1.5",children:e.filter(k=>k.type!=="none").map((k,j)=>{const N=`${m||k.name||k.dataKey||"value"}`,T=fk(y,k,N),E=h||k.payload.fill||k.color;return o.jsx("div",{className:xe("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:d&&k?.value!==void 0&&k.name?d(k.value,k.name,k,j,k.payload):o.jsxs(o.Fragment,{children:[T?.icon?o.jsx(T.icon,{}):!i&&o.jsx("div",{className:xe("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":E,"--color-border":E}}),o.jsxs("div",{className:xe("flex flex-1 justify-between leading-none",S?"items-end":"items-center"),children:[o.jsxs("div",{className:"grid gap-1.5",children:[S?w:null,o.jsx("span",{className:"text-muted-foreground",children:T?.label||k.name})]}),k.value&&o.jsx("span",{className:"font-mono font-medium tabular-nums text-foreground",children:k.value.toLocaleString()})]})]})},k.dataKey)})})]})});xh.displayName="ChartTooltip";const Sse=CJ,YL=b.forwardRef(({className:t,hideIcon:e=!1,payload:n,verticalAlign:r="bottom",nameKey:s},i)=>{const{config:a}=XL();return n?.length?o.jsx("div",{ref:i,className:xe("flex items-center justify-center gap-4",r==="top"?"pb-3":"pt-3",t),children:n.filter(l=>l.type!=="none").map(l=>{const c=`${s||l.dataKey||"value"}`,d=fk(a,l,c);return o.jsxs("div",{className:xe("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"),children:[d?.icon&&!e?o.jsx(d.icon,{}):o.jsx("div",{className:"h-2 w-2 shrink-0 rounded-[2px]",style:{backgroundColor:l.color}}),d?.label]},l.value)})}):null});YL.displayName="ChartLegend";function fk(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 J9=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,eE=Fz,kf=(t,e)=>n=>{var r;if(e?.variants==null)return eE(t,n?.class,n?.className);const{variants:s,defaultVariants:i}=e,a=Object.keys(s).map(d=>{const h=n?.[d],m=i?.[d];if(h===null)return null;const g=J9(h)||J9(m);return s[d][g]}),l=n&&Object.entries(n).reduce((d,h)=>{let[m,g]=h;return g===void 0||(d[m]=g),d},{}),c=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((d,h)=>{let{class:m,className:g,...x}=h;return Object.entries(x).every(y=>{let[w,S]=y;return Array.isArray(S)?S.includes({...i,...l}[w]):{...i,...l}[w]===S})?[...d,m,g]:d},[]);return eE(t,a,c,n?.class,n?.className)},I0=kf("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?Oee:"button";return o.jsx(a,{className:xe(I0({variant:e,size:n,className:t})),ref:i,...s})});de.displayName="Button";function kse(){const[t,e]=b.useState(null),[n,r]=b.useState(!0),[s,i]=b.useState(0),[a,l]=b.useState(24),[c,d]=b.useState(!0),[h,m]=b.useState(null),[g,x]=b.useState(!0),y=b.useCallback(async()=>{try{x(!0);const P=await Br.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"),B=await Br.get(`/api/webui/statistics/dashboard?hours=${a}`,{headers:{Authorization:`Bearer ${P}`}});e(B.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),B=setTimeout(()=>i(30),800),$=setTimeout(()=>i(45),2e3),U=setTimeout(()=>i(60),4e3),te=setTimeout(()=>i(75),6500),z=setTimeout(()=>i(85),9e3),Q=setTimeout(()=>i(92),11e3);return()=>{clearTimeout(P),clearTimeout(B),clearTimeout($),clearTimeout(U),clearTimeout(te),clearTimeout(z),clearTimeout(Q)}},[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 o.jsx("div",{className:"flex items-center justify-center h-[calc(100vh-200px)]",children:o.jsxs("div",{className:"text-center space-y-6 w-full max-w-md px-4",children:[o.jsx(Ps,{className:"h-12 w-12 animate-spin mx-auto text-primary"}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("p",{className:"text-lg font-medium",children:"加载统计数据中..."}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"正在获取麦麦运行数据"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(Lp,{value:s,className:"h-2"}),o.jsxs("p",{className:"text-xs text-muted-foreground",children:[s,"%"]})]})]})});const{summary:S,model_stats:k,hourly_data:j,daily_data:N,recent_activity:T}=t,E=P=>{const B=Math.floor(P/3600),$=Math.floor(P%3600/60);return`${B}小时${$}分钟`},_=P=>new Date(P).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}),A=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 o.jsx(gn,{className:"h-full",children:o.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"实时监控面板"}),o.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"麦麦运行状态和统计数据一览"})]}),o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsx(ja,{value:a.toString(),onValueChange:P=>l(Number(P)),children:o.jsxs(Wi,{className:"grid grid-cols-3 w-full sm:w-auto",children:[o.jsx(Lt,{value:"24",children:"24小时"}),o.jsx(Lt,{value:"168",children:"7天"}),o.jsx(Lt,{value:"720",children:"30天"})]})}),o.jsxs(de,{variant:c?"default":"outline",size:"sm",onClick:()=>d(!c),className:"gap-2",children:[o.jsx(Ps,{className:`h-4 w-4 ${c?"animate-spin":""}`}),o.jsx("span",{className:"hidden sm:inline",children:"自动刷新"})]}),o.jsx(de,{variant:"outline",size:"sm",onClick:w,children:o.jsx(Ps,{className:"h-4 w-4"})})]})]}),o.jsxs("div",{className:"flex items-center gap-3 px-4 py-2 rounded-lg border border-dashed border-muted-foreground/30 bg-muted/20",children:[g?o.jsx(cse,{className:"h-5 flex-1"}):h?o.jsxs("p",{className:"flex-1 text-sm text-muted-foreground italic truncate",children:['"',h.hitokoto,'" —— ',h.from]}):null,o.jsx(de,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0",onClick:y,disabled:g,children:o.jsx(Ps,{className:`h-3.5 w-3.5 ${g?"animate-spin":""}`})})]}),o.jsxs("div",{className:"grid gap-4 grid-cols-1 xs:grid-cols-2 lg:grid-cols-4",children:[o.jsxs(qt,{children:[o.jsxs(Fn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[o.jsx(qn,{className:"text-sm font-medium",children:"总请求数"}),o.jsx(Iee,{className:"h-4 w-4 text-muted-foreground"})]}),o.jsxs(Gn,{children:[o.jsx("div",{className:"text-2xl font-bold",children:S.total_requests.toLocaleString()}),o.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["最近",a<48?a+"小时":Math.floor(a/24)+"天"]})]})]}),o.jsxs(qt,{children:[o.jsxs(Fn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[o.jsx(qn,{className:"text-sm font-medium",children:"总花费"}),o.jsx(Lee,{className:"h-4 w-4 text-muted-foreground"})]}),o.jsxs(Gn,{children:[o.jsxs("div",{className:"text-2xl font-bold",children:["¥",S.total_cost.toFixed(2)]}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:S.cost_per_hour>0?`¥${S.cost_per_hour.toFixed(2)}/小时`:"暂无数据"})]})]}),o.jsxs(qt,{children:[o.jsxs(Fn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[o.jsx(qn,{className:"text-sm font-medium",children:"Token消耗"}),o.jsx(ek,{className:"h-4 w-4 text-muted-foreground"})]}),o.jsxs(Gn,{children:[o.jsxs("div",{className:"text-2xl font-bold",children:[(S.total_tokens/1e3).toFixed(1),"K"]}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:S.tokens_per_hour>0?`${(S.tokens_per_hour/1e3).toFixed(1)}K/小时`:"暂无数据"})]})]}),o.jsxs(qt,{children:[o.jsxs(Fn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[o.jsx(qn,{className:"text-sm font-medium",children:"平均响应"}),o.jsx(tk,{className:"h-4 w-4 text-muted-foreground"})]}),o.jsxs(Gn,{children:[o.jsxs("div",{className:"text-2xl font-bold",children:[S.avg_response_time.toFixed(2),"s"]}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"API平均耗时"})]})]})]}),o.jsxs("div",{className:"grid gap-4 grid-cols-1 sm:grid-cols-3",children:[o.jsxs(qt,{children:[o.jsxs(Fn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[o.jsx(qn,{className:"text-sm font-medium",children:"在线时长"}),o.jsx(_h,{className:"h-4 w-4 text-muted-foreground"})]}),o.jsx(Gn,{children:o.jsx("div",{className:"text-xl font-bold",children:E(S.online_time)})})]}),o.jsxs(qt,{children:[o.jsxs(Fn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[o.jsx(qn,{className:"text-sm font-medium",children:"消息处理"}),o.jsx(Wh,{className:"h-4 w-4 text-muted-foreground"})]}),o.jsxs(Gn,{children:[o.jsx("div",{className:"text-xl font-bold",children:S.total_messages.toLocaleString()}),o.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["回复 ",S.total_replies.toLocaleString()," 条"]})]})]}),o.jsxs(qt,{children:[o.jsxs(Fn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[o.jsx(qn,{className:"text-sm font-medium",children:"成本效率"}),o.jsx(Bee,{className:"h-4 w-4 text-muted-foreground"})]}),o.jsxs(Gn,{children:[o.jsx("div",{className:"text-xl font-bold",children:S.total_messages>0?`¥${(S.total_cost/S.total_messages*100).toFixed(2)}`:"¥0.00"}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"每100条消息"})]})]})]}),o.jsxs(ja,{defaultValue:"trends",className:"space-y-4",children:[o.jsxs(Wi,{className:"grid w-full grid-cols-2 sm:grid-cols-4",children:[o.jsx(Lt,{value:"trends",children:"趋势"}),o.jsx(Lt,{value:"models",children:"模型"}),o.jsx(Lt,{value:"activity",children:"活动"}),o.jsx(Lt,{value:"daily",children:"日统计"})]}),o.jsxs(un,{value:"trends",className:"space-y-4",children:[o.jsxs(qt,{children:[o.jsxs(Fn,{children:[o.jsx(qn,{children:"请求趋势"}),o.jsxs(ts,{children:["最近",a,"小时的请求量变化"]})]}),o.jsx(Gn,{children:o.jsx(gh,{config:L,className:"h-[300px] sm:h-[400px] w-full aspect-auto",children:o.jsxs(TJ,{data:j,children:[o.jsx(Ux,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),o.jsx(Wx,{dataKey:"timestamp",tickFormatter:P=>_(P),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),o.jsx(Dm,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),o.jsx(Lm,{content:o.jsx(xh,{labelFormatter:P=>_(P)})}),o.jsx(EJ,{type:"monotone",dataKey:"requests",stroke:"var(--color-requests)",strokeWidth:2})]})})})]}),o.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-2",children:[o.jsxs(qt,{children:[o.jsxs(Fn,{children:[o.jsx(qn,{children:"花费趋势"}),o.jsx(ts,{children:"API调用成本变化"})]}),o.jsx(Gn,{children:o.jsx(gh,{config:L,className:"h-[250px] sm:h-[300px] w-full aspect-auto",children:o.jsxs(v4,{data:j,children:[o.jsx(Ux,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),o.jsx(Wx,{dataKey:"timestamp",tickFormatter:P=>_(P),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),o.jsx(Dm,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),o.jsx(Lm,{content:o.jsx(xh,{labelFormatter:P=>_(P)})}),o.jsx(Gx,{dataKey:"cost",fill:"var(--color-cost)"})]})})})]}),o.jsxs(qt,{children:[o.jsxs(Fn,{children:[o.jsx(qn,{children:"Token消耗"}),o.jsx(ts,{children:"Token使用量变化"})]}),o.jsx(Gn,{children:o.jsx(gh,{config:L,className:"h-[250px] sm:h-[300px] w-full aspect-auto",children:o.jsxs(v4,{data:j,children:[o.jsx(Ux,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),o.jsx(Wx,{dataKey:"timestamp",tickFormatter:P=>_(P),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),o.jsx(Dm,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),o.jsx(Lm,{content:o.jsx(xh,{labelFormatter:P=>_(P)})}),o.jsx(Gx,{dataKey:"tokens",fill:"var(--color-tokens)"})]})})})]})]})]}),o.jsx(un,{value:"models",className:"space-y-4",children:o.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-2",children:[o.jsxs(qt,{children:[o.jsxs(Fn,{children:[o.jsx(qn,{children:"模型请求分布"}),o.jsx(ts,{children:"各模型使用占比"})]}),o.jsx(Gn,{children:o.jsx(gh,{config:Object.fromEntries(k.slice(0,6).map((P,B)=>[P.model_name,{label:P.model_name,color:`hsl(var(--chart-${B%5+1}))`}])),className:"h-[300px] sm:h-[400px] w-full aspect-auto",children:o.jsxs(_J,{children:[o.jsx(Lm,{content:o.jsx(xh,{})}),o.jsx(AJ,{data:A,cx:"50%",cy:"50%",labelLine:!1,label:({name:P,percent:B})=>`${P} ${B?(B*100).toFixed(0):0}%`,outerRadius:100,dataKey:"value",children:A.map((P,B)=>o.jsx(MJ,{fill:P.fill},`cell-${B}`))})]})})})]}),o.jsxs(qt,{children:[o.jsxs(Fn,{children:[o.jsx(qn,{children:"模型详细统计"}),o.jsx(ts,{children:"请求数、花费和性能"})]}),o.jsx(Gn,{children:o.jsx(gn,{className:"h-[300px] sm:h-[400px]",children:o.jsx("div",{className:"space-y-3",children:k.map((P,B)=>o.jsxs("div",{className:"p-4 rounded-lg border bg-card hover:bg-accent/50 transition-colors",children:[o.jsxs("div",{className:"flex items-center justify-between mb-2",children:[o.jsx("h4",{className:"font-semibold text-sm truncate flex-1 min-w-0",children:P.model_name}),o.jsx("div",{className:"w-3 h-3 rounded-full ml-2 flex-shrink-0",style:{backgroundColor:`hsl(var(--chart-${B%5+1}))`}})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground",children:"请求数:"}),o.jsx("span",{className:"ml-1 font-medium",children:P.request_count.toLocaleString()})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground",children:"花费:"}),o.jsxs("span",{className:"ml-1 font-medium",children:["¥",P.total_cost.toFixed(2)]})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground",children:"Tokens:"}),o.jsxs("span",{className:"ml-1 font-medium",children:[(P.total_tokens/1e3).toFixed(1),"K"]})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground",children:"平均耗时:"}),o.jsxs("span",{className:"ml-1 font-medium",children:[P.avg_response_time.toFixed(2),"s"]})]})]})]},B))})})})]})]})}),o.jsx(un,{value:"activity",children:o.jsxs(qt,{children:[o.jsxs(Fn,{children:[o.jsx(qn,{children:"最近活动"}),o.jsx(ts,{children:"最新的API调用记录"})]}),o.jsx(Gn,{children:o.jsx(gn,{className:"h-[400px] sm:h-[500px]",children:o.jsx("div",{className:"space-y-2",children:T.map((P,B)=>o.jsxs("div",{className:"p-3 sm:p-4 rounded-lg border bg-card hover:bg-accent/50 transition-colors",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-2 mb-2",children:[o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:"font-medium text-sm truncate",children:P.model}),o.jsx("div",{className:"text-xs text-muted-foreground",children:P.request_type})]}),o.jsx("div",{className:"text-xs text-muted-foreground flex-shrink-0",children:_(P.timestamp)})]}),o.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2 text-xs",children:[o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground",children:"Tokens:"}),o.jsx("span",{className:"ml-1",children:P.tokens})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground",children:"花费:"}),o.jsxs("span",{className:"ml-1",children:["¥",P.cost.toFixed(4)]})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground",children:"耗时:"}),o.jsxs("span",{className:"ml-1",children:[P.time_cost.toFixed(2),"s"]})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground",children:"状态:"}),o.jsx("span",{className:`ml-1 ${P.status==="success"?"text-green-600":"text-red-600"}`,children:P.status})]})]})]},B))})})})]})}),o.jsx(un,{value:"daily",children:o.jsxs(qt,{children:[o.jsxs(Fn,{children:[o.jsx(qn,{children:"每日统计"}),o.jsx(ts,{children:"最近7天的数据汇总"})]}),o.jsx(Gn,{children:o.jsx(gh,{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:o.jsxs(v4,{data:N,children:[o.jsx(Ux,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),o.jsx(Wx,{dataKey:"timestamp",tickFormatter:P=>{const B=new Date(P);return`${B.getMonth()+1}/${B.getDate()}`},stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),o.jsx(Dm,{yAxisId:"left",stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),o.jsx(Dm,{yAxisId:"right",orientation:"right",stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),o.jsx(Lm,{content:o.jsx(xh,{labelFormatter:P=>new Date(P).toLocaleDateString("zh-CN")})}),o.jsx(Sse,{content:o.jsx(YL,{})}),o.jsx(Gx,{yAxisId:"left",dataKey:"requests",fill:"var(--color-requests)"}),o.jsx(Gx,{yAxisId:"right",dataKey:"cost",fill:"var(--color-cost)"})]})})})]})})]})]})})}const Ose={theme:"system",setTheme:()=>null},KL=b.createContext(Ose),Vj=()=>{const t=b.useContext(KL);if(t===void 0)throw new Error("useTheme must be used within a ThemeProvider");return t},jse=(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)"})})},ZL=b.createContext(void 0),JL=()=>{const t=b.useContext(ZL);if(t===void 0)throw new Error("useAnimation must be used within an AnimationProvider");return t};var sb="Switch",[Nse]=Ra(sb),[Cse,Tse]=Nse(sb),eB=b.forwardRef((t,e)=>{const{__scopeSwitch:n,name:r,checked:s,defaultChecked:i,required:a,disabled:l,value:c="on",onCheckedChange:d,form:h,...m}=t,[g,x]=b.useState(null),y=Yn(e,N=>x(N)),w=b.useRef(!1),S=g?h||!!g.closest("form"):!0,[k,j]=Xl({prop:s,defaultProp:i??!1,onChange:d,caller:sb});return o.jsxs(Cse,{scope:n,checked:k,disabled:l,children:[o.jsx(xn.button,{type:"button",role:"switch","aria-checked":k,"aria-required":a,"data-state":sB(k),"data-disabled":l?"":void 0,disabled:l,value:c,...m,ref:y,onClick:nt(t.onClick,N=>{j(T=>!T),S&&(w.current=N.isPropagationStopped(),w.current||N.stopPropagation())})}),S&&o.jsx(rB,{control:g,bubbles:!w.current,name:r,value:c,checked:k,required:a,disabled:l,form:h,style:{transform:"translateX(-100%)"}})]})});eB.displayName=sb;var tB="SwitchThumb",nB=b.forwardRef((t,e)=>{const{__scopeSwitch:n,...r}=t,s=Tse(tB,n);return o.jsx(xn.span,{"data-state":sB(s.checked),"data-disabled":s.disabled?"":void 0,...r,ref:e})});nB.displayName=tB;var Ese="SwitchBubbleInput",rB=b.forwardRef(({__scopeSwitch:t,control:e,checked:n,bubbles:r=!0,...s},i)=>{const a=b.useRef(null),l=Yn(a,i),c=eI(n),d=tI(e);return b.useEffect(()=>{const h=a.current;if(!h)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(h,n),h.dispatchEvent(y)}},[c,n,r]),o.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...s,tabIndex:-1,ref:l,style:{...s.style,...d,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});rB.displayName=Ese;function sB(t){return t?"checked":"unchecked"}var iB=eB,_se=nB;const Bt=b.forwardRef(({className:t,...e},n)=>o.jsx(iB,{className:xe("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:o.jsx(_se,{className:xe("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")})}));Bt.displayName=iB.displayName;const Ase=kf("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),he=b.forwardRef(({className:t,...e},n)=>o.jsx(nI,{ref:n,className:xe(Ase(),t),...e}));he.displayName=nI.displayName;const ze=b.forwardRef(({className:t,type:e,...n},r)=>o.jsx("input",{type:e,className:xe("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}));ze.displayName="Input";const Mse=5,Rse=5e3;let E4=0;function Dse(){return E4=(E4+1)%Number.MAX_SAFE_INTEGER,E4.toString()}const _4=new Map,tE=t=>{if(_4.has(t))return;const e=setTimeout(()=>{_4.delete(t),y0({type:"REMOVE_TOAST",toastId:t})},Rse);_4.set(t,e)},Pse=(t,e)=>{switch(e.type){case"ADD_TOAST":return{...t,toasts:[e.toast,...t.toasts].slice(0,Mse)};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?tE(n):t.toasts.forEach(r=>{tE(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)}}},rv=[];let sv={toasts:[]};function y0(t){sv=Pse(sv,t),rv.forEach(e=>{e(sv)})}function zse({...t}){const e=Dse(),n=s=>y0({type:"UPDATE_TOAST",toast:{...s,id:e}}),r=()=>y0({type:"DISMISS_TOAST",toastId:e});return y0({type:"ADD_TOAST",toast:{...t,id:e,open:!0,onOpenChange:s=>{s||r()}}}),{id:e,dismiss:r,update:n}}function as(){const[t,e]=b.useState(sv);return b.useEffect(()=>(rv.push(e),()=>{const n=rv.indexOf(e);n>-1&&rv.splice(n,1)}),[t]),{...t,toast:zse,dismiss:n=>y0({type:"DISMISS_TOAST",toastId:n})}}const Ise=[{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 Lse(t){const e=Ise.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 Uj="0.11.6 Beta",Wj="MaiBot Dashboard",Bse=`${Wj} v${Uj}`,Fse=(t="v")=>`${t}${Uj}`,Dr=Nj,Of=rI,qse=kj,Gj=Hy,aB=b.forwardRef(({className:t,...e},n)=>o.jsx(qy,{ref:n,className:xe("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}));aB.displayName=qy.displayName;const Sr=b.forwardRef(({className:t,children:e,preventOutsideClose:n=!1,...r},s)=>o.jsxs(qse,{children:[o.jsx(aB,{}),o.jsxs($y,{ref:s,className:xe("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),onPointerDownOutside:n?i=>i.preventDefault():void 0,onInteractOutside:n?i=>i.preventDefault():void 0,...r,children:[e,o.jsxs(Hy,{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:[o.jsx(_p,{className:"h-4 w-4"}),o.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Sr.displayName=$y.displayName;const kr=({className:t,...e})=>o.jsx("div",{className:xe("flex flex-col space-y-1.5 text-center sm:text-left",t),...e});kr.displayName="DialogHeader";const ws=({className:t,...e})=>o.jsx("div",{className:xe("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});ws.displayName="DialogFooter";const Or=b.forwardRef(({className:t,...e},n)=>o.jsx(Oj,{ref:n,className:xe("text-lg font-semibold leading-none tracking-tight",t),...e}));Or.displayName=Oj.displayName;const ss=b.forwardRef(({className:t,...e},n)=>o.jsx(jj,{ref:n,className:xe("text-sm text-muted-foreground",t),...e}));ss.displayName=jj.displayName;var $se=Symbol("radix.slottable");function Hse(t){const e=({children:n})=>o.jsx(o.Fragment,{children:n});return e.displayName=`${t}.Slottable`,e.__radixId=$se,e}var oB="AlertDialog",[Qse]=Ra(oB,[sI]),Yl=sI(),lB=t=>{const{__scopeAlertDialog:e,...n}=t,r=Yl(e);return o.jsx(Nj,{...r,...n,modal:!0})};lB.displayName=oB;var Vse="AlertDialogTrigger",cB=b.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=Yl(n);return o.jsx(rI,{...s,...r,ref:e})});cB.displayName=Vse;var Use="AlertDialogPortal",uB=t=>{const{__scopeAlertDialog:e,...n}=t,r=Yl(e);return o.jsx(kj,{...r,...n})};uB.displayName=Use;var Wse="AlertDialogOverlay",dB=b.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=Yl(n);return o.jsx(qy,{...s,...r,ref:e})});dB.displayName=Wse;var Mh="AlertDialogContent",[Gse,Xse]=Qse(Mh),Yse=Hse("AlertDialogContent"),hB=b.forwardRef((t,e)=>{const{__scopeAlertDialog:n,children:r,...s}=t,i=Yl(n),a=b.useRef(null),l=Yn(e,a),c=b.useRef(null);return o.jsx(jee,{contentName:Mh,titleName:fB,docsSlug:"alert-dialog",children:o.jsx(Gse,{scope:n,cancelRef:c,children:o.jsxs($y,{role:"alertdialog",...i,...s,ref:l,onOpenAutoFocus:nt(s.onOpenAutoFocus,d=>{d.preventDefault(),c.current?.focus({preventScroll:!0})}),onPointerDownOutside:d=>d.preventDefault(),onInteractOutside:d=>d.preventDefault(),children:[o.jsx(Yse,{children:r}),o.jsx(Zse,{contentRef:a})]})})})});hB.displayName=Mh;var fB="AlertDialogTitle",mB=b.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=Yl(n);return o.jsx(Oj,{...s,...r,ref:e})});mB.displayName=fB;var pB="AlertDialogDescription",gB=b.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=Yl(n);return o.jsx(jj,{...s,...r,ref:e})});gB.displayName=pB;var Kse="AlertDialogAction",xB=b.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=Yl(n);return o.jsx(Hy,{...s,...r,ref:e})});xB.displayName=Kse;var vB="AlertDialogCancel",yB=b.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,{cancelRef:s}=Xse(vB,n),i=Yl(n),a=Yn(e,s);return o.jsx(Hy,{...i,...r,ref:a})});yB.displayName=vB;var Zse=({contentRef:t})=>{const e=`\`${Mh}\` requires a description for the component to be accessible for screen reader users.
You can add a description to the \`${Mh}\` by passing a \`${pB}\` 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 \`${Mh}\`. 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},Jse=lB,eie=cB,tie=uB,bB=dB,wB=hB,SB=xB,kB=yB,OB=mB,jB=gB;const Dn=Jse,rs=eie,nie=tie,NB=b.forwardRef(({className:t,...e},n)=>o.jsx(bB,{className:xe("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}));NB.displayName=bB.displayName;const Nn=b.forwardRef(({className:t,...e},n)=>o.jsxs(nie,{children:[o.jsx(NB,{}),o.jsx(wB,{ref:n,className:xe("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})]}));Nn.displayName=wB.displayName;const Cn=({className:t,...e})=>o.jsx("div",{className:xe("flex flex-col space-y-2 text-center sm:text-left",t),...e});Cn.displayName="AlertDialogHeader";const Tn=({className:t,...e})=>o.jsx("div",{className:xe("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});Tn.displayName="AlertDialogFooter";const En=b.forwardRef(({className:t,...e},n)=>o.jsx(OB,{ref:n,className:xe("text-lg font-semibold",t),...e}));En.displayName=OB.displayName;const _n=b.forwardRef(({className:t,...e},n)=>o.jsx(jB,{ref:n,className:xe("text-sm text-muted-foreground",t),...e}));_n.displayName=jB.displayName;const An=b.forwardRef(({className:t,...e},n)=>o.jsx(SB,{ref:n,className:xe(I0(),t),...e}));An.displayName=SB.displayName;const Mn=b.forwardRef(({className:t,...e},n)=>o.jsx(kB,{ref:n,className:xe(I0({variant:"outline"}),"mt-2 sm:mt-0",t),...e}));Mn.displayName=kB.displayName;function rie(){return o.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[o.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:o.jsxs("div",{children:[o.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"系统设置"}),o.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理您的应用偏好设置"})]})}),o.jsxs(ja,{defaultValue:"appearance",className:"w-full",children:[o.jsxs(Wi,{className:"grid w-full grid-cols-2 sm:grid-cols-4 gap-0.5 sm:gap-1 h-auto p-1",children:[o.jsxs(Lt,{value:"appearance",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[o.jsx(yI,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),o.jsx("span",{children:"外观"})]}),o.jsxs(Lt,{value:"security",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[o.jsx(Fee,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),o.jsx("span",{children:"安全"})]}),o.jsxs(Lt,{value:"other",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[o.jsx(Xu,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),o.jsx("span",{children:"其他"})]}),o.jsxs(Lt,{value:"about",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[o.jsx(Oa,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),o.jsx("span",{children:"关于"})]})]}),o.jsxs(gn,{className:"h-[calc(100vh-240px)] sm:h-[calc(100vh-280px)] mt-4 sm:mt-6",children:[o.jsx(un,{value:"appearance",className:"mt-0",children:o.jsx(sie,{})}),o.jsx(un,{value:"security",className:"mt-0",children:o.jsx(iie,{})}),o.jsx(un,{value:"other",className:"mt-0",children:o.jsx(aie,{})}),o.jsx(un,{value:"about",className:"mt-0",children:o.jsx(oie,{})})]})]})]})}function nE(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,l=parseInt(i.substring(2,4),16)/255,c=parseInt(i.substring(4,6),16)/255,d=Math.max(a,l,c),h=Math.min(a,l,c);let m=0,g=0;const x=(d+h)/2;if(d!==h){const y=d-h;switch(g=x>.5?y/(2-d-h):y/(d+h),d){case a:m=((l-c)/y+(l<c?6:0))/6;break;case l:m=((c-a)/y+2)/6;break;case c:m=((a-l)/y+4)/6;break}}return`${Math.round(m*360)} ${Math.round(g*100)}% ${Math.round(x*100)}%`};e.style.setProperty("--primary",s(t)),e.style.removeProperty("--primary-gradient"),e.classList.remove("has-gradient")}}function sie(){const{theme:t,setTheme:e}=Vj(),{enableAnimations:n,setEnableAnimations:r,enableWavesBackground:s,setEnableWavesBackground:i}=JL(),[a,l]=b.useState(()=>localStorage.getItem("accent-color")||"blue");b.useEffect(()=>{const d=localStorage.getItem("accent-color")||"blue";nE(d)},[]);const c=d=>{l(d),localStorage.setItem("accent-color",d),nE(d)};return o.jsxs("div",{className:"space-y-6 sm:space-y-8",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"主题模式"}),o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3 sm:gap-4",children:[o.jsx(A4,{value:"light",current:t,onChange:e,label:"浅色",description:"始终使用浅色主题"}),o.jsx(A4,{value:"dark",current:t,onChange:e,label:"深色",description:"始终使用深色主题"}),o.jsx(A4,{value:"system",current:t,onChange:e,label:"跟随系统",description:"根据系统设置自动切换"})]})]}),o.jsxs("div",{children:[o.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"主题色"}),o.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[o.jsxs("div",{children:[o.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"单色"}),o.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-6 gap-2 sm:gap-3",children:[o.jsx(ua,{value:"blue",current:a,onChange:c,label:"蓝色",colorClass:"bg-blue-500"}),o.jsx(ua,{value:"purple",current:a,onChange:c,label:"紫色",colorClass:"bg-purple-500"}),o.jsx(ua,{value:"green",current:a,onChange:c,label:"绿色",colorClass:"bg-green-500"}),o.jsx(ua,{value:"orange",current:a,onChange:c,label:"橙色",colorClass:"bg-orange-500"}),o.jsx(ua,{value:"pink",current:a,onChange:c,label:"粉色",colorClass:"bg-pink-500"}),o.jsx(ua,{value:"red",current:a,onChange:c,label:"红色",colorClass:"bg-red-500"})]})]}),o.jsxs("div",{children:[o.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"渐变色"}),o.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-6 gap-2 sm:gap-3",children:[o.jsx(ua,{value:"gradient-sunset",current:a,onChange:c,label:"日落",colorClass:"bg-gradient-to-r from-orange-500 to-pink-500"}),o.jsx(ua,{value:"gradient-ocean",current:a,onChange:c,label:"海洋",colorClass:"bg-gradient-to-r from-blue-500 to-cyan-500"}),o.jsx(ua,{value:"gradient-forest",current:a,onChange:c,label:"森林",colorClass:"bg-gradient-to-r from-green-500 to-emerald-500"}),o.jsx(ua,{value:"gradient-aurora",current:a,onChange:c,label:"极光",colorClass:"bg-gradient-to-r from-purple-500 to-pink-500"}),o.jsx(ua,{value:"gradient-fire",current:a,onChange:c,label:"烈焰",colorClass:"bg-gradient-to-r from-red-500 to-orange-500"}),o.jsx(ua,{value:"gradient-twilight",current:a,onChange:c,label:"暮光",colorClass:"bg-gradient-to-r from-indigo-500 to-purple-500"})]})]}),o.jsxs("div",{children:[o.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"自定义颜色"}),o.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 sm:gap-4",children:[o.jsx("div",{className:"flex-1",children:o.jsx("input",{type:"color",value:a.startsWith("#")?a:"#3b82f6",onChange:d=>c(d.target.value),className:"h-10 sm:h-12 w-full rounded-lg border-2 border-border cursor-pointer",title:"选择自定义颜色"})}),o.jsx("div",{className:"flex-1",children:o.jsx(ze,{type:"text",value:a,onChange:d=>c(d.target.value),placeholder:"#3b82f6",className:"font-mono text-sm"})})]}),o.jsx("p",{className:"text-[10px] sm:text-xs text-muted-foreground mt-2",children:"点击色块选择颜色,或手动输入 HEX 颜色代码"})]})]})]}),o.jsxs("div",{children:[o.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"动画效果"}),o.jsxs("div",{className:"space-y-2 sm:space-y-3",children:[o.jsx("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-0.5 flex-1",children:[o.jsx(he,{htmlFor:"animations",className:"text-base font-medium cursor-pointer",children:"启用动画效果"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭后将禁用所有过渡动画和特效,提升性能"})]}),o.jsx(Bt,{id:"animations",checked:n,onCheckedChange:r})]})}),o.jsx("div",{className:"rounded-lg border bg-card p-4",children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-0.5 flex-1",children:[o.jsx(he,{htmlFor:"waves-background",className:"text-base font-medium cursor-pointer",children:"登录页波浪背景"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭后登录页将使用纯色背景,适合低性能设备"})]}),o.jsx(Bt,{id:"waves-background",checked:s,onCheckedChange:i})]})})]})]})]})}function iie(){const t=Zi(),[e,n]=b.useState(""),[r,s]=b.useState(""),[i,a]=b.useState(!1),[l,c]=b.useState(!1),[d,h]=b.useState(!1),[m,g]=b.useState(!1),[x,y]=b.useState(!1),[w,S]=b.useState(!1),[k,j]=b.useState(""),[N,T]=b.useState(!1),{toast:E}=as(),_=b.useMemo(()=>Lse(r),[r]),A=()=>localStorage.getItem("access-token")||"",L=async z=>{try{await navigator.clipboard.writeText(z),y(!0),E({title:"复制成功",description:"Token 已复制到剪贴板"}),setTimeout(()=>y(!1),2e3)}catch{E({title:"复制失败",description:"请手动复制 Token",variant:"destructive"})}},P=async()=>{if(!r.trim()){E({title:"输入错误",description:"请输入新的 Token",variant:"destructive"});return}if(!_.isValid){const z=_.rules.filter(Q=>!Q.passed).map(Q=>Q.label).join(", ");E({title:"格式错误",description:`Token 不符合要求: ${z}`,variant:"destructive"});return}h(!0);try{const z=A(),Q=await fetch("/api/webui/auth/update",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${z}`},body:JSON.stringify({new_token:r.trim()})}),F=await Q.json();Q.ok&&F.success?(localStorage.setItem("access-token",r.trim()),s(""),e&&n(r.trim()),E({title:"更新成功",description:"Access Token 已更新,即将跳转到登录页"}),setTimeout(()=>{localStorage.removeItem("access-token"),t({to:"/auth"})},1500)):E({title:"更新失败",description:F.message||"无法更新 Token",variant:"destructive"})}catch(z){console.error("更新 Token 错误:",z),E({title:"更新失败",description:"连接服务器失败",variant:"destructive"})}finally{h(!1)}},B=async()=>{g(!0);try{const z=A(),Q=await fetch("/api/webui/auth/regenerate",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${z}`}}),F=await Q.json();Q.ok&&F.success?(localStorage.setItem("access-token",F.token),n(F.token),j(F.token),S(!0),T(!1),E({title:"生成成功",description:"新的 Access Token 已生成,请及时保存"})):E({title:"生成失败",description:F.message||"无法生成新 Token",variant:"destructive"})}catch(z){console.error("生成 Token 错误:",z),E({title:"生成失败",description:"连接服务器失败",variant:"destructive"})}finally{g(!1)}},$=async()=>{try{await navigator.clipboard.writeText(k),T(!0),E({title:"复制成功",description:"Token 已复制到剪贴板"})}catch{E({title:"复制失败",description:"请手动复制 Token",variant:"destructive"})}},U=()=>{S(!1),setTimeout(()=>{j(""),T(!1)},300),setTimeout(()=>{localStorage.removeItem("access-token"),t({to:"/auth"})},500)},te=z=>{z||U()};return o.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[o.jsx(Dr,{open:w,onOpenChange:te,children:o.jsxs(Sr,{className:"sm:max-w-md",children:[o.jsxs(kr,{children:[o.jsxs(Or,{className:"flex items-center gap-2",children:[o.jsx(Wa,{className:"h-5 w-5 text-yellow-500"}),"新的 Access Token"]}),o.jsx(ss,{children:"这是您的新 Token请立即保存。关闭此窗口后将跳转到登录页面。"})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"rounded-lg border-2 border-primary/20 bg-primary/5 p-4",children:[o.jsx(he,{className:"text-xs text-muted-foreground mb-2 block",children:"您的新 Token (64位安全令牌)"}),o.jsx("div",{className:"font-mono text-sm break-all select-all bg-background p-3 rounded border",children:k})]}),o.jsx("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3",children:o.jsxs("div",{className:"flex gap-2",children:[o.jsx(Wa,{className:"h-4 w-4 text-yellow-600 dark:text-yellow-500 flex-shrink-0 mt-0.5"}),o.jsxs("div",{className:"text-sm text-yellow-800 dark:text-yellow-300 space-y-1",children:[o.jsx("p",{className:"font-semibold",children:"重要提示"}),o.jsxs("ul",{className:"list-disc list-inside space-y-0.5 text-xs",children:[o.jsx("li",{children:"此 Token 仅显示一次,关闭后无法再查看"}),o.jsx("li",{children:"请立即复制并保存到安全的位置"}),o.jsx("li",{children:"关闭窗口后将自动跳转到登录页面"}),o.jsx("li",{children:"请使用新 Token 重新登录系统"})]})]})]})})]}),o.jsxs(ws,{className:"gap-2 sm:gap-0",children:[o.jsx(de,{variant:"outline",onClick:$,className:"gap-2",children:N?o.jsxs(o.Fragment,{children:[o.jsx(Ro,{className:"h-4 w-4 text-green-500"}),"已复制"]}):o.jsxs(o.Fragment,{children:[o.jsx(Mv,{className:"h-4 w-4"}),"复制 Token"]})}),o.jsx(de,{onClick:U,children:"我已保存,关闭"})]})]})}),o.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[o.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"当前 Access Token"}),o.jsx("div",{className:"space-y-3 sm:space-y-4",children:o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{htmlFor:"current-token",className:"text-sm",children:"您的访问令牌"}),o.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[o.jsxs("div",{className:"relative flex-1",children:[o.jsx(ze,{id:"current-token",type:i?"text":"password",value:e||A(),readOnly:!0,className:"pr-10 font-mono text-sm",placeholder:"点击查看按钮显示 Token"}),o.jsx("button",{onClick:()=>{e||n(A()),a(!i)},className:"absolute right-2 top-1/2 -translate-y-1/2 p-1.5 hover:bg-accent rounded",title:i?"隐藏":"显示",children:i?o.jsx(Rv,{className:"h-4 w-4 text-muted-foreground"}):o.jsx(Ea,{className:"h-4 w-4 text-muted-foreground"})})]}),o.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[o.jsx(de,{variant:"outline",size:"icon",onClick:()=>L(A()),title:"复制到剪贴板",className:"flex-shrink-0",children:x?o.jsx(Ro,{className:"h-4 w-4 text-green-500"}):o.jsx(Mv,{className:"h-4 w-4"})}),o.jsxs(Dn,{children:[o.jsx(rs,{asChild:!0,children:o.jsxs(de,{variant:"outline",disabled:m,className:"gap-2 flex-1 sm:flex-none",children:[o.jsx(Ps,{className:xe("h-4 w-4",m&&"animate-spin")}),o.jsx("span",{className:"hidden sm:inline",children:"重新生成"}),o.jsx("span",{className:"sm:hidden",children:"生成"})]})}),o.jsxs(Nn,{children:[o.jsxs(Cn,{children:[o.jsx(En,{children:"确认重新生成 Token"}),o.jsx(_n,{children:"这将生成一个新的 64 位安全令牌,并使当前 Token 立即失效。 您需要使用新 Token 重新登录系统。此操作不可撤销,确定要继续吗?"})]}),o.jsxs(Tn,{children:[o.jsx(Mn,{children:"取消"}),o.jsx(An,{onClick:B,children:"确认生成"})]})]})]})]})]}),o.jsx("p",{className:"text-[10px] sm:text-xs text-muted-foreground",children:"请妥善保管您的 Access Token不要泄露给他人"})]})})]}),o.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[o.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"自定义 Access Token"}),o.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{htmlFor:"new-token",className:"text-sm",children:"新的访问令牌"}),o.jsxs("div",{className:"relative",children:[o.jsx(ze,{id:"new-token",type:l?"text":"password",value:r,onChange:z=>s(z.target.value),className:"pr-10 font-mono text-sm",placeholder:"输入自定义 Token"}),o.jsx("button",{onClick:()=>c(!l),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1.5 hover:bg-accent rounded",title:l?"隐藏":"显示",children:l?o.jsx(Rv,{className:"h-4 w-4 text-muted-foreground"}):o.jsx(Ea,{className:"h-4 w-4 text-muted-foreground"})})]}),r&&o.jsxs("div",{className:"mt-3 space-y-2 p-3 rounded-lg bg-muted/50",children:[o.jsx("p",{className:"text-sm font-medium text-foreground",children:"Token 安全要求:"}),o.jsx("div",{className:"space-y-1.5",children:_.rules.map(z=>o.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[z.passed?o.jsx(Vc,{className:"h-4 w-4 text-green-500 flex-shrink-0"}):o.jsx(qee,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),o.jsx("span",{className:xe(z.passed?"text-green-600 dark:text-green-400":"text-muted-foreground"),children:z.label})]},z.id))}),_.isValid&&o.jsx("div",{className:"mt-2 pt-2 border-t border-border",children:o.jsxs("div",{className:"flex items-center gap-2 text-sm text-green-600 dark:text-green-400",children:[o.jsx(Ro,{className:"h-4 w-4"}),o.jsx("span",{className:"font-medium",children:"Token 格式正确,可以使用"})]})})]})]}),o.jsx(de,{onClick:P,disabled:d||!_.isValid||!r,className:"w-full sm:w-auto",children:d?"更新中...":"更新自定义 Token"})]})]}),o.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:[o.jsx("h4",{className:"text-sm sm:text-base font-semibold text-yellow-900 dark:text-yellow-200 mb-2",children:"安全提示"}),o.jsxs("ul",{className:"text-xs sm:text-sm text-yellow-800 dark:text-yellow-300 space-y-1 list-disc list-inside",children:[o.jsx("li",{children:"重新生成 Token 会创建系统随机生成的 64 位安全令牌"}),o.jsx("li",{children:"自定义 Token 必须满足所有安全要求才能使用"}),o.jsx("li",{children:"更新 Token 后,旧的 Token 将立即失效"}),o.jsx("li",{children:"请在安全的环境下查看和复制 Token"}),o.jsx("li",{children:"如果怀疑 Token 泄露,请立即重新生成或更新"}),o.jsx("li",{children:"建议使用系统生成的 Token 以获得最高安全性"})]})]})]})}function aie(){const t=Zi(),{toast:e}=as(),[n,r]=b.useState(!1),[s,i]=b.useState(!1);if(s)throw new Error("这是一个手动触发的测试错误,用于验证错误边界组件是否正常工作。");const a=async()=>{r(!0);try{const l=localStorage.getItem("access-token"),c=await fetch("/api/webui/setup/reset",{method:"POST",headers:{Authorization:`Bearer ${l}`}}),d=await c.json();c.ok&&d.success?(e({title:"重置成功",description:"即将进入初次配置向导"}),setTimeout(()=>{t({to:"/setup"})},1e3)):e({title:"重置失败",description:d.message||"无法重置配置状态",variant:"destructive"})}catch(l){console.error("重置配置状态错误:",l),e({title:"重置失败",description:"连接服务器失败",variant:"destructive"})}finally{r(!1)}};return o.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[o.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[o.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"配置向导"}),o.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[o.jsx("div",{className:"space-y-2",children:o.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"重新进行初次配置向导,可以帮助您重新设置系统的基础配置。"})}),o.jsxs(Dn,{children:[o.jsx(rs,{asChild:!0,children:o.jsxs(de,{variant:"outline",disabled:n,className:"gap-2",children:[o.jsx($ee,{className:xe("h-4 w-4",n&&"animate-spin")}),"重新进行初次配置"]})}),o.jsxs(Nn,{children:[o.jsxs(Cn,{children:[o.jsx(En,{children:"确认重新配置"}),o.jsx(_n,{children:"这将带您重新进入初次配置向导。您可以重新设置系统的基础配置项。确定要继续吗?"})]}),o.jsxs(Tn,{children:[o.jsx(Mn,{children:"取消"}),o.jsx(An,{onClick:a,children:"确认重置"})]})]})]})]})]}),o.jsxs("div",{className:"rounded-lg border border-dashed border-yellow-500/50 bg-yellow-500/5 p-4 sm:p-6",children:[o.jsxs("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4 flex items-center gap-2",children:[o.jsx(Wa,{className:"h-5 w-5 text-yellow-500"}),"开发者工具"]}),o.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[o.jsx("div",{className:"space-y-2",children:o.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"以下功能仅供开发调试使用,可能会导致页面崩溃或异常。"})}),o.jsxs(Dn,{children:[o.jsx(rs,{asChild:!0,children:o.jsxs(de,{variant:"destructive",className:"gap-2",children:[o.jsx(Wa,{className:"h-4 w-4"}),"触发测试错误"]})}),o.jsxs(Nn,{children:[o.jsxs(Cn,{children:[o.jsx(En,{children:"确认触发错误"}),o.jsx(_n,{children:"这将手动触发一个 React 错误,用于测试错误边界组件的显示效果。 页面将显示错误界面,您可以通过刷新页面或点击返回首页来恢复。"})]}),o.jsxs(Tn,{children:[o.jsx(Mn,{children:"取消"}),o.jsx(An,{onClick:()=>i(!0),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"确认触发"})]})]})]})]})]})]})}function oie(){return o.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[o.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:o.jsxs("div",{className:"flex items-start gap-3 sm:gap-4",children:[o.jsx("div",{className:"flex-shrink-0 rounded-lg bg-primary/10 p-2 sm:p-3",children:o.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:o.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"})})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("h3",{className:"text-lg sm:text-xl font-bold text-foreground mb-2",children:"开源项目"}),o.jsx("p",{className:"text-sm sm:text-base text-muted-foreground mb-3",children:"本项目在 GitHub 开源,欢迎 Star ⭐ 支持!"}),o.jsxs("a",{href:"https://github.com/Mai-with-u/MaiBot-Dashboard",target:"_blank",rel:"noopener noreferrer",className:xe("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:[o.jsx("svg",{className:"h-4 w-4",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:o.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",o.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.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"})})]})]})]})}),o.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[o.jsxs("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:["关于 ",Wj]}),o.jsxs("div",{className:"space-y-2 text-xs sm:text-sm text-muted-foreground",children:[o.jsxs("p",{children:["版本: ",Uj]}),o.jsx("p",{children:"麦麦MaiBot的现代化 Web 管理界面"})]})]}),o.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[o.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"作者"}),o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx("p",{className:"text-sm font-medium",children:"MaiBot 核心"}),o.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"Mai-with-u"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx("p",{className:"text-sm font-medium",children:"WebUI"}),o.jsxs("p",{className:"text-xs sm:text-sm text-muted-foreground",children:["Mai-with-u ",o.jsx("a",{href:"https://github.com/DrSmoothl",target:"_blank",rel:"noopener noreferrer",className:"text-primary underline",children:"@MotricSeven"})]})]})]})]}),o.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[o.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"技术栈"}),o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 text-xs sm:text-sm text-muted-foreground",children:[o.jsxs("div",{className:"space-y-1.5",children:[o.jsx("p",{className:"font-medium text-foreground",children:"前端框架"}),o.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[o.jsx("li",{children:"React 19.2.0"}),o.jsx("li",{children:"TypeScript 5.7.2"}),o.jsx("li",{children:"Vite 6.0.7"}),o.jsx("li",{children:"TanStack Router 1.94.2"})]})]}),o.jsxs("div",{className:"space-y-1.5",children:[o.jsx("p",{className:"font-medium text-foreground",children:"UI 组件"}),o.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[o.jsx("li",{children:"shadcn/ui"}),o.jsx("li",{children:"Radix UI"}),o.jsx("li",{children:"Tailwind CSS 3.4.17"}),o.jsx("li",{children:"Lucide Icons"})]})]}),o.jsxs("div",{className:"space-y-1.5",children:[o.jsx("p",{className:"font-medium text-foreground",children:"后端"}),o.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[o.jsx("li",{children:"Python 3.12+"}),o.jsx("li",{children:"FastAPI"}),o.jsx("li",{children:"Uvicorn"}),o.jsx("li",{children:"WebSocket"})]})]}),o.jsxs("div",{className:"space-y-1.5",children:[o.jsx("p",{className:"font-medium text-foreground",children:"构建工具"}),o.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[o.jsx("li",{children:"Bun / npm"}),o.jsx("li",{children:"ESLint 9.17.0"}),o.jsx("li",{children:"PostCSS"})]})]})]})]}),o.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[o.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"开源库感谢"}),o.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mb-3",children:"本项目使用了以下优秀的开源库,感谢他们的贡献:"}),o.jsx(gn,{className:"h-[300px] sm:h-[400px]",children:o.jsxs("div",{className:"space-y-4 pr-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("p",{className:"text-sm font-medium text-foreground",children:"UI 框架与组件"}),o.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[o.jsx(Er,{name:"React",description:"用户界面构建库",license:"MIT"}),o.jsx(Er,{name:"shadcn/ui",description:"优雅的 React 组件库",license:"MIT"}),o.jsx(Er,{name:"Radix UI",description:"无样式的可访问组件库",license:"MIT"}),o.jsx(Er,{name:"Tailwind CSS",description:"实用优先的 CSS 框架",license:"MIT"}),o.jsx(Er,{name:"Lucide React",description:"精美的图标库",license:"ISC"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("p",{className:"text-sm font-medium text-foreground",children:"路由与状态管理"}),o.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[o.jsx(Er,{name:"TanStack Router",description:"类型安全的路由库",license:"MIT"}),o.jsx(Er,{name:"Zustand",description:"轻量级状态管理",license:"MIT"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("p",{className:"text-sm font-medium text-foreground",children:"表单处理"}),o.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[o.jsx(Er,{name:"React Hook Form",description:"高性能表单库",license:"MIT"}),o.jsx(Er,{name:"Zod",description:"TypeScript 优先的 schema 验证",license:"MIT"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("p",{className:"text-sm font-medium text-foreground",children:"工具库"}),o.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[o.jsx(Er,{name:"clsx",description:"条件 className 构建工具",license:"MIT"}),o.jsx(Er,{name:"tailwind-merge",description:"Tailwind 类名合并工具",license:"MIT"}),o.jsx(Er,{name:"class-variance-authority",description:"组件变体管理",license:"Apache-2.0"}),o.jsx(Er,{name:"date-fns",description:"现代化日期处理库",license:"MIT"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("p",{className:"text-sm font-medium text-foreground",children:"动画效果"}),o.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[o.jsx(Er,{name:"Framer Motion",description:"React 动画库",license:"MIT"}),o.jsx(Er,{name:"vaul",description:"抽屉组件动画",license:"MIT"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("p",{className:"text-sm font-medium text-foreground",children:"后端框架"}),o.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[o.jsx(Er,{name:"FastAPI",description:"现代化 Python Web 框架",license:"MIT"}),o.jsx(Er,{name:"Uvicorn",description:"ASGI 服务器",license:"BSD-3-Clause"}),o.jsx(Er,{name:"Pydantic",description:"数据验证库",license:"MIT"}),o.jsx(Er,{name:"python-multipart",description:"文件上传支持",license:"Apache-2.0"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("p",{className:"text-sm font-medium text-foreground",children:"开发工具"}),o.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[o.jsx(Er,{name:"TypeScript",description:"JavaScript 的超集",license:"Apache-2.0"}),o.jsx(Er,{name:"Vite",description:"下一代前端构建工具",license:"MIT"}),o.jsx(Er,{name:"ESLint",description:"JavaScript 代码检查工具",license:"MIT"}),o.jsx(Er,{name:"PostCSS",description:"CSS 转换工具",license:"MIT"})]})]})]})})]}),o.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[o.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"开源许可"}),o.jsxs("div",{className:"space-y-3",children:[o.jsx("div",{className:"rounded-lg bg-primary/5 border border-primary/20 p-3 sm:p-4",children:o.jsxs("div",{className:"flex items-start gap-2 sm:gap-3",children:[o.jsx("div",{className:"flex-shrink-0 mt-0.5",children:o.jsx("div",{className:"rounded-md bg-primary/10 px-2 py-1",children:o.jsx("span",{className:"text-xs sm:text-sm font-bold text-primary",children:"GPLv3"})})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"text-sm sm:text-base font-semibold text-foreground mb-1",children:"MaiBot WebUI"}),o.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"本项目采用 GNU General Public License v3.0 开源许可证。 您可以自由地使用、修改和分发本软件,但必须保持相同的开源许可。"})]})]})}),o.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"本项目依赖的所有开源库均遵循各自的开源许可证MIT、Apache-2.0、BSD 等)。 感谢所有开源贡献者的无私奉献。"})]})]})]})}function Er({name:t,description:e,license:n}){return o.jsxs("div",{className:"flex items-start justify-between gap-2 rounded-lg border bg-muted/30 p-2.5 sm:p-3",children:[o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"font-medium text-foreground truncate",children:t}),o.jsx("p",{className:"text-muted-foreground text-xs mt-0.5",children:e})]}),o.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 A4({value:t,current:e,onChange:n,label:r,description:s}){const i=e===t;return o.jsxs("button",{onClick:()=>n(t),className:xe("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&&o.jsx("div",{className:"absolute top-2 right-2 sm:top-3 sm:right-3 h-2 w-2 rounded-full bg-primary"}),o.jsxs("div",{className:"space-y-1",children:[o.jsx("div",{className:"text-sm sm:text-base font-medium",children:r}),o.jsx("div",{className:"text-[10px] sm:text-xs text-muted-foreground",children:s})]}),o.jsxs("div",{className:"mt-2 sm:mt-3 flex gap-1",children:[t==="light"&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-200"}),o.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-300"}),o.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-400"})]}),t==="dark"&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-700"}),o.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-800"}),o.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-900"})]}),t==="system"&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-200 to-slate-700"}),o.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-300 to-slate-800"}),o.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-400 to-slate-900"})]})]})]})}function ua({value:t,current:e,onChange:n,label:r,colorClass:s}){const i=e===t;return o.jsxs("button",{onClick:()=>n(t),className:xe("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&&o.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"}),o.jsxs("div",{className:"flex flex-col items-center gap-1.5 sm:gap-2",children:[o.jsx("div",{className:xe("h-8 w-8 sm:h-10 sm:w-10 rounded-full",s)}),o.jsx("div",{className:"text-[10px] sm:text-xs font-medium text-center",children:r})]})]})}class lie{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),l=this.perm[r]+s,c=this.perm[l],d=this.perm[l+1],h=this.perm[r+1]+s,m=this.perm[h],g=this.perm[h+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[d%12],e,n-1),this.dot(this.grad3[g%12],e-1,n-1),i),a)}}function cie(){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 lie(Math.random()),bounding:null});return b.useEffect(()=>{const s=e.current,i=t.current;if(!s||!i)return;const a=r.current,l=()=>{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,j=32,N=w+200,T=S+30,E=Math.ceil(N/k),_=Math.ceil(T/j),A=(w-k*E)/2,L=(S-j*_)/2;for(let P=0;P<=E;P++){const B=[];for(let U=0;U<=_;U++){const te={x:A+k*P,y:L+j*U,wave:{x:0,y:0},cursor:{x:0,y:0,vx:0,vy:0}};B.push(te)}const $=document.createElementNS("http://www.w3.org/2000/svg","path");i.appendChild($),a.paths.push($),a.lines.push(B)}},d=w=>{const{lines:S,mouse:k,noise:j}=a;S.forEach(N=>{N.forEach(T=>{const E=j.perlin2((T.x+w*.0125)*.002,(T.y+w*.005)*.0015)*12;T.wave.x=Math.cos(E)*32,T.wave.y=Math.sin(E)*16;const _=T.x-k.sx,A=T.y-k.sy,L=Math.hypot(_,A),P=Math.max(175,k.vs);if(L<P){const B=1-L/P,$=Math.cos(L*.001)*B;T.cursor.vx+=Math.cos(k.a)*$*P*k.vs*65e-5,T.cursor.vy+=Math.sin(k.a)*$*P*k.vs*65e-5}T.cursor.vx+=(0-T.cursor.x)*.005,T.cursor.vy+=(0-T.cursor.y)*.005,T.cursor.vx*=.925,T.cursor.vy*=.925,T.cursor.x+=T.cursor.vx*2,T.cursor.y+=T.cursor.vy*2,T.cursor.x=Math.min(100,Math.max(-100,T.cursor.x)),T.cursor.y=Math.min(100,Math.max(-100,T.cursor.y))})})},h=(w,S=!0)=>{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,j)=>{let N=h(k[0],!1),T=`M ${N.x} ${N.y}`;k.forEach((E,_)=>{const A=_===k.length-1;N=h(E,!A),T+=`L ${N.x} ${N.y}`}),S[j].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,j=S.y-S.ly,N=Math.hypot(k,j);S.v=N,S.vs+=(N-S.vs)*.1,S.vs=Math.min(100,S.vs),S.lx=S.x,S.ly=S.y,S.a=Math.atan2(j,k),s&&(s.style.setProperty("--x",`${S.sx}px`),s.style.setProperty("--y",`${S.sy}px`)),d(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=()=>{l(),c()};return l(),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)}},[]),o.jsxs("div",{ref:e,className:"waves-background",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",overflow:"hidden",pointerEvents:"none"},children:[o.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"}}),o.jsx("svg",{ref:t,style:{display:"block",width:"100%",height:"100%"},children:o.jsx("style",{children:`
path {
fill: none;
stroke: hsl(var(--primary) / 0.20);
stroke-width: 1px;
}
`})})]})}function uie(){const t=Zi();b.useEffect(()=>{localStorage.getItem("access-token")||t({to:"/auth"})},[t])}function CB(){return!!localStorage.getItem("access-token")}function die(){const[t,e]=b.useState(""),[n,r]=b.useState(!1),[s,i]=b.useState(""),a=Zi(),{enableWavesBackground:l,setEnableWavesBackground:c}=JL(),{theme:d,setTheme:h}=Vj();b.useEffect(()=>{CB()&&a({to:"/"})},[a]);const g=d==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":d,x=()=>{h(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 j=await fetch("/api/webui/setup/status",{method:"GET",headers:{Authorization:`Bearer ${t.trim()}`}}),N=await j.json();j.ok&&N.is_first_setup?a({to:"/setup"}):a({to:"/"})}else i(k.message||"Token 验证失败,请检查后重试")}catch(S){console.error("Token 验证错误:",S),i("连接服务器失败,请检查网络连接")}finally{r(!1)}};return o.jsxs("div",{className:"relative flex min-h-screen items-center justify-center overflow-hidden bg-background p-4",children:[l&&o.jsx(cie,{}),o.jsxs(qt,{className:"relative z-10 w-full max-w-md shadow-2xl backdrop-blur-xl bg-card/80 border-border/50",children:[o.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"?o.jsx(nk,{className:"h-5 w-5",strokeWidth:2.5,fill:"none"}):o.jsx(rk,{className:"h-5 w-5",strokeWidth:2.5,fill:"none"})}),o.jsxs(Fn,{className:"space-y-4 text-center",children:[o.jsx("div",{className:"mx-auto flex h-16 w-16 items-center justify-center rounded-2xl bg-primary/10",children:o.jsx(y9,{className:"h-8 w-8 text-primary",strokeWidth:2,fill:"none"})}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(qn,{className:"text-2xl font-bold",children:"欢迎使用 MaiBot"}),o.jsx(ts,{className:"text-base",children:"请输入您的 Access Token 以继续访问系统"})]})]}),o.jsx(Gn,{children:o.jsxs("form",{onSubmit:y,className:"space-y-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{htmlFor:"token",className:"text-sm font-medium",children:"Access Token"}),o.jsxs("div",{className:"relative",children:[o.jsx(bI,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground",strokeWidth:2,fill:"none"}),o.jsx(ze,{id:"token",type:"password",placeholder:"请输入您的 Access Token",value:t,onChange:w=>e(w.target.value),className:xe("pl-10",s&&"border-red-500 focus-visible:ring-red-500"),disabled:n,autoFocus:!0,autoComplete:"off"})]})]}),s&&o.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:[o.jsx(Uc,{className:"h-4 w-4 flex-shrink-0",strokeWidth:2,fill:"none"}),o.jsx("span",{children:s})]}),o.jsx(de,{type:"submit",className:"w-full",disabled:n,children:n?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}),"验证中..."]}):"验证并进入"}),o.jsxs(Dr,{children:[o.jsx(Of,{asChild:!0,children:o.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:[o.jsx(Wy,{className:"h-4 w-4",strokeWidth:2,fill:"none"}),"我没有 Token我该去哪里获得 Token"]})}),o.jsxs(Sr,{className:"sm:max-w-md",children:[o.jsxs(kr,{children:[o.jsxs(Or,{className:"flex items-center gap-2",children:[o.jsx(y9,{className:"h-5 w-5 text-primary",strokeWidth:2,fill:"none"}),"如何获取 Access Token"]}),o.jsx(ss,{children:"Access Token 是访问 MaiBot WebUI 的唯一凭证,请按以下方式获取"})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsx(Hee,{className:"h-5 w-5 text-primary flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),o.jsxs("div",{className:"flex-1 space-y-2",children:[o.jsx("h4",{className:"font-semibold text-sm",children:"方式一:查看启动日志"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"在 MaiBot 启动时,控制台会显示 WebUI Access Token。"}),o.jsxs("div",{className:"rounded bg-background p-2 font-mono text-xs",children:[o.jsx("p",{className:"text-muted-foreground",children:"🔑 WebUI Access Token: abc123..."}),o.jsx("p",{className:"text-muted-foreground",children:"💡 请使用此 Token 登录 WebUI"})]})]})]})}),o.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsx(zl,{className:"h-5 w-5 text-primary flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),o.jsxs("div",{className:"flex-1 space-y-2",children:[o.jsx("h4",{className:"font-semibold text-sm",children:"方式二:查看配置文件"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Token 保存在项目根目录的配置文件中:"}),o.jsx("div",{className:"rounded bg-background p-2 font-mono text-xs break-all",children:o.jsx("code",{className:"text-primary",children:"data/webui.json"})}),o.jsxs("p",{className:"text-xs text-muted-foreground",children:["打开此文件,复制 ",o.jsx("code",{className:"px-1 py-0.5 bg-background rounded",children:"access_token"})," 字段的值"]})]})]})}),o.jsx("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3",children:o.jsxs("div",{className:"flex gap-2",children:[o.jsx(Uc,{className:"h-4 w-4 text-yellow-600 dark:text-yellow-500 flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),o.jsxs("div",{className:"text-sm text-yellow-800 dark:text-yellow-300 space-y-1",children:[o.jsx("p",{className:"font-semibold",children:"安全提示"}),o.jsxs("ul",{className:"list-disc list-inside space-y-0.5 text-xs",children:[o.jsx("li",{children:"请妥善保管您的 Token不要泄露给他人"}),o.jsx("li",{children:"如需重置 Token请在登录后前往系统设置"})]})]})]})})]})]})]}),o.jsxs(Dn,{children:[o.jsx(rs,{asChild:!0,children:o.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:[o.jsx(tk,{className:"h-4 w-4",strokeWidth:2,fill:"none"}),"我觉得这个界面很卡怎么办?"]})}),o.jsxs(Nn,{children:[o.jsxs(Cn,{children:[o.jsxs(En,{className:"flex items-center gap-2",children:[o.jsx(tk,{className:"h-5 w-5 text-primary",strokeWidth:2,fill:"none"}),"关闭背景动画"]}),o.jsx(_n,{children:"背景动画可能会在低性能设备上造成卡顿。关闭动画可以显著提升界面流畅度。"})]}),o.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:o.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭动画后,背景将变为纯色,但不影响任何功能的使用。您可以随时在系统设置中重新开启动画。"})}),o.jsxs(Tn,{children:[o.jsx(Mn,{children:"取消"}),o.jsx(An,{onClick:()=>c(!1),children:"关闭动画"})]})]})]})]})})]}),o.jsx("div",{className:"absolute bottom-4 left-0 right-0 text-center text-xs text-muted-foreground",children:o.jsx("p",{children:Bse})})]})}const Mr=b.forwardRef(({className:t,...e},n)=>o.jsx("textarea",{className:xe("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}));Mr.displayName="Textarea";var hie=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],fie=hie.reduce((t,e)=>{const n=Fy(`Primitive.${e}`),r=b.forwardRef((s,i)=>{const{asChild:a,...l}=s,c=a?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(c,{...l,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),mie="Separator",rE="horizontal",pie=["horizontal","vertical"],TB=b.forwardRef((t,e)=>{const{decorative:n,orientation:r=rE,...s}=t,i=gie(r)?r:rE,l=n?{role:"none"}:{"aria-orientation":i==="vertical"?i:void 0,role:"separator"};return o.jsx(fie.div,{"data-orientation":i,...l,...s,ref:e})});TB.displayName=mie;function gie(t){return pie.includes(t)}var EB=TB;const L0=b.forwardRef(({className:t,orientation:e="horizontal",decorative:n=!0,...r},s)=>o.jsx(EB,{ref:s,decorative:n,orientation:e,className:xe("shrink-0 bg-border",e==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",t),...r}));L0.displayName=EB.displayName;const xie=kf("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 Xn({className:t,variant:e,...n}){return o.jsx("div",{className:xe(xie({variant:e}),t),...n})}function vie({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 o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{className:"space-y-3",children:[o.jsx(he,{htmlFor:"qq_account",children:"QQ账号 *"}),o.jsx(ze,{id:"qq_account",type:"number",placeholder:"请输入机器人的QQ账号",value:t.qq_account||"",onChange:s=>e({...t,qq_account:Number(s.target.value)})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人登录使用的QQ账号"})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(he,{htmlFor:"nickname",children:"昵称 *"}),o.jsx(ze,{id:"nickname",placeholder:"请输入机器人的昵称",value:t.nickname,onChange:s=>e({...t,nickname:s.target.value})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人的主要称呼名称"})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(he,{children:"别名"}),o.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:t.alias_names.map((s,i)=>o.jsxs(Xn,{variant:"secondary",className:"gap-1",children:[s,o.jsx("button",{type:"button",onClick:()=>r(i),className:"ml-1 hover:text-destructive",children:o.jsx(_p,{className:"h-3 w-3"})})]},i))}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(ze,{id:"alias_input",placeholder:"输入别名后按回车添加",onKeyPress:s=>{s.key==="Enter"&&(n(s.target.value),s.target.value="")}}),o.jsx(de,{type:"button",variant:"outline",onClick:()=>{const s=document.getElementById("alias_input");s&&(n(s.value),s.value="")},children:"添加"})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人的其他称呼,可以添加多个"})]})]})}function yie({config:t,onChange:e}){return o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{className:"space-y-3",children:[o.jsx(he,{htmlFor:"personality",children:"人格特征 *"}),o.jsx(Mr,{id:"personality",placeholder:"描述机器人的人格特质和身份特征建议120字以内",value:t.personality,onChange:n=>e({...t,personality:n.target.value}),rows:3}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"例如:是一个女大学生,现在在读大二,会刷贴吧"})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(he,{htmlFor:"reply_style",children:"表达风格 *"}),o.jsx(Mr,{id:"reply_style",placeholder:"描述机器人说话的表达风格、表达习惯",value:t.reply_style,onChange:n=>e({...t,reply_style:n.target.value}),rows:3}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"例如:回复平淡一些,简短一些,说中文,参考贴吧、知乎和微博的回复风格"})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(he,{htmlFor:"interest",children:"兴趣 *"}),o.jsx(Mr,{id:"interest",placeholder:"描述机器人感兴趣的话题",value:t.interest,onChange:n=>e({...t,interest:n.target.value}),rows:2}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"会影响机器人对什么话题进行回复"})]}),o.jsx(L0,{}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(he,{htmlFor:"plan_style",children:"群聊说话规则 *"}),o.jsx(Mr,{id:"plan_style",placeholder:"机器人在群聊中的行为风格和规则",value:t.plan_style,onChange:n=>e({...t,plan_style:n.target.value}),rows:4}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"定义机器人在群聊中如何行动,例如回复频率、条件等"})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(he,{htmlFor:"private_plan_style",children:"私聊说话规则 *"}),o.jsx(Mr,{id:"private_plan_style",placeholder:"机器人在私聊中的行为风格和规则",value:t.private_plan_style,onChange:n=>e({...t,private_plan_style:n.target.value}),rows:3}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"定义机器人在私聊中的行为方式"})]})]})}function bie({config:t,onChange:e}){return o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(he,{htmlFor:"emoji_chance",children:"表情包激活概率"}),o.jsxs("span",{className:"text-sm text-muted-foreground",children:[(t.emoji_chance*100).toFixed(0),"%"]})]}),o.jsx(ze,{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)})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人发送表情包的概率"})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(he,{htmlFor:"max_reg_num",children:"最大表情包数量"}),o.jsx(ze,{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)})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人最多保存的表情包数量"})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(he,{htmlFor:"do_replace",children:"达到最大数量时替换"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"开启后会删除旧表情包,关闭则不再收集新表情包"})]}),o.jsx(Bt,{id:"do_replace",checked:t.do_replace,onCheckedChange:n=>e({...t,do_replace:n})})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(he,{htmlFor:"check_interval",children:"检查间隔(分钟)"}),o.jsx(ze,{id:"check_interval",type:"number",min:"1",max:"120",value:t.check_interval,onChange:n=>e({...t,check_interval:Number(n.target.value)})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"检查表情包注册、破损、删除的时间间隔"})]}),o.jsx(L0,{}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(he,{htmlFor:"steal_emoji",children:"偷取表情包"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人将一些表情包据为己有"})]}),o.jsx(Bt,{id:"steal_emoji",checked:t.steal_emoji,onCheckedChange:n=>e({...t,steal_emoji:n})})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(he,{htmlFor:"content_filtration",children:"启用表情包过滤"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"只保存符合要求的表情包"})]}),o.jsx(Bt,{id:"content_filtration",checked:t.content_filtration,onCheckedChange:n=>e({...t,content_filtration:n})})]}),t.content_filtration&&o.jsxs("div",{className:"space-y-3",children:[o.jsx(he,{htmlFor:"filtration_prompt",children:"过滤要求"}),o.jsx(ze,{id:"filtration_prompt",placeholder:"例如:符合公序良俗",value:t.filtration_prompt,onChange:n=>e({...t,filtration_prompt:n.target.value})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"描述表情包应该符合的要求"})]})]})}function wie({config:t,onChange:e}){return o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(he,{htmlFor:"enable_tool",children:"启用工具系统"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人使用各种工具增强功能"})]}),o.jsx(Bt,{id:"enable_tool",checked:t.enable_tool,onCheckedChange:n=>e({...t,enable_tool:n})})]}),o.jsx(L0,{}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(he,{htmlFor:"enable_mood",children:"启用情绪系统"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"让机器人具有情绪变化能力"})]}),o.jsx(Bt,{id:"enable_mood",checked:t.enable_mood,onCheckedChange:n=>e({...t,enable_mood:n})})]}),t.enable_mood&&o.jsxs("div",{className:"ml-6 space-y-6 border-l-2 border-primary/20 pl-6",children:[o.jsxs("div",{className:"space-y-3",children:[o.jsx(he,{htmlFor:"mood_update_threshold",children:"情绪更新阈值"}),o.jsx(ze,{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)})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"值越高,情绪更新越慢"})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(he,{htmlFor:"emotion_style",children:"情感特征"}),o.jsx(Mr,{id:"emotion_style",placeholder:"描述情绪的变化情况,例如:情绪较为稳定,但遭遇特定事件时起伏较大",value:t.emotion_style||"",onChange:n=>e({...t,emotion_style:n.target.value}),rows:2}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"影响机器人的情绪变化方式"})]})]}),o.jsx(L0,{}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(he,{htmlFor:"all_global",children:"启用全局黑话模式"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人学习和使用群组黑话"})]}),o.jsx(Bt,{id:"all_global",checked:t.all_global,onCheckedChange:n=>e({...t,all_global:n})})]})]})}function Sie({config:t,onChange:e}){const[n,r]=b.useState(!1);return o.jsxs("div",{className:"space-y-6",children:[o.jsx("div",{className:"rounded-lg bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-4",children:o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsx("div",{className:"mt-0.5",children:o.jsx("svg",{className:"h-5 w-5 text-blue-600 dark:text-blue-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.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"})})}),o.jsxs("div",{className:"flex-1 text-sm",children:[o.jsx("p",{className:"font-medium text-blue-900 dark:text-blue-100 mb-1",children:"关于硅基流动 (SiliconFlow)"}),o.jsx("p",{className:"text-blue-700 dark:text-blue-300 mb-2",children:"硅基流动提供了完整的模型覆盖,包括 DeepSeek V3、Qwen、视觉模型、语音识别和嵌入模型。 只需一个 API Key 即可使用麦麦的所有功能!"}),o.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",o.jsx(Ah,{className:"h-3 w-3"})]})]})]})}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(he,{htmlFor:"siliconflow_api_key",children:"SiliconFlow API Key *"}),o.jsxs("div",{className:"relative",children:[o.jsx(ze,{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"}),o.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?o.jsx(Rv,{className:"h-4 w-4 text-muted-foreground"}):o.jsx(Ea,{className:"h-4 w-4 text-muted-foreground"})})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"请输入您的硅基流动 API 密钥。获取后,麦麦将自动配置所有必需的模型。"})]}),o.jsxs("div",{className:"rounded-lg bg-muted/50 p-4 text-sm space-y-2",children:[o.jsx("p",{className:"font-medium",children:"将自动配置以下模型:"}),o.jsxs("ul",{className:"list-disc list-inside space-y-1 text-muted-foreground ml-2",children:[o.jsx("li",{children:"DeepSeek V3 - 主要对话和工具模型"}),o.jsx("li",{children:"Qwen3 30B - 高频小任务和工具调用"}),o.jsx("li",{children:"Qwen3 VL 30B - 图像识别"}),o.jsx("li",{children:"SenseVoice - 语音识别"}),o.jsx("li",{children:"BGE-M3 - 文本嵌入"}),o.jsx("li",{children:"知识库相关模型 (LPMM)"})]})]}),o.jsx("div",{className:"rounded-lg border border-amber-200 dark:border-amber-800 bg-amber-50 dark:bg-amber-950/30 p-4",children:o.jsxs("p",{className:"text-sm text-amber-900 dark:text-amber-100",children:[o.jsx("span",{className:"font-medium",children:"💡 提示:"}),'完成向导后,您可以在"系统设置 → 模型配置"中添加更多 API 提供商和模型。']})})]})}async function St(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 Dt(){return{"Content-Type":"application/json",Authorization:`Bearer ${localStorage.getItem("access-token")}`}}async function kie(){const t=await St("/api/webui/config/bot",{method:"GET",headers:Dt()});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 Oie(){const t=await St("/api/webui/config/bot",{method:"GET",headers:Dt()});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 jie(){const t=await St("/api/webui/config/bot",{method:"GET",headers:Dt()});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 Nie(){const t=await St("/api/webui/config/bot",{method:"GET",headers:Dt()});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 Cie(){const t=await St("/api/webui/config/model",{method:"GET",headers:Dt()});if(!t.ok)throw new Error("读取模型配置失败");return{api_key:((await t.json()).config.api_providers||[]).find(i=>i.name==="SiliconFlow")?.api_key||""}}async function Tie(t){const e=await St("/api/webui/config/bot/section/bot",{method:"POST",headers:Dt(),body:JSON.stringify(t)});if(!e.ok){const n=await e.json();throw new Error(n.detail||"保存Bot基础配置失败")}return await e.json()}async function Eie(t){const e=await St("/api/webui/config/bot/section/personality",{method:"POST",headers:Dt(),body:JSON.stringify(t)});if(!e.ok){const n=await e.json();throw new Error(n.detail||"保存人格配置失败")}return await e.json()}async function _ie(t){const e=await St("/api/webui/config/bot/section/emoji",{method:"POST",headers:Dt(),body:JSON.stringify(t)});if(!e.ok){const n=await e.json();throw new Error(n.detail||"保存表情包配置失败")}return await e.json()}async function Aie(t){const e=[];e.push(St("/api/webui/config/bot/section/tool",{method:"POST",headers:Dt(),body:JSON.stringify({enable_tool:t.enable_tool})})),e.push(St("/api/webui/config/bot/section/jargon",{method:"POST",headers:Dt(),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(St("/api/webui/config/bot/section/mood",{method:"POST",headers:Dt(),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 Mie(t){const e=await St("/api/webui/config/model",{method:"GET",headers:Dt()});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},l=await St("/api/webui/config/model",{method:"POST",headers:Dt(),body:JSON.stringify(a)});if(!l.ok){const c=await l.json();throw new Error(c.detail||"保存模型配置失败")}return await l.json()}async function sE(){const t=localStorage.getItem("access-token"),e=await St("/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 ib(){const t=await St("/api/webui/system/restart",{method:"POST",headers:Dt()});if(!t.ok){const e=await t.json();throw new Error(e.detail||"重启失败")}return await t.json()}async function Rie(){const t=await St("/api/webui/system/status",{method:"GET",headers:Dt()});if(!t.ok){const e=await t.json();throw new Error(e.detail||"获取状态失败")}return await t.json()}function Die(){const t=Zi(),{toast:e}=as(),[n,r]=b.useState(0),[s,i]=b.useState(!1),[a,l]=b.useState(!1),[c,d]=b.useState(!0),[h,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}),[j,N]=b.useState({api_key:""}),[T,E]=b.useState(!1),[_,A]=b.useState(""),L=[{id:"bot-basic",title:"Bot基础",description:"配置机器人的基本信息",icon:a0},{id:"personality",title:"人格配置",description:"定义机器人的性格和说话风格",icon:Dv},{id:"emoji",title:"表情包",description:"配置表情包相关设置",icon:_j},{id:"other",title:"其他设置",description:"工具、情绪系统等配置",icon:Xu},{id:"siliconflow",title:"API配置",description:"配置硅基流动API密钥",icon:bI}],P=(n+1)/L.length*100;b.useEffect(()=>{(async()=>{try{d(!0);const[Y,J,X,R,ie]=await Promise.all([kie(),Oie(),jie(),Nie(),Cie()]);m(Y),x(J),w(X),k(R),N(ie)}catch(Y){e({title:"加载配置失败",description:Y instanceof Error?Y.message:"无法加载现有配置,将使用默认值",variant:"destructive"})}finally{d(!1)}})()},[e]);const B=async()=>{l(!0);try{switch(n){case 0:await Tie(h);break;case 1:await Eie(g);break;case 2:await _ie(y);break;case 3:await Aie(S);break;case 4:await Mie(j);break}return e({title:"保存成功",description:`${L[n].title}配置已保存`}),!0}catch(F){return e({title:"保存失败",description:F instanceof Error?F.message:"未知错误",variant:"destructive"}),!1}finally{l(!1)}},$=async()=>{await B()&&n<L.length-1&&r(n+1)},U=()=>{n>0&&r(n-1)},te=async()=>{i(!0),E(!0);try{if(A("正在保存API配置..."),!await B()){i(!1),E(!1);return}A("正在完成初始化..."),await sE(),A("正在重启麦麦..."),await ib(),e({title:"配置完成",description:"麦麦正在重启以应用新配置..."}),A("等待麦麦重启完成...");const Y=60;let J=0,X=!1;for(;J<Y&&!X;){await new Promise(R=>setTimeout(R,1e3));try{(await Rie()).running&&(X=!0,A("重启成功!正在跳转..."))}catch{J++}}if(!X)throw new Error("重启超时,请手动检查麦麦状态");setTimeout(()=>{t({to:"/"})},1e3)}catch(F){E(!1),e({title:"配置失败",description:F instanceof Error?F.message:"未知错误",variant:"destructive"})}finally{i(!1)}},z=async()=>{try{await sE(),t({to:"/"})}catch(F){e({title:"跳过失败",description:F instanceof Error?F.message:"未知错误",variant:"destructive"})}},Q=()=>{switch(n){case 0:return o.jsx(vie,{config:h,onChange:m});case 1:return o.jsx(yie,{config:g,onChange:x});case 2:return o.jsx(bie,{config:y,onChange:w});case 3:return o.jsx(wie,{config:S,onChange:k});case 4:return o.jsx(Sie,{config:j,onChange:N});default:return null}};return o.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&&o.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm",children:o.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:[o.jsx("div",{className:"flex h-20 w-20 items-center justify-center rounded-full bg-primary/10",children:o.jsx(Po,{className:"h-10 w-10 animate-spin text-primary"})}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("h2",{className:"text-2xl font-bold",children:"正在重启麦麦"}),o.jsx("p",{className:"text-muted-foreground",children:_})]}),o.jsx("div",{className:"w-full",children:o.jsx("div",{className:"h-2 w-full overflow-hidden rounded-full bg-secondary",children:o.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"}})})}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"请稍候,这可能需要一分钟..."})]})}),o.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[o.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"}),o.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?o.jsxs("div",{className:"relative z-10 text-center",children:[o.jsx("div",{className:"mx-auto mb-4 flex h-16 w-16 items-center justify-center",children:o.jsx("div",{className:"h-12 w-12 animate-spin rounded-full border-4 border-primary border-t-transparent"})}),o.jsx("p",{className:"text-lg font-medium",children:"加载配置中..."}),o.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:"正在读取现有配置"})]}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"relative z-10 w-full max-w-4xl",children:[o.jsxs("div",{className:"mb-6 md:mb-8 text-center",children:[o.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:o.jsx(Qee,{className:"h-6 w-6 md:h-8 md:w-8 text-primary",strokeWidth:2,fill:"none"})}),o.jsx("h1",{className:"mb-2 text-2xl md:text-3xl font-bold",children:"首次配置向导"}),o.jsxs("p",{className:"text-sm md:text-base text-muted-foreground",children:["让我们一起完成 ",Wj," 的初始配置"]})]}),o.jsxs("div",{className:"mb-6 md:mb-8",children:[o.jsxs("div",{className:"mb-2 flex items-center justify-between text-xs md:text-sm",children:[o.jsxs("span",{className:"text-muted-foreground",children:["步骤 ",n+1," / ",L.length]}),o.jsxs("span",{className:"font-medium text-primary",children:[Math.round(P),"%"]})]}),o.jsx(Lp,{value:P,className:"h-2"})]}),o.jsx("div",{className:"mb-6 md:mb-8 flex justify-between",children:L.map((F,Y)=>{const J=F.icon;return o.jsxs("div",{className:xe("flex flex-1 flex-col items-center gap-1 md:gap-2",Y<L.length-1&&"relative"),children:[Y<L.length-1&&o.jsx("div",{className:xe("absolute left-1/2 top-3 md:top-4 h-0.5 w-full",Y<n?"bg-primary":"bg-border")}),o.jsx("div",{className:xe("relative z-10 flex h-6 w-6 md:h-8 md:w-8 items-center justify-center rounded-full border-2 transition-all",Y===n||Y<n?"border-primary bg-primary text-primary-foreground":"border-border bg-background text-muted-foreground"),children:Y<n?o.jsx(Vc,{className:"h-3 w-3 md:h-4 md:w-4",strokeWidth:2.5,fill:"none"}):o.jsx(J,{className:"h-3 w-3 md:h-4 md:w-4"})}),o.jsx("span",{className:xe("text-[10px] md:text-xs text-center max-w-[60px] md:max-w-none truncate md:whitespace-normal",Y===n?"font-medium text-foreground":"text-muted-foreground"),title:F.title,children:F.title})]},F.id)})}),o.jsx(qt,{className:"mb-6 md:mb-8 shadow-lg",children:o.jsx(Gn,{className:"p-4 md:p-8",children:o.jsxs("div",{className:"min-h-[300px] md:min-h-[400px]",children:[o.jsxs("div",{className:"mb-4 md:mb-6",children:[o.jsx("h2",{className:"mb-2 text-xl md:text-2xl font-semibold",children:L[n].title}),o.jsx("p",{className:"text-sm md:text-base text-muted-foreground",children:L[n].description})]}),o.jsx(gn,{className:"h-[400px] md:h-[500px]",children:o.jsx("div",{className:"pr-2",children:Q()})})]})})}),o.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-3 sm:gap-0",children:[o.jsx(de,{variant:"outline",onClick:U,disabled:n===0||a,className:"w-full sm:w-auto order-2 sm:order-1",children:"上一步"}),o.jsxs("div",{className:"flex gap-2 w-full sm:w-auto order-1 sm:order-2",children:[o.jsxs(Dn,{children:[o.jsx(rs,{asChild:!0,children:o.jsxs(de,{variant:"ghost",className:"flex-1 sm:flex-none gap-2",disabled:a||s,children:[o.jsx(Vee,{className:"h-4 w-4",strokeWidth:2,fill:"none"}),"跳过向导"]})}),o.jsxs(Nn,{children:[o.jsxs(Cn,{children:[o.jsx(En,{children:"确认跳过配置向导"}),o.jsx(_n,{children:"您可以随时在系统设置中重新进入配置向导。确定要跳过吗?"})]}),o.jsxs(Tn,{children:[o.jsx(Mn,{children:"取消"}),o.jsx(An,{onClick:z,children:"确认跳过"})]})]})]}),n===L.length-1?o.jsx(de,{onClick:te,disabled:s||a,className:"flex-1 sm:flex-none",children:s||a?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}),a?"保存中...":"完成中..."]}):o.jsxs(o.Fragment,{children:["完成配置",o.jsx(Vc,{className:"ml-2 h-4 w-4",strokeWidth:2,fill:"none"})]})}):o.jsx(de,{onClick:$,disabled:a,className:"flex-1 sm:flex-none",children:a?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}),"保存中..."]}):o.jsxs(o.Fragment,{children:["下一步",o.jsx(Uee,{className:"ml-2 h-4 w-4",strokeWidth:2,fill:"none"})]})})]})]})]}),o.jsx("div",{className:"relative z-10 mt-6 md:mt-8 text-center text-xs text-muted-foreground",children:o.jsx("p",{children:"您可以随时在设置中修改这些配置"})})]})]})}function _B(){const t=Zi();return o.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background p-4",children:o.jsxs("div",{className:"w-full max-w-2xl text-center",children:[o.jsxs("div",{className:"relative mb-8",children:[o.jsx("h1",{className:"text-[150px] font-black leading-none text-primary/10 select-none sm:text-[200px]",children:"404"}),o.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:o.jsx(Ni,{className:"h-20 w-20 text-primary/30 sm:h-24 sm:w-24"})})]}),o.jsxs("div",{className:"space-y-4 mb-8",children:[o.jsx("h2",{className:"text-2xl font-bold text-foreground sm:text-3xl",children:"页面未找到"}),o.jsx("p",{className:"text-base text-muted-foreground sm:text-lg max-w-md mx-auto",children:"抱歉,您访问的页面不存在或已被移除。请检查 URL 是否正确,或返回首页继续浏览。"})]}),o.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-center gap-4",children:[o.jsxs(de,{size:"lg",onClick:()=>t({to:"/"}),className:"gap-2 w-full sm:w-auto",children:[o.jsx(D0,{className:"h-4 w-4"}),"返回首页"]}),o.jsxs(de,{size:"lg",variant:"outline",onClick:()=>window.history.back(),className:"gap-2 w-full sm:w-auto",children:[o.jsx(wI,{className:"h-4 w-4"}),"返回上一页"]})]}),o.jsx("div",{className:"mt-12 pt-8 border-t border-border",children:o.jsx("p",{className:"text-sm text-muted-foreground",children:"如果您认为这是一个错误,请联系系统管理员"})})]})})}var AB=["PageUp","PageDown"],MB=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],RB={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},jf="Slider",[mk,Pie,zie]=By(jf),[DB]=Ra(jf,[zie]),[Iie,ab]=DB(jf),PB=b.forwardRef((t,e)=>{const{name:n,min:r=0,max:s=100,step:i=1,orientation:a="horizontal",disabled:l=!1,minStepsBetweenThumbs:c=0,defaultValue:d=[r],value:h,onValueChange:m=()=>{},onValueCommit:g=()=>{},inverted:x=!1,form:y,...w}=t,S=b.useRef(new Set),k=b.useRef(0),N=a==="horizontal"?Lie:Bie,[T=[],E]=Xl({prop:h,defaultProp:d,onChange:$=>{[...S.current][k.current]?.focus(),m($)}}),_=b.useRef(T);function A($){const U=Qie(T,$);B($,U)}function L($){B($,k.current)}function P(){const $=_.current[k.current];T[k.current]!==$&&g(T)}function B($,U,{commit:te}={commit:!1}){const z=Gie(i),Q=Xie(Math.round(($-r)/i)*i+r,z),F=Sj(Q,[r,s]);E((Y=[])=>{const J=$ie(Y,F,U);if(Wie(J,c*i)){k.current=J.indexOf(F);const X=String(J)!==String(Y);return X&&te&&g(J),X?J:Y}else return Y})}return o.jsx(Iie,{scope:t.__scopeSlider,name:n,disabled:l,min:r,max:s,valueIndexToChangeRef:k,thumbs:S.current,values:T,orientation:a,form:y,children:o.jsx(mk.Provider,{scope:t.__scopeSlider,children:o.jsx(mk.Slot,{scope:t.__scopeSlider,children:o.jsx(N,{"aria-disabled":l,"data-disabled":l?"":void 0,...w,ref:e,onPointerDown:nt(w.onPointerDown,()=>{l||(_.current=T)}),min:r,max:s,inverted:x,onSlideStart:l?void 0:A,onSlideMove:l?void 0:L,onSlideEnd:l?void 0:P,onHomeKeyDown:()=>!l&&B(r,0,{commit:!0}),onEndKeyDown:()=>!l&&B(s,T.length-1,{commit:!0}),onStepKeyDown:({event:$,direction:U})=>{if(!l){const Q=AB.includes($.key)||$.shiftKey&&MB.includes($.key)?10:1,F=k.current,Y=T[F],J=i*Q*U;B(Y+J,F,{commit:!0})}}})})})})});PB.displayName=jf;var[zB,IB]=DB(jf,{startEdge:"left",endEdge:"right",size:"width",direction:1}),Lie=b.forwardRef((t,e)=>{const{min:n,max:r,dir:s,inverted:i,onSlideStart:a,onSlideMove:l,onSlideEnd:c,onStepKeyDown:d,...h}=t,[m,g]=b.useState(null),x=Yn(e,N=>g(N)),y=b.useRef(void 0),w=Ep(s),S=w==="ltr",k=S&&!i||!S&&i;function j(N){const T=y.current||m.getBoundingClientRect(),E=[0,T.width],A=Xj(E,k?[n,r]:[r,n]);return y.current=T,A(N-T.left)}return o.jsx(zB,{scope:t.__scopeSlider,startEdge:k?"left":"right",endEdge:k?"right":"left",direction:k?1:-1,size:"width",children:o.jsx(LB,{dir:w,"data-orientation":"horizontal",...h,ref:x,style:{...h.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:N=>{const T=j(N.clientX);a?.(T)},onSlideMove:N=>{const T=j(N.clientX);l?.(T)},onSlideEnd:()=>{y.current=void 0,c?.()},onStepKeyDown:N=>{const E=RB[k?"from-left":"from-right"].includes(N.key);d?.({event:N,direction:E?-1:1})}})})}),Bie=b.forwardRef((t,e)=>{const{min:n,max:r,inverted:s,onSlideStart:i,onSlideMove:a,onSlideEnd:l,onStepKeyDown:c,...d}=t,h=b.useRef(null),m=Yn(e,h),g=b.useRef(void 0),x=!s;function y(w){const S=g.current||h.current.getBoundingClientRect(),k=[0,S.height],N=Xj(k,x?[r,n]:[n,r]);return g.current=S,N(w-S.top)}return o.jsx(zB,{scope:t.__scopeSlider,startEdge:x?"bottom":"top",endEdge:x?"top":"bottom",size:"height",direction:x?1:-1,children:o.jsx(LB,{"data-orientation":"vertical",...d,ref:m,style:{...d.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,l?.()},onStepKeyDown:w=>{const k=RB[x?"from-bottom":"from-top"].includes(w.key);c?.({event:w,direction:k?-1:1})}})})}),LB=b.forwardRef((t,e)=>{const{__scopeSlider:n,onSlideStart:r,onSlideMove:s,onSlideEnd:i,onHomeKeyDown:a,onEndKeyDown:l,onStepKeyDown:c,...d}=t,h=ab(jf,n);return o.jsx(xn.span,{...d,ref:e,onKeyDown:nt(t.onKeyDown,m=>{m.key==="Home"?(a(m),m.preventDefault()):m.key==="End"?(l(m),m.preventDefault()):AB.concat(MB).includes(m.key)&&(c(m),m.preventDefault())}),onPointerDown:nt(t.onPointerDown,m=>{const g=m.target;g.setPointerCapture(m.pointerId),m.preventDefault(),h.thumbs.has(g)?g.focus():r(m)}),onPointerMove:nt(t.onPointerMove,m=>{m.target.hasPointerCapture(m.pointerId)&&s(m)}),onPointerUp:nt(t.onPointerUp,m=>{const g=m.target;g.hasPointerCapture(m.pointerId)&&(g.releasePointerCapture(m.pointerId),i(m))})})}),BB="SliderTrack",FB=b.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,s=ab(BB,n);return o.jsx(xn.span,{"data-disabled":s.disabled?"":void 0,"data-orientation":s.orientation,...r,ref:e})});FB.displayName=BB;var pk="SliderRange",qB=b.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,s=ab(pk,n),i=IB(pk,n),a=b.useRef(null),l=Yn(e,a),c=s.values.length,d=s.values.map(g=>QB(g,s.min,s.max)),h=c>1?Math.min(...d):0,m=100-Math.max(...d);return o.jsx(xn.span,{"data-orientation":s.orientation,"data-disabled":s.disabled?"":void 0,...r,ref:l,style:{...t.style,[i.startEdge]:h+"%",[i.endEdge]:m+"%"}})});qB.displayName=pk;var gk="SliderThumb",$B=b.forwardRef((t,e)=>{const n=Pie(t.__scopeSlider),[r,s]=b.useState(null),i=Yn(e,l=>s(l)),a=b.useMemo(()=>r?n().findIndex(l=>l.ref.current===r):-1,[n,r]);return o.jsx(Fie,{...t,ref:i,index:a})}),Fie=b.forwardRef((t,e)=>{const{__scopeSlider:n,index:r,name:s,...i}=t,a=ab(gk,n),l=IB(gk,n),[c,d]=b.useState(null),h=Yn(e,j=>d(j)),m=c?a.form||!!c.closest("form"):!0,g=tI(c),x=a.values[r],y=x===void 0?0:QB(x,a.min,a.max),w=Hie(r,a.values.length),S=g?.[l.size],k=S?Vie(S,y,l.direction):0;return b.useEffect(()=>{if(c)return a.thumbs.add(c),()=>{a.thumbs.delete(c)}},[c,a.thumbs]),o.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[l.startEdge]:`calc(${y}% + ${k}px)`},children:[o.jsx(mk.ItemSlot,{scope:t.__scopeSlider,children:o.jsx(xn.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:h,style:x===void 0?{display:"none"}:t.style,onFocus:nt(t.onFocus,()=>{a.valueIndexToChangeRef.current=r})})}),m&&o.jsx(HB,{name:s??(a.name?a.name+(a.values.length>1?"[]":""):void 0),form:a.form,value:x},r)]})});$B.displayName=gk;var qie="RadioBubbleInput",HB=b.forwardRef(({__scopeSlider:t,value:e,...n},r)=>{const s=b.useRef(null),i=Yn(s,r),a=eI(e);return b.useEffect(()=>{const l=s.current;if(!l)return;const c=window.HTMLInputElement.prototype,h=Object.getOwnPropertyDescriptor(c,"value").set;if(a!==e&&h){const m=new Event("input",{bubbles:!0});h.call(l,e),l.dispatchEvent(m)}},[a,e]),o.jsx(xn.input,{style:{display:"none"},...n,ref:i,defaultValue:e})});HB.displayName=qie;function $ie(t=[],e,n){const r=[...t];return r[n]=e,r.sort((s,i)=>s-i)}function QB(t,e,n){const i=100/(n-e)*(t-e);return Sj(i,[0,100])}function Hie(t,e){return e>2?`Value ${t+1} of ${e}`:e===2?["Minimum","Maximum"][t]:void 0}function Qie(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 Vie(t,e,n){const r=t/2,i=Xj([0,50],[0,r]);return(r-i(e)*n)*n}function Uie(t){return t.slice(0,-1).map((e,n)=>t[n+1]-e)}function Wie(t,e){if(e>0){const n=Uie(t);return Math.min(...n)>=e}return!0}function Xj(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 Gie(t){return(String(t).split(".")[1]||"").length}function Xie(t,e){const n=Math.pow(10,e);return Math.round(t*n)/n}var VB=PB,Yie=FB,Kie=qB,Zie=$B;const Bp=b.forwardRef(({className:t,...e},n)=>o.jsxs(VB,{ref:n,className:xe("relative flex w-full touch-none select-none items-center",t),...e,children:[o.jsx(Yie,{className:"relative h-1.5 w-full grow overflow-hidden rounded-full bg-primary/20",children:o.jsx(Kie,{className:"absolute h-full bg-primary"})}),o.jsx(Zie,{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"})]}));Bp.displayName=VB.displayName;const Vt=Aee,Ut=Mee,$t=b.forwardRef(({className:t,children:e,...n},r)=>o.jsxs(iI,{ref:r,className:xe("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,o.jsx(Nee,{asChild:!0,children:o.jsx(nd,{className:"h-4 w-4 opacity-50"})})]}));$t.displayName=iI.displayName;const UB=b.forwardRef(({className:t,...e},n)=>o.jsx(aI,{ref:n,className:xe("flex cursor-default items-center justify-center py-1",t),...e,children:o.jsx(P0,{className:"h-4 w-4"})}));UB.displayName=aI.displayName;const WB=b.forwardRef(({className:t,...e},n)=>o.jsx(oI,{ref:n,className:xe("flex cursor-default items-center justify-center py-1",t),...e,children:o.jsx(nd,{className:"h-4 w-4"})}));WB.displayName=oI.displayName;const Ht=b.forwardRef(({className:t,children:e,position:n="popper",...r},s)=>o.jsx(Cee,{children:o.jsxs(lI,{ref:s,className:xe("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:[o.jsx(UB,{}),o.jsx(Tee,{className:xe("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:e}),o.jsx(WB,{})]})}));Ht.displayName=lI.displayName;const Jie=b.forwardRef(({className:t,...e},n)=>o.jsx(cI,{ref:n,className:xe("px-2 py-1.5 text-sm font-semibold",t),...e}));Jie.displayName=cI.displayName;const De=b.forwardRef(({className:t,children:e,...n},r)=>o.jsxs(uI,{ref:r,className:xe("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:[o.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:o.jsx(Eee,{children:o.jsx(Ro,{className:"h-4 w-4"})})}),o.jsx(_ee,{children:e})]}));De.displayName=uI.displayName;const eae=b.forwardRef(({className:t,...e},n)=>o.jsx(dI,{ref:n,className:xe("-mx-1 my-1 h-px bg-muted",t),...e}));eae.displayName=dI.displayName;function tae(t){const e=nae(t),n=b.forwardRef((r,s)=>{const{children:i,...a}=r,l=b.Children.toArray(i),c=l.find(sae);if(c){const d=c.props.children,h=l.map(m=>m===c?b.Children.count(d)>1?b.Children.only(null):b.isValidElement(d)?d.props.children:null:m);return o.jsx(e,{...a,ref:s,children:b.isValidElement(d)?b.cloneElement(d,void 0,h):null})}return o.jsx(e,{...a,ref:s,children:i})});return n.displayName=`${t}.Slot`,n}function nae(t){const e=b.forwardRef((n,r)=>{const{children:s,...i}=n;if(b.isValidElement(s)){const a=aae(s),l=iae(i,s.props);return s.type!==b.Fragment&&(l.ref=r?Qc(r,a):a),b.cloneElement(s,l)}return b.Children.count(s)>1?b.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var rae=Symbol("radix.slottable");function sae(t){return b.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===rae}function iae(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]=(...l)=>{const c=i(...l);return s(...l),c}:s&&(n[r]=s):r==="style"?n[r]={...s,...i}:r==="className"&&(n[r]=[s,i].filter(Boolean).join(" "))}return{...t,...n}}function aae(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 ob="Popover",[GB]=Ra(ob,[vf]),Fp=vf(),[oae,iu]=GB(ob),XB=t=>{const{__scopePopover:e,children:n,open:r,defaultOpen:s,onOpenChange:i,modal:a=!1}=t,l=Fp(e),c=b.useRef(null),[d,h]=b.useState(!1),[m,g]=Xl({prop:r,defaultProp:s??!1,onChange:i,caller:ob});return o.jsx(Vy,{...l,children:o.jsx(oae,{scope:e,contentId:Ui(),triggerRef:c,open:m,onOpenChange:g,onOpenToggle:b.useCallback(()=>g(x=>!x),[g]),hasCustomAnchor:d,onCustomAnchorAdd:b.useCallback(()=>h(!0),[]),onCustomAnchorRemove:b.useCallback(()=>h(!1),[]),modal:a,children:n})})};XB.displayName=ob;var YB="PopoverAnchor",lae=b.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=iu(YB,n),i=Fp(n),{onCustomAnchorAdd:a,onCustomAnchorRemove:l}=s;return b.useEffect(()=>(a(),()=>l()),[a,l]),o.jsx(Uy,{...i,...r,ref:e})});lae.displayName=YB;var KB="PopoverTrigger",ZB=b.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=iu(KB,n),i=Fp(n),a=Yn(e,s.triggerRef),l=o.jsx(xn.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":rF(s.open),...r,ref:a,onClick:nt(t.onClick,s.onOpenToggle)});return s.hasCustomAnchor?l:o.jsx(Uy,{asChild:!0,...i,children:l})});ZB.displayName=KB;var Yj="PopoverPortal",[cae,uae]=GB(Yj,{forceMount:void 0}),JB=t=>{const{__scopePopover:e,forceMount:n,children:r,container:s}=t,i=iu(Yj,e);return o.jsx(cae,{scope:e,forceMount:n,children:o.jsx(ii,{present:n||i.open,children:o.jsx(Qy,{asChild:!0,container:s,children:r})})})};JB.displayName=Yj;var Kh="PopoverContent",eF=b.forwardRef((t,e)=>{const n=uae(Kh,t.__scopePopover),{forceMount:r=n.forceMount,...s}=t,i=iu(Kh,t.__scopePopover);return o.jsx(ii,{present:r||i.open,children:i.modal?o.jsx(hae,{...s,ref:e}):o.jsx(fae,{...s,ref:e})})});eF.displayName=Kh;var dae=tae("PopoverContent.RemoveScroll"),hae=b.forwardRef((t,e)=>{const n=iu(Kh,t.__scopePopover),r=b.useRef(null),s=Yn(e,r),i=b.useRef(!1);return b.useEffect(()=>{const a=r.current;if(a)return hI(a)},[]),o.jsx(fI,{as:dae,allowPinchZoom:!0,children:o.jsx(tF,{...t,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:nt(t.onCloseAutoFocus,a=>{a.preventDefault(),i.current||n.triggerRef.current?.focus()}),onPointerDownOutside:nt(t.onPointerDownOutside,a=>{const l=a.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,d=l.button===2||c;i.current=d},{checkForDefaultPrevented:!1}),onFocusOutside:nt(t.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1})})})}),fae=b.forwardRef((t,e)=>{const n=iu(Kh,t.__scopePopover),r=b.useRef(!1),s=b.useRef(!1);return o.jsx(tF,{...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()}})}),tF=b.forwardRef((t,e)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:i,disableOutsidePointerEvents:a,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:h,...m}=t,g=iu(Kh,n),x=Fp(n);return mI(),o.jsx(pI,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:i,children:o.jsx(Cj,{asChild:!0,disableOutsidePointerEvents:a,onInteractOutside:h,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onDismiss:()=>g.onOpenChange(!1),children:o.jsx(Tj,{"data-state":rF(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)"}})})})}),nF="PopoverClose",mae=b.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=iu(nF,n);return o.jsx(xn.button,{type:"button",...r,ref:e,onClick:nt(t.onClick,()=>s.onOpenChange(!1))})});mae.displayName=nF;var pae="PopoverArrow",gae=b.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=Fp(n);return o.jsx(Ej,{...s,...r,ref:e})});gae.displayName=pae;function rF(t){return t?"open":"closed"}var xae=XB,vae=ZB,yae=JB,sF=eF;const zo=xae,Io=vae,Xa=b.forwardRef(({className:t,align:e="center",sideOffset:n=4,...r},s)=>o.jsx(yae,{children:o.jsx(sF,{ref:s,align:e,sideOffset:n,className:xe("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})}));Xa.displayName=sF.displayName;const au="/api/webui/config";async function iE(){const e=await(await St(`${au}/bot`)).json();if(!e.success)throw new Error("获取配置数据失败");return e.config}async function Rh(){const e=await(await St(`${au}/model`)).json();if(!e.success)throw new Error("获取模型配置数据失败");return e.config}async function aE(t){const n=await(await St(`${au}/bot`,{method:"POST",headers:Dt(),body:JSON.stringify(t)})).json();if(!n.success)throw new Error(n.message||"保存配置失败")}async function bae(){const e=await(await St(`${au}/bot/raw`)).json();if(!e.success)throw new Error("获取配置源代码失败");return e.content}async function wae(t){const n=await(await St(`${au}/bot/raw`,{method:"POST",headers:Dt(),body:JSON.stringify({raw_content:t})})).json();if(!n.success)throw new Error(n.message||"保存配置失败")}async function qv(t){const n=await(await St(`${au}/model`,{method:"POST",headers:Dt(),body:JSON.stringify(t)})).json();if(!n.success)throw new Error(n.message||"保存配置失败")}async function Sae(t,e){const r=await(await St(`${au}/bot/section/${t}`,{method:"POST",headers:Dt(),body:JSON.stringify(e)})).json();if(!r.success)throw new Error(r.message||`保存配置节 ${t} 失败`)}async function xk(t,e){const r=await(await St(`${au}/model/section/${t}`,{method:"POST",headers:Dt(),body:JSON.stringify(e)})).json();if(!r.success)throw new Error(r.message||`保存配置节 ${t} 失败`)}async function kae(t,e="openai",n="/models"){const r=new URLSearchParams({provider_name:t,parser:e,endpoint:n}),s=await St(`/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 Oae=kf("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"}}),ga=b.forwardRef(({className:t,variant:e,...n},r)=>o.jsx("div",{ref:r,role:"alert",className:xe(Oae({variant:e}),t),...n}));ga.displayName="Alert";const jae=b.forwardRef(({className:t,...e},n)=>o.jsx("h5",{ref:n,className:xe("mb-1 font-medium leading-none tracking-tight",t),...e}));jae.displayName="AlertTitle";const xa=b.forwardRef(({className:t,...e},n)=>o.jsx("div",{ref:n,className:xe("text-sm [&_p]:leading-relaxed",t),...e}));xa.displayName="AlertDescription";function Kj({onRestartComplete:t,onRestartFailed:e}){const[n,r]=b.useState(0),[s,i]=b.useState("restarting"),[a,l]=b.useState(0),[c,d]=b.useState(0);b.useEffect(()=>{const g=setInterval(()=>{r(w=>w>=90?w:w+1)},200),x=setInterval(()=>{l(w=>w+1)},1e3),y=setTimeout(()=>{i("checking"),h()},3e3);return()=>{clearInterval(g),clearInterval(x),clearTimeout(y)}},[]);const h=()=>{const x=async()=>{try{if(d(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 o.jsx("div",{className:"fixed inset-0 bg-background/95 backdrop-blur-sm z-50 flex items-center justify-center",children:o.jsxs("div",{className:"max-w-md w-full mx-4 space-y-8",children:[o.jsxs("div",{className:"flex flex-col items-center space-y-4",children:[s==="restarting"&&o.jsxs(o.Fragment,{children:[o.jsx(Po,{className:"h-16 w-16 text-primary animate-spin"}),o.jsx("h2",{className:"text-2xl font-bold",children:"正在重启麦麦"}),o.jsx("p",{className:"text-muted-foreground text-center",children:"请稍候,麦麦正在重启中..."})]}),s==="checking"&&o.jsxs(o.Fragment,{children:[o.jsx(Po,{className:"h-16 w-16 text-primary animate-spin"}),o.jsx("h2",{className:"text-2xl font-bold",children:"检查服务状态"}),o.jsxs("p",{className:"text-muted-foreground text-center",children:["等待服务恢复... (尝试 ",c,"/60)"]})]}),s==="success"&&o.jsxs(o.Fragment,{children:[o.jsx(Vc,{className:"h-16 w-16 text-green-500"}),o.jsx("h2",{className:"text-2xl font-bold",children:"重启成功"}),o.jsx("p",{className:"text-muted-foreground text-center",children:"正在跳转到登录页面..."})]}),s==="failed"&&o.jsxs(o.Fragment,{children:[o.jsx(Uc,{className:"h-16 w-16 text-destructive"}),o.jsx("h2",{className:"text-2xl font-bold",children:"重启超时"}),o.jsx("p",{className:"text-muted-foreground text-center",children:"服务未能在预期时间内恢复,请手动检查或刷新页面"})]})]}),s!=="failed"&&o.jsxs("div",{className:"space-y-2",children:[o.jsx(Lp,{value:n,className:"h-2"}),o.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground",children:[o.jsxs("span",{children:[n,"%"]}),o.jsxs("span",{children:["已用时: ",m(a)]})]})]}),o.jsx("div",{className:"bg-muted/50 rounded-lg p-4 space-y-2",children:o.jsxs("p",{className:"text-sm text-muted-foreground",children:[s==="restarting"&&"🔄 配置已保存,正在重启主程序...",s==="checking"&&"⏳ 正在等待服务恢复,请勿关闭页面...",s==="success"&&"✅ 配置已生效,服务运行正常",s==="failed"&&"⚠️ 如果长时间无响应,请尝试手动重启"]})}),o.jsx("div",{className:"bg-yellow-500/10 border border-yellow-500/50 rounded-lg p-4",children:o.jsxs("p",{className:"text-sm text-yellow-900 dark:text-yellow-100",children:[o.jsx("strong",{children:"⚠️ 重要提示:"})," 由于技术原因,使用重启功能后,将无法再使用 ",o.jsx("code",{className:"px-1 py-0.5 bg-yellow-200 dark:bg-yellow-900 rounded",children:"Ctrl+C"})," 结束程序。如需结束程序,请使用脚本目录下的进程管理脚本。"]})}),s==="failed"&&o.jsxs("div",{className:"flex gap-2",children:[o.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:"刷新页面"}),o.jsx("button",{onClick:()=>{i("checking"),d(0),h()},className:"flex-1 px-4 py-2 bg-secondary text-secondary-foreground rounded-md hover:bg-secondary/90",children:"重试检测"})]})]})})}let vk=[],iF=[];(()=>{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<t.length;e++)(e%2?iF:vk).push(n=n+t[e])})();function Nae(t){if(t<768)return!1;for(let e=0,n=vk.length;;){let r=e+n>>1;if(t<vk[r])n=r;else if(t>=iF[r])e=r+1;else return!0;if(e==n)return!1}}function oE(t){return t>=127462&&t<=127487}const lE=8205;function Cae(t,e,n=!0,r=!0){return(n?aF:Tae)(t,e,r)}function aF(t,e,n){if(e==t.length)return e;e&&oF(t.charCodeAt(e))&&lF(t.charCodeAt(e-1))&&e--;let r=M4(t,e);for(e+=cE(r);e<t.length;){let s=M4(t,e);if(r==lE||s==lE||n&&Nae(s))e+=cE(s),r=s;else if(oE(s)){let i=0,a=e-2;for(;a>=0&&oE(M4(t,a));)i++,a-=2;if(i%2==0)break;e+=2}else break}return e}function Tae(t,e,n){for(;e>0;){let r=aF(t,e-2,n);if(r<e)return r;e--}return 0}function M4(t,e){let n=t.charCodeAt(e);if(!lF(n)||e+1==t.length)return n;let r=t.charCodeAt(e+1);return oF(r)?(n-55296<<10)+(r-56320)+65536:n}function oF(t){return t>=56320&&t<57344}function lF(t){return t>=55296&&t<56320}function cE(t){return t<65536?1:2}class jn{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]=Zh(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),iv.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]=Zh(this,e,n);let r=[];return this.decompose(e,n,r,0),iv.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 b0(this),i=new b0(e);for(let a=n,l=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(l+=s.value.length,s.done||l>=r)return!0}}iter(e=1){return new b0(this,e)}iterRange(e,n=this.length){return new cF(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 uF(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]?jn.empty:e.length<=32?new Hr(e):iv.from(Hr.split(e,[]))}}class Hr extends jn{constructor(e,n=Eae(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],l=s+a.length;if((n?r:l)>=e)return new _ae(s,l,r,a);s=l+1,r++}}decompose(e,n,r,s){let i=e<=0&&n>=this.length?this:new Hr(uE(this.text,e,n),Math.min(n,this.length)-Math.max(0,e));if(s&1){let a=r.pop(),l=av(i.text,a.text.slice(),0,i.length);if(l.length<=32)r.push(new Hr(l,a.length+i.length));else{let c=l.length>>1;r.push(new Hr(l.slice(0,c)),new Hr(l.slice(c)))}}else r.push(i)}replace(e,n,r){if(!(r instanceof Hr))return super.replace(e,n,r);[e,n]=Zh(this,e,n);let s=av(this.text,av(r.text,uE(this.text,0,e)),n),i=this.length+r.length-(n-e);return s.length<=32?new Hr(s,i):iv.from(Hr.split(s,[]),i)}sliceString(e,n=this.length,r=`
`){[e,n]=Zh(this,e,n);let s="";for(let i=0,a=0;i<=n&&a<this.text.length;a++){let l=this.text[a],c=i+l.length;i>e&&a&&(s+=r),e<c&&n>i&&(s+=l.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 Hr(r,s)),r=[],s=-1);return s>-1&&n.push(new Hr(r,s)),n}}let iv=class vh extends jn{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],l=s+a.length,c=r+a.lines-1;if((n?c:l)>=e)return a.lineInner(e,n,r,s);s=l+1,r=c+1}}decompose(e,n,r,s){for(let i=0,a=0;a<=n&&i<this.children.length;i++){let l=this.children[i],c=a+l.length;if(e<=c&&n>=a){let d=s&((a<=e?1:0)|(c>=n?2:0));a>=e&&c<=n&&!d?r.push(l):l.decompose(e-a,n-a,r,d)}a=c+1}}replace(e,n,r){if([e,n]=Zh(this,e,n),r.lines<this.lines)for(let s=0,i=0;s<this.children.length;s++){let a=this.children[s],l=i+a.length;if(e>=i&&n<=l){let c=a.replace(e-i,n-i,r),d=this.lines-a.lines+c.lines;if(c.lines<d>>4&&c.lines>d>>6){let h=this.children.slice();return h[s]=c,new vh(h,this.length-(n-e)+r.length)}return super.replace(i,l,c)}i=l+1}return super.replace(e,n,r)}sliceString(e,n=this.length,r=`
`){[e,n]=Zh(this,e,n);let s="";for(let i=0,a=0;i<this.children.length&&a<=n;i++){let l=this.children[i],c=a+l.length;a>e&&i&&(s+=r),e<c&&n>a&&(s+=l.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 vh))return 0;let r=0,[s,i,a,l]=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==l)return r;let c=this.children[s],d=e.children[i];if(c!=d)return r+c.scanIdentical(d,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 Hr(x,n)}let s=Math.max(32,r>>5),i=s<<1,a=s>>1,l=[],c=0,d=-1,h=[];function m(x){let y;if(x.lines>i&&x instanceof vh)for(let w of x.children)m(w);else x.lines>a&&(c>a||!c)?(g(),l.push(x)):x instanceof Hr&&c&&(y=h[h.length-1])instanceof Hr&&x.lines+y.lines<=32?(c+=x.lines,d+=x.length+1,h[h.length-1]=new Hr(y.text.concat(x.text),y.length+1+x.length)):(c+x.lines>s&&g(),c+=x.lines,d+=x.length+1,h.push(x))}function g(){c!=0&&(l.push(h.length==1?h[0]:vh.from(h,d)),d=-1,c=h.length=0)}for(let x of e)m(x);return g(),l.length==1?l[0]:new vh(l,n)}};jn.empty=new Hr([""],0);function Eae(t){let e=-1;for(let n of t)e+=n.length+1;return e}function av(t,e,n=0,r=1e9){for(let s=0,i=0,a=!0;i<t.length&&s<=r;i++){let l=t[i],c=s+l.length;c>=n&&(c>r&&(l=l.slice(0,r-s)),s<n&&(l=l.slice(n-s)),a?(e[e.length-1]+=l,a=!1):e.push(l)),s=c+1}return e}function uE(t,e,n){return av(t,[""],e,n)}class b0{constructor(e,n=1){this.dir=n,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[n>0?1:(e instanceof Hr?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,l=s instanceof Hr?s.text.length:s.children.length;if(a==(n>0?l: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 Hr){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 Hr?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 cF{constructor(e,n,r){this.value="",this.done=!1,this.cursor=new b0(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 uF{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"&&(jn.prototype[Symbol.iterator]=function(){return this.iter()},b0.prototype[Symbol.iterator]=cF.prototype[Symbol.iterator]=uF.prototype[Symbol.iterator]=function(){return this});class _ae{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 Zh(t,e,n){return e=Math.max(0,Math.min(t.length,e)),[e,Math.max(e,Math.min(t.length,n))]}function zs(t,e,n=!0,r=!0){return Cae(t,e,n,r)}function Aae(t){return t>=56320&&t<57344}function Mae(t){return t>=55296&&t<56320}function gi(t,e){let n=t.charCodeAt(e);if(!Mae(n)||e+1==t.length)return n;let r=t.charCodeAt(e+1);return Aae(r)?(n-55296<<10)+(r-56320)+65536:n}function Zj(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10)+55296,(t&1023)+56320))}function wo(t){return t<65536?1:2}const yk=/\r\n?|\n/;var Ds=(function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t})(Ds||(Ds={}));class Do{constructor(e){this.sections=e}get length(){let e=0;for(let n=0;n<this.sections.length;n+=2)e+=this.sections[n];return e}get newLength(){let e=0;for(let n=0;n<this.sections.length;n+=2){let r=this.sections[n+1];e+=r<0?this.sections[n]:r}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let n=0,r=0,s=0;n<this.sections.length;){let i=this.sections[n++],a=this.sections[n++];a<0?(e(r,s,i),s+=i):s+=a,r+=i}}iterChangedRanges(e,n=!1){bk(this,e,n)}get invertedDesc(){let e=[];for(let n=0;n<this.sections.length;){let r=this.sections[n++],s=this.sections[n++];s<0?e.push(r,s):e.push(s,r)}return new Do(e)}composeDesc(e){return this.empty?e:e.empty?this:dF(this,e)}mapDesc(e,n=!1){return e.empty?this:wk(this,e,n)}mapPos(e,n=-1,r=Ds.Simple){let s=0,i=0;for(let a=0;a<this.sections.length;){let l=this.sections[a++],c=this.sections[a++],d=s+l;if(c<0){if(d>e)return i+(e-s);i+=l}else{if(r!=Ds.Simple&&d>=e&&(r==Ds.TrackDel&&s<e&&d>e||r==Ds.TrackBefore&&s<e||r==Ds.TrackAfter&&d>e))return null;if(d>e||d==e&&n<0&&!l)return e==s||n<0?i:i+c;i+=c}s=d}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<this.sections.length&&s<=n;){let i=this.sections[r++],a=this.sections[r++],l=s+i;if(a>=0&&s<=n&&l>=e)return s<e&&l>n?"cover":!0;s=l}return!1}toString(){let e="";for(let n=0;n<this.sections.length;){let r=this.sections[n++],s=this.sections[n++];e+=(e?" ":"")+r+(s>=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 Do(e)}static create(e){return new Do(e)}}class us extends Do{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 bk(this,(n,r,s,i,a)=>e=e.replace(s,s+(r-n),a),!1),e}mapDesc(e,n=!1){return wk(this,e,n,!0)}invert(e){let n=this.sections.slice(),r=[];for(let s=0,i=0;s<n.length;s+=2){let a=n[s],l=n[s+1];if(l>=0){n[s]=l,n[s+1]=a;let c=s>>1;for(;r.length<c;)r.push(jn.empty);r.push(a?e.slice(i,i+a):jn.empty)}i+=a}return new us(n,r)}compose(e){return this.empty?e:e.empty?this:dF(this,e,!0)}map(e,n=!1){return e.empty?this:wk(this,e,n,!0)}iterChanges(e,n=!1){bk(this,e,n)}get desc(){return Do.create(this.sections)}filter(e){let n=[],r=[],s=[],i=new B0(this);e:for(let a=0,l=0;;){let c=a==e.length?1e9:e[a++];for(;l<c||l==c&&i.len==0;){if(i.done)break e;let h=Math.min(i.len,c-l);$s(s,h,-1);let m=i.ins==-1?-1:i.off==0?i.ins:0;$s(n,h,m),m>0&&Bc(r,n,i.text),i.forward(h),l+=h}let d=e[a++];for(;l<d;){if(i.done)break e;let h=Math.min(i.len,d-l);$s(n,h,-1),$s(s,h,i.ins==-1?-1:i.off==0?i.ins:0),i.forward(h),l+=h}}return{changes:new us(n,r),filtered:Do.create(s)}}toJSON(){let e=[];for(let n=0;n<this.sections.length;n+=2){let r=this.sections[n],s=this.sections[n+1];s<0?e.push(r):s==0?e.push([r]):e.push([r].concat(this.inserted[n>>1].toJSON()))}return e}static of(e,n,r){let s=[],i=[],a=0,l=null;function c(h=!1){if(!h&&!s.length)return;a<n&&$s(s,n-a,-1);let m=new us(s,i);l=l?l.compose(m.map(l)):m,s=[],i=[],a=0}function d(h){if(Array.isArray(h))for(let m of h)d(m);else if(h instanceof us){if(h.length!=n)throw new RangeError(`Mismatched change set length (got ${h.length}, expected ${n})`);c(),l=l?l.compose(h.map(l)):h}else{let{from:m,to:g=m,insert:x}=h;if(m>g||m<0||g>n)throw new RangeError(`Invalid change range ${m} to ${g} (in doc of length ${n})`);let y=x?typeof x=="string"?jn.of(x.split(r||yk)):x:jn.empty,w=y.length;if(m==g&&w==0)return;m<a&&c(),m>a&&$s(s,m-a,-1),$s(s,g-m,w),Bc(i,s,y),a=g}}return d(e),c(!l),l}static empty(e){return new us(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;s<e.length;s++){let i=e[s];if(typeof i=="number")n.push(i,-1);else{if(!Array.isArray(i)||typeof i[0]!="number"||i.some((a,l)=>l&&typeof a!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(i.length==1)n.push(i[0],0);else{for(;r.length<s;)r.push(jn.empty);r[s]=jn.of(i.slice(1)),n.push(i[0],r[s].length)}}}return new us(n,r)}static createSet(e,n){return new us(e,n)}}function $s(t,e,n,r=!1){if(e==0&&n<=0)return;let s=t.length-2;s>=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 Bc(t,e,n){if(n.length==0)return;let r=e.length-2>>1;if(r<t.length)t[t.length-1]=t[t.length-1].append(n);else{for(;t.length<r;)t.push(jn.empty);t.push(n)}}function bk(t,e,n){let r=t.inserted;for(let s=0,i=0,a=0;a<t.sections.length;){let l=t.sections[a++],c=t.sections[a++];if(c<0)s+=l,i+=l;else{let d=s,h=i,m=jn.empty;for(;d+=l,h+=c,c&&r&&(m=m.append(r[a-2>>1])),!(n||a==t.sections.length||t.sections[a+1]<0);)l=t.sections[a++],c=t.sections[a++];e(s,d,i,h,m),s=d,i=h}}}function wk(t,e,n,r=!1){let s=[],i=r?[]:null,a=new B0(t),l=new B0(e);for(let c=-1;;){if(a.done&&l.len||l.done&&a.len)throw new Error("Mismatched change set lengths");if(a.ins==-1&&l.ins==-1){let d=Math.min(a.len,l.len);$s(s,d,-1),a.forward(d),l.forward(d)}else if(l.ins>=0&&(a.ins<0||c==a.i||a.off==0&&(l.len<a.len||l.len==a.len&&!n))){let d=l.len;for($s(s,l.ins,-1);d;){let h=Math.min(a.len,d);a.ins>=0&&c<a.i&&a.len<=h&&($s(s,0,a.ins),i&&Bc(i,s,a.text),c=a.i),a.forward(h),d-=h}l.next()}else if(a.ins>=0){let d=0,h=a.len;for(;h;)if(l.ins==-1){let m=Math.min(h,l.len);d+=m,h-=m,l.forward(m)}else if(l.ins==0&&l.len<h)h-=l.len,l.next();else break;$s(s,d,c<a.i?a.ins:0),i&&c<a.i&&Bc(i,s,a.text),c=a.i,a.forward(a.len-h)}else{if(a.done&&l.done)return i?us.createSet(s,i):Do.create(s);throw new Error("Mismatched change set lengths")}}}function dF(t,e,n=!1){let r=[],s=n?[]:null,i=new B0(t),a=new B0(e);for(let l=!1;;){if(i.done&&a.done)return s?us.createSet(r,s):Do.create(r);if(i.ins==0)$s(r,i.len,0,l),i.next();else if(a.len==0&&!a.done)$s(r,0,a.ins,l),s&&Bc(s,r,a.text),a.next();else{if(i.done||a.done)throw new Error("Mismatched change set lengths");{let c=Math.min(i.len2,a.len),d=r.length;if(i.ins==-1){let h=a.ins==-1?-1:a.off?0:a.ins;$s(r,c,h,l),s&&h&&Bc(s,r,a.text)}else a.ins==-1?($s(r,i.off?0:i.len,c,l),s&&Bc(s,r,i.textBit(c))):($s(r,i.off?0:i.len,a.off?0:a.ins,l),s&&!a.off&&Bc(s,r,a.text));l=(i.ins>c||a.ins>=0&&a.len>c)&&(l||r.length>d),i.forward2(c),a.forward(c)}}}}class B0{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,n=this.i-2>>1;return n>=e.length?jn.empty:e[n]}textBit(e){let{inserted:n}=this.set,r=this.i-2>>1;return r>=n.length&&!e?jn.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 Hu{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 Hu(r,s,this.flags)}extend(e,n=e){if(e<=this.anchor&&n>=this.anchor)return Me.range(e,n);let r=Math.abs(e-this.anchor)>Math.abs(n-this.anchor)?e:n;return Me.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 Me.range(e.anchor,e.head)}static create(e,n,r){return new Hu(e,n,r)}}class Me{constructor(e,n){this.ranges=e,this.mainIndex=n}map(e,n=-1){return e.empty?this:Me.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;r<this.ranges.length;r++)if(!this.ranges[r].eq(e.ranges[r],n))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new Me([this.main],0)}addRange(e,n=!0){return Me.create([e].concat(this.ranges),n?0:this.mainIndex+1)}replaceRange(e,n=this.mainIndex){let r=this.ranges.slice();return r[n]=e,Me.create(r,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.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 Me(e.ranges.map(n=>Hu.fromJSON(n)),e.main)}static single(e,n=e){return new Me([Me.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;s<e.length;s++){let i=e[s];if(i.empty?i.from<=r:i.from<r)return Me.normalized(e.slice(),n);r=i.to}return new Me(e,n)}static cursor(e,n=0,r,s){return Hu.create(e,e,(n==0?0:n<0?8:16)|(r==null?7:Math.min(6,r))|(s??16777215)<<6)}static range(e,n,r,s){let i=(r??16777215)<<6|(s==null?7:Math.min(6,s));return n<e?Hu.create(n,e,48|i):Hu.create(e,n,(n>e?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;s<e.length;s++){let i=e[s],a=e[s-1];if(i.empty?i.from<=a.to:i.from<a.to){let l=a.from,c=Math.max(i.to,a.to);s<=n&&n--,e.splice(--s,2,i.anchor>i.head?Me.range(c,l):Me.range(l,c))}}return new Me(e,n)}}function hF(t,e){for(let n of t.ranges)if(n.to>e)throw new RangeError("Selection points outside of document")}let Jj=0;class at{constructor(e,n,r,s,i){this.combine=e,this.compareInput=n,this.compare=r,this.isStatic=s,this.id=Jj++,this.default=e([]),this.extensions=typeof i=="function"?i(this):i}get reader(){return this}static define(e={}){return new at(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 ov([],this,0,e)}compute(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new ov(e,this,1,n)}computeN(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new ov(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 ov{constructor(e,n,r,s){this.dependencies=e,this.facet=n,this.type=r,this.value=s,this.id=Jj++}dynamicSlot(e){var n;let r=this.value,s=this.facet.compareInput,i=this.id,a=e[i]>>1,l=this.type==2,c=!1,d=!1,h=[];for(let m of this.dependencies)m=="doc"?c=!0:m=="selection"?d=!0:(((n=e[m.id])!==null&&n!==void 0?n:1)&1)==0&&h.push(e[m.id]);return{create(m){return m.values[a]=r(m),1},update(m,g){if(c&&g.docChanged||d&&(g.docChanged||g.selection)||Sk(m,h)){let x=r(m);if(l?!dE(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=Hv(g,y);if(this.dependencies.every(S=>S instanceof at?g.facet(S)===m.facet(S):S instanceof Os?g.field(S,!1)==m.field(S,!1):!0)||(l?dE(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 dE(t,e,n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!n(t[r],e[r]))return!1;return!0}function Sk(t,e){let n=!1;for(let r of e)w0(t,r)&1&&(n=!0);return n}function Rae(t,e,n){let r=n.map(c=>t[c.id]),s=n.map(c=>c.type),i=r.filter(c=>!(c&1)),a=t[e.id]>>1;function l(c){let d=[];for(let h=0;h<r.length;h++){let m=Hv(c,r[h]);if(s[h]==2)for(let g of m)d.push(g);else d.push(m)}return e.combine(d)}return{create(c){for(let d of r)w0(c,d);return c.values[a]=l(c),1},update(c,d){if(!Sk(c,i))return 0;let h=l(c);return e.compare(h,c.values[a])?0:(c.values[a]=h,1)},reconfigure(c,d){let h=Sk(c,r),m=d.config.facets[e.id],g=d.facet(e);if(m&&!h&&e6(n,m))return c.values[a]=g,0;let x=l(c);return e.compare(x,g)?(c.values[a]=g,0):(c.values[a]=x,1)}}}const Zx=at.define({static:!0});class Os{constructor(e,n,r,s,i){this.id=e,this.createF=n,this.updateF=r,this.compareF=s,this.spec=i,this.provides=void 0}static define(e){let n=new Os(Jj++,e.create,e.update,e.compare||((r,s)=>r===s),e);return e.provide&&(n.provides=e.provide(n)),n}create(e){let n=e.facet(Zx).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(Zx),a=s.facet(Zx),l;return(l=i.find(c=>c.field==this))&&l!=a.find(c=>c.field==this)?(r.values[n]=l.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,Zx.of({field:this,create:e})]}get extension(){return this}}const Fu={lowest:4,low:3,default:2,high:1,highest:0};function Bm(t){return e=>new fF(e,t)}const ou={highest:Bm(Fu.highest),high:Bm(Fu.high),default:Bm(Fu.default),low:Bm(Fu.low),lowest:Bm(Fu.lowest)};class fF{constructor(e,n){this.inner=e,this.prec=n}}class lb{of(e){return new kk(this,e)}reconfigure(e){return lb.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class kk{constructor(e,n){this.compartment=e,this.inner=n}}class $v{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<r.length;)this.statusTemplate.push(0)}staticFacet(e){let n=this.address[e.id];return n==null?e.default:this.staticValues[n>>1]}static resolve(e,n,r){let s=[],i=Object.create(null),a=new Map;for(let g of Dae(e,n,a))g instanceof Os?s.push(g):(i[g.facet.id]||(i[g.facet.id]=[])).push(g);let l=Object.create(null),c=[],d=[];for(let g of s)l[g.id]=d.length<<1,d.push(x=>g.slot(x));let h=r?.config.facets;for(let g in i){let x=i[g],y=x[0].facet,w=h&&h[g]||[];if(x.every(S=>S.type==0))if(l[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?(l[S.id]=c.length<<1|1,c.push(S.value)):(l[S.id]=d.length<<1,d.push(k=>S.dynamicSlot(k)));l[y.id]=d.length<<1,d.push(S=>Rae(S,y,x))}}let m=d.map(g=>g(l));return new $v(e,a,m,l,c,i)}}function Dae(t,e,n){let r=[[],[],[],[],[]],s=new Map;function i(a,l){let c=s.get(a);if(c!=null){if(c<=l)return;let d=r[c].indexOf(a);d>-1&&r[c].splice(d,1),a instanceof kk&&n.delete(a.compartment)}if(s.set(a,l),Array.isArray(a))for(let d of a)i(d,l);else if(a instanceof kk){if(n.has(a.compartment))throw new RangeError("Duplicate use of compartment in extensions");let d=e.get(a.compartment)||a.inner;n.set(a.compartment,d),i(d,l)}else if(a instanceof fF)i(a.inner,a.prec);else if(a instanceof Os)r[l].push(a),a.provides&&i(a.provides,l);else if(a instanceof ov)r[l].push(a),a.facet.extensions&&i(a.facet.extensions,Fu.default);else{let d=a.extension;if(!d)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(d,l)}}return i(t,Fu.default),r.reduce((a,l)=>a.concat(l))}function w0(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 Hv(t,e){return e&1?t.config.staticValues[e>>1]:t.values[e>>1]}const mF=at.define(),Ok=at.define({combine:t=>t.some(e=>e),static:!0}),pF=at.define({combine:t=>t.length?t[0]:void 0,static:!0}),gF=at.define(),xF=at.define(),vF=at.define(),yF=at.define({combine:t=>t.length?t[0]:!1});class qo{constructor(e,n){this.type=e,this.value=n}static define(){return new Pae}}class Pae{of(e){return new qo(this,e)}}class zae{constructor(e){this.map=e}of(e){return new Ft(this,e)}}class Ft{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 Ft(this.type,n)}is(e){return this.type==e}static define(e={}){return new zae(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}}Ft.reconfigure=Ft.define();Ft.appendConfig=Ft.define();class ns{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&&hF(r,n.newLength),i.some(l=>l.type==ns.time)||(this.annotations=i.concat(ns.time.of(Date.now())))}static create(e,n,r,s,i,a){return new ns(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(ns.userEvent);return!!(n&&(n==e||n.length>e.length&&n.slice(0,e.length)==e&&n[e.length]=="."))}}ns.time=qo.define();ns.userEvent=qo.define();ns.addToHistory=qo.define();ns.remote=qo.define();function Iae(t,e){let n=[];for(let r=0,s=0;;){let i,a;if(r<t.length&&(s==e.length||e[s]>=t[r]))i=t[r++],a=t[r++];else if(s<e.length)i=e[s++],a=e[s++];else return n;!n.length||n[n.length-1]<i?n.push(i,a):n[n.length-1]<a&&(n[n.length-1]=a)}}function bF(t,e,n){var r;let s,i,a;return n?(s=e.changes,i=us.empty(e.changes.length),a=t.changes.compose(e.changes)):(s=e.changes.map(t.changes),i=t.changes.mapDesc(e.changes,!0),a=t.changes.compose(s)),{changes:a,selection:e.selection?e.selection.map(i):(r=t.selection)===null||r===void 0?void 0:r.map(s),effects:Ft.mapEffects(t.effects,s).concat(Ft.mapEffects(e.effects,i)),annotations:t.annotations.length?t.annotations.concat(e.annotations):e.annotations,scrollIntoView:t.scrollIntoView||e.scrollIntoView}}function jk(t,e,n){let r=e.selection,s=Dh(e.annotations);return e.userEvent&&(s=s.concat(ns.userEvent.of(e.userEvent))),{changes:e.changes instanceof us?e.changes:us.of(e.changes||[],n,t.facet(pF)),selection:r&&(r instanceof Me?r:Me.single(r.anchor,r.head)),effects:Dh(e.effects),annotations:s,scrollIntoView:!!e.scrollIntoView}}function wF(t,e,n){let r=jk(t,e.length?e[0]:{},t.doc.length);e.length&&e[0].filter===!1&&(n=!1);for(let i=1;i<e.length;i++){e[i].filter===!1&&(n=!1);let a=!!e[i].sequential;r=bF(r,jk(t,e[i],a?r.changes.newLength:t.doc.length),a)}let s=ns.create(t,r.changes,r.selection,r.effects,r.annotations,r.scrollIntoView);return Bae(n?Lae(s):s)}function Lae(t){let e=t.startState,n=!0;for(let s of e.facet(gF)){let i=s(t);if(i===!1){n=!1;break}Array.isArray(i)&&(n=n===!0?i:Iae(n,i))}if(n!==!0){let s,i;if(n===!1)i=t.changes.invertedDesc,s=us.empty(e.doc.length);else{let a=t.changes.filter(n);s=a.changes,i=a.filtered.mapDesc(a.changes).invertedDesc}t=ns.create(e,s,t.selection&&t.selection.map(i),Ft.mapEffects(t.effects,i),t.annotations,t.scrollIntoView)}let r=e.facet(xF);for(let s=r.length-1;s>=0;s--){let i=r[s](t);i instanceof ns?t=i:Array.isArray(i)&&i.length==1&&i[0]instanceof ns?t=i[0]:t=wF(e,Dh(i),!1)}return t}function Bae(t){let e=t.startState,n=e.facet(vF),r=t;for(let s=n.length-1;s>=0;s--){let i=n[s](t);i&&Object.keys(i).length&&(r=bF(r,jk(e,i,t.changes.newLength),!0))}return r==t?t:ns.create(e,t.changes,t.selection,r.effects,r.annotations,r.scrollIntoView)}const Fae=[];function Dh(t){return t==null?Fae:Array.isArray(t)?t:[t]}var wr=(function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t})(wr||(wr={}));const qae=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Nk;try{Nk=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function $ae(t){if(Nk)return Nk.test(t);for(let e=0;e<t.length;e++){let n=t[e];if(/\w/.test(n)||n>"€"&&(n.toUpperCase()!=n.toLowerCase()||qae.test(n)))return!0}return!1}function Hae(t){return e=>{if(!/\S/.test(e))return wr.Space;if($ae(e))return wr.Word;for(let n=0;n<t.length;n++)if(e.indexOf(t[n])>-1)return wr.Word;return wr.Other}}class wn{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 l=0;l<this.config.dynamicSlots.length;l++)w0(this,l<<1);this.computeSlot=null}field(e,n=!0){let r=this.config.address[e.id];if(r==null){if(n)throw new RangeError("Field is not present in this state");return}return w0(this,r),Hv(this,r)}update(...e){return wF(this,e,!0)}applyTransaction(e){let n=this.config,{base:r,compartments:s}=n;for(let l of e.effects)l.is(lb.reconfigure)?(n&&(s=new Map,n.compartments.forEach((c,d)=>s.set(d,c)),n=null),s.set(l.value.compartment,l.value.extension)):l.is(Ft.reconfigure)?(n=null,r=l.value):l.is(Ft.appendConfig)&&(n=null,r=Dh(r).concat(l.value));let i;n?i=e.startState.values.slice():(n=$v.resolve(r,s,this),i=new wn(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(c,d)=>d.reconfigure(c,this),null).values);let a=e.startState.facet(Ok)?e.newSelection:e.newSelection.asSingle();new wn(n,e.newDoc,a,i,(l,c)=>c.update(l,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:Me.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=Dh(r.effects);for(let l=1;l<n.ranges.length;l++){let c=e(n.ranges[l]),d=this.changes(c.changes),h=d.map(s);for(let g=0;g<l;g++)i[g]=i[g].map(h);let m=s.mapDesc(d,!0);i.push(c.range.map(m)),s=s.compose(h),a=Ft.mapEffects(a,h).concat(Ft.mapEffects(Dh(c.effects),m))}return{changes:s,selection:Me.create(i,n.mainIndex),effects:a}}changes(e=[]){return e instanceof us?e:us.of(e,this.doc.length,this.facet(wn.lineSeparator))}toText(e){return jn.of(e.split(this.facet(wn.lineSeparator)||yk))}sliceDoc(e=0,n=this.doc.length){return this.doc.sliceString(e,n,this.lineBreak)}facet(e){let n=this.config.address[e.id];return n==null?e.default:(w0(this,n),Hv(this,n))}toJSON(e){let n={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let r in e){let s=e[r];s instanceof Os&&this.config.address[s.id]!=null&&(n[r]=s.spec.toJSON(this.field(e[r]),this))}return n}static fromJSON(e,n={},r){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let s=[];if(r){for(let i in r)if(Object.prototype.hasOwnProperty.call(e,i)){let a=r[i],l=e[i];s.push(a.init(c=>a.spec.fromJSON(l,c)))}}return wn.create({doc:e.doc,selection:Me.fromJSON(e.selection),extensions:n.extensions?s.concat([n.extensions]):s})}static create(e={}){let n=$v.resolve(e.extensions||[],new Map),r=e.doc instanceof jn?e.doc:jn.of((e.doc||"").split(n.staticFacet(wn.lineSeparator)||yk)),s=e.selection?e.selection instanceof Me?e.selection:Me.single(e.selection.anchor,e.selection.head):Me.single(0);return hF(s,r.length),n.staticFacet(Ok)||(s=s.asSingle()),new wn(n,r,s,n.dynamicSlots.map(()=>null),(i,a)=>a.create(i),null)}get tabSize(){return this.facet(wn.tabSize)}get lineBreak(){return this.facet(wn.lineSeparator)||`
`}get readOnly(){return this.facet(yF)}phrase(e,...n){for(let r of this.facet(wn.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(mF))for(let a of i(this,n,r))Object.prototype.hasOwnProperty.call(a,e)&&s.push(a[e]);return s}charCategorizer(e){return Hae(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,l=e-r;for(;a>0;){let c=zs(n,a,!1);if(i(n.slice(c,a))!=wr.Word)break;a=c}for(;l<s;){let c=zs(n,l);if(i(n.slice(l,c))!=wr.Word)break;l=c}return a==l?null:Me.range(a+r,l+r)}}wn.allowMultipleSelections=Ok;wn.tabSize=at.define({combine:t=>t.length?t[0]:4});wn.lineSeparator=pF;wn.readOnly=yF;wn.phrases=at.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])}});wn.languageData=mF;wn.changeFilter=gF;wn.transactionFilter=xF;wn.transactionExtender=vF;lb.reconfigure=Ft.define();function $o(t,e,n={}){let r={};for(let s of t)for(let i of Object.keys(s)){let a=s[i],l=r[i];if(l===void 0)r[i]=a;else if(!(l===a||a===void 0))if(Object.hasOwnProperty.call(n,i))r[i]=n[i](l,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 sd{eq(e){return this==e}range(e,n=e){return Ck.create(e,n,this)}}sd.prototype.startSide=sd.prototype.endSide=0;sd.prototype.point=!1;sd.prototype.mapMode=Ds.TrackDel;let Ck=class SF{constructor(e,n,r){this.from=e,this.to=n,this.value=r}static create(e,n,r){return new SF(e,n,r)}};function Tk(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}class t6{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,l=i.length;;){if(a==l)return a;let c=a+l>>1,d=i[c]-e||(r?this.value[c].endSide:this.value[c].startSide)-n;if(c==a)return d>=0?a:l;d>=0?l=c:a=c+1}}between(e,n,r,s){for(let i=this.findIndex(n,-1e9,!0),a=this.findIndex(r,1e9,!1,i);i<a;i++)if(s(this.from[i]+e,this.to[i]+e,this.value[i])===!1)return!1}map(e,n){let r=[],s=[],i=[],a=-1,l=-1;for(let c=0;c<this.value.length;c++){let d=this.value[c],h=this.from[c]+e,m=this.to[c]+e,g,x;if(h==m){let y=n.mapPos(h,d.startSide,d.mapMode);if(y==null||(g=x=y,d.startSide!=d.endSide&&(x=n.mapPos(h,d.endSide),x<g)))continue}else if(g=n.mapPos(h,d.startSide),x=n.mapPos(m,d.endSide),g>x||g==x&&d.startSide>0&&d.endSide<=0)continue;(x-g||d.endSide-d.startSide)<0||(a<0&&(a=g),d.point&&(l=Math.max(l,x-g)),r.push(d),s.push(g-a),i.push(x-a))}return{mapped:r.length?new t6(s,i,r,l):null,pos:a}}}class Rn{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 Rn(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(Tk)),this.isEmpty)return n.length?Rn.of(n):this;let l=new kF(this,null,-1).goto(0),c=0,d=[],h=new ql;for(;l.value||c<n.length;)if(c<n.length&&(l.from-n[c].from||l.startSide-n[c].value.startSide)>=0){let m=n[c++];h.addInner(m.from,m.to,m.value)||d.push(m)}else l.rangeIndex==1&&l.chunkIndex<this.chunk.length&&(c==n.length||this.chunkEnd(l.chunkIndex)<n[c].from)&&(!a||s>this.chunkEnd(l.chunkIndex)||i<this.chunkPos[l.chunkIndex])&&h.addChunk(this.chunkPos[l.chunkIndex],this.chunk[l.chunkIndex])?l.nextChunk():((!a||s>l.to||i<l.from||a(l.from,l.to,l.value))&&(h.addInner(l.from,l.to,l.value)||d.push(Ck.create(l.from,l.to,l.value))),l.next());return h.finishInner(this.nextLayer.isEmpty&&!d.length?Rn.empty:this.nextLayer.update({add:d,filter:a,filterFrom:s,filterTo:i}))}map(e){if(e.empty||this.isEmpty)return this;let n=[],r=[],s=-1;for(let a=0;a<this.chunk.length;a++){let l=this.chunkPos[a],c=this.chunk[a],d=e.touchesRange(l,l+c.length);if(d===!1)s=Math.max(s,c.maxPoint),n.push(c),r.push(e.mapPos(l));else if(d===!0){let{mapped:h,pos:m}=c.map(l,e);h&&(s=Math.max(s,h.maxPoint),n.push(h),r.push(m))}}let i=this.nextLayer.map(e);return n.length==0?i:new Rn(r,n,i||Rn.empty,s)}between(e,n,r){if(!this.isEmpty){for(let s=0;s<this.chunk.length;s++){let i=this.chunkPos[s],a=this.chunk[s];if(n>=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 F0.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,n=0){return F0.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),l=n.filter(m=>m.maxPoint>0||!m.isEmpty&&m.maxPoint>=i),c=hE(a,l,r),d=new Fm(a,c,i),h=new Fm(l,c,i);r.iterGaps((m,g,x)=>fE(d,m,h,g,x,s)),r.empty&&r.length==0&&fE(d,0,h,0,0,s)}static eq(e,n,r=0,s){s==null&&(s=999999999);let i=e.filter(h=>!h.isEmpty&&n.indexOf(h)<0),a=n.filter(h=>!h.isEmpty&&e.indexOf(h)<0);if(i.length!=a.length)return!1;if(!i.length)return!0;let l=hE(i,a),c=new Fm(i,l,0).goto(r),d=new Fm(a,l,0).goto(r);for(;;){if(c.to!=d.to||!Ek(c.active,d.active)||c.point&&(!d.point||!c.point.eq(d.point)))return!1;if(c.to>s)return!0;c.next(),d.next()}}static spans(e,n,r,s,i=-1){let a=new Fm(e,null,i).goto(n),l=n,c=a.openStart;for(;;){let d=Math.min(a.to,r);if(a.point){let h=a.activeForPoint(a.to),m=a.pointFrom<n?h.length+1:a.point.startSide<0?h.length:Math.min(h.length,c);s.point(l,d,a.point,h,m,a.pointRank),c=Math.min(a.openEnd(d),h.length)}else d>l&&(s.span(l,d,a.active,c),c=a.openEnd(d));if(a.to>r)return c+(a.point&&a.to>r?1:0);l=a.to,a.next()}}static of(e,n=!1){let r=new ql;for(let s of e instanceof Ck?[e]:n?Qae(e):e)r.add(s.from,s.to,s.value);return r.finish()}static join(e){if(!e.length)return Rn.empty;let n=e[e.length-1];for(let r=e.length-2;r>=0;r--)for(let s=e[r];s!=Rn.empty;s=s.nextLayer)n=new Rn(s.chunkPos,s.chunk,n,Math.max(s.maxPoint,n.maxPoint));return n}}Rn.empty=new Rn([],[],null,-1);function Qae(t){if(t.length>1)for(let e=t[0],n=1;n<t.length;n++){let r=t[n];if(Tk(e,r)>0)return t.slice().sort(Tk);e=r}return t}Rn.empty.nextLayer=Rn.empty;class ql{finishChunk(e){this.chunks.push(new t6(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 ql)).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(Rn.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let n=Rn.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,n}}function hE(t,e,n){let r=new Map;for(let i of t)for(let a=0;a<i.chunk.length;a++)i.chunk[a].maxPoint<=0&&r.set(i.chunk[a],i.chunkPos[a]);let s=new Set;for(let i of e)for(let a=0;a<i.chunk.length;a++){let l=r.get(i.chunk[a]);l!=null&&(n?n.mapPos(l):l)==i.chunkPos[a]&&!n?.touchesRange(l,l+i.chunk[a].length)&&s.add(i.chunk[a])}return s}class kF{constructor(e,n,r,s=0){this.layer=e,this.skip=n,this.minPoint=r,this.rank=s}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(e,n=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e,n,!1),this}gotoInner(e,n,r){for(;this.chunkIndex<this.layer.chunk.length;){let s=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(s)||this.layer.chunkEnd(this.chunkIndex)<e||s.maxPoint<this.minPoint))break;this.chunkIndex++,r=!1}if(this.chunkIndex<this.layer.chunk.length){let s=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],n,!0);(!r||this.rangeIndex<s)&&this.setRangeIndex(s)}this.next()}forward(e,n){(this.to-e||this.endSide-n)<0&&this.gotoInner(e,n,!0)}next(){for(;;)if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}else{let e=this.layer.chunkPos[this.chunkIndex],n=this.layer.chunk[this.chunkIndex],r=e+n.from[this.rangeIndex];if(this.from=r,this.to=e+n.to[this.rangeIndex],this.value=n.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=e}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(e){return this.from-e.from||this.startSide-e.startSide||this.rank-e.rank||this.to-e.to||this.endSide-e.endSide}}class F0{constructor(e){this.heap=e}static from(e,n=null,r=-1){let s=[];for(let i=0;i<e.length;i++)for(let a=e[i];!a.isEmpty;a=a.nextLayer)a.maxPoint>=r&&s.push(new kF(a,n,r,i));return s.length==1?s[0]:new F0(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--)R4(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--)R4(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(),R4(this.heap,0)}}}function R4(t,e){for(let n=t[e];;){let r=(e<<1)+1;if(r>=t.length)break;let s=t[r];if(r+1<t.length&&s.compare(t[r+1])>=0&&(s=t[r+1],r++),n.compare(s)<0)break;t[r]=n,t[e]=s,e=r}}class Fm{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=F0.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){Jx(this.active,e),Jx(this.activeTo,e),Jx(this.activeRank,e),this.minActive=mE(this.active,this.activeTo)}addActive(e){let n=0,{value:r,to:s,rank:i}=this.cursor;for(;n<this.activeRank.length&&(i-this.activeRank[n]||s-this.activeTo[n])>0;)n++;e1(this.active,n,r),e1(this.activeTo,n,s),e1(this.activeRank,n,i),e&&e1(e,n,this.cursor.from),this.minActive=mE(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&&Jx(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<this.cursor.to)this.cursor.next();else{this.point=i,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=i.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}}else{this.to=this.endSide=1e9;break}}if(r){this.openStart=0;for(let s=r.length-1;s>=0&&r[s]<e;s--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let n=[];for(let r=this.active.length-1;r>=0&&!(this.activeRank[r]<this.pointRank);r--)(this.activeTo[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 fE(t,e,n,r,s,i){t.goto(e),n.goto(r);let a=r+s,l=r,c=r-e;for(;;){let d=t.to+c-n.to,h=d||t.endSide-n.endSide,m=h<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))&&Ek(t.activeForPoint(t.to),n.activeForPoint(n.to))||i.comparePoint(l,g,t.point,n.point):g>l&&!Ek(t.active,n.active)&&i.compareRange(l,g,t.active,n.active),m>a)break;(d||t.openEnd!=n.openEnd)&&i.boundChange&&i.boundChange(m),l=m,h<=0&&t.next(),h>=0&&n.next()}}function Ek(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!=e[n]&&!t[n].eq(e[n]))return!1;return!0}function Jx(t,e){for(let n=e,r=t.length-1;n<r;n++)t[n]=t[n+1];t.pop()}function e1(t,e,n){for(let r=t.length-1;r>=e;r--)t[r+1]=t[r];t[e]=n}function mE(t,e){let n=-1,r=1e9;for(let s=0;s<e.length;s++)(e[s]-r||t[s].endSide-t[n].endSide)<0&&(n=s,r=e[s]);return n}function Nf(t,e,n=t.length){let r=0;for(let s=0;s<n&&s<t.length;)t.charCodeAt(s)==9?(r+=e-r%e,s++):(r++,s=zs(t,s));return r}function _k(t,e,n,r){for(let s=0,i=0;;){if(i>=e)return s;if(s==t.length)break;i+=t.charCodeAt(s)==9?n-i%n:1,s=zs(t,s)}return r===!0?-1:t.length}const Ak="ͼ",pE=typeof Symbol>"u"?"__"+Ak:Symbol.for(Ak),Mk=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),gE=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class Wc{constructor(e,n){this.rules=[];let{finish:r}=n||{};function s(a){return/^@/.test(a)?[a]:a.split(/,\s*/)}function i(a,l,c,d){let h=[],m=/^@(\w+)\b/.exec(a[0]),g=m&&m[1]=="keyframes";if(m&&l==null)return c.push(a[0]+";");for(let x in l){let y=l[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,h,g)}else y!=null&&h.push(x.replace(/_.*/,"").replace(/[A-Z]/g,w=>"-"+w.toLowerCase())+": "+y+";")}(h.length||g)&&c.push((r&&!m&&!d?a.map(r):a).join(", ")+" {"+h.join(" ")+"}")}for(let a in e)i(s(a),e[a],this.rules)}getRules(){return this.rules.join(`
`)}static newName(){let e=gE[pE]||1;return gE[pE]=e+1,Ak+e.toString(36)}static mount(e,n,r){let s=e[Mk],i=r&&r.nonce;s?i&&s.setNonce(i):s=new Vae(e,i),s.mount(Array.isArray(n)?n:[n],e)}}let xE=new Map;class Vae{constructor(e,n){let r=e.ownerDocument||e,s=r.defaultView;if(!e.head&&e.adoptedStyleSheets&&s.CSSStyleSheet){let i=xE.get(r);if(i)return e[Mk]=i;this.sheet=new s.CSSStyleSheet,xE.set(r,this)}else this.styleTag=r.createElement("style"),n&&this.styleTag.setAttribute("nonce",n);this.modules=[],e[Mk]=this}mount(e,n){let r=this.sheet,s=0,i=0;for(let a=0;a<e.length;a++){let l=e[a],c=this.modules.indexOf(l);if(c<i&&c>-1&&(this.modules.splice(c,1),i--,c=-1),c==-1){if(this.modules.splice(i++,0,l),r)for(let d=0;d<l.rules.length;d++)r.insertRule(l.rules[d],s++)}else{for(;i<c;)s+=this.modules[i++].rules.length;s+=l.rules.length,i++}}if(r)n.adoptedStyleSheets.indexOf(this.sheet)<0&&(n.adoptedStyleSheets=[this.sheet,...n.adoptedStyleSheets]);else{let a="";for(let c=0;c<this.modules.length;c++)a+=this.modules[c].getRules()+`
`;this.styleTag.textContent=a;let l=n.head||n;this.styleTag.parentNode!=l&&l.insertBefore(this.styleTag,l.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}}var Gc={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},q0={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Uae=typeof navigator<"u"&&/Mac/.test(navigator.platform),Wae=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Ms=0;Ms<10;Ms++)Gc[48+Ms]=Gc[96+Ms]=String(Ms);for(var Ms=1;Ms<=24;Ms++)Gc[Ms+111]="F"+Ms;for(var Ms=65;Ms<=90;Ms++)Gc[Ms]=String.fromCharCode(Ms+32),q0[Ms]=String.fromCharCode(Ms);for(var D4 in Gc)q0.hasOwnProperty(D4)||(q0[D4]=Gc[D4]);function Gae(t){var e=Uae&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||Wae&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?q0:Gc)[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 sr(){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(;e<arguments.length;e++)OF(t,arguments[e]);return t}function OF(t,e){if(typeof e=="string")t.appendChild(document.createTextNode(e));else if(e!=null)if(e.nodeType!=null)t.appendChild(e);else if(Array.isArray(e))for(var n=0;n<e.length;n++)OF(t,e[n]);else throw new RangeError("Unsupported child node: "+e)}let Zs=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},Rk=typeof document<"u"?document:{documentElement:{style:{}}};const Dk=/Edge\/(\d+)/.exec(Zs.userAgent),jF=/MSIE \d/.test(Zs.userAgent),Pk=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Zs.userAgent),cb=!!(jF||Pk||Dk),vE=!cb&&/gecko\/(\d+)/i.test(Zs.userAgent),P4=!cb&&/Chrome\/(\d+)/.exec(Zs.userAgent),Xae="webkitFontSmoothing"in Rk.documentElement.style,zk=!cb&&/Apple Computer/.test(Zs.vendor),yE=zk&&(/Mobile\/\w+/.test(Zs.userAgent)||Zs.maxTouchPoints>2);var et={mac:yE||/Mac/.test(Zs.platform),windows:/Win/.test(Zs.platform),linux:/Linux|X11/.test(Zs.platform),ie:cb,ie_version:jF?Rk.documentMode||6:Pk?+Pk[1]:Dk?+Dk[1]:0,gecko:vE,gecko_version:vE?+(/Firefox\/(\d+)/.exec(Zs.userAgent)||[0,0])[1]:0,chrome:!!P4,chrome_version:P4?+P4[1]:0,ios:yE,android:/Android\b/.test(Zs.userAgent),webkit_version:Xae?+(/\bAppleWebKit\/(\d+)/.exec(Zs.userAgent)||[0,0])[1]:0,safari:zk,safari_version:zk?+(/\bVersion\/(\d+(\.\d+)?)/.exec(Zs.userAgent)||[0,0])[1]:0,tabSize:Rk.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function $0(t){let e;return t.nodeType==11?e=t.getSelection?t:t.ownerDocument:e=t,e.getSelection()}function Ik(t,e){return e?t==e||t.contains(e.nodeType!=1?e.parentNode:e):!1}function lv(t,e){if(!e.anchorNode)return!1;try{return Ik(t,e.anchorNode)}catch{return!1}}function Jh(t){return t.nodeType==3?ad(t,0,t.nodeValue.length).getClientRects():t.nodeType==1?t.getClientRects():[]}function S0(t,e,n,r){return n?bE(t,e,n,r,-1)||bE(t,e,n,r,1):!1}function id(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e}function Qv(t){return t.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}function bE(t,e,n,r,s){for(;;){if(t==n&&e==r)return!0;if(e==(s<0?0:Lo(t))){if(t.nodeName=="DIV")return!1;let i=t.parentNode;if(!i||i.nodeType!=1)return!1;e=id(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?Lo(t):0}else return!1}}function Lo(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function qp(t,e){let n=e?t.left:t.right;return{left:n,right:n,top:t.top,bottom:t.bottom}}function Yae(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 NF(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 Kae(t,e,n,r,s,i,a,l){let c=t.ownerDocument,d=c.defaultView||window;for(let h=t,m=!1;h&&!m;)if(h.nodeType==1){let g,x=h==c.body,y=1,w=1;if(x)g=Yae(d);else{if(/^(fixed|sticky)$/.test(getComputedStyle(h).position)&&(m=!0),h.scrollHeight<=h.clientHeight&&h.scrollWidth<=h.clientWidth){h=h.assignedSlot||h.parentNode;continue}let j=h.getBoundingClientRect();({scaleX:y,scaleY:w}=NF(h,j)),g={left:j.left,right:j.left+h.clientWidth*y,top:j.top,bottom:j.top+h.clientHeight*w}}let S=0,k=0;if(s=="nearest")e.top<g.top?(k=e.top-(g.top+a),n>0&&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-k<g.top&&(k=e.top-(g.top+a)));else{let j=e.bottom-e.top,N=g.bottom-g.top;k=(s=="center"&&j<=N?e.top+j/2-N/2:s=="start"||s=="center"&&n<0?e.top-a:e.bottom-N+a)-g.top}if(r=="nearest"?e.left<g.left?(S=e.left-(g.left+i),n>0&&e.right>g.right+S&&(S=e.right-g.right+i)):e.right>g.right&&(S=e.right-g.right+i,n<0&&e.left<g.left+S&&(S=e.left-(g.left+i))):S=(r=="center"?e.left+(e.right-e.left)/2-(g.right-g.left)/2:r=="start"==l?e.left-i:e.right-(g.right-g.left)+i)-g.left,S||k)if(x)d.scrollBy(S,k);else{let j=0,N=0;if(k){let T=h.scrollTop;h.scrollTop+=k/w,N=(h.scrollTop-T)*w}if(S){let T=h.scrollLeft;h.scrollLeft+=S/y,j=(h.scrollLeft-T)*y}e={left:e.left-j,top:e.top-N,right:e.right-j,bottom:e.bottom-N},j&&Math.abs(j-S)<1&&(r="nearest"),N&&Math.abs(N-k)<1&&(s="nearest")}if(x)break;(e.top<g.top||e.bottom>g.bottom||e.left<g.left||e.right>g.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)}),h=h.assignedSlot||h.parentNode}else if(h.nodeType==11)h=h.host;else break}function Zae(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 Jae{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?Lo(n):0),r,Math.min(e.focusOffset,r?Lo(r):0))}set(e,n,r,s){this.anchorNode=e,this.anchorOffset=n,this.focusNode=r,this.focusOffset=s}}let Iu=null;et.safari&&et.safari_version>=26&&(Iu=!1);function CF(t){if(t.setActive)return t.setActive();if(Iu)return t.focus(Iu);let e=[];for(let n=t;n&&(e.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(t.focus(Iu==null?{get preventScroll(){return Iu={preventScroll:!0},!0}}:void 0),!Iu){Iu=!1;for(let n=0;n<e.length;){let r=e[n++],s=e[n++],i=e[n++];r.scrollTop!=s&&(r.scrollTop=s),r.scrollLeft!=i&&(r.scrollLeft=i)}}}let wE;function ad(t,e,n=e){let r=wE||(wE=document.createRange());return r.setEnd(t,n),r.setStart(t,e),r}function Ph(t,e,n,r){let s={key:e,code:e,keyCode:n,which:n,cancelable:!0};r&&({altKey:s.altKey,ctrlKey:s.ctrlKey,shiftKey:s.shiftKey,metaKey:s.metaKey}=r);let i=new KeyboardEvent("keydown",s);i.synthetic=!0,t.dispatchEvent(i);let a=new KeyboardEvent("keyup",s);return a.synthetic=!0,t.dispatchEvent(a),i.defaultPrevented||a.defaultPrevented}function eoe(t){for(;t;){if(t&&(t.nodeType==9||t.nodeType==11&&t.host))return t;t=t.assignedSlot||t.parentNode}return null}function TF(t){for(;t.attributes.length;)t.removeAttributeNode(t.attributes[0])}function toe(t,e){let n=e.focusNode,r=e.focusOffset;if(!n||e.anchorNode!=n||e.anchorOffset!=r)return!1;for(r=Math.min(r,Lo(n));;)if(r){if(n.nodeType!=1)return!1;let s=n.childNodes[r-1];s.contentEditable=="false"?r--:(n=s,r=Lo(n))}else{if(n==t)return!0;r=id(n),n=n.parentNode}}function EF(t){return t.scrollTop>Math.max(1,t.scrollHeight-t.clientHeight-4)}function _F(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=Lo(n)}else if(n.parentNode&&!Qv(n))r=id(n),n=n.parentNode;else return null}}function AF(t,e){for(let n=t,r=e;;){if(n.nodeType==3&&r<n.nodeValue.length)return{node:n,offset:r};if(n.nodeType==1&&r<n.childNodes.length){if(n.contentEditable=="false")return null;n=n.childNodes[r],r=0}else if(n.parentNode&&!Qv(n))r=id(n)+1,n=n.parentNode;else return null}}class Qs{constructor(e,n,r=!0){this.node=e,this.offset=n,this.precise=r}static before(e,n){return new Qs(e.parentNode,id(e),n)}static after(e,n){return new Qs(e.parentNode,id(e)+1,n)}}const n6=[];class er{constructor(){this.parent=null,this.dom=null,this.flags=2}get overrideDOMText(){return null}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e){let n=this.posAtStart;for(let r of this.children){if(r==e)return n;n+=r.length+r.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}sync(e,n){if(this.flags&2){let r=this.dom,s=null,i;for(let a of this.children){if(a.flags&7){if(!a.dom&&(i=s?s.nextSibling:r.firstChild)){let l=er.get(i);(!l||!l.parent&&l.canReuseDOM(a))&&a.reuseDOM(i)}a.sync(e,n),a.flags&=-8}if(i=s?s.nextSibling:r.firstChild,n&&!n.written&&n.node==r&&i!=a.dom&&(n.written=!0),a.dom.parentNode==r)for(;i&&i!=a.dom;)i=SE(i);else r.insertBefore(a.dom,i);s=a.dom}for(i=s?s.nextSibling:r.firstChild,i&&n&&n.node==r&&(n.written=!0);i;)i=SE(i)}else if(this.flags&1)for(let r of this.children)r.flags&7&&(r.sync(e,n),r.flags&=-8)}reuseDOM(e){}localPosFromDOM(e,n){let r;if(e==this.dom)r=this.dom.childNodes[n];else{let s=Lo(e)==0?0:n==0?-1:1;for(;;){let i=e.parentNode;if(i==this.dom)break;s==0&&i.firstChild!=i.lastChild&&(e==i.firstChild?s=-1:s=1),e=i}s<0?r=e:r=e.nextSibling}if(r==this.dom.firstChild)return 0;for(;r&&!er.get(r);)r=r.nextSibling;if(!r)return this.length;for(let s=0,i=0;;s++){let a=this.children[s];if(a.dom==r)return i;i+=a.length+a.breakAfter}}domBoundsAround(e,n,r=0){let s=-1,i=-1,a=-1,l=-1;for(let c=0,d=r,h=r;c<this.children.length;c++){let m=this.children[c],g=d+m.length;if(d<e&&g>n)return m.domBoundsAround(e,n,d);if(g>=e&&s==-1&&(s=c,i=d),d>n&&m.dom.parentNode==this.dom){a=c,l=h;break}h=g,d=g+m.breakAfter}return{from:i,to:l<0?r+this.length:l,startDOM:(s?this.children[s-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:a<this.children.length&&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=n6){this.markDirty();for(let s=e;s<n;s++){let i=this.children[s];i.parent==this&&r.indexOf(i)<0&&i.destroy()}r.length<250?this.children.splice(e,n-e,...r):this.children=[].concat(this.children.slice(0,e),r,this.children.slice(n));for(let s=0;s<r.length;s++)r[s].setParent(this)}ignoreMutation(e){return!1}ignoreEvent(e){return!1}childCursor(e=this.length){return new MF(this.children,e,this.children.length)}childPos(e,n=1){return this.childCursor().findPos(e,n)}toString(){let e=this.constructor.name.replace("View","");return e+(this.children.length?"("+this.children.join()+")":this.length?"["+(e=="Text"?this.text:this.length)+"]":"")+(this.breakAfter?"#":"")}static get(e){return e.cmView}get isEditable(){return!0}get isWidget(){return!1}get isHidden(){return!1}merge(e,n,r,s,i,a){return!1}become(e){return!1}canReuseDOM(e){return e.constructor==this.constructor&&!((this.flags|e.flags)&8)}getSide(){return 0}destroy(){for(let e of this.children)e.parent==this&&e.destroy();this.parent=null}}er.prototype.breakAfter=0;function SE(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class MF{constructor(e,n,r){this.children=e,this.pos=n,this.i=r,this.off=0}findPos(e,n=1){for(;;){if(e>this.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 RF(t,e,n,r,s,i,a,l,c){let{children:d}=t,h=d.length?d[e]:null,m=i.length?i[i.length-1]:null,g=m?m.breakAfter:a;if(!(e==r&&h&&!a&&!g&&i.length<2&&h.merge(n,s,i.length?m:null,n==0,l,c))){if(r<d.length){let x=d[r];x&&(s<x.length||x.breakAfter&&m?.breakAfter)?(e==r&&(x=x.split(s),s=0),!g&&m&&x.merge(0,s,m,!0,0,c)?i[i.length-1]=x:((s||x.children.length&&!x.children[0].length)&&x.merge(0,s,null,!1,0,c),i.push(x))):x?.breakAfter&&(m?m.breakAfter=1:a=1),r++}for(h&&(h.breakAfter=a,n>0&&(!a&&i.length&&h.merge(n,h.length,i[0],!1,l,0)?h.breakAfter=i.shift().breakAfter:(n<h.length||h.children.length&&h.children[h.children.length-1].length==0)&&h.merge(n,h.length,null,!1,l,0),e++));e<r&&i.length;)if(d[r-1].become(i[i.length-1]))r--,i.pop(),c=i.length?0:l;else if(d[e].become(i[0]))e++,i.shift(),l=i.length?0:c;else break;!i.length&&e&&r<d.length&&!d[e-1].breakAfter&&d[r].merge(0,0,d[e-1],!1,l,c)&&e--,(e<r||i.length)&&t.replaceChildren(e,r,i)}}function DF(t,e,n,r,s,i){let a=t.childCursor(),{i:l,off:c}=a.findPos(n,1),{i:d,off:h}=a.findPos(e,-1),m=e-n;for(let g of r)m+=g.length;t.length+=m,RF(t,d,h,l,c,r,0,s,i)}const noe=256;class Ya extends er{constructor(e){super(),this.text=e}get length(){return this.text.length}createDOM(e){this.setDOM(e||document.createTextNode(this.text))}sync(e,n){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(n&&n.node==this.dom&&(n.written=!0),this.dom.nodeValue=this.text)}reuseDOM(e){e.nodeType==3&&this.createDOM(e)}merge(e,n,r){return this.flags&8||r&&(!(r instanceof Ya)||this.length-(n-e)+r.length>noe||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 Ya(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 Qs(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 roe(this.dom,e,n)}}class $l extends er{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(TF(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 $l&&r.mark.eq(this.mark))||e&&i<=0||n<this.length&&a<=0)?!1:(DF(this,e,n,r?r.children.slice():[],i-1,a-1),this.markDirty(),!0)}split(e){let n=[],r=0,s=-1,i=0;for(let l of this.children){let c=r+l.length;c>e&&n.push(r<e?l.split(e-r):l),s<0&&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 $l(this.mark,n,a)}domAtPos(e){return PF(this,e)}coordsAt(e,n){return IF(this,e,n)}}function roe(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?et.chrome||et.gecko||(e?(s--,a=1):i<r&&(i++,a=-1)):n<0?s--:i<r&&i++;let l=ad(t,s,i).getClientRects();if(!l.length)return null;let c=l[(a?a<0:n>=0)?0:l.length-1];return et.safari&&!a&&c.width==0&&(c=Array.prototype.find.call(l,d=>d.width)||c),a?qp(c,a<0):c||null}class Al extends er{static create(e,n,r){return new Al(e,n,r)}constructor(e,n,r){super(),this.widget=e,this.length=n,this.side=r,this.prevWidget=null}split(e){let n=Al.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 Al)||!this.widget.compare(r.widget)||e>0&&i<=0||n<this.length&&a<=0)?!1:(this.length=e+(r?r.length:0)+(this.length-n),!0)}become(e){return e instanceof Al&&e.side==this.side&&this.widget.constructor==e.widget.constructor?(this.widget.compare(e.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=e.widget,this.length=e.length,!0):!1}ignoreMutation(){return!0}ignoreEvent(e){return this.widget.ignoreEvent(e)}get overrideDOMText(){if(this.length==0)return jn.empty;let e=this;for(;e.parent;)e=e.parent;let{view:n}=e,r=n&&n.state.doc,s=this.posAtStart;return r?r.slice(s,s+this.length):jn.empty}domAtPos(e){return(this.length?e==0:this.side>0)?Qs.before(this.dom):Qs.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 l=a?s.length-1:0;i=s[l],!(e>0?l==0:l==s.length-1||i.top<i.bottom);l+=a?-1:1);return qp(i,!a)}get isEditable(){return!1}get isWidget(){return!0}get isHidden(){return this.widget.isHidden}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}}class ef extends er{constructor(e){super(),this.side=e}get length(){return 0}merge(){return!1}become(e){return e instanceof ef&&e.side==this.side}split(){return new ef(this.side)}sync(){if(!this.dom){let e=document.createElement("img");e.className="cm-widgetBuffer",e.setAttribute("aria-hidden","true"),this.setDOM(e)}}getSide(){return this.side}domAtPos(e){return this.side>0?Qs.before(this.dom):Qs.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(e){return this.dom.getBoundingClientRect()}get overrideDOMText(){return jn.empty}get isHidden(){return!0}}Ya.prototype.children=Al.prototype.children=ef.prototype.children=n6;function PF(t,e){let n=t.dom,{children:r}=t,s=0;for(let i=0;s<r.length;s++){let a=r[s],l=i+a.length;if(!(l==i&&a.getSide()<=0)){if(e>i&&e<l&&a.dom.parentNode==n)return a.domAtPos(e-i);if(e<=i)break;i=l}}for(let i=s;i>0;i--){let a=r[i-1];if(a.dom.parentNode==n)return a.domAtPos(a.length)}for(let i=s;i<r.length;i++){let a=r[i];if(a.dom.parentNode==n)return a.domAtPos(0)}return new Qs(n,0)}function zF(t,e,n){let r,{children:s}=t;n>0&&e instanceof $l&&s.length&&(r=s[s.length-1])instanceof $l&&r.mark.eq(e.mark)?zF(r,e.children[0],n-1):(s.push(e),e.setParent(t)),t.length+=e.length}function IF(t,e,n){let r=null,s=-1,i=null,a=-1;function l(d,h){for(let m=0,g=0;m<d.children.length&&g<=h;m++){let x=d.children[m],y=g+x.length;y>=h&&(x.children.length?l(x,h-g):(!i||i.isHidden&&(n>0||ioe(i,x)))&&(y>h||g==y&&x.getSide()>0)?(i=x,a=h-g):(g<h||g==y&&x.getSide()<0&&!x.isHidden)&&(r=x,s=h-g)),g=y}}l(t,e);let c=(n<0?r:i)||r||i;return c?c.coordsAt(Math.max(0,c==r?s:a),n):soe(t)}function soe(t){let e=t.dom.lastChild;if(!e)return t.dom.getBoundingClientRect();let n=Jh(e);return n[n.length-1]||null}function ioe(t,e){let n=t.coordsAt(0,1),r=e.coordsAt(0,1);return n&&r&&r.top<n.bottom}function Lk(t,e){for(let n in t)n=="class"&&e.class?e.class+=" "+t.class:n=="style"&&e.style?e.style+=";"+t.style:e[n]=t[n];return e}const kE=Object.create(null);function Vv(t,e,n){if(t==e)return!0;t||(t=kE),e||(e=kE);let r=Object.keys(t),s=Object.keys(e);if(r.length-(n&&r.indexOf(n)>-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 Bk(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 aoe(t){let e=Object.create(null);for(let n=0;n<t.attributes.length;n++){let r=t.attributes[n];e[r.name]=r.value}return e}class Ho{eq(e){return!1}updateDOM(e,n){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,n,r){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}}var ni=(function(t){return t[t.Text=0]="Text",t[t.WidgetBefore=1]="WidgetBefore",t[t.WidgetAfter=2]="WidgetAfter",t[t.WidgetRange=3]="WidgetRange",t})(ni||(ni={}));class kt extends sd{constructor(e,n,r,s){super(),this.startSide=e,this.endSide=n,this.widget=r,this.spec=s}get heightRelevant(){return!1}static mark(e){return new $p(e)}static widget(e){let n=Math.max(-1e4,Math.min(1e4,e.side||0)),r=!!e.block;return n+=r&&!e.inlineOrder?n>0?3e8:-4e8:n>0?1e8:-1e8,new Xc(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}=LF(e,n);r=(i?n?-3e8:-1:5e8)-1,s=(a?n?2e8:1:-6e8)+1}return new Xc(e,r,s,n,e.widget||null,!0)}static line(e){return new Hp(e)}static set(e,n=!1){return Rn.of(e,n)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}kt.none=Rn.empty;class $p extends kt{constructor(e){let{start:n,end:r}=LF(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 $p&&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))&&Vv(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)}}$p.prototype.point=!1;class Hp extends kt{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof Hp&&this.spec.class==e.spec.class&&Vv(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)}}Hp.prototype.mapMode=Ds.TrackBefore;Hp.prototype.point=!0;class Xc extends kt{constructor(e,n,r,s,i,a){super(n,r,i,e),this.block=s,this.isReplace=a,this.mapMode=s?n<=0?Ds.TrackBefore:Ds.TrackAfter:Ds.TrackDel}get type(){return this.startSide!=this.endSide?ni.WidgetRange:this.startSide<=0?ni.WidgetBefore:ni.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof Xc&&ooe(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)}}Xc.prototype.point=!0;function LF(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 ooe(t,e){return t==e||!!(t&&e&&t.compare(e))}function cv(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 es extends er{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 es))return!1;this.dom||r.transferDOM(this)}return s&&this.setDeco(r?r.attrs:null),DF(this,e,n,r?r.children.slice():[],i,a),!0}split(e){let n=new es;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;i<this.children.length;i++)n.append(this.children[i],0);for(;r>0&&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){Vv(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,n){zF(this,e,n)}addLineDeco(e){let n=e.spec.attributes,r=e.spec.class;n&&(this.attrs=Lk(n,this.attrs||{})),r&&(this.attrs=Lk({class:r},this.attrs||{}))}domAtPos(e){return PF(this,e)}reuseDOM(e){e.nodeName=="DIV"&&(this.setDOM(e),this.flags|=6)}sync(e,n){var r;this.dom?this.flags&4&&(TF(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&&(Bk(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&&er.get(s)instanceof $l;)s=s.lastChild;if(!s||!this.length||s.nodeName!="BR"&&((r=er.get(s))===null||r===void 0?void 0:r.isEditable)==!1&&(!et.ios||!this.children.some(i=>i instanceof Ya))){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 Ya)||/[^ -~]/.test(r.text))return null;let s=Jh(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=IF(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<i){let a=(i-s.textHeight)/2;return{top:r.top+a,bottom:r.bottom-a,left:r.left,right:r.left}}}return r}become(e){return e instanceof es&&this.children.length==0&&e.children.length==0&&Vv(this.attrs,e.attrs)&&this.breakAfter==e.breakAfter}covers(){return!0}static find(e,n){for(let r=0,s=0;r<e.children.length;r++){let i=e.children[r],a=s+i.length;if(a>=n){if(i instanceof es)return i;if(a>n)break}s=a+i.breakAfter}return null}}class Il extends er{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 Il)||!this.widget.compare(r.widget)||e>0&&i<=0||n<this.length&&a<=0)?!1:(this.length=e+(r?r.length:0)+(this.length-n),!0)}domAtPos(e){return e==0?Qs.before(this.dom):Qs.after(this.dom,e==this.length)}split(e){let n=this.length-e;this.length=e;let r=new Il(this.widget,n,this.deco);return r.breakAfter=this.breakAfter,r}get children(){return n6}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"))}get overrideDOMText(){return this.parent?this.parent.view.state.doc.slice(this.posAtStart,this.posAtEnd):jn.empty}domBoundsAround(){return null}become(e){return e instanceof Il&&e.widget.constructor==this.widget.constructor?(e.widget.compare(this.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=e.widget,this.length=e.length,this.deco=e.deco,this.breakAfter=e.breakAfter,!0):!1}ignoreMutation(){return!0}ignoreEvent(e){return this.widget.ignoreEvent(e)}get isEditable(){return!1}get isWidget(){return!0}coordsAt(e,n){let r=this.widget.coordsAt(this.dom,e,n);return r||(this.widget instanceof Fk?null:qp(this.dom.getBoundingClientRect(),this.length?e==0:n<=0))}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}covers(e){let{startSide:n,endSide:r}=this.deco;return n==r?!1:e<0?n<0:r>0}}class Fk extends Ho{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 k0{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 Il&&e.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new es),this.atCursorPos=!0),this.curLine}flushBuffer(e=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(t1(new ef(-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 Il)&&this.getLine()}buildText(e,n,r){for(;e>0;){if(this.textOff==this.text.length){let{value:a,lineBreak:l,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(l){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(t1(new Ya(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 Xc){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 l=n-e;if(r instanceof Xc)if(r.block)r.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new Il(r.widget||tf.block,l,r));else{let c=Al.create(r.widget||tf.inline,l,l?0:r.startSide),d=this.atCursorPos&&!c.isEditable&&i<=s.length&&(e<n||r.startSide>0),h=!c.isEditable&&(e<n||i>s.length||r.startSide<=0),m=this.getLine();this.pendingBuffer==2&&!d&&!c.isEditable&&(this.pendingBuffer=0),this.flushBuffer(s),d&&(m.append(t1(new ef(1),s),i),i=s.length+Math.max(0,i-s.length)),m.append(t1(c,s),i),this.atCursorPos=h,this.pendingBuffer=h?e<n||i>s.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=s.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(r);l&&(this.textOff+l<=this.text.length?this.textOff+=l:(this.skip+=l-(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 k0(e,n,r,i);return a.openEnd=Rn.spans(s,n,r,a),a.openStart<0&&(a.openStart=a.openEnd),a.finish(a.openEnd),a}}function t1(t,e){for(let n of e)t=new $l(n,[t],t.length);return t}class tf extends Ho{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}}tf.inline=new tf("span");tf.block=new tf("div");var gr=(function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t})(gr||(gr={}));const od=gr.LTR,r6=gr.RTL;function BF(t){let e=[];for(let n=0;n<t.length;n++)e.push(1<<+t[n]);return e}const loe=BF("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),coe=BF("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),qk=Object.create(null),ho=[];for(let t of["()","[]","{}"]){let e=t.charCodeAt(0),n=t.charCodeAt(1);qk[e]=n,qk[n]=-e}function FF(t){return t<=247?loe[t]:1424<=t&&t<=1524?2:1536<=t&&t<=1785?coe[t-1536]:1774<=t&&t<=2220?4:8192<=t&&t<=8204?256:64336<=t&&t<=65023?4:1}const uoe=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class Fc{get dir(){return this.level%2?r6:od}constructor(e,n,r){this.from=e,this.to=n,this.level=r}side(e,n){return this.dir==n==e?this.to:this.from}forward(e,n){return e==(this.dir==n)}static find(e,n,r,s){let i=-1;for(let a=0;a<e.length;a++){let l=e[a];if(l.from<=n&&l.to>=n){if(l.level==r)return a;(i<0||(s!=0?s<0?l.from<n:l.to>n:e[i].level>l.level))&&(i=a)}}if(i<0)throw new RangeError("Index out of range");return i}}function qF(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++){let r=t[n],s=e[n];if(r.from!=s.from||r.to!=s.to||r.direction!=s.direction||!qF(r.inner,s.inner))return!1}return!0}const ir=[];function doe(t,e,n,r,s){for(let i=0;i<=r.length;i++){let a=i?r[i-1].to:e,l=i<r.length?r[i].from:n,c=i?256:s;for(let d=a,h=c,m=c;d<l;d++){let g=FF(t.charCodeAt(d));g==512?g=h:g==8&&m==4&&(g=16),ir[d]=g==4?2:g,g&7&&(m=g),h=g}for(let d=a,h=c,m=c;d<l;d++){let g=ir[d];if(g==128)d<l-1&&h==ir[d+1]&&h&24?g=ir[d]=h:ir[d]=256;else if(g==64){let x=d+1;for(;x<l&&ir[x]==64;)x++;let y=d&&h==8||x<n&&ir[x]==8?m==1?1:8:256;for(let w=d;w<x;w++)ir[w]=y;d=x-1}else g==8&&m==1&&(ir[d]=1);h=g,g&7&&(m=g)}}}function hoe(t,e,n,r,s){let i=s==1?2:1;for(let a=0,l=0,c=0;a<=r.length;a++){let d=a?r[a-1].to:e,h=a<r.length?r[a].from:n;for(let m=d,g,x,y;m<h;m++)if(x=qk[g=t.charCodeAt(m)])if(x<0){for(let w=l-3;w>=0;w-=3)if(ho[w+1]==-x){let S=ho[w+2],k=S&2?s:S&4?S&1?i:s:0;k&&(ir[m]=ir[ho[w]]=k),l=w;break}}else{if(ho.length==189)break;ho[l++]=m,ho[l++]=g,ho[l++]=c}else if((y=ir[m])==2||y==1){let w=y==s;c=w?0:1;for(let S=l-3;S>=0;S-=3){let k=ho[S+2];if(k&2)break;if(w)ho[S+2]|=2;else{if(k&4)break;ho[S+2]|=4}}}}}function foe(t,e,n,r){for(let s=0,i=r;s<=n.length;s++){let a=s?n[s-1].to:t,l=s<n.length?n[s].from:e;for(let c=a;c<l;){let d=ir[c];if(d==256){let h=c+1;for(;;)if(h==l){if(s==n.length)break;h=n[s++].to,l=s<n.length?n[s].from:e}else if(ir[h]==256)h++;else break;let m=i==1,g=(h<e?ir[h]:r)==1,x=m==g?m?1:2:r;for(let y=h,w=s,S=w?n[w-1].to:t;y>c;)y==S&&(y=n[--w].from,S=w?n[w-1].to:t),ir[--y]=x;c=h}else i=d,c++}}}function $k(t,e,n,r,s,i,a){let l=r%2?2:1;if(r%2==s%2)for(let c=e,d=0;c<n;){let h=!0,m=!1;if(d==i.length||c<i[d].from){let w=ir[c];w!=l&&(h=!1,m=w==16)}let g=!h&&l==1?[]:null,x=h?r:r+1,y=c;e:for(;;)if(d<i.length&&y==i[d].from){if(m)break e;let w=i[d];if(!h)for(let S=w.to,k=d+1;;){if(S==n)break e;if(k<i.length&&i[k].from==S)S=i[k++].to;else{if(ir[S]==l)break e;break}}if(d++,g)g.push(w);else{w.from>c&&a.push(new Fc(c,w.from,x));let S=w.direction==od!=!(x%2);Hk(t,S?r+1:r,s,w.inner,w.from,w.to,a),c=w.to}y=w.to}else{if(y==n||(h?ir[y]!=l:ir[y]==l))break;y++}g?$k(t,c,y,r+1,s,g,a):c<y&&a.push(new Fc(c,y,x)),c=y}else for(let c=n,d=i.length;c>e;){let h=!0,m=!1;if(!d||c>i[d-1].to){let w=ir[c-1];w!=l&&(h=!1,m=w==16)}let g=!h&&l==1?[]:null,x=h?r:r+1,y=c;e:for(;;)if(d&&y==i[d-1].to){if(m)break e;let w=i[--d];if(!h)for(let S=w.from,k=d;;){if(S==e)break e;if(k&&i[k-1].to==S)S=i[--k].from;else{if(ir[S-1]==l)break e;break}}if(g)g.push(w);else{w.to<c&&a.push(new Fc(w.to,c,x));let S=w.direction==od!=!(x%2);Hk(t,S?r+1:r,s,w.inner,w.from,w.to,a),c=w.from}y=w.from}else{if(y==e||(h?ir[y-1]!=l:ir[y-1]==l))break;y--}g?$k(t,y,c,r+1,s,g,a):y<c&&a.push(new Fc(y,c,x)),c=y}}function Hk(t,e,n,r,s,i,a){let l=e%2?2:1;doe(t,s,i,r,l),hoe(t,s,i,r,l),foe(s,i,r,l),$k(t,s,i,e,n,r,a)}function moe(t,e,n){if(!t)return[new Fc(0,0,e==r6?1:0)];if(e==od&&!n.length&&!uoe.test(t))return $F(t.length);if(n.length)for(;t.length>ir.length;)ir[ir.length]=256;let r=[],s=e==od?0:1;return Hk(t,s,s,n,0,t.length,r),r}function $F(t){return[new Fc(0,t,0)]}let HF="";function poe(t,e,n,r,s){var i;let a=r.head-t.from,l=Fc.find(e,a,(i=r.bidiLevel)!==null&&i!==void 0?i:-1,r.assoc),c=e[l],d=c.side(s,n);if(a==d){let g=l+=s?1:-1;if(g<0||g>=e.length)return null;c=e[l=g],a=c.side(!s,n),d=c.side(s,n)}let h=zs(t.text,a,c.forward(s,n));(h<c.from||h>c.to)&&(h=d),HF=t.text.slice(Math.min(a,h),Math.max(a,h));let m=l==(s?e.length-1:0)?null:e[l+(s?1:-1)];return m&&h==d&&m.level+(s?0:1)<c.level?Me.cursor(m.side(!s,n)+t.from,m.forward(s,n)?1:-1,m.level):Me.cursor(h+t.from,c.forward(s,n)?-1:1,c.level)}function goe(t,e,n){for(let r=e;r<n;r++){let s=FF(t.charCodeAt(r));if(s==1)return od;if(s==2||s==4)return r6}return od}const QF=at.define(),VF=at.define(),UF=at.define(),WF=at.define(),Qk=at.define(),GF=at.define(),XF=at.define(),s6=at.define(),i6=at.define(),YF=at.define({combine:t=>t.some(e=>e)}),KF=at.define({combine:t=>t.some(e=>e)}),ZF=at.define();class zh{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 zh(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 zh(Me.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const n1=Ft.define({map:(t,e)=>t.map(e)}),JF=Ft.define();function vi(t,e,n){let r=t.facet(WF);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 El=at.define({combine:t=>t.length?t[0]:!0});let xoe=0;const Nh=at.define({combine(t){return t.filter((e,n)=>{for(let r=0;r<n;r++)if(t[r].plugin==e.plugin)return!1;return!0})}});class Vr{constructor(e,n,r,s,i){this.id=e,this.create=n,this.domEventHandlers=r,this.domEventObservers=s,this.baseExtensions=i(this),this.extension=this.baseExtensions.concat(Nh.of({plugin:this,arg:void 0}))}of(e){return this.baseExtensions.concat(Nh.of({plugin:this,arg:e}))}static define(e,n){const{eventHandlers:r,eventObservers:s,provide:i,decorations:a}=n||{};return new Vr(xoe++,e,r,s,l=>{let c=[];return a&&c.push(H0.of(d=>{let h=d.plugin(l);return h?a(h):kt.none})),i&&c.push(i(l)),c})}static fromClass(e,n){return Vr.define((r,s)=>new e(r,s),n)}}class z4{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(vi(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){vi(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){vi(e.state,r,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const eq=at.define(),a6=at.define(),H0=at.define(),tq=at.define(),Qp=at.define(),nq=at.define();function OE(t,e){let n=t.state.facet(nq);if(!n.length)return n;let r=n.map(i=>i instanceof Function?i(t):i),s=[];return Rn.spans(r,e.from,e.to,{point(){},span(i,a,l,c){let d=i-e.from,h=a-e.from,m=s;for(let g=l.length-1;g>=0;g--,c--){let x=l[g].spec.bidiIsolate,y;if(x==null&&(x=goe(e.text,d,h)),c>0&&m.length&&(y=m[m.length-1]).to==d&&y.direction==x)y.to=h,m=y.inner;else{let w={from:d,to:h,direction:x,inner:[]};m.push(w),m=w.inner}}}}),s}const rq=at.define();function o6(t){let e=0,n=0,r=0,s=0;for(let i of t.state.facet(rq)){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 o0=at.define();class Na{constructor(e,n,r,s){this.fromA=e,this.toA=n,this.fromB=r,this.toB=s}join(e){return new Na(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.toA<r.fromA)break;r=r.join(s),e.splice(n-1,1)}}return e.splice(n,0,r),e}static extendWithRanges(e,n){if(n.length==0)return e;let r=[];for(let s=0,i=0,a=0,l=0;;s++){let c=s==e.length?null:e[s],d=a-l,h=c?c.fromB:1e9;for(;i<n.length&&n[i]<h;){let m=n[i],g=n[i+1],x=Math.max(l,m),y=Math.min(h,g);if(x<=y&&new Na(x+d,y+d,x,y).addToSet(r),g>h)break;i+=2}if(!c)return r;new Na(c.fromA,c.toA,c.fromB,c.toB).addToSet(r),a=c.toA,l=c.toB}}}class Uv{constructor(e,n,r){this.view=e,this.state=n,this.transactions=r,this.flags=0,this.startState=e.state,this.changes=us.empty(this.startState.doc.length);for(let i of r)this.changes=this.changes.compose(i.changes);let s=[];this.changes.iterChangedRanges((i,a,l,c)=>s.push(new Na(i,a,l,c))),this.changedRanges=s}static create(e,n,r){return new Uv(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 jE extends er{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=kt.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 es],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new Na(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:d,toA:h})=>h<this.minWidthFrom||d>this.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:!Ooe(e.changes,this.hasComposition)&&!e.selectionSet&&(s=e.state.selection.main.head));let i=s>-1?yoe(this.view,e.changes,s):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:d,to:h}=this.hasComposition;r=new Na(d,h,e.changes.mapPos(d,-1),e.changes.mapPos(h,1)).addToSet(r.slice())}this.hasComposition=i?{from:i.range.fromB,to:i.range.toB}:null,(et.ie||et.chrome)&&!i&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let a=this.decorations,l=this.updateDeco(),c=Soe(a,l,e.changes);return r=Na.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=et.chrome||et.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<this.view.state.doc.length)for(let a of this.children)a instanceof Il&&a.widget instanceof Fk&&i.push(a.dom);s.updateGaps(i)}updateChildren(e,n,r){let s=r?r.range.addToSet(e.slice()):e,i=this.childCursor(n);for(let a=s.length-1;;a--){let l=a>=0?s[a]:null;if(!l)break;let{fromA:c,toA:d,fromB:h,toB:m}=l,g,x,y,w;if(r&&r.range.fromB<m&&r.range.toB>h){let T=k0.build(this.view.state.doc,h,r.range.fromB,this.decorations,this.dynamicDecorationMap),E=k0.build(this.view.state.doc,r.range.toB,m,this.decorations,this.dynamicDecorationMap);x=T.breakAtStart,y=T.openStart,w=E.openEnd;let _=this.compositionView(r);E.breakAtStart?_.breakAfter=1:E.content.length&&_.merge(_.length,_.length,E.content[0],!1,E.openStart,0)&&(_.breakAfter=E.content[0].breakAfter,E.content.shift()),T.content.length&&_.merge(0,0,T.content[T.content.length-1],!0,0,T.openEnd)&&T.content.pop(),g=T.content.concat(_).concat(E.content)}else({content:g,breakAtStart:x,openStart:y,openEnd:w}=k0.build(this.view.state.doc,h,m,this.decorations,this.dynamicDecorationMap));let{i:S,off:k}=i.findPos(d,1),{i:j,off:N}=i.findPos(c,-1);RF(this,j,N,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(JF)&&(this.editContextFormatting=r.value)}compositionView(e){let n=new Ya(e.text.nodeValue);n.flags|=8;for(let{deco:s}of e.marks)n=new $l(s,[n],n.length);let r=new es;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 l=er.get(i);l&&l!=a&&(l.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(El)||this.dom.tabIndex>-1)&&lv(this.dom,this.view.observer.selectionRange)&&!(r&&this.dom.contains(r));if(!(s||n||i))return;let a=this.forceSelection;this.forceSelection=!1;let l=this.view.state.selection.main,c=this.moveToLine(this.domAtPos(l.anchor)),d=l.empty?c:this.moveToLine(this.domAtPos(l.head));if(et.gecko&&l.empty&&!this.hasComposition&&voe(c)){let m=document.createTextNode("");this.view.observer.ignore(()=>c.node.insertBefore(m,c.node.childNodes[c.offset]||null)),c=d=new Qs(m,0),a=!0}let h=this.view.observer.selectionRange;(a||!h.focusNode||(!S0(c.node,c.offset,h.anchorNode,h.anchorOffset)||!S0(d.node,d.offset,h.focusNode,h.focusOffset))&&!this.suppressWidgetCursorChange(h,l))&&(this.view.observer.ignore(()=>{et.android&&et.chrome&&this.dom.contains(h.focusNode)&&koe(h.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let m=$0(this.view.root);if(m)if(l.empty){if(et.gecko){let g=boe(c.node,c.offset);if(g&&g!=3){let x=(g==1?_F:AF)(c.node,c.offset);x&&(c=new Qs(x.node,x.offset))}}m.collapse(c.node,c.offset),l.bidiLevel!=null&&m.caretBidiLevel!==void 0&&(m.caretBidiLevel=l.bidiLevel)}else if(m.extend){m.collapse(c.node,c.offset);try{m.extend(d.node,d.offset)}catch{}}else{let g=document.createRange();l.anchor>l.head&&([c,d]=[d,c]),g.setEnd(d.node,d.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,d)),this.impreciseAnchor=c.precise?null:new Qs(h.anchorNode,h.anchorOffset),this.impreciseHead=d.precise?null:new Qs(h.focusNode,h.focusOffset)}suppressWidgetCursorChange(e,n){return this.hasComposition&&n.empty&&S0(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=$0(e.root),{anchorNode:s,anchorOffset:i}=e.observer.selectionRange;if(!r||!n.empty||!n.assoc||!r.modify)return;let a=es.find(this,n.head);if(!a)return;let l=a.posAtStart;if(n.head==l||n.head==l+a.length)return;let c=this.coordsAt(n.head,-1),d=this.coordsAt(n.head,1);if(!c||!d||c.bottom>d.top)return;let h=this.domAtPos(n.head+n.assoc);r.collapse(h.node,h.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<n.childNodes.length;s++){let i=er.get(n.childNodes[s]);i instanceof es&&(r=i.domAtPos(0))}for(let s=e.offset-1;!r&&s>=0;s--){let i=er.get(n.childNodes[s]);i instanceof es&&(r=i.domAtPos(i.length))}return r?new Qs(r.node,r.offset,!0):e}nearest(e){for(let n=e;n;){let r=er.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<this.children.length-1;){let s=this.children[n];if(r<s.length||s instanceof es)break;n++,r=0}return this.children[n].domAtPos(r)}coordsAt(e,n){let r=null,s=0;for(let i=this.length,a=this.children.length-1;a>=0;a--){let l=this.children[a],c=i-l.breakAfter,d=c-l.length;if(c<e)break;if(d<=e&&(d<e||l.covers(-1))&&(c>e||l.covers(1))&&(!r||l instanceof es&&!(r instanceof es&&n>=0)))r=l,s=d;else if(r&&d==e&&c==e&&l instanceof Il&&Math.abs(n)<2){if(l.deco.startSide<0)break;a&&(r=null)}i=d}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 es))return null;for(;s.children.length;){let{i:l,off:c}=s.childPos(r,1);for(;;l++){if(l==s.children.length)return null;if((s=s.children[l]).length)break}r=c}if(!(s instanceof Ya))return null;let i=zs(s.text,r);if(i==r)return null;let a=ad(s.dom,r,i).getClientRects();for(let l=0;l<a.length;l++){let c=a[l];if(l==a.length-1||c.top<c.bottom&&c.left<c.right)return c}return null}measureVisibleLineHeights(e){let n=[],{from:r,to:s}=e,i=this.view.contentDOM.clientWidth,a=i>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,l=-1,c=this.view.textDirection==gr.LTR;for(let d=0,h=0;h<this.children.length;h++){let m=this.children[h],g=d+m.length;if(g>s)break;if(d>=r){let x=m.dom.getBoundingClientRect();if(n.push(x.height),a){let y=m.dom.lastChild,w=y?Jh(y):[];if(w.length){let S=w[w.length-1],k=c?S.right-x.left:x.right-S.left;k>l&&(l=k,this.minWidth=i,this.minWidthFrom=d,this.minWidthTo=g)}}}d=g+m.breakAfter}return n}textDirectionAt(e){let{i:n}=this.childPos(e,1);return getComputedStyle(this.children[n].dom).direction=="rtl"?gr.RTL:gr.LTR}measureTextSize(){for(let i of this.children)if(i instanceof es){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=Jh(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 MF(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 l=(n.lineBlockAt(a).bottom-n.lineBlockAt(r).top)/this.view.scaleY;e.push(kt.replace({widget:new Fk(l),block:!0,inclusive:!0,isBlockGap:!0}).range(r,a))}if(!i)break;r=i.to+1}return kt.set(e)}updateDeco(){let e=1,n=this.view.state.facet(H0).map(i=>(this.dynamicDecorationMap[e++]=typeof i=="function")?i(this.view):i),r=!1,s=this.view.state.facet(tq).map((i,a)=>{let l=typeof i=="function";return l&&(r=!0),l?i(this.view):i});for(s.length&&(this.dynamicDecorationMap[e++]=r,n.push(Rn.join(s))),this.decorations=[this.editContextFormatting,...n,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];e<this.decorations.length;)this.dynamicDecorationMap[e++]=!1;return this.decorations}scrollIntoView(e){if(e.isSnapshot){let d=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=d.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let d of this.view.state.facet(ZF))try{if(d(this.view,e.range,e))return!0}catch(h){vi(this.view.state,h,"scroll handler")}let{range:n}=e,r=this.coordsAt(n.head,n.empty?n.assoc:n.head>n.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=o6(this.view),a={left:r.left-i.left,top:r.top-i.top,right:r.right+i.right,bottom:r.bottom+i.bottom},{offsetWidth:l,offsetHeight:c}=this.view.scrollDOM;Kae(this.view.scrollDOM,a,n.head<n.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,l),-l),Math.max(Math.min(e.yMargin,c),-c),this.view.textDirection==gr.LTR)}lineHasWidget(e){let{i:n}=this.childCursor().findPos(e);if(n==this.children.length)return!1;let r=s=>s instanceof Al||s.children.some(r);return r(this.children[n])}}function voe(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 sq(t,e){let n=t.observer.selectionRange;if(!n.focusNode)return null;let r=_F(n.focusNode,n.focusOffset),s=AF(n.focusNode,n.focusOffset),i=r||s;if(s&&r&&s.node!=r.node){let l=er.get(s.node);if(!l||l instanceof Ya&&l.text!=s.node.nodeValue)i=s;else if(t.docView.lastCompositionAfterCursor){let c=er.get(r.node);!c||c instanceof Ya&&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 yoe(t,e,n){let r=sq(t,n);if(!r)return null;let{node:s,from:i,to:a}=r,l=s.nodeValue;if(/[\n\r]/.test(l)||t.state.doc.sliceString(r.from,r.to)!=l)return null;let c=e.invertedDesc,d=new Na(c.mapPos(i),c.mapPos(a),i,a),h=[];for(let m=s.parentNode;;m=m.parentNode){let g=er.get(m);if(g instanceof $l)h.push({node:m,deco:g.mark});else{if(g instanceof es||m.nodeName=="DIV"&&m.parentNode==t.contentDOM)return{range:d,text:s,marks:h,line:m};if(m!=t.contentDOM)h.push({node:m,deco:new $p({inclusive:!0,attributes:aoe(m),tagName:m.tagName.toLowerCase()})});else return null}}}function boe(t,e){return t.nodeType!=1?0:(e&&t.childNodes[e-1].contentEditable=="false"?1:0)|(e<t.childNodes.length&&t.childNodes[e].contentEditable=="false"?2:0)}let woe=class{constructor(){this.changes=[]}compareRange(e,n){cv(e,n,this.changes)}comparePoint(e,n){cv(e,n,this.changes)}boundChange(e){cv(e,e,this.changes)}};function Soe(t,e,n){let r=new woe;return Rn.compare(t,e,n,r),r.changes}function koe(t,e){for(let n=t;n&&n!=e;n=n.assignedSlot||n.parentNode)if(n.nodeType==1&&n.contentEditable=="false")return!0;return!1}function Ooe(t,e){let n=!1;return e&&t.iterChangedRanges((r,s)=>{r<e.to&&s>e.from&&(n=!0)}),n}function joe(t,e,n=1){let r=t.charCategorizer(e),s=t.doc.lineAt(e),i=e-s.from;if(s.length==0)return Me.cursor(e);i==0?n=1:i==s.length&&(n=-1);let a=i,l=i;n<0?a=zs(s.text,i,!1):l=zs(s.text,i);let c=r(s.text.slice(a,l));for(;a>0;){let d=zs(s.text,a,!1);if(r(s.text.slice(d,a))!=c)break;a=d}for(;l<s.length;){let d=zs(s.text,l);if(r(s.text.slice(l,d))!=c)break;l=d}return Me.range(a+s.from,l+s.from)}function Noe(t,e){return e.left>t?e.left-t:Math.max(0,t-e.right)}function Coe(t,e){return e.top>t?e.top-t:Math.max(0,t-e.bottom)}function I4(t,e){return t.top<e.bottom-1&&t.bottom>e.top+1}function NE(t,e){return e<t.top?{top:e,left:t.left,right:t.right,bottom:t.bottom}:t}function CE(t,e){return e>t.bottom?{top:t.top,left:t.left,right:t.right,bottom:e}:t}function Vk(t,e,n){let r,s,i,a,l=!1,c,d,h,m;for(let y=t.firstChild;y;y=y.nextSibling){let w=Jh(y);for(let S=0;S<w.length;S++){let k=w[S];s&&I4(s,k)&&(k=NE(CE(k,s.bottom),s.top));let j=Noe(e,k),N=Coe(n,k);if(j==0&&N==0)return y.nodeType==3?TE(y,e,n):Vk(y,e,n);(!r||a>N||a==N&&i>j)&&(r=y,s=k,i=j,a=N,l=j?e<k.left?S>0:S<w.length-1:!0),j==0?n>k.bottom&&(!h||h.bottom<k.bottom)?(c=y,h=k):n<k.top&&(!m||m.top>k.top)&&(d=y,m=k):h&&I4(h,k)?h=CE(h,k.bottom):m&&I4(m,k)&&(m=NE(m,k.top))}}if(h&&h.bottom>=n?(r=c,s=h):m&&m.top<=n&&(r=d,s=m),!r)return{node:t,offset:0};let g=Math.max(s.left,Math.min(s.right,e));if(r.nodeType==3)return TE(r,g,n);if(l&&r.contentEditable!="false")return Vk(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 TE(t,e,n){let r=t.nodeValue.length,s=-1,i=1e9,a=0;for(let l=0;l<r;l++){let c=ad(t,l,l+1).getClientRects();for(let d=0;d<c.length;d++){let h=c[d];if(h.top==h.bottom)continue;a||(a=e-h.left);let m=(h.top>n?h.top-n:n-h.bottom)-1;if(h.left-1<=e&&h.right+1>=e&&m<i){let g=e>=(h.left+h.right)/2,x=g;if(et.chrome||et.gecko){let y=ad(t,l).getBoundingClientRect();Math.abs(y.left-h.right)<.1&&(x=!g)}if(m<=0)return{node:t,offset:l+(x?1:0)};s=l+(x?1:0),i=m}}}return{node:t,offset:s>-1?s:a>0?t.nodeValue.length:0}}function iq(t,e,n,r=-1){var s,i;let a=t.contentDOM.getBoundingClientRect(),l=a.top+t.viewState.paddingTop,c,{docHeight:d}=t.viewState,{x:h,y:m}=e,g=m-l;if(g<0)return 0;if(g>d)return t.state.doc.length;for(let T=t.viewState.heightOracle.textHeight/2,E=!1;c=t.elementAtHeight(g),c.type!=ni.Text;)for(;g=r>0?c.bottom+T:c.top-T,!(g>=0&&g<=d);){if(E)return n?null:0;E=!0,r=-r}m=l+g;let x=c.from;if(x<t.viewport.from)return t.viewport.from==0?0:n?null:EE(t,a,c,h,m);if(x>t.viewport.to)return t.viewport.to==t.state.doc.length?t.state.doc.length:n?null:EE(t,a,c,h,m);let y=t.dom.ownerDocument,w=t.root.elementFromPoint?t.root:y,S=w.elementFromPoint(h,m);S&&!t.contentDOM.contains(S)&&(S=null),S||(h=Math.max(a.left+1,Math.min(a.right-1,h)),S=w.elementFromPoint(h,m),S&&!t.contentDOM.contains(S)&&(S=null));let k,j=-1;if(S&&((s=t.docView.nearest(S))===null||s===void 0?void 0:s.isEditable)!=!1){if(y.caretPositionFromPoint){let T=y.caretPositionFromPoint(h,m);T&&({offsetNode:k,offset:j}=T)}else if(y.caretRangeFromPoint){let T=y.caretRangeFromPoint(h,m);T&&({startContainer:k,startOffset:j}=T)}k&&(!t.contentDOM.contains(k)||et.safari&&Toe(k,j,h)||et.chrome&&Eoe(k,j,h))&&(k=void 0),k&&(j=Math.min(Lo(k),j))}if(!k||!t.docView.dom.contains(k)){let T=es.find(t.docView,x);if(!T)return g>c.top+c.height/2?c.to:c.from;({node:k,offset:j}=Vk(T.dom,h,m))}let N=t.docView.nearest(k);if(!N)return null;if(N.isWidget&&((i=N.dom)===null||i===void 0?void 0:i.nodeType)==1){let T=N.dom.getBoundingClientRect();return e.y<T.top||e.y<=T.bottom&&e.x<=(T.left+T.right)/2?N.posAtStart:N.posAtEnd}else return N.localPosFromDOM(k,j)+N.posAtStart}function EE(t,e,n,r,s){let i=Math.round((r-e.left)*t.defaultCharacterWidth);if(t.lineWrapping&&n.height>t.defaultLineHeight*1.5){let l=t.viewState.heightOracle.textHeight,c=Math.floor((s-n.top-(t.defaultLineHeight-l)*.5)/l);i+=c*t.viewState.heightOracle.lineLength}let a=t.state.sliceDoc(n.from,n.to);return n.from+_k(a,i,t.state.tabSize)}function aq(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 ad(t,r-1,r).getBoundingClientRect().right>n}function Toe(t,e,n){return aq(t,e,n)}function Eoe(t,e,n){if(e!=0)return aq(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():ad(t,0,Math.max(t.nodeValue.length,1)).getBoundingClientRect();return n-r.left>5}function Uk(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.to<e)){if(i.from<e&&i.to>e)return i;(!s||i.type==ni.Text&&(s.type!=i.type||(n<0?i.from<e:i.to>e)))&&(s=i)}}return s||r}return r}function _oe(t,e,n,r){let s=Uk(t,e.head,e.assoc||-1),i=!r||s.type!=ni.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(),l=t.textDirectionAt(s.from),c=t.posAtCoords({x:n==(l==gr.LTR)?a.right-1:a.left+1,y:(i.top+i.bottom)/2});if(c!=null)return Me.cursor(c,n?-1:1)}return Me.cursor(n?s.to:s.from,n?-1:1)}function _E(t,e,n,r){let s=t.state.doc.lineAt(e.head),i=t.bidiSpans(s),a=t.textDirectionAt(s.from);for(let l=e,c=null;;){let d=poe(s,i,a,l,n),h=HF;if(!d){if(s.number==(n?t.state.doc.lines:1))return l;h=`
`,s=t.state.doc.line(s.number+(n?1:-1)),i=t.bidiSpans(s),d=t.visualLineSide(s,!n)}if(c){if(!c(h))return l}else{if(!r)return d;c=r(h)}l=d}}function Aoe(t,e,n){let r=t.state.charCategorizer(e),s=r(n);return i=>{let a=r(i);return s==wr.Space&&(s=a),s==a}}function Moe(t,e,n,r){let s=e.head,i=n?1:-1;if(s==(n?t.state.doc.length:0))return Me.cursor(s,e.assoc);let a=e.goalColumn,l,c=t.contentDOM.getBoundingClientRect(),d=t.coordsAtPos(s,e.assoc||-1),h=t.documentTop;if(d)a==null&&(a=d.left-c.left),l=i<0?d.top:d.bottom;else{let x=t.viewState.lineBlockAt(s);a==null&&(a=Math.min(c.right-c.left,t.defaultCharacterWidth*(s-x.from))),l=(i<0?x.top:x.bottom)+h}let m=c.left+a,g=r??t.viewState.heightOracle.textHeight>>1;for(let x=0;;x+=10){let y=l+(g+x)*i,w=iq(t,{x:m,y},!1,i);if(y<c.top||y>c.bottom||(i<0?w<s:w>s)){let S=t.docView.coordsForChar(w),k=!S||y<S.top?-1:1;return Me.cursor(w,k,void 0,a)}}}function O0(t,e,n){for(;;){let r=0;for(let s of t)s.between(e-1,e+1,(i,a,l)=>{if(e>i&&e<a){let c=r||n||(e-i<a-e?-1:1);e=c<0?i:a,r=c}});if(!r)return e}}function oq(t,e){let n=null;for(let r=0;r<e.ranges.length;r++){let s=e.ranges[r],i=null;if(s.empty){let a=O0(t,s.from,0);a!=s.from&&(i=Me.cursor(a,-1))}else{let a=O0(t,s.from,-1),l=O0(t,s.to,1);(a!=s.from||l!=s.to)&&(i=Me.range(s.from==s.anchor?a:l,s.from==s.head?a:l))}i&&(n||(n=e.ranges.slice()),n[r]=i)}return n?Me.create(n,e.mainIndex):e}function L4(t,e,n){let r=O0(t.state.facet(Qp).map(s=>s(t)),n.from,e.head>n.from?-1:1);return r==n.from?n:Me.cursor(r,r<n.from?1:-1)}const l0="￿";class Roe{constructor(e,n){this.points=e,this.text="",this.lineSeparator=n.facet(wn.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=l0}readRange(e,n){if(!e)return this;let r=e.parentNode;for(let s=e;;){this.findPointBefore(r,s);let i=this.text.length;this.readNode(s);let a=s.nextSibling;if(a==n)break;let l=er.get(s),c=er.get(a);(l&&c?l.breakAfter:(l?l.breakAfter:Qv(s))||Qv(a)&&(s.nodeName!="BR"||s.cmIgnore)&&this.text.length>i)&&!Poe(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,l;if(this.lineSeparator?(i=n.indexOf(this.lineSeparator,r),a=this.lineSeparator.length):(l=s.exec(n))&&(i=l.index,a=l[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=er.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+(Doe(e,r.node,r.offset)?n:0))}}function Doe(t,e,n){for(;;){if(!e||n<Lo(e))return!1;if(e==t)return!0;n=id(e)+1,e=e.parentNode}}function Poe(t,e){let n;for(;!(t==e||!t);t=t.nextSibling){let r=er.get(t);if(!(r?.isWidget||t.cmIgnore))return!1;r&&(n||(n=[])).push(r)}if(n)for(let r of n){let s=r.overrideDOMText;if(s?.length)return!1}return!0}class AE{constructor(e,n){this.node=e,this.offset=n,this.pos=-1}}class zoe{constructor(e,n,r,s){this.typeOver=s,this.bounds=null,this.text="",this.domChanged=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 l=i||a?[]:Loe(e),c=new Roe(l,e.state);c.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=c.text,this.newSel=Boe(l,this.bounds.from)}else{let l=e.observer.selectionRange,c=i&&i.node==l.focusNode&&i.offset==l.focusOffset||!Ik(e.contentDOM,l.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(l.focusNode,l.focusOffset),d=a&&a.node==l.anchorNode&&a.offset==l.anchorOffset||!Ik(e.contentDOM,l.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(l.anchorNode,l.anchorOffset),h=e.viewport;if((et.ios||et.chrome)&&e.state.selection.main.empty&&c!=d&&(h.from>0||h.to<e.state.doc.length)){let m=Math.min(c,d),g=Math.max(c,d),x=h.from-m,y=h.to-g;(x==0||x==1||m==0)&&(y==0||y==-1||g==e.state.doc.length)&&(c=0,d=e.state.doc.length)}e.inputState.composing>-1&&e.state.selection.ranges.length>1?this.newSel=e.state.selection.replaceRange(Me.range(d,c)):this.newSel=Me.single(d,c)}}}function lq(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:l}=e.bounds,c=s.from,d=null;(i===8||et.android&&e.text.length<l-a)&&(c=s.to,d="end");let h=cq(t.state.doc.sliceString(a,l,l0),e.text,c-a,d);h&&(et.chrome&&i==13&&h.toB==h.from+2&&e.text.slice(h.from,h.toB)==l0+l0&&h.toB--,n={from:a+h.from,to:a+h.toA,insert:jn.of(e.text.slice(h.from,h.toB).split(l0))})}else r&&(!t.hasFocus&&t.state.facet(El)||r.main.eq(s))&&(r=null);if(!n&&!r)return!1;if(!n&&e.typeOver&&!s.empty&&r&&r.main.empty?n={from:s.from,to:s.to,insert:t.state.doc.slice(s.from,s.to)}:(et.mac||et.android)&&n&&n.from==n.to&&n.from==s.head-1&&/^\. ?$/.test(n.insert.toString())&&t.contentDOM.getAttribute("autocorrect")=="off"?(r&&n.insert.length==2&&(r=Me.single(r.main.anchor-1,r.main.head-1)),n={from:n.from,to:n.to,insert:jn.of([n.insert.toString().replace("."," ")])}):n&&n.from>=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).to<s.to&&t.docView.lineHasWidget(s.to)&&t.inputState.insertingTextAt>Date.now()-50?n={from:s.from,to:s.to,insert:t.state.toText(t.inputState.insertingText)}:et.chrome&&n&&n.from==n.to&&n.from==s.head&&n.insert.toString()==`
`&&t.lineWrapping&&(r&&(r=Me.single(r.main.anchor-1,r.main.head-1)),n={from:s.from,to:s.to,insert:jn.of([" "])}),n)return l6(t,n,r,i);if(r&&!r.main.eq(s)){let a=!1,l="select";return t.inputState.lastSelectionTime>Date.now()-50&&(t.inputState.lastSelectionOrigin=="select"&&(a=!0),l=t.inputState.lastSelectionOrigin,l=="select.pointer"&&(r=oq(t.state.facet(Qp).map(c=>c(t)),r))),t.dispatch({selection:r,scrollIntoView:a,userEvent:l}),!0}else return!1}function l6(t,e,n,r=-1){if(et.ios&&t.inputState.flushIOSKey(e))return!0;let s=t.state.selection.main;if(et.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&&Ph(t.contentDOM,"Enter",13)||(e.from==s.from-1&&e.to==s.to&&e.insert.length==0||r==8&&e.insert.length<e.to-e.from&&e.to>s.head)&&Ph(t.contentDOM,"Backspace",8)||e.from==s.from&&e.to==s.to+1&&e.insert.length==0&&Ph(t.contentDOM,"Delete",46)))return!0;let i=e.insert.toString();t.inputState.composing>=0&&t.inputState.composing++;let a,l=()=>a||(a=Ioe(t,e,n));return t.state.facet(GF).some(c=>c(t,e.from,e.to,i,l))||t.dispatch(l()),!0}function Ioe(t,e,n){let r,s=t.state,i=s.selection.main,a=-1;if(e.from==e.to&&e.from<i.from||e.from>i.to){let c=e.from<i.from?-1:1,d=c<0?i.from:i.to,h=O0(s.facet(Qp).map(m=>m(t)),d,c);e.from==h&&(a=h)}if(a>-1)r={changes:e,selection:Me.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.from<e.from?s.sliceDoc(i.from,e.from):"",d=i.to>e.to?s.sliceDoc(e.to,i.to):"";r=s.replaceSelection(t.state.toText(c+e.insert.sliceString(0,void 0,t.state.lineBreak)+d))}else{let c=s.changes(e),d=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 h=t.state.sliceDoc(e.from,e.to),m,g=n&&sq(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:d||y.map(c)};let w=y.to-x,S=w-h.length;if(t.state.sliceDoc(S,w)!=h||w>=m.from&&S<=m.to)return{range:y};let k=s.changes({from:S,to:w,insert:e.insert}),j=y.to-i.to;return{changes:k,range:d?Me.range(Math.max(0,d.anchor+j),Math.max(0,d.head+j)):y.map(k)}})}else r={changes:c,selection:d&&s.selection.replaceRange(d)}}let l="input.type";return(t.composing||t.inputState.compositionPendingChange&&t.inputState.compositionEndedAt>Date.now()-50)&&(t.inputState.compositionPendingChange=!1,l+=".compose",t.inputState.compositionFirstChange&&(l+=".start",t.inputState.compositionFirstChange=!1)),s.update(r,{userEvent:l,scrollIntoView:!0})}function cq(t,e,n,r){let s=Math.min(t.length,e.length),i=0;for(;i<s&&t.charCodeAt(i)==e.charCodeAt(i);)i++;if(i==s&&t.length==e.length)return null;let a=t.length,l=e.length;for(;a>0&&l>0&&t.charCodeAt(a-1)==e.charCodeAt(l-1);)a--,l--;if(r=="end"){let c=Math.max(0,i-Math.min(a,l));n-=a+c-i}if(a<i&&t.length<e.length){let c=n<=i&&n>=a?i-n:0;i-=c,l=i+(l-a),a=i}else if(l<i){let c=n<=i&&n>=l?i-n:0;i-=c,a=i+(a-l),l=i}return{from:i,toA:a,toB:l}}function Loe(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 AE(n,r)),(s!=n||i!=r)&&e.push(new AE(s,i))),e}function Boe(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?Me.single(n+e,r+e):null}class Foe{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,et.safari&&e.contentDOM.addEventListener("input",()=>null),et.gecko&&nle(e.contentDOM.ownerDocument)}handleEvent(e){!Goe(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=qoe(e),r=this.handlers,s=this.view.contentDOM;for(let i in n)if(i!="scroll"){let a=!n[i].handlers.length,l=r[i];l&&a!=!l.handlers.length&&(s.removeEventListener(i,this.handleEvent),l=null),l||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&&dq.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),et.android&&et.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let n;return et.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((n=uq.find(r=>r.keyCode==e.keyCode))&&!e.ctrlKey||$oe.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.from<e.to&&/^\S+$/.test(e.insert.toString())?!1:(this.pendingIOSKey=void 0,Ph(this.view.contentDOM,n.key,n.keyCode,n instanceof KeyboardEvent?n:void 0))}ignoreDuringComposition(e){return!/^key/.test(e.type)||e.synthetic?!1:this.composing>0?!0:et.safari&&!et.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 ME(t,e){return(n,r)=>{try{return e.call(t,r,n)}catch(s){vi(n.state,s)}}}function qoe(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 l in i){let c=i[l];c&&n(l).handlers.push(ME(r.value,c))}if(a)for(let l in a){let c=a[l];c&&n(l).observers.push(ME(r.value,c))}}for(let r in Ka)n(r).handlers.push(Ka[r]);for(let r in _a)n(r).observers.push(_a[r]);return e}const uq=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],$oe="dthko",dq=[16,17,18,20,91,92,224,225],r1=6;function s1(t){return Math.max(0,t)*.7+8}function Hoe(t,e){return Math.max(Math.abs(t.clientX-e.clientX),Math.abs(t.clientY-e.clientY))}class Qoe{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=Zae(e.contentDOM),this.atoms=e.state.facet(Qp).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(wn.allowMultipleSelections)&&Voe(e,n),this.dragging=Woe(e,n)&&mq(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&&Hoe(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let n=0,r=0,s=0,i=0,a=this.view.win.innerWidth,l=this.view.win.innerHeight;this.scrollParents.x&&({left:s,right:a}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:i,bottom:l}=this.scrollParents.y.getBoundingClientRect());let c=o6(this.view);e.clientX-c.left<=s+r1?n=-s1(s-e.clientX):e.clientX+c.right>=a-r1&&(n=s1(e.clientX-a)),e.clientY-c.top<=i+r1?r=-s1(i-e.clientY):e.clientY+c.bottom>=l-r1&&(r=s1(e.clientY-l)),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=oq(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 Voe(t,e){let n=t.state.facet(QF);return n.length?n[0](e):et.mac?e.metaKey:e.ctrlKey}function Uoe(t,e){let n=t.state.facet(VF);return n.length?n[0](e):et.mac?!e.altKey:!e.ctrlKey}function Woe(t,e){let{main:n}=t.state.selection;if(n.empty)return!1;let r=$0(t.root);if(!r||r.rangeCount==0)return!0;let s=r.getRangeAt(0).getClientRects();for(let i=0;i<s.length;i++){let a=s[i];if(a.left<=e.clientX&&a.right>=e.clientX&&a.top<=e.clientY&&a.bottom>=e.clientY)return!0}return!1}function Goe(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=er.get(n))&&r.ignoreEvent(e))return!1;return!0}const Ka=Object.create(null),_a=Object.create(null),hq=et.ie&&et.ie_version<15||et.ios&&et.webkit_version<604;function Xoe(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(),fq(t,n.value)},50)}function ub(t,e,n){for(let r of t.facet(e))n=r(n,t);return n}function fq(t,e){e=ub(t.state,s6,e);let{state:n}=t,r,s=1,i=n.toText(e),a=i.lines==n.selection.ranges.length;if(Wk!=null&&n.selection.ranges.every(c=>c.empty)&&Wk==i.toString()){let c=-1;r=n.changeByRange(d=>{let h=n.doc.lineAt(d.from);if(h.from==c)return{range:d};c=h.from;let m=n.toText((a?i.line(s++).text:e)+n.lineBreak);return{changes:{from:h.from,insert:m},range:Me.cursor(d.from+m.length)}})}else a?r=n.changeByRange(c=>{let d=i.line(s++);return{changes:{from:c.from,to:c.to,insert:d.text},range:Me.cursor(c.from+d.length)}}):r=n.replaceSelection(i);t.dispatch(r,{userEvent:"input.paste",scrollIntoView:!0})}_a.scroll=t=>{t.inputState.lastScrollTop=t.scrollDOM.scrollTop,t.inputState.lastScrollLeft=t.scrollDOM.scrollLeft};Ka.keydown=(t,e)=>(t.inputState.setSelectionOrigin("select"),e.keyCode==27&&t.inputState.tabFocusMode!=0&&(t.inputState.tabFocusMode=Date.now()+2e3),!1);_a.touchstart=(t,e)=>{t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")};_a.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")};Ka.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(UF))if(n=r(t,e),n)break;if(!n&&e.button==0&&(n=Zoe(t,e)),n){let r=!t.hasFocus;t.inputState.startMouseSelection(new Qoe(t,e,n,r)),r&&t.observer.ignore(()=>{CF(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 RE(t,e,n,r){if(r==1)return Me.cursor(e,n);if(r==2)return joe(t.state,e,n);{let s=es.find(t.docView,e),i=t.state.doc.lineAt(s?s.posAtEnd:e),a=s?s.posAtStart:i.from,l=s?s.posAtEnd:i.to;return l<t.state.doc.length&&l==i.to&&l++,Me.range(a,l)}}let DE=(t,e,n)=>e>=n.top&&e<=n.bottom&&t>=n.left&&t<=n.right;function Yoe(t,e,n,r){let s=es.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&&DE(n,r,a))return-1;let l=s.coordsAt(i,1);return l&&DE(n,r,l)?1:a&&a.bottom>=r?-1:1}function PE(t,e){let n=t.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:n,bias:Yoe(t,n,e.clientX,e.clientY)}}const Koe=et.ie&&et.ie_version<=11;let zE=null,IE=0,LE=0;function mq(t){if(!Koe)return t.detail;let e=zE,n=LE;return zE=t,LE=Date.now(),IE=!e||n>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(IE+1)%3:1}function Zoe(t,e){let n=PE(t,e),r=mq(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,l){let c=PE(t,i),d,h=RE(t,c.pos,c.bias,r);if(n.pos!=c.pos&&!a){let m=RE(t,n.pos,n.bias,r),g=Math.min(m.from,h.from),x=Math.max(m.to,h.to);h=g<h.from?Me.range(g,x):Me.range(x,g)}return a?s.replaceRange(s.main.extend(h.from,h.to)):l&&r==1&&s.ranges.length>1&&(d=Joe(s,c.pos))?d:l?s.addRange(h):Me.create([h])}}}function Joe(t,e){for(let n=0;n<t.ranges.length;n++){let{from:r,to:s}=t.ranges[n];if(r<=e&&s>=e)return Me.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}Ka.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=Me.range(i,a))}}let{inputState:r}=t;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=n,e.dataTransfer&&(e.dataTransfer.setData("Text",ub(t.state,i6,t.state.sliceDoc(n.from,n.to))),e.dataTransfer.effectAllowed="copyMove"),!1};Ka.dragend=t=>(t.inputState.draggedContent=null,!1);function BE(t,e,n,r){if(n=ub(t.state,s6,n),!n)return;let s=t.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:i}=t.inputState,a=r&&i&&Uoe(t,e)?{from:i.from,to:i.to}:null,l={from:s,insert:n},c=t.state.changes(a?[a,l]:l);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}Ka.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&&BE(t,e,r.filter(a=>a!=null).join(t.state.lineBreak),!1)};for(let a=0;a<n.length;a++){let l=new FileReader;l.onerror=i,l.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(l.result)||(r[a]=l.result),i()},l.readAsText(n[a])}return!0}else{let r=e.dataTransfer.getData("Text");if(r)return BE(t,e,r,!0),!0}return!1};Ka.paste=(t,e)=>{if(t.state.readOnly)return!0;t.observer.flush();let n=hq?null:e.clipboardData;return n?(fq(t,n.getData("text/plain")||n.getData("text/uri-list")),!0):(Xoe(t),!1)};function ele(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 tle(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:ub(t,i6,e.join(t.lineBreak)),ranges:n,linewise:r}}let Wk=null;Ka.copy=Ka.cut=(t,e)=>{let{text:n,ranges:r,linewise:s}=tle(t.state);if(!n&&!s)return!1;Wk=s?n:null,e.type=="cut"&&!t.state.readOnly&&t.dispatch({changes:r,scrollIntoView:!0,userEvent:"delete.cut"});let i=hq?null:e.clipboardData;return i?(i.clearData(),i.setData("text/plain",n),!0):(ele(t,n),!1)};const pq=qo.define();function gq(t,e){let n=[];for(let r of t.facet(XF)){let s=r(t,e);s&&n.push(s)}return n.length?t.update({effects:n,annotations:pq.of(!0)}):null}function xq(t){setTimeout(()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let n=gq(t.state,e);n?t.dispatch(n):t.update([])}},10)}_a.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),xq(t)};_a.blur=t=>{t.observer.clearSelectionRange(),xq(t)};_a.compositionstart=_a.compositionupdate=t=>{t.observer.editContext||(t.inputState.compositionFirstChange==null&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0))};_a.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,et.chrome&&et.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then(()=>t.observer.flush()):setTimeout(()=>{t.inputState.composing<0&&t.docView.hasComposition&&t.update([])},50))};_a.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()};Ka.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 l=a[0],c=t.posAtDOM(l.startContainer,l.startOffset),d=t.posAtDOM(l.endContainer,l.endOffset);return l6(t,{from:c,to:d,insert:t.state.toText(i)},null),!0}}let s;if(et.chrome&&et.android&&(s=uq.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 et.ios&&e.inputType=="deleteContentForward"&&t.observer.flushSoon(),et.safari&&e.inputType=="insertText"&&t.inputState.composing>=0&&setTimeout(()=>_a.compositionend(t,e),20),!1};const FE=new Set;function nle(t){FE.has(t)||(FE.add(t),t.addEventListener("copy",()=>{}),t.addEventListener("cut",()=>{}))}const qE=["pre-wrap","normal","pre-line","break-spaces"];let nf=!1;function $E(){nf=!1}class rle{constructor(e){this.lineWrapping=e,this.doc=jn.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 qE.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let n=!1;for(let r=0;r<e.length;r++){let s=e[r];s<0?r++:this.heightSamples[Math.floor(s*10)]||(n=!0,this.heightSamples[Math.floor(s*10)]=!0)}return n}refresh(e,n,r,s,i,a){let l=qE.indexOf(e)>-1,c=Math.round(n)!=Math.round(this.lineHeight)||this.lineWrapping!=l;if(this.lineWrapping=l,this.lineHeight=n,this.charWidth=r,this.textHeight=s,this.lineLength=i,c){this.heightSamples={};for(let d=0;d<a.length;d++){let h=a[d];h<0?d++:this.heightSamples[Math.floor(h*10)]=!0}}return c}}class sle{constructor(e,n){this.from=e,this.heights=n,this.index=0}get more(){return this.index<this.heights.length}}class So{constructor(e,n,r,s,i){this.from=e,this.length=n,this.top=r,this.height=s,this._content=i}get type(){return typeof this._content=="number"?ni.Text:Array.isArray(this._content)?this._content:this._content.type}get to(){return this.from+this.length}get bottom(){return this.top+this.height}get widget(){return this._content instanceof Xc?this._content.widget:null}get widgetLineBreaks(){return typeof this._content=="number"?this._content:0}join(e){let n=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(e._content)?e._content:[e]);return new So(this.from,this.length+e.length,this.top,this.height+e.height,n)}}var pr=(function(t){return t[t.ByPos=0]="ByPos",t[t.ByHeight=1]="ByHeight",t[t.ByPosNoHeight=2]="ByPosNoHeight",t})(pr||(pr={}));const uv=.001;class ri{constructor(e,n,r=2){this.length=e,this.height=n,this.flags=r}get outdated(){return(this.flags&2)>0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>uv&&(nf=!0),this.height=e)}replace(e,n,r){return ri.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 l=s.length-1;l>=0;l--){let{fromA:c,toA:d,fromB:h,toB:m}=s[l],g=i.lineAt(c,pr.ByPosNoHeight,r.setDoc(n),0,0),x=g.to>=d?g:i.lineAt(d,pr.ByPosNoHeight,r,0,0);for(m+=x.to-d,d=x.to;l>0&&g.from<=s[l-1].toA;)c=s[l-1].fromA,h=s[l-1].fromB,l--,c<g.from&&(g=i.lineAt(c,pr.ByPosNoHeight,r,0,0));h+=g.from-c,c=g.from;let y=c6.build(r.setDoc(a),e,h,m);i=Wv(i,i.replace(c,d,y))}return i.updateHeight(r,0)}static empty(){return new $i(0,0)}static of(e){if(e.length==1)return e[0];let n=0,r=e.length,s=0,i=0;for(;;)if(n==r)if(s>i*2){let l=e[n-1];l.break?e.splice(--n,1,l.left,null,l.right):e.splice(--n,1,l.left,l.right),r+=1+l.break,s-=l.size}else if(i>s*2){let l=e[r];l.break?e.splice(r,1,l.left,null,l.right):e.splice(r,1,l.left,l.right),r+=2+l.break,i-=l.size}else break;else if(s<i){let l=e[n++];l&&(s+=l.size)}else{let l=e[--r];l&&(i+=l.size)}let a=0;return e[n-1]==null?(a=1,n--):e[n]==null&&(a=1,r++),new ile(ri.of(e.slice(0,n)),a,ri.of(e.slice(r)))}}function Wv(t,e){return t==e?t:(t.constructor!=e.constructor&&(nf=!0),e)}ri.prototype.size=1;class vq extends ri{constructor(e,n,r){super(e,n),this.deco=r}blockAt(e,n,r,s){return new So(s,this.length,r,this.height,this.deco||0)}lineAt(e,n,r,s,i){return this.blockAt(0,r,s,i)}forEachLine(e,n,r,s,i,a){e<=i+this.length&&n>=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 $i extends vq{constructor(e,n){super(e,n,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,n,r,s){return new So(s,this.length,r,this.height,this.breaks)}replace(e,n,r){let s=r[0];return r.length==1&&(s instanceof $i||s instanceof As&&s.flags&4)&&Math.abs(this.length-s.length)<10?(s instanceof As?s=new $i(s.length,this.height):s.height=this.height,this.outdated||(s.outdated=!1),s):ri.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 As extends ri{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,l=0;if(e.lineWrapping){let c=Math.min(this.height,e.lineHeight*i);a=c/i,this.length>i+1&&(l=(this.height-c)/(this.length-i-1))}else a=this.height/i;return{firstLine:r,lastLine:s,perLine:a,perChar:l}}blockAt(e,n,r,s){let{firstLine:i,lastLine:a,perLine:l,perChar:c}=this.heightMetrics(n,s);if(n.lineWrapping){let d=s+(e<n.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-r)/this.height))*this.length)),h=n.doc.lineAt(d),m=l+h.length*c,g=Math.max(r,e-m/2);return new So(h.from,h.length,g,m,0)}else{let d=Math.max(0,Math.min(a-i,Math.floor((e-r)/l))),{from:h,length:m}=n.doc.line(i+d);return new So(h,m,r+l*d,l,0)}}lineAt(e,n,r,s,i){if(n==pr.ByHeight)return this.blockAt(e,r,s,i);if(n==pr.ByPosNoHeight){let{from:x,to:y}=r.doc.lineAt(e);return new So(x,y-x,0,0,0)}let{firstLine:a,perLine:l,perChar:c}=this.heightMetrics(r,i),d=r.doc.lineAt(e),h=l+d.length*c,m=d.number-a,g=s+l*m+c*(d.from-i-m);return new So(d.from,d.length,Math.max(s,Math.min(g,s+this.height-h)),h,0)}forEachLine(e,n,r,s,i,a){e=Math.max(e,i),n=Math.min(n,i+this.length);let{firstLine:l,perLine:c,perChar:d}=this.heightMetrics(r,i);for(let h=e,m=s;h<=n;){let g=r.doc.lineAt(h);if(h==e){let y=g.number-l;m+=c*y+d*(e-i-y)}let x=c+d*g.length;a(new So(g.from,g.length,m,x,0)),m+=x,h=g.to+1}}replace(e,n,r){let s=this.length-n;if(s>0){let i=r[r.length-1];i instanceof As?r[r.length-1]=new As(i.length+s):r.push(null,new As(s-1))}if(e>0){let i=r[0];i instanceof As?r[0]=new As(e+i.length):r.unshift(new As(e-1),null)}return ri.of(r)}decomposeLeft(e,n){n.push(new As(e-1),null)}decomposeRight(e,n){n.push(null,new As(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=[],l=Math.max(n,s.from),c=-1;for(s.from>n&&a.push(new As(s.from-n-1).updateHeight(e,n));l<=i&&s.more;){let h=e.doc.lineAt(l).length;a.length&&a.push(null);let m=s.heights[s.index++];c==-1?c=m:Math.abs(m-c)>=uv&&(c=-2);let g=new $i(h,m);g.outdated=!1,a.push(g),l+=h+1}l<=i&&a.push(null,new As(i-l).updateHeight(e,l));let d=ri.of(a);return(c<0||Math.abs(d.height-this.height)>=uv||Math.abs(c-this.heightMetrics(e,n).perLine)>=uv)&&(nf=!0),Wv(this,d)}else(r||this.outdated)&&(this.setHeight(e.heightForGap(n,n+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class ile extends ri{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 e<i?this.left.blockAt(e,n,r,s):this.right.blockAt(e,n,i,s+this.left.length+this.break)}lineAt(e,n,r,s,i){let a=s+this.left.height,l=i+this.left.length+this.break,c=n==pr.ByHeight?e<a:e<l,d=c?this.left.lineAt(e,n,r,s,i):this.right.lineAt(e,n,r,a,l);if(this.break||(c?d.to<l:d.from>l))return d;let h=n==pr.ByPosNoHeight?pr.ByPosNoHeight:pr.ByPos;return c?d.join(this.right.lineAt(l,h,r,a,l)):this.left.lineAt(l,h,r,s,i).join(d)}forEachLine(e,n,r,s,i,a){let l=s+this.left.height,c=i+this.left.length+this.break;if(this.break)e<c&&this.left.forEachLine(e,n,r,s,i,a),n>=c&&this.right.forEachLine(e,n,r,l,c,a);else{let d=this.lineAt(c,pr.ByPos,r,s,i);e<d.from&&this.left.forEachLine(e,d.from-1,r,s,i,a),d.to>=e&&d.from<=n&&a(d),n>d.to&&this.right.forEachLine(d.to+1,n,r,l,c,a)}}replace(e,n,r){let s=this.left.length+this.break;if(n<s)return this.balanced(this.left.replace(e,n,r),this.right);if(e>this.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 l of r)i.push(l);if(e>0&&HE(i,a-1),n<this.length){let l=i.length;this.decomposeRight(n,i),HE(i,l)}return ri.of(i)}decomposeLeft(e,n){let r=this.left.length;if(e<=r)return this.left.decomposeLeft(e,n);n.push(this.left),this.break&&(r++,e>=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);e<r&&this.left.decomposeRight(e,n),this.break&&e<s&&n.push(null),n.push(this.right)}balanced(e,n){return e.size>2*n.size||n.size>2*e.size?ri.of(this.break?[e,null,n]:[e,n]):(this.left=Wv(this.left,e),this.right=Wv(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,l=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<=l+a.length&&s.more?c=a=a.updateHeight(e,l,r,s):a.updateHeight(e,l,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 HE(t,e){let n,r;t[e]==null&&(n=t[e-1])instanceof As&&(r=t[e+1])instanceof As&&t.splice(e-1,3,new As(n.length+1+r.length))}const ale=5;class c6{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 $i?s.length+=r-this.pos:(r>this.pos||!this.isCovered)&&this.nodes.push(new $i(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<n||r.heightRelevant){let s=r.widget?r.widget.estimatedHeight:0,i=r.widget?r.widget.lineBreaks:0;s<0&&(s=this.oracle.lineHeight);let a=n-e;r.block?this.addBlock(new vq(a,s,r)):(a||i||s>=ale)&&this.addLineDeco(s,i,a)}else n>e&&this.span(e,n);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:e,to:n}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=n,this.writtenTo<e&&((this.writtenTo<e-1||this.nodes[this.nodes.length-1]==null)&&this.nodes.push(this.blankContent(this.writtenTo,e-1)),this.nodes.push(null)),this.pos>e&&this.nodes.push(new $i(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,n){let r=new As(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 $i)return e;let n=new $i(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 $i)&&!this.isCovered?this.nodes.push(new $i(0,-1)):(this.writtenTo<this.pos||n==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let r=e;for(let s of this.nodes)s instanceof $i&&s.updateHeight(this.oracle,r),r+=s?s.length:1;return this.nodes}static build(e,n,r,s){let i=new c6(r,e);return Rn.spans(n,r,s,i,0),i.finish(r)}}function ole(t,e,n){let r=new lle;return Rn.compare(t,e,n,r,0),r.changes}class lle{constructor(){this.changes=[]}compareRange(){}comparePoint(e,n,r,s){(e<n||r&&r.heightRelevant||s&&s.heightRelevant)&&cv(e,n,this.changes,5)}}function cle(t,e){let n=t.getBoundingClientRect(),r=t.ownerDocument,s=r.defaultView||window,i=Math.max(0,n.left),a=Math.min(s.innerWidth,n.right),l=Math.max(0,n.top),c=Math.min(s.innerHeight,n.bottom);for(let d=t.parentNode;d&&d!=r.body;)if(d.nodeType==1){let h=d,m=window.getComputedStyle(h);if((h.scrollHeight>h.clientHeight||h.scrollWidth>h.clientWidth)&&m.overflow!="visible"){let g=h.getBoundingClientRect();i=Math.max(i,g.left),a=Math.min(a,g.right),l=Math.max(l,g.top),c=Math.min(d==t.parentNode?s.innerHeight:c,g.bottom)}d=m.position=="absolute"||m.position=="fixed"?h.offsetParent:h.parentNode}else if(d.nodeType==11)d=d.host;else break;return{left:i-n.left,right:Math.max(i,a)-n.left,top:l-(n.top+e),bottom:Math.max(l,c)-(n.top+e)}}function ule(t){let e=t.getBoundingClientRect(),n=t.ownerDocument.defaultView||window;return e.left<n.innerWidth&&e.right>0&&e.top<n.innerHeight&&e.bottom>0}function dle(t,e){let n=t.getBoundingClientRect();return{left:0,right:n.right-n.left,top:e,bottom:n.bottom-(n.top+e)}}class B4{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;r<e.length;r++){let s=e[r],i=n[r];if(s.from!=i.from||s.to!=i.to||s.size!=i.size)return!1}return!0}draw(e,n){return kt.replace({widget:new hle(this.displaySize*(n?e.scaleY:e.scaleX),n)}).range(this.from,this.to)}}class hle extends Ho{constructor(e,n){super(),this.size=e,this.vertical=n}eq(e){return e.size==this.size&&e.vertical==this.vertical}toDOM(){let e=document.createElement("div");return this.vertical?e.style.height=this.size+"px":(e.style.width=this.size+"px",e.style.height="2px",e.style.display="inline-block"),e}get estimatedHeight(){return this.vertical?this.size:-1}}class QE{constructor(e){this.state=e,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scrollTop=0,this.scrolledToBottom=!1,this.scaleX=1,this.scaleY=1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=VE,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=gr.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let n=e.facet(a6).some(r=>typeof r!="function"&&r.class=="cm-lineWrapping");this.heightOracle=new rle(n),this.stateDeco=e.facet(H0).filter(r=>typeof r!="function"),this.heightMap=ri.empty().applyChanges(this.stateDeco,jn.empty,this.heightOracle.setDoc(e.doc),[new Na(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=kt.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 i1(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?VE:new u6(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(c0(e,this.scaler))})}update(e,n=null){this.state=e.state;let r=this.stateDeco;this.stateDeco=this.state.facet(H0).filter(h=>typeof h!="function");let s=e.changedRanges,i=Na.extendWithRanges(s,ole(r,this.stateDeco,e?e.changes:us.empty(this.state.doc.length))),a=this.heightMap.height,l=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);$E(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),i),(this.heightMap.height!=a||nf)&&(e.flags|=2),l?(this.scrollAnchorPos=e.changes.mapPos(l.from,-1),this.scrollAnchorHeight=l.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=a);let c=i.length?this.mapViewport(this.viewport,e.changes):this.viewport;(n&&(n.range.head<c.from||n.range.head>c.to)||!this.viewportIsAppropriate(c))&&(c=this.getViewport(0,n));let d=c.from!=this.viewport.from||c.to!=this.viewport.to;this.viewport=c,e.flags|=this.updateForViewport(),(d||!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(KF)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let n=e.contentDOM,r=window.getComputedStyle(n),s=this.heightOracle,i=r.whiteSpace;this.defaultTextDirection=r.direction=="rtl"?gr.RTL:gr.LTR;let a=this.heightOracle.mustRefreshForWrapping(i),l=n.getBoundingClientRect(),c=a||this.mustMeasureContent||this.contentDOMHeight!=l.height;this.contentDOMHeight=l.height,this.mustMeasureContent=!1;let d=0,h=0;if(l.width&&l.height){let{scaleX:T,scaleY:E}=NF(n,l);(T>.005&&Math.abs(this.scaleX-T)>.005||E>.005&&Math.abs(this.scaleY-E)>.005)&&(this.scaleX=T,this.scaleY=E,d|=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,d|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(s.lineWrapping&&(c=!0),this.editorWidth=e.scrollDOM.clientWidth,d|=16);let x=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=x&&(this.scrollAnchorHeight=-1,this.scrollTop=x),this.scrolledToBottom=EF(e.scrollDOM);let y=(this.printing?dle:cle)(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&&!ule(e.dom))return 0;let j=l.width;if((this.contentDOMWidth!=j||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=l.width,this.editorHeight=e.scrollDOM.clientHeight,d|=16),c){let T=e.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(T)&&(a=!0),a||s.lineWrapping&&Math.abs(j-this.contentDOMWidth)>s.charWidth){let{lineHeight:E,charWidth:_,textHeight:A}=e.docView.measureTextSize();a=E>0&&s.refresh(i,E,_,A,Math.max(5,j/_),T),a&&(e.docView.minWidth=0,d|=16)}w>0&&S>0?h=Math.max(w,S):w<0&&S<0&&(h=Math.min(w,S)),$E();for(let E of this.viewports){let _=E.from==this.viewport.from?T:e.docView.measureVisibleLineHeights(E);this.heightMap=(a?ri.empty().applyChanges(this.stateDeco,jn.empty,this.heightOracle,[new Na(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(s,0,a,new sle(E.from,_))}nf&&(d|=2)}let N=!this.viewportIsAppropriate(this.viewport,h)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return N&&(d&2&&(d|=this.updateScaler()),this.viewport=this.getViewport(h,this.scrollTarget),d|=this.updateForViewport()),(d&2||N)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(a?[]:this.lineGaps,e)),d|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),d}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:l}=this,c=new i1(s.lineAt(a-r*1e3,pr.ByHeight,i,0,0).from,s.lineAt(l+(1-r)*1e3,pr.ByHeight,i,0,0).to);if(n){let{head:d}=n.range;if(d<c.from||d>c.to){let h=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),m=s.lineAt(d,pr.ByPos,i,0,0),g;n.y=="center"?g=(m.top+m.bottom)/2-h/2:n.y=="start"||n.y=="nearest"&&d<c.from?g=m.top:g=m.bottom-h,c=new i1(s.lineAt(g-1e3/2,pr.ByHeight,i,0,0).from,s.lineAt(g+h+1e3/2,pr.ByHeight,i,0,0).to)}}return c}mapViewport(e,n){let r=n.mapPos(e.from,-1),s=n.mapPos(e.to,1);return new i1(this.heightMap.lineAt(r,pr.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(s,pr.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:n},r=0){if(!this.inView)return!0;let{top:s}=this.heightMap.lineAt(e,pr.ByPos,this.heightOracle,0,0),{bottom:i}=this.heightMap.lineAt(n,pr.ByPos,this.heightOracle,0,0),{visibleTop:a,visibleBottom:l}=this;return(e==0||s<=a-Math.max(10,Math.min(-r,250)))&&(n==this.state.doc.length||i>=l+Math.max(10,Math.min(r,250)))&&s>a-2*1e3&&i<l+2*1e3}mapLineGaps(e,n){if(!e.length||n.empty)return e;let r=[];for(let s of e)n.touchesRange(s.from,s.to)||r.push(new B4(n.mapPos(s.from),n.mapPos(s.to),s.size,s.displaySize));return r}ensureLineGaps(e,n){let r=this.heightOracle.lineWrapping,s=r?1e4:2e3,i=s>>1,a=s<<1;if(this.defaultTextDirection!=gr.LTR&&!r)return[];let l=[],c=(h,m,g,x)=>{if(m-h<i)return;let y=this.state.selection.main,w=[y.from];y.empty||w.push(y.to);for(let k of w)if(k>h&&k<m){c(h,k-10,g,x),c(k+10,m,g,x);return}let S=mle(e,k=>k.from>=g.from&&k.to<=g.to&&Math.abs(k.from-h)<i&&Math.abs(k.to-m)<i&&!w.some(j=>k.from<j&&k.to>j));if(!S){if(m<g.to&&n&&r&&n.visibleRanges.some(N=>N.from<=m&&N.to>=m)){let N=n.moveToLineBoundary(Me.cursor(m),!1,!0).head;N>h&&(m=N)}let k=this.gapSize(g,h,m,x),j=r||k<2e6?k:2e6;S=new B4(h,m,k,j)}l.push(S)},d=h=>{if(h.length<a||h.type!=ni.Text)return;let m=fle(h.from,h.to,this.stateDeco);if(m.total<a)return;let g=this.scrollTarget?this.scrollTarget.range.head:null,x,y;if(r){let w=s/this.heightOracle.lineLength*this.heightOracle.lineHeight,S,k;if(g!=null){let j=o1(m,g),N=((this.visibleBottom-this.visibleTop)/2+w)/h.height;S=j-N,k=j+N}else S=(this.visibleTop-h.top-w)/h.height,k=(this.visibleBottom-h.top+w)/h.height;x=a1(m,S),y=a1(m,k)}else{let w=m.total*this.heightOracle.charWidth,S=s*this.heightOracle.charWidth,k=0;if(w>2e6)for(let _ of e)_.from>=h.from&&_.from<h.to&&_.size!=_.displaySize&&_.from*this.heightOracle.charWidth+k<this.pixelViewport.left&&(k=_.size-_.displaySize);let j=this.pixelViewport.left+k,N=this.pixelViewport.right+k,T,E;if(g!=null){let _=o1(m,g),A=((N-j)/2+S)/w;T=_-A,E=_+A}else T=(j-S)/w,E=(N+S)/w;x=a1(m,T),y=a1(m,E)}x>h.from&&c(h.from,x,h,m),y<h.to&&c(y,h.to,h,m)};for(let h of this.viewportLines)Array.isArray(h.type)?h.type.forEach(d):d(h);return l}gapSize(e,n,r,s){let i=o1(s,r)-o1(s,n);return this.heightOracle.lineWrapping?e.height*i:s.total*this.heightOracle.charWidth*i}updateLineGaps(e){B4.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=kt.set(e.map(n=>n.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let n=this.stateDeco;this.lineGaps.length&&(n=n.concat(this.lineGapDeco));let r=[];Rn.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<r.length&&!(s&8);i++){let a=this.visibleRanges[i],l=r[i];(a.from!=l.from||a.to!=l.to)&&(s|=4,e&&e.mapPos(a.from,-1)==l.from&&e.mapPos(a.to,1)==l.to||(s|=8))}return this.visibleRanges=r,s}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(n=>n.from<=e&&n.to>=e)||c0(this.heightMap.lineAt(e,pr.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)||c0(this.heightMap.lineAt(this.scaler.fromDOM(e),pr.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 c0(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 i1=class{constructor(e,n){this.from=e,this.to=n}};function fle(t,e,n){let r=[],s=t,i=0;return Rn.spans(n,t,e,{span(){},point(a,l){a>s&&(r.push({from:s,to:a}),i+=a-s),s=l}},20),s<e&&(r.push({from:s,to:e}),i+=e-s),{total:i,ranges:r}}function a1({total:t,ranges:e},n){if(n<=0)return e[0].from;if(n>=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],l=a-i;if(r<=l)return i+r;r-=l}}function o1(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 mle(t,e){for(let n of t)if(e(n))return n}const VE={toDOM(t){return t},fromDOM(t){return t},scale:1,eq(t){return t==this}};class u6{constructor(e,n,r){let s=0,i=0,a=0;this.viewports=r.map(({from:l,to:c})=>{let d=n.lineAt(l,pr.ByPos,e,0,0).top,h=n.lineAt(c,pr.ByPos,e,0,0).bottom;return s+=h-d,{from:l,to:c,top:d,bottom:h,domTop:0,domBottom:0}}),this.scale=(7e6-s)/(n.height-s);for(let l of this.viewports)l.domTop=a+(l.top-i)*this.scale,a=l.domBottom=l.domTop+(l.bottom-l.top),i=l.bottom}toDOM(e){for(let n=0,r=0,s=0;;n++){let i=n<this.viewports.length?this.viewports[n]:null;if(!i||e<i.top)return s+(e-r)*this.scale;if(e<=i.bottom)return i.domTop+(e-i.top);r=i.bottom,s=i.domBottom}}fromDOM(e){for(let n=0,r=0,s=0;;n++){let i=n<this.viewports.length?this.viewports[n]:null;if(!i||e<i.domTop)return r+(e-s)/this.scale;if(e<=i.domBottom)return i.top+(e-i.domTop);r=i.bottom,s=i.domBottom}}eq(e){return e instanceof u6?this.scale==e.scale&&this.viewports.length==e.viewports.length&&this.viewports.every((n,r)=>n.from==e.viewports[r].from&&n.to==e.viewports[r].to):!1}}function c0(t,e){if(e.scale==1)return t;let n=e.toDOM(t.top),r=e.toDOM(t.bottom);return new So(t.from,t.length,n,r-n,Array.isArray(t._content)?t._content.map(s=>c0(s,e)):t._content)}const l1=at.define({combine:t=>t.join(" ")}),Gk=at.define({combine:t=>t.indexOf(!0)>-1}),Xk=Wc.newName(),yq=Wc.newName(),bq=Wc.newName(),wq={"&light":"."+yq,"&dark":"."+bq};function Yk(t,e,n){return new Wc(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 ple=Yk("."+Xk,{"&":{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,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>')`,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"}},wq),gle={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},F4=et.ie&&et.ie_version<=11;class xle{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new Jae,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);(et.ie&&et.ie_version<=11||et.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&&et.android&&e.constructor.EDIT_CONTEXT!==!1&&!(et.chrome&&et.chrome_version<126)&&(this.editContext=new yle(e),e.state.facet(El)&&(e.contentDOM.editContext=this.editContext.editContext)),F4&&(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)<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(e.scrollDOM)),this.addWindowListeners(this.win=e.win),this.start(),typeof IntersectionObserver=="function"&&(this.intersection=new IntersectionObserver(n=>{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(El)?r.root.activeElement!=this.dom:!lv(this.dom,s))return;let i=s.anchorNode&&r.docView.nearest(s.anchorNode);if(i&&i.ignoreEvent(e)){n||(this.selectionChanged=!1);return}(et.ie&&et.ie_version<=11||et.android&&et.chrome)&&!r.state.selection.main.empty&&s.focusNode&&S0(s.focusNode,s.focusOffset,s.anchorNode,s.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,n=$0(e.root);if(!n)return!1;let r=et.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&vle(this.view,n)||n;if(!r||this.selectionRange.eq(r))return!1;let s=lv(this.dom,r);return s&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&toe(this.dom,r)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(r),s&&(this.selectionChanged=!0),!0)}setSelectionRange(e,n){this.selectionRange.set(e.node,e.offset,n.node,n.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,n=null;for(let r=this.dom;r;)if(r.nodeType==1)!n&&e<this.scrollTargets.length&&this.scrollTargets[e]==r?e++:n||(n=this.scrollTargets.slice(0,e)),n&&n.push(r),r=r.assignedSlot||r.parentNode;else if(r.nodeType==11)r=r.host;else break;if(e<this.scrollTargets.length&&!n&&(n=this.scrollTargets.slice(0,e)),n){for(let r of this.scrollTargets)r.removeEventListener("scroll",this.onScroll);for(let r of this.scrollTargets=n)r.addEventListener("scroll",this.onScroll)}}ignore(e){if(!this.active)return e();try{return this.stop(),e()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,gle),F4&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),F4&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,n){var r;if(!this.delayedAndroidKey){let s=()=>{let i=this.delayedAndroidKey;i&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=i.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&i.force&&Ph(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<Date.now()-50||!!(!((r=this.delayedAndroidKey)===null||r===void 0)&&r.force)})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{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&&lv(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 zoe(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=lq(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=UE(n,e.previousSibling||e.target.previousSibling,-1),s=UE(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(El)!=e.state.facet(El)&&(e.view.contentDOM.editContext=e.state.facet(El)?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 UE(t,e,n){for(;e;){let r=er.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 WE(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 S0(a.node,a.offset,s,i)&&([n,r,s,i]=[s,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:s,focusOffset:i}}function vle(t,e){if(e.getComposedRanges){let s=e.getComposedRanges(t.root)[0];if(s)return WE(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?WE(t,n):null}class yle{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,l=this.toEditorPos(r.updateRangeStart),c=this.toEditorPos(r.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:r.updateRangeStart,editorBase:l,drifted:!1});let d=c-l>r.text.length;l==this.from&&i<this.from?l=i:c==this.to&&i>this.to&&(c=i);let h=cq(e.state.sliceDoc(l,c),r.text,(d?s.from:s.to)-l,d?"end":null);if(!h){let g=Me.single(this.toEditorPos(r.selectionStart),this.toEditorPos(r.selectionEnd));g.main.eq(s)||e.dispatch({selection:g,userEvent:"select"});return}let m={from:h.from+l,to:h.toA+l,insert:jn.of(r.text.slice(h.from,h.toB).split(`
`))};if((et.mac||et.android)&&m.from==a-1&&/^\. ?$/.test(r.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(m={from:l,to:c,insert:jn.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,Me.single(this.toEditorPos(r.selectionStart,g),this.toEditorPos(r.selectionEnd,g)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),m.from<m.to&&!m.insert.length&&e.inputState.composing>=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),l=this.toEditorPos(r.rangeEnd);a<l;a++){let c=e.coordsForChar(a);i=c&&new DOMRect(c.left,c.top,c.right-c.left,c.bottom-c.top)||i||new DOMRect,s.push(i)}n.updateCharacterBounds(r.rangeStart,s)},this.handlers.textformatupdate=r=>{let s=[];for(let i of r.getTextFormats()){let a=i.underlineStyle,l=i.underlineThickness;if(!/none/i.test(a)&&!/none/i.test(l)){let c=this.toEditorPos(i.rangeStart),d=this.toEditorPos(i.rangeEnd);if(c<d){let h=`text-decoration: underline ${/^[a-z]/.test(a)?a+" ":a=="Dashed"?"dashed ":a=="Squiggle"?"wavy ":""}${/thin/i.test(l)?1:2}px`;s.push(kt.mark({attributes:{style:h}}).range(c,d))}}}e.dispatch({effects:JF.of(kt.set(s))})},this.handlers.compositionstart=()=>{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=$0(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,l,c,d)=>{if(r)return;let h=d.length-(a-i);if(s&&a>=s.to)if(s.from==i&&s.to==a&&s.insert.eq(d)){s=this.pendingContextChange=null,n+=h,this.to+=h;return}else s=null,this.revertPending(e.state);if(i+=n,a+=n,a<=this.from)this.from+=h,this.to+=h;else if(i<this.to){if(i<this.from||a>this.to||this.to-this.from+d.length>3e4){r=!0;return}this.editContext.updateText(this.toContextPos(i),this.toContextPos(a),d.toString()),this.to+=h}n+=h}),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.to<e.doc.length&&this.to-n<500||this.to-this.from>1e4*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 Ze{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||eoe(e.parent)||document,this.viewState=new QE(e.state||wn.create(e)),e.scrollTo&&e.scrollTo.is(n1)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Nh).map(s=>new z4(s));for(let s of this.plugins)s.update(this);this.observer=new xle(this),this.inputState=new Foe(this),this.inputState.ensureHandlers(this.plugins),this.docView=new jE(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 ns?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,l=0,c=null;e.some(g=>g.annotation(pq))?(this.inputState.notifiedFocused=a,l=1):a!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=a,c=gq(i,a),c||(l=1));let d=this.observer.delayedAndroidKey,h=null;if(d?(this.observer.clearDelayedAndroidKey(),h=this.observer.readChange(),(h&&!this.state.doc.eq(i.doc)||!this.state.selection.eq(i.selection))&&(h=null)):this.observer.clear(),i.facet(wn.phrases)!=this.state.facet(wn.phrases))return this.setState(i);s=Uv.create(this,i,e),s.flags|=l;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 zh(x.empty?x:Me.cursor(x.head,x.head>x.anchor?-1:1))}for(let x of g.effects)x.is(n1)&&(m=x.value.clip(this.state))}this.viewState.update(s,m),this.bidiCache=Gv.update(this.bidiCache,s.changes),s.empty||(this.updatePlugins(s),this.inputState.update(s)),n=this.docView.update(s),this.state.facet(o0)!=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(l1)!=s.state.facet(l1)&&(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(Qk))try{g(s)}catch(x){vi(this.state,x,"update listener")}(c||h)&&Promise.resolve().then(()=>{c&&this.state==c.startState&&this.dispatch(c),h&&!lq(this,h)&&d.force&&Ph(this.contentDOM,d.key,d.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 QE(e),this.plugins=e.facet(Nh).map(r=>new z4(r)),this.pluginMap.clear();for(let r of this.plugins)r.update(this);this.docView.destroy(),this.docView=new jE(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(Nh),r=e.state.facet(Nh);if(n!=r){let s=[];for(let i of r){let a=n.indexOf(i);if(a<0)s.push(new z4(i));else{let l=this.plugins[a];l.mustUpdate=e,s.push(l)}}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<this.plugins.length;s++)this.plugins[s].update(this);n!=r&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let n=e.value;if(n&&n.docViewUpdate)try{n.docViewUpdate(this)}catch(r){vi(this.state,r,"doc view update listener")}}}measure(e=!0){if(this.destroyed)return;if(this.measureScheduled>-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 l=0;;l++){if(a<0)if(EF(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(l>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let d=[];c&4||([this.measureRequests,d]=[d,this.measureRequests]);let h=d.map(x=>{try{return x.read(this)}catch(y){return vi(this.state,y),GE}}),m=Uv.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;x<d.length;x++)if(h[x]!=GE)try{let y=d[x];y.write&&y.write(h[x],this)}catch(y){vi(this.state,y)}if(g&&this.docView.updateSelection(!0),!m.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,a=-1;continue}else{let y=(i<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(i).top)-a;if(y>1||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 l of this.state.facet(Qk))l(n)}get themeClasses(){return Xk+" "+(this.state.facet(Gk)?bq:yq)+" "+this.state.facet(l1)}updateAttrs(){let e=XE(this,eq,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),n={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(El)?"true":"false",class:"cm-content",style:`${et.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(n["aria-readonly"]="true"),XE(this,a6,n);let r=this.observer.ignore(()=>{let s=Bk(this.contentDOM,this.contentAttrs,n),i=Bk(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(Ze.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(o0);let e=this.state.facet(Ze.cspNonce);Wc.mount(this.root,this.styleModules.concat(ple).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;n<this.measureRequests.length;n++)if(this.measureRequests[n].key===e.key){this.measureRequests[n]=e;return}}this.measureRequests.push(e)}}plugin(e){let n=this.pluginMap.get(e);return(n===void 0||n&&n.plugin!=e)&&this.pluginMap.set(e,n=this.plugins.find(r=>r.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 L4(this,e,_E(this,e,n,r))}moveByGroup(e,n){return L4(this,e,_E(this,e,n,r=>Aoe(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 Me.cursor(i.side(n,s)+e.from,i.forward(!n,s)?1:-1)}moveToLineBoundary(e,n,r=!0){return _oe(this,e,n,r)}moveVertically(e,n,r){return L4(this,e,Moe(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(),iq(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[Fc.find(i,e-s.from,-1,n)];return qp(r,a.dir==gr.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(YF)||e<this.viewport.from||e>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>ble)return $F(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||qF(i.isolates,r=OE(this,e))))return i.order;r||(r=OE(this,e));let s=moe(e.text,n,r);return this.bidiCache.push(new Gv(e.from,e.to,n,r,!0,s)),s}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||et.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{CF(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 n1.of(new zh(typeof e=="number"?Me.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 n1.of(new zh(Me.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 Vr.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return Vr.define(()=>({}),{eventObservers:e})}static theme(e,n){let r=Wc.newName(),s=[l1.of(r),o0.of(Yk(`.${r}`,e))];return n&&n.dark&&s.push(Gk.of(!0)),s}static baseTheme(e){return ou.lowest(o0.of(Yk("."+Xk,e,wq)))}static findFromDOM(e){var n;let r=e.querySelector(".cm-content"),s=r&&er.get(r)||er.get(e);return((n=s?.rootView)===null||n===void 0?void 0:n.view)||null}}Ze.styleModule=o0;Ze.inputHandler=GF;Ze.clipboardInputFilter=s6;Ze.clipboardOutputFilter=i6;Ze.scrollHandler=ZF;Ze.focusChangeEffect=XF;Ze.perLineTextDirection=YF;Ze.exceptionSink=WF;Ze.updateListener=Qk;Ze.editable=El;Ze.mouseSelectionStyle=UF;Ze.dragMovesSelection=VF;Ze.clickAddsSelectionRange=QF;Ze.decorations=H0;Ze.outerDecorations=tq;Ze.atomicRanges=Qp;Ze.bidiIsolatedRanges=nq;Ze.scrollMargins=rq;Ze.darkTheme=Gk;Ze.cspNonce=at.define({combine:t=>t.length?t[0]:""});Ze.contentAttributes=a6;Ze.editorAttributes=eq;Ze.lineWrapping=Ze.contentAttributes.of({class:"cm-lineWrapping"});Ze.announce=Ft.define();const ble=4096,GE={};class Gv{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:gr.LTR;for(let i=Math.max(0,e.length-10);i<e.length;i++){let a=e[i];a.dir==s&&!n.touchesRange(a.from,a.to)&&r.push(new Gv(n.mapPos(a.from,1),n.mapPos(a.to,-1),a.dir,a.isolates,!1,a.order))}return r}}function XE(t,e,n){for(let r=t.state.facet(e),s=r.length-1;s>=0;s--){let i=r[s],a=typeof i=="function"?i(t):i;a&&Lk(a,n)}return n}const wle=et.mac?"mac":et.windows?"win":et.linux?"linux":"key";function Sle(t,e){const n=t.split(/-(?!$)/);let r=n[n.length-1];r=="Space"&&(r=" ");let s,i,a,l;for(let c=0;c<n.length-1;++c){const d=n[c];if(/^(cmd|meta|m)$/i.test(d))l=!0;else if(/^a(lt)?$/i.test(d))s=!0;else if(/^(c|ctrl|control)$/i.test(d))i=!0;else if(/^s(hift)?$/i.test(d))a=!0;else if(/^mod$/i.test(d))e=="mac"?l=!0:i=!0;else throw new Error("Unrecognized modifier name: "+d)}return s&&(r="Alt-"+r),i&&(r="Ctrl-"+r),l&&(r="Meta-"+r),a&&(r="Shift-"+r),r}function c1(t,e,n){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n!==!1&&e.shiftKey&&(t="Shift-"+t),t}const kle=ou.default(Ze.domEventHandlers({keydown(t,e){return kq(Sq(e.state),t,e,"editor")}})),Vp=at.define({enables:kle}),YE=new WeakMap;function Sq(t){let e=t.facet(Vp),n=YE.get(e);return n||YE.set(e,n=Nle(e.reduce((r,s)=>r.concat(s),[]))),n}function Ole(t,e,n){return kq(Sq(t.state),e,t,n)}let zc=null;const jle=4e3;function Nle(t,e=wle){let n=Object.create(null),r=Object.create(null),s=(a,l)=>{let c=r[a];if(c==null)r[a]=l;else if(c!=l)throw new Error("Key binding "+a+" is used both as a regular binding and as a multi-stroke prefix")},i=(a,l,c,d,h)=>{var m,g;let x=n[a]||(n[a]=Object.create(null)),y=l.split(/ (?!$)/).map(k=>Sle(k,e));for(let k=1;k<y.length;k++){let j=y.slice(0,k).join(" ");s(j,!0),x[j]||(x[j]={preventDefault:!0,stopPropagation:!1,run:[N=>{let T=zc={view:N,prefix:j,scope:a};return setTimeout(()=>{zc==T&&(zc=null)},jle),!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),d&&(S.preventDefault=!0),h&&(S.stopPropagation=!0)};for(let a of t){let l=a.scope?a.scope.split(" "):["editor"];if(a.any)for(let d of l){let h=n[d]||(n[d]=Object.create(null));h._any||(h._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:m}=a;for(let g in h)h[g].run.push(x=>m(x,Kk))}let c=a[e]||a.key;if(c)for(let d of l)i(d,c,a.run,a.preventDefault,a.stopPropagation),a.shift&&i(d,"Shift-"+c,a.shift,a.preventDefault,a.stopPropagation)}return n}let Kk=null;function kq(t,e,n,r){Kk=e;let s=Gae(e),i=gi(s,0),a=wo(i)==s.length&&s!=" ",l="",c=!1,d=!1,h=!1;zc&&zc.view==n&&zc.scope==r&&(l=zc.prefix+" ",dq.indexOf(e.keyCode)<0&&(d=!0,zc=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&&(h=!0),!0;S.preventDefault&&(S.stopPropagation&&(h=!0),d=!0)}return!1},x=t[r],y,w;return x&&(g(x[l+c1(s,e,!a)])?c=!0:a&&(e.altKey||e.metaKey||e.ctrlKey)&&!(et.windows&&e.ctrlKey&&e.altKey)&&!(et.mac&&e.altKey&&!(e.ctrlKey||e.metaKey))&&(y=Gc[e.keyCode])&&y!=s?(g(x[l+c1(y,e,!0)])||e.shiftKey&&(w=q0[e.keyCode])!=s&&w!=y&&g(x[l+c1(w,e,!1)]))&&(c=!0):a&&e.shiftKey&&g(x[l+c1(s,e,!0)])&&(c=!0),!c&&g(x._any)&&(c=!0)),d&&(c=!0),c&&h&&e.stopPropagation(),Kk=null,c}class Up{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=Oq(e);return[new Up(n,s.left-i.left,s.top-i.top,null,s.bottom-s.top)]}else return Cle(e,n,r)}}function Oq(t){let e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==gr.LTR?e.left:e.right-t.scrollDOM.clientWidth*t.scaleX)-t.scrollDOM.scrollLeft*t.scaleX,top:e.top-t.scrollDOM.scrollTop*t.scaleY}}function KE(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,l=t.posAtCoords({x:i.left+1,y:a}),c=t.posAtCoords({x:i.right-1,y:a});return l==null||c==null?r:{from:Math.max(r.from,Math.min(l,c)),to:Math.min(r.to,Math.max(l,c))}}function Cle(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==gr.LTR,a=t.contentDOM,l=a.getBoundingClientRect(),c=Oq(t),d=a.querySelector(".cm-line"),h=d&&window.getComputedStyle(d),m=l.left+(h?parseInt(h.paddingLeft)+Math.min(0,parseInt(h.textIndent)):0),g=l.right-(h?parseInt(h.paddingRight):0),x=Uk(t,r,1),y=Uk(t,s,-1),w=x.type==ni.Text?x:null,S=y.type==ni.Text?y:null;if(w&&(t.lineWrapping||x.widgetLineBreaks)&&(w=KE(t,r,1,w)),S&&(t.lineWrapping||y.widgetLineBreaks)&&(S=KE(t,s,-1,S)),w&&S&&w.from==S.from&&w.to==S.to)return j(N(n.from,n.to,w));{let E=w?N(n.from,null,w):T(x,!1),_=S?N(null,n.to,S):T(y,!0),A=[];return(w||x).to<(S||y).from-(w&&S?1:0)||x.widgetLineBreaks>1&&E.bottom+t.defaultLineHeight/2<_.top?A.push(k(m,E.bottom,g,_.top)):E.bottom<_.top&&t.elementAtHeight((E.bottom+_.top)/2).type==ni.Text&&(E.bottom=_.top=(E.bottom+_.top)/2),j(E).concat(A).concat(j(_))}function k(E,_,A,L){return new Up(e,E-c.left,_-c.top,A-E,L-_)}function j({top:E,bottom:_,horizontal:A}){let L=[];for(let P=0;P<A.length;P+=2)L.push(k(A[P],E,A[P+1],_));return L}function N(E,_,A){let L=1e9,P=-1e9,B=[];function $(z,Q,F,Y,J){let X=t.coordsAtPos(z,z==A.to?-2:2),R=t.coordsAtPos(F,F==A.from?2:-2);!X||!R||(L=Math.min(X.top,R.top,L),P=Math.max(X.bottom,R.bottom,P),J==gr.LTR?B.push(i&&Q?m:X.left,i&&Y?g:R.right):B.push(!i&&Y?m:R.left,!i&&Q?g:X.right))}let U=E??A.from,te=_??A.to;for(let z of t.visibleRanges)if(z.to>U&&z.from<te)for(let Q=Math.max(z.from,U),F=Math.min(z.to,te);;){let Y=t.state.doc.lineAt(Q);for(let J of t.bidiSpans(Y)){let X=J.from+Y.from,R=J.to+Y.from;if(X>=F)break;R>Q&&$(Math.max(X,Q),E==null&&X<=U,Math.min(R,F),_==null&&R>=te,J.dir)}if(Q=Y.to+1,Q>=F)break}return B.length==0&&$(U,E==null,te,_==null,t.textDirection),{top:L,bottom:P,horizontal:B}}function T(E,_){let A=l.top+(_?E.top:E.bottom);return{top:A,bottom:A,horizontal:[]}}}function Tle(t,e){return t.constructor==e.constructor&&t.eq(e)}class Ele{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(dv)!=e.state.facet(dv)&&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(dv);for(;n<r.length&&r[n]!=this.layer;)n++;this.dom.style.zIndex=String((this.layer.above?150:-1)-n)}measure(){return this.layer.markers(this.view)}scale(){let{scaleX:e,scaleY:n}=this.view;(e!=this.scaleX||n!=this.scaleY)&&(this.scaleX=e,this.scaleY=n,this.dom.style.transform=`scale(${1/e}, ${1/n})`)}draw(e){if(e.length!=this.drawn.length||e.some((n,r)=>!Tle(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,et.safari&&et.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 dv=at.define();function jq(t){return[Vr.define(e=>new Ele(e,t)),dv.of(t)]}const Q0=at.define({combine(t){return $o(t,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,n)=>Math.min(e,n),drawRangeCursor:(e,n)=>e||n})}});function _le(t={}){return[Q0.of(t),Ale,Mle,Rle,KF.of(!0)]}function Nq(t){return t.startState.facet(Q0)!=t.state.facet(Q0)}const Ale=jq({above:!0,markers(t){let{state:e}=t,n=e.facet(Q0),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",l=s.empty?s:Me.cursor(s.head,s.head>s.anchor?-1:1);for(let c of Up.forRange(t,a,l))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=Nq(t);return n&&ZE(t.state,e),t.docChanged||t.selectionSet||n},mount(t,e){ZE(e.state,t)},class:"cm-cursorLayer"});function ZE(t,e){e.style.animationDuration=t.facet(Q0).cursorBlinkRate+"ms"}const Mle=jq({above:!1,markers(t){return t.state.selection.ranges.map(e=>e.empty?[]:Up.forRange(t,"cm-selectionBackground",e)).reduce((e,n)=>e.concat(n))},update(t,e){return t.docChanged||t.selectionSet||t.viewportChanged||Nq(t)},class:"cm-selectionLayer"}),Rle=ou.highest(Ze.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"}}}})),Cq=Ft.define({map(t,e){return t==null?null:e.mapPos(t)}}),u0=Os.define({create(){return null},update(t,e){return t!=null&&(t=e.changes.mapPos(t)),e.effects.reduce((n,r)=>r.is(Cq)?r.value:n,t)}}),Dle=Vr.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(u0);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(u0)!=n||t.docChanged||t.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:t}=this,e=t.state.field(u0),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(u0)!=t&&this.view.dispatch({effects:Cq.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 Ple(){return[u0,Dle]}function JE(t,e,n,r,s){e.lastIndex=0;for(let i=t.iterRange(n,r),a=n,l;!i.next().done;a+=i.value.length)if(!i.lineBreak)for(;l=e.exec(i.value);)s(a+l.index,l)}function zle(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 Ile{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=(l,c,d,h)=>s(h,d,d+l[0].length,l,c);else if(typeof r=="function")this.addMatch=(l,c,d,h)=>{let m=r(l,c,d);m&&h(d,d+l[0].length,m)};else if(r)this.addMatch=(l,c,d,h)=>h(d,d+l[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 ql,r=n.add.bind(n);for(let{from:s,to:i}of zle(e,this.maxLength))JE(e.state.doc,this.regexp,s,i,(a,l)=>this.addMatch(l,e,a,r));return n.finish()}updateDeco(e,n){let r=1e9,s=-1;return e.docChanged&&e.changes.iterChanges((i,a,l,c)=>{c>=e.view.viewport.from&&l<=e.view.viewport.to&&(r=Math.min(l,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),l=Math.min(i.to,s);if(l>=a){let c=e.state.doc.lineAt(a),d=c.to<l?e.state.doc.lineAt(l):c,h=Math.max(i.from,c.from),m=Math.min(i.to,d.to);if(this.boundary){for(;a>c.from;a--)if(this.boundary.test(c.text[a-1-c.from])){h=a;break}for(;l<d.to;l++)if(this.boundary.test(d.text[l-d.from])){m=l;break}}let g=[],x,y=(w,S,k)=>g.push(k.range(w,S));if(c==d)for(this.regexp.lastIndex=h-c.from;(x=this.regexp.exec(c.text))&&x.index<m-c.from;)this.addMatch(x,e,x.index+c.from,y);else JE(e.state.doc,this.regexp,h,m,(w,S)=>this.addMatch(S,e,w,y));n=n.update({filterFrom:h,filterTo:m,filter:(w,S)=>w<h||S>m,add:g})}}return n}}const Zk=/x/.unicode!=null?"gu":"g",Lle=new RegExp(`[\0-\b
--Ÿ­؜\u2028\u2029\uFEFF-]`,Zk),Ble={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 q4=null;function Fle(){var t;if(q4==null&&typeof document<"u"&&document.body){let e=document.body.style;q4=((t=e.tabSize)!==null&&t!==void 0?t:e.MozTabSize)!=null}return q4||!1}const hv=at.define({combine(t){let e=$o(t,{render:null,specialChars:Lle,addSpecialChars:null});return(e.replaceTabs=!Fle())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,Zk)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,Zk)),e}});function qle(t={}){return[hv.of(t),$le()]}let e_=null;function $le(){return e_||(e_=Vr.fromClass(class{constructor(t){this.view=t,this.decorations=kt.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(hv)),this.decorations=this.decorator.createDeco(t)}makeDecorator(t){return new Ile({regexp:t.specialChars,decoration:(e,n,r)=>{let{doc:s}=n.state,i=gi(e[0],0);if(i==9){let a=s.lineAt(r),l=n.state.tabSize,c=Nf(a.text,l,r-a.from);return kt.replace({widget:new Ule((l-c%l)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[i]||(this.decorationCache[i]=kt.replace({widget:new Vle(t,i)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(hv);t.startState.facet(hv)!=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 Hle="•";function Qle(t){return t>=32?Hle:t==10?"␤":String.fromCharCode(9216+t)}class Vle extends Ho{constructor(e,n){super(),this.options=e,this.code=n}eq(e){return e.code==this.code}toDOM(e){let n=Qle(this.code),r=e.state.phrase("Control character")+" "+(Ble[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 Ule extends Ho{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 Wle(){return Xle}const Gle=kt.line({class:"cm-activeLine"}),Xle=Vr.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(Gle.range(s.from)),e=s.from)}return kt.set(n)}},{decorations:t=>t.decorations});class Yle extends Ho{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?Jh(e.firstChild):[];if(!n.length)return null;let r=window.getComputedStyle(e.parentNode),s=qp(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 Kle(t){let e=Vr.fromClass(class{constructor(n){this.view=n,this.placeholder=t?kt.set([kt.widget({widget:new Yle(t),side:1}).range(0)]):kt.none}get decorations(){return this.view.state.doc.length?kt.none:this.placeholder}},{decorations:n=>n.decorations});return typeof t=="string"?[e,Ze.contentAttributes.of({"aria-placeholder":t})]:e}const Jk=2e3;function Zle(t,e,n){let r=Math.min(e.line,n.line),s=Math.max(e.line,n.line),i=[];if(e.off>Jk||n.off>Jk||e.col<0||n.col<0){let a=Math.min(e.off,n.off),l=Math.max(e.off,n.off);for(let c=r;c<=s;c++){let d=t.doc.line(c);d.length<=l&&i.push(Me.range(d.from+a,d.to+l))}}else{let a=Math.min(e.col,n.col),l=Math.max(e.col,n.col);for(let c=r;c<=s;c++){let d=t.doc.line(c),h=_k(d.text,a,t.tabSize,!0);if(h<0)i.push(Me.cursor(d.to));else{let m=_k(d.text,l,t.tabSize);i.push(Me.range(d.from+h,d.from+m))}}}return i}function Jle(t,e){let n=t.coordsAtPos(t.viewport.from);return n?Math.round(Math.abs((n.left-e)/t.defaultCharacterWidth)):-1}function t_(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>Jk?-1:s==r.length?Jle(t,e.clientX):Nf(r.text,t.state.tabSize,n-r.from);return{line:r.number,col:i,off:s}}function ece(t,e){let n=t_(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 l=t_(t,s);if(!l)return r;let c=Zle(t.state,n,l);return c.length?a?Me.create(c.concat(r.ranges)):Me.create(c):r}}:null}function tce(t){let e=(n=>n.altKey&&n.button==0);return Ze.mouseSelectionStyle.of((n,r)=>e(r)?ece(n,r):null)}const nce={Alt:[18,t=>!!t.altKey],Control:[17,t=>!!t.ctrlKey],Shift:[16,t=>!!t.shiftKey],Meta:[91,t=>!!t.metaKey]},rce={style:"cursor: crosshair"};function sce(t={}){let[e,n]=nce[t.key||"Alt"],r=Vr.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,Ze.contentAttributes.of(s=>{var i;return!((i=s.plugin(r))===null||i===void 0)&&i.isDown?rce:null})]}const u1="-10000px";class Tq{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=[],l=n?[]:null;for(let c=0;c<i.length;c++){let d=i[c],h=-1;if(d){for(let m=0;m<this.tooltips.length;m++){let g=this.tooltips[m];g&&g.create==d.create&&(h=m)}if(h<0)a[c]=this.createTooltipView(d,c?a[c-1]:null),l&&(l[c]=!!d.above);else{let m=a[c]=this.tooltipViews[h];l&&(l[c]=n[h]),m.update&&m.update(e)}}}for(let c of this.tooltipViews)a.indexOf(c)<0&&(this.removeTooltipView(c),(r=c.destroy)===null||r===void 0||r.call(c));return n&&(l.forEach((c,d)=>n[d]=c),n.length=l.length),this.input=s,this.tooltips=i,this.tooltipViews=a,!0}}function ice(t){let e=t.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:e.clientHeight,right:e.clientWidth}}const $4=at.define({combine:t=>{var e,n,r;return{position:et.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)||ice}}}),n_=new WeakMap,d6=Vr.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($4);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 Tq(t,h6,(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($4);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=u1,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(et.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=o6(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 l=this.manager.tooltipViews[a];return l.getCoords?l.getCoords(i.pos):this.view.coordsAtPos(i.pos)}),size:this.manager.tooltipViews.map(({dom:i})=>i.getBoundingClientRect()),space:this.view.state.facet($4).tooltipSpace(this.view),scaleX:t,scaleY:e,makeAbsolute:n}}writeMeasure(t){var e;if(t.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let l of this.manager.tooltipViews)l.dom.style.position="absolute"}let{visible:n,space:r,scaleX:s,scaleY:i}=t,a=[];for(let l=0;l<this.manager.tooltips.length;l++){let c=this.manager.tooltips[l],d=this.manager.tooltipViews[l],{dom:h}=d,m=t.pos[l],g=t.size[l];if(!m||c.clip!==!1&&(m.bottom<=Math.max(n.top,r.top)||m.top>=Math.min(n.bottom,r.bottom)||m.right<Math.max(n.left,r.left)-.1||m.left>Math.min(n.right,r.right)+.1)){h.style.top=u1;continue}let x=c.arrow?d.dom.querySelector(".cm-tooltip-arrow"):null,y=x?7:0,w=g.right-g.left,S=(e=n_.get(d))!==null&&e!==void 0?e:g.bottom-g.top,k=d.offset||oce,j=this.view.textDirection==gr.LTR,N=g.width>r.right-r.left?j?r.left:r.right-g.width:j?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[l];!c.strictSide&&(T?m.top-S-y-k.y<r.top:m.bottom+S+y+k.y>r.bottom)&&T==r.bottom-m.bottom>m.top-r.top&&(T=this.above[l]=!T);let E=(T?m.top-r.top:r.bottom-m.bottom)-y;if(E<S&&d.resize!==!1){if(E<this.view.defaultLineHeight){h.style.top=u1;continue}n_.set(d,S),h.style.height=(S=E)/i+"px"}else h.style.height&&(h.style.height="");let _=T?m.top-S-y-k.y:m.bottom+y+k.y,A=N+w;if(d.overlap!==!0)for(let L of a)L.left<A&&L.right>N&&L.top<_+S&&L.bottom>_&&(_=T?L.top-S-2-y:L.bottom+y+2);if(this.position=="absolute"?(h.style.top=(_-t.parent.top)/i+"px",r_(h,(N-t.parent.left)/s)):(h.style.top=_/i+"px",r_(h,N/s)),x){let L=m.left+(j?k.x:-k.x)-(N+14-7);x.style.left=L/s+"px"}d.overlap!==!0&&a.push({left:N,top:_,right:A,bottom:_+S}),h.classList.toggle("cm-tooltip-above",T),h.classList.toggle("cm-tooltip-below",!T),d.positioned&&d.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=u1}},{eventObservers:{scroll(){this.maybeMeasure()}}});function r_(t,e){let n=parseInt(t.style.left,10);(isNaN(n)||Math.abs(e-n)>1)&&(t.style.left=e+"px")}const ace=Ze.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"}}}),oce={x:0,y:0},h6=at.define({enables:[d6,ace]}),Xv=at.define({combine:t=>t.reduce((e,n)=>e.concat(n),[])});class db{static create(e){return new db(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new Tq(e,Xv,(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 lce=h6.compute([Xv],t=>{let e=t.facet(Xv);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:db.create,above:e[0].above,arrow:e.some(n=>n.arrow)}});class cce{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;e<this.hoverTime?this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime-e):this.startHover()}startHover(){clearTimeout(this.restartTimeout);let{view:e,lastMove:n}=this,r=e.docView.nearest(n.target);if(!r)return;let s,i=1;if(r instanceof Al)s=r.posAtStart;else{if(s=e.posAtCoords(n),s==null)return;let l=e.coordsAtPos(s);if(!l||n.y<l.top||n.y>l.bottom||n.x<l.left-e.defaultCharacterWidth||n.x>l.right+e.defaultCharacterWidth)return;let c=e.bidiSpans(e.state.doc.lineAt(s)).find(h=>h.from<=s&&h.to>=s),d=c&&c.dir==gr.RTL?-1:1;i=n.x<l.left?-d:d}let a=this.source(e,s,i);if(a?.then){let l=this.pending={pos:s};a.then(c=>{this.pending==l&&(this.pending=null,c&&!(Array.isArray(c)&&!c.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(c)?c:[c])}))},c=>vi(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(d6),n=e?e.manager.tooltips.findIndex(r=>r.create==db.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&&!uce(i.dom,e)||this.pending){let{pos:a}=s[0]||this.pending,l=(r=(n=s[0])===null||n===void 0?void 0:n.end)!==null&&r!==void 0?r:a;(a==l?this.view.posAtCoords(this.lastMove)!=a:!dce(this.view,a,l,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 d1=4;function uce(t,e){let{left:n,right:r,top:s,bottom:i}=t.getBoundingClientRect(),a;if(a=t.querySelector(".cm-tooltip-arrow")){let l=a.getBoundingClientRect();s=Math.min(l.top,s),i=Math.max(l.bottom,i)}return e.clientX>=n-d1&&e.clientX<=r+d1&&e.clientY>=s-d1&&e.clientY<=i+d1}function dce(t,e,n,r,s,i){let a=t.scrollDOM.getBoundingClientRect(),l=t.documentTop+t.documentPadding.top+t.contentHeight;if(a.left>r||a.right<r||a.top>s||Math.min(a.bottom,l)<s)return!1;let c=t.posAtCoords({x:r,y:s},!1);return c>=e&&c<=n}function hce(t,e={}){let n=Ft.define(),r=Os.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 l of s){let c=i.changes.mapPos(l.pos,-1,Ds.TrackDel);if(c!=null){let d=Object.assign(Object.create(null),l);d.pos=c,d.end!=null&&(d.end=i.changes.mapPos(d.end)),a.push(d)}}s=a}for(let a of i.effects)a.is(n)&&(s=a.value),a.is(fce)&&(s=[]);return s},provide:s=>Xv.from(s)});return{active:r,extension:[r,Vr.define(s=>new cce(s,t,r,n,e.hoverTime||300)),lce]}}function Eq(t,e){let n=t.plugin(d6);if(!n)return null;let r=n.manager.tooltips.indexOf(e);return r<0?null:n.manager.tooltipViews[r]}const fce=Ft.define(),s_=at.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 V0(t,e){let n=t.plugin(_q),r=n?n.specs.indexOf(e):-1;return r>-1?n.panels[r]:null}const _q=Vr.fromClass(class{constructor(t){this.input=t.state.facet(U0),this.specs=this.input.filter(n=>n),this.panels=this.specs.map(n=>n(t));let e=t.state.facet(s_);this.top=new h1(t,!0,e.topContainer),this.bottom=new h1(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(s_);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new h1(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new h1(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=t.state.facet(U0);if(n!=this.input){let r=n.filter(c=>c),s=[],i=[],a=[],l=[];for(let c of r){let d=this.specs.indexOf(c),h;d<0?(h=c(t.view),l.push(h)):(h=this.panels[d],h.update&&h.update(t)),s.push(h),(h.top?i:a).push(h)}this.specs=r,this.panels=s,this.top.sync(i),this.bottom.sync(a);for(let c of l)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=>Ze.scrollMargins.of(e=>{let n=e.plugin(t);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})});class h1{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=i_(e);e=e.nextSibling}else this.dom.insertBefore(n.dom,e);for(;e;)e=i_(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 i_(t){let e=t.nextSibling;return t.remove(),e}const U0=at.define({enables:_q});class Hl extends sd{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}Hl.prototype.elementClass="";Hl.prototype.toDOM=void 0;Hl.prototype.mapMode=Ds.TrackBefore;Hl.prototype.startSide=Hl.prototype.endSide=-1;Hl.prototype.point=!0;const fv=at.define(),mce=at.define(),pce={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>Rn.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},j0=at.define();function gce(t){return[Aq(),j0.of({...pce,...t})]}const a_=at.define({combine:t=>t.some(e=>e)});function Aq(t){return[xce]}const xce=Vr.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(j0).map(e=>new l_(t,e)),this.fixed=!t.state.facet(a_);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(a_)!=!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=Rn.iter(this.view.state.facet(fv),this.view.viewport.from),r=[],s=this.gutters.map(i=>new vce(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 l of i.type)if(l.type==ni.Text&&a){eO(n,r,l.from);for(let c of s)c.line(this.view,l,r);a=!1}else if(l.widget)for(let c of s)c.widget(this.view,l)}else if(i.type==ni.Text){eO(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(j0),n=t.state.facet(j0),r=t.docChanged||t.heightChanged||t.viewportChanged||!Rn.eq(t.startState.facet(fv),t.state.facet(fv),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 l_(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=>Ze.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==gr.LTR?{left:r,right:s}:{right:r,left:s}})});function o_(t){return Array.isArray(t)?t:[t]}function eO(t,e,n){for(;t.value&&t.from<=n;)t.from==n&&e.push(t.value),t.next()}class vce{constructor(e,n,r){this.gutter=e,this.height=r,this.i=0,this.cursor=Rn.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 l=new Mq(e,a,i,r);s.elements.push(l),s.dom.appendChild(l.dom)}else s.elements[this.i].update(e,a,i,r);this.height=n.bottom,this.i++}line(e,n,r){let s=[];eO(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(mce)){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 l_{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 l=e.lineBlockAtHeight(a-e.documentTop);n.domEventHandlers[r](e,l,s)&&s.preventDefault()});this.markers=o_(n.markers(e)),n.initialSpacer&&(this.spacer=new Mq(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=o_(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!Rn.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 Mq{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":""),yce(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 l=a,c=i<n.length?n[i++]:null,d=!1;if(c){let h=c.elementClass;h&&(r+=" "+h);for(let m=a;m<this.markers.length;m++)if(this.markers[m].compare(c)){l=m,d=!0;break}}else l=this.markers.length;for(;a<l;){let h=this.markers[a++];if(h.toDOM){h.destroy(s);let m=s.nextSibling;s.remove(),s=m}}if(!c)break;c.toDOM&&(d?s=s.nextSibling:this.dom.insertBefore(c.toDOM(e),s)),d&&a++}this.dom.className=r,this.markers=n}destroy(){this.setMarkers(null,[])}}function yce(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].compare(e[n]))return!1;return!0}const bce=at.define(),wce=at.define(),Ch=at.define({combine(t){return $o(t,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,n){let r=Object.assign({},e);for(let s in n){let i=r[s],a=n[s];r[s]=i?(l,c,d)=>i(l,c,d)||a(l,c,d):a}return r}})}});class H4 extends Hl{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function Q4(t,e){return t.state.facet(Ch).formatNumber(e,t.state)}const Sce=j0.compute([Ch],t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(bce)},lineMarker(e,n,r){return r.some(s=>s.toDOM)?null:new H4(Q4(e,e.state.doc.lineAt(n.from).number))},widgetMarker:(e,n,r)=>{for(let s of e.state.facet(wce)){let i=s(e,n,r);if(i)return i}return null},lineMarkerChange:e=>e.startState.facet(Ch)!=e.state.facet(Ch),initialSpacer(e){return new H4(Q4(e,c_(e.state.doc.lines)))},updateSpacer(e,n){let r=Q4(n.view,c_(n.view.state.doc.lines));return r==e.number?e:new H4(r)},domEventHandlers:t.facet(Ch).domEventHandlers,side:"before"}));function kce(t={}){return[Ch.of(t),Aq(),Sce]}function c_(t){let e=9;for(;e<t;)e=e*10+9;return e}const Oce=new class extends Hl{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},jce=fv.compute(["selection"],t=>{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(Oce.range(s)))}return Rn.of(e)});function Nce(){return jce}const Rq=1024;let Cce=0;class V4{constructor(e,n){this.from=e,this.to=n}}class sn{constructor(e={}){this.id=Cce++,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=si.match(e)),n=>{let r=e(n);return r===void 0?null:[this,r]}}}sn.closedBy=new sn({deserialize:t=>t.split(" ")});sn.openedBy=new sn({deserialize:t=>t.split(" ")});sn.group=new sn({deserialize:t=>t.split(" ")});sn.isolate=new sn({deserialize:t=>{if(t&&t!="rtl"&&t!="ltr"&&t!="auto")throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}});sn.contextHash=new sn({perNode:!0});sn.lookAhead=new sn({perNode:!0});sn.mounted=new sn({perNode:!0});class Yv{constructor(e,n,r){this.tree=e,this.overlay=n,this.parser=r}static get(e){return e&&e.props&&e.props[sn.mounted.id]}}const Tce=Object.create(null);class si{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):Tce,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),s=new si(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(sn.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(sn.group),i=-1;i<(s?s.length:0);i++){let a=n[i<0?r.name:s[i]];if(a)return a}}}}si.none=new si("",Object.create(null),0,8);class hb{constructor(e){this.types=e;for(let n=0;n<e.length;n++)if(e[n].id!=n)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let n=[];for(let r of this.types){let s=null;for(let i of e){let a=i(r);if(a){s||(s=Object.assign({},r.props));let l=a[1],c=a[0];c.combine&&c.id in s&&(l=c.combine(s[c.id],l)),s[c.id]=l}}n.push(s?new si(r.name,s,r.id,r.flags):r)}return new hb(n)}}const f1=new WeakMap,u_=new WeakMap;var hs;(function(t){t[t.ExcludeBuffers=1]="ExcludeBuffers",t[t.IncludeAnonymous=2]="IncludeAnonymous",t[t.IgnoreMounts=4]="IgnoreMounts",t[t.IgnoreOverlays=8]="IgnoreOverlays"})(hs||(hs={}));class ar{constructor(e,n,r,s,i){if(this.type=e,this.children=n,this.positions=r,this.length=s,this.props=null,i&&i.length){this.props=Object.create(null);for(let[a,l]of i)this.props[typeof a=="number"?a:a.id]=l}}toString(){let e=Yv.get(this);if(e&&!e.overlay)return e.tree.toString();let n="";for(let r of this.children){let s=r.toString();s&&(n&&(n+=","),n+=s)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(n.length?"("+n+")":""):n}cursor(e=0){return new nO(this.topNode,e)}cursorAt(e,n=0,r=0){let s=f1.get(this)||this.topNode,i=new nO(s);return i.moveTo(e,n),f1.set(this,i._tree),i}get topNode(){return new ki(this,0,0,null)}resolve(e,n=0){let r=W0(f1.get(this)||this.topNode,e,n,!1);return f1.set(this,r),r}resolveInner(e,n=0){let r=W0(u_.get(this)||this.topNode,e,n,!0);return u_.set(this,r),r}resolveStack(e,n=0){return Ace(this,e,n)}iterate(e){let{enter:n,leave:r,from:s=0,to:i=this.length}=e,a=e.mode||0,l=(a&hs.IncludeAnonymous)>0;for(let c=this.cursor(a|hs.IncludeAnonymous);;){let d=!1;if(c.from<=i&&c.to>=s&&(!l&&c.type.isAnonymous||n(c)!==!1)){if(c.firstChild())continue;d=!0}for(;d&&r&&(l||!c.type.isAnonymous)&&r(c),!c.nextSibling();){if(!c.parent())return;d=!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:p6(si.none,this.children,this.positions,0,this.children.length,0,this.length,(n,r,s)=>new ar(this.type,n,r,s,this.propValues),e.makeTree||((n,r,s)=>new ar(si.none,n,r,s)))}static build(e){return Mce(e)}}ar.empty=new ar(si.none,[],[],0);class f6{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 f6(this.buffer,this.index)}}class Yc{constructor(e,n,r){this.buffer=e,this.length=n,this.set=r}get type(){return si.none}toString(){let e=[];for(let n=0;n<this.buffer.length;)e.push(this.childString(n)),n=this.buffer[n+3];return e.join(",")}childString(e){let n=this.buffer[e],r=this.buffer[e+3],s=this.set.types[n],i=s.name;if(/\W/.test(i)&&!s.isError&&(i=JSON.stringify(i)),e+=4,r==e)return i;let a=[];for(;e<r;)a.push(this.childString(e)),e=this.buffer[e+3];return i+"("+a.join(",")+")"}findChild(e,n,r,s,i){let{buffer:a}=this,l=-1;for(let c=e;c!=n&&!(Dq(i,s,a[c+1],a[c+2])&&(l=c,r>0));c=a[c+3]);return l}slice(e,n,r){let s=this.buffer,i=new Uint16Array(n-e),a=0;for(let l=e,c=0;l<n;){i[c++]=s[l++],i[c++]=s[l++]-r;let d=i[c++]=s[l++]-r;i[c++]=s[l++]-e,a=Math.max(a,d)}return new Yc(i,a,this.set)}}function Dq(t,e,n,r){switch(t){case-2:return n<e;case-1:return r>=e&&n<e;case 0:return n<e&&r>e;case 1:return n<=e&&r>e;case 2:return r>e;case 4:return!0}}function W0(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.to<e);){let a=!r&&t instanceof ki&&t.index<0?null:t.parent;if(!a)return t;t=a}let i=r?0:hs.IgnoreOverlays;if(r)for(let a=t,l=a.parent;l;a=l,l=a.parent)a instanceof ki&&a.index<0&&((s=l.enter(e,n,i))===null||s===void 0?void 0:s.from)!=a.from&&(t=l);for(;;){let a=t.enter(e,n,i);if(!a)return t;t=a}}class Pq{cursor(e=0){return new nO(this,e)}getChild(e,n=null,r=null){let s=d_(this,e,n,r);return s.length?s[0]:null}getChildren(e,n=null,r=null){return d_(this,e,n,r)}resolve(e,n=0){return W0(this,e,n,!1)}resolveInner(e,n=0){return W0(this,e,n,!0)}matchContext(e){return tO(this.parent,e)}enterUnfinishedNodesBefore(e){let n=this.childBefore(e),r=this;for(;n;){let s=n.lastChild;if(!s||s.to!=n.to)break;s.type.isError&&s.from==s.to?(r=n,n=s.prevSibling):n=s}return r}get node(){return this}get next(){return this.parent}}class ki extends Pq{constructor(e,n,r,s){super(),this._tree=e,this.from=n,this.index=r,this._parent=s}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,n,r,s,i=0){for(let a=this;;){for(let{children:l,positions:c}=a._tree,d=n>0?l.length:-1;e!=d;e+=n){let h=l[e],m=c[e]+a.from;if(Dq(s,r,m,m+h.length)){if(h instanceof Yc){if(i&hs.ExcludeBuffers)continue;let g=h.findChild(0,h.buffer.length,n,r-m,s);if(g>-1)return new jo(new Ece(a,h,e,m),null,g)}else if(i&hs.IncludeAnonymous||!h.type.isAnonymous||m6(h)){let g;if(!(i&hs.IgnoreMounts)&&(g=Yv.get(h))&&!g.overlay)return new ki(g.tree,m,e,a);let x=new ki(h,m,e,a);return i&hs.IncludeAnonymous||!x.type.isAnonymous?x:x.nextChild(n<0?h.children.length-1:0,n,r,s)}}}if(i&hs.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&hs.IgnoreOverlays)&&(s=Yv.get(this._tree))&&s.overlay){let i=e-this.from;for(let{from:a,to:l}of s.overlay)if((n>0?a<=i:a<i)&&(n<0?l>=i:l>i))return new ki(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 d_(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 tO(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 Ece{constructor(e,n,r,s){this.parent=e,this.buffer=n,this.index=r,this.start=s}}class jo extends Pq{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 jo(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&hs.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 jo(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 jo(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 jo(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 ar(this.type,e,n,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function zq(t){if(!t.length)return null;let e=0,n=t[0];for(let i=1;i<t.length;i++){let a=t[i];(a.from>n.from||a.to<n.to)&&(n=a,e=i)}let r=n instanceof ki&&n.index<0?null:n.parent,s=t.slice();return r?s[e]=r:s.splice(e,1),new _ce(s,n)}class _ce{constructor(e,n){this.heads=e,this.node=n}get next(){return zq(this.heads)}}function Ace(t,e,n){let r=t.resolveInner(e,n),s=null;for(let i=r instanceof ki?r:r.context.parent;i;i=i.parent)if(i.index<0){let a=i.parent;(s||(s=[r])).push(a.resolve(e,n)),i=a}else{let a=Yv.get(i.tree);if(a&&a.overlay&&a.overlay[0].from<=e&&a.overlay[a.overlay.length-1].to>=e){let l=new ki(a.tree,a.overlay[0].from+i.from,-1,i);(s||(s=[r])).push(W0(l,e,n,!1))}}return s?zq(s):r}class nO{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 ki)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 ki?(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&hs.ExcludeBuffers?!1:this.enterChild(1,e,n):this.yield(this._tree.enter(e,n,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&hs.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&hs.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<s.buffer.buffer.length)return!1}else for(let i=0;i<this.index;i++)if(s.buffer.buffer[i+3]<this.index)return!1;({index:n,parent:r}=s)}else({index:n,_parent:r}=this._tree);for(;r;{index:n,_parent:r}=r)if(n>-1)for(let i=n+e,a=e<0?-1:r._tree.children.length;i!=a;i+=e){let l=r._tree.children[i];if(this.mode&hs.IncludeAnonymous||l instanceof Yc||!l.type.isAnonymous||m6(l))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<e))&&this.parent(););for(;this.enterChild(1,e,n););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,n=null,r=0;if(e&&e.context==this.buffer)e:for(let s=this.index,i=this.stack.length;i>=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<this.stack.length;s++)n=new jo(this.buffer,n,this.stack[s]);return this.bufferNode=new jo(this.buffer,n,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,n){for(let r=0;;){let s=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){r++;continue}this.type.isAnonymous||(s=!0)}for(;;){if(s&&n&&n(this),s=this.type.isAnonymous,!r)return;if(this.nextSibling())break;this.parent(),r--,s=!0}}}matchContext(e){if(!this.buffer)return tO(this.node.parent,e);let{buffer:n}=this.buffer,{types:r}=n.set;for(let s=e.length-1,i=this.stack.length-1;s>=0;i--){if(i<0)return tO(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 m6(t){return t.children.some(e=>e instanceof Yc||!e.type.isAnonymous||m6(e))}function Mce(t){var e;let{buffer:n,nodeSet:r,maxBufferLength:s=Rq,reused:i=[],minRepeatType:a=r.types.length}=t,l=Array.isArray(n)?new f6(n,n.length):n,c=r.types,d=0,h=0;function m(E,_,A,L,P,B){let{id:$,start:U,end:te,size:z}=l,Q=h,F=d;if(z<0)if(l.next(),z==-1){let ie=i[$];A.push(ie),L.push(U-E);return}else if(z==-3){d=$;return}else if(z==-4){h=$;return}else throw new RangeError(`Unrecognized record size: ${z}`);let Y=c[$],J,X,R=U-E;if(te-U<=s&&(X=S(l.pos-_,P))){let ie=new Uint16Array(X.size-X.skip),G=l.pos-X.size,I=ie.length;for(;l.pos>G;)I=k(X.start,ie,I);J=new Yc(ie,te-X.start,r),R=X.start-E}else{let ie=l.pos-z;l.next();let G=[],I=[],V=$>=a?$:-1,ee=0,ne=te;for(;l.pos>ie;)V>=0&&l.id==V&&l.size>=0?(l.end<=ne-s&&(y(G,I,U,ee,l.end,ne,V,Q,F),ee=G.length,ne=l.end),l.next()):B>2500?g(U,ie,G,I):m(U,ie,G,I,V,B+1);if(V>=0&&ee>0&&ee<G.length&&y(G,I,U,ee,U,ne,V,Q,F),G.reverse(),I.reverse(),V>-1&&ee>0){let W=x(Y,F);J=p6(Y,G,I,0,G.length,0,te-U,W,W)}else J=w(Y,G,I,te-U,Q-te,F)}A.push(J),L.push(R)}function g(E,_,A,L){let P=[],B=0,$=-1;for(;l.pos>_;){let{id:U,start:te,end:z,size:Q}=l;if(Q>4)l.next();else{if($>-1&&te<$)break;$<0&&($=z-s),P.push(U,te,z),B++,l.next()}}if(B){let U=new Uint16Array(B*4),te=P[P.length-2];for(let z=P.length-3,Q=0;z>=0;z-=3)U[Q++]=P[z],U[Q++]=P[z+1]-te,U[Q++]=P[z+2]-te,U[Q++]=Q;A.push(new Yc(U,P[2]-te,r)),L.push(te-E)}}function x(E,_){return(A,L,P)=>{let B=0,$=A.length-1,U,te;if($>=0&&(U=A[$])instanceof ar){if(!$&&U.type==E&&U.length==P)return U;(te=U.prop(sn.lookAhead))&&(B=L[$]+U.length+te)}return w(E,A,L,P,B,_)}}function y(E,_,A,L,P,B,$,U,te){let z=[],Q=[];for(;E.length>L;)z.push(E.pop()),Q.push(_.pop()+A-P);E.push(w(r.types[$],z,Q,B-P,U-B,te)),_.push(P-A)}function w(E,_,A,L,P,B,$){if(B){let U=[sn.contextHash,B];$=$?[U].concat($):[U]}if(P>25){let U=[sn.lookAhead,P];$=$?[U].concat($):[U]}return new ar(E,_,A,L,$)}function S(E,_){let A=l.fork(),L=0,P=0,B=0,$=A.end-s,U={size:0,start:0,skip:0};e:for(let te=A.pos-E;A.pos>te;){let z=A.size;if(A.id==_&&z>=0){U.size=L,U.start=P,U.skip=B,B+=4,L+=4,A.next();continue}let Q=A.pos-z;if(z<0||Q<te||A.start<$)break;let F=A.id>=a?4:0,Y=A.start;for(A.next();A.pos>Q;){if(A.size<0)if(A.size==-3)F+=4;else break e;else A.id>=a&&(F+=4);A.next()}P=Y,L+=z,B+=F}return(_<0||L==E)&&(U.size=L,U.start=P,U.skip=B),U.size>4?U:void 0}function k(E,_,A){let{id:L,start:P,end:B,size:$}=l;if(l.next(),$>=0&&L<a){let U=A;if($>4){let te=l.pos-($-4);for(;l.pos>te;)A=k(E,_,A)}_[--A]=U,_[--A]=B-E,_[--A]=P-E,_[--A]=L}else $==-3?d=L:$==-4&&(h=L);return A}let j=[],N=[];for(;l.pos>0;)m(t.start||0,t.bufferStart||0,j,N,-1,0);let T=(e=t.length)!==null&&e!==void 0?e:j.length?N[0]+j[0].length:0;return new ar(c[t.topID],j.reverse(),N.reverse(),T)}const h_=new WeakMap;function mv(t,e){if(!t.isAnonymous||e instanceof Yc||e.type!=t)return 1;let n=h_.get(e);if(n==null){n=1;for(let r of e.children){if(r.type!=t||!(r instanceof ar)){n=1;break}n+=mv(t,r)}h_.set(e,n)}return n}function p6(t,e,n,r,s,i,a,l,c){let d=0;for(let y=r;y<s;y++)d+=mv(t,e[y]);let h=Math.ceil(d*1.5/8),m=[],g=[];function x(y,w,S,k,j){for(let N=S;N<k;){let T=N,E=w[N],_=mv(t,y[N]);for(N++;N<k;N++){let A=mv(t,y[N]);if(_+A>=h)break;_+=A}if(N==T+1){if(_>h){let A=y[T];x(A.children,A.positions,0,A.children.length,w[T]+j);continue}m.push(y[T])}else{let A=w[N-1]+y[N-1].length-E;m.push(p6(t,y,w,T,N,E,A,null,c))}g.push(E+j-i)}}return x(e,n,r,s,0),(l||c)(m,g,a)}class Rce{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 jo?this.setBuffer(e.context.buffer,e.index,n):e instanceof ki&&this.map.set(e.tree,n)}get(e){return e instanceof jo?this.getBuffer(e.context.buffer,e.index):e instanceof ki?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 l=0,c=0,d=0;;l++){let h=l<n.length?n[l]:null,m=h?h.fromA:1e9;if(m-c>=r)for(;a&&a.from<m;){let g=a;if(c>=g.from||m<=g.to||d){let x=Math.max(g.from,c)-d,y=Math.min(g.to,m)-d;g=x>=y?null:new Ju(x,y,g.tree,g.offset+d,l>0,!!h)}if(g&&s.push(g),a.to>m)break;a=i<e.length?e[i++]:null}if(!h)break;c=h.toA,d=h.toA-h.toB}return s}}let g6=class{startParse(e,n,r){return typeof e=="string"&&(e=new Dce(e)),r=r?r.length?r.map(s=>new V4(s.from,s.to)):[new V4(0,0)]:[new V4(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 Dce{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 sn({perNode:!0});let Pce=0;class ha{constructor(e,n,r,s){this.name=e,this.set=n,this.base=r,this.modified=s,this.id=Pce++}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 ha&&(n=e),n?.base)throw new Error("Can not derive from a modified tag");let s=new ha(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 Kv(e);return r=>r.modified.indexOf(n)>-1?r:Kv.get(r.base||r,r.modified.concat(n).sort((s,i)=>s.id-i.id))}}let zce=0;class Kv{constructor(e){this.name=e,this.instances=[],this.id=zce++}static get(e,n){if(!n.length)return e;let r=n[0].instances.find(l=>l.base==e&&Ice(n,l.modified));if(r)return r;let s=[],i=new ha(e.name,s,e,n);for(let l of n)l.instances.push(i);let a=Lce(n);for(let l of e.set)if(!l.modified.length)for(let c of a)s.push(Kv.get(l,c));return i}}function Ice(t,e){return t.length==e.length&&t.every((n,r)=>n==e[r])}function Lce(t){let e=[[]];for(let n=0;n<t.length;n++)for(let r=0,s=e.length;r<s;r++)e.push(e[r].concat(t[n]));return e.sort((n,r)=>r.length-n.length)}function x6(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,l=s;for(let m=0;;){if(l=="..."&&m>0&&m+3==s.length){a=1;break}let g=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(l);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);l=s.slice(m)}let c=i.length-1,d=i[c];if(!d)throw new RangeError("Invalid path: "+s);let h=new G0(r,a,c>0?i.slice(0,c):null);e[d]=h.sort(e[d])}}return Iq.add(e)}const Iq=new sn({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 G0(s.tags,s.mode,s.context);n?n.next=i:r=i,n=i}return r}});class G0{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<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}}G0.empty=new G0([],2,null);function Lq(t,e){let n=Object.create(null);for(let i of t)if(!Array.isArray(i.tag))n[i.tag.id]=i.class;else for(let a of i.tag)n[a.id]=i.class;let{scope:r,all:s=null}=e||{};return{style:i=>{let a=s;for(let l of i)for(let c of l.set){let d=n[c.id];if(d){a=a?a+" "+d:d;break}}return a},scope:r}}function Bce(t,e){let n=null;for(let r of t){let s=r.style(e);s&&(n=n?n+" "+s:s)}return n}function Fce(t,e,n,r=0,s=t.length){let i=new qce(r,Array.isArray(e)?e:[e],n);i.highlightRange(t.cursor(),r,s,"",i.highlighters),i.flush(s)}class qce{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:l,to:c}=e;if(l>=r||c<=n)return;a.isTop&&(i=this.highlighters.filter(x=>!x.scope||x.scope(a)));let d=s,h=$ce(e)||G0.empty,m=Bce(i,h.tags);if(m&&(d&&(d+=" "),d+=m,h.mode==1&&(s+=(s?" ":"")+m)),this.startSpan(Math.max(n,l),d),h.opaque)return;let g=e.tree&&e.tree.prop(sn.mounted);if(g&&g.overlay){let x=e.node.enter(g.overlay[0].from+l,1),y=this.highlighters.filter(S=>!S.scope||S.scope(g.tree.type)),w=e.firstChild();for(let S=0,k=l;;S++){let j=S<g.overlay.length?g.overlay[S]:null,N=j?j.from+l:c,T=Math.max(n,k),E=Math.min(r,N);if(T<E&&w)for(;e.from<E&&(this.highlightRange(e,T,E,s,i),this.startSpan(Math.min(E,e.to),d),!(e.to>=N||!e.nextSibling())););if(!j||N>r)break;k=j.to+l,k>n&&(this.highlightRange(x.cursor(),Math.max(n,j.from+l),Math.min(r,k),"",y),this.startSpan(Math.min(r,k),d))}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),d)}while(e.nextSibling());e.parent()}}}function $ce(t){let e=t.type.prop(Iq);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}const Ke=ha.define,m1=Ke(),Mc=Ke(),f_=Ke(Mc),m_=Ke(Mc),Rc=Ke(),p1=Ke(Rc),U4=Ke(Rc),po=Ke(),Ru=Ke(po),fo=Ke(),mo=Ke(),rO=Ke(),qm=Ke(rO),g1=Ke(),ve={comment:m1,lineComment:Ke(m1),blockComment:Ke(m1),docComment:Ke(m1),name:Mc,variableName:Ke(Mc),typeName:f_,tagName:Ke(f_),propertyName:m_,attributeName:Ke(m_),className:Ke(Mc),labelName:Ke(Mc),namespace:Ke(Mc),macroName:Ke(Mc),literal:Rc,string:p1,docString:Ke(p1),character:Ke(p1),attributeValue:Ke(p1),number:U4,integer:Ke(U4),float:Ke(U4),bool:Ke(Rc),regexp:Ke(Rc),escape:Ke(Rc),color:Ke(Rc),url:Ke(Rc),keyword:fo,self:Ke(fo),null:Ke(fo),atom:Ke(fo),unit:Ke(fo),modifier:Ke(fo),operatorKeyword:Ke(fo),controlKeyword:Ke(fo),definitionKeyword:Ke(fo),moduleKeyword:Ke(fo),operator:mo,derefOperator:Ke(mo),arithmeticOperator:Ke(mo),logicOperator:Ke(mo),bitwiseOperator:Ke(mo),compareOperator:Ke(mo),updateOperator:Ke(mo),definitionOperator:Ke(mo),typeOperator:Ke(mo),controlOperator:Ke(mo),punctuation:rO,separator:Ke(rO),bracket:qm,angleBracket:Ke(qm),squareBracket:Ke(qm),paren:Ke(qm),brace:Ke(qm),content:po,heading:Ru,heading1:Ke(Ru),heading2:Ke(Ru),heading3:Ke(Ru),heading4:Ke(Ru),heading5:Ke(Ru),heading6:Ke(Ru),contentSeparator:Ke(po),list:Ke(po),quote:Ke(po),emphasis:Ke(po),strong:Ke(po),link:Ke(po),monospace:Ke(po),strikethrough:Ke(po),inserted:Ke(),deleted:Ke(),changed:Ke(),invalid:Ke(),meta:g1,documentMeta:Ke(g1),annotation:Ke(g1),processingInstruction:Ke(g1),definition:ha.defineModifier("definition"),constant:ha.defineModifier("constant"),function:ha.defineModifier("function"),standard:ha.defineModifier("standard"),local:ha.defineModifier("local"),special:ha.defineModifier("special")};for(let t in ve){let e=ve[t];e instanceof ha&&(e.name=t)}Lq([{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 W4;const Qu=new sn;function Bq(t){return at.define({combine:t?e=>e.concat(t):void 0})}const Hce=new sn;class va{constructor(e,n,r=[],s=""){this.data=e,this.name=s,wn.prototype.hasOwnProperty("tree")||Object.defineProperty(wn.prototype,"tree",{get(){return Ss(this)}}),this.parser=n,this.extension=[Kc.of(this),wn.languageData.of((i,a,l)=>{let c=p_(i,a,l),d=c.type.prop(Qu);if(!d)return[];let h=i.facet(d),m=c.type.prop(Hce);if(m){let g=c.resolve(a-c.from,l);for(let x of m)if(x.test(g,i)){let y=i.facet(x.facet);return x.type=="replace"?y:y.concat(h)}}return h})].concat(r)}isActiveAt(e,n,r=-1){return p_(e,n,r).type.prop(Qu)==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(Qu)==this.data){r.push({from:a,to:a+i.length});return}let l=i.prop(sn.mounted);if(l){if(l.tree.prop(Qu)==this.data){if(l.overlay)for(let c of l.overlay)r.push({from:c.from+a,to:c.to+a});else r.push({from:a,to:a+i.length});return}else if(l.overlay){let c=r.length;if(s(l.tree,l.overlay[0].from+a),r.length>c)return}}for(let c=0;c<i.children.length;c++){let d=i.children[c];d instanceof ar&&s(d,i.positions[c]+a)}};return s(Ss(e),0),r}get allowsNesting(){return!0}}va.setState=Ft.define();function p_(t,e,n){let r=t.facet(Kc),s=Ss(t).topNode;if(!r||r.allowsNesting)for(let i=s;i;i=i.enter(e,n,hs.ExcludeBuffers))i.type.isTop&&(s=i);return s}class X0 extends va{constructor(e,n,r){super(e,n,[],r),this.parser=n}static define(e){let n=Bq(e.languageData);return new X0(n,e.parser.configure({props:[Qu.add(r=>r.isTop?n:void 0)]}),e.name)}configure(e,n){return new X0(this.data,this.parser.configure(e),n||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Ss(t){let e=t.field(va.state,!1);return e?e.tree:ar.empty}class Qce{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<r||n>=this.cursorPos?this.doc.sliceString(e,n):this.string.slice(e-r,n-r)}}let $m=null;class rf{constructor(e,n,r=[],s,i,a,l,c){this.parser=e,this.state=n,this.fragments=r,this.tree=s,this.treeLen=i,this.viewport=a,this.skipped=l,this.scheduleOn=c,this.parse=null,this.tempSkipped=[]}static create(e,n,r){return new rf(e,n,[],ar.empty,0,r,[],null)}startParse(){return this.parser.startParse(new Qce(this.state.doc),this.fragments)}work(e,n){return n!=null&&n>=this.state.doc.length&&(n=void 0),this.tree!=ar.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.state.doc.length&&this.parse.stopAt(n);;){let s=this.parse.advance();if(s)if(this.fragments=this.withoutTempSkipped(Ju.addTree(s,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(r=this.parse.stoppedAt)!==null&&r!==void 0?r:this.state.doc.length,this.tree=s,this.parse=null,this.treeLen<(n??this.state.doc.length))this.parse=this.startParse();else return!0;if(e())return!1}})}takeTree(){let e,n;this.parse&&(e=this.parse.parsedPos)>=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=$m;$m=this;try{return e()}finally{$m=n}}withoutTempSkipped(e){for(let n;n=this.tempSkipped.pop();)e=g_(e,n.from,n.to);return e}changes(e,n){let{fragments:r,tree:s,treeLen:i,viewport:a,skipped:l}=this;if(this.takeTree(),!e.empty){let c=[];if(e.iterChangedRanges((d,h,m,g)=>c.push({fromA:d,toA:h,fromB:m,toB:g})),r=Ju.applyChanges(r,c),s=ar.empty,i=0,a={from:e.mapPos(a.from,-1),to:e.mapPos(a.to,1)},this.skipped.length){l=[];for(let d of this.skipped){let h=e.mapPos(d.from,1),m=e.mapPos(d.to,-1);h<m&&l.push({from:h,to:m})}}}return new rf(this.parser,n,r,s,i,a,l,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let n=this.skipped.length;for(let r=0;r<this.skipped.length;r++){let{from:s,to:i}=this.skipped[r];s<e.to&&i>e.from&&(this.fragments=g_(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 g6{createParse(n,r,s){let i=s[0].from,a=s[s.length-1].to;return{parsedPos:i,advance(){let c=$m;if(c){for(let d of s)c.tempSkipped.push(d);e&&(c.scheduleOn=c.scheduleOn?Promise.all([c.scheduleOn,e]):e)}return this.parsedPos=a,new ar(si.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 $m}}function g_(t,e,n){return Ju.applyChanges(t,[{fromA:e,toA:n,fromB:e,toB:n}])}class sf{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 sf(n)}static init(e){let n=Math.min(3e3,e.doc.length),r=rf.create(e.facet(Kc).parser,e,{from:0,to:n});return r.work(20,n)||r.takeTree(),new sf(r)}}va.state=Os.define({create:sf.init,update(t,e){for(let n of e.effects)if(n.is(va.setState))return n.value;return e.startState.facet(Kc)!=e.state.facet(Kc)?sf.init(e.state):t.apply(e)}});let Fq=t=>{let e=setTimeout(()=>t(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(Fq=t=>{let e=-1,n=setTimeout(()=>{e=requestIdleCallback(t,{timeout:400})},100);return()=>e<0?clearTimeout(n):cancelIdleCallback(e)});const G4=typeof navigator<"u"&&(!((W4=navigator.scheduling)===null||W4===void 0)&&W4.isInputPending)?()=>navigator.scheduling.isInputPending():null,Vce=Vr.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(va.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(va.state);(n.tree!=n.context.tree||!n.context.isDone(e.doc.length))&&(this.working=Fq(this.work))}work(e){this.working=null;let n=Date.now();if(this.chunkEnd<n&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=n+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:r,viewport:{to:s}}=this.view,i=r.field(va.state);if(i.tree==i.context.tree&&i.context.isDone(s+1e5))return;let a=Date.now()+Math.min(this.chunkBudget,100,e&&!G4?Math.max(25,e.timeRemaining()-5):1e9),l=i.context.treeLen<s&&r.doc.length>s+1e3,c=i.context.work(()=>G4&&G4()||Date.now()>a,s+(l?0:1e5));this.chunkBudget-=Date.now()-n,(c||this.chunkBudget<=0)&&(i.context.takeTree(),this.view.dispatch({effects:va.setState.of(new sf(i.context))})),this.chunkBudget>0&&!(c&&!l)&&this.scheduleWork(),this.checkAsyncSchedule(i.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(n=>vi(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=at.define({combine(t){return t.length?t[0]:null},enables:t=>[va.state,Vce,Ze.contentAttributes.compute([t],e=>{let n=e.facet(t);return n&&n.name?{"data-language":n.name}:{}})]});class qq{constructor(e,n=[]){this.language=e,this.support=n,this.extension=[e,n]}}const Uce=at.define(),Wp=at.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 ld(t){let e=t.facet(Wp);return e.charCodeAt(0)==9?t.tabSize*e.length:e.length}function Y0(t,e){let n="",r=t.tabSize,s=t.facet(Wp)[0];if(s==" "){for(;e>=r;)n+=" ",e-=r;s=" "}for(let i=0;i<e;i++)n+=s;return n}function v6(t,e){t instanceof wn&&(t=new fb(t));for(let r of t.state.facet(Uce)){let s=r(t,e);if(s!==void 0)return s}let n=Ss(t.state);return n.length>=e?Wce(t,n,e):null}class fb{constructor(e,n={}){this.state=e,this.options=n,this.unit=ld(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<e:s<=e)?{text:r.text.slice(s-r.from),from:s}:{text:r.text.slice(0,s-r.from),from:r.from}:r}textAfterPos(e,n=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:r,from:s}=this.lineAt(e,n);return r.slice(e-s,Math.min(r.length,e+100-s))}column(e,n=1){let{text:r,from:s}=this.lineAt(e,n),i=this.countColumn(r,e-s),a=this.options.overrideIndentation?this.options.overrideIndentation(s):-1;return a>-1&&(i+=a-this.countColumn(r,r.search(/\S|$/))),i}countColumn(e,n=e.length){return Nf(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 mb=new sn;function Wce(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.from<r.node.from||a.to>r.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 $q(r,t,n)}function $q(t,e,n){for(let r=t;r;r=r.next){let s=Xce(r.node);if(s)return s(y6.create(e,n,r))}return 0}function Gce(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}function Xce(t){let e=t.type.prop(mb);if(e)return e;let n=t.firstChild,r;if(n&&(r=n.type.prop(sn.closedBy))){let s=t.lastChild,i=s&&r.indexOf(s.name)>-1;return a=>Hq(a,!0,1,void 0,i&&!Gce(a)?s.from:void 0)}return t.parent==null?Yce:null}function Yce(){return 0}class y6 extends fb{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 y6(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(Kce(r,e))break;n=this.state.doc.lineAt(r.from)}return this.lineIndent(n.from)}continue(){return $q(this.context.next,this.base,this.pos)}}function Kce(t,e){for(let n=e;n;n=n.parent)if(t==n)return!0;return!1}function Zce(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 l=n.to;;){let c=e.childAfter(l);if(!c||c==r)return null;if(!c.type.isSkipped){if(c.from>=a)return null;let d=/^ */.exec(i.text.slice(n.to-i.from))[0].length;return{from:n.from,to:n.to+d}}l=c.to}}function X4({closing:t,align:e=!0,units:n=1}){return r=>Hq(r,e,n,t)}function Hq(t,e,n,r,s){let i=t.textAfter,a=i.match(/^\s*/)[0].length,l=r&&i.slice(a,a+r.length)==r||s==t.pos+a,c=e?Zce(t):null;return c?l?t.column(c.from):t.column(c.to):t.baseIndent+(l?0:t.unit*n)}function x_({except:t,units:e=1}={}){return n=>{let r=t&&t.test(n.textAfter);return n.baseIndent+(r?0:e*n.unit)}}const Jce=200;function eue(){return wn.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+Jce)return t;let i=n.sliceString(s.from,r);if(!e.some(d=>d.test(i)))return t;let{state:a}=t,l=-1,c=[];for(let{head:d}of a.selection.ranges){let h=a.doc.lineAt(d);if(h.from==l)continue;l=h.from;let m=v6(a,h.from);if(m==null)continue;let g=/^\s*/.exec(h.text)[0],x=Y0(a,m);g!=x&&c.push({from:h.from,to:h.from+g.length,insert:x})}return c.length?[t,{changes:c,sequential:!0}]:t})}const tue=at.define(),b6=new sn;function Qq(t){let e=t.firstChild,n=t.lastChild;return e&&e.to<n.from?{from:e.to,to:n.type.isError?t.to:n.from}:null}function nue(t,e,n){let r=Ss(t);if(r.length<n)return null;let s=r.resolveStack(n,1),i=null;for(let a=s;a;a=a.next){let l=a.node;if(l.to<=n||l.from>n)continue;if(i&&l.from<e)break;let c=l.type.prop(b6);if(c&&(l.to<r.length-50||r.length==t.doc.length||!rue(l))){let d=c(l,t);d&&d.from<=n&&d.from>=e&&d.to>n&&(i=d)}}return i}function rue(t){let e=t.lastChild;return e&&e.to==t.to&&e.type.isError}function Zv(t,e,n){for(let r of t.facet(tue)){let s=r(t,e,n);if(s)return s}return nue(t,e,n)}function Vq(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 pb=Ft.define({map:Vq}),Gp=Ft.define({map:Vq});function Uq(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 cd=Os.define({create(){return kt.none},update(t,e){e.isUserEvent("delete")&&e.changes.iterChangedRanges((n,r)=>t=v_(t,n,r)),t=t.map(e.changes);for(let n of e.effects)if(n.is(pb)&&!sue(t,n.value.from,n.value.to)){let{preparePlaceholder:r}=e.state.facet(Xq),s=r?kt.replace({widget:new due(r(e.state,n.value))}):y_;t=t.update({add:[s.range(n.value.from,n.value.to)]})}else n.is(Gp)&&(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=v_(t,e.selection.main.head)),t},provide:t=>Ze.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<t.length;){let r=t[n++],s=t[n++];if(typeof r!="number"||typeof s!="number")throw new RangeError("Invalid JSON for fold state");e.push(y_.range(r,s))}return kt.set(e,!0)}});function v_(t,e,n=e){let r=!1;return t.between(e,n,(s,i)=>{s<n&&i>e&&(r=!0)}),r?t.update({filterFrom:e,filterTo:n,filter:(s,i)=>s>=n||i<=e}):t}function Jv(t,e,n){var r;let s=null;return(r=t.field(cd,!1))===null||r===void 0||r.between(e,n,(i,a)=>{(!s||s.from>i)&&(s={from:i,to:a})}),s}function sue(t,e,n){let r=!1;return t.between(e,e,(s,i)=>{s==e&&i==n&&(r=!0)}),r}function Wq(t,e){return t.field(cd,!1)?e:e.concat(Ft.appendConfig.of(Yq()))}const iue=t=>{for(let e of Uq(t)){let n=Zv(t.state,e.from,e.to);if(n)return t.dispatch({effects:Wq(t.state,[pb.of(n),Gq(t,n)])}),!0}return!1},aue=t=>{if(!t.state.field(cd,!1))return!1;let e=[];for(let n of Uq(t)){let r=Jv(t.state,n.from,n.to);r&&e.push(Gp.of(r),Gq(t,r,!1))}return e.length&&t.dispatch({effects:e}),e.length>0};function Gq(t,e,n=!0){let r=t.state.doc.lineAt(e.from).number,s=t.state.doc.lineAt(e.to).number;return Ze.announce.of(`${t.state.phrase(n?"Folded lines":"Unfolded lines")} ${r} ${t.state.phrase("to")} ${s}.`)}const oue=t=>{let{state:e}=t,n=[];for(let r=0;r<e.doc.length;){let s=t.lineBlockAt(r),i=Zv(e,s.from,s.to);i&&n.push(pb.of(i)),r=(i?t.lineBlockAt(i.to):s).to+1}return n.length&&t.dispatch({effects:Wq(t.state,n)}),!!n.length},lue=t=>{let e=t.state.field(cd,!1);if(!e||!e.size)return!1;let n=[];return e.between(0,t.state.doc.length,(r,s)=>{n.push(Gp.of({from:r,to:s}))}),t.dispatch({effects:n}),!0},cue=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:iue},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:aue},{key:"Ctrl-Alt-[",run:oue},{key:"Ctrl-Alt-]",run:lue}],uue={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},Xq=at.define({combine(t){return $o(t,uue)}});function Yq(t){return[cd,mue]}function Kq(t,e){let{state:n}=t,r=n.facet(Xq),s=a=>{let l=t.lineBlockAt(t.posAtDOM(a.target)),c=Jv(t.state,l.from,l.to);c&&t.dispatch({effects:Gp.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 y_=kt.replace({widget:new class extends Ho{toDOM(t){return Kq(t,null)}}});class due extends Ho{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return Kq(e,this.value)}}const hue={openText:"⌄",closedText:"",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class Y4 extends Hl{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 fue(t={}){let e={...hue,...t},n=new Y4(e,!0),r=new Y4(e,!1),s=Vr.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(cd,!1)!=a.state.field(cd,!1)||Ss(a.startState)!=Ss(a.state)||e.foldingChanged(a))&&(this.markers=this.buildMarkers(a.view))}buildMarkers(a){let l=new ql;for(let c of a.viewportLineBlocks){let d=Jv(a.state,c.from,c.to)?r:Zv(a.state,c.from,c.to)?n:null;d&&l.add(c.from,c.from,d)}return l.finish()}}),{domEventHandlers:i}=e;return[s,gce({class:"cm-foldGutter",markers(a){var l;return((l=a.plugin(s))===null||l===void 0?void 0:l.markers)||Rn.empty},initialSpacer(){return new Y4(e,!1)},domEventHandlers:{...i,click:(a,l,c)=>{if(i.click&&i.click(a,l,c))return!0;let d=Jv(a.state,l.from,l.to);if(d)return a.dispatch({effects:Gp.of(d)}),!0;let h=Zv(a.state,l.from,l.to);return h?(a.dispatch({effects:pb.of(h)}),!0):!1}}}),Yq()]}const mue=Ze.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 Xp{constructor(e,n){this.specs=e;let r;function s(l){let c=Wc.newName();return(r||(r=Object.create(null)))["."+c]=l,c}const i=typeof n.all=="string"?n.all:n.all?s(n.all):void 0,a=n.scope;this.scope=a instanceof va?l=>l.prop(Qu)==a.data:a?l=>l==a:void 0,this.style=Lq(e.map(l=>({tag:l.tag,class:l.class||s(Object.assign({},l,{tag:null}))})),{all:i}).style,this.module=r?new Wc(r):null,this.themeType=n.themeType}static define(e,n){return new Xp(e,n||{})}}const sO=at.define(),Zq=at.define({combine(t){return t.length?[t[0]]:null}});function K4(t){let e=t.facet(sO);return e.length?e:t.facet(Zq)}function Jq(t,e){let n=[gue],r;return t instanceof Xp&&(t.module&&n.push(Ze.styleModule.of(t.module)),r=t.themeType),e?.fallback?n.push(Zq.of(t)):r?n.push(sO.computeN([Ze.darkTheme],s=>s.facet(Ze.darkTheme)==(r=="dark")?[t]:[])):n.push(sO.of(t)),n}class pue{constructor(e){this.markCache=Object.create(null),this.tree=Ss(e.state),this.decorations=this.buildDeco(e,K4(e.state)),this.decoratedTo=e.viewport.to}update(e){let n=Ss(e.state),r=K4(e.state),s=r!=K4(e.startState),{viewport:i}=e.view,a=e.changes.mapPos(this.decoratedTo,1);n.length<i.to&&!s&&n.type==this.tree.type&&a>=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 kt.none;let r=new ql;for(let{from:s,to:i}of e.visibleRanges)Fce(this.tree,n,(a,l,c)=>{r.add(a,l,this.markCache[c]||(this.markCache[c]=kt.mark({class:c})))},s,i);return r.finish()}}const gue=ou.high(Vr.fromClass(pue,{decorations:t=>t.decorations})),xue=Xp.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"}]),vue=Ze.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),e$=1e4,t$="()[]{}",n$=at.define({combine(t){return $o(t,{afterCursor:!0,brackets:t$,maxScanDistance:e$,renderMatch:wue})}}),yue=kt.mark({class:"cm-matchingBracket"}),bue=kt.mark({class:"cm-nonmatchingBracket"});function wue(t){let e=[],n=t.matched?yue:bue;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 Sue=Os.define({create(){return kt.none},update(t,e){if(!e.docChanged&&!e.selection)return t;let n=[],r=e.state.facet(n$);for(let s of e.state.selection.ranges){if(!s.empty)continue;let i=No(e.state,s.head,-1,r)||s.head>0&&No(e.state,s.head-1,1,r)||r.afterCursor&&(No(e.state,s.head,1,r)||s.head<e.state.doc.length&&No(e.state,s.head+1,-1,r));i&&(n=n.concat(r.renderMatch(i,e.state)))}return kt.set(n,!0)},provide:t=>Ze.decorations.from(t)}),kue=[Sue,vue];function Oue(t={}){return[n$.of(t),kue]}const jue=new sn;function iO(t,e,n){let r=t.prop(e<0?sn.openedBy:sn.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 aO(t){let e=t.type.prop(jue);return e?e(t.node):t}function No(t,e,n,r={}){let s=r.maxScanDistance||e$,i=r.brackets||t$,a=Ss(t),l=a.resolveInner(e,n);for(let c=l;c;c=c.parent){let d=iO(c.type,n,i);if(d&&c.from<c.to){let h=aO(c);if(h&&(n>0?e>=h.from&&e<h.to:e>h.from&&e<=h.to))return Nue(t,e,n,c,h,d,i)}}return Cue(t,e,n,a,l.type,s,i)}function Nue(t,e,n,r,s,i,a){let l=r.parent,c={from:s.from,to:s.to},d=0,h=l?.cursor();if(h&&(n<0?h.childBefore(r.from):h.childAfter(r.to)))do if(n<0?h.to<=r.from:h.from>=r.to){if(d==0&&i.indexOf(h.type.name)>-1&&h.from<h.to){let m=aO(h);return{start:c,end:m?{from:m.from,to:m.to}:void 0,matched:!0}}else if(iO(h.type,n,a))d++;else if(iO(h.type,-n,a)){if(d==0){let m=aO(h);return{start:c,end:m&&m.from<m.to?{from:m.from,to:m.to}:void 0,matched:!1}}d--}}while(n<0?h.prevSibling():h.nextSibling());return{start:c,matched:!1}}function Cue(t,e,n,r,s,i,a){let l=n<0?t.sliceDoc(e-1,e):t.sliceDoc(e,e+1),c=a.indexOf(l);if(c<0||c%2==0!=n>0)return null;let d={from:n<0?e-1:e,to:n>0?e+1:e},h=t.doc.iterRange(e,n>0?t.doc.length:0),m=0;for(let g=0;!h.next().done&&g<=i;){let x=h.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:d,end:{from:y+w,to:y+w+1},matched:k>>1==c>>1};m--}}n>0&&(g+=x.length)}return h.done?{start:d,matched:!1}:null}function b_(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<e;a++)t.charCodeAt(a)==9?i+=n-i%n:i++;return i}class r${constructor(e,n,r,s){this.string=e,this.tabSize=n,this.indentUnit=r,this.overrideIndent=s,this.pos=0,this.start=0,this.lastColumnPos=0,this.lastColumnValue=0}eol(){return this.pos>=this.string.length}sol(){return this.pos==0}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)}eat(e){let n=this.string.charAt(this.pos),r;if(typeof e=="string"?r=n==e:r=n&&(e instanceof RegExp?e.test(n):e(n)),r)return++this.pos,n}eatWhile(e){let n=this.pos;for(;this.eat(e););return this.pos>n}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.lastColumnPos<this.start&&(this.lastColumnValue=b_(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue}indentation(){var e;return(e=this.overrideIndent)!==null&&e!==void 0?e:b_(this.string,null,this.tabSize)}match(e,n,r){if(typeof e=="string"){let s=a=>r?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 Tue(t){return{name:t.name||"",token:t.token,blankLine:t.blankLine||(()=>{}),startState:t.startState||(()=>!0),copyState:t.copyState||Eue,indent:t.indent||(()=>null),languageData:t.languageData||{},tokenTable:t.tokenTable||k6,mergeTokens:t.mergeTokens!==!1}}function Eue(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 w_=new WeakMap;class w6 extends va{constructor(e){let n=Bq(e.languageData),r=Tue(e),s,i=new class extends g6{createParse(a,l,c){return new Aue(s,a,l,c)}};super(n,i,[],e.name),this.topNode=Due(n,this),s=this,this.streamParser=r,this.stateAfter=new sn({perNode:!0}),this.tokenTable=e.tokenTable?new o$(r.tokenTable):Rue}static define(e){return new w6(e)}getIndent(e){let n,{overrideIndentation:r}=e.options;r&&(n=w_.get(e.state),n!=null&&n<e.pos-1e4&&(n=void 0));let s=S6(this,e.node.tree,e.node.from,e.node.from,n??e.pos),i,a;if(s?(a=s.state,i=s.pos+1):(a=this.streamParser.startState(e.unit),i=e.node.from),e.pos-i>1e4)return null;for(;i<e.pos;){let c=e.state.doc.lineAt(i),d=Math.min(e.pos,c.to);if(c.length){let h=r?r(c.from):-1,m=new r$(c.text,e.state.tabSize,e.unit,h<0?void 0:h);for(;m.pos<d-c.from;)i$(this.streamParser.token,m,a)}else this.streamParser.blankLine(a,e.unit);if(d==e.pos)break;i=c.to+1}let l=e.lineAt(e.pos);return r&&n==null&&w_.set(e.state,l.from),this.streamParser.indent(a,/^\s*(.*)/.exec(l.text)[1],e)}get allowsNesting(){return!1}}function S6(t,e,n,r,s){let i=n>=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 l=e.children[a],c=n+e.positions[a],d=l instanceof ar&&c<s&&S6(t,l,c,r,s);if(d)return d}return null}function s$(t,e,n,r,s){if(s&&n<=0&&r>=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],l=e.children[i],c;if(a<r&&l instanceof ar){if(!(c=s$(t,l,n-a,r-a,s)))break;return s?new ar(e.type,e.children.slice(0,i).concat(c),e.positions.slice(0,i+1),a+c.length):c}}return null}function _ue(t,e,n,r,s){for(let i of e){let a=i.from+(i.openStart?25:0),l=i.to-(i.openEnd?25:0),c=a<=n&&l>n&&S6(t,i.tree,0-i.offset,n,l),d;if(c&&c.pos<=r&&(d=s$(t,i.tree,n+i.offset,c.pos+i.offset,!1)))return{state:c.state,tree:d}}return{state:t.streamParser.startState(s?ld(s):4),tree:ar.empty}}let Aue=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=rf.get(),a=s[0].from,{state:l,tree:c}=_ue(e,r,a,this.to,i?.state);this.state=l,this.parsedPos=this.chunkStart=a+c.length;for(let d=0;d<c.children.length;d++)this.chunks.push(c.children[d]),this.chunkPos.push(c.positions[d]);i&&this.parsedPos<i.viewport.from-1e5&&s.some(d=>d.from<=i.viewport.from&&d.to>=i.viewport.from)&&(this.state=this.lang.streamParser.startState(ld(i.state)),i.skipUntilInView(this.parsedPos,i.viewport.from),this.parsedPos=i.viewport.from),this.moveRangeIndex()}advance(){let e=rf.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<r;)this.parseLine(e);return this.chunkStart<this.parsedPos&&this.finishChunk(),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,l=this.lineAfter(a);n+=l,r=a+l.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].to<this.parsedPos;)this.rangeIndex++}emitToken(e,n,r,s){let i=4;if(this.ranges.length>1){s=this.skipGapsTo(n,s,1),n+=s;let l=this.chunk.length;s=this.skipGapsTo(r,s,-1),r+=s,i+=this.chunk.length-l}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 r$(n,e?e.state.tabSize:4,e?ld(e.state):2);if(a.eol())i.blankLine(this.state,a.indentUnit);else for(;!a.eol();){let l=i$(i.token,a,this.state);if(l&&(s=this.emitToken(this.lang.tokenTable.resolve(l),this.parsedPos+a.start,this.parsedPos+a.pos,s)),a.start>1e4)break}this.parsedPos=r,this.moveRangeIndex(),this.parsedPos<this.to&&this.parsedPos++}finishChunk(){let e=ar.build({buffer:this.chunk,start:this.chunkStart,length:this.parsedPos-this.chunkStart,nodeSet:Mue,topID:0,maxBufferLength:512,reused:this.chunkReused});e=new ar(e.type,e.children,e.positions,e.length,[[this.lang.stateAfter,this.lang.streamParser.copyState(this.state)]]),this.chunks.push(e),this.chunkPos.push(this.chunkStart-this.ranges[0].from),this.chunk=[],this.chunkReused=void 0,this.chunkStart=this.parsedPos}finish(){return new ar(this.lang.topNode,this.chunks,this.chunkPos,this.parsedPos-this.ranges[0].from).balance()}};function i$(t,e,n){e.start=e.pos;for(let r=0;r<10;r++){let s=t(e,n);if(e.pos>e.start)return s}throw new Error("Stream parser failed to advance stream.")}const k6=Object.create(null),K0=[si.none],Mue=new hb(K0),S_=[],k_=Object.create(null),a$=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"]])a$[t]=l$(k6,e);class o${constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),a$)}resolve(e){return e?this.table[e]||(this.table[e]=l$(this.extra,e)):0}}const Rue=new o$(k6);function Z4(t,e){S_.indexOf(t)>-1||(S_.push(t),console.warn(e))}function l$(t,e){let n=[];for(let l of e.split(" ")){let c=[];for(let d of l.split(".")){let h=t[d]||ve[d];h?typeof h=="function"?c.length?c=c.map(h):Z4(d,`Modifier ${d} used at start of tag`):c.length?Z4(d,`Tag ${d} used as modifier`):c=Array.isArray(h)?h:[h]:Z4(d,`Unknown highlighting tag ${d}`)}for(let d of c)n.push(d)}if(!n.length)return 0;let r=e.replace(/ /g,"_"),s=r+" "+n.map(l=>l.id),i=k_[s];if(i)return i.id;let a=k_[s]=si.define({id:K0.length,name:r,props:[x6({[r]:n})]});return K0.push(a),a.id}function Due(t,e){let n=si.define({id:K0.length,name:"Document",props:[Qu.add(()=>t),mb.add(()=>r=>e.getIndent(r))],top:!0});return K0.push(n),n}gr.RTL,gr.LTR;const Pue=t=>{let{state:e}=t,n=e.doc.lineAt(e.selection.main.from),r=j6(t.state,n.from);return r.line?zue(t):r.block?Lue(t):!1};function O6(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 zue=O6(que,0),Iue=O6(c$,0),Lue=O6((t,e)=>c$(t,e,Fue(e)),0);function j6(t,e){let n=t.languageDataAt("commentTokens",e,1);return n.length?n[0]:{}}const Hm=50;function Bue(t,{open:e,close:n},r,s){let i=t.sliceDoc(r-Hm,r),a=t.sliceDoc(s,s+Hm),l=/\s*$/.exec(i)[0].length,c=/^\s*/.exec(a)[0].length,d=i.length-l;if(i.slice(d-e.length,d)==e&&a.slice(c,c+n.length)==n)return{open:{pos:r-l,margin:l&&1},close:{pos:s+c,margin:c&&1}};let h,m;s-r<=2*Hm?h=m=t.sliceDoc(r,s):(h=t.sliceDoc(r,r+Hm),m=t.sliceDoc(s-Hm,s));let g=/^\s*/.exec(h)[0].length,x=/\s*$/.exec(m)[0].length,y=m.length-x-n.length;return h.slice(g,g+e.length)==e&&m.slice(y,y+n.length)==n?{open:{pos:r+g+e.length,margin:/\s/.test(h.charAt(g+e.length))?1:0},close:{pos:s-x-n.length,margin:/\s/.test(m.charAt(y-1))?1:0}}:null}function Fue(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 c$(t,e,n=e.selection.ranges){let r=n.map(i=>j6(e,i.from).block);if(!r.every(i=>i))return null;let s=n.map((i,a)=>Bue(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,l;a<s.length;a++)if(l=s[a]){let c=r[a],{open:d,close:h}=l;i.push({from:d.pos-c.open.length,to:d.pos+d.margin},{from:h.pos-h.margin,to:h.pos+c.close.length})}return{changes:i}}return null}function que(t,e,n=e.selection.ranges){let r=[],s=-1;for(let{from:i,to:a}of n){let l=r.length,c=1e9,d=j6(e,i).line;if(d){for(let h=i;h<=a;){let m=e.doc.lineAt(h);if(m.from>s&&(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+d.length)==d?g:-1;g<m.text.length&&g<c&&(c=g),r.push({line:m,comment:y,token:d,indent:g,empty:x,single:!1})}h=m.to+1}if(c<1e9)for(let h=l;h<r.length;h++)r[h].indent<r[h].line.text.length&&(r[h].indent=c);r.length==l+1&&(r[l].single=!0)}}if(t!=2&&r.some(i=>i.comment<0&&(!i.empty||i.single))){let i=[];for(let{line:l,token:c,indent:d,empty:h,single:m}of r)(m||!h)&&i.push({from:l.from+d,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:l,token:c}of r)if(l>=0){let d=a.from+l,h=d+c.length;a.text[h-a.from]==" "&&h++,i.push({from:d,to:h})}return{changes:i}}return null}const oO=qo.define(),$ue=qo.define(),Hue=at.define(),u$=at.define({combine(t){return $o(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)})}}),d$=Os.define({create(){return Co.empty},update(t,e){let n=e.state.facet(u$),r=e.annotation(oO);if(r){let c=yi.fromTransaction(e,r.selection),d=r.side,h=d==0?t.undone:t.done;return c?h=ey(h,h.length,n.minDepth,c):h=m$(h,e.startState.selection),new Co(d==0?r.rest:h,d==0?h:r.rest)}let s=e.annotation($ue);if((s=="full"||s=="before")&&(t=t.isolate()),e.annotation(ns.addToHistory)===!1)return e.changes.empty?t:t.addMapping(e.changes.desc);let i=yi.fromTransaction(e),a=e.annotation(ns.time),l=e.annotation(ns.userEvent);return i?t=t.addChanges(i,a,l,n,e):e.selection&&(t=t.addSelection(e.startState.selection,a,l,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 Co(t.done.map(yi.fromJSON),t.undone.map(yi.fromJSON))}});function Que(t={}){return[d$,u$.of(t),Ze.domEventHandlers({beforeinput(e,n){let r=e.inputType=="historyUndo"?h$:e.inputType=="historyRedo"?lO:null;return r?(e.preventDefault(),r(n)):!1}})]}function gb(t,e){return function({state:n,dispatch:r}){if(!e&&n.readOnly)return!1;let s=n.field(d$,!1);if(!s)return!1;let i=s.pop(t,n,e);return i?(r(i),!0):!1}}const h$=gb(0,!1),lO=gb(1,!1),Vue=gb(0,!0),Uue=gb(1,!0);class yi{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 yi(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 yi(e.changes&&us.fromJSON(e.changes),[],e.mapped&&Do.fromJSON(e.mapped),e.startSelection&&Me.fromJSON(e.startSelection),e.selectionsAfter.map(Me.fromJSON))}static fromTransaction(e,n){let r=ya;for(let s of e.startState.facet(Hue)){let i=s(e);i.length&&(r=r.concat(i))}return!r.length&&e.changes.empty?null:new yi(e.changes.invert(e.startState.doc),r,void 0,n||e.startState.selection,ya)}static selection(e){return new yi(void 0,ya,void 0,void 0,e)}}function ey(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 Wue(t,e){let n=[],r=!1;return t.iterChangedRanges((s,i)=>n.push(s,i)),e.iterChangedRanges((s,i,a,l)=>{for(let c=0;c<n.length;){let d=n[c++],h=n[c++];l>=d&&a<=h&&(r=!0)}}),r}function Gue(t,e){return t.ranges.length==e.ranges.length&&t.ranges.filter((n,r)=>n.empty!=e.ranges[r].empty).length===0}function f$(t,e){return t.length?e.length?t.concat(e):t:e}const ya=[],Xue=200;function m$(t,e){if(t.length){let n=t[t.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-Xue));return r.length&&r[r.length-1].eq(e)?t:(r.push(e),ey(t,t.length-1,1e9,n.setSelAfter(r)))}else return[yi.selection([e])]}function Yue(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 J4(t,e){if(!t.length)return t;let n=t.length,r=ya;for(;n;){let s=Kue(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?[yi.selection(r)]:ya}function Kue(t,e,n){let r=f$(t.selectionsAfter.length?t.selectionsAfter.map(l=>l.map(e)):ya,n);if(!t.changes)return yi.selection(r);let s=t.changes.map(e),i=e.mapDesc(t.changes,!0),a=t.mapped?t.mapped.composeDesc(i):i;return new yi(s,Ft.mapEffects(t.effects,e),a,t.startSelection.map(i),r)}const Zue=/^(input\.type|delete)($|\.)/;class Co{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 Co(this.done,this.undone):this}addChanges(e,n,r,s,i){let a=this.done,l=a[a.length-1];return l&&l.changes&&!l.changes.empty&&e.changes&&(!r||Zue.test(r))&&(!l.selectionsAfter.length&&n-this.prevTime<s.newGroupDelay&&s.joinToEvent(i,Wue(l.changes,e.changes))||r=="input.type.compose")?a=ey(a,a.length-1,s.minDepth,new yi(e.changes.compose(l.changes),f$(Ft.mapEffects(e.effects,l.changes),l.effects),l.mapped,l.startSelection,ya)):a=ey(a,a.length,s.minDepth,e),new Co(a,ya,n,r)}addSelection(e,n,r,s){let i=this.done.length?this.done[this.done.length-1].selectionsAfter:ya;return i.length>0&&n-this.prevTime<s&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&Gue(i[i.length-1],e)?this:new Co(m$(this.done,e),this.undone,n,r)}addMapping(e){return new Co(J4(this.done,e),J4(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,n,r){let s=e==0?this.done:this.undone;if(s.length==0)return null;let i=s[s.length-1],a=i.selectionsAfter[0]||n.selection;if(r&&i.selectionsAfter.length)return n.update({selection:i.selectionsAfter[i.selectionsAfter.length-1],annotations:oO.of({side:e,rest:Yue(s),selection:a}),userEvent:e==0?"select.undo":"select.redo",scrollIntoView:!0});if(i.changes){let l=s.length==1?ya:s.slice(0,s.length-1);return i.mapped&&(l=J4(l,i.mapped)),n.update({changes:i.changes,selection:i.startSelection,effects:i.effects,annotations:oO.of({side:e,rest:l,selection:a}),filter:!1,userEvent:e==0?"undo":"redo",scrollIntoView:!0})}else return null}}Co.empty=new Co(ya,ya);const Jue=[{key:"Mod-z",run:h$,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:lO,preventDefault:!0},{linux:"Ctrl-Shift-z",run:lO,preventDefault:!0},{key:"Mod-u",run:Vue,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:Uue,preventDefault:!0}];function Cf(t,e){return Me.create(t.ranges.map(e),t.mainIndex)}function to(t,e){return t.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function no({state:t,dispatch:e},n){let r=Cf(t.selection,n);return r.eq(t.selection,!0)?!1:(e(to(t,r)),!0)}function xb(t,e){return Me.cursor(e?t.to:t.from)}function p$(t,e){return no(t,n=>n.empty?t.moveByChar(n,e):xb(n,e))}function Us(t){return t.textDirectionAt(t.state.selection.main.head)==gr.LTR}const g$=t=>p$(t,!Us(t)),x$=t=>p$(t,Us(t));function v$(t,e){return no(t,n=>n.empty?t.moveByGroup(n,e):xb(n,e))}const ede=t=>v$(t,!Us(t)),tde=t=>v$(t,Us(t));function nde(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 vb(t,e,n){let r=Ss(t).resolveInner(e.head),s=n?sn.closedBy:sn.openedBy;for(let c=e.head;;){let d=n?r.childAfter(c):r.childBefore(c);if(!d)break;nde(t,d,s)?r=d:c=n?d.to:d.from}let i=r.type.prop(s),a,l;return i&&(a=n?No(t,r.from,1):No(t,r.to,-1))&&a.matched?l=n?a.end.to:a.end.from:l=n?r.to:r.from,Me.cursor(l,n?-1:1)}const rde=t=>no(t,e=>vb(t.state,e,!Us(t))),sde=t=>no(t,e=>vb(t.state,e,Us(t)));function y$(t,e){return no(t,n=>{if(!n.empty)return xb(n,e);let r=t.moveVertically(n,e);return r.head!=n.head?r:t.moveToLineBoundary(n,e)})}const b$=t=>y$(t,!1),w$=t=>y$(t,!0);function S$(t){let e=t.scrollDOM.clientHeight<t.scrollDOM.scrollHeight-2,n=0,r=0,s;if(e){for(let i of t.state.facet(Ze.scrollMargins)){let a=i(t);a?.top&&(n=Math.max(a?.top,n)),a?.bottom&&(r=Math.max(a?.bottom,r))}s=t.scrollDOM.clientHeight-n-r}else s=(t.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:r,selfScroll:e,height:Math.max(t.defaultLineHeight,s-5)}}function k$(t,e){let n=S$(t),{state:r}=t,s=Cf(r.selection,a=>a.empty?t.moveVertically(a,e,n.height):xb(a,e));if(s.eq(r.selection))return!1;let i;if(n.selfScroll){let a=t.coordsAtPos(r.selection.main.head),l=t.scrollDOM.getBoundingClientRect(),c=l.top+n.marginTop,d=l.bottom-n.marginBottom;a&&a.top>c&&a.bottom<d&&(i=Ze.scrollIntoView(s.main.head,{y:"start",yMargin:a.top-c}))}return t.dispatch(to(r,s),{effects:i}),!0}const O_=t=>k$(t,!1),cO=t=>k$(t,!0);function lu(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=Me.cursor(r.from+i))}return s}const ide=t=>no(t,e=>lu(t,e,!0)),ade=t=>no(t,e=>lu(t,e,!1)),ode=t=>no(t,e=>lu(t,e,!Us(t))),lde=t=>no(t,e=>lu(t,e,Us(t))),cde=t=>no(t,e=>Me.cursor(t.lineBlockAt(e.head).from,1)),ude=t=>no(t,e=>Me.cursor(t.lineBlockAt(e.head).to,-1));function dde(t,e,n){let r=!1,s=Cf(t.selection,i=>{let a=No(t,i.head,-1)||No(t,i.head,1)||i.head>0&&No(t,i.head-1,1)||i.head<t.doc.length&&No(t,i.head+1,-1);if(!a||!a.end)return i;r=!0;let l=a.start.from==i.head?a.end.to:a.end.from;return Me.cursor(l)});return r?(e(to(t,s)),!0):!1}const hde=({state:t,dispatch:e})=>dde(t,e);function Pa(t,e){let n=Cf(t.state.selection,r=>{let s=e(r);return Me.range(r.anchor,s.head,s.goalColumn,s.bidiLevel||void 0)});return n.eq(t.state.selection)?!1:(t.dispatch(to(t.state,n)),!0)}function O$(t,e){return Pa(t,n=>t.moveByChar(n,e))}const j$=t=>O$(t,!Us(t)),N$=t=>O$(t,Us(t));function C$(t,e){return Pa(t,n=>t.moveByGroup(n,e))}const fde=t=>C$(t,!Us(t)),mde=t=>C$(t,Us(t)),pde=t=>Pa(t,e=>vb(t.state,e,!Us(t))),gde=t=>Pa(t,e=>vb(t.state,e,Us(t)));function T$(t,e){return Pa(t,n=>t.moveVertically(n,e))}const E$=t=>T$(t,!1),_$=t=>T$(t,!0);function A$(t,e){return Pa(t,n=>t.moveVertically(n,e,S$(t).height))}const j_=t=>A$(t,!1),N_=t=>A$(t,!0),xde=t=>Pa(t,e=>lu(t,e,!0)),vde=t=>Pa(t,e=>lu(t,e,!1)),yde=t=>Pa(t,e=>lu(t,e,!Us(t))),bde=t=>Pa(t,e=>lu(t,e,Us(t))),wde=t=>Pa(t,e=>Me.cursor(t.lineBlockAt(e.head).from)),Sde=t=>Pa(t,e=>Me.cursor(t.lineBlockAt(e.head).to)),C_=({state:t,dispatch:e})=>(e(to(t,{anchor:0})),!0),T_=({state:t,dispatch:e})=>(e(to(t,{anchor:t.doc.length})),!0),E_=({state:t,dispatch:e})=>(e(to(t,{anchor:t.selection.main.anchor,head:0})),!0),__=({state:t,dispatch:e})=>(e(to(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0),kde=({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0),Ode=({state:t,dispatch:e})=>{let n=yb(t).map(({from:r,to:s})=>Me.range(r,Math.min(s+1,t.doc.length)));return e(t.update({selection:Me.create(n),userEvent:"select"})),!0},jde=({state:t,dispatch:e})=>{let n=Cf(t.selection,r=>{let s=Ss(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:l}=a;if((l.from<r.from&&l.to>=r.to||l.to>r.to&&l.from<=r.from)&&a.next)return Me.range(l.to,l.from)}return r});return n.eq(t.selection)?!1:(e(to(t,n)),!0)};function M$(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.to<t.state.doc.length:a.from>0)for(let l=i;;){let c=t.moveVertically(l,e);if(c.head<a.from||c.head>a.to){s.some(d=>d.head==c.head)||s.push(c);break}else{if(c.head==l.head)break;l=c}}}return s.length==r.ranges.length?!1:(t.dispatch(to(n,Me.create(s,s.length-1))),!0)}const Nde=t=>M$(t,!1),Cde=t=>M$(t,!0),Tde=({state:t,dispatch:e})=>{let n=t.selection,r=null;return n.ranges.length>1?r=Me.create([n.main]):n.main.empty||(r=Me.create([Me.cursor(n.main.head)])),r?(e(to(t,r)),!0):!1};function Yp(t,e){if(t.state.readOnly)return!1;let n="delete.selection",{state:r}=t,s=r.changeByRange(i=>{let{from:a,to:l}=i;if(a==l){let c=e(i);c<a?(n="delete.backward",c=x1(t,c,!1)):c>a&&(n="delete.forward",c=x1(t,c,!0)),a=Math.min(a,c),l=Math.max(l,c)}else a=x1(t,a,!1),l=x1(t,l,!0);return a==l?{range:i}:{changes:{from:a,to:l},range:Me.cursor(a,a<i.head?-1:1)}});return s.changes.empty?!1:(t.dispatch(r.update(s,{scrollIntoView:!0,userEvent:n,effects:n=="delete.selection"?Ze.announce.of(r.phrase("Selection deleted")):void 0})),!0)}function x1(t,e,n){if(t instanceof Ze)for(let r of t.state.facet(Ze.atomicRanges).map(s=>s(t)))r.between(e,e,(s,i)=>{s<e&&i>e&&(e=n?i:s)});return e}const R$=(t,e,n)=>Yp(t,r=>{let s=r.from,{state:i}=t,a=i.doc.lineAt(s),l,c;if(n&&!e&&s>a.from&&s<a.from+200&&!/[^ \t]/.test(l=a.text.slice(0,s-a.from))){if(l[l.length-1]==" ")return s-1;let d=Nf(l,i.tabSize),h=d%ld(i)||ld(i);for(let m=0;m<h&&l[l.length-1-m]==" ";m++)s--;c=s}else c=zs(a.text,s-a.from,e,e)+a.from,c==s&&a.number!=(e?i.doc.lines:1)?c+=e?1:-1:!e&&/[\ufe00-\ufe0f]/.test(a.text.slice(c-a.from,s-a.from))&&(c=zs(a.text,c-a.from,!1,!1)+a.from);return c}),uO=t=>R$(t,!1,!0),D$=t=>R$(t,!0,!1),P$=(t,e)=>Yp(t,n=>{let r=n.head,{state:s}=t,i=s.doc.lineAt(r),a=s.charCategorizer(r);for(let l=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=zs(i.text,r-i.from,e)+i.from,d=i.text.slice(Math.min(r,c)-i.from,Math.max(r,c)-i.from),h=a(d);if(l!=null&&h!=l)break;(d!=" "||r!=n.head)&&(l=h),r=c}return r}),z$=t=>P$(t,!1),Ede=t=>P$(t,!0),_de=t=>Yp(t,e=>{let n=t.lineBlockAt(e.head).to;return e.head<n?n:Math.min(t.state.doc.length,e.head+1)}),Ade=t=>Yp(t,e=>{let n=t.moveToLineBoundary(e,!1).head;return e.head>n?n:Math.max(0,e.head-1)}),Mde=t=>Yp(t,e=>{let n=t.moveToLineBoundary(e,!0).head;return e.head<n?n:Math.min(t.state.doc.length,e.head+1)}),Rde=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=t.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:jn.of(["",""])},range:Me.cursor(r.from)}));return e(t.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},Dde=({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:zs(i.text,s-i.from,!1)+i.from,l=s==i.to?s+1:zs(i.text,s-i.from,!0)+i.from;return{changes:{from:a,to:l,insert:t.doc.slice(s,l).append(t.doc.slice(a,s))},range:Me.cursor(l)}});return n.changes.empty?!1:(e(t.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function yb(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 I$(t,e,n){if(t.readOnly)return!1;let r=[],s=[];for(let i of yb(t)){if(n?i.to==t.doc.length:i.from==0)continue;let a=t.doc.lineAt(n?i.to+1:i.from-1),l=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(Me.range(Math.min(t.doc.length,c.anchor+l),Math.min(t.doc.length,c.head+l)))}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(Me.range(c.anchor-l,c.head-l))}}return r.length?(e(t.update({changes:r,scrollIntoView:!0,selection:Me.create(s,t.selection.mainIndex),userEvent:"move.line"})),!0):!1}const Pde=({state:t,dispatch:e})=>I$(t,e,!1),zde=({state:t,dispatch:e})=>I$(t,e,!0);function L$(t,e,n){if(t.readOnly)return!1;let r=[];for(let s of yb(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 Ide=({state:t,dispatch:e})=>L$(t,e,!1),Lde=({state:t,dispatch:e})=>L$(t,e,!0),Bde=t=>{if(t.state.readOnly)return!1;let{state:e}=t,n=e.changes(yb(e).map(({from:s,to:i})=>(s>0?s--:i<e.doc.length&&i++,{from:s,to:i}))),r=Cf(e.selection,s=>{let i;if(t.lineWrapping){let a=t.lineBlockAt(s.head),l=t.coordsAtPos(s.head,s.assoc||1);l&&(i=a.bottom+t.documentTop-l.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 Fde(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let n=Ss(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(sn.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 A_=B$(!1),qde=B$(!0);function B$(t){return({state:e,dispatch:n})=>{if(e.readOnly)return!1;let r=e.changeByRange(s=>{let{from:i,to:a}=s,l=e.doc.lineAt(i),c=!t&&i==a&&Fde(e,i);t&&(i=a=(a<=l.to?l:e.doc.lineAt(a)).to);let d=new fb(e,{simulateBreak:i,simulateDoubleBreak:!!c}),h=v6(d,i);for(h==null&&(h=Nf(/^\s*/.exec(e.doc.lineAt(i).text)[0],e.tabSize));a<l.to&&/\s/.test(l.text[a-l.from]);)a++;c?{from:i,to:a}=c:i>l.from&&i<l.from+100&&!/\S/.test(l.text.slice(0,i))&&(i=l.from);let m=["",Y0(e,h)];return c&&m.push(Y0(e,d.lineIndent(l.from,-1))),{changes:{from:i,to:a,insert:jn.of(m)},range:Me.cursor(i+1+m[1].length)}});return n(e.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}function N6(t,e){let n=-1;return t.changeByRange(r=>{let s=[];for(let a=r.from;a<=r.to;){let l=t.doc.lineAt(a);l.number>n&&(r.empty||r.to>l.from)&&(e(l,s,r),n=l.number),a=l.to+1}let i=t.changes(s);return{changes:s,range:Me.range(i.mapPos(r.anchor,1),i.mapPos(r.head,1))}})}const $de=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=Object.create(null),r=new fb(t,{overrideIndentation:i=>{let a=n[i];return a??-1}}),s=N6(t,(i,a,l)=>{let c=v6(r,i.from);if(c==null)return;/\S/.test(i.text)||(c=0);let d=/^\s*/.exec(i.text)[0],h=Y0(t,c);(d!=h||l.from<i.from+d.length)&&(n[i.from]=c,a.push({from:i.from,to:i.from+d.length,insert:h}))});return s.changes.empty||e(t.update(s,{userEvent:"indent"})),!0},F$=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(N6(t,(n,r)=>{r.push({from:n.from,insert:t.facet(Wp)})}),{userEvent:"input.indent"})),!0),q$=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(N6(t,(n,r)=>{let s=/^\s*/.exec(n.text)[0];if(!s)return;let i=Nf(s,t.tabSize),a=0,l=Y0(t,Math.max(0,i-ld(t)));for(;a<s.length&&a<l.length&&s.charCodeAt(a)==l.charCodeAt(a);)a++;r.push({from:n.from+a,to:n.from+s.length,insert:l.slice(a)})}),{userEvent:"delete.dedent"})),!0),Hde=t=>(t.setTabFocusMode(),!0),Qde=[{key:"Ctrl-b",run:g$,shift:j$,preventDefault:!0},{key:"Ctrl-f",run:x$,shift:N$},{key:"Ctrl-p",run:b$,shift:E$},{key:"Ctrl-n",run:w$,shift:_$},{key:"Ctrl-a",run:cde,shift:wde},{key:"Ctrl-e",run:ude,shift:Sde},{key:"Ctrl-d",run:D$},{key:"Ctrl-h",run:uO},{key:"Ctrl-k",run:_de},{key:"Ctrl-Alt-h",run:z$},{key:"Ctrl-o",run:Rde},{key:"Ctrl-t",run:Dde},{key:"Ctrl-v",run:cO}],Vde=[{key:"ArrowLeft",run:g$,shift:j$,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:ede,shift:fde,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:ode,shift:yde,preventDefault:!0},{key:"ArrowRight",run:x$,shift:N$,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:tde,shift:mde,preventDefault:!0},{mac:"Cmd-ArrowRight",run:lde,shift:bde,preventDefault:!0},{key:"ArrowUp",run:b$,shift:E$,preventDefault:!0},{mac:"Cmd-ArrowUp",run:C_,shift:E_},{mac:"Ctrl-ArrowUp",run:O_,shift:j_},{key:"ArrowDown",run:w$,shift:_$,preventDefault:!0},{mac:"Cmd-ArrowDown",run:T_,shift:__},{mac:"Ctrl-ArrowDown",run:cO,shift:N_},{key:"PageUp",run:O_,shift:j_},{key:"PageDown",run:cO,shift:N_},{key:"Home",run:ade,shift:vde,preventDefault:!0},{key:"Mod-Home",run:C_,shift:E_},{key:"End",run:ide,shift:xde,preventDefault:!0},{key:"Mod-End",run:T_,shift:__},{key:"Enter",run:A_,shift:A_},{key:"Mod-a",run:kde},{key:"Backspace",run:uO,shift:uO,preventDefault:!0},{key:"Delete",run:D$,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:z$,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:Ede,preventDefault:!0},{mac:"Mod-Backspace",run:Ade,preventDefault:!0},{mac:"Mod-Delete",run:Mde,preventDefault:!0}].concat(Qde.map(t=>({mac:t.key,run:t.run,shift:t.shift}))),Ude=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:rde,shift:pde},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:sde,shift:gde},{key:"Alt-ArrowUp",run:Pde},{key:"Shift-Alt-ArrowUp",run:Ide},{key:"Alt-ArrowDown",run:zde},{key:"Shift-Alt-ArrowDown",run:Lde},{key:"Mod-Alt-ArrowUp",run:Nde},{key:"Mod-Alt-ArrowDown",run:Cde},{key:"Escape",run:Tde},{key:"Mod-Enter",run:qde},{key:"Alt-l",mac:"Ctrl-l",run:Ode},{key:"Mod-i",run:jde,preventDefault:!0},{key:"Mod-[",run:q$},{key:"Mod-]",run:F$},{key:"Mod-Alt-\\",run:$de},{key:"Shift-Mod-k",run:Bde},{key:"Shift-Mod-\\",run:hde},{key:"Mod-/",run:Pue},{key:"Alt-A",run:Iue},{key:"Ctrl-m",mac:"Shift-Alt-m",run:Hde}].concat(Vde),Wde={key:"Tab",run:F$,shift:q$},M_=typeof String.prototype.normalize=="function"?t=>t.normalize("NFKD"):t=>t;class af{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?l=>i(M_(l)):M_,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 gi(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=Zj(e),r=this.bufferStart+this.bufferPos;this.bufferPos+=wo(e);let s=this.normalize(n);if(s.length)for(let i=0,a=r;;i++){let l=s.charCodeAt(i),c=this.match(l,a,this.bufferPos+this.bufferStart);if(i==s.length-1){if(c)return this.value=c,this;break}a==r&&i<n.length&&n.charCodeAt(i)==l&&a++}}}match(e,n,r){let s=null;for(let i=0;i<this.matches.length;i+=2){let a=this.matches[i],l=!1;this.query.charCodeAt(a)==e&&(a==this.query.length-1?s={from:this.matches[i+1],to:r}:(this.matches[i]++,l=!0)),l||(this.matches.splice(i,2),i-=2)}return this.query.charCodeAt(0)==e&&(this.query.length==1?s={from:n,to:r}:this.matches.push(1,n)),s&&this.test&&!this.test(s.from,s.to,this.buffer,this.bufferStart)&&(s=null),s}}typeof Symbol<"u"&&(af.prototype[Symbol.iterator]=function(){return this});const $$={from:-1,to:-1,match:/.*/.exec("")},C6="gm"+(/x/.unicode==null?"":"u");class H${constructor(e,n,r,s=0,i=e.length){if(this.text=e,this.to=i,this.curLine="",this.done=!1,this.value=$$,/\\[sWDnr]|\n|\r|\[\^/.test(n))return new Q$(e,n,r,s,i);this.re=new RegExp(n,C6+(r?.ignoreCase?"i":"")),this.test=r?.test,this.iter=e.iter();let a=e.lineAt(s);this.curLineStart=a.from,this.matchPos=ty(e,s),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.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=ty(this.text,s+(r==s?1:0)),r==this.curLineStart+this.curLine.length&&this.nextLine(),(r<s||r>this.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<this.to)this.nextLine(),e=0;else return this.done=!0,this}}}const eS=new WeakMap;class Ih{constructor(e,n){this.from=e,this.text=n}get to(){return this.from+this.text.length}static get(e,n,r){let s=eS.get(e);if(!s||s.from>=r||s.to<=n){let l=new Ih(n,e.sliceString(n,r));return eS.set(e,l),l}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<r&&(i+=e.sliceString(s.to,r)),eS.set(e,new Ih(a,i)),new Ih(n,i.slice(n-a,r-a))}}class Q${constructor(e,n,r,s,i){this.text=e,this.to=i,this.done=!1,this.value=$$,this.matchPos=ty(e,s),this.re=new RegExp(n,C6+(r?.ignoreCase?"i":"")),this.test=r?.test,this.flat=Ih.get(e,s,this.chunkEnd(s+5e3))}chunkEnd(e){return e>=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=ty(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"&&(H$.prototype[Symbol.iterator]=Q$.prototype[Symbol.iterator]=function(){return this});function Gde(t){try{return new RegExp(t,C6),!0}catch{return!1}}function ty(t,e){if(e>=t.length)return e;let n=t.lineAt(e),r;for(;e<n.to&&(r=n.text.charCodeAt(e-n.from))>=56320&&r<57344;)e++;return e}function dO(t){let e=String(t.state.doc.lineAt(t.state.selection.main.head).number),n=sr("input",{class:"cm-textfield",name:"line",value:e}),r=sr("form",{class:"cm-gotoLine",onkeydown:i=>{i.keyCode==27?(i.preventDefault(),t.dispatch({effects:N0.of(!1)}),t.focus()):i.keyCode==13&&(i.preventDefault(),s())},onsubmit:i=>{i.preventDefault(),s()}},sr("label",t.state.phrase("Go to line"),": ",n)," ",sr("button",{class:"cm-button",type:"submit"},t.state.phrase("go")),sr("button",{name:"close",onclick:()=>{t.dispatch({effects:N0.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,l=a.doc.lineAt(a.selection.main.head),[,c,d,h,m]=i,g=h?+h.slice(1):0,x=d?+d:l.number;if(d&&m){let S=x/100;c&&(S=S*(c=="-"?-1:1)+l.number/a.doc.lines),x=Math.round(a.doc.lines*S)}else d&&c&&(x=x*(c=="-"?-1:1)+l.number);let y=a.doc.line(Math.max(1,Math.min(a.doc.lines,x))),w=Me.cursor(y.from+Math.max(0,Math.min(g,y.length)));t.dispatch({effects:[N0.of(!1),Ze.scrollIntoView(w.from,{y:"center"})],selection:w}),t.focus()}return{dom:r}}const N0=Ft.define(),R_=Os.define({create(){return!0},update(t,e){for(let n of e.effects)n.is(N0)&&(t=n.value);return t},provide:t=>U0.from(t,e=>e?dO:null)}),Xde=t=>{let e=V0(t,dO);if(!e){let n=[N0.of(!0)];t.state.field(R_,!1)==null&&n.push(Ft.appendConfig.of([R_,Yde])),t.dispatch({effects:n}),e=V0(t,dO)}return e&&e.dom.querySelector("input").select(),!0},Yde=Ze.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"}}}),Kde={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Zde=at.define({combine(t){return $o(t,Kde,{highlightWordAroundCursor:(e,n)=>e||n,minSelectionLength:Math.min,maxMatches:Math.min})}});function Jde(t){return[she,rhe]}const ehe=kt.mark({class:"cm-selectionMatch"}),the=kt.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function D_(t,e,n,r){return(n==0||t(e.sliceDoc(n-1,n))!=wr.Word)&&(r==e.doc.length||t(e.sliceDoc(r,r+1))!=wr.Word)}function nhe(t,e,n,r){return t(e.sliceDoc(n,n+1))==wr.Word&&t(e.sliceDoc(r-1,r))==wr.Word}const rhe=Vr.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(Zde),{state:n}=t,r=n.selection;if(r.ranges.length>1)return kt.none;let s=r.main,i,a=null;if(s.empty){if(!e.highlightWordAroundCursor)return kt.none;let c=n.wordAt(s.head);if(!c)return kt.none;a=n.charCategorizer(s.head),i=n.sliceDoc(c.from,c.to)}else{let c=s.to-s.from;if(c<e.minSelectionLength||c>200)return kt.none;if(e.wholeWords){if(i=n.sliceDoc(s.from,s.to),a=n.charCategorizer(s.head),!(D_(a,n,s.from,s.to)&&nhe(a,n,s.from,s.to)))return kt.none}else if(i=n.sliceDoc(s.from,s.to),!i)return kt.none}let l=[];for(let c of t.visibleRanges){let d=new af(n.doc,i,c.from,c.to);for(;!d.next().done;){let{from:h,to:m}=d.value;if((!a||D_(a,n,h,m))&&(s.empty&&h<=s.from&&m>=s.to?l.push(the.range(h,m)):(h>=s.to||m<=s.from)&&l.push(ehe.range(h,m)),l.length>e.maxMatches))return kt.none}}return kt.set(l)}},{decorations:t=>t.decorations}),she=Ze.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),ihe=({state:t,dispatch:e})=>{let{selection:n}=t,r=Me.create(n.ranges.map(s=>t.wordAt(s.head)||Me.cursor(s.head)),n.mainIndex);return r.eq(n)?!1:(e(t.update({selection:r})),!0)};function ahe(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,l=new af(t.doc,e,r[r.length-1].to);;)if(l.next(),l.done){if(a)return null;l=new af(t.doc,e,0,Math.max(0,r[r.length-1].from-1)),a=!0}else{if(a&&r.some(c=>c.from==l.value.from))continue;if(i){let c=t.wordAt(l.value.from);if(!c||c.from!=l.value.from||c.to!=l.value.to)continue}return l.value}}const ohe=({state:t,dispatch:e})=>{let{ranges:n}=t.selection;if(n.some(i=>i.from===i.to))return ihe({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=ahe(t,r);return s?(e(t.update({selection:t.selection.addRange(Me.range(s.from,s.to),!1),effects:Ze.scrollIntoView(s.to)})),!0):!1},Tf=at.define({combine(t){return $o(t,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new yhe(e),scrollToMatch:e=>Ze.scrollIntoView(e)})}});class V${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||Gde(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 dhe(this):new che(this)}getCursor(e,n=0,r){let s=e.doc?e:wn.create({doc:e});return r==null&&(r=s.doc.length),this.regexp?bh(this,s,n,r):yh(this,s,n,r)}}class U${constructor(e){this.spec=e}}function yh(t,e,n,r){return new af(e.doc,t.unquoted,n,r,t.caseSensitive?void 0:s=>s.toLowerCase(),t.wholeWord?lhe(e.doc,e.charCategorizer(e.selection.main.head)):void 0)}function lhe(t,e){return(n,r,s,i)=>((i>n||i+s.length<r)&&(i=Math.max(0,n-2),s=t.sliceString(i,Math.min(t.length,r+2))),(e(ny(s,n-i))!=wr.Word||e(ry(s,n-i))!=wr.Word)&&(e(ry(s,r-i))!=wr.Word||e(ny(s,r-i))!=wr.Word))}class che extends U${constructor(e){super(e)}nextMatch(e,n,r){let s=yh(this.spec,e,r,e.doc.length).nextOverlapping();if(s.done){let i=Math.min(e.doc.length,n+this.spec.unquoted.length);s=yh(this.spec,e,0,i).nextOverlapping()}return s.done||s.value.from==n&&s.value.to==r?null:s.value}prevMatchInRange(e,n,r){for(let s=r;;){let i=Math.max(n,s-1e4-this.spec.unquoted.length),a=yh(this.spec,e,i,s),l=null;for(;!a.nextOverlapping().done;)l=a.value;if(l)return l;if(i==n)return null;s-=1e4}}prevMatch(e,n,r){let s=this.prevMatchInRange(e,0,n);return s||(s=this.prevMatchInRange(e,Math.max(0,r-this.spec.unquoted.length),e.doc.length)),s&&(s.from!=n||s.to!=r)?s:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,n){let r=yh(this.spec,e,0,e.doc.length),s=[];for(;!r.next().done;){if(s.length>=n)return null;s.push(r.value)}return s}highlight(e,n,r,s){let i=yh(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 bh(t,e,n,r){return new H$(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:t.wholeWord?uhe(e.charCategorizer(e.selection.main.head)):void 0},n,r)}function ny(t,e){return t.slice(zs(t,e,!1),e)}function ry(t,e){return t.slice(e,zs(t,e))}function uhe(t){return(e,n,r)=>!r[0].length||(t(ny(r.input,r.index))!=wr.Word||t(ry(r.input,r.index))!=wr.Word)&&(t(ry(r.input,r.index+r[0].length))!=wr.Word||t(ny(r.input,r.index+r[0].length))!=wr.Word)}class dhe extends U${nextMatch(e,n,r){let s=bh(this.spec,e,r,e.doc.length).next();return s.done&&(s=bh(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=bh(this.spec,e,i,r),l=null;for(;!a.next().done;)l=a.value;if(l&&(i==n||l.from>i+10))return l;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<e.match.length)return e.match[i]+r.slice(s)}return n})}matchAll(e,n){let r=bh(this.spec,e,0,e.doc.length),s=[];for(;!r.next().done;){if(s.length>=n)return null;s.push(r.value)}return s}highlight(e,n,r,s){let i=bh(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 Z0=Ft.define(),T6=Ft.define(),$c=Os.define({create(t){return new tS(hO(t).create(),null)},update(t,e){for(let n of e.effects)n.is(Z0)?t=new tS(n.value.create(),t.panel):n.is(T6)&&(t=new tS(t.query,n.value?E6:null));return t},provide:t=>U0.from(t,e=>e.panel)});class tS{constructor(e,n){this.query=e,this.panel=n}}const hhe=kt.mark({class:"cm-searchMatch"}),fhe=kt.mark({class:"cm-searchMatch cm-searchMatch-selected"}),mhe=Vr.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field($c))}update(t){let e=t.state.field($c);(e!=t.startState.field($c)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return kt.none;let{view:n}=this,r=new ql;for(let s=0,i=n.visibleRanges,a=i.length;s<a;s++){let{from:l,to:c}=i[s];for(;s<a-1&&c>i[s+1].from-500;)c=i[++s].to;t.highlight(n.state,l,c,(d,h)=>{let m=n.state.selection.ranges.some(g=>g.from==d&&g.to==h);r.add(d,h,m?fhe:hhe)})}return r.finish()}},{decorations:t=>t.decorations});function Kp(t){return e=>{let n=e.state.field($c,!1);return n&&n.query.spec.valid?t(e,n):X$(e)}}const sy=Kp((t,{query:e})=>{let{to:n}=t.state.selection.main,r=e.nextMatch(t.state,n,n);if(!r)return!1;let s=Me.single(r.from,r.to),i=t.state.facet(Tf);return t.dispatch({selection:s,effects:[_6(t,r),i.scrollToMatch(s.main,t)],userEvent:"select.search"}),G$(t),!0}),iy=Kp((t,{query:e})=>{let{state:n}=t,{from:r}=n.selection.main,s=e.prevMatch(n,r,r);if(!s)return!1;let i=Me.single(s.from,s.to),a=t.state.facet(Tf);return t.dispatch({selection:i,effects:[_6(t,s),a.scrollToMatch(i.main,t)],userEvent:"select.search"}),G$(t),!0}),phe=Kp((t,{query:e})=>{let n=e.matchAll(t.state,1e3);return!n||!n.length?!1:(t.dispatch({selection:Me.create(n.map(r=>Me.range(r.from,r.to))),userEvent:"select.search.matches"}),!0)}),ghe=({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 l=new af(t.doc,t.sliceDoc(r,s));!l.next().done;){if(i.length>1e3)return!1;l.value.from==r&&(a=i.length),i.push(Me.range(l.value.from,l.value.to))}return e(t.update({selection:Me.create(i,a),userEvent:"select.search.matches"})),!0},P_=Kp((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,l=[],c,d,h=[];a.from==r&&a.to==s&&(d=n.toText(e.getReplacement(a)),l.push({from:a.from,to:a.to,insert:d}),a=e.nextMatch(n,a.from,a.to),h.push(Ze.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(r).number)+".")));let m=t.state.changes(l);return a&&(c=Me.single(a.from,a.to).map(m),h.push(_6(t,a)),h.push(n.facet(Tf).scrollToMatch(c.main,t))),t.dispatch({changes:m,selection:c,effects:h,userEvent:"input.replace"}),!0}),xhe=Kp((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:Ze.announce.of(r),userEvent:"input.replace.all"}),!0});function E6(t){return t.state.facet(Tf).createPanel(t)}function hO(t,e){var n,r,s,i,a;let l=t.selection.main,c=l.empty||l.to>l.from+100?"":t.sliceDoc(l.from,l.to);if(e&&!c)return e;let d=t.facet(Tf);return new V$({search:((n=e?.literal)!==null&&n!==void 0?n:d.literal)?c:c.replace(/\n/g,"\\n"),caseSensitive:(r=e?.caseSensitive)!==null&&r!==void 0?r:d.caseSensitive,literal:(s=e?.literal)!==null&&s!==void 0?s:d.literal,regexp:(i=e?.regexp)!==null&&i!==void 0?i:d.regexp,wholeWord:(a=e?.wholeWord)!==null&&a!==void 0?a:d.wholeWord})}function W$(t){let e=V0(t,E6);return e&&e.dom.querySelector("[main-field]")}function G$(t){let e=W$(t);e&&e==t.root.activeElement&&e.select()}const X$=t=>{let e=t.state.field($c,!1);if(e&&e.panel){let n=W$(t);if(n&&n!=t.root.activeElement){let r=hO(t.state,e.query.spec);r.valid&&t.dispatch({effects:Z0.of(r)}),n.focus(),n.select()}}else t.dispatch({effects:[T6.of(!0),e?Z0.of(hO(t.state,e.query.spec)):Ft.appendConfig.of(whe)]});return!0},Y$=t=>{let e=t.state.field($c,!1);if(!e||!e.panel)return!1;let n=V0(t,E6);return n&&n.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:T6.of(!1)}),!0},vhe=[{key:"Mod-f",run:X$,scope:"editor search-panel"},{key:"F3",run:sy,shift:iy,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:sy,shift:iy,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:Y$,scope:"editor search-panel"},{key:"Mod-Shift-l",run:ghe},{key:"Mod-Alt-g",run:Xde},{key:"Mod-d",run:ohe,preventDefault:!0}];class yhe{constructor(e){this.view=e;let n=this.query=e.state.field($c).query.spec;this.commit=this.commit.bind(this),this.searchField=sr("input",{value:n.search,placeholder:Li(e,"Find"),"aria-label":Li(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=sr("input",{value:n.replace,placeholder:Li(e,"Replace"),"aria-label":Li(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=sr("input",{type:"checkbox",name:"case",form:"",checked:n.caseSensitive,onchange:this.commit}),this.reField=sr("input",{type:"checkbox",name:"re",form:"",checked:n.regexp,onchange:this.commit}),this.wordField=sr("input",{type:"checkbox",name:"word",form:"",checked:n.wholeWord,onchange:this.commit});function r(s,i,a){return sr("button",{class:"cm-button",name:s,onclick:i,type:"button"},a)}this.dom=sr("div",{onkeydown:s=>this.keydown(s),class:"cm-search"},[this.searchField,r("next",()=>sy(e),[Li(e,"next")]),r("prev",()=>iy(e),[Li(e,"previous")]),r("select",()=>phe(e),[Li(e,"all")]),sr("label",null,[this.caseField,Li(e,"match case")]),sr("label",null,[this.reField,Li(e,"regexp")]),sr("label",null,[this.wordField,Li(e,"by word")]),...e.state.readOnly?[]:[sr("br"),this.replaceField,r("replace",()=>P_(e),[Li(e,"replace")]),r("replaceAll",()=>xhe(e),[Li(e,"replace all")])],sr("button",{name:"close",onclick:()=>Y$(e),"aria-label":Li(e,"close"),type:"button"},["×"])])}commit(){let e=new V$({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:Z0.of(e)}))}keydown(e){Ole(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?iy:sy)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),P_(this.view))}update(e){for(let n of e.transactions)for(let r of n.effects)r.is(Z0)&&!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(Tf).top}}function Li(t,e){return t.state.phrase(e)}const v1=30,y1=/[\s\.,:;?!]/;function _6(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-v1),a=Math.min(s,n+v1),l=t.state.sliceDoc(i,a);if(i!=r.from){for(let c=0;c<v1;c++)if(!y1.test(l[c+1])&&y1.test(l[c])){l=l.slice(c);break}}if(a!=s){for(let c=l.length-1;c>l.length-v1;c--)if(!y1.test(l[c-1])&&y1.test(l[c])){l=l.slice(0,c);break}}return Ze.announce.of(`${t.state.phrase("current match")}. ${l} ${t.state.phrase("on line")} ${r.number}.`)}const bhe=Ze.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"}}),whe=[$c,ou.low(mhe),bhe];class K${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=Ss(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(J$(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 z_(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 She(t){let e=Object.create(null),n=Object.create(null);for(let{label:s}of t){e[s[0]]=!0;for(let i=1;i<s.length;i++)n[s[i]]=!0}let r=z_(e)+z_(n)+"*$";return[new RegExp("^"+r),new RegExp(r)]}function Z$(t){let e=t.map(s=>typeof s=="string"?{label:s}:s),[n,r]=e.every(s=>/^\w+$/.test(s.label))?[/\w*$/,/\w+$/]:She(e);return s=>{let i=s.matchBefore(r);return i||s.explicit?{from:i?i.from:s.pos,options:e,validFor:n}:null}}function khe(t,e){return n=>{for(let r=Ss(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 I_=class{constructor(e,n,r,s){this.completion=e,this.source=n,this.match=r,this.score=s}};function ed(t){return t.selection.main.from}function J$(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 A6=qo.define();function Ohe(t,e,n,r){let{main:s}=t.selection,i=n-s.from,a=r-s.from;return{...t.changeByRange(l=>{if(l!=s&&n!=r&&t.sliceDoc(l.from+i,l.from+a)!=t.sliceDoc(n,r))return{range:l};let c=t.toText(e);return{changes:{from:l.from+i,to:r==s.from?l.to:l.from+a,insert:c},range:Me.cursor(l.from+i+c.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const L_=new WeakMap;function jhe(t){if(!Array.isArray(t))return t;let e=L_.get(t);return e||L_.set(t,e=Z$(t)),e}const ay=Ft.define(),J0=Ft.define();class Nhe{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<e.length;){let r=gi(e,n),s=wo(r);this.chars.push(r);let i=e.slice(n,n+s),a=i.toUpperCase();this.folded.push(gi(a==i?i.toLowerCase():a,0)),n+=s}this.astral=e.length!=this.chars.length}ret(e,n){return this.score=e,this.matched=n,this}match(e){if(this.pattern.length==0)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:n,folded:r,any:s,precise:i,byWord:a}=this;if(n.length==1){let j=gi(e,0),N=wo(j),T=N==e.length?0:-100;if(j!=n[0])if(j==r[0])T+=-200;else return null;return this.ret(T,[0,N])}let l=e.indexOf(this.pattern);if(l==0)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let c=n.length,d=0;if(l<0){for(let j=0,N=Math.min(e.length,200);j<N&&d<c;){let T=gi(e,j);(T==n[d]||T==r[d])&&(s[d++]=j),j+=wo(T)}if(d<c)return null}let h=0,m=0,g=!1,x=0,y=-1,w=-1,S=/[a-z]/.test(e),k=!0;for(let j=0,N=Math.min(e.length,200),T=0;j<N&&m<c;){let E=gi(e,j);l<0&&(h<c&&E==n[h]&&(i[h++]=j),x<c&&(E==n[x]||E==r[x]?(x==0&&(y=j),w=j+1,x++):x=0));let _,A=E<255?E>=48&&E<=57||E>=97&&E<=122?2:E>=65&&E<=90?1:0:(_=Zj(E))!=_.toLowerCase()?1:_!=_.toUpperCase()?2:0;(!j||A==1&&S||T==0&&A!=0)&&(n[m]==E||r[m]==E&&(g=!0)?a[m++]=j:a.length&&(k=!1)),T=A,j+=wo(E)}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]):l>-1?this.ret(-700-e.length,[l,l+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 l=a+(this.astral?wo(gi(r,a)):1);i&&s[i-1]==a?s[i-1]=l:(s[i++]=a,s[i++]=l)}return this.ret(e-r.length,s)}}class Che{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length<this.pattern.length)return null;let n=e.slice(0,this.pattern.length),r=n==this.pattern?0:n.toLowerCase()==this.folded?-200:null;return r==null?null:(this.matched=[0,n.length],this.score=r+(e.length==this.pattern.length?0:-100),this)}}const bs=at.define({combine(t){return $o(t,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:The,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=>B_(e(r),n(r)),optionClass:(e,n)=>r=>B_(e(r),n(r)),addToOptions:(e,n)=>e.concat(n),filterStrict:(e,n)=>e||n})}});function B_(t,e){return t?e?t+" "+e:t:e}function The(t,e,n,r,s,i){let a=t.textDirection==gr.RTL,l=a,c=!1,d="top",h,m,g=e.left-s.left,x=s.right-e.right,y=r.right-r.left,w=r.bottom-r.top;if(l&&g<Math.min(y,x)?l=!1:!l&&x<Math.min(y,g)&&(l=!0),y<=(l?g:x))h=Math.max(s.top,Math.min(n.top,s.bottom-w))-e.top,m=Math.min(400,l?g:x);else{c=!0,m=Math.min(400,(a?e.right:s.right-e.left)-30);let j=s.bottom-e.bottom;j>=w||j>e.top?h=n.bottom-e.top:(d="bottom",h=e.bottom-n.top)}let S=(e.bottom-e.top)/i.offsetHeight,k=(e.right-e.left)/i.offsetWidth;return{style:`${d}: ${h/S}px; max-width: ${m/k}px`,class:"cm-completionInfo-"+(c?a?"left-narrow":"right-narrow":l?"left":"right")}}function Ehe(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 l=n.displayLabel||n.label,c=0;for(let d=0;d<i.length;){let h=i[d++],m=i[d++];h>c&&a.appendChild(document.createTextNode(l.slice(c,h)));let g=a.appendChild(document.createElement("span"));g.appendChild(document.createTextNode(l.slice(h,m))),g.className="cm-completionMatchedText",c=m}return c<l.length&&a.appendChild(document.createTextNode(l.slice(c))),a},position:50},{render(n){if(!n.detail)return null;let r=document.createElement("span");return r.className="cm-completionDetail",r.textContent=n.detail,r},position:80}),e.sort((n,r)=>n.position-r.position).map(n=>n.render)}function nS(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 _he{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,l=e.state.facet(bs);this.optionContent=Ehe(l),this.optionClass=l.optionClass,this.tooltipClass=l.tooltipClass,this.range=nS(i.length,a,l.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",c=>{let{options:d}=e.state.field(n).open;for(let h=c.target,m;h&&h!=this.dom;h=h.parentNode)if(h.nodeName=="LI"&&(m=/-(\d+)$/.exec(h.id))&&+m[1]<d.length){this.applyCompletion(e,d[+m[1]]),c.preventDefault();return}}),this.dom.addEventListener("focusout",c=>{let d=e.state.field(this.stateField,!1);d&&d.tooltip&&e.state.facet(bs).closeOnBlur&&c.relatedTarget!=e.contentDOM&&e.dispatch({effects:J0.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:l}=r.open;(!s.open||s.open.options!=i)&&(this.range=nS(i.length,a,e.state.facet(bs).maxRenderedOptions),this.showOptions(i,r.id)),this.updateSel(),l!=((n=s.open)===null||n===void 0?void 0:n.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!l)}}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.from||n.selected>=this.range.to)&&(this.range=nS(n.options.length,n.selected,this.view.state.facet(bs).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(l=>{l&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(l,s)}).catch(l=>vi(this.view.state,l,"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&&Mhe(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<Math.max(i.top,n.top)+10?null:this.view.state.facet(bs).positionInfo(this.view,n,s,r,i,this.dom)}placeInfo(e){this.info&&(e?(e.style&&(this.info.style.cssText=e.style),this.info.className="cm-tooltip cm-completionInfo "+(e.class||"")):this.info.style.cssText="top: -1e6px")}createListBox(e,n,r){const s=document.createElement("ul");s.id=n,s.setAttribute("role","listbox"),s.setAttribute("aria-expanded","true"),s.setAttribute("aria-label",this.view.state.phrase("Completions")),s.addEventListener("mousedown",a=>{a.target==s&&a.preventDefault()});let i=null;for(let a=r.from;a<r.to;a++){let{completion:l,match:c}=e[a],{section:d}=l;if(d){let g=typeof d=="string"?d:d.name;if(g!=i&&(a>r.from||r.from==0))if(i=g,typeof d!="string"&&d.header)s.appendChild(d.header(d));else{let x=s.appendChild(document.createElement("completion-section"));x.textContent=g}}const h=s.appendChild(document.createElement("li"));h.id=n+"-"+a,h.setAttribute("role","option");let m=this.optionClass(l);m&&(h.className=m);for(let g of this.optionContent){let x=g(l,this.view.state,this.view,c);x&&h.appendChild(x)}}return r.from&&s.classList.add("cm-completionListIncompleteTop"),r.to<e.length&&s.classList.add("cm-completionListIncompleteBottom"),s}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}}function Ahe(t,e){return n=>new _he(n,t,e)}function Mhe(t,e){let n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),s=n.height/t.offsetHeight;r.top<n.top?t.scrollTop-=(n.top-r.top)/s:r.bottom>n.bottom&&(t.scrollTop+=(r.bottom-n.bottom)/s)}function F_(t){return(t.boost||0)*100+(t.apply?10:0)+(t.info?5:0)+(t.type?1:0)}function Rhe(t,e){let n=[],r=null,s=null,i=h=>{n.push(h);let{section:m}=h.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(bs);for(let h of t)if(h.hasResult()){let m=h.result.getMatch;if(h.result.filter===!1)for(let g of h.result.options)i(new I_(g,h.source,m?m(g):[],1e9-n.length));else{let g=e.sliceDoc(h.from,h.to),x,y=a.filterStrict?new Che(g):new Nhe(g);for(let w of h.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 I_(w,h.source,S,k)),typeof w.section=="object"&&w.section.rank==="dynamic"){let{name:j}=w.section;s||(s=Object.create(null)),s[j]=Math.max(k,s[j]||-1e9)}}}}if(r){let h=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.name<y.name?-1:1);for(let x of r.sort(g))m-=1e5,h[x.name]=m;for(let x of n){let{section:y}=x.completion;y&&(x.score+=h[typeof y=="string"?y:y.name])}}let l=[],c=null,d=a.compareCompletions;for(let h of n.sort((m,g)=>g.score-m.score||d(m.completion,g.completion))){let m=h.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?l.push(h):F_(h.completion)>F_(c)&&(l[l.length-1]=h),c=h.completion}return l}class Th{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 Th(this.options,q_(n,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,n,r,s,i,a){if(s&&!a&&e.some(d=>d.isPending))return s.setDisabled();let l=Rhe(e,n);if(!l.length)return s&&e.some(d=>d.isPending)?s.setDisabled():null;let c=n.facet(bs).selectOnOpen?0:-1;if(s&&s.selected!=c&&s.selected!=-1){let d=s.options[s.selected].completion;for(let h=0;h<l.length;h++)if(l[h].completion==d){c=h;break}}return new Th(l,q_(r,c),{pos:e.reduce((d,h)=>h.hasResult()?Math.min(d,h.from):d,1e8),create:Bhe,above:i.aboveCursor},s?s.timestamp:Date.now(),c,!1)}map(e){return new Th(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new Th(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class oy{constructor(e,n,r){this.active=e,this.id=n,this.open=r}static start(){return new oy(Ihe,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:n}=e,r=n.facet(bs),i=(r.override||n.languageDataAt("autocomplete",ed(n)).map(jhe)).map(c=>(this.active.find(h=>h.source==c)||new ba(c,this.active.some(h=>h.state!=0)?1:0)).update(e,r));i.length==this.active.length&&i.every((c,d)=>c==this.active[d])&&(i=this.active);let a=this.open,l=e.effects.some(c=>c.is(M6));a&&e.docChanged&&(a=a.map(e.changes)),e.selection||i.some(c=>c.hasResult()&&e.changes.touchesRange(c.from,c.to))||!Dhe(i,this.active)||l?a=Th.build(i,n,this.id,a,r,l):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 ba(c.source,0):c));for(let c of e.effects)c.is(tH)&&(a=a&&a.setSelected(c.value,this.id));return i==this.active&&a==this.open?this:new oy(i,this.id,a)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?Phe:zhe}}function Dhe(t,e){if(t==e)return!0;for(let n=0,r=0;;){for(;n<t.length&&!t[n].hasResult();)n++;for(;r<e.length&&!e[r].hasResult();)r++;let s=n==t.length,i=r==e.length;if(s||i)return s==i;if(t[n++].result!=e[r++].result)return!1}}const Phe={"aria-autocomplete":"list"},zhe={};function q_(t,e){let n={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":t};return e>-1&&(n["aria-activedescendant"]=t+"-"+e),n}const Ihe=[];function eH(t,e){if(t.isUserEvent("input.complete")){let r=t.annotation(A6);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 ba{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=eH(e,n),s=this;(r&8||r&16&&this.touches(e))&&(s=new ba(s.source,0)),r&4&&s.state==0&&(s=new ba(this.source,1)),s=s.updateFor(e,r);for(let i of e.effects)if(i.is(ay))s=new ba(s.source,1,i.value);else if(i.is(J0))s=new ba(s.source,0);else if(i.is(M6))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(ed(e.state))}}class Lh extends ba{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),l=ed(e.state);if(l>a||!s||n&2&&(ed(e.startState)==this.from||l<this.limit))return new ba(this.source,n&4?1:0);let c=e.changes.mapPos(this.limit);return Lhe(s.validFor,e.state,i,a)?new Lh(this.source,this.explicit,c,s,i,a):s.update&&(s=s.update(s,i,a,new K$(e.state,l,!1)))?new Lh(this.source,this.explicit,c,s,s.from,(r=s.to)!==null&&r!==void 0?r:ed(e.state)):new ba(this.source,1,this.explicit)}map(e){return e.empty?this:(this.result.map?this.result.map(this.result,e):this.result)?new Lh(this.source,this.explicit,e.mapPos(this.limit),this.result,e.mapPos(this.from),e.mapPos(this.to,1)):new ba(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}}function Lhe(t,e,n,r){if(!t)return!1;let s=e.sliceDoc(n,r);return typeof t=="function"?t(s,n,r,e):J$(t,!0).test(s)}const M6=Ft.define({map(t,e){return t.map(n=>n.map(e))}}),tH=Ft.define(),xi=Os.define({create(){return oy.start()},update(t,e){return t.update(e)},provide:t=>[h6.from(t,e=>e.tooltip),Ze.contentAttributes.from(t,e=>e.attrs)]});function R6(t,e){const n=e.completion.apply||e.completion.label;let r=t.state.field(xi).active.find(s=>s.source==e.source);return r instanceof Lh?(typeof n=="string"?t.dispatch({...Ohe(t.state,n,r.from,r.to),annotations:A6.of(e.completion)}):n(t,e.completion,r.from,r.to),!0):!1}const Bhe=Ahe(xi,R6);function b1(t,e="option"){return n=>{let r=n.state.field(xi,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp<n.state.facet(bs).interactionDelay)return!1;let s=1,i;e=="page"&&(i=Eq(n,r.open.tooltip))&&(s=Math.max(2,Math.floor(i.dom.offsetHeight/i.dom.querySelector("li").offsetHeight)-1));let{length:a}=r.open.options,l=r.open.selected>-1?r.open.selected+s*(t?1:-1):t?0:a-1;return l<0?l=e=="page"?0:a-1:l>=a&&(l=e=="page"?a-1:0),n.dispatch({effects:tH.of(l)}),!0}}const Fhe=t=>{let e=t.state.field(xi,!1);return t.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestamp<t.state.facet(bs).interactionDelay?!1:R6(t,e.open.options[e.open.selected])},rS=t=>t.state.field(xi,!1)?(t.dispatch({effects:ay.of(!0)}),!0):!1,qhe=t=>{let e=t.state.field(xi,!1);return!e||!e.active.some(n=>n.state!=0)?!1:(t.dispatch({effects:J0.of(null)}),!0)};class $he{constructor(e,n){this.active=e,this.context=n,this.time=Date.now(),this.updates=[],this.done=void 0}}const Hhe=50,Qhe=1e3,Vhe=Vr.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(xi).active)e.isPending&&this.startQuery(e)}update(t){let e=t.state.field(xi),n=t.state.facet(bs);if(!t.selectionSet&&!t.docChanged&&t.startState.field(xi)==e)return;let r=t.transactions.some(i=>{let a=eH(i,n);return a&8||(i.selection||i.docChanged)&&!(a&3)});for(let i=0;i<this.running.length;i++){let a=this.running[i];if(r||a.context.abortOnDocChange&&t.docChanged||a.updates.length+t.transactions.length>Hhe&&Date.now()-a.time>Qhe){for(let l of a.context.abortListeners)try{l()}catch(c){vi(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(ay)))&&(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(xi);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(bs).updateSyncTime))}startQuery(t){let{state:e}=this.view,n=ed(e),r=new K$(e,n,t.explicit,this.view),s=new $he(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:J0.of(null)}),vi(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(bs).updateSyncTime))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],n=this.view.state.facet(bs),r=this.view.state.field(xi);for(let s=0;s<this.running.length;s++){let i=this.running[s];if(i.done===void 0)continue;if(this.running.splice(s--,1),i.done){let l=ed(i.updates.length?i.updates[0].startState:this.view.state),c=Math.min(l,i.done.from+(i.active.explicit?0:1)),d=new Lh(i.active.source,i.active.explicit,c,i.done,i.done.from,(t=i.done.to)!==null&&t!==void 0?t:l);for(let h of i.updates)d=d.update(h,n);if(d.hasResult()){e.push(d);continue}}let a=r.active.find(l=>l.source==i.active.source);if(a&&a.isPending)if(i.done==null){let l=new ba(i.active.source,0);for(let c of i.updates)l=l.update(c,n);l.isPending||e.push(l)}else this.startQuery(a)}(e.length||r.open&&r.open.disabled)&&this.view.dispatch({effects:M6.of(e)})}},{eventHandlers:{blur(t){let e=this.view.state.field(xi,!1);if(e&&e.tooltip&&this.view.state.facet(bs).closeOnBlur){let n=e.open&&Eq(this.view,e.open.tooltip);(!n||!n.dom.contains(t.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:J0.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:ay.of(!1)}),20),this.composing=0}}}),Uhe=typeof navigator=="object"&&/Win/.test(navigator.platform),Whe=ou.highest(Ze.domEventHandlers({keydown(t,e){let n=e.state.field(xi,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||t.key.length>1||t.ctrlKey&&!(Uhe&&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&&R6(e,r),!1}})),nH=Ze.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 Ghe{constructor(e,n,r,s){this.field=e,this.line=n,this.from=r,this.to=s}}class D6{constructor(e,n,r){this.field=e,this.from=n,this.to=r}map(e){let n=e.mapPos(this.from,-1,Ds.TrackDel),r=e.mapPos(this.to,1,Ds.TrackDel);return n==null||r==null?null:new D6(this.field,n,r)}}class P6{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 d=a,h=/^\t*/.exec(c)[0].length;for(let m=0;m<h;m++)d+=e.facet(Wp);s.push(n+d.length-h),c=d+c.slice(h)}r.push(c),n+=c.length+1}let l=this.fieldPositions.map(c=>new D6(c.field,s[c.line]+c.from,s[c.line]+c.to));return{text:r,ranges:l}}static parse(e){let n=[],r=[],s=[],i;for(let a of e.split(/\r\n?|\n/)){for(;i=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(a);){let l=i[1]?+i[1]:null,c=i[2]||i[3]||"",d=-1,h=c.replace(/\\[{}]/g,m=>m[1]);for(let m=0;m<n.length;m++)(l!=null?n[m].seq==l:h&&n[m].name==h)&&(d=m);if(d<0){let m=0;for(;m<n.length&&(l==null||n[m].seq!=null&&n[m].seq<l);)m++;n.splice(m,0,{seq:l,name:h}),d=m;for(let g of s)g.field>=d&&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 Ghe(d,r.length,i.index,i.index+h.length)),a=a.slice(0,i.index)+c+a.slice(i.index+i[0].length)}a=a.replace(/\\([{}])/g,(l,c,d)=>{for(let h of s)h.line==r.length&&h.from>d&&(h.from--,h.to--);return c}),r.push(a)}return new P6(r,s)}}let Xhe=kt.widget({widget:new class extends Ho{toDOM(){let t=document.createElement("span");return t.className="cm-snippetFieldPosition",t}ignoreEvent(){return!1}}}),Yhe=kt.mark({class:"cm-snippetField"});class Ef{constructor(e,n){this.ranges=e,this.active=n,this.deco=kt.set(e.map(r=>(r.from==r.to?Xhe:Yhe).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 Ef(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 Zp=Ft.define({map(t,e){return t&&t.map(e)}}),Khe=Ft.define(),ep=Os.define({create(){return null},update(t,e){for(let n of e.effects){if(n.is(Zp))return n.value;if(n.is(Khe)&&t)return new Ef(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=>Ze.decorations.from(t,e=>e?e.deco:kt.none)});function z6(t,e){return Me.create(t.filter(n=>n.field==e).map(n=>Me.range(n.from,n.to)))}function Zhe(t){let e=P6.parse(t);return(n,r,s,i)=>{let{text:a,ranges:l}=e.instantiate(n.state,s),{main:c}=n.state.selection,d={changes:{from:s,to:i==c.from?c.to:i,insert:jn.of(a)},scrollIntoView:!0,annotations:r?[A6.of(r),ns.userEvent.of("input.complete")]:void 0};if(l.length&&(d.selection=z6(l,0)),l.some(h=>h.field>0)){let h=new Ef(l,0),m=d.effects=[Zp.of(h)];n.state.field(ep,!1)===void 0&&m.push(Ft.appendConfig.of([ep,rfe,sfe,nH]))}n.dispatch(n.state.update(d))}}function rH(t){return({state:e,dispatch:n})=>{let r=e.field(ep,!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:z6(r.ranges,s),effects:Zp.of(i?null:new Ef(r.ranges,s)),scrollIntoView:!0})),!0}}const Jhe=({state:t,dispatch:e})=>t.field(ep,!1)?(e(t.update({effects:Zp.of(null)})),!0):!1,efe=rH(1),tfe=rH(-1),nfe=[{key:"Tab",run:efe,shift:tfe},{key:"Escape",run:Jhe}],$_=at.define({combine(t){return t.length?t[0]:nfe}}),rfe=ou.highest(Vp.compute([$_],t=>t.facet($_)));function vl(t,e){return{...e,apply:Zhe(t)}}const sfe=Ze.domEventHandlers({mousedown(t,e){let n=e.state.field(ep,!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:z6(n.ranges,s.field),effects:Zp.of(n.ranges.some(i=>i.field>s.field)?new Ef(n.ranges,s.field):null),scrollIntoView:!0}),!0)}}),tp={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},Vu=Ft.define({map(t,e){let n=e.mapPos(t,-1,Ds.TrackAfter);return n??void 0}}),I6=new class extends sd{};I6.startSide=1;I6.endSide=-1;const sH=Os.define({create(){return Rn.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(Vu)&&(t=t.update({add:[I6.range(n.value,n.value+1)]}));return t}});function ife(){return[ofe,sH]}const sS="()[]{}<>«»»«[]{}";function iH(t){for(let e=0;e<sS.length;e+=2)if(sS.charCodeAt(e)==t)return sS.charAt(e+1);return Zj(t<128?t:t+1)}function aH(t,e){return t.languageDataAt("closeBrackets",e)[0]||tp}const afe=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),ofe=Ze.inputHandler.of((t,e,n,r)=>{if((afe?t.composing:t.compositionStarted)||t.state.readOnly)return!1;let s=t.state.selection.main;if(r.length>2||r.length==2&&wo(gi(r,0))==1||e!=s.from||n!=s.to)return!1;let i=ufe(t.state,r);return i?(t.dispatch(i),!0):!1}),lfe=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let r=aH(t,t.selection.main.head).brackets||tp.brackets,s=null,i=t.changeByRange(a=>{if(a.empty){let l=dfe(t.doc,a.head);for(let c of r)if(c==l&&bb(t.doc,a.head)==iH(gi(c,0)))return{changes:{from:a.head-c.length,to:a.head+c.length},range:Me.cursor(a.head-c.length)}}return{range:s=a}});return s||e(t.update(i,{scrollIntoView:!0,userEvent:"delete.backward"})),!s},cfe=[{key:"Backspace",run:lfe}];function ufe(t,e){let n=aH(t,t.selection.main.head),r=n.brackets||tp.brackets;for(let s of r){let i=iH(gi(s,0));if(e==s)return i==s?mfe(t,s,r.indexOf(s+s+s)>-1,n):hfe(t,s,i,n.before||tp.before);if(e==i&&oH(t,t.selection.main.from))return ffe(t,s,i)}return null}function oH(t,e){let n=!1;return t.field(sH).between(0,t.doc.length,r=>{r==e&&(n=!0)}),n}function bb(t,e){let n=t.sliceString(e,e+2);return n.slice(0,wo(gi(n,0)))}function dfe(t,e){let n=t.sliceString(e-2,e);return wo(gi(n,0))==n.length?n:n.slice(1)}function hfe(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:Vu.of(a.to+e.length),range:Me.range(a.anchor+e.length,a.head+e.length)};let l=bb(t.doc,a.head);return!l||/\s/.test(l)||r.indexOf(l)>-1?{changes:{insert:e+n,from:a.head},effects:Vu.of(a.head+e.length),range:Me.cursor(a.head+e.length)}:{range:s=a}});return s?null:t.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function ffe(t,e,n){let r=null,s=t.changeByRange(i=>i.empty&&bb(t.doc,i.head)==n?{changes:{from:i.head,to:i.head+n.length,insert:n},range:Me.cursor(i.head+n.length)}:r={range:i});return r?null:t.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function mfe(t,e,n,r){let s=r.stringPrefixes||tp.stringPrefixes,i=null,a=t.changeByRange(l=>{if(!l.empty)return{changes:[{insert:e,from:l.from},{insert:e,from:l.to}],effects:Vu.of(l.to+e.length),range:Me.range(l.anchor+e.length,l.head+e.length)};let c=l.head,d=bb(t.doc,c),h;if(d==e){if(H_(t,c))return{changes:{insert:e+e,from:c},effects:Vu.of(c+e.length),range:Me.cursor(c+e.length)};if(oH(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:Me.cursor(c+g.length)}}}else{if(n&&t.sliceDoc(c-2*e.length,c)==e+e&&(h=Q_(t,c-2*e.length,s))>-1&&H_(t,h))return{changes:{insert:e+e+e+e,from:c},effects:Vu.of(c+e.length),range:Me.cursor(c+e.length)};if(t.charCategorizer(c)(d)!=wr.Word&&Q_(t,c,s)>-1&&!pfe(t,c,e,s))return{changes:{insert:e+e,from:c},effects:Vu.of(c+e.length),range:Me.cursor(c+e.length)}}return{range:i=l}});return i?null:t.update(a,{scrollIntoView:!0,userEvent:"input.type"})}function H_(t,e){let n=Ss(t).resolveInner(e+1);return n.parent&&n.from==e}function pfe(t,e,n,r){let s=Ss(t).resolveInner(e,-1),i=r.reduce((a,l)=>Math.max(a,l.length),0);for(let a=0;a<5;a++){let l=t.sliceDoc(s.from,Math.min(s.to,s.from+n.length+i)),c=l.indexOf(n);if(!c||c>-1&&r.indexOf(l.slice(0,c))>-1){let h=s.firstChild;for(;h&&h.from==s.from&&h.to-h.from>n.length+c;){if(t.sliceDoc(h.to-n.length,h.to)==n)return!1;h=h.firstChild}return!0}let d=s.to==e&&s.parent;if(!d)break;s=d}return!1}function Q_(t,e,n){let r=t.charCategorizer(e);if(r(t.sliceDoc(e-1,e))!=wr.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))!=wr.Word)return i}return-1}function gfe(t={}){return[Whe,xi,bs.of(t),Vhe,xfe,nH]}const lH=[{key:"Ctrl-Space",run:rS},{mac:"Alt-`",run:rS},{mac:"Alt-i",run:rS},{key:"Escape",run:qhe},{key:"ArrowDown",run:b1(!0)},{key:"ArrowUp",run:b1(!1)},{key:"PageDown",run:b1(!0,"page")},{key:"PageUp",run:b1(!1,"page")},{key:"Enter",run:Fhe}],xfe=ou.highest(Vp.computeN([bs],t=>t.facet(bs).defaultKeymap?[lH]:[]));class V_{constructor(e,n,r){this.from=e,this.to=n,this.diagnostic=r}}class qu{constructor(e,n,r){this.diagnostics=e,this.panel=n,this.selected=r}static init(e,n,r){let s=r.facet(np).markerFilter;s&&(e=s(e,r));let i=e.slice().sort((x,y)=>x.from-y.from||x.to-y.to),a=new ql,l=[],c=0,d=r.doc.iter(),h=0,m=r.doc.length;for(let x=0;;){let y=x==i.length?null:i[x];if(!y&&!l.length)break;let w,S;if(l.length)w=c,S=l.reduce((N,T)=>Math.min(N,T.to),y&&y.from>w?y.from:1e8);else{if(w=y.from,w>m)break;S=y.to,l.push(y),x++}for(;x<i.length;){let N=i[x];if(N.from==w&&(N.to>N.from||N.to==w))l.push(N),x++,S=Math.min(N.to,S);else{S=Math.min(N.from,S);break}}S=Math.min(S,m);let k=!1;if(l.some(N=>N.from==w&&(N.to==S||S==m))&&(k=w==S,!k&&S-w<10)){let N=w-(h+d.value.length);N>0&&(d.next(N),h=w);for(let T=w;;){if(T>=S){k=!0;break}if(!d.lineBreak&&h+d.value.length>T)break;T=h+d.value.length,h+=d.value.length,d.next()}}let j=_fe(l);if(k)a.add(w,w,kt.widget({widget:new Nfe(j),diagnostics:l.slice()}));else{let N=l.reduce((T,E)=>E.markClass?T+" "+E.markClass:T,"");a.add(w,S,kt.mark({class:"cm-lintRange cm-lintRange-"+j+N,diagnostics:l.slice(),inclusiveEnd:l.some(T=>T.to>S)}))}if(c=S,c==m)break;for(let N=0;N<l.length;N++)l[N].to<=c&&l.splice(N--,1)}let g=a.finish();return new qu(g,n,of(g))}}function of(t,e=null,n=0){let r=null;return t.between(n,1e9,(s,i,{spec:a})=>{if(!(e&&a.diagnostics.indexOf(e)<0))if(!r)r=new V_(s,i,e||a.diagnostics[0]);else{if(a.diagnostics.indexOf(r.diagnostic)<0)return!1;r=new V_(r.from,i,r.diagnostic)}}),r}function vfe(t,e){let n=e.pos,r=e.end||n,s=t.state.facet(np).hideOn(t,n,r);if(s!=null)return s;let i=t.startState.doc.lineAt(e.pos);return!!(t.effects.some(a=>a.is(cH))||t.changes.touchesRange(i.from,Math.max(i.to,r)))}function yfe(t,e){return t.field(Vi,!1)?e:e.concat(Ft.appendConfig.of(Afe))}const cH=Ft.define(),L6=Ft.define(),uH=Ft.define(),Vi=Os.define({create(){return new qu(kt.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=of(n,t.selected.diagnostic,i)||of(n,null,i)}!n.size&&s&&e.state.facet(np).autoPanel&&(s=null),t=new qu(n,s,r)}for(let n of e.effects)if(n.is(cH)){let r=e.state.facet(np).autoPanel?n.value.length?rp.open:null:t.panel;t=qu.init(n.value,r,e.state)}else n.is(L6)?t=new qu(t.diagnostics,n.value?rp.open:null,t.selected):n.is(uH)&&(t=new qu(t.diagnostics,t.panel,n.value));return t},provide:t=>[U0.from(t,e=>e.panel),Ze.decorations.from(t,e=>e.diagnostics)]}),bfe=kt.mark({class:"cm-lintRange cm-lintRange-active"});function wfe(t,e,n){let{diagnostics:r}=t.state.field(Vi),s,i=-1,a=-1;r.between(e-(n<0?1:0),e+(n>0?1:0),(c,d,{spec:h})=>{if(e>=c&&e<=d&&(c==d||(e>c||n>0)&&(e<d||n<0)))return s=h.diagnostics,i=c,a=d,!1});let l=t.state.facet(np).tooltipFilter;return s&&l&&(s=l(s,t.state)),s?{pos:i,end:a,above:t.state.doc.lineAt(i).to<a,create(){return{dom:Sfe(t,s)}}}:null}function Sfe(t,e){return sr("ul",{class:"cm-tooltip-lint"},e.map(n=>hH(t,n,!1)))}const kfe=t=>{let e=t.state.field(Vi,!1);(!e||!e.panel)&&t.dispatch({effects:yfe(t.state,[L6.of(!0)])});let n=V0(t,rp.open);return n&&n.dom.querySelector(".cm-panel-lint ul").focus(),!0},U_=t=>{let e=t.state.field(Vi,!1);return!e||!e.panel?!1:(t.dispatch({effects:L6.of(!1)}),!0)},Ofe=t=>{let e=t.state.field(Vi,!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)},jfe=[{key:"Mod-Shift-m",run:kfe,preventDefault:!0},{key:"F8",run:Ofe}],np=at.define({combine(t){return{sources:t.map(e=>e.source).filter(e=>e!=null),...$o(t.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:W_,tooltipFilter:W_,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 W_(t,e){return t?e?(n,r)=>e(t(n,r),r):t:e}function dH(t){let e=[];if(t)e:for(let{name:n}of t){for(let r=0;r<n.length;r++){let s=n[r];if(/[a-zA-Z]/.test(s)&&!e.some(i=>i.toLowerCase()==s.toLowerCase())){e.push(s);continue e}}e.push("")}return e}function hH(t,e,n){var r;let s=n?dH(e.actions):[];return sr("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},sr("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 l=!1,c=x=>{if(x.preventDefault(),l)return;l=!0;let y=of(t.state.field(Vi).diagnostics,e);y&&i.apply(t,y.from,y.to)},{name:d}=i,h=s[a]?d.indexOf(s[a]):-1,m=h<0?d:[d.slice(0,h),sr("u",d.slice(h,h+1)),d.slice(h+1)],g=i.markClass?" "+i.markClass:"";return sr("button",{type:"button",class:"cm-diagnosticAction"+g,onclick:c,onmousedown:c,"aria-label":` Action: ${d}${h<0?"":` (access key "${s[a]})"`}.`},m)}),e.source&&sr("div",{class:"cm-diagnosticSource"},e.source))}class Nfe extends Ho{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return sr("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class G_{constructor(e,n){this.diagnostic=n,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=hH(e,n,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class rp{constructor(e){this.view=e,this.items=[];let n=s=>{if(s.keyCode==27)U_(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=dH(i.actions);for(let l=0;l<a.length;l++)if(a[l].toUpperCase().charCodeAt(0)==s.keyCode){let c=of(this.view.state.field(Vi).diagnostics,i);c&&i.actions[l].apply(e,c.from,c.to)}}else return;s.preventDefault()},r=s=>{for(let i=0;i<this.items.length;i++)this.items[i].dom.contains(s.target)&&this.moveSelection(i)};this.list=sr("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:n,onclick:r}),this.dom=sr("div",{class:"cm-panel-lint"},this.list,sr("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>U_(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(Vi).selected;if(!e)return-1;for(let n=0;n<this.items.length;n++)if(this.items[n].diagnostic==e.diagnostic)return n;return-1}update(){let{diagnostics:e,selected:n}=this.view.state.field(Vi),r=0,s=!1,i=null,a=new Set;for(e.between(0,this.view.state.doc.length,(l,c,{spec:d})=>{for(let h of d.diagnostics){if(a.has(h))continue;a.add(h);let m=-1,g;for(let x=r;x<this.items.length;x++)if(this.items[x].diagnostic==h){m=x;break}m<0?(g=new G_(this.view,h),this.items.splice(r,0,g),s=!0):(g=this.items[m],m>r&&(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<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)s=!0,this.items.pop();this.items.length==0&&(this.items.push(new G_(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),s=!0),i?(this.list.setAttribute("aria-activedescendant",i.id),this.view.requestMeasure({key:this,read:()=>({sel:i.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:l,panel:c})=>{let d=c.height/this.list.offsetHeight;l.top<c.top?this.list.scrollTop-=(c.top-l.top)/d:l.bottom>c.bottom&&(this.list.scrollTop+=(l.bottom-c.bottom)/d)}})):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(Vi),r=of(n.diagnostics,this.items[e].diagnostic);r&&this.view.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0,effects:uH.of(r)})}static open(e){return new rp(e)}}function Cfe(t,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${e}>${encodeURIComponent(t)}</svg>')`}function w1(t){return Cfe(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${t}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}const Tfe=Ze.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:w1("#d11")},".cm-lintRange-warning":{backgroundImage:w1("orange")},".cm-lintRange-info":{backgroundImage:w1("#999")},".cm-lintRange-hint":{backgroundImage:w1("#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 Efe(t){return t=="error"?4:t=="warning"?3:t=="info"?2:1}function _fe(t){let e="hint",n=1;for(let r of t){let s=Efe(r.severity);s>n&&(n=s,e=r.severity)}return e}const Afe=[Vi,Ze.decorations.compute([Vi],t=>{let{selected:e,panel:n}=t.field(Vi);return!e||!n||e.from==e.to?kt.none:kt.set([bfe.range(e.from,e.to)])}),hce(wfe,{hideOn:vfe}),Tfe];var X_=function(e){e===void 0&&(e={});var{crosshairCursor:n=!1}=e,r=[];e.closeBracketsKeymap!==!1&&(r=r.concat(cfe)),e.defaultKeymap!==!1&&(r=r.concat(Ude)),e.searchKeymap!==!1&&(r=r.concat(vhe)),e.historyKeymap!==!1&&(r=r.concat(Jue)),e.foldKeymap!==!1&&(r=r.concat(cue)),e.completionKeymap!==!1&&(r=r.concat(lH)),e.lintKeymap!==!1&&(r=r.concat(jfe));var s=[];return e.lineNumbers!==!1&&s.push(kce()),e.highlightActiveLineGutter!==!1&&s.push(Nce()),e.highlightSpecialChars!==!1&&s.push(qle()),e.history!==!1&&s.push(Que()),e.foldGutter!==!1&&s.push(fue()),e.drawSelection!==!1&&s.push(_le()),e.dropCursor!==!1&&s.push(Ple()),e.allowMultipleSelections!==!1&&s.push(wn.allowMultipleSelections.of(!0)),e.indentOnInput!==!1&&s.push(eue()),e.syntaxHighlighting!==!1&&s.push(Jq(xue,{fallback:!0})),e.bracketMatching!==!1&&s.push(Oue()),e.closeBrackets!==!1&&s.push(ife()),e.autocompletion!==!1&&s.push(gfe()),e.rectangularSelection!==!1&&s.push(tce()),n!==!1&&s.push(sce()),e.highlightActiveLine!==!1&&s.push(Wle()),e.highlightSelectionMatches!==!1&&s.push(Jde()),e.tabSize&&typeof e.tabSize=="number"&&s.push(Wp.of(" ".repeat(e.tabSize))),s.concat([Vp.of(r.flat())]).filter(Boolean)};const Mfe="#e5c07b",Y_="#e06c75",Rfe="#56b6c2",Dfe="#ffffff",pv="#abb2bf",fO="#7d8799",Pfe="#61afef",zfe="#98c379",K_="#d19a66",Ife="#c678dd",Lfe="#21252b",Z_="#2c313a",J_="#282c34",iS="#353a42",Bfe="#3E4451",eA="#528bff",Ffe=Ze.theme({"&":{color:pv,backgroundColor:J_},".cm-content":{caretColor:eA},".cm-cursor, .cm-dropCursor":{borderLeftColor:eA},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:Bfe},".cm-panels":{backgroundColor:Lfe,color:pv},".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:J_,color:fO,border:"none"},".cm-activeLineGutter":{backgroundColor:Z_},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:iS},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:iS,borderBottomColor:iS},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:Z_,color:pv}}},{dark:!0}),qfe=Xp.define([{tag:ve.keyword,color:Ife},{tag:[ve.name,ve.deleted,ve.character,ve.propertyName,ve.macroName],color:Y_},{tag:[ve.function(ve.variableName),ve.labelName],color:Pfe},{tag:[ve.color,ve.constant(ve.name),ve.standard(ve.name)],color:K_},{tag:[ve.definition(ve.name),ve.separator],color:pv},{tag:[ve.typeName,ve.className,ve.number,ve.changed,ve.annotation,ve.modifier,ve.self,ve.namespace],color:Mfe},{tag:[ve.operator,ve.operatorKeyword,ve.url,ve.escape,ve.regexp,ve.link,ve.special(ve.string)],color:Rfe},{tag:[ve.meta,ve.comment],color:fO},{tag:ve.strong,fontWeight:"bold"},{tag:ve.emphasis,fontStyle:"italic"},{tag:ve.strikethrough,textDecoration:"line-through"},{tag:ve.link,color:fO,textDecoration:"underline"},{tag:ve.heading,fontWeight:"bold",color:Y_},{tag:[ve.atom,ve.bool,ve.special(ve.variableName)],color:K_},{tag:[ve.processingInstruction,ve.string,ve.inserted],color:zfe},{tag:ve.invalid,color:Dfe}]),fH=[Ffe,Jq(qfe)];var $fe=Ze.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),Hfe=function(e){e===void 0&&(e={});var{indentWithTab:n=!0,editable:r=!0,readOnly:s=!1,theme:i="light",placeholder:a="",basicSetup:l=!0}=e,c=[];switch(n&&c.unshift(Vp.of([Wde])),l&&(typeof l=="boolean"?c.unshift(X_()):c.unshift(X_(l))),a&&c.unshift(Kle(a)),i){case"light":c.push($fe);break;case"dark":c.push(fH);break;case"none":break;default:c.push(i);break}return r===!1&&c.push(Ze.editable.of(!1)),s&&c.push(wn.readOnly.of(!0)),[...c]},Qfe=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 Vfe{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 tA{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 aS=null,Ufe=()=>typeof window>"u"?new tA:(aS||(aS=new tA),aS),nA=qo.define(),Wfe=200,Gfe=[];function Xfe(t){var{value:e,selection:n,onChange:r,onStatistics:s,onCreateEditor:i,onUpdate:a,extensions:l=Gfe,autoFocus:c,theme:d="light",height:h=null,minHeight:m=null,maxHeight:g=null,width:x=null,minWidth:y=null,maxWidth:w=null,placeholder:S="",editable:k=!0,readOnly:j=!1,indentWithTab:N=!0,basicSetup:T=!0,root:E,initialState:_}=t,[A,L]=b.useState(),[P,B]=b.useState(),[$,U]=b.useState(),te=b.useState(()=>({current:null}))[0],z=b.useState(()=>({current:null}))[0],Q=Ze.theme({"&":{height:h,minHeight:m,maxHeight:g,width:x,minWidth:y,maxWidth:w},"& .cm-scroller":{height:"100% !important"}}),F=Ze.updateListener.of(X=>{if(X.docChanged&&typeof r=="function"&&!X.transactions.some(G=>G.annotation(nA))){te.current?te.current.reset():(te.current=new Vfe(()=>{if(z.current){var G=z.current;z.current=null,G()}te.current=null},Wfe),Ufe().add(te.current));var R=X.state.doc,ie=R.toString();r(ie,X)}s&&s(Qfe(X))}),Y=Hfe({theme:d,editable:k,readOnly:j,placeholder:S,indentWithTab:N,basicSetup:T}),J=[F,Q,...Y];return a&&typeof a=="function"&&J.push(Ze.updateListener.of(a)),J=J.concat(l),b.useLayoutEffect(()=>{if(A&&!$){var X={doc:e,selection:n,extensions:J},R=_?wn.fromJSON(_.json,X,_.fields):wn.create(X);if(U(R),!P){var ie=new Ze({state:R,parent:A,root:E});B(ie),i&&i(ie,R)}}return()=>{P&&(U(void 0),B(void 0))}},[A,$]),b.useEffect(()=>{t.container&&L(t.container)},[t.container]),b.useEffect(()=>()=>{P&&(P.destroy(),B(void 0)),te.current&&(te.current.cancel(),te.current=null)},[P]),b.useEffect(()=>{c&&P&&P.focus()},[c,P]),b.useEffect(()=>{P&&P.dispatch({effects:Ft.reconfigure.of(J)})},[d,l,h,m,g,x,y,w,S,k,j,N,T,r,a]),b.useEffect(()=>{if(e!==void 0){var X=P?P.state.doc.toString():"";if(P&&e!==X){var R=te.current&&!te.current.isDone,ie=()=>{P&&e!==P.state.doc.toString()&&P.dispatch({changes:{from:0,to:P.state.doc.toString().length,insert:e||""},annotations:[nA.of(!0)]})};R?z.current=ie:ie()}}},[e,P]),{state:$,setState:U,view:P,setView:B,container:A,setContainer:L}}var Yfe=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],mH=b.forwardRef((t,e)=>{var{className:n,value:r="",selection:s,extensions:i=[],onChange:a,onStatistics:l,onCreateEditor:c,onUpdate:d,autoFocus:h,theme:m="light",height:g,minHeight:x,maxHeight:y,width:w,minWidth:S,maxWidth:k,basicSetup:j,placeholder:N,indentWithTab:T,editable:E,readOnly:_,root:A,initialState:L}=t,P=RJ(t,Yfe),B=b.useRef(null),{state:$,view:U,container:te,setContainer:z}=Xfe({root:A,value:r,autoFocus:h,theme:m,height:g,minHeight:x,maxHeight:y,width:w,minWidth:S,maxWidth:k,basicSetup:j,placeholder:N,indentWithTab:T,editable:E,readOnly:_,selection:s,onChange:a,onStatistics:l,onCreateEditor:c,onUpdate:d,extensions:i,initialState:L});b.useImperativeHandle(e,()=>({editor:B.current,state:$,view:U}),[B,te,$,U]);var Q=b.useCallback(Y=>{B.current=Y,z(Y)},[z]);if(typeof r!="string")throw new Error("value must be typeof string but got "+typeof r);var F=typeof m=="string"?"cm-theme-"+m:"cm-theme";return o.jsx("div",DJ({ref:Q,className:""+F+(n?" "+n:"")},P))});mH.displayName="CodeMirror";var rA={};class ly{constructor(e,n,r,s,i,a,l,c,d,h=0,m){this.p=e,this.stack=n,this.state=r,this.reducePos=s,this.pos=i,this.score=a,this.buffer=l,this.bufferBase=c,this.curContext=d,this.lookAhead=h,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 ly(e,[],n,r,r,0,[],0,s?new sA(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<this.pos-25;a&&this.setLookAhead(this.pos);let l=i.dynamicPrecedence(s);if(l&&(this.score+=l),r==0){this.pushState(i.getGoto(this.state,s,!0),this.reducePos),s<i.minRepeatTerm&&this.storeNode(s,this.reducePos,this.reducePos,a?8:4,!0),this.reduceContext(s,this.reducePos);return}let c=this.stack.length-(r-1)*3-(e&262144?6:0),d=c?this.stack[c-2]:this.p.ranges[0].from,h=this.reducePos-d;h>=2e3&&!(!((n=this.p.parser.nodeSet.types[s])===null||n===void 0)&&n.isAnonymous)&&(d==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=h):this.p.lastBigReductionSize<h&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=d,this.p.lastBigReductionSize=h));let m=c?this.stack[c-1]:0,g=this.bufferBase+this.buffer.length-m;if(s<i.minRepeatTerm||e&131072){let x=i.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(s,d,x,g+4,!0)}if(e&262144)this.state=this.stack[c];else{let x=this.stack[c-3];this.state=i.getGoto(x,s,!0)}for(;this.stack.length>c;)this.stack.pop();this.reduceContext(s,d)}storeNode(e,n,r,s=4,i=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let a=this,l=this.buffer.length;if(l==0&&a.parent&&(l=a.bufferBase-a.parent.bufferBase,a=a.parent),l>0&&a.buffer[l-4]==0&&a.buffer[l-1]>-1){if(n==r)return;if(a.buffer[l-2]>=n){a.buffer[l-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 l=!1;for(let c=a;c>0&&this.buffer[c-2]>r;c-=4)if(this.buffer[c-1]>=0){l=!0;break}if(l)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 ly(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 Kfe(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;i<n.length;i+=2)(a=n[i+1])!=this.state&&this.p.parser.hasAction(a,e)&&s.push(n[i],a);if(this.stack.length<120)for(let i=0;s.length<8&&i<n.length;i+=2){let a=n[i+1];s.some((l,c)=>c&1&&l==a)||s.push(n[i],a)}n=s}let r=[];for(let s=0;s<n.length&&r.length<4;s+=2){let i=n[s+1];if(i==this.state)continue;let a=this.split();a.pushState(i,this.pos),a.storeNode(0,a.pos,a.pos,4,!0),a.shiftContext(n[s],this.pos),a.reducePos=this.pos,a.score-=200,r.push(a)}return r}forceReduce(){let{parser:e}=this.p,n=e.stateSlot(this.state,5);if((n&65536)==0)return!1;if(!e.validAction(this.state,n)){let r=n>>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 l=(a>>19)-i;if(l>1){let c=a&65535,d=this.stack.length-l*3;if(d>=0&&e.getGoto(this.stack[d],c,!1)>=0)return l<<19|65536|c}}else{let l=r(a,i+1);if(l!=null)return l}})};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;n<this.stack.length;n+=3)if(this.stack[n]!=e.stack[n])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,n){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(n)))}reduceContext(e,n){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(n)))}emitContext(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let n=new sA(this.curContext.tracker,e);n.hash!=this.curContext.hash&&this.emitContext(),this.curContext=n}}setLookAhead(e){e>this.lookAhead&&(this.emitLookAhead(),this.lookAhead=e)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class sA{constructor(e,n){this.tracker=e,this.context=n,this.hash=e.strict?e.hash(n):0}}class Kfe{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 cy{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 cy(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 cy(this.stack,this.pos,this.index)}}function S1(t,e=Uint16Array){if(typeof t!="string")return t;let n=null;for(let r=0,s=0;r<t.length;){let i=0;for(;;){let a=t.charCodeAt(r++),l=!1;if(a==126){i=65535;break}a>=92&&a--,a>=34&&a--;let c=a-32;if(c>=46&&(c-=46,l=!0),i+=c,l)break;i*=46}n?n[s++]=i:n=new e(i)}return n}class gv{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const iA=new gv;class Zfe{constructor(e,n){this.input=e,this.ranges=n,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=iA,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(;i<r.from;){if(!s)return null;let a=this.ranges[--s];i-=r.from-a.to,r=a}for(;n<0?i>r.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&&e<this.range.to)return e;for(let n of this.ranges)if(n.to>e)return Math.max(e,n.from);return this.end}peek(e){let n=this.chunkOff+e,r,s;if(n>=0&&n<this.chunk.length)r=this.pos+e,s=this.chunk.charCodeAt(n);else{let i=this.resolveOffset(e,1);if(i==null)return-1;if(r=i,r>=this.chunk2Pos&&r<this.chunk2Pos+this.chunk2.length)s=this.chunk2.charCodeAt(r-this.chunk2Pos);else{let a=this.rangeIndex,l=this.range;for(;l.to<=r;)l=this.ranges[++a];this.chunk2=this.input.chunk(this.chunk2Pos=r),r+this.chunk2.length>l.to&&(this.chunk2=this.chunk2.slice(0,l.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.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=r}acceptTokenTo(e,n){this.token.value=e,this.token.end=n}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:n}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=n,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),n=this.pos+e.length;this.chunk=n>this.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=iA,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(e,n){if(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 Bh{constructor(e,n){this.data=e,this.id=n}token(e,n){let{parser:r}=n.p;Jfe(this.data,e,n,this.id,r.data,r.tokenPrecTable)}}Bh.prototype.contextual=Bh.prototype.fallback=Bh.prototype.extend=!1;Bh.prototype.fallback=Bh.prototype.extend=!1;class wb{constructor(e,n={}){this.token=e,this.contextual=!!n.contextual,this.fallback=!!n.fallback,this.extend=!!n.extend}}function Jfe(t,e,n,r,s,i){let a=0,l=1<<r,{dialect:c}=n.p.parser;e:for(;(l&t[a])!=0;){let d=t[a+1];for(let x=a+3;x<d;x+=2)if((t[x+1]&l)>0){let y=t[x];if(c.allows(y)&&(e.token.value==-1||e.token.value==y||eme(y,e.token.value,s,i))){e.acceptToken(y);break}}let h=e.next,m=0,g=t[a+2];if(e.next<0&&g>m&&t[d+g*3-3]==65535){a=t[d+g*3-1];continue e}for(;m<g;){let x=m+g>>1,y=d+x+(x<<1),w=t[y],S=t[y+1]||65536;if(h<w)g=x;else if(h>=S)m=x+1;else{a=t[y+2],e.advance();continue e}}break}}function aA(t,e,n){for(let r=e,s;(s=t[r])!=65535;r++)if(s==n)return r-e;return-1}function eme(t,e,n,r){let s=aA(n,r,e);return s<0||aA(n,r,t)<s}const Bi=typeof process<"u"&&rA&&/\bparse\b/.test(rA.LOG);let oS=null;function oA(t,e,n){let r=t.cursor(hs.IncludeAnonymous);for(r.moveTo(e);;)if(!(n<0?r.childBefore(e):r.childAfter(e)))for(;;){if((n<0?r.to<e:r.from>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 tme{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?oA(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?oA(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(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let n=this.trees.length-1;if(n<0)return this.nextFragment(),null;let r=this.trees[n],s=this.index[n];if(s==r.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let i=r.children[s],a=this.start[n]+r.positions[s];if(a>e)return this.nextStart=a,null;if(i instanceof ar){if(a==e){if(a<this.safeFrom)return null;let l=a+i.length;if(l<=this.safeTo){let c=i.prop(sn.lookAhead);if(!c||l+c<this.fragment.to)return i}}this.index[n]++,a+i.length>=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 nme{constructor(e,n){this.stream=n,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(r=>new gv)}getActions(e){let n=0,r=null,{parser:s}=e.p,{tokenizers:i}=s,a=s.stateSlot(e.state,3),l=e.curContext?e.curContext.hash:0,c=0;for(let d=0;d<i.length;d++){if((1<<d&a)==0)continue;let h=i[d],m=this.tokens[d];if(!(r&&!h.fallback)&&((h.contextual||m.start!=e.pos||m.mask!=a||m.context!=l)&&(this.updateCachedToken(m,h,e),m.mask=a,m.context=l),m.lookAhead>m.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),!h.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 gv,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 gv,{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<i.specialized.length;a++)if(i.specialized[a]==e.value){let l=i.specializers[a](this.stream.read(e.start,e.end),r);if(l>=0&&r.p.parser.dialect.allows(l>>1)){(l&1)==0?e.value=l>>1:e.extended=l>>1;break}}}else e.value=0,e.end=this.stream.clipPos(s+1)}putAction(e,n,r,s){for(let i=0;i<s;i+=3)if(this.actions[i]==e)return s;return this.actions[s++]=e,this.actions[s++]=n,this.actions[s++]=r,s}addActions(e,n,r,s){let{state:i}=e,{parser:a}=e.p,{data:l}=a;for(let c=0;c<2;c++)for(let d=a.stateSlot(i,c?2:1);;d+=3){if(l[d]==65535)if(l[d+1]==1)d=Cl(l,d+2);else{s==0&&l[d+1]==2&&(s=this.putAction(Cl(l,d+2),n,r,s));break}l[d]==n&&(s=this.putAction(Cl(l,d+1),n,r,s))}return s}}class rme{constructor(e,n,r,s){this.parser=e,this.input=n,this.ranges=s,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new Zfe(n,s),this.tokens=new nme(e,this.stream),this.topTerm=e.top[1];let{from:i}=s[0];this.stacks=[ly.start(this,e.top[0],i)],this.fragments=r.length&&this.stream.end-i>e.bufferLength*4?new tme(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;a<e.length;a++){let l=e[a];for(;;){if(this.tokens.mainToken=null,l.pos>n)r.push(l);else{if(this.advanceStack(l,r,e))continue;{s||(s=[],i=[]),s.push(l);let c=this.tokens.getMainToken(l);i.push(c.value,c.end)}}break}}if(!r.length){let a=s&&ame(s);if(a)return Bi&&console.log("Finish with "+this.stackID(a)),this.stackToTree(a);if(this.parser.strict)throw Bi&&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 Bi&&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((l,c)=>c.score-l.score);r.length>a;)r.pop();r.some(l=>l.reducePos>n)&&this.recovering--}else if(r.length>1){e:for(let a=0;a<r.length-1;a++){let l=r[a];for(let c=a+1;c<r.length;c++){let d=r[c];if(l.sameState(d)||l.buffer.length>500&&d.buffer.length>500)if((l.score-d.score||l.buffer.length-d.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<r.length;a++)r[a].pos<this.minStackPos&&(this.minStackPos=r[a].pos);return null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}advanceStack(e,n,r){let s=e.pos,{parser:i}=this,a=Bi?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&s>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let d=e.curContext&&e.curContext.tracker.strict,h=d?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&&(!d||(m.prop(sn.contextHash)||0)==h))return e.useNode(m,g),Bi&&console.log(a+this.stackID(e)+` (via reuse of ${i.getName(m.type.id)})`),!0;if(!(m instanceof ar)||m.children.length==0||m.positions[0]>0)break;let x=m.children[0];if(x instanceof ar&&m.positions[0]==0)m=x;else break}}let l=i.stateSlot(e.state,4);if(l>0)return e.reduce(l),Bi&&console.log(a+this.stackID(e)+` (via always-reduce ${i.getName(l&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let c=this.tokens.getActions(e);for(let d=0;d<c.length;){let h=c[d++],m=c[d++],g=c[d++],x=d==c.length||!r,y=x?e:e.split(),w=this.tokens.mainToken;if(y.apply(h,m,w?w.start:y.pos,g),Bi&&console.log(a+this.stackID(y)+` (via ${(h&65536)==0?"shift":`reduce of ${i.getName(h&65535)}`} for ${i.getName(m)} @ ${s}${y==e?"":", split"})`),x)return!0;y.pos>s?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 lA(e,n),!0}}runRecovery(e,n,r){let s=null,i=!1;for(let a=0;a<e.length;a++){let l=e[a],c=n[a<<1],d=n[(a<<1)+1],h=Bi?this.stackID(l)+" -> ":"";if(l.deadEnd&&(i||(i=!0,l.restart(),Bi&&console.log(h+this.stackID(l)+" (restarted)"),this.advanceFully(l,r))))continue;let m=l.split(),g=h;for(let x=0;x<10&&m.forceReduce()&&(Bi&&console.log(g+this.stackID(m)+" (via force-reduce)"),!this.advanceFully(m,r));x++)Bi&&(g=this.stackID(m)+" -> ");for(let x of l.recoverByInsert(c))Bi&&console.log(h+this.stackID(x)+" (via recover-insert)"),this.advanceFully(x,r);this.stream.end>l.pos?(d==l.pos&&(d++,c=0),l.recoverByDelete(c,d),Bi&&console.log(h+this.stackID(l)+` (via recover-delete ${this.parser.getName(c)})`),lA(l,r)):(!s||s.score<l.score)&&(s=l)}return s}stackToTree(e){return e.close(),ar.build({buffer:cy.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let n=(oS||(oS=new WeakMap)).get(e);return n||oS.set(e,n=String.fromCodePoint(this.nextStackID++)),n+e}}function lA(t,e){for(let n=0;n<e.length;n++){let r=e[n];if(r.pos==t.pos&&r.sameState(t)){e[n].score<t.score&&(e[n]=t);return}}e.push(t)}class sme{constructor(e,n,r){this.source=e,this.flags=n,this.disabled=r}allows(e){return!this.disabled||this.disabled[e]==0}}const lS=t=>t;class ime{constructor(e){this.start=e.start,this.shift=e.shift||lS,this.reduce=e.reduce||lS,this.reuse=e.reuse||lS,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}}class sp extends g6{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 l=0;l<e.repeatNodeCount;l++)n.push("");let r=Object.keys(e.topRules).map(l=>e.topRules[l][1]),s=[];for(let l=0;l<n.length;l++)s.push([]);function i(l,c,d){s[l].push([c,c.deserialize(String(d))])}if(e.nodeProps)for(let l of e.nodeProps){let c=l[0];typeof c=="string"&&(c=sn[c]);for(let d=1;d<l.length;){let h=l[d++];if(h>=0)i(h,c,l[d++]);else{let m=l[d+-h];for(let g=-h;g>0;g--)i(l[d++],c,m);d++}}}this.nodeSet=new hb(n.map((l,c)=>si.define({name:c>=this.minRepeatTerm?void 0:l,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=Rq;let a=S1(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let l=0;l<this.specializerSpecs.length;l++)this.specialized[l]=this.specializerSpecs[l].term;this.specializers=this.specializerSpecs.map(cA),this.states=S1(e.states,Uint32Array),this.data=S1(e.stateData),this.goto=S1(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(l=>typeof l=="number"?new Bh(a,l):l),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 rme(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++],l=a&1,c=s[i++];if(l&&r)return c;for(let d=i+(a>>1);i<d;i++)if(s[i]==e)return c;if(l)return-1}}hasAction(e,n){let r=this.data;for(let s=0;s<2;s++)for(let i=this.stateSlot(e,s?2:1),a;;i+=3){if((a=r[i])==65535)if(r[i+1]==1)a=r[i=Cl(r,i+2)];else{if(r[i+1]==2)return Cl(r,i+2);break}if(a==n||a==0)return Cl(r,i+1)}return 0}stateSlot(e,n){return this.states[e*6+n]}stateFlag(e,n){return(this.stateSlot(e,0)&n)>0}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=Cl(this.data,i+2);else break;s=n(Cl(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=Cl(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(sp.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(l=>l.from==r.external);if(!i)return r;let a=Object.assign(Object.assign({},r),{external:i.to});return n.specializers[s]=cA(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;i<n.length;i++)if(!r[i])for(let a=this.dialects[n[i]],l;(l=this.data[a++])!=65535;)(s||(s=new Uint8Array(this.maxTerm+1)))[l]=1;return new sme(e,r,s)}static deserialize(e){return new sp(e)}}function Cl(t,e){return t[e]|t[e+1]<<16}function ame(t){let e=null;for(let n of t){let r=n.p.stoppedAt;(n.pos==n.p.stream.end||r!=null&&n.pos>r)&&n.p.parser.stateFlag(n.state,2)&&(!e||e.score<n.score)&&(e=n)}return e}function cA(t){if(t.external){let e=t.extend?1:0;return(n,r)=>t.external(n,r)<<1|e}return t.get}const ome=1,pH=194,gH=195,lme=196,uA=197,cme=198,ume=199,dme=200,hme=2,xH=3,dA=201,fme=24,mme=25,pme=49,gme=50,xme=55,vme=56,yme=57,bme=59,wme=60,Sme=61,kme=62,Ome=63,jme=65,Nme=238,Cme=71,Tme=241,Eme=242,_me=243,Ame=244,Mme=245,Rme=246,Dme=247,Pme=248,vH=72,zme=249,Ime=250,Lme=251,Bme=252,Fme=253,qme=254,$me=255,Hme=256,Qme=73,Vme=77,Ume=263,Wme=112,Gme=130,Xme=151,Yme=152,Kme=155,ud=10,ip=13,B6=32,Sb=9,F6=35,Zme=40,Jme=46,mO=123,hA=125,yH=39,bH=34,fA=92,e0e=111,t0e=120,n0e=78,r0e=117,s0e=85,i0e=new Set([mme,pme,gme,Ume,jme,Gme,vme,yme,Nme,kme,Ome,vH,Qme,Vme,wme,Sme,Xme,Yme,Kme,Wme]);function cS(t){return t==ud||t==ip}function uS(t){return t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102}const a0e=new wb((t,e)=>{let n;if(t.next<0)t.acceptToken(ume);else if(e.context.flags&xv)cS(t.next)&&t.acceptToken(cme,1);else if(((n=t.peek(-1))<0||cS(n))&&e.canShift(uA)){let r=0;for(;t.next==B6||t.next==Sb;)t.advance(),r++;(t.next==ud||t.next==ip||t.next==F6)&&t.acceptToken(uA,-r)}else cS(t.next)&&t.acceptToken(lme,1)},{contextual:!0}),o0e=new wb((t,e)=>{let n=e.context;if(n.flags)return;let r=t.peek(-1);if(r==ud||r==ip){let s=0,i=0;for(;;){if(t.next==B6)s++;else if(t.next==Sb)s+=8-s%8;else break;t.advance(),i++}s!=n.indent&&t.next!=ud&&t.next!=ip&&t.next!=F6&&(s<n.indent?t.acceptToken(gH,-i):t.acceptToken(pH))}}),xv=1,wH=2,Sl=4,kl=8,Ol=16,jl=32;function vv(t,e,n){this.parent=t,this.indent=e,this.flags=n,this.hash=(t?t.hash+t.hash<<8:0)+e+(e<<4)+n+(n<<6)}const l0e=new vv(null,0,0);function c0e(t){let e=0;for(let n=0;n<t.length;n++)e+=t.charCodeAt(n)==Sb?8-e%8:1;return e}const mA=new Map([[Tme,0],[Eme,Sl],[_me,kl],[Ame,kl|Sl],[Mme,Ol],[Rme,Ol|Sl],[Dme,Ol|kl],[Pme,Ol|kl|Sl],[zme,jl],[Ime,jl|Sl],[Lme,jl|kl],[Bme,jl|kl|Sl],[Fme,jl|Ol],[qme,jl|Ol|Sl],[$me,jl|Ol|kl],[Hme,jl|Ol|kl|Sl]].map(([t,e])=>[t,e|wH])),u0e=new ime({start:l0e,reduce(t,e,n,r){return t.flags&xv&&i0e.has(e)||(e==Cme||e==vH)&&t.flags&wH?t.parent:t},shift(t,e,n,r){return e==pH?new vv(t,c0e(r.read(r.pos,n.pos)),0):e==gH?t.parent:e==fme||e==xme||e==bme||e==xH?new vv(t,0,xv):mA.has(e)?new vv(t,0,mA.get(e)|t.flags&xv):t},hash(t){return t.hash}}),d0e=new wb(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==B6||n==Sb)){n!=Zme&&n!=Jme&&n!=ud&&n!=ip&&n!=F6&&t.acceptToken(ome);return}}}),h0e=new wb((t,e)=>{let{flags:n}=e.context,r=n&Sl?bH:yH,s=(n&kl)>0,i=!(n&Ol),a=(n&jl)>0,l=t.pos;for(;!(t.next<0);)if(a&&t.next==mO)if(t.peek(1)==mO)t.advance(2);else{if(t.pos==l){t.acceptToken(xH,1);return}break}else if(i&&t.next==fA){if(t.pos==l){t.advance();let c=t.next;c>=0&&(t.advance(),f0e(t,c)),t.acceptToken(hme);return}break}else if(t.next==fA&&!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==l){t.acceptToken(dA,s?3:1);return}break}else if(t.next==ud){if(s)t.advance();else if(t.pos==l){t.acceptToken(dA);return}break}else t.advance();t.pos>l&&t.acceptToken(dme)});function f0e(t,e){if(e==e0e)for(let n=0;n<2&&t.next>=48&&t.next<=55;n++)t.advance();else if(e==t0e)for(let n=0;n<2&&uS(t.next);n++)t.advance();else if(e==r0e)for(let n=0;n<4&&uS(t.next);n++)t.advance();else if(e==s0e)for(let n=0;n<8&&uS(t.next);n++)t.advance();else if(e==n0e&&t.next==mO){for(t.advance();t.next>=0&&t.next!=hA&&t.next!=yH&&t.next!=bH&&t.next!=ud;)t.advance();t.next==hA&&t.advance()}}const m0e=x6({'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}),p0e={__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},g0e=sp.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'#FyO<POWO,5:aOOQS,5:a,5:aO<[QdO'#HwOOOW'#Dw'#DwOOOW'#Fz'#FzO<lOWO,5:bOOQS,5:b,5:bOOQS'#F}'#F}O<zQtO,5:iO?lQtO,5=`O@VQ#xO,5=`O@vQtO,5=`OOQS,5:},5:}OA_QeO'#GWOBqQdO,5;^OOQV,5=^,5=^OB|QtO'#IPOCkQdO,5;tOOQS-E:[-E:[OOQV,5;s,5;sO4dQdO'#FQOOQV-E9o-E9oOCsQtO,59]OEzQtO,59iOFeQdO'#HVOFpQdO'#HVO1XQdO'#HVOF{QdO'#DTOGTQdO,59mOGYQdO'#HZO'vQdO'#HZO0rQdO,5=tOOQS,5=t,5=tO0rQdO'#EROOQS'#ES'#ESOGwQdO'#GPOHXQdO,58|OHXQdO,58|O*xQdO,5:oOHgQtO'#H]OOQS,5:r,5:rOOQS,5:z,5:zOHzQdO,5;OOI]QdO'#IOO1XQdO'#H}OOQS,5;Q,5;QOOQS'#GT'#GTOIqQtO,5;QOJPQdO,5;QOJUQdO'#IQOOQS,5;T,5;TOJdQdO'#H|OOQS,5;W,5;WOJuQdO,5;YO4iQdO,5;`O4iQdO,5;cOJ}QtO'#ITO'vQdO'#ITOKXQdO,5;eO4VQdO,5;eO0rQdO,5;jO1XQdO,5;lOK^QeO'#EuOLjQgO,5;fO!!kQdO'#IUO4iQdO,5;jO!!vQdO,5;lO!#OQdO,5;qO!#ZQtO,5;vO'vQdO,5;vPOOO,5=[,5=[P!#bOSO,5=[P!#jOdO,5=[O!&bQtO1G.jO!&iQtO1G.jO!)YQtO1G.jO!)dQtO1G.jO!+}QtO1G.jO!,bQtO1G.jO!,uQdO'#HcO!-TQtO'#GuO0rQdO'#HcO!-_QdO'#HbOOQS,5:Z,5:ZO!-gQdO,5:ZO!-lQdO'#HeO!-wQdO'#HeO!.[QdO,5>OOOQS'#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,5<jOOQS,5<j,5<jOOQS-E9|-E9|OOQS,5<r,5<rOOQS-E:U-E:UOOQV1G0x1G0xO1XQdO'#GRO!7dQtO,5>kOOQS1G1`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,5<k,5<kOOQS-E9}-E9}O!9wQdO1G.hOOQS1G0Z1G0ZO!:VQdO,5=wO!:gQdO,5=wO0rQdO1G0jO0rQdO1G0jO!:xQdO,5>jO!;ZQdO,5>jO1XQdO,5>jO!;lQdO,5>iOOQS-E:R-E:RO!;qQdO1G0lO!;|QdO1G0lO!<RQdO,5>lO!<aQdO,5>lO!<oQdO,5>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,5<m,5<mOOQS-E:P-E:POOQS7+&z7+&zOOQS1G3]1G3]OOQS,5<^,5<^OOQS-E9p-E9pOOQS7+$s7+$sO#)bQdO,5=`O#){QdO,5=`O#*^QtO,5<aO#*qQdO1G3cOOQS-E9s-E9sOOQS7+&U7+&UO#+RQdO7+&UO#+aQdO,5<nO#+uQdO1G4UOOQS-E:Q-E:QO#,WQdO1G4UOOQS1G4T1G4TOOQS7+&W7+&WO#,iQdO7+&WOOQS,5<p,5<pO#,tQdO1G4WOOQS-E:S-E:SOOQS,5<l,5<lO#-SQdO1G4SOOQS-E:O-E:OO1XQdO'#EqO#-jQdO'#EqO#-uQdO'#IRO#-}QdO,5;[OOQS7+&`7+&`O0rQdO7+&`O#.SQgO7+&fO!JmQdO'#GXO4iQdO7+&fO4iQdO7+&iO#2QQtO,5<tO'vQdO,5<tO#2[QdO1G4ZOOQS-E:W-E:WO#2fQdO1G4ZO4iQdO7+&kO0rQdO7+&kOOQV7+&p7+&pO!KrQ!fO7+&rO!KzQdO7+&rO`QeO1G0{OOQV-E:X-E:XO4iQdO7+&lO4iQdO7+&lOOQV,5<u,5<uO#2nQdO,5<uO!JmQdO,5<uOOQV7+&l7+&lO#2yQgO7+&lO#6tQdO,5<vO#7PQdO1G4[OOQS-E:Y-E:YO#7^QdO1G4[O#7fQdO'#IWO#7tQdO'#IWO1XQdO'#IWOOQS'#IW'#IWO#8PQdO'#IVOOQS,5;n,5;nO#8XQdO,5;nO0rQdO'#FUOOQV7+&r7+&rO4iQdO7+&rOOQV7+&w7+&wO4iQdO7+&wO#8^QfO,5;xOOQV7+&|7+&|POOO7+(b7+(bO#8cQdO1G3iOOQS,5<c,5<cO#8qQdO1G3hOOQS-E9u-E9uO#9UQdO,5<dO#9aQdO,5<dO#9tQdO1G3kOOQS-E9v-E9vO#:UQdO1G3kO#:^QdO1G3kO#:nQdO1G3kO#:UQdO1G3kOOQS<<H[<<H[O#:yQtO1G1zOOQS<<Hk<<HkP#;WQdO'#FtO8vQdO1G3bO#;eQdO1G3bO#;jQdO<<HkOOQS<<Hl<<HlO#;zQdO7+)QOOQS<<Hs<<HsO#<[QtO1G1yP#<{QdO'#FsO#=YQdO7+)RO#=jQdO7+)RO#=rQdO<<HwO#=wQdO7+({OOQS<<Hy<<HyO#>nQdO,5<bO'vQdO,5<bOOQS-E9t-E9tOOQS<<Hw<<HwOOQS,5<g,5<gO0rQdO,5<gO#>sQdO1G4OOOQS-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<<IpO1XQdO1G2YP1XQdO'#GSO#AOQdO7+)pO#AaQdO7+)pOOQS<<Ir<<IrP1XQdO'#GUP0rQdO'#GQOOQS,5;],5;]O#ArQdO,5>mO#BQQdO,5>mOOQS1G0v1G0vOOQS<<Iz<<IzOOQV-E:V-E:VO4iQdO<<JQOOQV,5<s,5<sO4iQdO,5<sOOQV<<JQ<<JQOOQV<<JT<<JTO#BYQtO1G2`P#BdQdO'#GYO#BkQdO7+)uO#BuQgO<<JVO4iQdO<<JVOOQV<<J^<<J^O4iQdO<<J^O!KrQ!fO<<J^O#FpQgO7+&gOOQV<<JW<<JWO#FzQgO<<JWOOQV1G2a1G2aO1XQdO1G2aO#JuQdO1G2aO4iQdO<<JWO1XQdO1G2bP0rQdO'#G[O#KQQdO7+)vO#K_QdO7+)vOOQS'#FT'#FTO0rQdO,5>rO#KgQdO,5>rO#KrQdO,5>rO#K}QdO,5>qO#L`QdO,5>qOOQS1G1Y1G1YOOQS,5;p,5;pOOQV<<Jc<<JcO#LhQdO1G1dOOQS7+)T7+)TP#LmQdO'#FwO#L}QdO1G2OO#MbQdO1G2OO#MrQdO1G2OP#M}QdO'#FxO#N[QdO7+)VO#NlQdO7+)VO#NlQdO7+)VO#NtQdO7+)VO$ UQdO7+(|O8vQdO7+(|OOQSAN>VAN>VO$ oQdO<<LmOOQSAN>cAN>cO0rQdO1G1|O$!PQtO1G1|P$!ZQdO'#FvOOQS1G2R1G2RP$!hQdO'#F{O$!uQdO7+)jO$#`QdO,5>gOOOO-E9z-E9zOOOW<<MT<<MTO$#nQdO7+(fOOQSAN?[AN?[OOQS7+'t7+'tO$$XQdO<<M[OOQS,5<q,5<qO$$jQdO1G4XOOQS-E:T-E:TOOQVAN?lAN?lOOQV1G2_1G2_O4iQdOAN?qO$$xQgOAN?qOOQVAN?xAN?xO4iQdOAN?xOOQV<<JR<<JRO4iQdOAN?rO4iQdO7+'{OOQV7+'{7+'{O1XQdO7+'{OOQVAN?rAN?rOOQS7+'|7+'|O$(sQdO<<MbOOQS1G4^1G4^O0rQdO1G4^OOQS,5<w,5<wO$)QQdO1G4]OOQS-E:Z-E:ZOOQU'#G_'#G_O$)cQfO7+'OO$)nQdO'#F_O$*uQdO7+'jO$+VQdO7+'jOOQS7+'j7+'jO$+bQdO<<LqO$+rQdO<<LqO$+rQdO<<LqO$+zQdO'#H^OOQS<<Lh<<LhO$,UQdO<<LhOOQS7+'h7+'hOOQS'#D|'#D|OOOO1G4R1G4RO$,oQdO1G4RO$,wQdO1G4RP!=hQdO'#GVOOQVG25]G25]O4iQdOG25]OOQVG25dG25dOOQVG25^G25^OOQV<<Kg<<KgO4iQdO<<KgOOQS7+)x7+)xP$-SQdO'#G]OOQU-E:]-E:]OOQV<<Jj<<JjO$-vQtO'#FaOOQS'#Fc'#FcO$.WQdO'#FbO$.xQdO'#FbOOQS'#Fb'#FbO$.}QdO'#IYO$)nQdO'#FiO$)nQdO'#FiO$/fQdO'#FjO$)nQdO'#FkO$/mQdO'#IZOOQS'#IZ'#IZO$0[QdO,5;yOOQS<<KU<<KUO$0dQdO<<KUO$0tQdOANB]O$1UQdOANB]O$1^QdO'#H_OOQS'#H_'#H_O1sQdO'#DcO$1wQdO,5=xOOQSANBSANBSOOOO7+)m7+)mO$2`QdO7+)mOOQVLD*wLD*wOOQVANARANARO5uQ!fO'#GaO$2hQtO,5<SO$)nQdO'#FmOOQS,5<W,5<WOOQS'#Fd'#FdO$3YQdO,5;|O$3_QdO,5;|OOQS'#Fg'#FgO$)nQdO'#G`O$4PQdO,5<QO$4kQdO,5>tO$4{QdO,5>tO1XQdO,5<PO$5^QdO,5<TO$5cQdO,5<TO$)nQdO'#I[O$5hQdO'#I[O$5mQdO,5<UOOQS,5<V,5<VO0rQdO'#FpOOQU1G1e1G1eO4iQdO1G1eOOQSAN@pAN@pO$5rQdOG27wO$6SQdO,59}OOQS1G3d1G3dOOOO<<MX<<MXOOQS,5<{,5<{OOQS-E:_-E:_O$6XQtO'#FaO$6`QdO'#I]O$6nQdO'#I]O$6vQdO,5<XOOQS1G1h1G1hO$6{QdO1G1hO$7QQdO,5<zOOQS-E:^-E:^O$7lQdO,5=OO$8TQdO1G4`OOQS-E:b-E:bOOQS1G1k1G1kOOQS1G1o1G1oO$8eQdO,5>vO$)nQdO,5>vOOQS1G1p1G1pOOQS,5<[,5<[OOQU7+'P7+'PO$+zQdO1G/iO$)nQdO,5<YO$8sQdO,5>wO$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,5<ZP$)nQdO'#GcO$;XQdO1G2hO$)nQdO1G2hP$;gQdO'#GbO$;nQdO<<MhO$;xQdO1G1uO$<WQdO7+(SO8vQdO'#C}O8vQdO,59bO8vQdO,59bO8vQdO,59bO$<fQtO,5=`O8vQdO1G.|O0rQdO1G/XO0rQdO7+$pP$<yQdO'#GOO'vQdO'#GtO$=WQdO,59bO$=]QdO,59bO$=dQdO,59mO$=iQdO1G/UO1sQdO'#DRO8vQdO,59j",stateData:"$>S~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!;|!<S!<VP!<_!<h!=d!=g]eOn#g$j)t,P'}`OTYZ[adnoprtxy}!P!Q!R!U!X!c!d!e!f!g!h!i!k!o!p!q!s!t!z#O#S#T#[#d#g#x#y#{#}$Q$e$g$h$j$q$}%S%Z%^%`%c%g%l%n%w%|&O&Z&_&h&j&k&u&x&|'P'W'Z'l'm'p'r's'w'|(O(S(W(](^(d(g(p(r(z(})^)e)g)k)l)p)t)z*O*Y*d*g*h*k*q*r*t*v*y*z*}+Q+U+V+Y+a+c+d+k+x+y,P,X,Y,],g,h,i,k,l,o,q,s,u,w,y,z-O-d-f-m-p-s.f.g/V/Z/s0c0d0e0f0h0i0j0k0l0n0r{!cQ#c#p$R$d$p%e%j%p%q&`'O'g(q(|)j*o*x+w,v0g}!dQ#c#p$R$d$p$u%e%j%p%q&`'O'g(q(|)j*o*x+w,v0g!P!eQ#c#p$R$d$p$u$v%e%j%p%q&`'O'g(q(|)j*o*x+w,v0g!R!fQ#c#p$R$d$p$u$v$w%e%j%p%q&`'O'g(q(|)j*o*x+w,v0g!T!gQ#c#p$R$d$p$u$v$w$x%e%j%p%q&`'O'g(q(|)j*o*x+w,v0g!V!hQ#c#p$R$d$p$u$v$w$x$y%e%j%p%q&`'O'g(q(|)j*o*x+w,v0g!Z!hQ!n#c#p$R$d$p$u$v$w$x$y$z%e%j%p%q&`'O'g(q(|)j*o*x+w,v0g'}TOTYZ[adnoprtxy}!P!Q!R!U!X!c!d!e!f!g!h!i!k!o!p!q!s!t!z#O#S#T#[#d#g#x#y#{#}$Q$e$g$h$j$q$}%S%Z%^%`%c%g%l%n%w%|&O&Z&_&h&j&k&u&x&|'P'W'Z'l'm'p'r's'w'|(O(S(W(](^(d(g(p(r(z(})^)e)g)k)l)p)t)z*O*Y*d*g*h*k*q*r*t*v*y*z*}+Q+U+V+Y+a+c+d+k+x+y,P,X,Y,],g,h,i,k,l,o,q,s,u,w,y,z-O-d-f-m-p-s.f.g/V/Z/s0c0d0e0f0h0i0j0k0l0n0r&eVOYZ[dnprxy}!P!Q!U!i!k!o!p!q!s!t#[#d#g#y#{#}$Q$h$j$}%S%Z%^%`%g%l%n%w%|&Z&_&j&k&u&x'P'W'Z'l'm'p'r's'w(O(W(^(d(g(p(r(z)^)e)g)p)t)z*O*Y*d*g*h*k*q*r*t*v*y*z*}+U+V+Y+a+d+k,P,X,Y,],g,h,i,k,l,o,q,s,u,w,y,z-O-d-f-m-p-s.f.g/V/Z/s0c0d0e0f0h0i0j0k0n0r%oXOYZ[dnrxy}!P!Q!U!i!k#[#d#g#y#{#}$Q$h$j$}%S%^%`%g%l%n%w%|&Z&_&j&k&u&x'P'W'Z'l'm'p'r's'w(O(W(^(d(g(p(r(z)^)e)g)p)t)z*O*Y*d*g*h*k*q*t*v*y*z*}+U+V+Y+a+d+k,P,X,Y,],g,h,i,k,l,o,s,u,w,y,z-O-d-f-m-p.f.g/V/Z0i0j0kQ#vqQ/[.kR0o0q't`OTYZ[adnoprtxy}!P!Q!R!U!X!c!d!e!f!g!h!k!o!p!q!s!t!z#O#S#T#[#d#g#x#y#{#}$Q$e$g$h$j$q$}%S%Z%^%`%c%g%l%n%w%|&O&Z&_&h&j&k&u&x&|'P'W'Z'l'p'r's'w'|(O(S(W(](^(d(g(p(r(z(})^)e)g)k)l)p)t)z*O*Y*g*h*k*q*r*t*v*y*z*}+Q+U+V+Y+a+c+d+k+x+y,P,X,Y,],h,i,k,l,o,q,s,u,w,y,z-O-d-f-m-p-s.f.g/V/Z/s0c0d0e0f0h0i0j0k0l0n0rh#jhz{$W$Z&l&q)S)X+f+g-RW#rq&].k0qQ$]|Q$a!OQ$n!VQ$o!WW$|!i'm*d,gS&[#s#tQ'S$iQ(s&UQ)U&nU)Y&s)Z+jW)a&w+m-T-{Q*Q']W*R'_,`-h.TQ+l)`S,_*S*TQ-Q+eQ-_,TQ-c,WQ.R-al.W-l.^._.a.z.|/R/j/o/t/y0U0Z0^Q/S.`Q/a.tQ/l/OU0P/u0S0[X0V/z0W0_0`R&Z#r!_!wYZ!P!Q!k%S%`%g'p'r's(O(W)g*g*h*k*q*t*v,h,i,k,l,o-m-p.f.g/ZR%^!vQ!{YQ%x#[Q&d#}Q&g$QR,{+YT.j-s/s!Y!jQ!n#c#p$R$d$p$u$v$w$x$y$z%e%j%p%q&`'O'g(q(|)j*o*x+w,v0gQ&X#kQ'c$oR*^'dR'l$|Q%V!mR/_.r'|_OTYZ[adnoprtxy}!P!Q!R!U!X!c!d!e!f!g!h!i!k!o!p!q!s!t!z#O#S#T#[#d#g#x#y#{#}$Q$e$g$h$j$q$}%S%Z%^%`%c%g%l%n%w%|&O&Z&_&h&j&k&u&x&|'P'W'Z'l'm'p'r's'w'|(O(S(W(](^(d(g(p(r(z(})^)e)g)k)l)p)t)z*O*Y*d*g*h*k*q*r*t*v*y*z*}+Q+U+V+Y+a+c+d+k+x+y,P,X,Y,],g,h,i,k,l,o,q,s,u,w,y,z-O-d-f-m-p-s.f.g/V/Z/s0c0d0e0f0h0i0j0k0l0n0rS#a_#b!P.[-l.^._.`.a.t.z.|/R/j/o/t/u/y/z0S0U0W0Z0[0^0_0`'|_OTYZ[adnoprtxy}!P!Q!R!U!X!c!d!e!f!g!h!i!k!o!p!q!s!t!z#O#S#T#[#d#g#x#y#{#}$Q$e$g$h$j$q$}%S%Z%^%`%c%g%l%n%w%|&O&Z&_&h&j&k&u&x&|'P'W'Z'l'm'p'r's'w'|(O(S(W(](^(d(g(p(r(z(})^)e)g)k)l)p)t)z*O*Y*d*g*h*k*q*r*t*v*y*z*}+Q+U+V+Y+a+c+d+k+x+y,P,X,Y,],g,h,i,k,l,o,q,s,u,w,y,z-O-d-f-m-p-s.f.g/V/Z/s0c0d0e0f0h0i0j0k0l0n0rT#a_#bT#^^#_R(o%xa(l%x(n(o+`,{-y-z.oT+[(k+]R-z,{Q$PsQ+l)aQ,^*RR-e,_X#}s$O$P&fQ&y$aQ'a$nQ'd$oR)s'SQ)b&wV-S+m-T-{ZgOn$j)t,PXkOn)t,PQ$k!TQ&z$bQ&{$cQ'^$mQ'b$oQ)q'RQ)x'WQ){'XQ)|'YQ*Z'`S*]'c'dQ+s)gQ+u)hQ+v)iQ+z)oS+|)r*[Q,Q)vQ,R)wS,S)y)zQ,d*^Q-V+rQ-W+tQ-Y+{S-Z+},OQ-`,UQ-b,VQ-|-XQ.O-[Q.P-^Q.Q-_Q.p-}Q.q.RQ/W.dR/r/XWkOn)t,PR#mjQ'`$nS)r'S'aR,O)sQ,]*RR-f,^Q*['`Q+})rR-[,OZiOjn)t,PQ'f$pR*`'gT-j,e-ku.c-l.^._.a.t.z.|/R/j/o/t/u/y0S0U0Z0[0^t.c-l.^._.a.t.z.|/R/j/o/t/u/y0S0U0Z0[0^Q/S.`X0V/z0W0_0`!P.Z-l.^._.`.a.t.z.|/R/j/o/t/u/y/z0S0U0W0Z0[0^0_0`Q.w.YR/f.xg.z.].{/b/i/n/|0O0Q0]0a0bu.b-l.^._.a.t.z.|/R/j/o/t/u/y0S0U0Z0[0^X.u.W.b/a0PR/c.tV0R/u0S0[R/X.dQnOS#on,PR,P)tQ&^#uR(x&^S%m#R#wS(_%m(bT(b%p&`Q%a!yQ%h!}W(P%a%h(U(YQ(U%eR(Y%jQ&i$RR)O&iQ(e%qQ*{(`T+R(e*{Q'n%OR*e'nS'q%R%SY*i'q*j,m-q.hU*j'r's'tU,m*k*l*mS-q,n,oR.h-rQ#Y]R%t#YQ#_^R%y#_Q(h%vS+W(h+XR+X(iQ+](kR,|+]Q#b_R%{#bQ#ebQ%}#cW&Q#e%}({+bQ({&cR+b0gQ$OsS&e$O&fR&f$PQ&v$_R)_&vQ&V#jR(t&VQ&m$VS)T&m+hR+h)UQ$Z{R&p$ZQ&t$]R)[&tQ+n)bR-U+nQ#hfR&S#hQ)f&zR+q)fQ&}$dS)m&})nR)n'OQ'V$kR)u'VQ'[$lS*P'[,ZR,Z*QQ,a*VR-i,aWjOn)t,PR#ljQ-k,eR.U-kd.{.]/b/i/n/|0O0Q0]0a0bR/h.{U.s.W/a0PR/`.sQ/{/nS0X/{0YR0Y/|S/v/b/cR0T/vQ.}.]R/k.}R!ZPXmOn)t,PWlOn)t,PR'T$jYfOn$j)t,PR&R#g[sOn#g$j)t,PR&d#}&dQOYZ[dnprxy}!P!Q!U!i!k!o!p!q!s!t#[#d#g#y#{#}$Q$h$j$}%S%Z%^%`%g%l%n%w%|&Z&_&j&k&u&x'P'W'Z'l'm'p'r's'w(O(W(^(d(g(p(r(z)^)e)g)p)t)z*O*Y*d*g*h*k*q*r*t*v*y*z*}+U+V+Y+a+d+k,P,X,Y,],g,h,i,k,l,o,q,s,u,w,y,z-O-d-f-m-p-s.f.g/V/Z/s0c0d0e0f0h0i0j0k0n0rQ!nTQ#caQ#poU$Rt%c(SS$d!R$gQ$p!XQ$u!cQ$v!dQ$w!eQ$x!fQ$y!gQ$z!hQ%e!zQ%j#OQ%p#SQ%q#TQ&`#xQ'O$eQ'g$qQ(q&OU(|&h(}+cW)j&|)l+x+yQ*o'|Q*x(]Q+w)kQ,v+QR0g0lQ!yYQ!}ZQ$b!PQ$c!QQ%R!kQ't%S^'{%`%g(O(W*q*t*v^*f'p*h,k,l-p.g/ZQ*l'rQ*m'sQ+t)gQ,j*gQ,n*kQ-n,hQ-o,iQ-r,oQ.e-mR/Y.f[bOn#g$j)t,P!^!vYZ!P!Q!k%S%`%g'p'r's(O(W)g*g*h*k*q*t*v,h,i,k,l,o-m-p.f.g/ZQ#R[Q#fdS#wrxQ$UyW$_}$Q'P)pS$l!U$hW${!i'm*d,gS%v#[+Y`&P#d%|(p(r(z+a-O0kQ&a#yQ&b#{Q&c#}Q'j$}Q'z%^W([%l(^*y*}Q(`%nQ(i%wQ(v&ZS(y&_0iQ)P&jQ)Q&kU)]&u)^+kQ)d&xQ)y'WY)}'Z*O,X,Y-dQ*b'lS*n'w0jW+P(d*z,s,wW+T(g+V,y,zQ+p)eQ,U)zQ,c*YQ,x+UQ-P+dQ-e,]Q-v,uQ.S-fR/q/VhUOn#d#g$j%|&_'w(p(r)t,P%U!uYZ[drxy}!P!Q!U!i!k#[#y#{#}$Q$h$}%S%^%`%g%l%n%w&Z&j&k&u&x'P'W'Z'l'm'p'r's(O(W(^(d(g(z)^)e)g)p)z*O*Y*d*g*h*k*q*t*v*y*z*}+U+V+Y+a+d+k,X,Y,],g,h,i,k,l,o,s,u,w,y,z-O-d-f-m-p.f.g/V/Z0i0j0kQ#qpW%W!o!s0d0nQ%X!pQ%Y!qQ%[!tQ%f0cS'v%Z0hQ'x0eQ'y0fQ,p*rQ-u,qS.i-s/sR0p0rU#uq.k0qR(w&][cOn#g$j)t,PZ!xY#[#}$Q+YQ#W[Q#zrR$TxQ%b!yQ%i!}Q%o#RQ'j${Q(V%eQ(Z%jQ(c%pQ(f%qQ*|(`Q,f*bQ-t,pQ.m-uR/].lQ$StQ(R%cR*s(SQ.l-sR/}/sR#QZR#V[R%Q!iQ%O!iV*c'm*d,g!Z!lQ!n#c#p$R$d$p$u$v$w$x$y$z%e%j%p%q&`'O'g(q(|)j*o*x+w,v0gR%T!kT#]^#_Q%x#[R,{+YQ(m%xS+_(n(oQ,}+`Q-x,{S.n-y-zR/^.oT+Z(k+]Q$`}Q&g$QQ)o'PR+{)pQ$XzQ)W&qR+i)XQ$XzQ&o$WQ)W&qR+i)XQ#khW$Vz$W&q)XQ$[{Q&r$ZZ)R&l)S+f+g-RR$^|R)c&wXlOn)t,PQ$f!RR'Q$gQ$m!UR'R$hR*X'_Q*V'_V-g,`-h.TQ.d-lQ/P.^R/Q._U.]-l.^._Q/U.aQ/b.tQ/g.zU/i.|/j/yQ/n/RQ/|/oQ0O/tU0Q/u0S0[Q0]0UQ0a0ZR0b0^R/T.`R/d.t",nodeNames:"⚠ print Escape { Comment Script AssignStatement * BinaryExpression BitOp BitOp BitOp BitOp ArithOp ArithOp @ ArithOp ** UnaryExpression ArithOp BitOp AwaitExpression await ) ( ParenthesizedExpression BinaryExpression or and CompareOp in not is UnaryExpression ConditionalExpression if else LambdaExpression lambda ParamList VariableName AssignOp , : NamedExpression AssignOp YieldExpression yield from TupleExpression ComprehensionExpression async for LambdaExpression ] [ ArrayExpression ArrayComprehensionExpression } { DictionaryExpression DictionaryComprehensionExpression SetExpression SetComprehensionExpression CallExpression ArgList AssignOp MemberExpression . PropertyName Number String FormatString FormatReplacement FormatSelfDoc FormatConversion FormatSpec FormatReplacement FormatSelfDoc ContinuedString Ellipsis None Boolean TypeDef AssignOp UpdateStatement UpdateOp ExpressionStatement DeleteStatement del PassStatement pass BreakStatement break ContinueStatement continue ReturnStatement return YieldStatement PrintStatement RaiseStatement raise ImportStatement import as ScopeStatement global nonlocal AssertStatement assert TypeDefinition type TypeParamList TypeParam StatementGroup ; IfStatement Body elif WhileStatement while ForStatement TryStatement try except finally WithStatement with FunctionDefinition def ParamList AssignOp TypeDef ClassDefinition class DecoratedStatement Decorator At MatchStatement match MatchBody MatchClause case CapturePattern LiteralPattern ArithOp ArithOp AsPattern OrPattern LogicOp AttributePattern SequencePattern MappingPattern StarPattern ClassPattern PatternArgList KeywordPattern KeywordPattern Guard",maxTerm:277,context:u0e,nodeProps:[["isolate",-5,4,71,72,73,77,""],["group",-15,6,85,87,88,90,92,94,96,98,99,100,102,105,108,110,"Statement Statement",-22,8,18,21,25,40,49,50,56,57,60,61,62,63,64,67,70,71,72,79,80,81,82,"Expression",-10,114,116,119,121,122,126,128,133,135,138,"Statement",-9,143,144,147,148,150,151,152,153,154,"Pattern"],["openedBy",23,"(",54,"[",58,"{"],["closedBy",24,")",55,"]",59,"}"]],propSources:[m0e],skippedNodes:[0,4],repeatNodeCount:34,tokenData:"!2|~R!`OX%TXY%oY[%T[]%o]p%Tpq%oqr'ars)Yst*xtu%Tuv,dvw-hwx.Uxy/tyz0[z{0r{|2S|}2p}!O3W!O!P4_!P!Q:Z!Q!R;k!R![>_![!]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:[d0e,o0e,a0e,h0e,0,1,2,3,4],topRules:{Script:[0,5]},specialized:[{term:221,get:t=>p0e[t]||-1}],tokenPrec:7668}),pA=new Rce,SH=new Set(["Script","Body","FunctionDefinition","ClassDefinition","LambdaExpression","ForStatement","MatchClause"]);function k1(t){return(e,n,r)=>{if(r)return!1;let s=e.node.getChild("VariableName");return s&&n(s,t),!0}}const x0e={FunctionDefinition:k1("function"),ClassDefinition:k1("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:k1("variable"),AsPattern:k1("variable"),__proto__:null};function kH(t,e){let n=pA.get(e);if(n)return n;let r=[],s=!0;function i(a,l){let c=t.sliceString(a.from,a.to);r.push({label:c,type:l})}return e.cursor(hs.IncludeAnonymous).iterate(a=>{if(a.name){let l=x0e[a.name];if(l&&l(a,i,s)||!s&&SH.has(a.name))return!1;s=!1}else if(a.to-a.from>8192){for(let l of kH(t,a.node))r.push(l);return!1}}),pA.set(e,r),r}const gA=/^[\w\xa1-\uffff][\w\d\xa1-\uffff]*$/,OH=["String","FormatString","Comment","PropertyName"];function v0e(t){let e=Ss(t.state).resolveInner(t.pos,-1);if(OH.indexOf(e.name)>-1)return null;let n=e.name=="VariableName"||e.to-e.from<20&&gA.test(t.state.sliceDoc(e.from,e.to));if(!n&&!t.explicit)return null;let r=[];for(let s=e;s;s=s.parent)SH.has(s.name)&&(r=r.concat(kH(t.state.doc,s)));return{options:r,from:n?e.from:t.pos,validFor:gA}}const y0e=["__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"}))),b0e=[vl("def ${name}(${params}):\n ${}",{label:"def",detail:"function",type:"keyword"}),vl("for ${name} in ${collection}:\n ${}",{label:"for",detail:"loop",type:"keyword"}),vl("while ${}:\n ${}",{label:"while",detail:"loop",type:"keyword"}),vl("try:\n ${}\nexcept ${error}:\n ${}",{label:"try",detail:"/ except block",type:"keyword"}),vl(`if \${}:
`,{label:"if",detail:"block",type:"keyword"}),vl("if ${}:\n ${}\nelse:\n ${}",{label:"if",detail:"/ else block",type:"keyword"}),vl("class ${name}:\n def __init__(self, ${params}):\n ${}",{label:"class",detail:"definition",type:"keyword"}),vl("import ${module}",{label:"import",detail:"statement",type:"keyword"}),vl("from ${module} import ${names}",{label:"from",detail:"import",type:"keyword"})],w0e=khe(OH,Z$(y0e.concat(b0e)));function dS(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 hS(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.to<s+100&&!/\S/.test(t.state.sliceDoc(s,t.node.to))&&t.lineIndent(t.pos,-1)<=n||/^\s*(else:|elif |except |finally:|case\s+[^=:]+:)/.test(t.textAfter)&&t.lineIndent(t.pos,-1)>n?null:n+t.unit}const fS=X0.define({name:"python",parser:g0e.configure({props:[mb.add({Body:t=>{var e;let n=/^\s*(#|$)/.test(t.textAfter)&&dS(t)||t.node;return(e=hS(t,n))!==null&&e!==void 0?e:t.continue()},MatchBody:t=>{var e;let n=dS(t);return(e=hS(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":X4({closing:")"}),"DictionaryExpression DictionaryComprehensionExpression SetExpression SetComprehensionExpression":X4({closing:"}"}),"ArrayExpression ArrayComprehensionExpression":X4({closing:"]"}),MemberExpression:t=>t.baseIndent+t.unit,"String FormatString":()=>null,Script:t=>{var e;let n=dS(t);return(e=n&&hS(t,n))!==null&&e!==void 0?e:t.continue()}}),b6.add({"ArrayExpression DictionaryExpression SetExpression TupleExpression":Qq,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 S0e(){return new qq(fS,[fS.data.of({autocomplete:v0e}),fS.data.of({autocomplete:w0e})])}const k0e=x6({String:ve.string,Number:ve.number,"True False":ve.bool,PropertyName:ve.propertyName,Null:ve.null,", :":ve.separator,"[ ]":ve.squareBracket,"{ }":ve.brace}),O0e=sp.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:[k0e],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}),j0e=()=>t=>{try{JSON.parse(t.state.doc.toString())}catch(e){if(!(e instanceof SyntaxError))throw e;const n=N0e(e,t.state.doc);return[{from:n,message:e.message,severity:"error",to:n}]}return[]};function N0e(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 C0e=X0.define({name:"json",parser:O0e.configure({props:[mb.add({Object:x_({except:/^\s*\}/}),Array:x_({except:/^\s*\]/})}),b6.add({"Object Array":Qq})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function T0e(){return new qq(C0e)}const E0e={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:"#"}}},_0e={python:[S0e()],json:[T0e(),j0e()],toml:[w6.define(E0e)],text:[]};function A0e({value:t,onChange:e,language:n="text",readOnly:r=!1,height:s="400px",minHeight:i,maxHeight:a,placeholder:l,theme:c="dark",className:d=""}){const[h,m]=b.useState(!1);if(b.useEffect(()=>{m(!0)},[]),!h)return o.jsx("div",{className:`rounded-md border bg-muted animate-pulse ${d}`,style:{height:s,minHeight:i,maxHeight:a}});const g=[..._0e[n]||[],Ze.lineWrapping];return r&&g.push(Ze.editable.of(!1)),o.jsx("div",{className:`rounded-md overflow-hidden border ${d}`,children:o.jsx(mH,{value:t,height:s,minHeight:i,maxHeight:a,theme:c==="dark"?fH:void 0,extensions:g,onChange:e,placeholder:l,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 M0e(){const[t,e]=b.useState(!0),[n,r]=b.useState(!1),[s,i]=b.useState(!1),[a,l]=b.useState(!1),[c,d]=b.useState(!1),[h,m]=b.useState(!1),[g,x]=b.useState("visual"),[y,w]=b.useState(""),[S,k]=b.useState(!1),{toast:j}=as(),[N,T]=b.useState(null),[E,_]=b.useState(null),[A,L]=b.useState(null),[P,B]=b.useState(null),[$,U]=b.useState(null),[te,z]=b.useState(null),[Q,F]=b.useState(null),[Y,J]=b.useState(null),[X,R]=b.useState(null),[ie,G]=b.useState(null),[I,V]=b.useState(null),[ee,ne]=b.useState(null),[W,se]=b.useState(null),[re,oe]=b.useState(null),[Te,We]=b.useState(null),[Ye,Je]=b.useState(null),[Oe,Ve]=b.useState(null),[Ue,He]=b.useState(null),Ot=b.useRef(null),xt=b.useRef(!0),kn=b.useRef({}),It=b.useCallback(async()=>{try{const Fe=await bae();w(Fe),k(!1)}catch(Fe){j({variant:"destructive",title:"加载失败",description:Fe instanceof Error?Fe.message:"加载源代码失败"})}},[j]),Yt=b.useCallback(async()=>{try{e(!0);const Fe=await iE();kn.current=Fe,T(Fe.bot),_(Fe.personality);const rt=Fe.chat;rt.talk_value_rules||(rt.talk_value_rules=[]),L(rt),B(Fe.expression),U(Fe.emoji),z(Fe.memory),F(Fe.tool),J(Fe.mood),R(Fe.voice),G(Fe.lpmm_knowledge),V(Fe.keyword_reaction),ne(Fe.response_post_process),se(Fe.chinese_typo),oe(Fe.response_splitter),We(Fe.log),Je(Fe.debug),Ve(Fe.maim_message),He(Fe.telemetry),l(!1),xt.current=!1,await It()}catch(Fe){console.error("加载配置失败:",Fe),j({title:"加载失败",description:"无法加载配置文件",variant:"destructive"})}finally{e(!1)}},[j,It]);b.useEffect(()=>{Yt()},[Yt]);const _t=b.useCallback(async(Fe,rt)=>{if(!xt.current)try{i(!0),await Sae(Fe,rt),l(!1)}catch(tn){console.error(`自动保存 ${Fe} 失败:`,tn),l(!0)}finally{i(!1)}},[]),mt=b.useCallback((Fe,rt)=>{xt.current||(l(!0),Ot.current&&clearTimeout(Ot.current),Ot.current=setTimeout(()=>{_t(Fe,rt)},2e3))},[_t]);b.useEffect(()=>{N&&!xt.current&&mt("bot",N)},[N,mt]),b.useEffect(()=>{E&&!xt.current&&mt("personality",E)},[E,mt]),b.useEffect(()=>{A&&!xt.current&&mt("chat",A)},[A,mt]),b.useEffect(()=>{P&&!xt.current&&mt("expression",P)},[P,mt]),b.useEffect(()=>{$&&!xt.current&&mt("emoji",$)},[$,mt]),b.useEffect(()=>{te&&!xt.current&&mt("memory",te)},[te,mt]),b.useEffect(()=>{Q&&!xt.current&&mt("tool",Q)},[Q,mt]),b.useEffect(()=>{Y&&!xt.current&&mt("mood",Y)},[Y,mt]),b.useEffect(()=>{X&&!xt.current&&mt("voice",X)},[X,mt]),b.useEffect(()=>{ie&&!xt.current&&mt("lpmm_knowledge",ie)},[ie,mt]),b.useEffect(()=>{I&&!xt.current&&mt("keyword_reaction",I)},[I,mt]),b.useEffect(()=>{ee&&!xt.current&&mt("response_post_process",ee)},[ee,mt]),b.useEffect(()=>{W&&!xt.current&&mt("chinese_typo",W)},[W,mt]),b.useEffect(()=>{re&&!xt.current&&mt("response_splitter",re)},[re,mt]),b.useEffect(()=>{Te&&!xt.current&&mt("log",Te)},[Te,mt]),b.useEffect(()=>{Ye&&!xt.current&&mt("debug",Ye)},[Ye,mt]),b.useEffect(()=>{Oe&&!xt.current&&mt("maim_message",Oe)},[Oe,mt]),b.useEffect(()=>{Ue&&!xt.current&&mt("telemetry",Ue)},[Ue,mt]);const Ne=async()=>{try{r(!0),await wae(y),l(!1),k(!1),j({title:"保存成功",description:"配置已保存"}),await Yt()}catch(Fe){k(!0),j({variant:"destructive",title:"保存失败",description:Fe instanceof Error?Fe.message:"保存配置失败"})}finally{r(!1)}},Ie=async Fe=>{if(a){j({variant:"destructive",title:"切换失败",description:"请先保存当前更改"});return}if(x(Fe),Fe==="source")await It();else try{const rt=await iE();kn.current=rt,T(rt.bot),_(rt.personality);const tn=rt.chat;tn.talk_value_rules||(tn.talk_value_rules=[]),L(tn),B(rt.expression),U(rt.emoji),z(rt.memory),F(rt.tool),J(rt.mood),R(rt.voice),G(rt.lpmm_knowledge),V(rt.keyword_reaction),ne(rt.response_post_process),se(rt.chinese_typo),oe(rt.response_splitter),We(rt.log),Je(rt.debug),Ve(rt.maim_message),He(rt.telemetry),l(!1)}catch(rt){console.error("加载配置失败:",rt),j({title:"加载失败",description:"无法加载配置文件",variant:"destructive"})}},st=async()=>{try{r(!0),Ot.current&&clearTimeout(Ot.current);const Fe={...kn.current,bot:N,personality:E,chat:A,expression:P,emoji:$,memory:te,tool:Q,mood:Y,voice:X,lpmm_knowledge:ie,keyword_reaction:I,response_post_process:ee,chinese_typo:W,response_splitter:re,log:Te,debug:Ye,maim_message:Oe,telemetry:Ue};await aE(Fe),l(!1),j({title:"保存成功",description:"麦麦主程序配置已保存"})}catch(Fe){console.error("保存配置失败:",Fe),j({title:"保存失败",description:Fe.message,variant:"destructive"})}finally{r(!1)}},yt=async()=>{try{d(!0),ib().catch(()=>{}),m(!0)}catch(Fe){console.error("重启失败:",Fe),m(!1),j({title:"重启失败",description:"无法发送重启请求,请手动重启",variant:"destructive"}),d(!1)}},Pt=async()=>{try{r(!0),Ot.current&&clearTimeout(Ot.current);const Fe={...kn.current,bot:N,personality:E,chat:A,expression:P,emoji:$,memory:te,tool:Q,mood:Y,voice:X,lpmm_knowledge:ie,keyword_reaction:I,response_post_process:ee,chinese_typo:W,response_splitter:re,log:Te,debug:Ye,maim_message:Oe,telemetry:Ue};await aE(Fe),l(!1),j({title:"保存成功",description:"配置已保存,即将重启麦麦..."}),await new Promise(rt=>setTimeout(rt,500)),await yt()}catch(Fe){console.error("保存失败:",Fe),j({title:"保存失败",description:Fe.message,variant:"destructive"})}finally{r(!1)}},Mt=()=>{localStorage.removeItem("access-token"),window.location.href="/auth"},zn=()=>{m(!1),d(!1),j({title:"重启失败",description:"服务器未能在预期时间内恢复,请手动检查",variant:"destructive"})};return t?o.jsx(gn,{className:"h-full",children:o.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:o.jsx("div",{className:"flex items-center justify-center h-64",children:o.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})})}):o.jsx(gn,{className:"h-full",children:o.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"麦麦主程序配置"}),o.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理麦麦的核心功能和行为设置"})]}),o.jsxs("div",{className:"flex gap-2 w-full sm:w-auto items-center",children:[o.jsx(ja,{value:g,onValueChange:Fe=>Ie(Fe),className:"w-auto",children:o.jsxs(Wi,{className:"h-9",children:[o.jsxs(Lt,{value:"visual",className:"text-xs sm:text-sm px-2 sm:px-3",children:[o.jsx(Wee,{className:"h-3 w-3 sm:h-4 sm:w-4 mr-1"}),"可视化"]}),o.jsxs(Lt,{value:"source",className:"text-xs sm:text-sm px-2 sm:px-3",children:[o.jsx(Gee,{className:"h-3 w-3 sm:h-4 sm:w-4 mr-1"}),"源代码"]})]})}),o.jsxs(de,{onClick:g==="visual"?st:Ne,disabled:n||s||!a||c,size:"sm",variant:"outline",className:"flex-1 sm:flex-none",children:[o.jsx(Gy,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),n?"保存中...":s?"自动保存中...":a?"保存配置":"已保存"]}),o.jsxs(Dn,{children:[o.jsx(rs,{asChild:!0,children:o.jsxs(de,{disabled:n||s||c,size:"sm",className:"flex-1 sm:flex-none",children:[o.jsx(Aj,{className:"mr-2 h-4 w-4"}),c?"重启中...":a?"保存并重启":"重启麦麦"]})}),o.jsxs(Nn,{children:[o.jsxs(Cn,{children:[o.jsx(En,{children:"确认重启麦麦?"}),o.jsx(_n,{className:"space-y-3",asChild:!0,children:o.jsxs("div",{children:[o.jsx("p",{children:a?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"}),o.jsxs(ga,{className:"border-yellow-500/50 bg-yellow-500/10",children:[o.jsx(Oa,{className:"h-4 w-4 text-yellow-600"}),o.jsxs(xa,{className:"text-yellow-900 dark:text-yellow-100",children:[o.jsx("strong",{children:"重要提示:"}),"由于技术原因,使用重启功能后,将无法再使用 ",o.jsx("code",{className:"px-1 py-0.5 bg-yellow-200 dark:bg-yellow-900 rounded",children:"Ctrl+C"})," 结束程序。",o.jsxs(Dr,{children:[o.jsx(Of,{asChild:!0,children:o.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:[o.jsx(Wy,{className:"h-3 w-3"}),"如何结束程序?"]})}),o.jsxs(Sr,{className:"max-w-2xl",children:[o.jsxs(kr,{children:[o.jsx(Or,{children:"如何结束使用重启功能后的麦麦程序"}),o.jsx(ss,{children:"由于重启功能会使程序脱离终端控制,需要通过系统命令来结束进程"})]}),o.jsxs(ja,{defaultValue:"windows",className:"w-full",children:[o.jsxs(Wi,{className:"grid w-full grid-cols-3",children:[o.jsx(Lt,{value:"windows",children:"Windows"}),o.jsx(Lt,{value:"macos",children:"macOS"}),o.jsx(Lt,{value:"linux",children:"Linux"})]}),o.jsxs(un,{value:"windows",className:"space-y-4 mt-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"font-semibold",children:"方法一:使用任务管理器"}),o.jsxs("ol",{className:"list-decimal list-inside space-y-1 text-sm text-muted-foreground",children:[o.jsxs("li",{children:["按 ",o.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"Ctrl + Shift + Esc"})," 打开任务管理器"]}),o.jsxs("li",{children:['在"进程"或"详细信息"标签页中找到 ',o.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"python.exe"})]}),o.jsx("li",{children:'右键点击并选择"结束任务"'})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"font-semibold",children:"方法二:使用命令行"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"打开 PowerShell 或命令提示符,执行以下命令:"}),o.jsxs("div",{className:"bg-muted p-3 rounded-md font-mono text-sm",children:[o.jsx("p",{children:"# 查找麦麦进程"}),o.jsx("p",{children:'Get-Process python | Where-Object {$_.MainWindowTitle -eq ""}'}),o.jsx("p",{className:"mt-2",children:"# 结束所有 Python 进程(谨慎使用)"}),o.jsx("p",{children:"Stop-Process -Name python -Force"})]})]})]}),o.jsxs(un,{value:"macos",className:"space-y-4 mt-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"font-semibold",children:"方法一:使用活动监视器"}),o.jsxs("ol",{className:"list-decimal list-inside space-y-1 text-sm text-muted-foreground",children:[o.jsxs("li",{children:["按 ",o.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"Cmd + Space"}),' 打开 Spotlight搜索"活动监视器"']}),o.jsxs("li",{children:["在进程列表中找到 ",o.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"Python"})]}),o.jsx("li",{children:"选中后点击左上角的 X 按钮结束进程"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"font-semibold",children:"方法二:使用终端"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"打开终端,执行以下命令:"}),o.jsxs("div",{className:"bg-muted p-3 rounded-md font-mono text-sm",children:[o.jsx("p",{children:"# 查找麦麦进程"}),o.jsx("p",{children:"ps aux | grep python | grep -v grep"}),o.jsx("p",{className:"mt-2",children:"# 结束指定 PID 的进程"}),o.jsx("p",{children:"kill -9 <PID>"}),o.jsx("p",{className:"mt-2",children:"# 或结束所有 Python 进程(谨慎使用)"}),o.jsx("p",{children:"pkill -9 python"})]})]})]}),o.jsxs(un,{value:"linux",className:"space-y-4 mt-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"font-semibold",children:"使用终端命令"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"打开终端,执行以下命令:"}),o.jsxs("div",{className:"bg-muted p-3 rounded-md font-mono text-sm",children:[o.jsx("p",{children:"# 查找麦麦进程"}),o.jsx("p",{children:"ps aux | grep python | grep -v grep"}),o.jsx("p",{className:"mt-2",children:"# 结束指定 PID 的进程"}),o.jsx("p",{children:"kill -9 <PID>"}),o.jsx("p",{className:"mt-2",children:"# 或使用 pkill 按名称结束"}),o.jsx("p",{children:'pkill -9 -f "bot.py"'}),o.jsx("p",{className:"mt-2",children:"# 或结束所有 Python 进程(谨慎使用)"}),o.jsx("p",{children:"pkill -9 python"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"font-semibold",children:"使用 htop如已安装"}),o.jsxs("ol",{className:"list-decimal list-inside space-y-1 text-sm text-muted-foreground",children:[o.jsxs("li",{children:["在终端输入 ",o.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"htop"})]}),o.jsxs("li",{children:["按 ",o.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"F3"})," 搜索 python"]}),o.jsxs("li",{children:["按 ",o.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"F9"})," 发送信号,选择 SIGKILL"]})]})]})]})]}),o.jsx(ws,{children:o.jsx(Gj,{asChild:!0,children:o.jsx(de,{variant:"outline",children:"关闭"})})})]})]})]})]})]})})]}),o.jsxs(Tn,{children:[o.jsx(Mn,{children:"取消"}),o.jsx(An,{onClick:a?Pt:yt,children:a?"保存并重启":"确认重启"})]})]})]})]})]}),o.jsxs(ga,{children:[o.jsx(Oa,{className:"h-4 w-4"}),o.jsxs(xa,{children:["配置更新后需要",o.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),g==="source"&&o.jsxs("div",{className:"space-y-4",children:[o.jsxs(ga,{children:[o.jsx(Oa,{className:"h-4 w-4"}),o.jsxs(xa,{children:[o.jsx("strong",{children:"源代码模式(高级功能):"}),"直接编辑 TOML 配置文件。此功能仅适用于熟悉 TOML 语法的高级用户。保存时会在后端验证格式,只有格式完全正确才能保存。",S&&o.jsx("span",{className:"text-destructive font-semibold ml-2",children:"⚠️ 上次保存失败,请检查 TOML 格式"})]})]}),o.jsx(A0e,{value:y,onChange:Fe=>{w(Fe),l(!0),S&&k(!1)},language:"toml",theme:"dark",height:"calc(100vh - 280px)",minHeight:"500px",placeholder:"TOML 配置内容"})]}),g==="visual"&&o.jsx(o.Fragment,{children:o.jsxs(ja,{defaultValue:"bot",className:"w-full",children:[o.jsx("div",{className:"overflow-x-auto -mx-4 px-4 sm:mx-0 sm:px-0",children:o.jsxs(Wi,{className:"inline-flex w-auto min-w-full sm:grid sm:w-full sm:grid-cols-5 lg:grid-cols-10",children:[o.jsx(Lt,{value:"bot",className:"flex-shrink-0",children:"基本信息"}),o.jsx(Lt,{value:"personality",className:"flex-shrink-0",children:"人格"}),o.jsx(Lt,{value:"chat",className:"flex-shrink-0",children:"聊天"}),o.jsx(Lt,{value:"expression",className:"flex-shrink-0",children:"表达"}),o.jsx(Lt,{value:"features",className:"flex-shrink-0",children:"功能"}),o.jsx(Lt,{value:"processing",className:"flex-shrink-0",children:"处理"}),o.jsx(Lt,{value:"mood",className:"flex-shrink-0",children:"情绪"}),o.jsx(Lt,{value:"voice",className:"flex-shrink-0",children:"语音"}),o.jsx(Lt,{value:"lpmm",className:"flex-shrink-0",children:"知识库"}),o.jsx(Lt,{value:"other",className:"flex-shrink-0",children:"其他"})]})}),o.jsx(un,{value:"bot",className:"space-y-4",children:N&&o.jsx(R0e,{config:N,onChange:T})}),o.jsx(un,{value:"personality",className:"space-y-4",children:E&&o.jsx(D0e,{config:E,onChange:_})}),o.jsx(un,{value:"chat",className:"space-y-4",children:A&&o.jsx(P0e,{config:A,onChange:L})}),o.jsx(un,{value:"expression",className:"space-y-4",children:P&&o.jsx(I0e,{config:P,onChange:B})}),o.jsx(un,{value:"features",className:"space-y-4",children:$&&te&&Q&&o.jsx(L0e,{emojiConfig:$,memoryConfig:te,toolConfig:Q,onEmojiChange:U,onMemoryChange:z,onToolChange:F})}),o.jsx(un,{value:"processing",className:"space-y-4",children:I&&ee&&W&&re&&o.jsx(B0e,{keywordReactionConfig:I,responsePostProcessConfig:ee,chineseTypoConfig:W,responseSplitterConfig:re,onKeywordReactionChange:V,onResponsePostProcessChange:ne,onChineseTypoChange:se,onResponseSplitterChange:oe})}),o.jsx(un,{value:"mood",className:"space-y-4",children:Y&&o.jsx(F0e,{config:Y,onChange:J})}),o.jsx(un,{value:"voice",className:"space-y-4",children:X&&o.jsx(q0e,{config:X,onChange:R})}),o.jsx(un,{value:"lpmm",className:"space-y-4",children:ie&&o.jsx($0e,{config:ie,onChange:G})}),o.jsxs(un,{value:"other",className:"space-y-4",children:[Te&&o.jsx(H0e,{config:Te,onChange:We}),Ye&&o.jsx(Q0e,{config:Ye,onChange:Je}),Oe&&o.jsx(V0e,{config:Oe,onChange:Ve}),Ue&&o.jsx(U0e,{config:Ue,onChange:He})]})]})}),h&&o.jsx(Kj,{onRestartComplete:Mt,onRestartFailed:zn})]})})}function R0e({config:t,onChange:e}){const n=()=>{e({...t,platforms:[...t.platforms,""]})},r=c=>{e({...t,platforms:t.platforms.filter((d,h)=>h!==c)})},s=(c,d)=>{const h=[...t.platforms];h[c]=d,e({...t,platforms:h})},i=()=>{e({...t,alias_names:[...t.alias_names,""]})},a=c=>{e({...t,alias_names:t.alias_names.filter((d,h)=>h!==c)})},l=(c,d)=>{const h=[...t.alias_names];h[c]=d,e({...t,alias_names:h})};return o.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-semibold mb-4",children:"基本信息"}),o.jsxs("div",{className:"grid gap-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"platform",children:"平台"}),o.jsx(ze,{id:"platform",value:t.platform,onChange:c=>e({...t,platform:c.target.value}),placeholder:"qq"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"qq_account",children:"QQ账号"}),o.jsx(ze,{id:"qq_account",value:t.qq_account,onChange:c=>e({...t,qq_account:c.target.value}),placeholder:"123456789"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"nickname",children:"昵称"}),o.jsx(ze,{id:"nickname",value:t.nickname,onChange:c=>e({...t,nickname:c.target.value}),placeholder:"麦麦"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(he,{children:"其他平台账号"}),o.jsxs(de,{onClick:n,size:"sm",variant:"outline",children:[o.jsx(Ls,{className:"h-4 w-4 mr-1"}),"添加"]})]}),o.jsxs("div",{className:"space-y-2",children:[t.platforms.map((c,d)=>o.jsxs("div",{className:"flex gap-2",children:[o.jsx(ze,{value:c,onChange:h=>s(d,h.target.value),placeholder:"wx:114514"}),o.jsxs(Dn,{children:[o.jsx(rs,{asChild:!0,children:o.jsx(de,{size:"icon",variant:"outline",children:o.jsx(Sn,{className:"h-4 w-4"})})}),o.jsxs(Nn,{children:[o.jsxs(Cn,{children:[o.jsx(En,{children:"确认删除"}),o.jsxs(_n,{children:['确定要删除平台账号 "',c||"(空)",'" 吗?此操作无法撤销。']})]}),o.jsxs(Tn,{children:[o.jsx(Mn,{children:"取消"}),o.jsx(An,{onClick:()=>r(d),children:"删除"})]})]})]})]},d)),t.platforms.length===0&&o.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无其他平台账号"})]})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(he,{children:"别名"}),o.jsxs(de,{onClick:i,size:"sm",variant:"outline",children:[o.jsx(Ls,{className:"h-4 w-4 mr-1"}),"添加"]})]}),o.jsxs("div",{className:"space-y-2",children:[t.alias_names.map((c,d)=>o.jsxs("div",{className:"flex gap-2",children:[o.jsx(ze,{value:c,onChange:h=>l(d,h.target.value),placeholder:"小麦"}),o.jsxs(Dn,{children:[o.jsx(rs,{asChild:!0,children:o.jsx(de,{size:"icon",variant:"outline",children:o.jsx(Sn,{className:"h-4 w-4"})})}),o.jsxs(Nn,{children:[o.jsxs(Cn,{children:[o.jsx(En,{children:"确认删除"}),o.jsxs(_n,{children:['确定要删除别名 "',c||"(空)",'" 吗?此操作无法撤销。']})]}),o.jsxs(Tn,{children:[o.jsx(Mn,{children:"取消"}),o.jsx(An,{onClick:()=>a(d),children:"删除"})]})]})]})]},d)),t.alias_names.length===0&&o.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无别名"})]})]})]})]})})}function D0e({config:t,onChange:e}){const n=()=>{e({...t,states:[...t.states,""]})},r=i=>{e({...t,states:t.states.filter((a,l)=>l!==i)})},s=(i,a)=>{const l=[...t.states];l[i]=a,e({...t,states:l})};return o.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-semibold mb-4",children:"人格设置"}),o.jsxs("div",{className:"grid gap-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"personality",children:"人格特质"}),o.jsx(Mr,{id:"personality",value:t.personality,onChange:i=>e({...t,personality:i.target.value}),placeholder:"描述人格特质和身份特征建议120字以内",rows:3}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"建议120字以内描述人格特质和身份特征"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"reply_style",children:"表达风格"}),o.jsx(Mr,{id:"reply_style",value:t.reply_style,onChange:i=>e({...t,reply_style:i.target.value}),placeholder:"描述说话的表达风格和习惯",rows:3})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"interest",children:"兴趣"}),o.jsx(Mr,{id:"interest",value:t.interest,onChange:i=>e({...t,interest:i.target.value}),placeholder:"会影响麦麦对什么话题进行回复",rows:2})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"plan_style",children:"说话规则与行为风格"}),o.jsx(Mr,{id:"plan_style",value:t.plan_style,onChange:i=>e({...t,plan_style:i.target.value}),placeholder:"麦麦的说话规则和行为风格",rows:5})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"visual_style",children:"识图规则"}),o.jsx(Mr,{id:"visual_style",value:t.visual_style,onChange:i=>e({...t,visual_style:i.target.value}),placeholder:"识图时的处理规则",rows:3})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"private_plan_style",children:"私聊规则"}),o.jsx(Mr,{id:"private_plan_style",value:t.private_plan_style,onChange:i=>e({...t,private_plan_style:i.target.value}),placeholder:"私聊的说话规则和行为风格",rows:4})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(he,{children:"状态列表(人格多样性)"}),o.jsxs(de,{onClick:n,size:"sm",variant:"outline",children:[o.jsx(Ls,{className:"h-4 w-4 mr-1"}),"添加状态"]})]}),o.jsx("div",{className:"space-y-2",children:t.states.map((i,a)=>o.jsxs("div",{className:"flex gap-2",children:[o.jsx(Mr,{value:i,onChange:l=>s(a,l.target.value),placeholder:"描述一个人格状态",rows:2}),o.jsxs(Dn,{children:[o.jsx(rs,{asChild:!0,children:o.jsx(de,{size:"icon",variant:"outline",children:o.jsx(Sn,{className:"h-4 w-4"})})}),o.jsxs(Nn,{children:[o.jsxs(Cn,{children:[o.jsx(En,{children:"确认删除"}),o.jsx(_n,{children:"确定要删除这个人格状态吗?此操作无法撤销。"})]}),o.jsxs(Tn,{children:[o.jsx(Mn,{children:"取消"}),o.jsx(An,{onClick:()=>r(a),children:"删除"})]})]})]})]},a))})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"state_probability",children:"状态替换概率"}),o.jsx(ze,{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)})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"每次构建人格时替换 personality 的概率0.0-1.0"})]})]})]})})}function P0e({config:t,onChange:e}){const n=()=>{e({...t,talk_value_rules:[...t.talk_value_rules,{target:"",time:"00:00-23:59",value:1}]})},r=l=>{e({...t,talk_value_rules:t.talk_value_rules.filter((c,d)=>d!==l)})},s=(l,c,d)=>{const h=[...t.talk_value_rules];h[l]={...h[l],[c]:d},e({...t,talk_value_rules:h})},i=({value:l,onChange:c})=>{const[d,h]=b.useState("00"),[m,g]=b.useState("00"),[x,y]=b.useState("23"),[w,S]=b.useState("59");b.useEffect(()=>{const j=l.split("-");if(j.length===2){const[N,T]=j,[E,_]=N.split(":"),[A,L]=T.split(":");E&&h(E.padStart(2,"0")),_&&g(_.padStart(2,"0")),A&&y(A.padStart(2,"0")),L&&S(L.padStart(2,"0"))}},[l]);const k=(j,N,T,E)=>{const _=`${j}:${N}-${T}:${E}`;c(_)};return o.jsxs(zo,{children:[o.jsx(Io,{asChild:!0,children:o.jsxs(de,{variant:"outline",className:"w-full justify-start font-mono text-sm",children:[o.jsx(_h,{className:"h-4 w-4 mr-2"}),l||"选择时间段"]})}),o.jsx(Xa,{className:"w-80",children:o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{children:[o.jsx("h4",{className:"font-medium text-sm mb-3",children:"开始时间"}),o.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:gap-3",children:[o.jsxs("div",{children:[o.jsx(he,{className:"text-xs",children:"小时"}),o.jsxs(Vt,{value:d,onValueChange:j=>{h(j),k(j,m,x,w)},children:[o.jsx($t,{children:o.jsx(Ut,{})}),o.jsx(Ht,{children:Array.from({length:24},(j,N)=>N).map(j=>o.jsx(De,{value:j.toString().padStart(2,"0"),children:j.toString().padStart(2,"0")},j))})]})]}),o.jsxs("div",{children:[o.jsx(he,{className:"text-xs",children:"分钟"}),o.jsxs(Vt,{value:m,onValueChange:j=>{g(j),k(d,j,x,w)},children:[o.jsx($t,{children:o.jsx(Ut,{})}),o.jsx(Ht,{children:Array.from({length:60},(j,N)=>N).map(j=>o.jsx(De,{value:j.toString().padStart(2,"0"),children:j.toString().padStart(2,"0")},j))})]})]})]})]}),o.jsxs("div",{children:[o.jsx("h4",{className:"font-medium text-sm mb-3",children:"结束时间"}),o.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:gap-3",children:[o.jsxs("div",{children:[o.jsx(he,{className:"text-xs",children:"小时"}),o.jsxs(Vt,{value:x,onValueChange:j=>{y(j),k(d,m,j,w)},children:[o.jsx($t,{children:o.jsx(Ut,{})}),o.jsx(Ht,{children:Array.from({length:24},(j,N)=>N).map(j=>o.jsx(De,{value:j.toString().padStart(2,"0"),children:j.toString().padStart(2,"0")},j))})]})]}),o.jsxs("div",{children:[o.jsx(he,{className:"text-xs",children:"分钟"}),o.jsxs(Vt,{value:w,onValueChange:j=>{S(j),k(d,m,x,j)},children:[o.jsx($t,{children:o.jsx(Ut,{})}),o.jsx(Ht,{children:Array.from({length:60},(j,N)=>N).map(j=>o.jsx(De,{value:j.toString().padStart(2,"0"),children:j.toString().padStart(2,"0")},j))})]})]})]})]})]})})]})},a=({rule:l})=>{const c=`{ target = "${l.target}", time = "${l.time}", value = ${l.value.toFixed(1)} }`;return o.jsxs(zo,{children:[o.jsx(Io,{asChild:!0,children:o.jsxs(de,{variant:"outline",size:"sm",children:[o.jsx(Ea,{className:"h-4 w-4 mr-1"}),"预览"]})}),o.jsx(Xa,{className:"w-96",children:o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),o.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:c}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})};return o.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-semibold mb-4",children:"聊天设置"}),o.jsxs("div",{className:"grid gap-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"talk_value",children:"聊天频率(基础值)"}),o.jsx(ze,{id:"talk_value",type:"number",step:"0.1",min:"0",max:"1",value:t.talk_value,onChange:l=>e({...t,talk_value:parseFloat(l.target.value)})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"越小越沉默,范围 0-1"})]}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Bt,{id:"mentioned_bot_reply",checked:t.mentioned_bot_reply,onCheckedChange:l=>e({...t,mentioned_bot_reply:l})}),o.jsx(he,{htmlFor:"mentioned_bot_reply",className:"cursor-pointer",children:"启用提及必回复"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"max_context_size",children:"上下文长度"}),o.jsx(ze,{id:"max_context_size",type:"number",min:"1",value:t.max_context_size,onChange:l=>e({...t,max_context_size:parseInt(l.target.value)})})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"planner_smooth",children:"规划器平滑"}),o.jsx(ze,{id:"planner_smooth",type:"number",step:"1",min:"0",value:t.planner_smooth,onChange:l=>e({...t,planner_smooth:parseFloat(l.target.value)})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"增大数值会减小 planner 负荷,推荐 1-50 为关闭"})]}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Bt,{id:"enable_talk_value_rules",checked:t.enable_talk_value_rules,onCheckedChange:l=>e({...t,enable_talk_value_rules:l})}),o.jsx(he,{htmlFor:"enable_talk_value_rules",className:"cursor-pointer",children:"启用动态发言频率规则"})]}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Bt,{id:"include_planner_reasoning",checked:t.include_planner_reasoning,onCheckedChange:l=>e({...t,include_planner_reasoning:l})}),o.jsx(he,{htmlFor:"include_planner_reasoning",className:"cursor-pointer",children:"将 planner 推理加入 replyer"})]})]})]}),t.enable_talk_value_rules&&o.jsxs("div",{className:"border-t pt-6",children:[o.jsxs("div",{className:"flex items-center justify-between mb-4",children:[o.jsxs("div",{children:[o.jsx("h4",{className:"text-base font-semibold",children:"动态发言频率规则"}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"按时段或聊天流ID调整发言频率优先匹配具体聊天再匹配全局规则"})]}),o.jsxs(de,{onClick:n,size:"sm",children:[o.jsx(Ls,{className:"h-4 w-4 mr-1"}),"添加规则"]})]}),t.talk_value_rules&&t.talk_value_rules.length>0?o.jsx("div",{className:"space-y-4",children:t.talk_value_rules.map((l,c)=>o.jsxs("div",{className:"rounded-lg border p-4 bg-muted/50 space-y-4",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("span",{className:"text-sm font-medium text-muted-foreground",children:["规则 #",c+1]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(a,{rule:l}),o.jsxs(Dn,{children:[o.jsx(rs,{asChild:!0,children:o.jsx(de,{variant:"ghost",size:"sm",children:o.jsx(Sn,{className:"h-4 w-4 text-destructive"})})}),o.jsxs(Nn,{children:[o.jsxs(Cn,{children:[o.jsx(En,{children:"确认删除"}),o.jsxs(_n,{children:["确定要删除规则 #",c+1," 吗?此操作无法撤销。"]})]}),o.jsxs(Tn,{children:[o.jsx(Mn,{children:"取消"}),o.jsx(An,{onClick:()=>r(c),children:"删除"})]})]})]})]})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{className:"text-xs font-medium",children:"配置类型"}),o.jsxs(Vt,{value:l.target===""?"global":"specific",onValueChange:d=>{d==="global"?s(c,"target",""):s(c,"target","qq::group")},children:[o.jsx($t,{children:o.jsx(Ut,{})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"global",children:"全局配置"}),o.jsx(De,{value:"specific",children:"详细配置"})]})]})]}),l.target!==""&&(()=>{const d=l.target.split(":"),h=d[0]||"qq",m=d[1]||"",g=d[2]||"group";return o.jsxs("div",{className:"grid gap-4 p-4 rounded-lg bg-muted/50",children:[o.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{className:"text-xs font-medium",children:"平台"}),o.jsxs(Vt,{value:h,onValueChange:x=>{s(c,"target",`${x}:${m}:${g}`)},children:[o.jsx($t,{children:o.jsx(Ut,{})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"qq",children:"QQ"}),o.jsx(De,{value:"wx",children:"微信"})]})]})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{className:"text-xs font-medium",children:"群 ID"}),o.jsx(ze,{value:m,onChange:x=>{s(c,"target",`${h}:${x.target.value}:${g}`)},placeholder:"输入群 ID",className:"font-mono text-sm"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{className:"text-xs font-medium",children:"类型"}),o.jsxs(Vt,{value:g,onValueChange:x=>{s(c,"target",`${h}:${m}:${x}`)},children:[o.jsx($t,{children:o.jsx(Ut,{})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"group",children:"群组group"}),o.jsx(De,{value:"private",children:"私聊private"})]})]})]})]}),o.jsxs("p",{className:"text-xs text-muted-foreground",children:["当前聊天流 ID",l.target||"(未设置)"]})]})})(),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{className:"text-xs font-medium",children:"时间段 (Time)"}),o.jsx(i,{value:l.time,onChange:d=>s(c,"time",d)}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"支持跨夜区间,例如 23:00-02:00"})]}),o.jsxs("div",{className:"grid gap-3",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(he,{htmlFor:`rule-value-${c}`,className:"text-xs font-medium",children:"发言频率值 (Value)"}),o.jsx(ze,{id:`rule-value-${c}`,type:"number",step:"0.01",min:"0.01",max:"1",value:l.value,onChange:d=>{const h=parseFloat(d.target.value);isNaN(h)||s(c,"value",Math.max(.01,Math.min(1,h)))},className:"w-20 h-8 text-xs"})]}),o.jsx(Bp,{value:[l.value],onValueChange:d=>s(c,"value",d[0]),min:.01,max:1,step:.01,className:"w-full"}),o.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[o.jsx("span",{children:"0.01 (极少发言)"}),o.jsx("span",{children:"0.5"}),o.jsx("span",{children:"1.0 (正常)"})]})]})]})]},c))}):o.jsx("div",{className:"text-center py-8 text-muted-foreground",children:o.jsx("p",{className:"text-sm",children:'暂无规则,点击"添加规则"按钮创建'})}),o.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:[o.jsx("h5",{className:"text-sm font-semibold text-blue-900 dark:text-blue-100 mb-2",children:"📝 规则说明"}),o.jsxs("ul",{className:"text-xs text-blue-800 dark:text-blue-200 space-y-1",children:[o.jsxs("li",{children:["• ",o.jsx("strong",{children:"Target 为空"}),":全局规则,对所有聊天生效"]}),o.jsxs("li",{children:["• ",o.jsx("strong",{children:"Target 指定"}),"仅对特定聊天流生效格式platform:id:type"]}),o.jsxs("li",{children:["• ",o.jsx("strong",{children:"优先级"}),":先匹配具体聊天流规则,再匹配全局规则"]}),o.jsxs("li",{children:["• ",o.jsx("strong",{children:"时间支持跨夜"}),":例如 23:00-02:00 表示晚上11点到次日凌晨2点"]}),o.jsxs("li",{children:["• ",o.jsx("strong",{children:"数值范围"}),":建议 0-10 表示完全沉默1 表示正常发言"]})]})]})]})]})}function z0e({member:t,groupIndex:e,memberIndex:n,availableChatIds:r,onUpdate:s,onRemove:i}){const a=r.includes(t)||t==="*",[l,c]=b.useState(!a);return o.jsxs("div",{className:"flex gap-2",children:[o.jsx("div",{className:"flex-1 flex gap-2",children:l?o.jsxs(o.Fragment,{children:[o.jsx(ze,{value:t,onChange:d=>s(e,n,d.target.value),placeholder:'输入 "*" 或 "qq:123456:group"',className:"flex-1"}),r.length>0&&o.jsx(de,{size:"sm",variant:"outline",onClick:()=>c(!1),title:"切换到下拉选择",children:"下拉"})]}):o.jsxs(o.Fragment,{children:[o.jsxs(Vt,{value:t,onValueChange:d=>s(e,n,d),children:[o.jsx($t,{className:"flex-1",children:o.jsx(Ut,{placeholder:"选择聊天流"})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"*",children:"* (全局共享)"}),r.map((d,h)=>o.jsx(De,{value:d,children:d},h))]})]}),o.jsx(de,{size:"sm",variant:"outline",onClick:()=>c(!0),title:"切换到手动输入",children:"输入"})]})}),o.jsxs(Dn,{children:[o.jsx(rs,{asChild:!0,children:o.jsx(de,{size:"icon",variant:"outline",children:o.jsx(Sn,{className:"h-4 w-4"})})}),o.jsxs(Nn,{children:[o.jsxs(Cn,{children:[o.jsx(En,{children:"确认删除"}),o.jsxs(_n,{children:['确定要删除组成员 "',t||"(空)",'" 吗?此操作无法撤销。']})]}),o.jsxs(Tn,{children:[o.jsx(Mn,{children:"取消"}),o.jsx(An,{onClick:()=>i(e,n),children:"删除"})]})]})]})]})}function I0e({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 o.jsxs(zo,{children:[o.jsx(Io,{asChild:!0,children:o.jsxs(de,{variant:"outline",size:"sm",children:[o.jsx(Ea,{className:"h-4 w-4 mr-1"}),"预览"]})}),o.jsx(Xa,{className:"w-96",children:o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),o.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:g}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})},a=()=>{e({...t,expression_groups:[...t.expression_groups,[]]})},l=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})},d=(m,g)=>{const x=[...t.expression_groups];x[m]=x[m].filter((y,w)=>w!==g),e({...t,expression_groups:x})},h=(m,g,x)=>{const y=[...t.expression_groups];y[m][g]=x,e({...t,expression_groups:y})};return o.jsxs("div",{className:"space-y-6",children:[o.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center justify-between mb-4",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-semibold",children:"表达学习配置"}),o.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"配置麦麦如何学习和使用表达方式"})]}),o.jsxs(de,{onClick:n,size:"sm",variant:"outline",children:[o.jsx(Ls,{className:"h-4 w-4 mr-1"}),"添加规则"]})]}),o.jsxs("div",{className:"space-y-4",children:[t.learning_list.map((m,g)=>{const x=t.learning_list.some((N,T)=>T!==g&&N[0]===""),y=m[0]==="",w=m[0].split(":"),S=w[0]||"qq",k=w[1]||"",j=w[2]||"group";return o.jsxs("div",{className:"rounded-lg border p-4 space-y-4",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("span",{className:"text-sm font-medium",children:["规则 ",g+1," ",y&&"(全局配置)"]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(i,{rule:m}),o.jsxs(Dn,{children:[o.jsx(rs,{asChild:!0,children:o.jsx(de,{size:"sm",variant:"ghost",children:o.jsx(Sn,{className:"h-4 w-4"})})}),o.jsxs(Nn,{children:[o.jsxs(Cn,{children:[o.jsx(En,{children:"确认删除"}),o.jsxs(_n,{children:["确定要删除学习规则 ",g+1," 吗?此操作无法撤销。"]})]}),o.jsxs(Tn,{children:[o.jsx(Mn,{children:"取消"}),o.jsx(An,{onClick:()=>r(g),children:"删除"})]})]})]})]})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{className:"text-xs font-medium",children:"配置类型"}),o.jsxs(Vt,{value:y?"global":"specific",onValueChange:N=>{N==="global"?s(g,0,""):s(g,0,"qq::group")},disabled:x&&!y,children:[o.jsx($t,{children:o.jsx(Ut,{})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"global",children:"全局配置"}),o.jsx(De,{value:"specific",disabled:x&&!y,children:"详细配置"})]})]}),x&&!y&&o.jsx("p",{className:"text-xs text-amber-600",children:"已存在全局配置,无法创建新的全局配置"})]}),!y&&o.jsxs("div",{className:"grid gap-4 p-4 rounded-lg bg-muted/50",children:[o.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{className:"text-xs font-medium",children:"平台"}),o.jsxs(Vt,{value:S,onValueChange:N=>{s(g,0,`${N}:${k}:${j}`)},children:[o.jsx($t,{children:o.jsx(Ut,{})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"qq",children:"QQ"}),o.jsx(De,{value:"wx",children:"微信"})]})]})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{className:"text-xs font-medium",children:"群 ID"}),o.jsx(ze,{value:k,onChange:N=>{s(g,0,`${S}:${N.target.value}:${j}`)},placeholder:"输入群 ID",className:"font-mono text-sm"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{className:"text-xs font-medium",children:"类型"}),o.jsxs(Vt,{value:j,onValueChange:N=>{s(g,0,`${S}:${k}:${N}`)},children:[o.jsx($t,{children:o.jsx(Ut,{})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"group",children:"群组group"}),o.jsx(De,{value:"private",children:"私聊private"})]})]})]})]}),o.jsxs("p",{className:"text-xs text-muted-foreground",children:["当前聊天流 ID",m[0]||"(未设置)"]})]}),o.jsx("div",{className:"grid gap-2",children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsx(he,{className:"text-xs font-medium",children:"使用学到的表达"}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"允许麦麦使用从聊天中学到的表达方式"})]}),o.jsx(Bt,{checked:m[1]==="enable",onCheckedChange:N=>s(g,1,N?"enable":"disable")})]})}),o.jsx("div",{className:"grid gap-2",children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsx(he,{className:"text-xs font-medium",children:"学习表达"}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"允许麦麦从聊天中学习新的表达方式"})]}),o.jsx(Bt,{checked:m[2]==="enable",onCheckedChange:N=>s(g,2,N?"enable":"disable")})]})}),o.jsxs("div",{className:"grid gap-3",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(he,{className:"text-xs font-medium",children:"学习强度"}),o.jsx(ze,{type:"number",step:"0.1",min:"0",max:"5",value:m[3],onChange:N=>{const T=parseFloat(N.target.value);isNaN(T)||s(g,3,Math.max(0,Math.min(5,T)).toFixed(1))},className:"w-20 h-8 text-xs"})]}),o.jsx(Bp,{value:[parseFloat(m[3])||1],onValueChange:N=>s(g,3,N[0].toFixed(1)),min:0,max:5,step:.1,className:"w-full"}),o.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[o.jsx("span",{children:"0 (不学习)"}),o.jsx("span",{children:"2.5"}),o.jsx("span",{children:"5.0 (快速学习)"})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"影响学习频率,最短学习间隔 = 300/学习强度(秒)"})]})]})]},g)}),t.learning_list.length===0&&o.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无学习规则,点击"添加规则"开始配置'})]})]})}),o.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center justify-between mb-4",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-semibold",children:"表达共享组配置"}),o.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"配置不同聊天流之间如何共享学到的表达方式"})]}),o.jsxs(de,{onClick:a,size:"sm",variant:"outline",children:[o.jsx(Ls,{className:"h-4 w-4 mr-1"}),"添加共享组"]})]}),o.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 o.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("span",{className:"text-sm font-medium",children:["共享组 ",g+1,m.length===1&&m[0]==="*"&&"(全局共享)"]}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(de,{onClick:()=>c(g),size:"sm",variant:"outline",children:o.jsx(Ls,{className:"h-4 w-4"})}),o.jsxs(Dn,{children:[o.jsx(rs,{asChild:!0,children:o.jsx(de,{size:"sm",variant:"ghost",children:o.jsx(Sn,{className:"h-4 w-4"})})}),o.jsxs(Nn,{children:[o.jsxs(Cn,{children:[o.jsx(En,{children:"确认删除"}),o.jsxs(_n,{children:["确定要删除共享组 ",g+1," 吗?此操作无法撤销。"]})]}),o.jsxs(Tn,{children:[o.jsx(Mn,{children:"取消"}),o.jsx(An,{onClick:()=>l(g),children:"删除"})]})]})]})]})]}),o.jsx("div",{className:"space-y-2",children:m.map((y,w)=>o.jsx(z0e,{member:y,groupIndex:g,memberIndex:w,availableChatIds:x,onUpdate:h,onRemove:d},`${g}-${w}`))}),o.jsx("p",{className:"text-xs text-muted-foreground",children:'提示:可以从下拉框选择已配置的聊天流,或手动输入。输入 "*" 启用全局共享'})]},g)}),t.expression_groups.length===0&&o.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无共享组,点击"添加共享组"开始配置'})]})]})})]})}function L0e({emojiConfig:t,memoryConfig:e,toolConfig:n,onEmojiChange:r,onMemoryChange:s,onToolChange:i}){return o.jsxs("div",{className:"space-y-6",children:[o.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-semibold mb-4",children:"工具设置"}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Bt,{id:"enable_tool",checked:n.enable_tool,onCheckedChange:a=>i({...n,enable_tool:a})}),o.jsx(he,{htmlFor:"enable_tool",className:"cursor-pointer",children:"启用工具系统"})]}),o.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"允许麦麦使用各种工具来增强功能"})]})}),o.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-semibold mb-4",children:"记忆设置"}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"max_agent_iterations",children:"记忆思考深度"}),o.jsx(ze,{id:"max_agent_iterations",type:"number",min:"1",value:e.max_agent_iterations,onChange:a=>s({...e,max_agent_iterations:parseInt(a.target.value)})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"最低为 1不深入思考"})]})]})}),o.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-semibold mb-4",children:"表情包设置"}),o.jsxs("div",{className:"grid gap-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"emoji_chance",children:"表情包激活概率"}),o.jsx(ze,{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)})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"范围 0-1越大越容易发送表情包"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"max_reg_num",children:"最大注册数量"}),o.jsx(ze,{id:"max_reg_num",type:"number",min:"1",value:t.max_reg_num,onChange:a=>r({...t,max_reg_num:parseInt(a.target.value)})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦最多可以注册的表情包数量"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"check_interval",children:"检查间隔(分钟)"}),o.jsx(ze,{id:"check_interval",type:"number",min:"1",value:t.check_interval,onChange:a=>r({...t,check_interval:parseInt(a.target.value)})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"检查表情包(注册、破损、删除)的时间间隔"})]}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Bt,{id:"do_replace",checked:t.do_replace,onCheckedChange:a=>r({...t,do_replace:a})}),o.jsx(he,{htmlFor:"do_replace",className:"cursor-pointer",children:"达到最大数量时替换表情包"})]}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Bt,{id:"steal_emoji",checked:t.steal_emoji,onCheckedChange:a=>r({...t,steal_emoji:a})}),o.jsx(he,{htmlFor:"steal_emoji",className:"cursor-pointer",children:"偷取表情包"})]}),o.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"允许麦麦将看到的表情包据为己有"}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Bt,{id:"content_filtration",checked:t.content_filtration,onCheckedChange:a=>r({...t,content_filtration:a})}),o.jsx(he,{htmlFor:"content_filtration",className:"cursor-pointer",children:"启用表情包过滤"})]}),t.content_filtration&&o.jsxs("div",{className:"grid gap-2 pl-6 border-l-2 border-primary/20",children:[o.jsx(he,{htmlFor:"filtration_prompt",children:"过滤要求"}),o.jsx(ze,{id:"filtration_prompt",value:t.filtration_prompt,onChange:a=>r({...t,filtration_prompt:a.target.value}),placeholder:"符合公序良俗"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"只有符合此要求的表情包才会被保存"})]})]})]})})]})}function B0e({keywordReactionConfig:t,responsePostProcessConfig:e,chineseTypoConfig:n,responseSplitterConfig:r,onKeywordReactionChange:s,onResponsePostProcessChange:i,onChineseTypoChange:a,onResponseSplitterChange:l}){const c=()=>{s({...t,regex_rules:[...t.regex_rules,{regex:[""],reaction:""}]})},d=T=>{s({...t,regex_rules:t.regex_rules.filter((E,_)=>_!==T)})},h=(T,E,_)=>{const A=[...t.regex_rules];E==="regex"&&typeof _=="string"?A[T]={...A[T],regex:[_]}:E==="reaction"&&typeof _=="string"&&(A[T]={...A[T],reaction:_}),s({...t,regex_rules:A})},m=({regex:T,reaction:E,onRegexChange:_,onReactionChange:A})=>{const[L,P]=b.useState(!1),[B,$]=b.useState(""),[U,te]=b.useState(null),[z,Q]=b.useState(""),[F,Y]=b.useState({}),[J,X]=b.useState(""),R=b.useRef(null),[ie,G]=b.useState("build"),I=W=>W.replace(/\(\?P<([^>]+)>/g,"(?<$1>"),V=(W,se=0)=>{const re=R.current;if(!re)return;const oe=re.selectionStart||0,Te=re.selectionEnd||0,We=T.substring(0,oe)+W+T.substring(Te);_(We),setTimeout(()=>{const Ye=oe+W.length+se;re.setSelectionRange(Ye,Ye),re.focus()},0)};b.useEffect(()=>{if(!T||!B){te(null),Y({}),X(E),Q("");return}try{const W=I(T),se=new RegExp(W,"g"),re=B.match(se);te(re),Q("");const Te=new RegExp(W).exec(B);if(Te&&Te.groups){Y(Te.groups);let We=E;Object.entries(Te.groups).forEach(([Ye,Je])=>{We=We.replace(new RegExp(`\\[${Ye}\\]`,"g"),Je||"")}),X(We)}else Y({}),X(E)}catch(W){Q(W.message),te(null),Y({}),X(E)}},[T,B,E]);const ee=()=>{if(!B||!U||U.length===0)return o.jsx("span",{className:"text-muted-foreground",children:B||"请输入测试文本"});try{const W=I(T),se=new RegExp(W,"g");let re=0;const oe=[];let Te;for(;(Te=se.exec(B))!==null;)Te.index>re&&oe.push(o.jsx("span",{children:B.substring(re,Te.index)},`text-${re}`)),oe.push(o.jsx("span",{className:"bg-yellow-200 dark:bg-yellow-900 font-semibold",children:Te[0]},`match-${Te.index}`)),re=Te.index+Te[0].length;return re<B.length&&oe.push(o.jsx("span",{children:B.substring(re)},`text-${re}`)),o.jsx(o.Fragment,{children:oe})}catch{return o.jsx("span",{children:B})}},ne=[{category:"基础匹配",items:[{label:"任意字符",pattern:".",desc:"匹配除换行符外的任意字符"},{label:"数字",pattern:"\\d",desc:"匹配 0-9"},{label:"非数字",pattern:"\\D",desc:"匹配非数字字符"},{label:"字母数字",pattern:"\\w",desc:"匹配字母、数字、下划线"},{label:"非字母数字",pattern:"\\W",desc:"匹配非字母数字字符"},{label:"空白符",pattern:"\\s",desc:"匹配空格、制表符等"},{label:"非空白符",pattern:"\\S",desc:"匹配非空白字符"}]},{category:"位置锚点",items:[{label:"行首",pattern:"^",desc:"匹配行的开始"},{label:"行尾",pattern:"$",desc:"匹配行的结束"},{label:"单词边界",pattern:"\\b",desc:"匹配单词边界"}]},{category:"重复次数",items:[{label:"0或多次",pattern:"*",desc:"匹配前面的元素0次或多次"},{label:"1或多次",pattern:"+",desc:"匹配前面的元素1次或多次"},{label:"0或1次",pattern:"?",desc:"匹配前面的元素0次或1次"},{label:"指定次数",pattern:"{n}",desc:"匹配n次将n替换为数字"},{label:"次数范围",pattern:"{m,n}",desc:"匹配m到n次"}]},{category:"分组和捕获",items:[{label:"普通分组",pattern:"()",desc:"分组但不捕获",moveCursor:-1},{label:"命名捕获",pattern:"(?P<name>)",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<word>\\S+)",desc:"捕获一个词语"},{label:"捕获句子",pattern:"(?P<sentence>.+)",desc:"捕获整个句子"},{label:"捕获数字",pattern:"(?P<num>\\d+)",desc:"捕获一个或多个数字"},{label:"可选词语",pattern:"(?:词语1|词语2)",desc:"匹配多个可选项之一"}]}];return o.jsxs(Dr,{open:L,onOpenChange:P,children:[o.jsx(Of,{asChild:!0,children:o.jsxs(de,{variant:"outline",size:"sm",children:[o.jsx(Pv,{className:"h-4 w-4 mr-1"}),"正则编辑器"]})}),o.jsxs(Sr,{className:"max-w-[95vw] sm:max-w-[900px] max-h-[90vh]",children:[o.jsxs(kr,{children:[o.jsx(Or,{children:"正则表达式编辑器"}),o.jsx(ss,{className:"text-sm",children:"使用可视化工具构建正则表达式,并实时测试效果"})]}),o.jsx(gn,{className:"max-h-[calc(90vh-120px)]",children:o.jsxs(ja,{value:ie,onValueChange:W=>G(W),className:"w-full",children:[o.jsxs(Wi,{className:"grid w-full grid-cols-2",children:[o.jsx(Lt,{value:"build",children:"🔧 构建器"}),o.jsx(Lt,{value:"test",children:"🧪 测试器"})]}),o.jsxs(un,{value:"build",className:"space-y-4 mt-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{className:"text-sm font-medium",children:"正则表达式"}),o.jsx(ze,{ref:R,value:T,onChange:W=>_(W.target.value),className:"font-mono text-sm",placeholder:"点击下方按钮构建正则表达式..."})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{className:"text-sm font-medium",children:"Reaction 内容"}),o.jsx(Mr,{value:E,onChange:W=>A(W.target.value),placeholder:"使用 [捕获组名] 引用捕获的内容...",rows:3,className:"text-sm"})]}),o.jsxs("div",{className:"space-y-4 border-t pt-4",children:[ne.map(W=>o.jsxs("div",{className:"space-y-2",children:[o.jsx("h5",{className:"text-xs font-semibold text-primary",children:W.category}),o.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:W.items.map(se=>o.jsx(de,{variant:"outline",size:"sm",className:"justify-start h-auto py-2 px-3",onClick:()=>V(se.pattern,se.moveCursor||0),children:o.jsxs("div",{className:"flex flex-col items-start w-full",children:[o.jsxs("div",{className:"flex items-center gap-2 w-full",children:[o.jsx("span",{className:"text-xs font-medium",children:se.label}),o.jsx("code",{className:"ml-auto text-xs bg-muted px-1.5 py-0.5 rounded font-mono",children:se.pattern})]}),o.jsx("span",{className:"text-xs text-muted-foreground mt-0.5",children:se.desc})]})},se.label))})]},W.category)),o.jsxs("div",{className:"space-y-2 border-t pt-4",children:[o.jsx("h5",{className:"text-xs font-semibold text-primary",children:"完整示例模板"}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>_("^(?P<n>\\S{1,20})是这样的$"),children:o.jsxs("div",{className:"flex flex-col items-start w-full",children:[o.jsxs("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:["^(?P<n>\\S","{1,20}",")是这样的$"]}),o.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"匹配「某事物是这样的」并捕获事物名称"})]})}),o.jsx(de,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>_("(?:[^,。.\\s]+\\s*)?我(?:也)?[没沒]要求你\\s*(?P<action>.+?)[.。,]?$"),children:o.jsxs("div",{className:"flex flex-col items-start w-full",children:[o.jsx("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:"(?:[^,。.\\s]+\\s*)?我(?:也)?[没沒]要求你\\s*(?P<action>.+?)[.。,]?$"}),o.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"匹配「我没要求你做某事」并捕获具体行为"})]})}),o.jsx(de,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>_("(?P<subject>.+?)(?:是|为什么|怎么)"),children:o.jsxs("div",{className:"flex flex-col items-start w-full",children:[o.jsx("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:"(?P<subject>.+?)(?:是|为什么|怎么)"}),o.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"捕获问题主题词"})]})})]})]})]}),o.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:[o.jsx("p",{className:"text-xs font-medium text-blue-900 dark:text-blue-100",children:"💡 使用提示"}),o.jsxs("ul",{className:"text-xs text-blue-700 dark:text-blue-300 space-y-1 list-disc list-inside",children:[o.jsx("li",{children:"点击输入框设置光标位置,然后点击按钮插入模式"}),o.jsxs("li",{children:["命名捕获组格式:",o.jsx("code",{className:"bg-blue-100 dark:bg-blue-900 px-1 rounded",children:"(?P<名称>模式)"})]}),o.jsxs("li",{children:["在 reaction 中使用 ",o.jsx("code",{className:"bg-blue-100 dark:bg-blue-900 px-1 rounded",children:"[名称]"})," 引用捕获的内容"]}),o.jsx("li",{children:"切换到测试器标签页验证正则表达式效果"})]})]})]}),o.jsxs(un,{value:"test",className:"space-y-4 mt-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{className:"text-sm font-medium",children:"当前正则表达式"}),o.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:T||"(未设置)"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{htmlFor:"test-text",className:"text-sm font-medium",children:"测试文本"}),o.jsx(Mr,{id:"test-text",value:B,onChange:W=>$(W.target.value),placeholder:`在此输入要测试的文本...
例如:打游戏是这样的`,className:"min-h-[100px] text-sm"})]}),z&&o.jsxs("div",{className:"rounded-md bg-destructive/10 border border-destructive/20 p-3",children:[o.jsx("p",{className:"text-sm text-destructive font-medium",children:"正则表达式错误"}),o.jsx("p",{className:"text-xs text-destructive/80 mt-1",children:z})]}),!z&&B&&o.jsxs("div",{className:"space-y-3",children:[o.jsx("div",{className:"flex items-center gap-2",children:U&&U.length>0?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"h-2 w-2 rounded-full bg-green-500"}),o.jsxs("span",{className:"text-sm font-medium text-green-600 dark:text-green-400",children:["匹配成功 (",U.length," 处)"]})]}):o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"h-2 w-2 rounded-full bg-gray-400"}),o.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"无匹配"})]})}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{className:"text-sm font-medium",children:"匹配高亮"}),o.jsx(gn,{className:"h-40 rounded-md bg-muted p-3",children:o.jsx("div",{className:"text-sm break-words",children:ee()})})]}),Object.keys(F).length>0&&o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{className:"text-sm font-medium",children:"命名捕获组"}),o.jsx(gn,{className:"h-32 rounded-md border p-3",children:o.jsx("div",{className:"space-y-2",children:Object.entries(F).map(([W,se])=>o.jsxs("div",{className:"flex items-start gap-2 text-sm",children:[o.jsxs("span",{className:"font-mono font-semibold text-primary min-w-[80px]",children:["[",W,"]"]}),o.jsx("span",{className:"text-muted-foreground",children:"="}),o.jsx("span",{className:"font-mono bg-muted px-2 py-0.5 rounded",children:se})]},W))})})]}),Object.keys(F).length>0&&E&&o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{className:"text-sm font-medium",children:"Reaction 替换预览"}),o.jsx(gn,{className:"h-48 rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3",children:o.jsx("div",{className:"text-sm break-words",children:J})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"reaction 中的 [name] 已被替换为对应的捕获组值"})]})]}),o.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:[o.jsx("p",{className:"text-xs font-medium text-blue-900 dark:text-blue-100",children:"💡 测试说明"}),o.jsxs("ul",{className:"text-xs text-blue-700 dark:text-blue-300 space-y-1 list-disc list-inside",children:[o.jsx("li",{children:"匹配的文本会以黄色背景高亮显示"}),o.jsx("li",{children:"命名捕获组的值会显示在下方列表中"}),o.jsx("li",{children:"Reaction 替换预览显示最终生成的反应内容"}),o.jsx("li",{children:"如需修改正则,切换回构建器标签页"})]})]})]})]})})]})]})},g=()=>{s({...t,keyword_rules:[...t.keyword_rules,{keywords:[],reaction:""}]})},x=T=>{s({...t,keyword_rules:t.keyword_rules.filter((E,_)=>_!==T)})},y=(T,E,_)=>{const A=[...t.keyword_rules];typeof _=="string"&&(A[T]={...A[T],reaction:_}),s({...t,keyword_rules:A})},w=T=>{const E=[...t.keyword_rules];E[T]={...E[T],keywords:[...E[T].keywords||[],""]},s({...t,keyword_rules:E})},S=(T,E)=>{const _=[...t.keyword_rules];_[T]={..._[T],keywords:(_[T].keywords||[]).filter((A,L)=>L!==E)},s({...t,keyword_rules:_})},k=(T,E,_)=>{const A=[...t.keyword_rules],L=[...A[T].keywords||[]];L[E]=_,A[T]={...A[T],keywords:L},s({...t,keyword_rules:A})},j=({rule:T})=>{const E=`{ regex = [${(T.regex||[]).map(_=>`"${_}"`).join(", ")}], reaction = "${T.reaction}" }`;return o.jsxs(zo,{children:[o.jsx(Io,{asChild:!0,children:o.jsxs(de,{variant:"outline",size:"sm",children:[o.jsx(Ea,{className:"h-4 w-4 mr-1"}),"预览"]})}),o.jsx(Xa,{className:"w-[95vw] sm:w-[500px]",children:o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),o.jsx(gn,{className:"h-60 rounded-md bg-muted p-3",children:o.jsx("pre",{className:"font-mono text-xs break-all",children:E})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})},N=({rule:T})=>{const E=`[[keyword_reaction.keyword_rules]]
keywords = [${(T.keywords||[]).map(_=>`"${_}"`).join(", ")}]
reaction = "${T.reaction}"`;return o.jsxs(zo,{children:[o.jsx(Io,{asChild:!0,children:o.jsxs(de,{variant:"outline",size:"sm",children:[o.jsx(Ea,{className:"h-4 w-4 mr-1"}),"预览"]})}),o.jsx(Xa,{className:"w-[95vw] sm:w-[500px]",children:o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),o.jsx(gn,{className:"h-60 rounded-md bg-muted p-3",children:o.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap break-all",children:E})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})};return o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-semibold mb-2",children:"关键词反应配置"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"配置触发特定反应的关键词和正则表达式规则"})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsx("h4",{className:"text-base font-semibold",children:"正则表达式规则"}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"使用正则表达式匹配消息内容"})]}),o.jsxs(de,{onClick:c,size:"sm",variant:"outline",children:[o.jsx(Ls,{className:"h-4 w-4 mr-1"}),"添加正则规则"]})]}),o.jsxs("div",{className:"space-y-3",children:[t.regex_rules.map((T,E)=>o.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("span",{className:"text-sm font-medium",children:["正则规则 ",E+1]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(m,{regex:T.regex&&T.regex[0]||"",reaction:T.reaction,onRegexChange:_=>h(E,"regex",_),onReactionChange:_=>h(E,"reaction",_)}),o.jsx(j,{rule:T}),o.jsxs(Dn,{children:[o.jsx(rs,{asChild:!0,children:o.jsx(de,{size:"sm",variant:"ghost",children:o.jsx(Sn,{className:"h-4 w-4"})})}),o.jsxs(Nn,{children:[o.jsxs(Cn,{children:[o.jsx(En,{children:"确认删除"}),o.jsxs(_n,{children:["确定要删除正则规则 ",E+1," 吗?此操作无法撤销。"]})]}),o.jsxs(Tn,{children:[o.jsx(Mn,{children:"取消"}),o.jsx(An,{onClick:()=>d(E),children:"删除"})]})]})]})]})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{className:"text-xs font-medium",children:"正则表达式Python 语法)"}),o.jsx(ze,{value:T.regex&&T.regex[0]||"",onChange:_=>h(E,"regex",_.target.value),placeholder:"例如:^(?P<n>\\\\S{1,20})是这样的$ (点击正则编辑器按钮可视化构建)",className:"font-mono text-sm"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:'支持命名捕获组 (?P<name>pattern),可在 reaction 中使用 [name] 引用。点击"正则编辑器"可视化构建和测试!'})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{className:"text-xs font-medium",children:"反应内容"}),o.jsx(Mr,{value:T.reaction,onChange:_=>h(E,"reaction",_.target.value),placeholder:`触发后麦麦的反应...
可以使用 [捕获组名] 来引用正则表达式中的内容`,rows:3,className:"text-sm"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"使用 [捕获组名] 引用正则表达式中的命名捕获组,例如 [n] 会被替换为捕获的内容"})]})]})]},E)),t.regex_rules.length===0&&o.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无正则规则,点击"添加正则规则"开始配置'})]})]}),o.jsxs("div",{className:"space-y-4 border-t pt-6",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsx("h4",{className:"text-base font-semibold",children:"关键词规则"}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"使用关键词列表匹配消息内容"})]}),o.jsxs(de,{onClick:g,size:"sm",variant:"outline",children:[o.jsx(Ls,{className:"h-4 w-4 mr-1"}),"添加关键词规则"]})]}),o.jsxs("div",{className:"space-y-3",children:[t.keyword_rules.map((T,E)=>o.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("span",{className:"text-sm font-medium",children:["关键词规则 ",E+1]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(N,{rule:T}),o.jsxs(Dn,{children:[o.jsx(rs,{asChild:!0,children:o.jsx(de,{size:"sm",variant:"ghost",children:o.jsx(Sn,{className:"h-4 w-4"})})}),o.jsxs(Nn,{children:[o.jsxs(Cn,{children:[o.jsx(En,{children:"确认删除"}),o.jsxs(_n,{children:["确定要删除关键词规则 ",E+1," 吗?此操作无法撤销。"]})]}),o.jsxs(Tn,{children:[o.jsx(Mn,{children:"取消"}),o.jsx(An,{onClick:()=>x(E),children:"删除"})]})]})]})]})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(he,{className:"text-xs font-medium",children:"关键词列表"}),o.jsxs(de,{onClick:()=>w(E),size:"sm",variant:"ghost",children:[o.jsx(Ls,{className:"h-3 w-3 mr-1"}),"添加关键词"]})]}),o.jsxs("div",{className:"space-y-2",children:[(T.keywords||[]).map((_,A)=>o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(ze,{value:_,onChange:L=>k(E,A,L.target.value),placeholder:"关键词",className:"flex-1"}),o.jsx(de,{onClick:()=>S(E,A),size:"sm",variant:"ghost",children:o.jsx(Sn,{className:"h-4 w-4"})})]},A)),(!T.keywords||T.keywords.length===0)&&o.jsx("p",{className:"text-xs text-muted-foreground text-center py-2",children:'暂无关键词,点击"添加关键词"开始配置'})]})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{className:"text-xs font-medium",children:"反应内容"}),o.jsx(Mr,{value:T.reaction,onChange:_=>y(E,"reaction",_.target.value),placeholder:"触发后麦麦的反应...",rows:3,className:"text-sm"})]})]})]},E)),t.keyword_rules.length===0&&o.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无关键词规则,点击"添加关键词规则"开始配置'})]})]})]}),o.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-semibold mb-4",children:"回复后处理配置"}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Bt,{id:"enable_response_post_process",checked:e.enable_response_post_process,onCheckedChange:T=>i({...e,enable_response_post_process:T})}),o.jsx(he,{htmlFor:"enable_response_post_process",className:"cursor-pointer",children:"启用回复后处理"})]}),o.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"包括错别字生成器和回复分割器"})]}),e.enable_response_post_process&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"border-t pt-6 space-y-4",children:o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center space-x-2 mb-4",children:[o.jsx(Bt,{id:"enable_chinese_typo",checked:n.enable,onCheckedChange:T=>a({...n,enable:T})}),o.jsx(he,{htmlFor:"enable_chinese_typo",className:"cursor-pointer font-semibold",children:"中文错别字生成器"})]}),o.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"为回复添加随机错别字,让麦麦的回复更自然"}),n.enable&&o.jsxs("div",{className:"grid gap-4 pl-6 border-l-2 border-primary/20",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"error_rate",className:"text-xs font-medium",children:"单字替换概率"}),o.jsx(ze,{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)})})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"min_freq",className:"text-xs font-medium",children:"最小字频阈值"}),o.jsx(ze,{id:"min_freq",type:"number",min:"0",value:n.min_freq,onChange:T=>a({...n,min_freq:parseInt(T.target.value)})})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"tone_error_rate",className:"text-xs font-medium",children:"声调错误概率"}),o.jsx(ze,{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)})})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"word_replace_rate",className:"text-xs font-medium",children:"整词替换概率"}),o.jsx(ze,{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)})})]})]})]})}),o.jsx("div",{className:"border-t pt-6 space-y-4",children:o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center space-x-2 mb-4",children:[o.jsx(Bt,{id:"enable_response_splitter",checked:r.enable,onCheckedChange:T=>l({...r,enable:T})}),o.jsx(he,{htmlFor:"enable_response_splitter",className:"cursor-pointer font-semibold",children:"回复分割器"})]}),o.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"控制回复的长度和句子数量"}),r.enable&&o.jsxs("div",{className:"grid gap-4 pl-6 border-l-2 border-primary/20",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"max_length",className:"text-xs font-medium",children:"最大长度"}),o.jsx(ze,{id:"max_length",type:"number",min:"1",value:r.max_length,onChange:T=>l({...r,max_length:parseInt(T.target.value)})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"回复允许的最大字符数"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"max_sentence_num",className:"text-xs font-medium",children:"最大句子数"}),o.jsx(ze,{id:"max_sentence_num",type:"number",min:"1",value:r.max_sentence_num,onChange:T=>l({...r,max_sentence_num:parseInt(T.target.value)})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"回复允许的最大句子数量"})]}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Bt,{id:"enable_kaomoji_protection",checked:r.enable_kaomoji_protection,onCheckedChange:T=>l({...r,enable_kaomoji_protection:T})}),o.jsx(he,{htmlFor:"enable_kaomoji_protection",className:"cursor-pointer",children:"启用颜文字保护"})]}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Bt,{id:"enable_overflow_return_all",checked:r.enable_overflow_return_all,onCheckedChange:T=>l({...r,enable_overflow_return_all:T})}),o.jsx(he,{htmlFor:"enable_overflow_return_all",className:"cursor-pointer",children:"超出时一次性返回全部"})]}),o.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"当句子数量超出限制时,合并后一次性返回所有内容"})]})]})})]})]})]})}function F0e({config:t,onChange:e}){return o.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[o.jsx("h3",{className:"text-lg font-semibold",children:"情绪设置"}),o.jsxs("div",{className:"grid gap-4",children:[o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Bt,{checked:t.enable_mood,onCheckedChange:n=>e({...t,enable_mood:n})}),o.jsx(he,{className:"cursor-pointer",children:"启用情绪系统"})]}),t.enable_mood&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{children:"情绪更新阈值"}),o.jsx(ze,{type:"number",min:"1",value:t.mood_update_threshold,onChange:n=>e({...t,mood_update_threshold:parseInt(n.target.value)})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"越高,更新越慢"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{children:"情感特征"}),o.jsx(Mr,{value:t.emotion_style,onChange:n=>e({...t,emotion_style:n.target.value}),placeholder:"影响情绪的变化情况",rows:2})]})]})]})]})}function q0e({config:t,onChange:e}){return o.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[o.jsx("h3",{className:"text-lg font-semibold",children:"语音设置"}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Bt,{checked:t.enable_asr,onCheckedChange:n=>e({...t,enable_asr:n})}),o.jsx(he,{className:"cursor-pointer",children:"启用语音识别"})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"启用后麦麦可以识别语音消息,需要配置语音识别模型"})]})}function $0e({config:t,onChange:e}){return o.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[o.jsx("h3",{className:"text-lg font-semibold",children:"LPMM 知识库设置"}),o.jsxs("div",{className:"grid gap-4",children:[o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Bt,{checked:t.enable,onCheckedChange:n=>e({...t,enable:n})}),o.jsx(he,{className:"cursor-pointer",children:"启用 LPMM 知识库"})]}),t.enable&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{children:"LPMM 模式"}),o.jsxs(Vt,{value:t.lpmm_mode,onValueChange:n=>e({...t,lpmm_mode:n}),children:[o.jsx($t,{children:o.jsx(Ut,{placeholder:"选择 LPMM 模式"})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"classic",children:"经典模式"}),o.jsx(De,{value:"agent",children:"Agent 模式"})]})]})]}),o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{children:"同义词搜索 TopK"}),o.jsx(ze,{type:"number",min:"1",value:t.rag_synonym_search_top_k,onChange:n=>e({...t,rag_synonym_search_top_k:parseInt(n.target.value)})})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{children:"同义词阈值"}),o.jsx(ze,{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)})})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{children:"实体提取线程数"}),o.jsx(ze,{type:"number",min:"1",value:t.info_extraction_workers,onChange:n=>e({...t,info_extraction_workers:parseInt(n.target.value)})})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{children:"嵌入向量维度"}),o.jsx(ze,{type:"number",min:"1",value:t.embedding_dimension,onChange:n=>e({...t,embedding_dimension:parseInt(n.target.value)})})]})]})]})]})]})}function H0e({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(""))},l=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"))},d=x=>{const y={...t.library_log_levels};delete y[x],e({...t,library_log_levels:y})},h=["DEBUG","INFO","WARNING","ERROR","CRITICAL"],m=["FULL","compact","lite"],g=["none","title","full"];return o.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-semibold mb-4",children:"日志配置"}),o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{children:"日期格式"}),o.jsx(ze,{value:t.date_style,onChange:x=>e({...t,date_style:x.target.value}),placeholder:"例如: m-d H:i:s"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"m=月, d=日, H=时, i=分, s=秒"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{children:"日志级别样式"}),o.jsxs(Vt,{value:t.log_level_style,onValueChange:x=>e({...t,log_level_style:x}),children:[o.jsx($t,{children:o.jsx(Ut,{})}),o.jsx(Ht,{children:m.map(x=>o.jsx(De,{value:x,children:x},x))})]})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{children:"日志文本颜色"}),o.jsxs(Vt,{value:t.color_text,onValueChange:x=>e({...t,color_text:x}),children:[o.jsx($t,{children:o.jsx(Ut,{})}),o.jsx(Ht,{children:g.map(x=>o.jsx(De,{value:x,children:x},x))})]})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{children:"全局日志级别"}),o.jsxs(Vt,{value:t.log_level,onValueChange:x=>e({...t,log_level:x}),children:[o.jsx($t,{children:o.jsx(Ut,{})}),o.jsx(Ht,{children:h.map(x=>o.jsx(De,{value:x,children:x},x))})]})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{children:"控制台日志级别"}),o.jsxs(Vt,{value:t.console_log_level,onValueChange:x=>e({...t,console_log_level:x}),children:[o.jsx($t,{children:o.jsx(Ut,{})}),o.jsx(Ht,{children:h.map(x=>o.jsx(De,{value:x,children:x},x))})]})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{children:"文件日志级别"}),o.jsxs(Vt,{value:t.file_log_level,onValueChange:x=>e({...t,file_log_level:x}),children:[o.jsx($t,{children:o.jsx(Ut,{})}),o.jsx(Ht,{children:h.map(x=>o.jsx(De,{value:x,children:x},x))})]})]})]})]}),o.jsxs("div",{children:[o.jsx(he,{className:"mb-2 block",children:"完全屏蔽的库"}),o.jsxs("div",{className:"flex gap-2 mb-2",children:[o.jsx(ze,{value:n,onChange:x=>r(x.target.value),placeholder:"输入库名",className:"flex-1",onKeyDown:x=>{x.key==="Enter"&&(x.preventDefault(),a())}}),o.jsx(de,{onClick:a,size:"sm",className:"flex-shrink-0",children:o.jsx(Ls,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),o.jsx("div",{className:"flex flex-wrap gap-2",children:t.suppress_libraries.map(x=>o.jsxs("div",{className:"flex items-center gap-1 bg-secondary px-3 py-1 rounded-md",children:[o.jsx("span",{className:"text-sm",children:x}),o.jsx(de,{variant:"ghost",size:"sm",className:"h-5 w-5 p-0",onClick:()=>l(x),children:o.jsx(Sn,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]},x))})]}),o.jsxs("div",{children:[o.jsx(he,{className:"mb-2 block",children:"特定库的日志级别"}),o.jsxs("div",{className:"flex gap-2 mb-2",children:[o.jsx(ze,{value:n,onChange:x=>r(x.target.value),placeholder:"输入库名",className:"flex-1"}),o.jsxs(Vt,{value:s,onValueChange:i,children:[o.jsx($t,{className:"w-32",children:o.jsx(Ut,{})}),o.jsx(Ht,{children:h.map(x=>o.jsx(De,{value:x,children:x},x))})]}),o.jsx(de,{onClick:c,size:"sm",children:o.jsx(Ls,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),o.jsx("div",{className:"space-y-2",children:Object.entries(t.library_log_levels).map(([x,y])=>o.jsxs("div",{className:"flex items-center justify-between bg-secondary px-3 py-2 rounded-md",children:[o.jsx("span",{className:"text-sm font-medium",children:x}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-sm text-muted-foreground",children:y}),o.jsx(de,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>d(x),children:o.jsx(Sn,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]})]},x))})]})]})}function Q0e({config:t,onChange:e}){return o.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[o.jsx("h3",{className:"text-lg font-semibold",children:"调试配置"}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(he,{children:"显示 Prompt"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"是否在日志中显示提示词"})]}),o.jsx(Bt,{checked:t.show_prompt,onCheckedChange:n=>e({...t,show_prompt:n})})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(he,{children:"显示回复器 Prompt"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示回复器的提示词"})]}),o.jsx(Bt,{checked:t.show_replyer_prompt,onCheckedChange:n=>e({...t,show_replyer_prompt:n})})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(he,{children:"显示回复器推理"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示回复器的推理过程"})]}),o.jsx(Bt,{checked:t.show_replyer_reasoning,onCheckedChange:n=>e({...t,show_replyer_reasoning:n})})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(he,{children:"显示 Jargon Prompt"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示术语相关的提示词"})]}),o.jsx(Bt,{checked:t.show_jargon_prompt,onCheckedChange:n=>e({...t,show_jargon_prompt:n})})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(he,{children:"显示记忆检索 Prompt"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示记忆检索相关的提示词"})]}),o.jsx(Bt,{checked:t.show_memory_prompt,onCheckedChange:n=>e({...t,show_memory_prompt:n})})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(he,{children:"显示 Planner Prompt"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示 Planner 的提示词和原始返回结果"})]}),o.jsx(Bt,{checked:t.show_planner_prompt,onCheckedChange:n=>e({...t,show_planner_prompt:n})})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(he,{children:"显示 LPMM 相关文段"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示 LPMM 知识库找到的相关文段日志"})]}),o.jsx(Bt,{checked:t.show_lpmm_paragraph,onCheckedChange:n=>e({...t,show_lpmm_paragraph:n})})]})]})]})}function V0e({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((l,c)=>c!==a)})};return o.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-semibold mb-4",children:"MaimMessage 服务配置"}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(he,{children:"启用自定义服务器"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"是否使用自定义的 MaimMessage 服务器"})]}),o.jsx(Bt,{checked:t.use_custom,onCheckedChange:a=>e({...t,use_custom:a})})]}),t.use_custom&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{children:"主机地址"}),o.jsx(ze,{value:t.host,onChange:a=>e({...t,host:a.target.value}),placeholder:"127.0.0.1"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{children:"端口号"}),o.jsx(ze,{type:"number",value:t.port,onChange:a=>e({...t,port:parseInt(a.target.value)}),placeholder:"8090"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{children:"连接模式"}),o.jsxs(Vt,{value:t.mode,onValueChange:a=>e({...t,mode:a}),children:[o.jsx($t,{children:o.jsx(Ut,{})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"ws",children:"WebSocket (ws)"}),o.jsx(De,{value:"tcp",children:"TCP"})]})]})]}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Bt,{checked:t.use_wss,onCheckedChange:a=>e({...t,use_wss:a}),disabled:t.mode!=="ws"}),o.jsx(he,{children:"使用 WSS 安全连接"})]})]}),t.use_wss&&t.mode==="ws"&&o.jsxs("div",{className:"grid gap-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{children:"SSL 证书文件路径"}),o.jsx(ze,{value:t.cert_file,onChange:a=>e({...t,cert_file:a.target.value}),placeholder:"cert.pem"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{children:"SSL 密钥文件路径"}),o.jsx(ze,{value:t.key_file,onChange:a=>e({...t,key_file:a.target.value}),placeholder:"key.pem"})]})]})]})]})]}),o.jsxs("div",{children:[o.jsx(he,{className:"mb-2 block",children:"认证令牌"}),o.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"用于 API 验证,为空则不启用验证"}),o.jsxs("div",{className:"flex gap-2 mb-2",children:[o.jsx(ze,{value:n,onChange:a=>r(a.target.value),placeholder:"输入认证令牌",onKeyDown:a=>{a.key==="Enter"&&(a.preventDefault(),s())}}),o.jsx(de,{onClick:s,size:"sm",children:o.jsx(Ls,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),o.jsx("div",{className:"space-y-2",children:t.auth_token.map((a,l)=>o.jsxs("div",{className:"flex items-center justify-between bg-secondary px-3 py-2 rounded-md",children:[o.jsx("span",{className:"text-sm font-mono",children:a}),o.jsx(de,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>i(l),children:o.jsx(Sn,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]},l))})]})]})}function U0e({config:t,onChange:e}){return o.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[o.jsx("h3",{className:"text-lg font-semibold",children:"统计信息"}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(he,{children:"启用统计信息发送"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"发送匿名统计信息,帮助我们了解全球有多少只麦麦在运行"})]}),o.jsx(Bt,{checked:t.enable,onCheckedChange:n=>e({...t,enable:n})})]})]})}const _f=b.forwardRef(({className:t,...e},n)=>o.jsx("div",{className:"relative w-full overflow-auto",children:o.jsx("table",{ref:n,className:xe("w-full caption-bottom text-sm",t),...e})}));_f.displayName="Table";const Af=b.forwardRef(({className:t,...e},n)=>o.jsx("thead",{ref:n,className:xe("[&_tr]:border-b",t),...e}));Af.displayName="TableHeader";const Mf=b.forwardRef(({className:t,...e},n)=>o.jsx("tbody",{ref:n,className:xe("[&_tr:last-child]:border-0",t),...e}));Mf.displayName="TableBody";const W0e=b.forwardRef(({className:t,...e},n)=>o.jsx("tfoot",{ref:n,className:xe("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",t),...e}));W0e.displayName="TableFooter";const Is=b.forwardRef(({className:t,...e},n)=>o.jsx("tr",{ref:n,className:xe("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",t),...e}));Is.displayName="TableRow";const pn=b.forwardRef(({className:t,...e},n)=>o.jsx("th",{ref:n,className:xe("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}));pn.displayName="TableHead";const Gt=b.forwardRef(({className:t,...e},n)=>o.jsx("td",{ref:n,className:xe("px-4 py-3 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...e}));Gt.displayName="TableCell";const G0e=b.forwardRef(({className:t,...e},n)=>o.jsx("caption",{ref:n,className:xe("mt-4 text-sm text-muted-foreground",t),...e}));G0e.displayName="TableCaption";var xA=1,X0e=.9,Y0e=.8,K0e=.17,mS=.1,pS=.999,Z0e=.9999,J0e=.99,epe=/[\\\/_+.#"@\[\(\{&]/,tpe=/[\\\/_+.#"@\[\(\{&]/g,npe=/[\s-]/,jH=/[\s-]/g;function pO(t,e,n,r,s,i,a){if(i===e.length)return s===t.length?xA:J0e;var l=`${s},${i}`;if(a[l]!==void 0)return a[l];for(var c=r.charAt(i),d=n.indexOf(c,s),h=0,m,g,x,y;d>=0;)m=pO(t,e,n,r,d+1,i+1,a),m>h&&(d===s?m*=xA:epe.test(t.charAt(d-1))?(m*=Y0e,x=t.slice(s,d-1).match(tpe),x&&s>0&&(m*=Math.pow(pS,x.length))):npe.test(t.charAt(d-1))?(m*=X0e,y=t.slice(s,d-1).match(jH),y&&s>0&&(m*=Math.pow(pS,y.length))):(m*=K0e,s>0&&(m*=Math.pow(pS,d-s))),t.charAt(d)!==e.charAt(i)&&(m*=Z0e)),(m<mS&&n.charAt(d-1)===r.charAt(i+1)||r.charAt(i+1)===r.charAt(i)&&n.charAt(d-1)!==r.charAt(i))&&(g=pO(t,e,n,r,d+1,i+2,a),g*mS>m&&(m=g*mS)),m>h&&(h=m),d=n.indexOf(c,d+1);return a[l]=h,h}function vA(t){return t.toLowerCase().replace(jH," ")}function rpe(t,e,n){return t=n&&n.length>0?`${t+" "+n.join(" ")}`:t,pO(t,e,vA(t),vA(e),0,0,{})}var spe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],cu=spe.reduce((t,e)=>{const n=Fy(`Primitive.${e}`),r=b.forwardRef((s,i)=>{const{asChild:a,...l}=s,c=a?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(c,{...l,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),Qm='[cmdk-group=""]',gS='[cmdk-group-items=""]',ipe='[cmdk-group-heading=""]',NH='[cmdk-item=""]',yA=`${NH}:not([aria-disabled="true"])`,gO="cmdk-item-select",wh="data-value",ape=(t,e,n)=>rpe(t,e,n),CH=b.createContext(void 0),Jp=()=>b.useContext(CH),TH=b.createContext(void 0),q6=()=>b.useContext(TH),EH=b.createContext(void 0),_H=b.forwardRef((t,e)=>{let n=Sh(()=>{var G,I;return{search:"",value:(I=(G=t.value)!=null?G:t.defaultValue)!=null?I:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=Sh(()=>new Set),s=Sh(()=>new Map),i=Sh(()=>new Map),a=Sh(()=>new Set),l=AH(t),{label:c,children:d,value:h,onValueChange:m,filter:g,shouldFilter:x,loop:y,disablePointerSelection:w=!1,vimBindings:S=!0,...k}=t,j=Ui(),N=Ui(),T=Ui(),E=b.useRef(null),_=xpe();dd(()=>{if(h!==void 0){let G=h.trim();n.current.value=G,A.emit()}},[h]),dd(()=>{_(6,te)},[]);let A=b.useMemo(()=>({subscribe:G=>(a.current.add(G),()=>a.current.delete(G)),snapshot:()=>n.current,setState:(G,I,V)=>{var ee,ne,W,se;if(!Object.is(n.current[G],I)){if(n.current[G]=I,G==="search")U(),B(),_(1,$);else if(G==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let re=document.getElementById(T);re?re.focus():(ee=document.getElementById(j))==null||ee.focus()}if(_(7,()=>{var re;n.current.selectedItemId=(re=z())==null?void 0:re.id,A.emit()}),V||_(5,te),((ne=l.current)==null?void 0:ne.value)!==void 0){let re=I??"";(se=(W=l.current).onValueChange)==null||se.call(W,re);return}}A.emit()}},emit:()=>{a.current.forEach(G=>G())}}),[]),L=b.useMemo(()=>({value:(G,I,V)=>{var ee;I!==((ee=i.current.get(G))==null?void 0:ee.value)&&(i.current.set(G,{value:I,keywords:V}),n.current.filtered.items.set(G,P(I,V)),_(2,()=>{B(),A.emit()}))},item:(G,I)=>(r.current.add(G),I&&(s.current.has(I)?s.current.get(I).add(G):s.current.set(I,new Set([G]))),_(3,()=>{U(),B(),n.current.value||$(),A.emit()}),()=>{i.current.delete(G),r.current.delete(G),n.current.filtered.items.delete(G);let V=z();_(4,()=>{U(),V?.getAttribute("id")===G&&$(),A.emit()})}),group:G=>(s.current.has(G)||s.current.set(G,new Set),()=>{i.current.delete(G),s.current.delete(G)}),filter:()=>l.current.shouldFilter,label:c||t["aria-label"],getDisablePointerSelection:()=>l.current.disablePointerSelection,listId:j,inputId:T,labelId:N,listInnerRef:E}),[]);function P(G,I){var V,ee;let ne=(ee=(V=l.current)==null?void 0:V.filter)!=null?ee:ape;return G?ne(G,n.current.search,I):0}function B(){if(!n.current.search||l.current.shouldFilter===!1)return;let G=n.current.filtered.items,I=[];n.current.filtered.groups.forEach(ee=>{let ne=s.current.get(ee),W=0;ne.forEach(se=>{let re=G.get(se);W=Math.max(re,W)}),I.push([ee,W])});let V=E.current;Q().sort((ee,ne)=>{var W,se;let re=ee.getAttribute("id"),oe=ne.getAttribute("id");return((W=G.get(oe))!=null?W:0)-((se=G.get(re))!=null?se:0)}).forEach(ee=>{let ne=ee.closest(gS);ne?ne.appendChild(ee.parentElement===ne?ee:ee.closest(`${gS} > *`)):V.appendChild(ee.parentElement===V?ee:ee.closest(`${gS} > *`))}),I.sort((ee,ne)=>ne[1]-ee[1]).forEach(ee=>{var ne;let W=(ne=E.current)==null?void 0:ne.querySelector(`${Qm}[${wh}="${encodeURIComponent(ee[0])}"]`);W?.parentElement.appendChild(W)})}function $(){let G=Q().find(V=>V.getAttribute("aria-disabled")!=="true"),I=G?.getAttribute(wh);A.setState("value",I||void 0)}function U(){var G,I,V,ee;if(!n.current.search||l.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let ne=0;for(let W of r.current){let se=(I=(G=i.current.get(W))==null?void 0:G.value)!=null?I:"",re=(ee=(V=i.current.get(W))==null?void 0:V.keywords)!=null?ee:[],oe=P(se,re);n.current.filtered.items.set(W,oe),oe>0&&ne++}for(let[W,se]of s.current)for(let re of se)if(n.current.filtered.items.get(re)>0){n.current.filtered.groups.add(W);break}n.current.filtered.count=ne}function te(){var G,I,V;let ee=z();ee&&(((G=ee.parentElement)==null?void 0:G.firstChild)===ee&&((V=(I=ee.closest(Qm))==null?void 0:I.querySelector(ipe))==null||V.scrollIntoView({block:"nearest"})),ee.scrollIntoView({block:"nearest"}))}function z(){var G;return(G=E.current)==null?void 0:G.querySelector(`${NH}[aria-selected="true"]`)}function Q(){var G;return Array.from(((G=E.current)==null?void 0:G.querySelectorAll(yA))||[])}function F(G){let I=Q()[G];I&&A.setState("value",I.getAttribute(wh))}function Y(G){var I;let V=z(),ee=Q(),ne=ee.findIndex(se=>se===V),W=ee[ne+G];(I=l.current)!=null&&I.loop&&(W=ne+G<0?ee[ee.length-1]:ne+G===ee.length?ee[0]:ee[ne+G]),W&&A.setState("value",W.getAttribute(wh))}function J(G){let I=z(),V=I?.closest(Qm),ee;for(;V&&!ee;)V=G>0?ppe(V,Qm):gpe(V,Qm),ee=V?.querySelector(yA);ee?A.setState("value",ee.getAttribute(wh)):Y(G)}let X=()=>F(Q().length-1),R=G=>{G.preventDefault(),G.metaKey?X():G.altKey?J(1):Y(1)},ie=G=>{G.preventDefault(),G.metaKey?F(0):G.altKey?J(-1):Y(-1)};return b.createElement(cu.div,{ref:e,tabIndex:-1,...k,"cmdk-root":"",onKeyDown:G=>{var I;(I=k.onKeyDown)==null||I.call(k,G);let V=G.nativeEvent.isComposing||G.keyCode===229;if(!(G.defaultPrevented||V))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&&ie(G);break}case"ArrowUp":{ie(G);break}case"Home":{G.preventDefault(),F(0);break}case"End":{G.preventDefault(),X();break}case"Enter":{G.preventDefault();let ee=z();if(ee){let ne=new Event(gO);ee.dispatchEvent(ne)}}}}},b.createElement("label",{"cmdk-label":"",htmlFor:L.inputId,id:L.labelId,style:ype},c),kb(t,G=>b.createElement(TH.Provider,{value:A},b.createElement(CH.Provider,{value:L},G))))}),ope=b.forwardRef((t,e)=>{var n,r;let s=Ui(),i=b.useRef(null),a=b.useContext(EH),l=Jp(),c=AH(t),d=(r=(n=c.current)==null?void 0:n.forceMount)!=null?r:a?.forceMount;dd(()=>{if(!d)return l.item(s,a?.id)},[d]);let h=MH(s,i,[t.value,t.children,i],t.keywords),m=q6(),g=Zc(_=>_.value&&_.value===h.current),x=Zc(_=>d||l.filter()===!1?!0:_.search?_.filtered.items.get(s)>0:!0);b.useEffect(()=>{let _=i.current;if(!(!_||t.disabled))return _.addEventListener(gO,y),()=>_.removeEventListener(gO,y)},[x,t.onSelect,t.disabled]);function y(){var _,A;w(),(A=(_=c.current).onSelect)==null||A.call(_,h.current)}function w(){m.setState("value",h.current,!0)}if(!x)return null;let{disabled:S,value:k,onSelect:j,forceMount:N,keywords:T,...E}=t;return b.createElement(cu.div,{ref:Qc(i,e),...E,id:s,"cmdk-item":"",role:"option","aria-disabled":!!S,"aria-selected":!!g,"data-disabled":!!S,"data-selected":!!g,onPointerMove:S||l.getDisablePointerSelection()?void 0:w,onClick:S?void 0:y},t.children)}),lpe=b.forwardRef((t,e)=>{let{heading:n,children:r,forceMount:s,...i}=t,a=Ui(),l=b.useRef(null),c=b.useRef(null),d=Ui(),h=Jp(),m=Zc(x=>s||h.filter()===!1?!0:x.search?x.filtered.groups.has(a):!0);dd(()=>h.group(a),[]),MH(a,l,[t.value,t.heading,c]);let g=b.useMemo(()=>({id:a,forceMount:s}),[s]);return b.createElement(cu.div,{ref:Qc(l,e),...i,"cmdk-group":"",role:"presentation",hidden:m?void 0:!0},n&&b.createElement("div",{ref:c,"cmdk-group-heading":"","aria-hidden":!0,id:d},n),kb(t,x=>b.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?d:void 0},b.createElement(EH.Provider,{value:g},x))))}),cpe=b.forwardRef((t,e)=>{let{alwaysRender:n,...r}=t,s=b.useRef(null),i=Zc(a=>!a.search);return!n&&!i?null:b.createElement(cu.div,{ref:Qc(s,e),...r,"cmdk-separator":"",role:"separator"})}),upe=b.forwardRef((t,e)=>{let{onValueChange:n,...r}=t,s=t.value!=null,i=q6(),a=Zc(d=>d.search),l=Zc(d=>d.selectedItemId),c=Jp();return b.useEffect(()=>{t.value!=null&&i.setState("search",t.value)},[t.value]),b.createElement(cu.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":l,id:c.inputId,type:"text",value:s?t.value:a,onChange:d=>{s||i.setState("search",d.target.value),n?.(d.target.value)}})}),dpe=b.forwardRef((t,e)=>{let{children:n,label:r="Suggestions",...s}=t,i=b.useRef(null),a=b.useRef(null),l=Zc(d=>d.selectedItemId),c=Jp();return b.useEffect(()=>{if(a.current&&i.current){let d=a.current,h=i.current,m,g=new ResizeObserver(()=>{m=requestAnimationFrame(()=>{let x=d.offsetHeight;h.style.setProperty("--cmdk-list-height",x.toFixed(1)+"px")})});return g.observe(d),()=>{cancelAnimationFrame(m),g.unobserve(d)}}},[]),b.createElement(cu.div,{ref:Qc(i,e),...s,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":l,"aria-label":r,id:c.listId},kb(t,d=>b.createElement("div",{ref:Qc(a,c.listInnerRef),"cmdk-list-sizer":""},d)))}),hpe=b.forwardRef((t,e)=>{let{open:n,onOpenChange:r,overlayClassName:s,contentClassName:i,container:a,...l}=t;return b.createElement(Nj,{open:n,onOpenChange:r},b.createElement(kj,{container:a},b.createElement(qy,{"cmdk-overlay":"",className:s}),b.createElement($y,{"aria-label":t.label,"cmdk-dialog":"",className:i},b.createElement(_H,{ref:e,...l}))))}),fpe=b.forwardRef((t,e)=>Zc(n=>n.filtered.count===0)?b.createElement(cu.div,{ref:e,...t,"cmdk-empty":"",role:"presentation"}):null),mpe=b.forwardRef((t,e)=>{let{progress:n,children:r,label:s="Loading...",...i}=t;return b.createElement(cu.div,{ref:e,...i,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":s},kb(t,a=>b.createElement("div",{"aria-hidden":!0},a)))}),Ci=Object.assign(_H,{List:dpe,Item:ope,Input:upe,Group:lpe,Separator:cpe,Dialog:hpe,Empty:fpe,Loading:mpe});function ppe(t,e){let n=t.nextElementSibling;for(;n;){if(n.matches(e))return n;n=n.nextElementSibling}}function gpe(t,e){let n=t.previousElementSibling;for(;n;){if(n.matches(e))return n;n=n.previousElementSibling}}function AH(t){let e=b.useRef(t);return dd(()=>{e.current=t}),e}var dd=typeof window>"u"?b.useEffect:b.useLayoutEffect;function Sh(t){let e=b.useRef();return e.current===void 0&&(e.current=t()),e}function Zc(t){let e=q6(),n=()=>t(e.snapshot());return b.useSyncExternalStore(e.subscribe,n,n)}function MH(t,e,n,r=[]){let s=b.useRef(),i=Jp();return dd(()=>{var a;let l=(()=>{var d;for(let h of n){if(typeof h=="string")return h.trim();if(typeof h=="object"&&"current"in h)return h.current?(d=h.current.textContent)==null?void 0:d.trim():s.current}})(),c=r.map(d=>d.trim());i.value(t,l,c),(a=e.current)==null||a.setAttribute(wh,l),s.current=l}),s}var xpe=()=>{let[t,e]=b.useState(),n=Sh(()=>new Map);return dd(()=>{n.current.forEach(r=>r()),n.current=new Map},[t]),(r,s)=>{n.current.set(r,s),e({})}};function vpe(t){let e=t.type;return typeof e=="function"?e(t.props):"render"in e?e.render(t.props):t}function kb({asChild:t,children:e},n){return t&&b.isValidElement(e)?b.cloneElement(vpe(e),{ref:e.ref},n(e.props.children)):n(e)}var ype={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const Ob=b.forwardRef(({className:t,...e},n)=>o.jsx(Ci,{ref:n,className:xe("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",t),...e}));Ob.displayName=Ci.displayName;const jb=b.forwardRef(({className:t,...e},n)=>o.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[o.jsx(Ni,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),o.jsx(Ci.Input,{ref:n,className:xe("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})]}));jb.displayName=Ci.Input.displayName;const Nb=b.forwardRef(({className:t,...e},n)=>o.jsx(Ci.List,{ref:n,className:xe("max-h-[300px] overflow-y-auto overflow-x-hidden",t),...e}));Nb.displayName=Ci.List.displayName;const Cb=b.forwardRef((t,e)=>o.jsx(Ci.Empty,{ref:e,className:"py-6 text-center text-sm",...t}));Cb.displayName=Ci.Empty.displayName;const ap=b.forwardRef(({className:t,...e},n)=>o.jsx(Ci.Group,{ref:n,className:xe("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}));ap.displayName=Ci.Group.displayName;const bpe=b.forwardRef(({className:t,...e},n)=>o.jsx(Ci.Separator,{ref:n,className:xe("-mx-1 h-px bg-border",t),...e}));bpe.displayName=Ci.Separator.displayName;const op=b.forwardRef(({className:t,...e},n)=>o.jsx(Ci.Item,{ref:n,className:xe("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}));op.displayName=Ci.Item.displayName;const Oi=b.forwardRef(({className:t,...e},n)=>o.jsx(gI,{ref:n,className:xe("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:o.jsx(Ree,{className:xe("grid place-content-center text-current"),children:o.jsx(Ro,{className:"h-4 w-4"})})}));Oi.displayName=gI.displayName;const RH=b.createContext(null),DH="maibot-completed-tours";function wpe(){try{const t=localStorage.getItem(DH);return t?new Set(JSON.parse(t)):new Set}catch{return new Set}}function bA(t){localStorage.setItem(DH,JSON.stringify([...t]))}function Spe({children:t}){const[e,n]=b.useState({activeTourId:null,stepIndex:0,isRunning:!1}),r=b.useRef(new Map),[,s]=b.useState(0),[i,a]=b.useState(wpe),l=b.useCallback((N,T)=>{r.current.set(N,T),s(E=>E+1)},[]),c=b.useCallback(N=>{r.current.delete(N),n(T=>T.activeTourId===N?{...T,activeTourId:null,isRunning:!1,stepIndex:0}:T)},[]),d=b.useCallback((N,T=0)=>{r.current.has(N)&&n({activeTourId:N,stepIndex:T,isRunning:!0})},[]),h=b.useCallback(()=>{n(N=>({...N,isRunning:!1}))},[]),m=b.useCallback(N=>{n(T=>({...T,stepIndex:N}))},[]),g=b.useCallback(()=>{n(N=>({...N,stepIndex:N.stepIndex+1}))},[]),x=b.useCallback(()=>{n(N=>({...N,stepIndex:Math.max(0,N.stepIndex-1)}))},[]),y=b.useCallback(()=>e.activeTourId?r.current.get(e.activeTourId)||[]:[],[e.activeTourId]),w=b.useCallback(N=>{a(T=>{const E=new Set(T);return E.add(N),bA(E),E})},[]),S=b.useCallback(N=>{const{action:T,index:E,status:_,type:A}=N,L=["finished","skipped"];if(T==="close"){n(P=>({...P,isRunning:!1,stepIndex:0}));return}L.includes(_)?n(P=>(_==="finished"&&P.activeTourId&&setTimeout(()=>w(P.activeTourId),0),{...P,isRunning:!1,stepIndex:0})):A==="step:after"&&(T==="next"?n(P=>({...P,stepIndex:E+1})):T==="prev"&&n(P=>({...P,stepIndex:E-1})))},[w]),k=b.useCallback(N=>i.has(N),[i]),j=b.useCallback(N=>{a(T=>{const E=new Set(T);return E.delete(N),bA(E),E})},[]);return o.jsx(RH.Provider,{value:{state:e,tours:r.current,registerTour:l,unregisterTour:c,startTour:d,stopTour:h,goToStep:m,nextStep:g,prevStep:x,getCurrentSteps:y,handleJoyrideCallback:S,isTourCompleted:k,markTourCompleted:w,resetTourCompleted:j},children:t})}function PH(t){return e=>typeof e===t}var kpe=PH("function"),Ope=t=>t===null,wA=t=>Object.prototype.toString.call(t).slice(8,-1)==="RegExp",SA=t=>!jpe(t)&&!Ope(t)&&(kpe(t)||typeof t=="object"),jpe=PH("undefined");function Npe(t,e){const{length:n}=t;if(n!==e.length)return!1;for(let r=n;r--!==0;)if(!ei(t[r],e[r]))return!1;return!0}function Cpe(t,e){if(t.byteLength!==e.byteLength)return!1;const n=new DataView(t.buffer),r=new DataView(e.buffer);let s=t.byteLength;for(;s--;)if(n.getUint8(s)!==r.getUint8(s))return!1;return!0}function Tpe(t,e){if(t.size!==e.size)return!1;for(const n of t.entries())if(!e.has(n[0]))return!1;for(const n of t.entries())if(!ei(n[1],e.get(n[0])))return!1;return!0}function Epe(t,e){if(t.size!==e.size)return!1;for(const n of t.entries())if(!e.has(n[0]))return!1;return!0}function ei(t,e){if(t===e)return!0;if(t&&SA(t)&&e&&SA(e)){if(t.constructor!==e.constructor)return!1;if(Array.isArray(t)&&Array.isArray(e))return Npe(t,e);if(t instanceof Map&&e instanceof Map)return Tpe(t,e);if(t instanceof Set&&e instanceof Set)return Epe(t,e);if(ArrayBuffer.isView(t)&&ArrayBuffer.isView(e))return Cpe(t,e);if(wA(t)&&wA(e))return t.source===e.source&&t.flags===e.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===e.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===e.toString();const n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(let s=n.length;s--!==0;)if(!Object.prototype.hasOwnProperty.call(e,n[s]))return!1;for(let s=n.length;s--!==0;){const i=n[s];if(!(i==="_owner"&&t.$$typeof)&&!ei(t[i],e[i]))return!1}return!0}return Number.isNaN(t)&&Number.isNaN(e)?!0:t===e}var _pe=["Array","ArrayBuffer","AsyncFunction","AsyncGenerator","AsyncGeneratorFunction","Date","Error","Function","Generator","GeneratorFunction","HTMLElement","Map","Object","Promise","RegExp","Set","WeakMap","WeakSet"],Ape=["bigint","boolean","null","number","string","symbol","undefined"];function Tb(t){const e=Object.prototype.toString.call(t).slice(8,-1);if(/HTML\w+Element/.test(e))return"HTMLElement";if(Mpe(e))return e}function ro(t){return e=>Tb(e)===t}function Mpe(t){return _pe.includes(t)}function Rf(t){return e=>typeof e===t}function Rpe(t){return Ape.includes(t)}var Dpe=["innerHTML","ownerDocument","style","attributes","nodeValue"];function ct(t){if(t===null)return"null";switch(typeof t){case"bigint":return"bigint";case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"symbol":return"symbol";case"undefined":return"undefined"}if(ct.array(t))return"Array";if(ct.plainFunction(t))return"Function";const e=Tb(t);return e||"Object"}ct.array=Array.isArray;ct.arrayOf=(t,e)=>!ct.array(t)&&!ct.function(e)?!1:t.every(n=>e(n));ct.asyncGeneratorFunction=t=>Tb(t)==="AsyncGeneratorFunction";ct.asyncFunction=ro("AsyncFunction");ct.bigint=Rf("bigint");ct.boolean=t=>t===!0||t===!1;ct.date=ro("Date");ct.defined=t=>!ct.undefined(t);ct.domElement=t=>ct.object(t)&&!ct.plainObject(t)&&t.nodeType===1&&ct.string(t.nodeName)&&Dpe.every(e=>e in t);ct.empty=t=>ct.string(t)&&t.length===0||ct.array(t)&&t.length===0||ct.object(t)&&!ct.map(t)&&!ct.set(t)&&Object.keys(t).length===0||ct.set(t)&&t.size===0||ct.map(t)&&t.size===0;ct.error=ro("Error");ct.function=Rf("function");ct.generator=t=>ct.iterable(t)&&ct.function(t.next)&&ct.function(t.throw);ct.generatorFunction=ro("GeneratorFunction");ct.instanceOf=(t,e)=>!t||!e?!1:Object.getPrototypeOf(t)===e.prototype;ct.iterable=t=>!ct.nullOrUndefined(t)&&ct.function(t[Symbol.iterator]);ct.map=ro("Map");ct.nan=t=>Number.isNaN(t);ct.null=t=>t===null;ct.nullOrUndefined=t=>ct.null(t)||ct.undefined(t);ct.number=t=>Rf("number")(t)&&!ct.nan(t);ct.numericString=t=>ct.string(t)&&t.length>0&&!Number.isNaN(Number(t));ct.object=t=>!ct.nullOrUndefined(t)&&(ct.function(t)||typeof t=="object");ct.oneOf=(t,e)=>ct.array(t)?t.indexOf(e)>-1:!1;ct.plainFunction=ro("Function");ct.plainObject=t=>{if(Tb(t)!=="Object")return!1;const e=Object.getPrototypeOf(t);return e===null||e===Object.getPrototypeOf({})};ct.primitive=t=>ct.null(t)||Rpe(typeof t);ct.promise=ro("Promise");ct.propertyOf=(t,e,n)=>{if(!ct.object(t)||!e)return!1;const r=t[e];return ct.function(n)?n(r):ct.defined(r)};ct.regexp=ro("RegExp");ct.set=ro("Set");ct.string=Rf("string");ct.symbol=Rf("symbol");ct.undefined=Rf("undefined");ct.weakMap=ro("WeakMap");ct.weakSet=ro("WeakSet");var ft=ct;function Ppe(...t){return t.every(e=>ft.string(e)||ft.array(e)||ft.plainObject(e))}function zpe(t,e,n){return zH(t,e)?[t,e].every(ft.array)?!t.some(CA(n))&&e.some(CA(n)):[t,e].every(ft.plainObject)?!Object.entries(t).some(NA(n))&&Object.entries(e).some(NA(n)):e===n:!1}function kA(t,e,n){const{actual:r,key:s,previous:i,type:a}=n,l=To(t,s),c=To(e,s);let d=[l,c].every(ft.number)&&(a==="increased"?l<c:l>c);return ft.undefined(r)||(d=d&&c===r),ft.undefined(i)||(d=d&&l===i),d}function OA(t,e,n){const{key:r,type:s,value:i}=n,a=To(t,r),l=To(e,r),c=s==="added"?a:l,d=s==="added"?l:a;if(!ft.nullOrUndefined(i)){if(ft.defined(c)){if(ft.array(c)||ft.plainObject(c))return zpe(c,d,i)}else return ei(d,i);return!1}return[a,l].every(ft.array)?!d.every($6(c)):[a,l].every(ft.plainObject)?Ipe(Object.keys(c),Object.keys(d)):![a,l].every(h=>ft.primitive(h)&&ft.defined(h))&&(s==="added"?!ft.defined(a)&&ft.defined(l):ft.defined(a)&&!ft.defined(l))}function jA(t,e,{key:n}={}){let r=To(t,n),s=To(e,n);if(!zH(r,s))throw new TypeError("Inputs have different types");if(!Ppe(r,s))throw new TypeError("Inputs don't have length");return[r,s].every(ft.plainObject)&&(r=Object.keys(r),s=Object.keys(s)),[r,s]}function NA(t){return([e,n])=>ft.array(t)?ei(t,n)||t.some(r=>ei(r,n)||ft.array(n)&&$6(n)(r)):ft.plainObject(t)&&t[e]?!!t[e]&&ei(t[e],n):ei(t,n)}function Ipe(t,e){return e.some(n=>!t.includes(n))}function CA(t){return e=>ft.array(t)?t.some(n=>ei(n,e)||ft.array(e)&&$6(e)(n)):ei(t,e)}function Vm(t,e){return ft.array(t)?t.some(n=>ei(n,e)):ei(t,e)}function $6(t){return e=>t.some(n=>ei(n,e))}function zH(...t){return t.every(ft.array)||t.every(ft.number)||t.every(ft.plainObject)||t.every(ft.string)}function To(t,e){return ft.plainObject(t)||ft.array(t)?ft.string(e)?e.split(".").reduce((r,s)=>r&&r[s],t):ft.number(e)?t[e]:t:t}function uy(t,e){if([t,e].some(ft.nullOrUndefined))throw new Error("Missing required parameters");if(![t,e].every(h=>ft.plainObject(h)||ft.array(h)))throw new Error("Expected plain objects or array");return{added:(h,m)=>{try{return OA(t,e,{key:h,type:"added",value:m})}catch{return!1}},changed:(h,m,g)=>{try{const x=To(t,h),y=To(e,h),w=ft.defined(m),S=ft.defined(g);if(w||S){const k=S?Vm(g,x):!Vm(m,x),j=Vm(m,y);return k&&j}return[x,y].every(ft.array)||[x,y].every(ft.plainObject)?!ei(x,y):x!==y}catch{return!1}},changedFrom:(h,m,g)=>{if(!ft.defined(h))return!1;try{const x=To(t,h),y=To(e,h),w=ft.defined(g);return Vm(m,x)&&(w?Vm(g,y):!w)}catch{return!1}},decreased:(h,m,g)=>{if(!ft.defined(h))return!1;try{return kA(t,e,{key:h,actual:m,previous:g,type:"decreased"})}catch{return!1}},emptied:h=>{try{const[m,g]=jA(t,e,{key:h});return!!m.length&&!g.length}catch{return!1}},filled:h=>{try{const[m,g]=jA(t,e,{key:h});return!m.length&&!!g.length}catch{return!1}},increased:(h,m,g)=>{if(!ft.defined(h))return!1;try{return kA(t,e,{key:h,actual:m,previous:g,type:"increased"})}catch{return!1}},removed:(h,m)=>{try{return OA(t,e,{key:h,type:"removed",value:m})}catch{return!1}}}}var xS,TA;function Lpe(){if(TA)return xS;TA=1;var t=new Error("Element already at target scroll position"),e=new Error("Scroll cancelled"),n=Math.min,r=Date.now;xS={left:s("scrollLeft"),top:s("scrollTop")};function s(l){return function(d,h,m,g){m=m||{},typeof m=="function"&&(g=m,m={}),typeof g!="function"&&(g=a);var x=r(),y=d[l],w=m.ease||i,S=isNaN(m.duration)?350:+m.duration,k=!1;return y===h?g(t,d[l]):requestAnimationFrame(N),j;function j(){k=!0}function N(T){if(k)return g(e,d[l]);var E=r(),_=n(1,(E-x)/S),A=w(_);d[l]=A*(h-y)+y,_<1?requestAnimationFrame(N):requestAnimationFrame(function(){g(null,d[l])})}}}function i(l){return .5*(1-Math.cos(Math.PI*l))}function a(){}return xS}var Bpe=Lpe();const Fpe=gd(Bpe);var yv={exports:{}},qpe=yv.exports,EA;function $pe(){return EA||(EA=1,(function(t){(function(e,n){t.exports?t.exports=n():e.Scrollparent=n()})(qpe,function(){function e(r){var s=getComputedStyle(r,null).getPropertyValue("overflow");return s.indexOf("scroll")>-1||s.indexOf("auto")>-1}function n(r){if(r instanceof HTMLElement||r instanceof SVGElement){for(var s=r.parentNode;s.parentNode;){if(e(s))return s;s=s.parentNode}return document.scrollingElement||document.documentElement}}return n})})(yv)),yv.exports}var Hpe=$pe();const IH=gd(Hpe);var vS,_A;function Qpe(){if(_A)return vS;_A=1;var t=function(r){return Object.prototype.hasOwnProperty.call(r,"props")},e=function(r,s){return r+n(s)},n=function(r){return r===null||typeof r=="boolean"||typeof r>"u"?"":typeof r=="number"?r.toString():typeof r=="string"?r:Array.isArray(r)?r.reduce(e,""):t(r)&&Object.prototype.hasOwnProperty.call(r.props,"children")?n(r.props.children):""};return n.default=n,vS=n,vS}var Vpe=Qpe();const AA=gd(Vpe);var yS,MA;function Upe(){if(MA)return yS;MA=1;var t=function(j){return e(j)&&!n(j)};function e(k){return!!k&&typeof k=="object"}function n(k){var j=Object.prototype.toString.call(k);return j==="[object RegExp]"||j==="[object Date]"||i(k)}var r=typeof Symbol=="function"&&Symbol.for,s=r?Symbol.for("react.element"):60103;function i(k){return k.$$typeof===s}function a(k){return Array.isArray(k)?[]:{}}function l(k,j){return j.clone!==!1&&j.isMergeableObject(k)?w(a(k),k,j):k}function c(k,j,N){return k.concat(j).map(function(T){return l(T,N)})}function d(k,j){if(!j.customMerge)return w;var N=j.customMerge(k);return typeof N=="function"?N:w}function h(k){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(k).filter(function(j){return Object.propertyIsEnumerable.call(k,j)}):[]}function m(k){return Object.keys(k).concat(h(k))}function g(k,j){try{return j in k}catch{return!1}}function x(k,j){return g(k,j)&&!(Object.hasOwnProperty.call(k,j)&&Object.propertyIsEnumerable.call(k,j))}function y(k,j,N){var T={};return N.isMergeableObject(k)&&m(k).forEach(function(E){T[E]=l(k[E],N)}),m(j).forEach(function(E){x(k,E)||(g(k,E)&&N.isMergeableObject(j[E])?T[E]=d(E,N)(k[E],j[E],N):T[E]=l(j[E],N))}),T}function w(k,j,N){N=N||{},N.arrayMerge=N.arrayMerge||c,N.isMergeableObject=N.isMergeableObject||t,N.cloneUnlessOtherwiseSpecified=l;var T=Array.isArray(j),E=Array.isArray(k),_=T===E;return _?T?N.arrayMerge(k,j,N):y(k,j,N):l(j,N)}w.all=function(j,N){if(!Array.isArray(j))throw new Error("first argument should be an array");return j.reduce(function(T,E){return w(T,E,N)},{})};var S=w;return yS=S,yS}var Wpe=Upe();const Va=gd(Wpe);var eg=typeof window<"u"&&typeof document<"u"&&typeof navigator<"u",Gpe=(function(){for(var t=["Edge","Trident","Firefox"],e=0;e<t.length;e+=1)if(eg&&navigator.userAgent.indexOf(t[e])>=0)return 1;return 0})();function Xpe(t){var e=!1;return function(){e||(e=!0,window.Promise.resolve().then(function(){e=!1,t()}))}}function Ype(t){var e=!1;return function(){e||(e=!0,setTimeout(function(){e=!1,t()},Gpe))}}var Kpe=eg&&window.Promise,Zpe=Kpe?Xpe:Ype;function LH(t){var e={};return t&&e.toString.call(t)==="[object Function]"}function bd(t,e){if(t.nodeType!==1)return[];var n=t.ownerDocument.defaultView,r=n.getComputedStyle(t,null);return e?r[e]:r}function H6(t){return t.nodeName==="HTML"?t:t.parentNode||t.host}function tg(t){if(!t)return document.body;switch(t.nodeName){case"HTML":case"BODY":return t.ownerDocument.body;case"#document":return t.body}var e=bd(t),n=e.overflow,r=e.overflowX,s=e.overflowY;return/(auto|scroll|overlay)/.test(n+s+r)?t:tg(H6(t))}function BH(t){return t&&t.referenceNode?t.referenceNode:t}var RA=eg&&!!(window.MSInputMethodContext&&document.documentMode),DA=eg&&/MSIE 10/.test(navigator.userAgent);function Df(t){return t===11?RA:t===10?DA:RA||DA}function lf(t){if(!t)return document.documentElement;for(var e=Df(10)?document.body:null,n=t.offsetParent||null;n===e&&t.nextElementSibling;)n=(t=t.nextElementSibling).offsetParent;var r=n&&n.nodeName;return!r||r==="BODY"||r==="HTML"?t?t.ownerDocument.documentElement:document.documentElement:["TH","TD","TABLE"].indexOf(n.nodeName)!==-1&&bd(n,"position")==="static"?lf(n):n}function Jpe(t){var e=t.nodeName;return e==="BODY"?!1:e==="HTML"||lf(t.firstElementChild)===t}function xO(t){return t.parentNode!==null?xO(t.parentNode):t}function dy(t,e){if(!t||!t.nodeType||!e||!e.nodeType)return document.documentElement;var n=t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_FOLLOWING,r=n?t:e,s=n?e:t,i=document.createRange();i.setStart(r,0),i.setEnd(s,0);var a=i.commonAncestorContainer;if(t!==a&&e!==a||r.contains(s))return Jpe(a)?a:lf(a);var l=xO(t);return l.host?dy(l.host,e):dy(t,xO(e).host)}function cf(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"top",n=e==="top"?"scrollTop":"scrollLeft",r=t.nodeName;if(r==="BODY"||r==="HTML"){var s=t.ownerDocument.documentElement,i=t.ownerDocument.scrollingElement||s;return i[n]}return t[n]}function ege(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,r=cf(e,"top"),s=cf(e,"left"),i=n?-1:1;return t.top+=r*i,t.bottom+=r*i,t.left+=s*i,t.right+=s*i,t}function PA(t,e){var n=e==="x"?"Left":"Top",r=n==="Left"?"Right":"Bottom";return parseFloat(t["border"+n+"Width"])+parseFloat(t["border"+r+"Width"])}function zA(t,e,n,r){return Math.max(e["offset"+t],e["scroll"+t],n["client"+t],n["offset"+t],n["scroll"+t],Df(10)?parseInt(n["offset"+t])+parseInt(r["margin"+(t==="Height"?"Top":"Left")])+parseInt(r["margin"+(t==="Height"?"Bottom":"Right")]):0)}function FH(t){var e=t.body,n=t.documentElement,r=Df(10)&&getComputedStyle(n);return{height:zA("Height",e,n,r),width:zA("Width",e,n,r)}}var tge=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},nge=(function(){function t(e,n){for(var r=0;r<n.length;r++){var s=n[r];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}})(),uf=function(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t},wa=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t};function Jc(t){return wa({},t,{right:t.left+t.width,bottom:t.top+t.height})}function vO(t){var e={};try{if(Df(10)){e=t.getBoundingClientRect();var n=cf(t,"top"),r=cf(t,"left");e.top+=n,e.left+=r,e.bottom+=n,e.right+=r}else e=t.getBoundingClientRect()}catch{}var s={left:e.left,top:e.top,width:e.right-e.left,height:e.bottom-e.top},i=t.nodeName==="HTML"?FH(t.ownerDocument):{},a=i.width||t.clientWidth||s.width,l=i.height||t.clientHeight||s.height,c=t.offsetWidth-a,d=t.offsetHeight-l;if(c||d){var h=bd(t);c-=PA(h,"x"),d-=PA(h,"y"),s.width-=c,s.height-=d}return Jc(s)}function Q6(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,r=Df(10),s=e.nodeName==="HTML",i=vO(t),a=vO(e),l=tg(t),c=bd(e),d=parseFloat(c.borderTopWidth),h=parseFloat(c.borderLeftWidth);n&&s&&(a.top=Math.max(a.top,0),a.left=Math.max(a.left,0));var m=Jc({top:i.top-a.top-d,left:i.left-a.left-h,width:i.width,height:i.height});if(m.marginTop=0,m.marginLeft=0,!r&&s){var g=parseFloat(c.marginTop),x=parseFloat(c.marginLeft);m.top-=d-g,m.bottom-=d-g,m.left-=h-x,m.right-=h-x,m.marginTop=g,m.marginLeft=x}return(r&&!n?e.contains(l):e===l&&l.nodeName!=="BODY")&&(m=ege(m,e)),m}function rge(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=t.ownerDocument.documentElement,r=Q6(t,n),s=Math.max(n.clientWidth,window.innerWidth||0),i=Math.max(n.clientHeight,window.innerHeight||0),a=e?0:cf(n),l=e?0:cf(n,"left"),c={top:a-r.top+r.marginTop,left:l-r.left+r.marginLeft,width:s,height:i};return Jc(c)}function qH(t){var e=t.nodeName;if(e==="BODY"||e==="HTML")return!1;if(bd(t,"position")==="fixed")return!0;var n=H6(t);return n?qH(n):!1}function $H(t){if(!t||!t.parentElement||Df())return document.documentElement;for(var e=t.parentElement;e&&bd(e,"transform")==="none";)e=e.parentElement;return e||document.documentElement}function V6(t,e,n,r){var s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1,i={top:0,left:0},a=s?$H(t):dy(t,BH(e));if(r==="viewport")i=rge(a,s);else{var l=void 0;r==="scrollParent"?(l=tg(H6(e)),l.nodeName==="BODY"&&(l=t.ownerDocument.documentElement)):r==="window"?l=t.ownerDocument.documentElement:l=r;var c=Q6(l,a,s);if(l.nodeName==="HTML"&&!qH(a)){var d=FH(t.ownerDocument),h=d.height,m=d.width;i.top+=c.top-c.marginTop,i.bottom=h+c.top,i.left+=c.left-c.marginLeft,i.right=m+c.left}else i=c}n=n||0;var g=typeof n=="number";return i.left+=g?n:n.left||0,i.top+=g?n:n.top||0,i.right-=g?n:n.right||0,i.bottom-=g?n:n.bottom||0,i}function sge(t){var e=t.width,n=t.height;return e*n}function HH(t,e,n,r,s){var i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:0;if(t.indexOf("auto")===-1)return t;var a=V6(n,r,i,s),l={top:{width:a.width,height:e.top-a.top},right:{width:a.right-e.right,height:a.height},bottom:{width:a.width,height:a.bottom-e.bottom},left:{width:e.left-a.left,height:a.height}},c=Object.keys(l).map(function(g){return wa({key:g},l[g],{area:sge(l[g])})}).sort(function(g,x){return x.area-g.area}),d=c.filter(function(g){var x=g.width,y=g.height;return x>=n.clientWidth&&y>=n.clientHeight}),h=d.length>0?d[0].key:c[0].key,m=t.split("-")[1];return h+(m?"-"+m:"")}function QH(t,e,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,s=r?$H(e):dy(e,BH(n));return Q6(n,s,r)}function VH(t){var e=t.ownerDocument.defaultView,n=e.getComputedStyle(t),r=parseFloat(n.marginTop||0)+parseFloat(n.marginBottom||0),s=parseFloat(n.marginLeft||0)+parseFloat(n.marginRight||0),i={width:t.offsetWidth+s,height:t.offsetHeight+r};return i}function hy(t){var e={left:"right",right:"left",bottom:"top",top:"bottom"};return t.replace(/left|right|bottom|top/g,function(n){return e[n]})}function UH(t,e,n){n=n.split("-")[0];var r=VH(t),s={width:r.width,height:r.height},i=["right","left"].indexOf(n)!==-1,a=i?"top":"left",l=i?"left":"top",c=i?"height":"width",d=i?"width":"height";return s[a]=e[a]+e[c]/2-r[c]/2,n===l?s[l]=e[l]-r[d]:s[l]=e[hy(l)],s}function ng(t,e){return Array.prototype.find?t.find(e):t.filter(e)[0]}function ige(t,e,n){if(Array.prototype.findIndex)return t.findIndex(function(s){return s[e]===n});var r=ng(t,function(s){return s[e]===n});return t.indexOf(r)}function WH(t,e,n){var r=n===void 0?t:t.slice(0,ige(t,"name",n));return r.forEach(function(s){s.function&&console.warn("`modifier.function` is deprecated, use `modifier.fn`!");var i=s.function||s.fn;s.enabled&&LH(i)&&(e.offsets.popper=Jc(e.offsets.popper),e.offsets.reference=Jc(e.offsets.reference),e=i(e,s))}),e}function age(){if(!this.state.isDestroyed){var t={instance:this,styles:{},arrowStyles:{},attributes:{},flipped:!1,offsets:{}};t.offsets.reference=QH(this.state,this.popper,this.reference,this.options.positionFixed),t.placement=HH(this.options.placement,t.offsets.reference,this.popper,this.reference,this.options.modifiers.flip.boundariesElement,this.options.modifiers.flip.padding),t.originalPlacement=t.placement,t.positionFixed=this.options.positionFixed,t.offsets.popper=UH(this.popper,t.offsets.reference,t.placement),t.offsets.popper.position=this.options.positionFixed?"fixed":"absolute",t=WH(this.modifiers,t),this.state.isCreated?this.options.onUpdate(t):(this.state.isCreated=!0,this.options.onCreate(t))}}function GH(t,e){return t.some(function(n){var r=n.name,s=n.enabled;return s&&r===e})}function U6(t){for(var e=[!1,"ms","Webkit","Moz","O"],n=t.charAt(0).toUpperCase()+t.slice(1),r=0;r<e.length;r++){var s=e[r],i=s?""+s+n:t;if(typeof document.body.style[i]<"u")return i}return null}function oge(){return this.state.isDestroyed=!0,GH(this.modifiers,"applyStyle")&&(this.popper.removeAttribute("x-placement"),this.popper.style.position="",this.popper.style.top="",this.popper.style.left="",this.popper.style.right="",this.popper.style.bottom="",this.popper.style.willChange="",this.popper.style[U6("transform")]=""),this.disableEventListeners(),this.options.removeOnDestroy&&this.popper.parentNode.removeChild(this.popper),this}function XH(t){var e=t.ownerDocument;return e?e.defaultView:window}function YH(t,e,n,r){var s=t.nodeName==="BODY",i=s?t.ownerDocument.defaultView:t;i.addEventListener(e,n,{passive:!0}),s||YH(tg(i.parentNode),e,n,r),r.push(i)}function lge(t,e,n,r){n.updateBound=r,XH(t).addEventListener("resize",n.updateBound,{passive:!0});var s=tg(t);return YH(s,"scroll",n.updateBound,n.scrollParents),n.scrollElement=s,n.eventsEnabled=!0,n}function cge(){this.state.eventsEnabled||(this.state=lge(this.reference,this.options,this.state,this.scheduleUpdate))}function uge(t,e){return XH(t).removeEventListener("resize",e.updateBound),e.scrollParents.forEach(function(n){n.removeEventListener("scroll",e.updateBound)}),e.updateBound=null,e.scrollParents=[],e.scrollElement=null,e.eventsEnabled=!1,e}function dge(){this.state.eventsEnabled&&(cancelAnimationFrame(this.scheduleUpdate),this.state=uge(this.reference,this.state))}function W6(t){return t!==""&&!isNaN(parseFloat(t))&&isFinite(t)}function yO(t,e){Object.keys(e).forEach(function(n){var r="";["width","height","top","right","bottom","left"].indexOf(n)!==-1&&W6(e[n])&&(r="px"),t.style[n]=e[n]+r})}function hge(t,e){Object.keys(e).forEach(function(n){var r=e[n];r!==!1?t.setAttribute(n,e[n]):t.removeAttribute(n)})}function fge(t){return yO(t.instance.popper,t.styles),hge(t.instance.popper,t.attributes),t.arrowElement&&Object.keys(t.arrowStyles).length&&yO(t.arrowElement,t.arrowStyles),t}function mge(t,e,n,r,s){var i=QH(s,e,t,n.positionFixed),a=HH(n.placement,i,e,t,n.modifiers.flip.boundariesElement,n.modifiers.flip.padding);return e.setAttribute("x-placement",a),yO(e,{position:n.positionFixed?"fixed":"absolute"}),n}function pge(t,e){var n=t.offsets,r=n.popper,s=n.reference,i=Math.round,a=Math.floor,l=function(k){return k},c=i(s.width),d=i(r.width),h=["left","right"].indexOf(t.placement)!==-1,m=t.placement.indexOf("-")!==-1,g=c%2===d%2,x=c%2===1&&d%2===1,y=e?h||m||g?i:a:l,w=e?i:l;return{left:y(x&&!m&&e?r.left-1:r.left),top:w(r.top),bottom:w(r.bottom),right:y(r.right)}}var gge=eg&&/Firefox/i.test(navigator.userAgent);function xge(t,e){var n=e.x,r=e.y,s=t.offsets.popper,i=ng(t.instance.modifiers,function(N){return N.name==="applyStyle"}).gpuAcceleration;i!==void 0&&console.warn("WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!");var a=i!==void 0?i:e.gpuAcceleration,l=lf(t.instance.popper),c=vO(l),d={position:s.position},h=pge(t,window.devicePixelRatio<2||!gge),m=n==="bottom"?"top":"bottom",g=r==="right"?"left":"right",x=U6("transform"),y=void 0,w=void 0;if(m==="bottom"?l.nodeName==="HTML"?w=-l.clientHeight+h.bottom:w=-c.height+h.bottom:w=h.top,g==="right"?l.nodeName==="HTML"?y=-l.clientWidth+h.right:y=-c.width+h.right:y=h.left,a&&x)d[x]="translate3d("+y+"px, "+w+"px, 0)",d[m]=0,d[g]=0,d.willChange="transform";else{var S=m==="bottom"?-1:1,k=g==="right"?-1:1;d[m]=w*S,d[g]=y*k,d.willChange=m+", "+g}var j={"x-placement":t.placement};return t.attributes=wa({},j,t.attributes),t.styles=wa({},d,t.styles),t.arrowStyles=wa({},t.offsets.arrow,t.arrowStyles),t}function KH(t,e,n){var r=ng(t,function(l){var c=l.name;return c===e}),s=!!r&&t.some(function(l){return l.name===n&&l.enabled&&l.order<r.order});if(!s){var i="`"+e+"`",a="`"+n+"`";console.warn(a+" modifier is required by "+i+" modifier in order to work, be sure to include it before "+i+"!")}return s}function vge(t,e){var n;if(!KH(t.instance.modifiers,"arrow","keepTogether"))return t;var r=e.element;if(typeof r=="string"){if(r=t.instance.popper.querySelector(r),!r)return t}else if(!t.instance.popper.contains(r))return console.warn("WARNING: `arrow.element` must be child of its popper element!"),t;var s=t.placement.split("-")[0],i=t.offsets,a=i.popper,l=i.reference,c=["left","right"].indexOf(s)!==-1,d=c?"height":"width",h=c?"Top":"Left",m=h.toLowerCase(),g=c?"left":"top",x=c?"bottom":"right",y=VH(r)[d];l[x]-y<a[m]&&(t.offsets.popper[m]-=a[m]-(l[x]-y)),l[m]+y>a[x]&&(t.offsets.popper[m]+=l[m]+y-a[x]),t.offsets.popper=Jc(t.offsets.popper);var w=l[m]+l[d]/2-y/2,S=bd(t.instance.popper),k=parseFloat(S["margin"+h]),j=parseFloat(S["border"+h+"Width"]),N=w-t.offsets.popper[m]-k-j;return N=Math.max(Math.min(a[d]-y,N),0),t.arrowElement=r,t.offsets.arrow=(n={},uf(n,m,Math.round(N)),uf(n,g,""),n),t}function yge(t){return t==="end"?"start":t==="start"?"end":t}var ZH=["auto-start","auto","auto-end","top-start","top","top-end","right-start","right","right-end","bottom-end","bottom","bottom-start","left-end","left","left-start"],bS=ZH.slice(3);function IA(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=bS.indexOf(t),r=bS.slice(n+1).concat(bS.slice(0,n));return e?r.reverse():r}var wS={FLIP:"flip",CLOCKWISE:"clockwise",COUNTERCLOCKWISE:"counterclockwise"};function bge(t,e){if(GH(t.instance.modifiers,"inner")||t.flipped&&t.placement===t.originalPlacement)return t;var n=V6(t.instance.popper,t.instance.reference,e.padding,e.boundariesElement,t.positionFixed),r=t.placement.split("-")[0],s=hy(r),i=t.placement.split("-")[1]||"",a=[];switch(e.behavior){case wS.FLIP:a=[r,s];break;case wS.CLOCKWISE:a=IA(r);break;case wS.COUNTERCLOCKWISE:a=IA(r,!0);break;default:a=e.behavior}return a.forEach(function(l,c){if(r!==l||a.length===c+1)return t;r=t.placement.split("-")[0],s=hy(r);var d=t.offsets.popper,h=t.offsets.reference,m=Math.floor,g=r==="left"&&m(d.right)>m(h.left)||r==="right"&&m(d.left)<m(h.right)||r==="top"&&m(d.bottom)>m(h.top)||r==="bottom"&&m(d.top)<m(h.bottom),x=m(d.left)<m(n.left),y=m(d.right)>m(n.right),w=m(d.top)<m(n.top),S=m(d.bottom)>m(n.bottom),k=r==="left"&&x||r==="right"&&y||r==="top"&&w||r==="bottom"&&S,j=["top","bottom"].indexOf(r)!==-1,N=!!e.flipVariations&&(j&&i==="start"&&x||j&&i==="end"&&y||!j&&i==="start"&&w||!j&&i==="end"&&S),T=!!e.flipVariationsByContent&&(j&&i==="start"&&y||j&&i==="end"&&x||!j&&i==="start"&&S||!j&&i==="end"&&w),E=N||T;(g||k||E)&&(t.flipped=!0,(g||k)&&(r=a[c+1]),E&&(i=yge(i)),t.placement=r+(i?"-"+i:""),t.offsets.popper=wa({},t.offsets.popper,UH(t.instance.popper,t.offsets.reference,t.placement)),t=WH(t.instance.modifiers,t,"flip"))}),t}function wge(t){var e=t.offsets,n=e.popper,r=e.reference,s=t.placement.split("-")[0],i=Math.floor,a=["top","bottom"].indexOf(s)!==-1,l=a?"right":"bottom",c=a?"left":"top",d=a?"width":"height";return n[l]<i(r[c])&&(t.offsets.popper[c]=i(r[c])-n[d]),n[c]>i(r[l])&&(t.offsets.popper[c]=i(r[l])),t}function Sge(t,e,n,r){var s=t.match(/((?:\-|\+)?\d*\.?\d*)(.*)/),i=+s[1],a=s[2];if(!i)return t;if(a.indexOf("%")===0){var l=void 0;switch(a){case"%p":l=n;break;case"%":case"%r":default:l=r}var c=Jc(l);return c[e]/100*i}else if(a==="vh"||a==="vw"){var d=void 0;return a==="vh"?d=Math.max(document.documentElement.clientHeight,window.innerHeight||0):d=Math.max(document.documentElement.clientWidth,window.innerWidth||0),d/100*i}else return i}function kge(t,e,n,r){var s=[0,0],i=["right","left"].indexOf(r)!==-1,a=t.split(/(\+|\-)/).map(function(h){return h.trim()}),l=a.indexOf(ng(a,function(h){return h.search(/,|\s/)!==-1}));a[l]&&a[l].indexOf(",")===-1&&console.warn("Offsets separated by white space(s) are deprecated, use a comma (,) instead.");var c=/\s*,\s*|\s+/,d=l!==-1?[a.slice(0,l).concat([a[l].split(c)[0]]),[a[l].split(c)[1]].concat(a.slice(l+1))]:[a];return d=d.map(function(h,m){var g=(m===1?!i:i)?"height":"width",x=!1;return h.reduce(function(y,w){return y[y.length-1]===""&&["+","-"].indexOf(w)!==-1?(y[y.length-1]=w,x=!0,y):x?(y[y.length-1]+=w,x=!1,y):y.concat(w)},[]).map(function(y){return Sge(y,g,e,n)})}),d.forEach(function(h,m){h.forEach(function(g,x){W6(g)&&(s[m]+=g*(h[x-1]==="-"?-1:1))})}),s}function Oge(t,e){var n=e.offset,r=t.placement,s=t.offsets,i=s.popper,a=s.reference,l=r.split("-")[0],c=void 0;return W6(+n)?c=[+n,0]:c=kge(n,i,a,l),l==="left"?(i.top+=c[0],i.left-=c[1]):l==="right"?(i.top+=c[0],i.left+=c[1]):l==="top"?(i.left+=c[0],i.top-=c[1]):l==="bottom"&&(i.left+=c[0],i.top+=c[1]),t.popper=i,t}function jge(t,e){var n=e.boundariesElement||lf(t.instance.popper);t.instance.reference===n&&(n=lf(n));var r=U6("transform"),s=t.instance.popper.style,i=s.top,a=s.left,l=s[r];s.top="",s.left="",s[r]="";var c=V6(t.instance.popper,t.instance.reference,e.padding,n,t.positionFixed);s.top=i,s.left=a,s[r]=l,e.boundaries=c;var d=e.priority,h=t.offsets.popper,m={primary:function(x){var y=h[x];return h[x]<c[x]&&!e.escapeWithReference&&(y=Math.max(h[x],c[x])),uf({},x,y)},secondary:function(x){var y=x==="right"?"left":"top",w=h[y];return h[x]>c[x]&&!e.escapeWithReference&&(w=Math.min(h[y],c[x]-(x==="right"?h.width:h.height))),uf({},y,w)}};return d.forEach(function(g){var x=["left","top"].indexOf(g)!==-1?"primary":"secondary";h=wa({},h,m[x](g))}),t.offsets.popper=h,t}function Nge(t){var e=t.placement,n=e.split("-")[0],r=e.split("-")[1];if(r){var s=t.offsets,i=s.reference,a=s.popper,l=["bottom","top"].indexOf(n)!==-1,c=l?"left":"top",d=l?"width":"height",h={start:uf({},c,i[c]),end:uf({},c,i[c]+i[d]-a[d])};t.offsets.popper=wa({},a,h[r])}return t}function Cge(t){if(!KH(t.instance.modifiers,"hide","preventOverflow"))return t;var e=t.offsets.reference,n=ng(t.instance.modifiers,function(r){return r.name==="preventOverflow"}).boundaries;if(e.bottom<n.top||e.left>n.right||e.top>n.bottom||e.right<n.left){if(t.hide===!0)return t;t.hide=!0,t.attributes["x-out-of-boundaries"]=""}else{if(t.hide===!1)return t;t.hide=!1,t.attributes["x-out-of-boundaries"]=!1}return t}function Tge(t){var e=t.placement,n=e.split("-")[0],r=t.offsets,s=r.popper,i=r.reference,a=["left","right"].indexOf(n)!==-1,l=["top","left"].indexOf(n)===-1;return s[a?"left":"top"]=i[n]-(l?s[a?"width":"height"]:0),t.placement=hy(e),t.offsets.popper=Jc(s),t}var Ege={shift:{order:100,enabled:!0,fn:Nge},offset:{order:200,enabled:!0,fn:Oge,offset:0},preventOverflow:{order:300,enabled:!0,fn:jge,priority:["left","right","top","bottom"],padding:5,boundariesElement:"scrollParent"},keepTogether:{order:400,enabled:!0,fn:wge},arrow:{order:500,enabled:!0,fn:vge,element:"[x-arrow]"},flip:{order:600,enabled:!0,fn:bge,behavior:"flip",padding:5,boundariesElement:"viewport",flipVariations:!1,flipVariationsByContent:!1},inner:{order:700,enabled:!1,fn:Tge},hide:{order:800,enabled:!0,fn:Cge},computeStyle:{order:850,enabled:!0,fn:xge,gpuAcceleration:!0,x:"bottom",y:"right"},applyStyle:{order:900,enabled:!0,fn:fge,onLoad:mge,gpuAcceleration:void 0}},_ge={placement:"bottom",positionFixed:!1,eventsEnabled:!0,removeOnDestroy:!1,onCreate:function(){},onUpdate:function(){},modifiers:Ege},lp=(function(){function t(e,n){var r=this,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};tge(this,t),this.scheduleUpdate=function(){return requestAnimationFrame(r.update)},this.update=Zpe(this.update.bind(this)),this.options=wa({},t.Defaults,s),this.state={isDestroyed:!1,isCreated:!1,scrollParents:[]},this.reference=e&&e.jquery?e[0]:e,this.popper=n&&n.jquery?n[0]:n,this.options.modifiers={},Object.keys(wa({},t.Defaults.modifiers,s.modifiers)).forEach(function(a){r.options.modifiers[a]=wa({},t.Defaults.modifiers[a]||{},s.modifiers?s.modifiers[a]:{})}),this.modifiers=Object.keys(this.options.modifiers).map(function(a){return wa({name:a},r.options.modifiers[a])}).sort(function(a,l){return a.order-l.order}),this.modifiers.forEach(function(a){a.enabled&&LH(a.onLoad)&&a.onLoad(r.reference,r.popper,r.options,a,r.state)}),this.update();var i=this.options.eventsEnabled;i&&this.enableEventListeners(),this.state.eventsEnabled=i}return nge(t,[{key:"update",value:function(){return age.call(this)}},{key:"destroy",value:function(){return oge.call(this)}},{key:"enableEventListeners",value:function(){return cge.call(this)}},{key:"disableEventListeners",value:function(){return dge.call(this)}}]),t})();lp.Utils=(typeof window<"u"?window:global).PopperUtils;lp.placements=ZH;lp.Defaults=_ge;var Age=["innerHTML","ownerDocument","style","attributes","nodeValue"],Mge=["Array","ArrayBuffer","AsyncFunction","AsyncGenerator","AsyncGeneratorFunction","Date","Error","Function","Generator","GeneratorFunction","HTMLElement","Map","Object","Promise","RegExp","Set","WeakMap","WeakSet"],Rge=["bigint","boolean","null","number","string","symbol","undefined"];function Eb(t){var e=Object.prototype.toString.call(t).slice(8,-1);if(/HTML\w+Element/.test(e))return"HTMLElement";if(Dge(e))return e}function so(t){return function(e){return Eb(e)===t}}function Dge(t){return Mge.includes(t)}function Pf(t){return function(e){return typeof e===t}}function Pge(t){return Rge.includes(t)}function _e(t){if(t===null)return"null";switch(typeof t){case"bigint":return"bigint";case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"symbol":return"symbol";case"undefined":return"undefined"}if(_e.array(t))return"Array";if(_e.plainFunction(t))return"Function";var e=Eb(t);return e||"Object"}_e.array=Array.isArray;_e.arrayOf=function(t,e){return!_e.array(t)&&!_e.function(e)?!1:t.every(function(n){return e(n)})};_e.asyncGeneratorFunction=function(t){return Eb(t)==="AsyncGeneratorFunction"};_e.asyncFunction=so("AsyncFunction");_e.bigint=Pf("bigint");_e.boolean=function(t){return t===!0||t===!1};_e.date=so("Date");_e.defined=function(t){return!_e.undefined(t)};_e.domElement=function(t){return _e.object(t)&&!_e.plainObject(t)&&t.nodeType===1&&_e.string(t.nodeName)&&Age.every(function(e){return e in t})};_e.empty=function(t){return _e.string(t)&&t.length===0||_e.array(t)&&t.length===0||_e.object(t)&&!_e.map(t)&&!_e.set(t)&&Object.keys(t).length===0||_e.set(t)&&t.size===0||_e.map(t)&&t.size===0};_e.error=so("Error");_e.function=Pf("function");_e.generator=function(t){return _e.iterable(t)&&_e.function(t.next)&&_e.function(t.throw)};_e.generatorFunction=so("GeneratorFunction");_e.instanceOf=function(t,e){return!t||!e?!1:Object.getPrototypeOf(t)===e.prototype};_e.iterable=function(t){return!_e.nullOrUndefined(t)&&_e.function(t[Symbol.iterator])};_e.map=so("Map");_e.nan=function(t){return Number.isNaN(t)};_e.null=function(t){return t===null};_e.nullOrUndefined=function(t){return _e.null(t)||_e.undefined(t)};_e.number=function(t){return Pf("number")(t)&&!_e.nan(t)};_e.numericString=function(t){return _e.string(t)&&t.length>0&&!Number.isNaN(Number(t))};_e.object=function(t){return!_e.nullOrUndefined(t)&&(_e.function(t)||typeof t=="object")};_e.oneOf=function(t,e){return _e.array(t)?t.indexOf(e)>-1:!1};_e.plainFunction=so("Function");_e.plainObject=function(t){if(Eb(t)!=="Object")return!1;var e=Object.getPrototypeOf(t);return e===null||e===Object.getPrototypeOf({})};_e.primitive=function(t){return _e.null(t)||Pge(typeof t)};_e.promise=so("Promise");_e.propertyOf=function(t,e,n){if(!_e.object(t)||!e)return!1;var r=t[e];return _e.function(n)?n(r):_e.defined(r)};_e.regexp=so("RegExp");_e.set=so("Set");_e.string=Pf("string");_e.symbol=Pf("symbol");_e.undefined=Pf("undefined");_e.weakMap=so("WeakMap");_e.weakSet=so("WeakSet");function JH(t){return function(e){return typeof e===t}}var zge=JH("function"),Ige=function(t){return t===null},LA=function(t){return Object.prototype.toString.call(t).slice(8,-1)==="RegExp"},BA=function(t){return!Lge(t)&&!Ige(t)&&(zge(t)||typeof t=="object")},Lge=JH("undefined"),bO=function(t){var e=typeof Symbol=="function"&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};function Bge(t,e){var n=t.length;if(n!==e.length)return!1;for(var r=n;r--!==0;)if(!bi(t[r],e[r]))return!1;return!0}function Fge(t,e){if(t.byteLength!==e.byteLength)return!1;for(var n=new DataView(t.buffer),r=new DataView(e.buffer),s=t.byteLength;s--;)if(n.getUint8(s)!==r.getUint8(s))return!1;return!0}function qge(t,e){var n,r,s,i;if(t.size!==e.size)return!1;try{for(var a=bO(t.entries()),l=a.next();!l.done;l=a.next()){var c=l.value;if(!e.has(c[0]))return!1}}catch(m){n={error:m}}finally{try{l&&!l.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}try{for(var d=bO(t.entries()),h=d.next();!h.done;h=d.next()){var c=h.value;if(!bi(c[1],e.get(c[0])))return!1}}catch(m){s={error:m}}finally{try{h&&!h.done&&(i=d.return)&&i.call(d)}finally{if(s)throw s.error}}return!0}function $ge(t,e){var n,r;if(t.size!==e.size)return!1;try{for(var s=bO(t.entries()),i=s.next();!i.done;i=s.next()){var a=i.value;if(!e.has(a[0]))return!1}}catch(l){n={error:l}}finally{try{i&&!i.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}return!0}function bi(t,e){if(t===e)return!0;if(t&&BA(t)&&e&&BA(e)){if(t.constructor!==e.constructor)return!1;if(Array.isArray(t)&&Array.isArray(e))return Bge(t,e);if(t instanceof Map&&e instanceof Map)return qge(t,e);if(t instanceof Set&&e instanceof Set)return $ge(t,e);if(ArrayBuffer.isView(t)&&ArrayBuffer.isView(e))return Fge(t,e);if(LA(t)&&LA(e))return t.source===e.source&&t.flags===e.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===e.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===e.toString();var n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(var s=n.length;s--!==0;)if(!Object.prototype.hasOwnProperty.call(e,n[s]))return!1;for(var s=n.length;s--!==0;){var i=n[s];if(!(i==="_owner"&&t.$$typeof)&&!bi(t[i],e[i]))return!1}return!0}return Number.isNaN(t)&&Number.isNaN(e)?!0:t===e}function Hge(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return t.every(function(n){return _e.string(n)||_e.array(n)||_e.plainObject(n)})}function Qge(t,e,n){return eQ(t,e)?[t,e].every(_e.array)?!t.some(QA(n))&&e.some(QA(n)):[t,e].every(_e.plainObject)?!Object.entries(t).some(HA(n))&&Object.entries(e).some(HA(n)):e===n:!1}function FA(t,e,n){var r=n.actual,s=n.key,i=n.previous,a=n.type,l=Eo(t,s),c=Eo(e,s),d=[l,c].every(_e.number)&&(a==="increased"?l<c:l>c);return _e.undefined(r)||(d=d&&c===r),_e.undefined(i)||(d=d&&l===i),d}function qA(t,e,n){var r=n.key,s=n.type,i=n.value,a=Eo(t,r),l=Eo(e,r),c=s==="added"?a:l,d=s==="added"?l:a;if(!_e.nullOrUndefined(i)){if(_e.defined(c)){if(_e.array(c)||_e.plainObject(c))return Qge(c,d,i)}else return bi(d,i);return!1}return[a,l].every(_e.array)?!d.every(G6(c)):[a,l].every(_e.plainObject)?Vge(Object.keys(c),Object.keys(d)):![a,l].every(function(h){return _e.primitive(h)&&_e.defined(h)})&&(s==="added"?!_e.defined(a)&&_e.defined(l):_e.defined(a)&&!_e.defined(l))}function $A(t,e,n){var r=n===void 0?{}:n,s=r.key,i=Eo(t,s),a=Eo(e,s);if(!eQ(i,a))throw new TypeError("Inputs have different types");if(!Hge(i,a))throw new TypeError("Inputs don't have length");return[i,a].every(_e.plainObject)&&(i=Object.keys(i),a=Object.keys(a)),[i,a]}function HA(t){return function(e){var n=e[0],r=e[1];return _e.array(t)?bi(t,r)||t.some(function(s){return bi(s,r)||_e.array(r)&&G6(r)(s)}):_e.plainObject(t)&&t[n]?!!t[n]&&bi(t[n],r):bi(t,r)}}function Vge(t,e){return e.some(function(n){return!t.includes(n)})}function QA(t){return function(e){return _e.array(t)?t.some(function(n){return bi(n,e)||_e.array(e)&&G6(e)(n)}):bi(t,e)}}function Um(t,e){return _e.array(t)?t.some(function(n){return bi(n,e)}):bi(t,e)}function G6(t){return function(e){return t.some(function(n){return bi(n,e)})}}function eQ(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return t.every(_e.array)||t.every(_e.number)||t.every(_e.plainObject)||t.every(_e.string)}function Eo(t,e){if(_e.plainObject(t)||_e.array(t)){if(_e.string(e)){var n=e.split(".");return n.reduce(function(r,s){return r&&r[s]},t)}return _e.number(e)?t[e]:t}return t}function Uge(t,e){if([t,e].some(_e.nullOrUndefined))throw new Error("Missing required parameters");if(![t,e].every(function(m){return _e.plainObject(m)||_e.array(m)}))throw new Error("Expected plain objects or array");var n=function(m,g){try{return qA(t,e,{key:m,type:"added",value:g})}catch{return!1}},r=function(m,g,x){try{var y=Eo(t,m),w=Eo(e,m),S=_e.defined(g),k=_e.defined(x);if(S||k){var j=k?Um(x,y):!Um(g,y),N=Um(g,w);return j&&N}return[y,w].every(_e.array)||[y,w].every(_e.plainObject)?!bi(y,w):y!==w}catch{return!1}},s=function(m,g,x){if(!_e.defined(m))return!1;try{var y=Eo(t,m),w=Eo(e,m),S=_e.defined(x);return Um(g,y)&&(S?Um(x,w):!S)}catch{return!1}},i=function(m,g){return _e.defined(m)?r(m,g):!1},a=function(m,g,x){if(!_e.defined(m))return!1;try{return FA(t,e,{key:m,actual:g,previous:x,type:"decreased"})}catch{return!1}},l=function(m){try{var g=$A(t,e,{key:m}),x=g[0],y=g[1];return!!x.length&&!y.length}catch{return!1}},c=function(m){try{var g=$A(t,e,{key:m}),x=g[0],y=g[1];return!x.length&&!!y.length}catch{return!1}},d=function(m,g,x){if(!_e.defined(m))return!1;try{return FA(t,e,{key:m,actual:g,previous:x,type:"increased"})}catch{return!1}},h=function(m,g){try{return qA(t,e,{key:m,type:"removed",value:g})}catch{return!1}};return{added:n,changed:r,changedFrom:s,changedTo:i,decreased:a,emptied:l,filled:c,increased:d,removed:h}}function VA(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function br(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?VA(Object(n),!0).forEach(function(r){qs(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):VA(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function rg(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Wge(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,nQ(r.key),r)}}function sg(t,e,n){return e&&Wge(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function qs(t,e,n){return e=nQ(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function ig(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&wO(t,e)}function fy(t){return fy=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},fy(t)}function wO(t,e){return wO=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},wO(t,e)}function Gge(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Xge(t,e){if(t==null)return{};var n={},r=Object.keys(t),s,i;for(i=0;i<r.length;i++)s=r[i],!(e.indexOf(s)>=0)&&(n[s]=t[s]);return n}function tQ(t,e){if(t==null)return{};var n=Xge(t,e),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)r=i[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function Nl(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Yge(t,e){if(e&&(typeof e=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Nl(t)}function ag(t){var e=Gge();return function(){var r=fy(t),s;if(e){var i=fy(this).constructor;s=Reflect.construct(r,arguments,i)}else s=r.apply(this,arguments);return Yge(this,s)}}function Kge(t,e){if(typeof t!="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function nQ(t){var e=Kge(t,"string");return typeof e=="symbol"?e:String(e)}var Zge={flip:{padding:20},preventOverflow:{padding:10}},Jge="The typeValidator argument must be a function with the signature function(props, propName, componentName).",exe="The error message is optional, but must be a string if provided.";function txe(t,e,n,r){return typeof t=="boolean"?t:typeof t=="function"?t(e,n,r):t?!!t:!1}function nxe(t,e){return Object.hasOwnProperty.call(t,e)}function rxe(t,e,n,r){return new Error("Required ".concat(t[e]," `").concat(e,"` was not specified in `").concat(n,"`."))}function sxe(t,e){if(typeof t!="function")throw new TypeError(Jge);if(e&&typeof e!="string")throw new TypeError(exe)}function UA(t,e,n){return sxe(t,n),function(r,s,i){for(var a=arguments.length,l=new Array(a>3?a-3:0),c=3;c<a;c++)l[c-3]=arguments[c];return txe(e,r,s,i)?nxe(r,s)?t.apply(void 0,[r,s,i].concat(l)):rxe(r,s,i):t.apply(void 0,[r,s,i].concat(l))}}var On={INIT:"init",IDLE:"idle",OPENING:"opening",OPEN:"open",CLOSING:"closing"},Wm=J1.createPortal!==void 0;function vo(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}function SS(){return"ontouchstart"in window&&/Mobi/.test(navigator.userAgent)}function O1(t){var e=t.title,n=t.data,r=t.warn,s=r===void 0?!1:r,i=t.debug,a=i===void 0?!1:i,l=s?console.warn||console.error:console.log;a&&e&&n&&(console.groupCollapsed("%creact-floater: ".concat(e),"color: #9b00ff; font-weight: bold; font-size: 12px;"),Array.isArray(n)?n.forEach(function(c){_e.plainObject(c)&&c.key?l.apply(console,[c.key,c.value]):l.apply(console,[c])}):l.apply(console,[n]),console.groupEnd())}function ixe(t,e,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;t.addEventListener(e,n,r)}function axe(t,e,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;t.removeEventListener(e,n,r)}function oxe(t,e,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,s;s=function(a){n(a),axe(t,e,s)},ixe(t,e,s,r)}function WA(){}var rQ=(function(t){ig(n,t);var e=ag(n);function n(){return rg(this,n),e.apply(this,arguments)}return sg(n,[{key:"componentDidMount",value:function(){vo()&&(this.node||this.appendNode(),Wm||this.renderPortal())}},{key:"componentDidUpdate",value:function(){vo()&&(Wm||this.renderPortal())}},{key:"componentWillUnmount",value:function(){!vo()||!this.node||(Wm||J1.unmountComponentAtNode(this.node),this.node&&this.node.parentNode===document.body&&(document.body.removeChild(this.node),this.node=void 0))}},{key:"appendNode",value:function(){var s=this.props,i=s.id,a=s.zIndex;this.node||(this.node=document.createElement("div"),i&&(this.node.id=i),a&&(this.node.style.zIndex=a),document.body.appendChild(this.node))}},{key:"renderPortal",value:function(){if(!vo())return null;var s=this.props,i=s.children,a=s.setRef;if(this.node||this.appendNode(),Wm)return J1.createPortal(i,this.node);var l=J1.unstable_renderSubtreeIntoContainer(this,i.length>1?ae.createElement("div",null,i):i[0],this.node);return a(l),null}},{key:"renderReact16",value:function(){var s=this.props,i=s.hasChildren,a=s.placement,l=s.target;return i?this.renderPortal():l||a==="center"?this.renderPortal():null}},{key:"render",value:function(){return Wm?this.renderReact16():null}}]),n})(ae.Component);qs(rQ,"propTypes",{children:Ge.oneOfType([Ge.element,Ge.array]),hasChildren:Ge.bool,id:Ge.oneOfType([Ge.string,Ge.number]),placement:Ge.string,setRef:Ge.func.isRequired,target:Ge.oneOfType([Ge.object,Ge.string]),zIndex:Ge.number});var sQ=(function(t){ig(n,t);var e=ag(n);function n(){return rg(this,n),e.apply(this,arguments)}return sg(n,[{key:"parentStyle",get:function(){var s=this.props,i=s.placement,a=s.styles,l=a.arrow.length,c={pointerEvents:"none",position:"absolute",width:"100%"};return i.startsWith("top")?(c.bottom=0,c.left=0,c.right=0,c.height=l):i.startsWith("bottom")?(c.left=0,c.right=0,c.top=0,c.height=l):i.startsWith("left")?(c.right=0,c.top=0,c.bottom=0):i.startsWith("right")&&(c.left=0,c.top=0),c}},{key:"render",value:function(){var s=this.props,i=s.placement,a=s.setArrowRef,l=s.styles,c=l.arrow,d=c.color,h=c.display,m=c.length,g=c.margin,x=c.position,y=c.spread,w={display:h,position:x},S,k=y,j=m;return i.startsWith("top")?(S="0,0 ".concat(k/2,",").concat(j," ").concat(k,",0"),w.bottom=0,w.marginLeft=g,w.marginRight=g):i.startsWith("bottom")?(S="".concat(k,",").concat(j," ").concat(k/2,",0 0,").concat(j),w.top=0,w.marginLeft=g,w.marginRight=g):i.startsWith("left")?(j=y,k=m,S="0,0 ".concat(k,",").concat(j/2," 0,").concat(j),w.right=0,w.marginTop=g,w.marginBottom=g):i.startsWith("right")&&(j=y,k=m,S="".concat(k,",").concat(j," ").concat(k,",0 0,").concat(j/2),w.left=0,w.marginTop=g,w.marginBottom=g),ae.createElement("div",{className:"__floater__arrow",style:this.parentStyle},ae.createElement("span",{ref:a,style:w},ae.createElement("svg",{width:k,height:j,version:"1.1",xmlns:"http://www.w3.org/2000/svg"},ae.createElement("polygon",{points:S,fill:d}))))}}]),n})(ae.Component);qs(sQ,"propTypes",{placement:Ge.string.isRequired,setArrowRef:Ge.func.isRequired,styles:Ge.object.isRequired});var lxe=["color","height","width"];function iQ(t){var e=t.handleClick,n=t.styles,r=n.color,s=n.height,i=n.width,a=tQ(n,lxe);return ae.createElement("button",{"aria-label":"close",onClick:e,style:a,type:"button"},ae.createElement("svg",{width:"".concat(i,"px"),height:"".concat(s,"px"),viewBox:"0 0 18 18",version:"1.1",xmlns:"http://www.w3.org/2000/svg",preserveAspectRatio:"xMidYMid"},ae.createElement("g",null,ae.createElement("path",{d:"M8.13911129,9.00268191 L0.171521827,17.0258467 C-0.0498027049,17.248715 -0.0498027049,17.6098394 0.171521827,17.8327545 C0.28204354,17.9443526 0.427188206,17.9998706 0.572051765,17.9998706 C0.71714958,17.9998706 0.862013139,17.9443526 0.972581703,17.8327545 L9.0000937,9.74924618 L17.0276057,17.8327545 C17.1384085,17.9443526 17.2832721,17.9998706 17.4281356,17.9998706 C17.5729992,17.9998706 17.718097,17.9443526 17.8286656,17.8327545 C18.0499901,17.6098862 18.0499901,17.2487618 17.8286656,17.0258467 L9.86135722,9.00268191 L17.8340066,0.973848225 C18.0553311,0.750979934 18.0553311,0.389855532 17.8340066,0.16694039 C17.6126821,-0.0556467968 17.254037,-0.0556467968 17.0329467,0.16694039 L9.00042166,8.25611765 L0.967006424,0.167268345 C0.745681892,-0.0553188426 0.387317931,-0.0553188426 0.165993399,0.167268345 C-0.0553311331,0.390136635 -0.0553311331,0.751261038 0.165993399,0.974176179 L8.13920499,9.00268191 L8.13911129,9.00268191 Z",fill:r}))))}iQ.propTypes={handleClick:Ge.func.isRequired,styles:Ge.object.isRequired};function aQ(t){var e=t.content,n=t.footer,r=t.handleClick,s=t.open,i=t.positionWrapper,a=t.showCloseButton,l=t.title,c=t.styles,d={content:ae.isValidElement(e)?e:ae.createElement("div",{className:"__floater__content",style:c.content},e)};return l&&(d.title=ae.isValidElement(l)?l:ae.createElement("div",{className:"__floater__title",style:c.title},l)),n&&(d.footer=ae.isValidElement(n)?n:ae.createElement("div",{className:"__floater__footer",style:c.footer},n)),(a||i)&&!_e.boolean(s)&&(d.close=ae.createElement(iQ,{styles:c.close,handleClick:r})),ae.createElement("div",{className:"__floater__container",style:c.container},d.close,d.title,d.content,d.footer)}aQ.propTypes={content:Ge.node.isRequired,footer:Ge.node,handleClick:Ge.func.isRequired,open:Ge.bool,positionWrapper:Ge.bool.isRequired,showCloseButton:Ge.bool.isRequired,styles:Ge.object.isRequired,title:Ge.node};var oQ=(function(t){ig(n,t);var e=ag(n);function n(){return rg(this,n),e.apply(this,arguments)}return sg(n,[{key:"style",get:function(){var s=this.props,i=s.disableAnimation,a=s.component,l=s.placement,c=s.hideArrow,d=s.status,h=s.styles,m=h.arrow.length,g=h.floater,x=h.floaterCentered,y=h.floaterClosing,w=h.floaterOpening,S=h.floaterWithAnimation,k=h.floaterWithComponent,j={};return c||(l.startsWith("top")?j.padding="0 0 ".concat(m,"px"):l.startsWith("bottom")?j.padding="".concat(m,"px 0 0"):l.startsWith("left")?j.padding="0 ".concat(m,"px 0 0"):l.startsWith("right")&&(j.padding="0 0 0 ".concat(m,"px"))),[On.OPENING,On.OPEN].indexOf(d)!==-1&&(j=br(br({},j),w)),d===On.CLOSING&&(j=br(br({},j),y)),d===On.OPEN&&!i&&(j=br(br({},j),S)),l==="center"&&(j=br(br({},j),x)),a&&(j=br(br({},j),k)),br(br({},g),j)}},{key:"render",value:function(){var s=this.props,i=s.component,a=s.handleClick,l=s.hideArrow,c=s.setFloaterRef,d=s.status,h={},m=["__floater"];return i?ae.isValidElement(i)?h.content=ae.cloneElement(i,{closeFn:a}):h.content=i({closeFn:a}):h.content=ae.createElement(aQ,this.props),d===On.OPEN&&m.push("__floater__open"),l||(h.arrow=ae.createElement(sQ,this.props)),ae.createElement("div",{ref:c,className:m.join(" "),style:this.style},ae.createElement("div",{className:"__floater__body"},h.content,h.arrow))}}]),n})(ae.Component);qs(oQ,"propTypes",{component:Ge.oneOfType([Ge.func,Ge.element]),content:Ge.node,disableAnimation:Ge.bool.isRequired,footer:Ge.node,handleClick:Ge.func.isRequired,hideArrow:Ge.bool.isRequired,open:Ge.bool,placement:Ge.string.isRequired,positionWrapper:Ge.bool.isRequired,setArrowRef:Ge.func.isRequired,setFloaterRef:Ge.func.isRequired,showCloseButton:Ge.bool,status:Ge.string.isRequired,styles:Ge.object.isRequired,title:Ge.node});var lQ=(function(t){ig(n,t);var e=ag(n);function n(){return rg(this,n),e.apply(this,arguments)}return sg(n,[{key:"render",value:function(){var s=this.props,i=s.children,a=s.handleClick,l=s.handleMouseEnter,c=s.handleMouseLeave,d=s.setChildRef,h=s.setWrapperRef,m=s.style,g=s.styles,x;if(i)if(ae.Children.count(i)===1)if(!ae.isValidElement(i))x=ae.createElement("span",null,i);else{var y=_e.function(i.type)?"innerRef":"ref";x=ae.cloneElement(ae.Children.only(i),qs({},y,d))}else x=i;return x?ae.createElement("span",{ref:h,style:br(br({},g),m),onClick:a,onMouseEnter:l,onMouseLeave:c},x):null}}]),n})(ae.Component);qs(lQ,"propTypes",{children:Ge.node,handleClick:Ge.func.isRequired,handleMouseEnter:Ge.func.isRequired,handleMouseLeave:Ge.func.isRequired,setChildRef:Ge.func.isRequired,setWrapperRef:Ge.func.isRequired,style:Ge.object,styles:Ge.object.isRequired});var cxe={zIndex:100};function uxe(t){var e=Va(cxe,t.options||{});return{wrapper:{cursor:"help",display:"inline-flex",flexDirection:"column",zIndex:e.zIndex},wrapperPosition:{left:-1e3,position:"absolute",top:-1e3,visibility:"hidden"},floater:{display:"inline-block",filter:"drop-shadow(0 0 3px rgba(0, 0, 0, 0.3))",maxWidth:300,opacity:0,position:"relative",transition:"opacity 0.3s",visibility:"hidden",zIndex:e.zIndex},floaterOpening:{opacity:1,visibility:"visible"},floaterWithAnimation:{opacity:1,transition:"opacity 0.3s, transform 0.2s",visibility:"visible"},floaterWithComponent:{maxWidth:"100%"},floaterClosing:{opacity:0,visibility:"visible"},floaterCentered:{left:"50%",position:"fixed",top:"50%",transform:"translate(-50%, -50%)"},container:{backgroundColor:"#fff",color:"#666",minHeight:60,minWidth:200,padding:20,position:"relative",zIndex:10},title:{borderBottom:"1px solid #555",color:"#555",fontSize:18,marginBottom:5,paddingBottom:6,paddingRight:18},content:{fontSize:15},close:{backgroundColor:"transparent",border:0,borderRadius:0,color:"#555",fontSize:0,height:15,outline:"none",padding:10,position:"absolute",right:0,top:0,width:15,WebkitAppearance:"none"},footer:{borderTop:"1px solid #ccc",fontSize:13,marginTop:10,paddingTop:5},arrow:{color:"#fff",display:"inline-flex",length:16,margin:8,position:"absolute",spread:32},options:e}}var dxe=["arrow","flip","offset"],hxe=["position","top","right","bottom","left"],X6=(function(t){ig(n,t);var e=ag(n);function n(r){var s;return rg(this,n),s=e.call(this,r),qs(Nl(s),"setArrowRef",function(i){s.arrowRef=i}),qs(Nl(s),"setChildRef",function(i){s.childRef=i}),qs(Nl(s),"setFloaterRef",function(i){s.floaterRef=i}),qs(Nl(s),"setWrapperRef",function(i){s.wrapperRef=i}),qs(Nl(s),"handleTransitionEnd",function(){var i=s.state.status,a=s.props.callback;s.wrapperPopper&&s.wrapperPopper.instance.update(),s.setState({status:i===On.OPENING?On.OPEN:On.IDLE},function(){var l=s.state.status;a(l===On.OPEN?"open":"close",s.props)})}),qs(Nl(s),"handleClick",function(){var i=s.props,a=i.event,l=i.open;if(!_e.boolean(l)){var c=s.state,d=c.positionWrapper,h=c.status;(s.event==="click"||s.event==="hover"&&d)&&(O1({title:"click",data:[{event:a,status:h===On.OPEN?"closing":"opening"}],debug:s.debug}),s.toggle())}}),qs(Nl(s),"handleMouseEnter",function(){var i=s.props,a=i.event,l=i.open;if(!(_e.boolean(l)||SS())){var c=s.state.status;s.event==="hover"&&c===On.IDLE&&(O1({title:"mouseEnter",data:[{key:"originalEvent",value:a}],debug:s.debug}),clearTimeout(s.eventDelayTimeout),s.toggle())}}),qs(Nl(s),"handleMouseLeave",function(){var i=s.props,a=i.event,l=i.eventDelay,c=i.open;if(!(_e.boolean(c)||SS())){var d=s.state,h=d.status,m=d.positionWrapper;s.event==="hover"&&(O1({title:"mouseLeave",data:[{key:"originalEvent",value:a}],debug:s.debug}),l?[On.OPENING,On.OPEN].indexOf(h)!==-1&&!m&&!s.eventDelayTimeout&&(s.eventDelayTimeout=setTimeout(function(){delete s.eventDelayTimeout,s.toggle()},l*1e3)):s.toggle(On.IDLE))}}),s.state={currentPlacement:r.placement,needsUpdate:!1,positionWrapper:r.wrapperOptions.position&&!!r.target,status:On.INIT,statusWrapper:On.INIT},s._isMounted=!1,s.hasMounted=!1,vo()&&window.addEventListener("load",function(){s.popper&&s.popper.instance.update(),s.wrapperPopper&&s.wrapperPopper.instance.update()}),s}return sg(n,[{key:"componentDidMount",value:function(){if(vo()){var s=this.state.positionWrapper,i=this.props,a=i.children,l=i.open,c=i.target;this._isMounted=!0,O1({title:"init",data:{hasChildren:!!a,hasTarget:!!c,isControlled:_e.boolean(l),positionWrapper:s,target:this.target,floater:this.floaterRef},debug:this.debug}),this.hasMounted||(this.initPopper(),this.hasMounted=!0),!a&&c&&_e.boolean(l)}}},{key:"componentDidUpdate",value:function(s,i){if(vo()){var a=this.props,l=a.autoOpen,c=a.open,d=a.target,h=a.wrapperOptions,m=Uge(i,this.state),g=m.changedFrom,x=m.changed;if(s.open!==c){var y;_e.boolean(c)&&(y=c?On.OPENING:On.CLOSING),this.toggle(y)}(s.wrapperOptions.position!==h.position||s.target!==d)&&this.changeWrapperPosition(this.props),x("status",On.IDLE)&&c?this.toggle(On.OPEN):g("status",On.INIT,On.IDLE)&&l&&this.toggle(On.OPEN),this.popper&&x("status",On.OPENING)&&this.popper.instance.update(),this.floaterRef&&(x("status",On.OPENING)||x("status",On.CLOSING))&&oxe(this.floaterRef,"transitionend",this.handleTransitionEnd),x("needsUpdate",!0)&&this.rebuildPopper()}}},{key:"componentWillUnmount",value:function(){vo()&&(this._isMounted=!1,this.popper&&this.popper.instance.destroy(),this.wrapperPopper&&this.wrapperPopper.instance.destroy())}},{key:"initPopper",value:function(){var s=this,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.target,a=this.state.positionWrapper,l=this.props,c=l.disableFlip,d=l.getPopper,h=l.hideArrow,m=l.offset,g=l.placement,x=l.wrapperOptions,y=g==="top"||g==="bottom"?"flip":["right","bottom-end","top-end","left","top-start","bottom-start"];if(g==="center")this.setState({status:On.IDLE});else if(i&&this.floaterRef){var w=this.options,S=w.arrow,k=w.flip,j=w.offset,N=tQ(w,dxe);new lp(i,this.floaterRef,{placement:g,modifiers:br({arrow:br({enabled:!h,element:this.arrowRef},S),flip:br({enabled:!c,behavior:y},k),offset:br({offset:"0, ".concat(m,"px")},j)},N),onCreate:function(_){var A;if(s.popper=_,!((A=s.floaterRef)!==null&&A!==void 0&&A.isConnected)){s.setState({needsUpdate:!0});return}d(_,"floater"),s._isMounted&&s.setState({currentPlacement:_.placement,status:On.IDLE}),g!==_.placement&&setTimeout(function(){_.instance.update()},1)},onUpdate:function(_){s.popper=_;var A=s.state.currentPlacement;s._isMounted&&_.placement!==A&&s.setState({currentPlacement:_.placement})}})}if(a){var T=_e.undefined(x.offset)?0:x.offset;new lp(this.target,this.wrapperRef,{placement:x.placement||g,modifiers:{arrow:{enabled:!1},offset:{offset:"0, ".concat(T,"px")},flip:{enabled:!1}},onCreate:function(_){s.wrapperPopper=_,s._isMounted&&s.setState({statusWrapper:On.IDLE}),d(_,"wrapper"),g!==_.placement&&setTimeout(function(){_.instance.update()},1)}})}}},{key:"rebuildPopper",value:function(){var s=this;this.floaterRefInterval=setInterval(function(){var i;(i=s.floaterRef)!==null&&i!==void 0&&i.isConnected&&(clearInterval(s.floaterRefInterval),s.setState({needsUpdate:!1}),s.initPopper())},50)}},{key:"changeWrapperPosition",value:function(s){var i=s.target,a=s.wrapperOptions;this.setState({positionWrapper:a.position&&!!i})}},{key:"toggle",value:function(s){var i=this.state.status,a=i===On.OPEN?On.CLOSING:On.OPENING;_e.undefined(s)||(a=s),this.setState({status:a})}},{key:"debug",get:function(){var s=this.props.debug;return s||vo()&&"ReactFloaterDebug"in window&&!!window.ReactFloaterDebug}},{key:"event",get:function(){var s=this.props,i=s.disableHoverToClick,a=s.event;return a==="hover"&&SS()&&!i?"click":a}},{key:"options",get:function(){var s=this.props.options;return Va(Zge,s||{})}},{key:"styles",get:function(){var s=this,i=this.state,a=i.status,l=i.positionWrapper,c=i.statusWrapper,d=this.props.styles,h=Va(uxe(d),d);if(l){var m;[On.IDLE].indexOf(a)===-1||[On.IDLE].indexOf(c)===-1?m=h.wrapperPosition:m=this.wrapperPopper.styles,h.wrapper=br(br({},h.wrapper),m)}if(this.target){var g=window.getComputedStyle(this.target);this.wrapperStyles?h.wrapper=br(br({},h.wrapper),this.wrapperStyles):["relative","static"].indexOf(g.position)===-1&&(this.wrapperStyles={},l||(hxe.forEach(function(x){s.wrapperStyles[x]=g[x]}),h.wrapper=br(br({},h.wrapper),this.wrapperStyles),this.target.style.position="relative",this.target.style.top="auto",this.target.style.right="auto",this.target.style.bottom="auto",this.target.style.left="auto"))}return h}},{key:"target",get:function(){if(!vo())return null;var s=this.props.target;return s?_e.domElement(s)?s:document.querySelector(s):this.childRef||this.wrapperRef}},{key:"render",value:function(){var s=this.state,i=s.currentPlacement,a=s.positionWrapper,l=s.status,c=this.props,d=c.children,h=c.component,m=c.content,g=c.disableAnimation,x=c.footer,y=c.hideArrow,w=c.id,S=c.open,k=c.showCloseButton,j=c.style,N=c.target,T=c.title,E=ae.createElement(lQ,{handleClick:this.handleClick,handleMouseEnter:this.handleMouseEnter,handleMouseLeave:this.handleMouseLeave,setChildRef:this.setChildRef,setWrapperRef:this.setWrapperRef,style:j,styles:this.styles.wrapper},d),_={};return a?_.wrapperInPortal=E:_.wrapperAsChildren=E,ae.createElement("span",null,ae.createElement(rQ,{hasChildren:!!d,id:w,placement:i,setRef:this.setFloaterRef,target:N,zIndex:this.styles.options.zIndex},ae.createElement(oQ,{component:h,content:m,disableAnimation:g,footer:x,handleClick:this.handleClick,hideArrow:y||i==="center",open:S,placement:i,positionWrapper:a,setArrowRef:this.setArrowRef,setFloaterRef:this.setFloaterRef,showCloseButton:k,status:l,styles:this.styles,title:T}),_.wrapperInPortal),_.wrapperAsChildren)}}]),n})(ae.Component);qs(X6,"propTypes",{autoOpen:Ge.bool,callback:Ge.func,children:Ge.node,component:UA(Ge.oneOfType([Ge.func,Ge.element]),function(t){return!t.content}),content:UA(Ge.node,function(t){return!t.component}),debug:Ge.bool,disableAnimation:Ge.bool,disableFlip:Ge.bool,disableHoverToClick:Ge.bool,event:Ge.oneOf(["hover","click"]),eventDelay:Ge.number,footer:Ge.node,getPopper:Ge.func,hideArrow:Ge.bool,id:Ge.oneOfType([Ge.string,Ge.number]),offset:Ge.number,open:Ge.bool,options:Ge.object,placement:Ge.oneOf(["top","top-start","top-end","bottom","bottom-start","bottom-end","left","left-start","left-end","right","right-start","right-end","auto","center"]),showCloseButton:Ge.bool,style:Ge.object,styles:Ge.object,target:Ge.oneOfType([Ge.object,Ge.string]),title:Ge.node,wrapperOptions:Ge.shape({offset:Ge.number,placement:Ge.oneOf(["top","top-start","top-end","bottom","bottom-start","bottom-end","left","left-start","left-end","right","right-start","right-end","auto"]),position:Ge.bool})});qs(X6,"defaultProps",{autoOpen:!1,callback:WA,debug:!1,disableAnimation:!1,disableFlip:!1,disableHoverToClick:!1,event:"click",eventDelay:.4,getPopper:WA,hideArrow:!1,offset:15,placement:"bottom",showCloseButton:!1,styles:{},target:null,wrapperOptions:{position:!1}});var fxe=Object.defineProperty,mxe=(t,e,n)=>e in t?fxe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,gt=(t,e,n)=>mxe(t,typeof e!="symbol"?e+"":e,n),Qn={INIT:"init",START:"start",STOP:"stop",RESET:"reset",PREV:"prev",NEXT:"next",GO:"go",CLOSE:"close",SKIP:"skip",UPDATE:"update"},Qa={TOUR_START:"tour:start",STEP_BEFORE:"step:before",BEACON:"beacon",TOOLTIP:"tooltip",STEP_AFTER:"step:after",TOUR_END:"tour:end",TOUR_STATUS:"tour:status",TARGET_NOT_FOUND:"error:target_not_found"},Qt={INIT:"init",READY:"ready",BEACON:"beacon",TOOLTIP:"tooltip",COMPLETE:"complete",ERROR:"error"},mn={IDLE:"idle",READY:"ready",WAITING:"waiting",RUNNING:"running",PAUSED:"paused",SKIPPED:"skipped",FINISHED:"finished"};function Ic(){var t;return!!(typeof window<"u"&&((t=window.document)!=null&&t.createElement))}function cQ(t){return t?t.getBoundingClientRect():null}function pxe(t=!1){const{body:e,documentElement:n}=document;if(!e||!n)return 0;if(t){const r=[e.scrollHeight,e.offsetHeight,n.clientHeight,n.scrollHeight,n.offsetHeight].sort((i,a)=>i-a),s=Math.floor(r.length/2);return r.length%2===0?(r[s-1]+r[s])/2:r[s]}return Math.max(e.scrollHeight,e.offsetHeight,n.clientHeight,n.scrollHeight,n.offsetHeight)}function Ml(t){if(typeof t=="string")try{return document.querySelector(t)}catch{return null}return t}function gxe(t){return!t||t.nodeType!==1?null:getComputedStyle(t)}function cp(t,e,n){if(!t)return Uu();const r=IH(t);if(r){if(r.isSameNode(Uu()))return n?document:Uu();if(!(r.scrollHeight>r.offsetHeight)&&!e)return r.style.overflow="initial",Uu()}return r}function _b(t,e){if(!t)return!1;const n=cp(t,e);return n?!n.isSameNode(Uu()):!1}function xxe(t){return t.offsetParent!==document.body}function df(t,e="fixed"){if(!t||!(t instanceof HTMLElement))return!1;const{nodeName:n}=t,r=gxe(t);return n==="BODY"||n==="HTML"?!1:r&&r.position===e?!0:t.parentNode?df(t.parentNode,e):!1}function vxe(t){var e;if(!t)return!1;let n=t;for(;n&&n!==document.body;){if(n instanceof HTMLElement){const{display:r,visibility:s}=getComputedStyle(n);if(r==="none"||s==="hidden")return!1}n=(e=n.parentElement)!=null?e:null}return!0}function yxe(t,e,n){var r,s,i;const a=cQ(t),l=cp(t,n),c=_b(t,n),d=df(t);let h=0,m=(r=a?.top)!=null?r:0;if(c&&d){const g=(s=t?.offsetTop)!=null?s:0,x=(i=l?.scrollTop)!=null?i:0;m=g-x}else l instanceof HTMLElement&&(h=l.scrollTop,!c&&!df(t)&&(m+=h),l.isSameNode(Uu())||(m+=Uu().scrollTop));return Math.floor(m-e)}function bxe(t,e,n){var r;if(!t)return 0;const{offsetTop:s=0,scrollTop:i=0}=(r=IH(t))!=null?r:{};let a=t.getBoundingClientRect().top+i;s&&(_b(t,n)||xxe(t))&&(a-=s);const l=Math.floor(a-e);return l<0?0:l}function Uu(){var t;return(t=document.scrollingElement)!=null?t:document.documentElement}function wxe(t,e){const{duration:n,element:r}=e;return new Promise((s,i)=>{const{scrollTop:a}=r,l=t>a?t-a:a-t;Fpe.top(r,t,{duration:l<100?50:n},c=>c&&c.message!=="Element already at target scroll position"?i(c):s())})}var Gm=pa.createPortal!==void 0;function uQ(t=navigator.userAgent){let e=t;return typeof window>"u"?e="node":document.documentMode?e="ie":/Edge/.test(t)?e="edge":window.opera||t.includes(" OPR/")?e="opera":typeof window.InstallTrigger<"u"?e="firefox":window.chrome?e="chrome":/(Version\/([\d._]+).*Safari|CriOS|FxiOS| Mobile\/)/.test(t)&&(e="safari"),e}function bv(t){return Object.prototype.toString.call(t).slice(8,-1).toLowerCase()}function yo(t,e={}){const{defaultValue:n,step:r,steps:s}=e;let i=AA(t);if(i)(i.includes("{step}")||i.includes("{steps}"))&&r&&s&&(i=i.replace("{step}",r.toString()).replace("{steps}",s.toString()));else if(b.isValidElement(t)&&!Object.values(t.props).length&&bv(t.type)==="function"){const a=t.type({});i=yo(a,e)}else i=AA(n);return i}function Sxe(t,e){return!ft.plainObject(t)||!ft.array(e)?!1:Object.keys(t).every(n=>e.includes(n))}function kxe(t){const e=/^#?([\da-f])([\da-f])([\da-f])$/i,n=t.replace(e,(s,i,a,l)=>i+i+a+a+l+l),r=/^#?([\da-f]{2})([\da-f]{2})([\da-f]{2})$/i.exec(n);return r?[parseInt(r[1],16),parseInt(r[2],16),parseInt(r[3],16)]:[]}function GA(t){return t.disableBeacon||t.placement==="center"}function XA(){return!["chrome","safari","firefox","opera"].includes(uQ())}function hd({data:t,debug:e=!1,title:n,warn:r=!1}){const s=r?console.warn||console.error:console.log;e&&(n&&t?(console.groupCollapsed(`%creact-joyride: ${n}`,"color: #ff0044; font-weight: bold; font-size: 12px;"),Array.isArray(t)?t.forEach(i=>{ft.plainObject(i)&&i.key?s.apply(console,[i.key,i.value]):s.apply(console,[i])}):s.apply(console,[t]),console.groupEnd()):console.error("Missing title or data props"))}function Oxe(t){return Object.keys(t)}function dQ(t,...e){if(!ft.plainObject(t))throw new TypeError("Expected an object");const n={};for(const r in t)({}).hasOwnProperty.call(t,r)&&(e.includes(r)||(n[r]=t[r]));return n}function jxe(t,...e){if(!ft.plainObject(t))throw new TypeError("Expected an object");if(!e.length)return t;const n={};for(const r in t)({}).hasOwnProperty.call(t,r)&&e.includes(r)&&(n[r]=t[r]);return n}function SO(t,e,n){const r=i=>i.replace("{step}",String(e)).replace("{steps}",String(n));if(bv(t)==="string")return r(t);if(!b.isValidElement(t))return t;const{children:s}=t.props;if(bv(s)==="string"&&s.includes("{step}"))return b.cloneElement(t,{children:r(s)});if(Array.isArray(s))return b.cloneElement(t,{children:s.map(i=>typeof i=="string"?r(i):SO(i,e,n))});if(bv(t.type)==="function"&&!Object.values(t.props).length){const i=t.type({});return SO(i,e,n)}return t}function Nxe(t){const{isFirstStep:e,lifecycle:n,previousLifecycle:r,scrollToFirstStep:s,step:i,target:a}=t;return!i.disableScrolling&&(!e||s||n===Qt.TOOLTIP)&&i.placement!=="center"&&(!i.isFixed||!df(a))&&r!==n&&[Qt.BEACON,Qt.TOOLTIP].includes(n)}var Cxe={options:{preventOverflow:{boundariesElement:"scrollParent"}},wrapperOptions:{offset:-18,position:!0}},hQ={back:"Back",close:"Close",last:"Last",next:"Next",nextLabelWithProgress:"Next (Step {step} of {steps})",open:"Open the dialog",skip:"Skip"},Txe={event:"click",placement:"bottom",offset:10,disableBeacon:!1,disableCloseOnEsc:!1,disableOverlay:!1,disableOverlayClose:!1,disableScrollParentFix:!1,disableScrolling:!1,hideBackButton:!1,hideCloseButton:!1,hideFooter:!1,isFixed:!1,locale:hQ,showProgress:!1,showSkipButton:!1,spotlightClicks:!1,spotlightPadding:10},Exe={continuous:!1,debug:!1,disableCloseOnEsc:!1,disableOverlay:!1,disableOverlayClose:!1,disableScrolling:!1,disableScrollParentFix:!1,getHelpers:void 0,hideBackButton:!1,run:!0,scrollOffset:20,scrollDuration:300,scrollToFirstStep:!1,showSkipButton:!1,showProgress:!1,spotlightClicks:!1,spotlightPadding:10,steps:[]},_xe={arrowColor:"#fff",backgroundColor:"#fff",beaconSize:36,overlayColor:"rgba(0, 0, 0, 0.5)",primaryColor:"#f04",spotlightShadow:"0 0 15px rgba(0, 0, 0, 0.5)",textColor:"#333",width:380,zIndex:100},Xm={backgroundColor:"transparent",border:0,borderRadius:0,color:"#555",cursor:"pointer",fontSize:16,lineHeight:1,padding:8,WebkitAppearance:"none"},YA={borderRadius:4,position:"absolute"};function Axe(t,e){var n,r,s,i,a;const{floaterProps:l,styles:c}=t,d=Va((n=e.floaterProps)!=null?n:{},l??{}),h=Va(c??{},(r=e.styles)!=null?r:{}),m=Va(_xe,h.options||{}),g=e.placement==="center"||e.disableBeacon;let{width:x}=m;window.innerWidth>480&&(x=380),"width"in m&&(x=typeof m.width=="number"&&window.innerWidth<m.width?window.innerWidth-30:m.width);const y={bottom:0,left:0,overflow:"hidden",position:"absolute",right:0,top:0,zIndex:m.zIndex},w={beacon:{...Xm,display:g?"none":"inline-block",height:m.beaconSize,position:"relative",width:m.beaconSize,zIndex:m.zIndex},beaconInner:{animation:"joyride-beacon-inner 1.2s infinite ease-in-out",backgroundColor:m.primaryColor,borderRadius:"50%",display:"block",height:"50%",left:"50%",opacity:.7,position:"absolute",top:"50%",transform:"translate(-50%, -50%)",width:"50%"},beaconOuter:{animation:"joyride-beacon-outer 1.2s infinite ease-in-out",backgroundColor:`rgba(${kxe(m.primaryColor).join(",")}, 0.2)`,border:`2px solid ${m.primaryColor}`,borderRadius:"50%",boxSizing:"border-box",display:"block",height:"100%",left:0,opacity:.9,position:"absolute",top:0,transformOrigin:"center",width:"100%"},tooltip:{backgroundColor:m.backgroundColor,borderRadius:5,boxSizing:"border-box",color:m.textColor,fontSize:16,maxWidth:"100%",padding:15,position:"relative",width:x},tooltipContainer:{lineHeight:1.4,textAlign:"center"},tooltipTitle:{fontSize:18,margin:0},tooltipContent:{padding:"20px 10px"},tooltipFooter:{alignItems:"center",display:"flex",justifyContent:"flex-end",marginTop:15},tooltipFooterSpacer:{flex:1},buttonNext:{...Xm,backgroundColor:m.primaryColor,borderRadius:4,color:"#fff"},buttonBack:{...Xm,color:m.primaryColor,marginLeft:"auto",marginRight:5},buttonClose:{...Xm,color:m.textColor,height:14,padding:15,position:"absolute",right:0,top:0,width:14},buttonSkip:{...Xm,color:m.textColor,fontSize:14},overlay:{...y,backgroundColor:m.overlayColor,mixBlendMode:"hard-light"},overlayLegacy:{...y},overlayLegacyCenter:{...y,backgroundColor:m.overlayColor},spotlight:{...YA,backgroundColor:"gray"},spotlightLegacy:{...YA,boxShadow:`0 0 0 9999px ${m.overlayColor}, ${m.spotlightShadow}`},floaterStyles:{arrow:{color:(a=(i=(s=d?.styles)==null?void 0:s.arrow)==null?void 0:i.color)!=null?a:m.arrowColor},options:{zIndex:m.zIndex+100}},options:m};return Va(w,h)}function Mxe(t){return jxe(t,"beaconComponent","disableCloseOnEsc","disableOverlay","disableOverlayClose","disableScrolling","disableScrollParentFix","floaterProps","hideBackButton","hideCloseButton","locale","showProgress","showSkipButton","spotlightClicks","spotlightPadding","styles","tooltipComponent")}function ah(t,e){var n,r,s,i,a,l;const c=e??{},d=Va.all([Txe,Mxe(t),c],{isMergeableObject:ft.plainObject}),h=Axe(t,d),m=_b(Ml(d.target),d.disableScrollParentFix),g=Va.all([Cxe,(n=t.floaterProps)!=null?n:{},(r=d.floaterProps)!=null?r:{}]);return g.offset=d.offset,g.styles=Va((s=g.styles)!=null?s:{},h.floaterStyles),g.offset+=(a=(i=t.spotlightPadding)!=null?i:d.spotlightPadding)!=null?a:0,d.placementBeacon&&g.wrapperOptions&&(g.wrapperOptions.placement=d.placementBeacon),m&&g.options.preventOverflow&&(g.options.preventOverflow.boundariesElement="window"),{...d,locale:Va.all([hQ,(l=t.locale)!=null?l:{},d.locale||{}]),floaterProps:g,styles:dQ(h,"floaterStyles")}}function fQ(t,e=!1){return ft.plainObject(t)?t.target?!0:(hd({title:"validateStep",data:"target is missing from the step",warn:!0,debug:e}),!1):(hd({title:"validateStep",data:"step must be an object",warn:!0,debug:e}),!1)}function KA(t,e=!1){return ft.array(t)?t.every(n=>fQ(n,e)):(hd({title:"validateSteps",data:"steps must be an array",warn:!0,debug:e}),!1)}var mQ={action:"init",controlled:!1,index:0,lifecycle:Qt.INIT,origin:null,size:0,status:mn.IDLE},ZA=Oxe(dQ(mQ,"controlled","size")),Rxe=class{constructor(t){gt(this,"beaconPopper"),gt(this,"tooltipPopper"),gt(this,"data",new Map),gt(this,"listener"),gt(this,"store",new Map),gt(this,"addListener",s=>{this.listener=s}),gt(this,"setSteps",s=>{const{size:i,status:a}=this.getState(),l={size:s.length,status:a};this.data.set("steps",s),a===mn.WAITING&&!i&&s.length&&(l.status=mn.RUNNING),this.setState(l)}),gt(this,"getPopper",s=>s==="beacon"?this.beaconPopper:this.tooltipPopper),gt(this,"setPopper",(s,i)=>{s==="beacon"?this.beaconPopper=i:this.tooltipPopper=i}),gt(this,"cleanupPoppers",()=>{this.beaconPopper=null,this.tooltipPopper=null}),gt(this,"close",(s=null)=>{const{index:i,status:a}=this.getState();a===mn.RUNNING&&this.setState({...this.getNextState({action:Qn.CLOSE,index:i+1,origin:s})})}),gt(this,"go",s=>{const{controlled:i,status:a}=this.getState();if(i||a!==mn.RUNNING)return;const l=this.getSteps()[s];this.setState({...this.getNextState({action:Qn.GO,index:s}),status:l?a:mn.FINISHED})}),gt(this,"info",()=>this.getState()),gt(this,"next",()=>{const{index:s,status:i}=this.getState();i===mn.RUNNING&&this.setState(this.getNextState({action:Qn.NEXT,index:s+1}))}),gt(this,"open",()=>{const{status:s}=this.getState();s===mn.RUNNING&&this.setState({...this.getNextState({action:Qn.UPDATE,lifecycle:Qt.TOOLTIP})})}),gt(this,"prev",()=>{const{index:s,status:i}=this.getState();i===mn.RUNNING&&this.setState({...this.getNextState({action:Qn.PREV,index:s-1})})}),gt(this,"reset",(s=!1)=>{const{controlled:i}=this.getState();i||this.setState({...this.getNextState({action:Qn.RESET,index:0}),status:s?mn.RUNNING:mn.READY})}),gt(this,"skip",()=>{const{status:s}=this.getState();s===mn.RUNNING&&this.setState({action:Qn.SKIP,lifecycle:Qt.INIT,status:mn.SKIPPED})}),gt(this,"start",s=>{const{index:i,size:a}=this.getState();this.setState({...this.getNextState({action:Qn.START,index:ft.number(s)?s:i},!0),status:a?mn.RUNNING:mn.WAITING})}),gt(this,"stop",(s=!1)=>{const{index:i,status:a}=this.getState();[mn.FINISHED,mn.SKIPPED].includes(a)||this.setState({...this.getNextState({action:Qn.STOP,index:i+(s?1:0)}),status:mn.PAUSED})}),gt(this,"update",s=>{var i,a;if(!Sxe(s,ZA))throw new Error(`State is not valid. Valid keys: ${ZA.join(", ")}`);this.setState({...this.getNextState({...this.getState(),...s,action:(i=s.action)!=null?i:Qn.UPDATE,origin:(a=s.origin)!=null?a:null},!0)})});const{continuous:e=!1,stepIndex:n,steps:r=[]}=t??{};this.setState({action:Qn.INIT,controlled:ft.number(n),continuous:e,index:ft.number(n)?n:0,lifecycle:Qt.INIT,origin:null,status:r.length?mn.READY:mn.IDLE},!0),this.beaconPopper=null,this.tooltipPopper=null,this.listener=null,this.setSteps(r)}getState(){return this.store.size?{action:this.store.get("action")||"",controlled:this.store.get("controlled")||!1,index:parseInt(this.store.get("index"),10),lifecycle:this.store.get("lifecycle")||"",origin:this.store.get("origin")||null,size:this.store.get("size")||0,status:this.store.get("status")||""}:{...mQ}}getNextState(t,e=!1){var n,r,s,i,a;const{action:l,controlled:c,index:d,size:h,status:m}=this.getState(),g=ft.number(t.index)?t.index:d,x=c&&!e?d:Math.min(Math.max(g,0),h);return{action:(n=t.action)!=null?n:l,controlled:c,index:x,lifecycle:(r=t.lifecycle)!=null?r:Qt.INIT,origin:(s=t.origin)!=null?s:null,size:(i=t.size)!=null?i:h,status:x===h?mn.FINISHED:(a=t.status)!=null?a:m}}getSteps(){const t=this.data.get("steps");return Array.isArray(t)?t:[]}hasUpdatedState(t){const e=JSON.stringify(t),n=JSON.stringify(this.getState());return e!==n}setState(t,e=!1){const n=this.getState(),{action:r,index:s,lifecycle:i,origin:a=null,size:l,status:c}={...n,...t};this.store.set("action",r),this.store.set("index",s),this.store.set("lifecycle",i),this.store.set("origin",a),this.store.set("size",l),this.store.set("status",c),e&&(this.store.set("controlled",t.controlled),this.store.set("continuous",t.continuous)),this.listener&&this.hasUpdatedState(n)&&this.listener(this.getState())}getHelpers(){return{close:this.close,go:this.go,info:this.info,next:this.next,open:this.open,prev:this.prev,reset:this.reset,skip:this.skip}}};function Dxe(t){return new Rxe(t)}function Pxe({styles:t}){return b.createElement("div",{key:"JoyrideSpotlight",className:"react-joyride__spotlight","data-test-id":"spotlight",style:t})}var zxe=Pxe,Ixe=class extends b.Component{constructor(){super(...arguments),gt(this,"isActive",!1),gt(this,"resizeTimeout"),gt(this,"scrollTimeout"),gt(this,"scrollParent"),gt(this,"state",{isScrolling:!1,mouseOverSpotlight:!1,showSpotlight:!0}),gt(this,"hideSpotlight",()=>{const{continuous:t,disableOverlay:e,lifecycle:n}=this.props,r=[Qt.INIT,Qt.BEACON,Qt.COMPLETE,Qt.ERROR];return e||(t?r.includes(n):n!==Qt.TOOLTIP)}),gt(this,"handleMouseMove",t=>{const{mouseOverSpotlight:e}=this.state,{height:n,left:r,position:s,top:i,width:a}=this.spotlightStyles,l=s==="fixed"?t.clientY:t.pageY,c=s==="fixed"?t.clientX:t.pageX,d=l>=i&&l<=i+n,m=c>=r&&c<=r+a&&d;m!==e&&this.updateState({mouseOverSpotlight:m})}),gt(this,"handleScroll",()=>{const{target:t}=this.props,e=Ml(t);if(this.scrollParent!==document){const{isScrolling:n}=this.state;n||this.updateState({isScrolling:!0,showSpotlight:!1}),clearTimeout(this.scrollTimeout),this.scrollTimeout=window.setTimeout(()=>{this.updateState({isScrolling:!1,showSpotlight:!0})},50)}else df(e,"sticky")&&this.updateState({})}),gt(this,"handleResize",()=>{clearTimeout(this.resizeTimeout),this.resizeTimeout=window.setTimeout(()=>{this.isActive&&this.forceUpdate()},100)})}componentDidMount(){const{debug:t,disableScrolling:e,disableScrollParentFix:n=!1,target:r}=this.props,s=Ml(r);this.scrollParent=cp(s??document.body,n,!0),this.isActive=!0,window.addEventListener("resize",this.handleResize)}componentDidUpdate(t){var e;const{disableScrollParentFix:n,lifecycle:r,spotlightClicks:s,target:i}=this.props,{changed:a}=uy(t,this.props);if(a("target")||a("disableScrollParentFix")){const l=Ml(i);this.scrollParent=cp(l??document.body,n,!0)}a("lifecycle",Qt.TOOLTIP)&&((e=this.scrollParent)==null||e.addEventListener("scroll",this.handleScroll,{passive:!0}),setTimeout(()=>{const{isScrolling:l}=this.state;l||this.updateState({showSpotlight:!0})},100)),(a("spotlightClicks")||a("disableOverlay")||a("lifecycle"))&&(s&&r===Qt.TOOLTIP?window.addEventListener("mousemove",this.handleMouseMove,!1):r!==Qt.TOOLTIP&&window.removeEventListener("mousemove",this.handleMouseMove))}componentWillUnmount(){var t;this.isActive=!1,window.removeEventListener("mousemove",this.handleMouseMove),window.removeEventListener("resize",this.handleResize),clearTimeout(this.resizeTimeout),clearTimeout(this.scrollTimeout),(t=this.scrollParent)==null||t.removeEventListener("scroll",this.handleScroll)}get overlayStyles(){const{mouseOverSpotlight:t}=this.state,{disableOverlayClose:e,placement:n,styles:r}=this.props;let s=r.overlay;return XA()&&(s=n==="center"?r.overlayLegacyCenter:r.overlayLegacy),{cursor:e?"default":"pointer",height:pxe(),pointerEvents:t?"none":"auto",...s}}get spotlightStyles(){var t,e,n;const{showSpotlight:r}=this.state,{disableScrollParentFix:s=!1,spotlightClicks:i,spotlightPadding:a=0,styles:l,target:c}=this.props,d=Ml(c),h=cQ(d),m=df(d),g=yxe(d,a,s);return{...XA()?l.spotlightLegacy:l.spotlight,height:Math.round(((t=h?.height)!=null?t:0)+a*2),left:Math.round(((e=h?.left)!=null?e:0)-a),opacity:r?1:0,pointerEvents:i?"none":"auto",position:m?"fixed":"absolute",top:g,transition:"opacity 0.2s",width:Math.round(((n=h?.width)!=null?n:0)+a*2)}}updateState(t){this.isActive&&this.setState(e=>({...e,...t}))}render(){const{showSpotlight:t}=this.state,{onClickOverlay:e,placement:n}=this.props,{hideSpotlight:r,overlayStyles:s,spotlightStyles:i}=this;if(r())return null;let a=n!=="center"&&t&&b.createElement(zxe,{styles:i});if(uQ()==="safari"){const{mixBlendMode:l,zIndex:c,...d}=s;a=b.createElement("div",{style:{...d}},a),delete s.backgroundColor}return b.createElement("div",{className:"react-joyride__overlay","data-test-id":"overlay",onClick:e,role:"presentation",style:s},a)}},Lxe=class extends b.Component{constructor(){super(...arguments),gt(this,"node",null)}componentDidMount(){const{id:t}=this.props;Ic()&&(this.node=document.createElement("div"),this.node.id=t,document.body.appendChild(this.node),Gm||this.renderReact15())}componentDidUpdate(){Ic()&&(Gm||this.renderReact15())}componentWillUnmount(){!Ic()||!this.node||(Gm||pa.unmountComponentAtNode(this.node),this.node.parentNode===document.body&&(document.body.removeChild(this.node),this.node=null))}renderReact15(){if(!Ic())return;const{children:t}=this.props;this.node&&pa.unstable_renderSubtreeIntoContainer(this,t,this.node)}renderReact16(){if(!Ic()||!Gm)return null;const{children:t}=this.props;return this.node?pa.createPortal(t,this.node):null}render(){return Gm?this.renderReact16():null}},Bxe=class{constructor(t,e){if(gt(this,"element"),gt(this,"options"),gt(this,"canBeTabbed",n=>{const{tabIndex:r}=n;return r===null||r<0?!1:this.canHaveFocus(n)}),gt(this,"canHaveFocus",n=>{const r=/input|select|textarea|button|object/,s=n.nodeName.toLowerCase();return(r.test(s)&&!n.getAttribute("disabled")||s==="a"&&!!n.getAttribute("href"))&&this.isVisible(n)}),gt(this,"findValidTabElements",()=>[].slice.call(this.element.querySelectorAll("*"),0).filter(this.canBeTabbed)),gt(this,"handleKeyDown",n=>{const{code:r="Tab"}=this.options;n.code===r&&this.interceptTab(n)}),gt(this,"interceptTab",n=>{n.preventDefault();const r=this.findValidTabElements(),{shiftKey:s}=n;if(!r.length)return;let i=document.activeElement?r.indexOf(document.activeElement):0;i===-1||!s&&i+1===r.length?i=0:s&&i===0?i=r.length-1:i+=s?-1:1,r[i].focus()}),gt(this,"isHidden",n=>{const r=n.offsetWidth<=0&&n.offsetHeight<=0,s=window.getComputedStyle(n);return r&&!n.innerHTML?!0:r&&s.getPropertyValue("overflow")!=="visible"||s.getPropertyValue("display")==="none"}),gt(this,"isVisible",n=>{let r=n;for(;r;)if(r instanceof HTMLElement){if(r===document.body)break;if(this.isHidden(r))return!1;r=r.parentNode}return!0}),gt(this,"removeScope",()=>{window.removeEventListener("keydown",this.handleKeyDown)}),gt(this,"checkFocus",n=>{document.activeElement!==n&&(n.focus(),window.requestAnimationFrame(()=>this.checkFocus(n)))}),gt(this,"setFocus",()=>{const{selector:n}=this.options;if(!n)return;const r=this.element.querySelector(n);r&&window.requestAnimationFrame(()=>this.checkFocus(r))}),!(t instanceof HTMLElement))throw new TypeError("Invalid parameter: element must be an HTMLElement");this.element=t,this.options=e,window.addEventListener("keydown",this.handleKeyDown,!1),this.setFocus()}},Fxe=class extends b.Component{constructor(t){if(super(t),gt(this,"beacon",null),gt(this,"setBeaconRef",s=>{this.beacon=s}),t.beaconComponent)return;const e=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.id="joyride-beacon-animation",t.nonce&&n.setAttribute("nonce",t.nonce),n.appendChild(document.createTextNode(`
@keyframes joyride-beacon-inner {
20% {
opacity: 0.9;
}
90% {
opacity: 0.7;
}
}
@keyframes joyride-beacon-outer {
0% {
transform: scale(1);
}
45% {
opacity: 0.7;
transform: scale(0.75);
}
100% {
opacity: 0.9;
transform: scale(1);
}
}
`)),e.appendChild(n)}componentDidMount(){const{shouldFocus:t}=this.props;setTimeout(()=>{ft.domElement(this.beacon)&&t&&this.beacon.focus()},0)}componentWillUnmount(){const t=document.getElementById("joyride-beacon-animation");t?.parentNode&&t.parentNode.removeChild(t)}render(){const{beaconComponent:t,continuous:e,index:n,isLastStep:r,locale:s,onClickOrHover:i,size:a,step:l,styles:c}=this.props,d=yo(s.open),h={"aria-label":d,onClick:i,onMouseEnter:i,ref:this.setBeaconRef,title:d};let m;if(t){const g=t;m=b.createElement(g,{continuous:e,index:n,isLastStep:r,size:a,step:l,...h})}else m=b.createElement("button",{key:"JoyrideBeacon",className:"react-joyride__beacon","data-test-id":"button-beacon",style:c.beacon,type:"button",...h},b.createElement("span",{style:c.beaconInner}),b.createElement("span",{style:c.beaconOuter}));return m}};function qxe({styles:t,...e}){const{color:n,height:r,width:s,...i}=t;return ae.createElement("button",{style:i,type:"button",...e},ae.createElement("svg",{height:typeof r=="number"?`${r}px`:r,preserveAspectRatio:"xMidYMid",version:"1.1",viewBox:"0 0 18 18",width:typeof s=="number"?`${s}px`:s,xmlns:"http://www.w3.org/2000/svg"},ae.createElement("g",null,ae.createElement("path",{d:"M8.13911129,9.00268191 L0.171521827,17.0258467 C-0.0498027049,17.248715 -0.0498027049,17.6098394 0.171521827,17.8327545 C0.28204354,17.9443526 0.427188206,17.9998706 0.572051765,17.9998706 C0.71714958,17.9998706 0.862013139,17.9443526 0.972581703,17.8327545 L9.0000937,9.74924618 L17.0276057,17.8327545 C17.1384085,17.9443526 17.2832721,17.9998706 17.4281356,17.9998706 C17.5729992,17.9998706 17.718097,17.9443526 17.8286656,17.8327545 C18.0499901,17.6098862 18.0499901,17.2487618 17.8286656,17.0258467 L9.86135722,9.00268191 L17.8340066,0.973848225 C18.0553311,0.750979934 18.0553311,0.389855532 17.8340066,0.16694039 C17.6126821,-0.0556467968 17.254037,-0.0556467968 17.0329467,0.16694039 L9.00042166,8.25611765 L0.967006424,0.167268345 C0.745681892,-0.0553188426 0.387317931,-0.0553188426 0.165993399,0.167268345 C-0.0553311331,0.390136635 -0.0553311331,0.751261038 0.165993399,0.974176179 L8.13920499,9.00268191 L8.13911129,9.00268191 Z",fill:n}))))}var $xe=qxe;function Hxe(t){const{backProps:e,closeProps:n,index:r,isLastStep:s,primaryProps:i,skipProps:a,step:l,tooltipProps:c}=t,{content:d,hideBackButton:h,hideCloseButton:m,hideFooter:g,showSkipButton:x,styles:y,title:w}=l,S={};return S.primary=b.createElement("button",{"data-test-id":"button-primary",style:y.buttonNext,type:"button",...i}),x&&!s&&(S.skip=b.createElement("button",{"aria-live":"off","data-test-id":"button-skip",style:y.buttonSkip,type:"button",...a})),!h&&r>0&&(S.back=b.createElement("button",{"data-test-id":"button-back",style:y.buttonBack,type:"button",...e})),S.close=!m&&b.createElement($xe,{"data-test-id":"button-close",styles:y.buttonClose,...n}),b.createElement("div",{key:"JoyrideTooltip","aria-label":yo(w??d),className:"react-joyride__tooltip",style:y.tooltip,...c},b.createElement("div",{style:y.tooltipContainer},w&&b.createElement("h1",{"aria-label":yo(w),style:y.tooltipTitle},w),b.createElement("div",{style:y.tooltipContent},d)),!g&&b.createElement("div",{style:y.tooltipFooter},b.createElement("div",{style:y.tooltipFooterSpacer},S.skip),S.back,S.primary),S.close)}var Qxe=Hxe,Vxe=class extends b.Component{constructor(){super(...arguments),gt(this,"handleClickBack",t=>{t.preventDefault();const{helpers:e}=this.props;e.prev()}),gt(this,"handleClickClose",t=>{t.preventDefault();const{helpers:e}=this.props;e.close("button_close")}),gt(this,"handleClickPrimary",t=>{t.preventDefault();const{continuous:e,helpers:n}=this.props;if(!e){n.close("button_primary");return}n.next()}),gt(this,"handleClickSkip",t=>{t.preventDefault();const{helpers:e}=this.props;e.skip()}),gt(this,"getElementsProps",()=>{const{continuous:t,index:e,isLastStep:n,setTooltipRef:r,size:s,step:i}=this.props,{back:a,close:l,last:c,next:d,nextLabelWithProgress:h,skip:m}=i.locale,g=yo(a),x=yo(l),y=yo(c),w=yo(d),S=yo(m);let k=l,j=x;if(t){if(k=d,j=w,i.showProgress&&!n){const N=yo(h,{step:e+1,steps:s});k=SO(h,e+1,s),j=N}n&&(k=c,j=y)}return{backProps:{"aria-label":g,children:a,"data-action":"back",onClick:this.handleClickBack,role:"button",title:g},closeProps:{"aria-label":x,children:l,"data-action":"close",onClick:this.handleClickClose,role:"button",title:x},primaryProps:{"aria-label":j,children:k,"data-action":"primary",onClick:this.handleClickPrimary,role:"button",title:j},skipProps:{"aria-label":S,children:m,"data-action":"skip",onClick:this.handleClickSkip,role:"button",title:S},tooltipProps:{"aria-modal":!0,ref:r,role:"alertdialog"}}})}render(){const{continuous:t,index:e,isLastStep:n,setTooltipRef:r,size:s,step:i}=this.props,{beaconComponent:a,tooltipComponent:l,...c}=i;let d;if(l){const h={...this.getElementsProps(),continuous:t,index:e,isLastStep:n,size:s,step:c,setTooltipRef:r},m=l;d=b.createElement(m,{...h})}else d=b.createElement(Qxe,{...this.getElementsProps(),continuous:t,index:e,isLastStep:n,size:s,step:i});return d}},Uxe=class extends b.Component{constructor(){super(...arguments),gt(this,"scope",null),gt(this,"tooltip",null),gt(this,"handleClickHoverBeacon",t=>{const{step:e,store:n}=this.props;t.type==="mouseenter"&&e.event!=="hover"||n.update({lifecycle:Qt.TOOLTIP})}),gt(this,"setTooltipRef",t=>{this.tooltip=t}),gt(this,"setPopper",(t,e)=>{var n;const{action:r,lifecycle:s,step:i,store:a}=this.props;e==="wrapper"?a.setPopper("beacon",t):a.setPopper("tooltip",t),a.getPopper("beacon")&&(a.getPopper("tooltip")||i.placement==="center")&&s===Qt.INIT&&a.update({action:r,lifecycle:Qt.READY}),(n=i.floaterProps)!=null&&n.getPopper&&i.floaterProps.getPopper(t,e)}),gt(this,"renderTooltip",t=>{const{continuous:e,helpers:n,index:r,size:s,step:i}=this.props;return b.createElement(Vxe,{continuous:e,helpers:n,index:r,isLastStep:r+1===s,setTooltipRef:this.setTooltipRef,size:s,step:i,...t})})}componentDidMount(){const{debug:t,index:e}=this.props;hd({title:`step:${e}`,data:[{key:"props",value:this.props}],debug:t})}componentDidUpdate(t){var e;const{action:n,callback:r,continuous:s,controlled:i,debug:a,helpers:l,index:c,lifecycle:d,shouldScroll:h,status:m,step:g,store:x}=this.props,{changed:y,changedFrom:w}=uy(t,this.props),S=l.info(),k=s&&n!==Qn.CLOSE&&(c>0||n===Qn.PREV),j=y("action")||y("index")||y("lifecycle")||y("status"),N=w("lifecycle",[Qt.TOOLTIP,Qt.INIT],Qt.INIT),T=y("action",[Qn.NEXT,Qn.PREV,Qn.SKIP,Qn.CLOSE]),E=i&&c===t.index;if(T&&(N||E)&&r({...S,index:t.index,lifecycle:Qt.COMPLETE,step:t.step,type:Qa.STEP_AFTER}),g.placement==="center"&&m===mn.RUNNING&&y("index")&&n!==Qn.START&&d===Qt.INIT&&x.update({lifecycle:Qt.READY}),j){const _=Ml(g.target),A=!!_;A&&vxe(_)?(w("status",mn.READY,mn.RUNNING)||w("lifecycle",Qt.INIT,Qt.READY))&&r({...S,step:g,type:Qa.STEP_BEFORE}):(console.warn(A?"Target not visible":"Target not mounted",g),r({...S,type:Qa.TARGET_NOT_FOUND,step:g}),i||x.update({index:c+(n===Qn.PREV?-1:1)}))}w("lifecycle",Qt.INIT,Qt.READY)&&x.update({lifecycle:GA(g)||k?Qt.TOOLTIP:Qt.BEACON}),y("index")&&hd({title:`step:${d}`,data:[{key:"props",value:this.props}],debug:a}),y("lifecycle",Qt.BEACON)&&r({...S,step:g,type:Qa.BEACON}),y("lifecycle",Qt.TOOLTIP)&&(r({...S,step:g,type:Qa.TOOLTIP}),h&&this.tooltip&&(this.scope=new Bxe(this.tooltip,{selector:"[data-action=primary]"}),this.scope.setFocus())),w("lifecycle",[Qt.TOOLTIP,Qt.INIT],Qt.INIT)&&((e=this.scope)==null||e.removeScope(),x.cleanupPoppers())}componentWillUnmount(){var t;(t=this.scope)==null||t.removeScope()}get open(){const{lifecycle:t,step:e}=this.props;return GA(e)||t===Qt.TOOLTIP}render(){const{continuous:t,debug:e,index:n,nonce:r,shouldScroll:s,size:i,step:a}=this.props,l=Ml(a.target);return!fQ(a)||!ft.domElement(l)?null:b.createElement("div",{key:`JoyrideStep-${n}`,className:"react-joyride__step"},b.createElement(X6,{...a.floaterProps,component:this.renderTooltip,debug:e,getPopper:this.setPopper,id:`react-joyride-step-${n}`,open:this.open,placement:a.placement,target:a.target},b.createElement(Fxe,{beaconComponent:a.beaconComponent,continuous:t,index:n,isLastStep:n+1===i,locale:a.locale,nonce:r,onClickOrHover:this.handleClickHoverBeacon,shouldFocus:s,size:i,step:a,styles:a.styles})))}},pQ=class extends b.Component{constructor(t){super(t),gt(this,"helpers"),gt(this,"store"),gt(this,"callback",a=>{const{callback:l}=this.props;ft.function(l)&&l(a)}),gt(this,"handleKeyboard",a=>{const{index:l,lifecycle:c}=this.state,{steps:d}=this.props,h=d[l];c===Qt.TOOLTIP&&a.code==="Escape"&&h&&!h.disableCloseOnEsc&&this.store.close("keyboard")}),gt(this,"handleClickOverlay",()=>{const{index:a}=this.state,{steps:l}=this.props;ah(this.props,l[a]).disableOverlayClose||this.helpers.close("overlay")}),gt(this,"syncState",a=>{this.setState(a)});const{debug:e,getHelpers:n,run:r=!0,stepIndex:s}=t;this.store=Dxe({...t,controlled:r&&ft.number(s)}),this.helpers=this.store.getHelpers();const{addListener:i}=this.store;hd({title:"init",data:[{key:"props",value:this.props},{key:"state",value:this.state}],debug:e}),i(this.syncState),n&&n(this.helpers),this.state=this.store.getState()}componentDidMount(){if(!Ic())return;const{debug:t,disableCloseOnEsc:e,run:n,steps:r}=this.props,{start:s}=this.store;KA(r,t)&&n&&s(),e||document.body.addEventListener("keydown",this.handleKeyboard,{passive:!0})}componentDidUpdate(t,e){if(!Ic())return;const{action:n,controlled:r,index:s,status:i}=this.state,{debug:a,run:l,stepIndex:c,steps:d}=this.props,{stepIndex:h,steps:m}=t,{reset:g,setSteps:x,start:y,stop:w,update:S}=this.store,{changed:k}=uy(t,this.props),{changed:j,changedFrom:N}=uy(e,this.state),T=ah(this.props,d[s]),E=!ei(m,d),_=ft.number(c)&&k("stepIndex"),A=Ml(T.target);if(E&&(KA(d,a)?x(d):console.warn("Steps are not valid",d)),k("run")&&(l?y(c):w()),_){let B=ft.number(h)&&h<c?Qn.NEXT:Qn.PREV;n===Qn.STOP&&(B=Qn.START),[mn.FINISHED,mn.SKIPPED].includes(i)||S({action:n===Qn.CLOSE?Qn.CLOSE:B,index:c,lifecycle:Qt.INIT})}!r&&i===mn.RUNNING&&s===0&&!A&&(this.store.update({index:s+1}),this.callback({...this.state,type:Qa.TARGET_NOT_FOUND,step:T}));const L={...this.state,index:s,step:T};if(j("action",[Qn.NEXT,Qn.PREV,Qn.SKIP,Qn.CLOSE])&&j("status",mn.PAUSED)){const B=ah(this.props,d[e.index]);this.callback({...L,index:e.index,lifecycle:Qt.COMPLETE,step:B,type:Qa.STEP_AFTER})}if(j("status",[mn.FINISHED,mn.SKIPPED])){const B=ah(this.props,d[e.index]);r||this.callback({...L,index:e.index,lifecycle:Qt.COMPLETE,step:B,type:Qa.STEP_AFTER}),this.callback({...L,type:Qa.TOUR_END,step:B,index:e.index}),g()}else N("status",[mn.IDLE,mn.READY],mn.RUNNING)?this.callback({...L,type:Qa.TOUR_START}):(j("status")||j("action",Qn.RESET))&&this.callback({...L,type:Qa.TOUR_STATUS});this.scrollToStep(e)}componentWillUnmount(){const{disableCloseOnEsc:t}=this.props;t||document.body.removeEventListener("keydown",this.handleKeyboard)}scrollToStep(t){const{index:e,lifecycle:n,status:r}=this.state,{debug:s,disableScrollParentFix:i=!1,scrollDuration:a,scrollOffset:l=20,scrollToFirstStep:c=!1,steps:d}=this.props,h=ah(this.props,d[e]),m=Ml(h.target),g=Nxe({isFirstStep:e===0,lifecycle:n,previousLifecycle:t.lifecycle,scrollToFirstStep:c,step:h,target:m});if(r===mn.RUNNING&&g){const x=_b(m,i),y=cp(m,i);let w=Math.floor(bxe(m,l,i))||0;hd({title:"scrollToStep",data:[{key:"index",value:e},{key:"lifecycle",value:n},{key:"status",value:r}],debug:s});const S=this.store.getPopper("beacon"),k=this.store.getPopper("tooltip");if(n===Qt.BEACON&&S){const{offsets:j,placement:N}=S;!["bottom"].includes(N)&&!x&&(w=Math.floor(j.popper.top-l))}else if(n===Qt.TOOLTIP&&k){const{flipped:j,offsets:N,placement:T}=k;["top","right","left"].includes(T)&&!j&&!x?w=Math.floor(N.popper.top-l):w-=h.spotlightPadding}w=w>=0?w:0,r===mn.RUNNING&&wxe(w,{element:y,duration:a}).then(()=>{setTimeout(()=>{var j;(j=this.store.getPopper("tooltip"))==null||j.instance.update()},10)})}}render(){if(!Ic())return null;const{index:t,lifecycle:e,status:n}=this.state,{continuous:r=!1,debug:s=!1,nonce:i,scrollToFirstStep:a=!1,steps:l}=this.props,c=n===mn.RUNNING,d={};if(c&&l[t]){const h=ah(this.props,l[t]);d.step=b.createElement(Uxe,{...this.state,callback:this.callback,continuous:r,debug:s,helpers:this.helpers,nonce:i,shouldScroll:!h.disableScrolling&&(t!==0||a),step:h,store:this.store}),d.overlay=b.createElement(Lxe,{id:"react-joyride-portal"},b.createElement(Ixe,{...h,continuous:r,debug:s,lifecycle:e,onClickOverlay:this.handleClickOverlay}))}return b.createElement("div",{className:"react-joyride"},d.step,d.overlay)}};gt(pQ,"defaultProps",Exe);var Wxe=pQ;function Y6(){const t=b.useContext(RH);if(!t)throw new Error("useTour must be used within a TourProvider");return t}const Gxe={options:{zIndex:1e4,primaryColor:"hsl(var(--primary))",textColor:"hsl(var(--foreground))",backgroundColor:"hsl(var(--background))",arrowColor:"hsl(var(--background))",overlayColor:"rgba(0, 0, 0, 0.5)"},tooltip:{borderRadius:"var(--radius)",padding:"1rem"},tooltipContainer:{textAlign:"left"},tooltipTitle:{fontSize:"1rem",fontWeight:600,marginBottom:"0.5rem"},tooltipContent:{fontSize:"0.875rem",padding:"0.5rem 0"},buttonNext:{backgroundColor:"hsl(var(--primary))",color:"hsl(var(--primary-foreground))",borderRadius:"calc(var(--radius) - 2px)",fontSize:"0.875rem",padding:"0.5rem 1rem"},buttonBack:{color:"hsl(var(--muted-foreground))",fontSize:"0.875rem",marginRight:"0.5rem"},buttonSkip:{color:"hsl(var(--muted-foreground))",fontSize:"0.875rem"},buttonClose:{color:"hsl(var(--muted-foreground))"},spotlight:{borderRadius:"var(--radius)"}},Xxe={back:"上一步",close:"关闭",last:"完成",next:"下一步",nextLabelWithProgress:"下一步 ({step}/{steps})",open:"打开对话框",skip:"跳过"};function Yxe(){const{state:t,getCurrentSteps:e,handleJoyrideCallback:n}=Y6(),r=e(),[s,i]=b.useState(!1),a=b.useRef(t.stepIndex),l=b.useRef(null);b.useEffect(()=>{a.current!==t.stepIndex&&(i(!1),a.current=t.stepIndex)},[t.stepIndex]),b.useEffect(()=>{if(!t.isRunning||r.length===0){i(!1);return}const h=r[t.stepIndex];if(!h){i(!1);return}const m=h.target;if(m==="body"){i(!0);return}i(!1);const g=setTimeout(()=>{const x=()=>{const k=document.querySelector(m);if(k){const j=k.getBoundingClientRect();if(j.width>0&&j.height>0)return!0}return!1};if(x()){setTimeout(()=>i(!0),100);return}const y=setInterval(()=>{x()&&(clearInterval(y),setTimeout(()=>i(!0),100))},100),w=setTimeout(()=>{clearInterval(y),i(!0)},5e3),S=()=>{clearInterval(y),clearTimeout(w)};l.current=S},150);return()=>{clearTimeout(g),l.current&&(l.current(),l.current=null)}},[t.isRunning,t.stepIndex,r]);const c=b.useRef(null);if(b.useEffect(()=>{let h=document.getElementById("tour-portal-container");return h||(h=document.createElement("div"),h.id="tour-portal-container",h.style.cssText="position: fixed; top: 0; left: 0; z-index: 99999; pointer-events: none;",document.body.appendChild(h)),c.current=h,()=>{}},[]),!t.isRunning||r.length===0||!s)return null;const d=o.jsx(Wxe,{steps:r,stepIndex:t.stepIndex,run:t.isRunning,continuous:!0,showSkipButton:!0,showProgress:!0,disableOverlayClose:!0,disableScrolling:!1,disableScrollParentFix:!1,callback:n,styles:Gxe,locale:Xxe,scrollOffset:80,scrollToFirstStep:!0,floaterProps:{styles:{floater:{zIndex:99999}},disableAnimation:!0}},`tour-step-${t.stepIndex}`);return c.current?pa.createPortal(d,c.current):d}const _l="model-assignment-tour",gQ=[{target:"body",content:"本引导旨在帮助你配置模型提供商和对应的模型,并为麦麦的各个组件分配合适的模型。",placement:"center",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="sidebar-model-provider"]',content:'第一步,你需要配置模型提供商。模型提供商决定了你要使用谁家的模型,无论是单一厂商(如 DeepSeek还是模型平台如 Siliconflow都可以在这里进行配置。点击"下一步"进入配置页面。',placement:"right",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="add-provider-button"]',content:'点击"添加提供商"按钮,开始配置你的模型提供商。',placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!0,hideFooter:!0},{target:'[data-tour="provider-dialog"]',content:"在这里,你可以选择你想要配置的模型提供商,填写相关信息后保存即可。",placement:"left",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="provider-name-input"]',content:"这里的名称是你为这个模型提供商起的一个名字,方便你在后续使用时识别它。",placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="provider-apikey-input"]',content:"这里需要填写你从模型提供商那里获取的 API 密钥,用于验证和调用模型服务。对于不同的提供商,获取 API 密钥的方式可能有所不同,请参考对应提供商的文档。",placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="provider-url-input"]',content:"这里需要填写模型提供商的 API 访问地址确保填写正确以便系统能够连接到模型服务。对于不同的提供商API 地址可能有所不同,请参考对应提供商的文档。",placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="provider-template-select"]',content:"当然,如果你不知道如何填写这些信息,很多模型提供商在这里都提供了预设的模板供你选择,选择对应的模板后,相关信息会自动填充。",placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="provider-save-button"]',content:"填写完所有信息后,点击保存按钮,模型提供商就配置完成了。",placement:"top",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="provider-cancel-button"]',content:"因为这次咱们什么都没有填写,所以点击取消按钮退出吧。",placement:"top",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!0,hideFooter:!0},{target:'[data-tour="sidebar-model-management"]',content:'配置好模型提供商后,接下来我们需要为麦麦添加模型并分配功能。点击"下一步"进入模型管理页面。',placement:"right",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="add-model-button"]',content:'在为麦麦的组件分配模型之前,首先需要添加你想要分配的模型,点击"添加模型"按钮开始添加。',placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!0,hideFooter:!0},{target:'[data-tour="model-dialog"]',content:"在这里,你可以选择你之前配置好的模型提供商,然后选择对应的模型来添加。",placement:"left",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="model-name-input"]',content:"这里的模型名称是你为这个模型起的一个名字,方便你在后续使用时识别它。",placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="model-provider-select"]',content:"在这里选择你之前配置好的模型提供商,这样系统才能知道你要添加哪个提供商的模型。",placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="model-identifier-input"]',content:"这里需要填写你想要添加的模型的标识符,不同的模型提供商可能有不同的标识符格式,请参考对应提供商的文档。",placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="model-save-button"]',content:"填写完所有信息后,点击保存按钮,模型就添加完成了。",placement:"top",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="model-cancel-button"]',content:"当然,因为这次咱们什么都没有填写,所以直接点击取消按钮退出吧,等你准备好了再来添加模型。",placement:"top",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!0,hideFooter:!0},{target:'[data-tour="tasks-tab-trigger"]',content:'最后一步,添加好模型后,切换到"为模型分配功能"标签页,为麦麦的各个组件分配合适的模型。',placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!0,hideFooter:!0},{target:'[data-tour="task-model-select"]',content:"在这里,你可以为每个组件选择一个或多个合适的模型,选择完成后配置会自动保存。恭喜你完成了模型配置的学习!",placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1}],xQ={0:"/config/model",1:"/config/model",2:"/config/modelProvider",3:"/config/modelProvider",4:"/config/modelProvider",5:"/config/modelProvider",6:"/config/modelProvider",7:"/config/modelProvider",8:"/config/modelProvider",9:"/config/modelProvider",10:"/config/modelProvider",11:"/config/model",12:"/config/model",13:"/config/model",14:"/config/model",15:"/config/model",16:"/config/model",17:"/config/model",18:"/config/model",19:"/config/model"},d0=[{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 JA(t){return t?t.replace(/\/+$/,"").toLowerCase():""}function Kxe(t){if(!t)return null;const e=JA(t);return d0.find(n=>n.id!=="custom"&&JA(n.base_url)===e)||null}function Zxe(){const[t,e]=b.useState([]),[n,r]=b.useState(!0),[s,i]=b.useState(!1),[a,l]=b.useState(!1),[c,d]=b.useState(!1),[h,m]=b.useState(!1),[g,x]=b.useState(!1),[y,w]=b.useState(!1),[S,k]=b.useState(null),[j,N]=b.useState(null),[T,E]=b.useState("custom"),[_,A]=b.useState(!1),[L,P]=b.useState(!1),[B,$]=b.useState(null),[U,te]=b.useState(!1),[z,Q]=b.useState(""),[F,Y]=b.useState(new Set),[J,X]=b.useState(!1),[R,ie]=b.useState(1),[G,I]=b.useState(20),[V,ee]=b.useState(""),{toast:ne}=as(),W=Zi(),{state:se,goToStep:re,registerTour:oe}=Y6(),Te=b.useRef(null),We=b.useRef(!0);b.useEffect(()=>{oe(_l,gQ)},[oe]),b.useEffect(()=>{if(se.activeTourId===_l&&se.isRunning){const ke=xQ[se.stepIndex];ke&&!window.location.pathname.endsWith(ke.replace("/config/",""))&&W({to:ke})}},[se.stepIndex,se.activeTourId,se.isRunning,W]);const Ye=b.useRef(se.stepIndex);b.useEffect(()=>{if(se.activeTourId===_l&&se.isRunning){const ke=Ye.current,Pe=se.stepIndex;ke>=3&&ke<=9&&Pe<3&&w(!1),Ye.current=Pe}},[se.stepIndex,se.activeTourId,se.isRunning]),b.useEffect(()=>{if(se.activeTourId!==_l||!se.isRunning)return;const ke=Pe=>{const it=Pe.target,ot=se.stepIndex;ot===2&&it.closest('[data-tour="add-provider-button"]')?setTimeout(()=>re(3),300):ot===9&&it.closest('[data-tour="provider-cancel-button"]')&&setTimeout(()=>re(10),300)};return document.addEventListener("click",ke,!0),()=>document.removeEventListener("click",ke,!0)},[se,re]),b.useEffect(()=>{Je()},[]);const Je=async()=>{try{r(!0);const ke=await Rh();e(ke.api_providers||[]),d(!1),We.current=!1}catch(ke){console.error("加载配置失败:",ke)}finally{r(!1)}},Oe=async()=>{try{m(!0),ib().catch(()=>{}),x(!0)}catch(ke){console.error("重启失败:",ke),x(!1),ne({title:"重启失败",description:"无法发送重启请求,请手动重启",variant:"destructive"}),m(!1)}},Ve=async()=>{try{i(!0),Te.current&&clearTimeout(Te.current);const ke=await Rh();ke.api_providers=t,await qv(ke),d(!1),ne({title:"保存成功",description:"正在重启麦麦..."}),await Oe()}catch(ke){console.error("保存配置失败:",ke),ne({title:"保存失败",description:ke.message,variant:"destructive"}),i(!1)}},Ue=()=>{localStorage.removeItem("access-token"),window.location.href="/auth"},He=()=>{x(!1),m(!1),ne({title:"重启超时",description:"服务未能在预期时间内恢复,请手动检查或刷新页面",variant:"destructive"})},Ot=b.useCallback(async ke=>{if(!We.current)try{l(!0),await xk("api_providers",ke),d(!1)}catch(Pe){console.error("自动保存失败:",Pe),d(!0)}finally{l(!1)}},[]);b.useEffect(()=>{if(!We.current)return d(!0),Te.current&&clearTimeout(Te.current),Te.current=setTimeout(()=>{Ot(t)},2e3),()=>{Te.current&&clearTimeout(Te.current)}},[t,Ot]);const xt=async()=>{try{i(!0),Te.current&&clearTimeout(Te.current);const ke=await Rh();ke.api_providers=t,await qv(ke),d(!1),ne({title:"保存成功",description:"模型提供商配置已保存"})}catch(ke){console.error("保存配置失败:",ke),ne({title:"保存失败",description:ke.message,variant:"destructive"})}finally{i(!1)}},kn=(ke,Pe)=>{if(ke){const it=d0.find(ot=>ot.base_url===ke.base_url&&ot.client_type===ke.client_type);E(it?.id||"custom"),k(ke)}else E("custom"),k({name:"",base_url:"",api_key:"",client_type:"openai",max_retry:2,timeout:30,retry_interval:10});N(Pe),te(!1),w(!0)},It=ke=>{E(ke),A(!1);const Pe=d0.find(it=>it.id===ke);Pe&&Pe.id!=="custom"?k(it=>({...it,name:Pe.name,base_url:Pe.base_url,client_type:Pe.client_type})):Pe?.id==="custom"&&k(it=>({...it,name:"",base_url:"",client_type:"openai"}))},Yt=b.useMemo(()=>T!=="custom",[T]),_t=async()=>{if(S?.api_key)try{await navigator.clipboard.writeText(S.api_key),ne({title:"复制成功",description:"API Key 已复制到剪贴板"})}catch{ne({title:"复制失败",description:"无法访问剪贴板",variant:"destructive"})}},mt=()=>{if(!S)return;const ke={...S,max_retry:S.max_retry??2,timeout:S.timeout??30,retry_interval:S.retry_interval??10};if(j!==null){const Pe=[...t];Pe[j]=ke,e(Pe)}else e([...t,ke]);w(!1),k(null),N(null)},Ne=ke=>{if(!ke&&S){const Pe={...S,max_retry:S.max_retry??2,timeout:S.timeout??30,retry_interval:S.retry_interval??10};k(Pe)}w(ke)},Ie=ke=>{$(ke),P(!0)},st=()=>{if(B!==null){const ke=t.filter((Pe,it)=>it!==B);e(ke),ne({title:"删除成功",description:"提供商已从列表中移除"})}P(!1),$(null)},yt=ke=>{const Pe=new Set(F);Pe.has(ke)?Pe.delete(ke):Pe.add(ke),Y(Pe)},Pt=()=>{if(F.size===Fe.length)Y(new Set);else{const ke=Fe.map((Pe,it)=>t.findIndex(ot=>ot===Fe[it]));Y(new Set(ke))}},Mt=()=>{if(F.size===0){ne({title:"提示",description:"请先选择要删除的提供商",variant:"default"});return}X(!0)},zn=()=>{const ke=t.filter((Pe,it)=>!F.has(it));e(ke),Y(new Set),X(!1),ne({title:"批量删除成功",description:`已删除 ${F.size} 个提供商`})},Fe=t.filter(ke=>{if(!z)return!0;const Pe=z.toLowerCase();return ke.name.toLowerCase().includes(Pe)||ke.base_url.toLowerCase().includes(Pe)||ke.client_type.toLowerCase().includes(Pe)}),rt=Math.ceil(Fe.length/G),tn=Fe.slice((R-1)*G,R*G),Rt=()=>{const ke=parseInt(V);ke>=1&&ke<=rt&&(ie(ke),ee(""))};return n?o.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:o.jsx("div",{className:"flex items-center justify-center h-64",children:o.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})}):o.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"AI模型厂商配置"}),o.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理 AI 模型厂商的 API 配置"})]}),o.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[F.size>0&&o.jsxs(de,{onClick:Mt,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[o.jsx(Sn,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"批量删除 (",F.size,")"]}),o.jsxs(de,{onClick:()=>kn(null,null),size:"sm",className:"w-full sm:w-auto","data-tour":"add-provider-button",children:[o.jsx(Ls,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"添加提供商"]}),o.jsxs(de,{onClick:xt,disabled:s||a||!c||h,size:"sm",variant:"outline",className:"w-full sm:w-auto sm:min-w-[120px]",children:[o.jsx(Gy,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),s?"保存中...":a?"自动保存中...":c?"保存配置":"已保存"]}),o.jsxs(Dn,{children:[o.jsx(rs,{asChild:!0,children:o.jsxs(de,{disabled:s||a||h,size:"sm",className:"w-full sm:w-auto sm:min-w-[120px]",children:[o.jsx(Aj,{className:"mr-2 h-4 w-4"}),h?"重启中...":c?"保存并重启":"重启麦麦"]})}),o.jsxs(Nn,{children:[o.jsxs(Cn,{children:[o.jsx(En,{children:"确认重启麦麦?"}),o.jsx(_n,{className:"space-y-3",asChild:!0,children:o.jsxs("div",{children:[o.jsx("p",{children:c?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"}),o.jsxs(ga,{className:"border-yellow-500/50 bg-yellow-500/10",children:[o.jsx(Oa,{className:"h-4 w-4 text-yellow-600"}),o.jsxs(xa,{className:"text-yellow-900 dark:text-yellow-100",children:[o.jsx("strong",{children:"重要提示:"}),"由于技术原因,使用重启功能后,将无法再使用 ",o.jsx("code",{className:"px-1 py-0.5 bg-yellow-200 dark:bg-yellow-900 rounded",children:"Ctrl+C"})," 结束程序。",o.jsxs(Dr,{children:[o.jsx(Of,{asChild:!0,children:o.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:[o.jsx(Wy,{className:"h-3 w-3"}),"如何结束程序?"]})}),o.jsxs(Sr,{className:"max-w-2xl",children:[o.jsxs(kr,{children:[o.jsx(Or,{children:"如何结束使用重启功能后的麦麦程序"}),o.jsx(ss,{children:"由于重启功能会使程序脱离终端控制,需要通过系统命令来结束进程"})]}),o.jsxs(ja,{defaultValue:"windows",className:"w-full",children:[o.jsxs(Wi,{className:"grid w-full grid-cols-3",children:[o.jsx(Lt,{value:"windows",children:"Windows"}),o.jsx(Lt,{value:"macos",children:"macOS"}),o.jsx(Lt,{value:"linux",children:"Linux"})]}),o.jsxs(un,{value:"windows",className:"space-y-4 mt-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"font-semibold",children:"方法一:使用任务管理器"}),o.jsxs("ol",{className:"list-decimal list-inside space-y-1 text-sm text-muted-foreground",children:[o.jsxs("li",{children:["按 ",o.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"Ctrl + Shift + Esc"})," 打开任务管理器"]}),o.jsxs("li",{children:["在“进程”或“详细信息”标签页中找到 ",o.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"python.exe"})]}),o.jsx("li",{children:"右键点击并选择“结束任务”"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"font-semibold",children:"方法二:使用命令行"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"打开 PowerShell 或命令提示符,执行以下命令:"}),o.jsxs("div",{className:"bg-muted p-3 rounded-md font-mono text-sm",children:[o.jsx("p",{children:"# 查找麦麦进程"}),o.jsx("p",{children:'Get-Process python | Where-Object {$_.MainWindowTitle -eq ""}'}),o.jsx("p",{className:"mt-2",children:"# 结束所有 Python 进程(谨慎使用)"}),o.jsx("p",{children:"Stop-Process -Name python -Force"})]})]})]}),o.jsxs(un,{value:"macos",className:"space-y-4 mt-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"font-semibold",children:"方法一:使用活动监视器"}),o.jsxs("ol",{className:"list-decimal list-inside space-y-1 text-sm text-muted-foreground",children:[o.jsxs("li",{children:["按 ",o.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"Cmd + Space"})," 打开 Spotlight搜索“活动监视器”"]}),o.jsxs("li",{children:["在进程列表中找到 ",o.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"Python"})]}),o.jsx("li",{children:"选中后点击左上角的 X 按钮结束进程"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"font-semibold",children:"方法二:使用终端"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"打开终端,执行以下命令:"}),o.jsxs("div",{className:"bg-muted p-3 rounded-md font-mono text-sm",children:[o.jsx("p",{children:"# 查找麦麦进程"}),o.jsx("p",{children:"ps aux | grep python | grep -v grep"}),o.jsx("p",{className:"mt-2",children:"# 结束指定 PID 的进程"}),o.jsx("p",{children:"kill -9 <PID>"}),o.jsx("p",{className:"mt-2",children:"# 或结束所有 Python 进程(谨慎使用)"}),o.jsx("p",{children:"pkill -9 python"})]})]})]}),o.jsxs(un,{value:"linux",className:"space-y-4 mt-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"font-semibold",children:"使用终端命令"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"打开终端,执行以下命令:"}),o.jsxs("div",{className:"bg-muted p-3 rounded-md font-mono text-sm",children:[o.jsx("p",{children:"# 查找麦麦进程"}),o.jsx("p",{children:"ps aux | grep python | grep -v grep"}),o.jsx("p",{className:"mt-2",children:"# 结束指定 PID 的进程"}),o.jsx("p",{children:"kill -9 <PID>"}),o.jsx("p",{className:"mt-2",children:"# 或使用 pkill 按名称结束"}),o.jsx("p",{children:'pkill -9 -f "bot.py"'}),o.jsx("p",{className:"mt-2",children:"# 或结束所有 Python 进程(谨慎使用)"}),o.jsx("p",{children:"pkill -9 python"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"font-semibold",children:"使用 htop如已安装"}),o.jsxs("ol",{className:"list-decimal list-inside space-y-1 text-sm text-muted-foreground",children:[o.jsxs("li",{children:["在终端输入 ",o.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"htop"})]}),o.jsxs("li",{children:["按 ",o.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"F3"})," 搜索 python"]}),o.jsxs("li",{children:["按 ",o.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"F9"})," 发送信号,选择 SIGKILL"]})]})]})]})]}),o.jsx(ws,{children:o.jsx(Gj,{asChild:!0,children:o.jsx(de,{variant:"outline",children:"关闭"})})})]})]})]})]})]})})]}),o.jsxs(Tn,{children:[o.jsx(Mn,{children:"取消"}),o.jsx(An,{onClick:c?Ve:Oe,children:c?"保存并重启":"确认重启"})]})]})]})]})]}),o.jsxs(ga,{children:[o.jsx(Oa,{className:"h-4 w-4"}),o.jsxs(xa,{children:["配置更新后需要",o.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),o.jsxs(gn,{className:"h-[calc(100vh-260px)]",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-2 mb-4",children:[o.jsxs("div",{className:"relative w-full sm:flex-1 sm:max-w-sm",children:[o.jsx(Ni,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),o.jsx(ze,{placeholder:"搜索提供商名称、URL 或类型...",value:z,onChange:ke=>Q(ke.target.value),className:"pl-9"})]}),z&&o.jsxs("p",{className:"text-sm text-muted-foreground whitespace-nowrap",children:["找到 ",Fe.length," 个结果"]})]}),o.jsx("div",{className:"md:hidden space-y-3",children:Fe.length===0?o.jsx("div",{className:"text-center text-muted-foreground py-8 rounded-lg border bg-card",children:z?"未找到匹配的提供商":'暂无提供商配置,点击"添加提供商"开始配置'}):tn.map((ke,Pe)=>{const it=t.findIndex(ot=>ot===ke);return o.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[o.jsxs("div",{className:"flex items-start justify-between gap-2",children:[o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("h3",{className:"font-semibold text-base truncate",children:ke.name}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1 break-all",children:ke.base_url})]}),o.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[o.jsxs(de,{variant:"default",size:"sm",onClick:()=>kn(ke,it),children:[o.jsx(Yu,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),o.jsxs(de,{size:"sm",onClick:()=>Ie(it),className:"bg-red-600 hover:bg-red-700 text-white",children:[o.jsx(Sn,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground text-xs",children:"客户端类型"}),o.jsx("p",{className:"font-medium",children:ke.client_type})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground text-xs",children:"最大重试"}),o.jsx("p",{className:"font-medium",children:ke.max_retry})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground text-xs",children:"超时(秒)"}),o.jsx("p",{className:"font-medium",children:ke.timeout})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground text-xs",children:"重试间隔(秒)"}),o.jsx("p",{className:"font-medium",children:ke.retry_interval})]})]})]},Pe)})}),o.jsx("div",{className:"hidden md:block rounded-lg border bg-card overflow-hidden",children:o.jsx("div",{className:"overflow-x-auto",children:o.jsxs(_f,{children:[o.jsx(Af,{children:o.jsxs(Is,{children:[o.jsx(pn,{className:"w-12",children:o.jsx(Oi,{checked:F.size===Fe.length&&Fe.length>0,onCheckedChange:Pt})}),o.jsx(pn,{children:"名称"}),o.jsx(pn,{children:"基础URL"}),o.jsx(pn,{children:"客户端类型"}),o.jsx(pn,{className:"text-right",children:"最大重试"}),o.jsx(pn,{className:"text-right",children:"超时(秒)"}),o.jsx(pn,{className:"text-right",children:"重试间隔(秒)"}),o.jsx(pn,{className:"text-right",children:"操作"})]})}),o.jsx(Mf,{children:tn.length===0?o.jsx(Is,{children:o.jsx(Gt,{colSpan:8,className:"text-center text-muted-foreground py-8",children:z?"未找到匹配的提供商":'暂无提供商配置,点击"添加提供商"开始配置'})}):tn.map((ke,Pe)=>{const it=t.findIndex(ot=>ot===ke);return o.jsxs(Is,{children:[o.jsx(Gt,{children:o.jsx(Oi,{checked:F.has(it),onCheckedChange:()=>yt(it)})}),o.jsx(Gt,{className:"font-medium",children:ke.name}),o.jsx(Gt,{className:"max-w-xs truncate",title:ke.base_url,children:ke.base_url}),o.jsx(Gt,{children:ke.client_type}),o.jsx(Gt,{className:"text-right",children:ke.max_retry}),o.jsx(Gt,{className:"text-right",children:ke.timeout}),o.jsx(Gt,{className:"text-right",children:ke.retry_interval}),o.jsx(Gt,{className:"text-right",children:o.jsxs("div",{className:"flex justify-end gap-2",children:[o.jsxs(de,{variant:"default",size:"sm",onClick:()=>kn(ke,it),children:[o.jsx(Yu,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),o.jsxs(de,{size:"sm",onClick:()=>Ie(it),className:"bg-red-600 hover:bg-red-700 text-white",children:[o.jsx(Sn,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})})]},Pe)})})]})})}),Fe.length>0&&o.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(he,{htmlFor:"page-size-provider",className:"text-sm whitespace-nowrap",children:"每页显示"}),o.jsxs(Vt,{value:G.toString(),onValueChange:ke=>{I(parseInt(ke)),ie(1),Y(new Set)},children:[o.jsx($t,{id:"page-size-provider",className:"w-20",children:o.jsx(Ut,{})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"10",children:"10"}),o.jsx(De,{value:"20",children:"20"}),o.jsx(De,{value:"50",children:"50"}),o.jsx(De,{value:"100",children:"100"})]})]}),o.jsxs("span",{className:"text-sm text-muted-foreground",children:["显示 ",(R-1)*G+1," 到"," ",Math.min(R*G,Fe.length)," 条,共 ",Fe.length," 条"]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(de,{variant:"outline",size:"sm",onClick:()=>ie(1),disabled:R===1,className:"hidden sm:flex",children:o.jsx(Ap,{className:"h-4 w-4"})}),o.jsxs(de,{variant:"outline",size:"sm",onClick:()=>ie(ke=>Math.max(1,ke-1)),disabled:R===1,children:[o.jsx(vd,{className:"h-4 w-4 sm:mr-1"}),o.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(ze,{type:"number",value:V,onChange:ke=>ee(ke.target.value),onKeyDown:ke=>ke.key==="Enter"&&Rt(),placeholder:R.toString(),className:"w-16 h-8 text-center",min:1,max:rt}),o.jsx(de,{variant:"outline",size:"sm",onClick:Rt,disabled:!V,className:"h-8",children:"跳转"})]}),o.jsxs(de,{variant:"outline",size:"sm",onClick:()=>ie(ke=>ke+1),disabled:R>=rt,children:[o.jsx("span",{className:"hidden sm:inline",children:"下一页"}),o.jsx(yd,{className:"h-4 w-4 sm:ml-1"})]}),o.jsx(de,{variant:"outline",size:"sm",onClick:()=>ie(rt),disabled:R>=rt,className:"hidden sm:flex",children:o.jsx(Mp,{className:"h-4 w-4"})})]})]})]}),o.jsx(Dr,{open:y,onOpenChange:Ne,children:o.jsxs(Sr,{className:"max-w-[95vw] sm:max-w-2xl max-h-[90vh] overflow-y-auto","data-tour":"provider-dialog",preventOutsideClose:se.isRunning,children:[o.jsxs(kr,{children:[o.jsx(Or,{children:j!==null?"编辑提供商":"添加提供商"}),o.jsx(ss,{children:"配置 API 提供商的连接信息和参数"})]}),o.jsxs("form",{onSubmit:ke=>{ke.preventDefault(),mt()},autoComplete:"off",children:[o.jsxs("div",{className:"grid gap-4 py-4",children:[o.jsxs("div",{className:"grid gap-2","data-tour":"provider-template-select",children:[o.jsx(he,{htmlFor:"template",children:"提供商模板"}),o.jsxs(zo,{open:_,onOpenChange:A,children:[o.jsx(Io,{asChild:!0,children:o.jsxs(de,{variant:"outline",role:"combobox","aria-expanded":_,className:"w-full justify-between",children:[T?d0.find(ke=>ke.id===T)?.display_name:"选择提供商模板...",o.jsx(Mj,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),o.jsx(Xa,{className:"p-0",align:"start",style:{width:"var(--radix-popover-trigger-width)"},children:o.jsxs(Ob,{children:[o.jsx(jb,{placeholder:"搜索提供商模板..."}),o.jsx(gn,{className:"h-[300px]",children:o.jsxs(Nb,{className:"max-h-none overflow-visible",children:[o.jsx(Cb,{children:"未找到匹配的模板"}),o.jsx(ap,{children:d0.map(ke=>o.jsxs(op,{value:ke.display_name,onSelect:()=>It(ke.id),children:[o.jsx(Ro,{className:`mr-2 h-4 w-4 ${T===ke.id?"opacity-100":"opacity-0"}`}),ke.display_name]},ke.id))})]})})]})})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"选择预设模板可自动填充 URL 和客户端类型,支持搜索"})]}),o.jsxs("div",{className:"grid gap-2","data-tour":"provider-name-input",children:[o.jsx(he,{htmlFor:"name",children:"名称 *"}),o.jsx(ze,{id:"name",value:S?.name||"",onChange:ke=>k(Pe=>Pe?{...Pe,name:ke.target.value}:null),placeholder:"例如: DeepSeek, SiliconFlow"})]}),o.jsxs("div",{className:"grid gap-2","data-tour":"provider-url-input",children:[o.jsx(he,{htmlFor:"base_url",children:"基础 URL *"}),o.jsx(ze,{id:"base_url",value:S?.base_url||"",onChange:ke=>k(Pe=>Pe?{...Pe,base_url:ke.target.value}:null),placeholder:"https://api.example.com/v1",disabled:Yt,className:Yt?"bg-muted cursor-not-allowed":""}),Yt&&o.jsx("p",{className:"text-xs text-muted-foreground",children:'使用模板时 URL 不可编辑,切换到"自定义"以手动配置'})]}),o.jsxs("div",{className:"grid gap-2","data-tour":"provider-apikey-input",children:[o.jsx(he,{htmlFor:"api_key",children:"API Key *"}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(ze,{id:"api_key",type:U?"text":"password",value:S?.api_key||"",onChange:ke=>k(Pe=>Pe?{...Pe,api_key:ke.target.value}:null),placeholder:"sk-...",className:"flex-1"}),o.jsx(de,{type:"button",variant:"outline",size:"icon",onClick:()=>te(!U),title:U?"隐藏密钥":"显示密钥",children:U?o.jsx(Rv,{className:"h-4 w-4"}):o.jsx(Ea,{className:"h-4 w-4"})}),o.jsx(de,{type:"button",variant:"outline",size:"icon",onClick:_t,title:"复制密钥",children:o.jsx(Mv,{className:"h-4 w-4"})})]})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"client_type",children:"客户端类型"}),o.jsxs(Vt,{value:S?.client_type||"openai",onValueChange:ke=>k(Pe=>Pe?{...Pe,client_type:ke}:null),disabled:Yt,children:[o.jsx($t,{id:"client_type",className:Yt?"bg-muted cursor-not-allowed":"",children:o.jsx(Ut,{placeholder:"选择客户端类型"})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"openai",children:"OpenAI"}),o.jsx(De,{value:"gemini",children:"Gemini"})]})]}),Yt&&o.jsx("p",{className:"text-xs text-muted-foreground",children:'使用模板时客户端类型不可编辑,切换到"自定义"以手动配置'})]}),o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"max_retry",children:"最大重试"}),o.jsx(ze,{id:"max_retry",type:"number",min:"0",value:S?.max_retry??"",onChange:ke=>{const Pe=ke.target.value===""?null:parseInt(ke.target.value);k(it=>it?{...it,max_retry:Pe}:null)},placeholder:"默认: 2"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"timeout",children:"超时(秒)"}),o.jsx(ze,{id:"timeout",type:"number",min:"1",value:S?.timeout??"",onChange:ke=>{const Pe=ke.target.value===""?null:parseInt(ke.target.value);k(it=>it?{...it,timeout:Pe}:null)},placeholder:"默认: 30"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"retry_interval",children:"重试间隔(秒)"}),o.jsx(ze,{id:"retry_interval",type:"number",min:"1",value:S?.retry_interval??"",onChange:ke=>{const Pe=ke.target.value===""?null:parseInt(ke.target.value);k(it=>it?{...it,retry_interval:Pe}:null)},placeholder:"默认: 10"})]})]})]}),o.jsxs(ws,{children:[o.jsx(de,{type:"button",variant:"outline",onClick:()=>w(!1),"data-tour":"provider-cancel-button",children:"取消"}),o.jsx(de,{type:"submit","data-tour":"provider-save-button",children:"保存"})]})]})]})}),o.jsx(Dn,{open:L,onOpenChange:P,children:o.jsxs(Nn,{children:[o.jsxs(Cn,{children:[o.jsx(En,{children:"确认删除"}),o.jsxs(_n,{children:['确定要删除提供商 "',B!==null?t[B]?.name:"",'" 吗? 此操作无法撤销。']})]}),o.jsxs(Tn,{children:[o.jsx(Mn,{children:"取消"}),o.jsx(An,{onClick:st,children:"删除"})]})]})}),o.jsx(Dn,{open:J,onOpenChange:X,children:o.jsxs(Nn,{children:[o.jsxs(Cn,{children:[o.jsx(En,{children:"确认批量删除"}),o.jsxs(_n,{children:["确定要删除选中的 ",F.size," 个提供商吗? 此操作无法撤销。"]})]}),o.jsxs(Tn,{children:[o.jsx(Mn,{children:"取消"}),o.jsx(An,{onClick:zn,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})}),g&&o.jsx(Kj,{onRestartComplete:Ue,onRestartFailed:He})]})}function Jxe(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return b.useMemo(()=>r=>{e.forEach(s=>s(r))},e)}const Ab=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function zf(t){const e=Object.prototype.toString.call(t);return e==="[object Window]"||e==="[object global]"}function K6(t){return"nodeType"in t}function Ti(t){var e,n;return t?zf(t)?t:K6(t)&&(e=(n=t.ownerDocument)==null?void 0:n.defaultView)!=null?e:window:window}function Z6(t){const{Document:e}=Ti(t);return t instanceof e}function og(t){return zf(t)?!1:t instanceof Ti(t).HTMLElement}function vQ(t){return t instanceof Ti(t).SVGElement}function If(t){return t?zf(t)?t.document:K6(t)?Z6(t)?t:og(t)||vQ(t)?t.ownerDocument:document:document:document}const Bo=Ab?b.useLayoutEffect:b.useEffect;function J6(t){const e=b.useRef(t);return Bo(()=>{e.current=t}),b.useCallback(function(){for(var n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];return e.current==null?void 0:e.current(...r)},[])}function e1e(){const t=b.useRef(null),e=b.useCallback((r,s)=>{t.current=setInterval(r,s)},[]),n=b.useCallback(()=>{t.current!==null&&(clearInterval(t.current),t.current=null)},[]);return[e,n]}function up(t,e){e===void 0&&(e=[t]);const n=b.useRef(t);return Bo(()=>{n.current!==t&&(n.current=t)},e),n}function lg(t,e){const n=b.useRef();return b.useMemo(()=>{const r=t(n.current);return n.current=r,r},[...e])}function my(t){const e=J6(t),n=b.useRef(null),r=b.useCallback(s=>{s!==n.current&&e?.(s,n.current),n.current=s},[]);return[n,r]}function kO(t){const e=b.useRef();return b.useEffect(()=>{e.current=t},[t]),e.current}let kS={};function cg(t,e){return b.useMemo(()=>{if(e)return e;const n=kS[t]==null?0:kS[t]+1;return kS[t]=n,t+"-"+n},[t,e])}function yQ(t){return function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];return r.reduce((i,a)=>{const l=Object.entries(a);for(const[c,d]of l){const h=i[c];h!=null&&(i[c]=h+t*d)}return i},{...e})}}const Fh=yQ(1),dp=yQ(-1);function t1e(t){return"clientX"in t&&"clientY"in t}function eN(t){if(!t)return!1;const{KeyboardEvent:e}=Ti(t.target);return e&&t instanceof e}function n1e(t){if(!t)return!1;const{TouchEvent:e}=Ti(t.target);return e&&t instanceof e}function OO(t){if(n1e(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 t1e(t)?{x:t.clientX,y:t.clientY}:null}const hp=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[hp.Translate.toString(t),hp.Scale.toString(t)].join(" ")}},Transition:{toString(t){let{property:e,duration:n,easing:r}=t;return e+" "+n+"ms "+r}}}),eM="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function r1e(t){return t.matches(eM)?t:t.querySelector(eM)}const s1e={display:"none"};function i1e(t){let{id:e,value:n}=t;return ae.createElement("div",{id:e,style:s1e},n)}function a1e(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 ae.createElement("div",{id:e,style:s,role:"status","aria-live":r,"aria-atomic":!0},n)}function o1e(){const[t,e]=b.useState("");return{announce:b.useCallback(r=>{r!=null&&e(r)},[]),announcement:t}}const bQ=b.createContext(null);function l1e(t){const e=b.useContext(bQ);b.useEffect(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of <DndContext>");return e(t)},[t,e])}function c1e(){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 l;return(l=a[s])==null?void 0:l.call(a,i)})},[t]),e]}const u1e={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.
`},d1e={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 h1e(t){let{announcements:e=d1e,container:n,hiddenTextDescribedById:r,screenReaderInstructions:s=u1e}=t;const{announce:i,announcement:a}=o1e(),l=cg("DndLiveRegion"),[c,d]=b.useState(!1);if(b.useEffect(()=>{d(!0)},[]),l1e(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 h=ae.createElement(ae.Fragment,null,ae.createElement(i1e,{id:r,value:s.draggable}),ae.createElement(a1e,{id:l,announcement:a}));return n?pa.createPortal(h,n):h}var ds;(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"})(ds||(ds={}));function py(){}function tM(t,e){return b.useMemo(()=>({sensor:t,options:e??{}}),[t,e])}function f1e(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return b.useMemo(()=>[...e].filter(r=>r!=null),[...e])}const Za=Object.freeze({x:0,y:0});function wQ(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function SQ(t,e){let{data:{value:n}}=t,{data:{value:r}}=e;return n-r}function m1e(t,e){let{data:{value:n}}=t,{data:{value:r}}=e;return r-n}function nM(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 kQ(t,e){if(!t||t.length===0)return null;const[n]=t;return n[e]}function rM(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 p1e=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:r}=t;const s=rM(e,e.left,e.top),i=[];for(const a of r){const{id:l}=a,c=n.get(l);if(c){const d=wQ(rM(c),s);i.push({id:l,data:{droppableContainer:a,value:d}})}}return i.sort(SQ)},g1e=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:r}=t;const s=nM(e),i=[];for(const a of r){const{id:l}=a,c=n.get(l);if(c){const d=nM(c),h=s.reduce((g,x,y)=>g+wQ(d[y],x),0),m=Number((h/4).toFixed(4));i.push({id:l,data:{droppableContainer:a,value:m}})}}return i.sort(SQ)};function x1e(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,l=i-n;if(r<s&&n<i){const c=e.width*e.height,d=t.width*t.height,h=a*l,m=h/(c+d-h);return Number(m.toFixed(4))}return 0}const v1e=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:r}=t;const s=[];for(const i of r){const{id:a}=i,l=n.get(a);if(l){const c=x1e(l,e);c>0&&s.push({id:a,data:{droppableContainer:i,value:c}})}}return s.sort(m1e)};function y1e(t,e,n){return{...t,scaleX:e&&n?e.width/n.width:1,scaleY:e&&n?e.height/n.height:1}}function OQ(t,e){return t&&e?{x:t.left-e.left,y:t.top-e.top}:Za}function b1e(t){return function(n){for(var r=arguments.length,s=new Array(r>1?r-1:0),i=1;i<r;i++)s[i-1]=arguments[i];return s.reduce((a,l)=>({...a,top:a.top+t*l.y,bottom:a.bottom+t*l.y,left:a.left+t*l.x,right:a.right+t*l.x}),{...n})}}const w1e=b1e(1);function S1e(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 k1e(t,e,n){const r=S1e(e);if(!r)return t;const{scaleX:s,scaleY:i,x:a,y:l}=r,c=t.left-a-(1-s)*parseFloat(n),d=t.top-l-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),h=s?t.width/s:t.width,m=i?t.height/i:t.height;return{width:h,height:m,top:d,right:c+h,bottom:d+m,left:c}}const O1e={ignoreTransform:!1};function Lf(t,e){e===void 0&&(e=O1e);let n=t.getBoundingClientRect();if(e.ignoreTransform){const{transform:d,transformOrigin:h}=Ti(t).getComputedStyle(t);d&&(n=k1e(n,d,h))}const{top:r,left:s,width:i,height:a,bottom:l,right:c}=n;return{top:r,left:s,width:i,height:a,bottom:l,right:c}}function sM(t){return Lf(t,{ignoreTransform:!0})}function j1e(t){const e=t.innerWidth,n=t.innerHeight;return{top:0,left:0,right:e,bottom:n,width:e,height:n}}function N1e(t,e){return e===void 0&&(e=Ti(t).getComputedStyle(t)),e.position==="fixed"}function C1e(t,e){e===void 0&&(e=Ti(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 Mb(t,e){const n=[];function r(s){if(e!=null&&n.length>=e||!s)return n;if(Z6(s)&&s.scrollingElement!=null&&!n.includes(s.scrollingElement))return n.push(s.scrollingElement),n;if(!og(s)||vQ(s)||n.includes(s))return n;const i=Ti(t).getComputedStyle(s);return s!==t&&C1e(s,i)&&n.push(s),N1e(s,i)?n:r(s.parentNode)}return t?r(t):n}function jQ(t){const[e]=Mb(t,1);return e??null}function OS(t){return!Ab||!t?null:zf(t)?t:K6(t)?Z6(t)||t===If(t).scrollingElement?window:og(t)?t:null:null}function NQ(t){return zf(t)?t.scrollX:t.scrollLeft}function CQ(t){return zf(t)?t.scrollY:t.scrollTop}function jO(t){return{x:NQ(t),y:CQ(t)}}var ys;(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})(ys||(ys={}));function TQ(t){return!Ab||!t?!1:t===document.scrollingElement}function EQ(t){const e={x:0,y:0},n=TQ(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,l=t.scrollLeft>=r.x;return{isTop:s,isLeft:i,isBottom:a,isRight:l,maxScroll:r,minScroll:e}}const T1e={x:.2,y:.2};function E1e(t,e,n,r,s){let{top:i,left:a,right:l,bottom:c}=n;r===void 0&&(r=10),s===void 0&&(s=T1e);const{isTop:d,isBottom:h,isLeft:m,isRight:g}=EQ(t),x={x:0,y:0},y={x:0,y:0},w={height:e.height*s.y,width:e.width*s.x};return!d&&i<=e.top+w.height?(x.y=ys.Backward,y.y=r*Math.abs((e.top+w.height-i)/w.height)):!h&&c>=e.bottom-w.height&&(x.y=ys.Forward,y.y=r*Math.abs((e.bottom-w.height-c)/w.height)),!g&&l>=e.right-w.width?(x.x=ys.Forward,y.x=r*Math.abs((e.right-w.width-l)/w.width)):!m&&a<=e.left+w.width&&(x.x=ys.Backward,y.x=r*Math.abs((e.left+w.width-a)/w.width)),{direction:x,speed:y}}function _1e(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 _Q(t){return t.reduce((e,n)=>Fh(e,jO(n)),Za)}function A1e(t){return t.reduce((e,n)=>e+NQ(n),0)}function M1e(t){return t.reduce((e,n)=>e+CQ(n),0)}function R1e(t,e){if(e===void 0&&(e=Lf),!t)return;const{top:n,left:r,bottom:s,right:i}=e(t);jQ(t)&&(s<=0||i<=0||n>=window.innerHeight||r>=window.innerWidth)&&t.scrollIntoView({block:"center",inline:"center"})}const D1e=[["x",["left","right"],A1e],["y",["top","bottom"],M1e]];class tN{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=Mb(n),s=_Q(r);this.rect={...e},this.width=e.width,this.height=e.height;for(const[i,a,l]of D1e)for(const c of a)Object.defineProperty(this,c,{get:()=>{const d=l(r),h=s[i]-d;return this.rect[c]+h},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class C0{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 P1e(t){const{EventTarget:e}=Ti(t);return t instanceof e?t:If(t)}function jS(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 da;(function(t){t.Click="click",t.DragStart="dragstart",t.Keydown="keydown",t.ContextMenu="contextmenu",t.Resize="resize",t.SelectionChange="selectionchange",t.VisibilityChange="visibilitychange"})(da||(da={}));function iM(t){t.preventDefault()}function z1e(t){t.stopPropagation()}var bn;(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"})(bn||(bn={}));const AQ={start:[bn.Space,bn.Enter],cancel:[bn.Esc],end:[bn.Space,bn.Enter,bn.Tab]},I1e=(t,e)=>{let{currentCoordinates:n}=e;switch(t.code){case bn.Right:return{...n,x:n.x+25};case bn.Left:return{...n,x:n.x-25};case bn.Down:return{...n,y:n.y+25};case bn.Up:return{...n,y:n.y-25}}};class nN{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 C0(If(n)),this.windowListeners=new C0(Ti(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(da.Resize,this.handleCancel),this.windowListeners.add(da.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(da.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:n}=this.props,r=e.node.current;r&&R1e(r),n(Za)}handleKeyDown(e){if(eN(e)){const{active:n,context:r,options:s}=this.props,{keyboardCodes:i=AQ,coordinateGetter:a=I1e,scrollBehavior:l="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:d}=r.current,h=d?{x:d.left,y:d.top}:Za;this.referenceCoordinates||(this.referenceCoordinates=h);const m=a(e,{active:n,context:r.current,currentCoordinates:h});if(m){const g=dp(m,h),x={x:0,y:0},{scrollableAncestors:y}=r.current;for(const w of y){const S=e.code,{isTop:k,isRight:j,isLeft:N,isBottom:T,maxScroll:E,minScroll:_}=EQ(w),A=_1e(w),L={x:Math.min(S===bn.Right?A.right-A.width/2:A.right,Math.max(S===bn.Right?A.left:A.left+A.width/2,m.x)),y:Math.min(S===bn.Down?A.bottom-A.height/2:A.bottom,Math.max(S===bn.Down?A.top:A.top+A.height/2,m.y))},P=S===bn.Right&&!j||S===bn.Left&&!N,B=S===bn.Down&&!T||S===bn.Up&&!k;if(P&&L.x!==m.x){const $=w.scrollLeft+g.x,U=S===bn.Right&&$<=E.x||S===bn.Left&&$>=_.x;if(U&&!g.y){w.scrollTo({left:$,behavior:l});return}U?x.x=w.scrollLeft-$:x.x=S===bn.Right?w.scrollLeft-E.x:w.scrollLeft-_.x,x.x&&w.scrollBy({left:-x.x,behavior:l});break}else if(B&&L.y!==m.y){const $=w.scrollTop+g.y,U=S===bn.Down&&$<=E.y||S===bn.Up&&$>=_.y;if(U&&!g.x){w.scrollTo({top:$,behavior:l});return}U?x.y=w.scrollTop-$:x.y=S===bn.Down?w.scrollTop-E.y:w.scrollTop-_.y,x.y&&w.scrollBy({top:-x.y,behavior:l});break}}this.handleMove(e,Fh(dp(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()}}nN.activators=[{eventName:"onKeyDown",handler:(t,e,n)=>{let{keyboardCodes:r=AQ,onActivation:s}=e,{active:i}=n;const{code:a}=t.nativeEvent;if(r.start.includes(a)){const l=i.activatorNode.current;return l&&t.target!==l?!1:(t.preventDefault(),s?.({event:t.nativeEvent}),!0)}return!1}}];function aM(t){return!!(t&&"distance"in t)}function oM(t){return!!(t&&"delay"in t)}class rN{constructor(e,n,r){var s;r===void 0&&(r=P1e(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=If(a),this.documentListeners=new C0(this.document),this.listeners=new C0(r),this.windowListeners=new C0(Ti(a)),this.initialCoordinates=(s=OO(i))!=null?s:Za,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(da.Resize,this.handleCancel),this.windowListeners.add(da.DragStart,iM),this.windowListeners.add(da.VisibilityChange,this.handleCancel),this.windowListeners.add(da.ContextMenu,iM),this.documentListeners.add(da.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(oM(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(aM(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(da.Click,z1e,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(da.SelectionChange,this.removeTextSelection),n(e))}handleMove(e){var n;const{activated:r,initialCoordinates:s,props:i}=this,{onMove:a,options:{activationConstraint:l}}=i;if(!s)return;const c=(n=OO(e))!=null?n:Za,d=dp(s,c);if(!r&&l){if(aM(l)){if(l.tolerance!=null&&jS(d,l.tolerance))return this.handleCancel();if(jS(d,l.distance))return this.handleStart()}if(oM(l)&&jS(d,l.tolerance))return this.handleCancel();this.handlePending(l,d);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===bn.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}}const L1e={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class sN extends rN{constructor(e){const{event:n}=e,r=If(n.target);super(e,L1e,r)}}sN.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 B1e={move:{name:"mousemove"},end:{name:"mouseup"}};var NO;(function(t){t[t.RightClick=2]="RightClick"})(NO||(NO={}));class F1e extends rN{constructor(e){super(e,B1e,If(e.event.target))}}F1e.activators=[{eventName:"onMouseDown",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:r}=e;return n.button===NO.RightClick?!1:(r?.({event:n}),!0)}}];const NS={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class q1e extends rN{constructor(e){super(e,NS)}static setup(){return window.addEventListener(NS.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(NS.move.name,e)};function e(){}}}q1e.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 T0;(function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"})(T0||(T0={}));var gy;(function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"})(gy||(gy={}));function $1e(t){let{acceleration:e,activator:n=T0.Pointer,canScroll:r,draggingRect:s,enabled:i,interval:a=5,order:l=gy.TreeOrder,pointerCoordinates:c,scrollableAncestors:d,scrollableAncestorRects:h,delta:m,threshold:g}=t;const x=Q1e({delta:m,disabled:!i}),[y,w]=e1e(),S=b.useRef({x:0,y:0}),k=b.useRef({x:0,y:0}),j=b.useMemo(()=>{switch(n){case T0.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case T0.DraggableRect:return s}},[n,s,c]),N=b.useRef(null),T=b.useCallback(()=>{const _=N.current;if(!_)return;const A=S.current.x*k.current.x,L=S.current.y*k.current.y;_.scrollBy(A,L)},[]),E=b.useMemo(()=>l===gy.TreeOrder?[...d].reverse():d,[l,d]);b.useEffect(()=>{if(!i||!d.length||!j){w();return}for(const _ of E){if(r?.(_)===!1)continue;const A=d.indexOf(_),L=h[A];if(!L)continue;const{direction:P,speed:B}=E1e(_,L,j,e,g);for(const $ of["x","y"])x[$][P[$]]||(B[$]=0,P[$]=0);if(B.x>0||B.y>0){w(),N.current=_,y(T,a),S.current=B,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(j),JSON.stringify(x),y,d,E,h,JSON.stringify(g)])}const H1e={x:{[ys.Backward]:!1,[ys.Forward]:!1},y:{[ys.Backward]:!1,[ys.Forward]:!1}};function Q1e(t){let{delta:e,disabled:n}=t;const r=kO(e);return lg(s=>{if(n||!r||!s)return H1e;const i={x:Math.sign(e.x-r.x),y:Math.sign(e.y-r.y)};return{x:{[ys.Backward]:s.x[ys.Backward]||i.x===-1,[ys.Forward]:s.x[ys.Forward]||i.x===1},y:{[ys.Backward]:s.y[ys.Backward]||i.y===-1,[ys.Forward]:s.y[ys.Forward]||i.y===1}}},[n,e,r])}function V1e(t,e){const n=e!=null?t.get(e):void 0,r=n?n.node.current:null;return lg(s=>{var i;return e==null?null:(i=r??s)!=null?i:null},[r,e])}function U1e(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 fp;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(fp||(fp={}));var CO;(function(t){t.Optimized="optimized"})(CO||(CO={}));const lM=new Map;function W1e(t,e){let{dragging:n,dependencies:r,config:s}=e;const[i,a]=b.useState(null),{frequency:l,measure:c,strategy:d}=s,h=b.useRef(t),m=S(),g=up(m),x=b.useCallback(function(k){k===void 0&&(k=[]),!g.current&&a(j=>j===null?k:j.concat(k.filter(N=>!j.includes(N))))},[g]),y=b.useRef(null),w=lg(k=>{if(m&&!n)return lM;if(!k||k===lM||h.current!==t||i!=null){const j=new Map;for(let N of t){if(!N)continue;if(i&&i.length>0&&!i.includes(N.id)&&N.rect.current){j.set(N.id,N.rect.current);continue}const T=N.node.current,E=T?new tN(c(T),T):null;N.rect.current=E,E&&j.set(N.id,E)}return j}return k},[t,i,n,m,c]);return b.useEffect(()=>{h.current=t},[t]),b.useEffect(()=>{m||x()},[n,m]),b.useEffect(()=>{i&&i.length>0&&a(null)},[JSON.stringify(i)]),b.useEffect(()=>{m||typeof l!="number"||y.current!==null||(y.current=setTimeout(()=>{x(),y.current=null},l))},[l,m,x,...r]),{droppableRects:w,measureDroppableContainers:x,measuringScheduled:i!=null};function S(){switch(d){case fp.Always:return!1;case fp.BeforeDragging:return n;default:return!n}}}function MQ(t,e){return lg(n=>t?n||(typeof e=="function"?e(t):t):null,[e,t])}function G1e(t,e){return MQ(t,e)}function X1e(t){let{callback:e,disabled:n}=t;const r=J6(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 Rb(t){let{callback:e,disabled:n}=t;const r=J6(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 Y1e(t){return new tN(Lf(t),t)}function cM(t,e,n){e===void 0&&(e=Y1e);const[r,s]=b.useState(null);function i(){s(c=>{if(!t)return null;if(t.isConnected===!1){var d;return(d=c??n)!=null?d:null}const h=e(t);return JSON.stringify(c)===JSON.stringify(h)?c:h})}const a=X1e({callback(c){if(t)for(const d of c){const{type:h,target:m}=d;if(h==="childList"&&m instanceof HTMLElement&&m.contains(t)){i();break}}}}),l=Rb({callback:i});return Bo(()=>{i(),t?(l?.observe(t),a?.observe(document.body,{childList:!0,subtree:!0})):(l?.disconnect(),a?.disconnect())},[t]),r}function K1e(t){const e=MQ(t);return OQ(t,e)}const uM=[];function Z1e(t){const e=b.useRef(t),n=lg(r=>t?r&&r!==uM&&t&&e.current&&t.parentNode===e.current.parentNode?r:Mb(t):uM,[t]);return b.useEffect(()=>{e.current=t},[t]),n}function J1e(t){const[e,n]=b.useState(null),r=b.useRef(t),s=b.useCallback(i=>{const a=OS(i.target);a&&n(l=>l?(l.set(a,jO(a)),new Map(l)):null)},[]);return b.useEffect(()=>{const i=r.current;if(t!==i){a(i);const l=t.map(c=>{const d=OS(c);return d?(d.addEventListener("scroll",s,{passive:!0}),[d,jO(d)]):null}).filter(c=>c!=null);n(l.length?new Map(l):null),r.current=t}return()=>{a(t),a(i)};function a(l){l.forEach(c=>{const d=OS(c);d?.removeEventListener("scroll",s)})}},[s,t]),b.useMemo(()=>t.length?e?Array.from(e.values()).reduce((i,a)=>Fh(i,a),Za):_Q(t):Za,[t,e])}function dM(t,e){e===void 0&&(e=[]);const n=b.useRef(null);return b.useEffect(()=>{n.current=null},e),b.useEffect(()=>{const r=t!==Za;r&&!n.current&&(n.current=t),!r&&n.current&&(n.current=null)},[t]),n.current?dp(t,n.current):Za}function eve(t){b.useEffect(()=>{if(!Ab)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 tve(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 RQ(t){return b.useMemo(()=>t?j1e(t):null,[t])}const hM=[];function nve(t,e){e===void 0&&(e=Lf);const[n]=t,r=RQ(n?Ti(n):null),[s,i]=b.useState(hM);function a(){i(()=>t.length?t.map(c=>TQ(c)?r:new tN(e(c),c)):hM)}const l=Rb({callback:a});return Bo(()=>{l?.disconnect(),a(),t.forEach(c=>l?.observe(c))},[t]),s}function rve(t){if(!t)return null;if(t.children.length>1)return t;const e=t.children[0];return og(e)?e:t}function sve(t){let{measure:e}=t;const[n,r]=b.useState(null),s=b.useCallback(d=>{for(const{target:h}of d)if(og(h)){r(m=>{const g=e(h);return m?{...m,width:g.width,height:g.height}:g});break}},[e]),i=Rb({callback:s}),a=b.useCallback(d=>{const h=rve(d);i?.disconnect(),h&&i?.observe(h),r(h?e(h):null)},[e,i]),[l,c]=my(a);return b.useMemo(()=>({nodeRef:l,rect:n,setRef:c}),[n,l,c])}const ive=[{sensor:sN,options:{}},{sensor:nN,options:{}}],ave={current:{}},wv={draggable:{measure:sM},droppable:{measure:sM,strategy:fp.WhileDragging,frequency:CO.Optimized},dragOverlay:{measure:Lf}};class E0 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 ove={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new E0,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:py},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:wv,measureDroppableContainers:py,windowRect:null,measuringScheduled:!1},lve={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:py,draggableNodes:new Map,over:null,measureDroppableContainers:py},Db=b.createContext(lve),DQ=b.createContext(ove);function cve(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new E0}}}function uve(t,e){switch(e.type){case ds.DragStart:return{...t,draggable:{...t.draggable,initialCoordinates:e.initialCoordinates,active:e.active}};case ds.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 ds.DragEnd:case ds.DragCancel:return{...t,draggable:{...t.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case ds.RegisterDroppable:{const{element:n}=e,{id:r}=n,s=new E0(t.droppable.containers);return s.set(r,n),{...t,droppable:{...t.droppable,containers:s}}}case ds.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 E0(t.droppable.containers);return a.set(n,{...i,disabled:s}),{...t,droppable:{...t.droppable,containers:a}}}case ds.UnregisterDroppable:{const{id:n,key:r}=e,s=t.droppable.containers.get(n);if(!s||r!==s.key)return t;const i=new E0(t.droppable.containers);return i.delete(n),{...t,droppable:{...t.droppable,containers:i}}}default:return t}}function dve(t){let{disabled:e}=t;const{active:n,activatorEvent:r,draggableNodes:s}=b.useContext(Db),i=kO(r),a=kO(n?.id);return b.useEffect(()=>{if(!e&&!r&&i&&a!=null){if(!eN(i)||document.activeElement===i.target)return;const l=s.get(a);if(!l)return;const{activatorNode:c,node:d}=l;if(!c.current&&!d.current)return;requestAnimationFrame(()=>{for(const h of[c.current,d.current]){if(!h)continue;const m=r1e(h);if(m){m.focus();break}}})}},[r,e,s,a,i]),null}function hve(t,e){let{transform:n,...r}=e;return t!=null&&t.length?t.reduce((s,i)=>i({transform:s,...r}),n):n}function fve(t){return b.useMemo(()=>({draggable:{...wv.draggable,...t?.draggable},droppable:{...wv.droppable,...t?.droppable},dragOverlay:{...wv.dragOverlay,...t?.dragOverlay}}),[t?.draggable,t?.droppable,t?.dragOverlay])}function mve(t){let{activeNode:e,measure:n,initialRect:r,config:s=!0}=t;const i=b.useRef(!1),{x:a,y:l}=typeof s=="boolean"?{x:s,y:s}:s;Bo(()=>{if(!a&&!l||!e){i.current=!1;return}if(i.current||!r)return;const d=e?.node.current;if(!d||d.isConnected===!1)return;const h=n(d),m=OQ(h,r);if(a||(m.x=0),l||(m.y=0),i.current=!0,Math.abs(m.x)>0||Math.abs(m.y)>0){const g=jQ(d);g&&g.scrollBy({top:m.y,left:m.x})}},[e,a,l,r,n])}const PQ=b.createContext({...Za,scaleX:1,scaleY:1});var Dc;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})(Dc||(Dc={}));const pve=b.memo(function(e){var n,r,s,i;let{id:a,accessibility:l,autoScroll:c=!0,children:d,sensors:h=ive,collisionDetection:m=v1e,measuring:g,modifiers:x,...y}=e;const w=b.useReducer(uve,void 0,cve),[S,k]=w,[j,N]=c1e(),[T,E]=b.useState(Dc.Uninitialized),_=T===Dc.Initialized,{draggable:{active:A,nodes:L,translate:P},droppable:{containers:B}}=S,$=A!=null?L.get(A):null,U=b.useRef({initial:null,translated:null}),te=b.useMemo(()=>{var Kt;return A!=null?{id:A,data:(Kt=$?.data)!=null?Kt:ave,rect:U}:null},[A,$]),z=b.useRef(null),[Q,F]=b.useState(null),[Y,J]=b.useState(null),X=up(y,Object.values(y)),R=cg("DndDescribedBy",a),ie=b.useMemo(()=>B.getEnabled(),[B]),G=fve(g),{droppableRects:I,measureDroppableContainers:V,measuringScheduled:ee}=W1e(ie,{dragging:_,dependencies:[P.x,P.y],config:G.droppable}),ne=V1e(L,A),W=b.useMemo(()=>Y?OO(Y):null,[Y]),se=nn(),re=G1e(ne,G.draggable.measure);mve({activeNode:A!=null?L.get(A):null,config:se.layoutShiftCompensation,initialRect:re,measure:G.draggable.measure});const oe=cM(ne,G.draggable.measure,re),Te=cM(ne?ne.parentElement:null),We=b.useRef({activatorEvent:null,active:null,activeNode:ne,collisionRect:null,collisions:null,droppableRects:I,draggableNodes:L,draggingNode:null,draggingNodeRect:null,droppableContainers:B,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Ye=B.getNodeFor((n=We.current.over)==null?void 0:n.id),Je=sve({measure:G.dragOverlay.measure}),Oe=(r=Je.nodeRef.current)!=null?r:ne,Ve=_?(s=Je.rect)!=null?s:oe:null,Ue=!!(Je.nodeRef.current&&Je.rect),He=K1e(Ue?null:oe),Ot=RQ(Oe?Ti(Oe):null),xt=Z1e(_?Ye??ne:null),kn=nve(xt),It=hve(x,{transform:{x:P.x-He.x,y:P.y-He.y,scaleX:1,scaleY:1},activatorEvent:Y,active:te,activeNodeRect:oe,containerNodeRect:Te,draggingNodeRect:Ve,over:We.current.over,overlayNodeRect:Je.rect,scrollableAncestors:xt,scrollableAncestorRects:kn,windowRect:Ot}),Yt=W?Fh(W,P):null,_t=J1e(xt),mt=dM(_t),Ne=dM(_t,[oe]),Ie=Fh(It,mt),st=Ve?w1e(Ve,It):null,yt=te&&st?m({active:te,collisionRect:st,droppableRects:I,droppableContainers:ie,pointerCoordinates:Yt}):null,Pt=kQ(yt,"id"),[Mt,zn]=b.useState(null),Fe=Ue?It:Fh(It,Ne),rt=y1e(Fe,(i=Mt?.rect)!=null?i:null,oe),tn=b.useRef(null),Rt=b.useCallback((Kt,pt)=>{let{sensor:xr,options:Ur}=pt;if(z.current==null)return;const Wr=L.get(z.current);if(!Wr)return;const vr=Kt.nativeEvent,In=new xr({active:z.current,activeNode:Wr,event:vr,options:Ur,context:We,onAbort(nr){if(!L.get(nr))return;const{onDragAbort:xs}=X.current,js={id:nr};xs?.(js),j({type:"onDragAbort",event:js})},onPending(nr,gs,xs,js){if(!L.get(nr))return;const{onDragPending:Le}=X.current,Ct={id:nr,constraint:gs,initialCoordinates:xs,offset:js};Le?.(Ct),j({type:"onDragPending",event:Ct})},onStart(nr){const gs=z.current;if(gs==null)return;const xs=L.get(gs);if(!xs)return;const{onDragStart:js}=X.current,ge={activatorEvent:vr,active:{id:gs,data:xs.data,rect:U}};pa.unstable_batchedUpdates(()=>{js?.(ge),E(Dc.Initializing),k({type:ds.DragStart,initialCoordinates:nr,active:gs}),j({type:"onDragStart",event:ge}),F(tn.current),J(vr)})},onMove(nr){k({type:ds.DragMove,coordinates:nr})},onEnd:cr(ds.DragEnd),onCancel:cr(ds.DragCancel)});tn.current=In;function cr(nr){return async function(){const{active:xs,collisions:js,over:ge,scrollAdjustedTranslate:Le}=We.current;let Ct=null;if(xs&&Le){const{cancelDrop:vn}=X.current;Ct={activatorEvent:vr,active:xs,collisions:js,delta:Le,over:ge},nr===ds.DragEnd&&typeof vn=="function"&&await Promise.resolve(vn(Ct))&&(nr=ds.DragCancel)}z.current=null,pa.unstable_batchedUpdates(()=>{k({type:nr}),E(Dc.Uninitialized),zn(null),F(null),J(null),tn.current=null;const vn=nr===ds.DragEnd?"onDragEnd":"onDragCancel";if(Ct){const Fr=X.current[vn];Fr?.(Ct),j({type:vn,event:Ct})}})}}},[L]),ke=b.useCallback((Kt,pt)=>(xr,Ur)=>{const Wr=xr.nativeEvent,vr=L.get(Ur);if(z.current!==null||!vr||Wr.dndKit||Wr.defaultPrevented)return;const In={active:vr};Kt(xr,pt.options,In)===!0&&(Wr.dndKit={capturedBy:pt.sensor},z.current=Ur,Rt(xr,pt))},[L,Rt]),Pe=U1e(h,ke);eve(h),Bo(()=>{oe&&T===Dc.Initializing&&E(Dc.Initialized)},[oe,T]),b.useEffect(()=>{const{onDragMove:Kt}=X.current,{active:pt,activatorEvent:xr,collisions:Ur,over:Wr}=We.current;if(!pt||!xr)return;const vr={active:pt,activatorEvent:xr,collisions:Ur,delta:{x:Ie.x,y:Ie.y},over:Wr};pa.unstable_batchedUpdates(()=>{Kt?.(vr),j({type:"onDragMove",event:vr})})},[Ie.x,Ie.y]),b.useEffect(()=>{const{active:Kt,activatorEvent:pt,collisions:xr,droppableContainers:Ur,scrollAdjustedTranslate:Wr}=We.current;if(!Kt||z.current==null||!pt||!Wr)return;const{onDragOver:vr}=X.current,In=Ur.get(Pt),cr=In&&In.rect.current?{id:In.id,rect:In.rect.current,data:In.data,disabled:In.disabled}:null,nr={active:Kt,activatorEvent:pt,collisions:xr,delta:{x:Wr.x,y:Wr.y},over:cr};pa.unstable_batchedUpdates(()=>{zn(cr),vr?.(nr),j({type:"onDragOver",event:nr})})},[Pt]),Bo(()=>{We.current={activatorEvent:Y,active:te,activeNode:ne,collisionRect:st,collisions:yt,droppableRects:I,draggableNodes:L,draggingNode:Oe,draggingNodeRect:Ve,droppableContainers:B,over:Mt,scrollableAncestors:xt,scrollAdjustedTranslate:Ie},U.current={initial:Ve,translated:st}},[te,ne,yt,st,L,Oe,Ve,I,B,Mt,xt,Ie]),$1e({...se,delta:P,draggingRect:st,pointerCoordinates:Yt,scrollableAncestors:xt,scrollableAncestorRects:kn});const it=b.useMemo(()=>({active:te,activeNode:ne,activeNodeRect:oe,activatorEvent:Y,collisions:yt,containerNodeRect:Te,dragOverlay:Je,draggableNodes:L,droppableContainers:B,droppableRects:I,over:Mt,measureDroppableContainers:V,scrollableAncestors:xt,scrollableAncestorRects:kn,measuringConfiguration:G,measuringScheduled:ee,windowRect:Ot}),[te,ne,oe,Y,yt,Te,Je,L,B,I,Mt,V,xt,kn,G,ee,Ot]),ot=b.useMemo(()=>({activatorEvent:Y,activators:Pe,active:te,activeNodeRect:oe,ariaDescribedById:{draggable:R},dispatch:k,draggableNodes:L,over:Mt,measureDroppableContainers:V}),[Y,Pe,te,oe,k,R,L,Mt,V]);return ae.createElement(bQ.Provider,{value:N},ae.createElement(Db.Provider,{value:ot},ae.createElement(DQ.Provider,{value:it},ae.createElement(PQ.Provider,{value:rt},d)),ae.createElement(dve,{disabled:l?.restoreFocus===!1})),ae.createElement(h1e,{...l,hiddenTextDescribedById:R}));function nn(){const Kt=Q?.autoScrollEnabled===!1,pt=typeof c=="object"?c.enabled===!1:c===!1,xr=_&&!Kt&&!pt;return typeof c=="object"?{...c,enabled:xr}:{enabled:xr}}}),gve=b.createContext(null),fM="button",xve="Draggable";function vve(t){let{id:e,data:n,disabled:r=!1,attributes:s}=t;const i=cg(xve),{activators:a,activatorEvent:l,active:c,activeNodeRect:d,ariaDescribedById:h,draggableNodes:m,over:g}=b.useContext(Db),{role:x=fM,roleDescription:y="draggable",tabIndex:w=0}=s??{},S=c?.id===e,k=b.useContext(S?PQ:gve),[j,N]=my(),[T,E]=my(),_=tve(a,e),A=up(n);Bo(()=>(m.set(e,{id:e,key:i,node:j,activatorNode:T,data:A}),()=>{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===fM?!0:void 0,"aria-roledescription":y,"aria-describedby":h.draggable}),[r,x,w,S,y,h.draggable]);return{active:c,activatorEvent:l,activeNodeRect:d,attributes:L,isDragging:S,listeners:r?void 0:_,node:j,over:g,setNodeRef:N,setActivatorNodeRef:E,transform:k}}function yve(){return b.useContext(DQ)}const bve="Droppable",wve={timeout:25};function Sve(t){let{data:e,disabled:n=!1,id:r,resizeObserverConfig:s}=t;const i=cg(bve),{active:a,dispatch:l,over:c,measureDroppableContainers:d}=b.useContext(Db),h=b.useRef({disabled:n}),m=b.useRef(!1),g=b.useRef(null),x=b.useRef(null),{disabled:y,updateMeasurementsFor:w,timeout:S}={...wve,...s},k=up(w??r),j=b.useCallback(()=>{if(!m.current){m.current=!0;return}x.current!=null&&clearTimeout(x.current),x.current=setTimeout(()=>{d(Array.isArray(k.current)?k.current:[k.current]),x.current=null},S)},[S]),N=Rb({callback:j,disabled:y||!a}),T=b.useCallback((L,P)=>{N&&(P&&(N.unobserve(P),m.current=!1),L&&N.observe(L))},[N]),[E,_]=my(T),A=up(e);return b.useEffect(()=>{!N||!E.current||(N.disconnect(),m.current=!1,N.observe(E.current))},[E,N]),b.useEffect(()=>(l({type:ds.RegisterDroppable,element:{id:r,key:i,disabled:n,node:E,rect:g,data:A}}),()=>l({type:ds.UnregisterDroppable,key:i,id:r})),[r]),b.useEffect(()=>{n!==h.current.disabled&&(l({type:ds.SetDroppableDisabled,id:r,key:i,disabled:n}),h.current.disabled=n)},[r,i,n,l]),{active:a,rect:g,isOver:c?.id===r,node:E,over:c,setNodeRef:_}}function iN(t,e,n){const r=t.slice();return r.splice(n<0?r.length+n:n,0,r.splice(e,1)[0]),r}function kve(t,e){return t.reduce((n,r,s)=>{const i=e.get(r);return i&&(n[s]=i),n},Array(t.length))}function j1(t){return t!==null&&t>=0}function Ove(t,e){if(t===e)return!0;if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0}function jve(t){return typeof t=="boolean"?{draggable:t,droppable:t}:t}const N1={scaleX:1,scaleY:1},Nve=t=>{var e;let{rects:n,activeNodeRect:r,activeIndex:s,overIndex:i,index:a}=t;const l=(e=n[s])!=null?e:r;if(!l)return null;const c=Cve(n,a,s);if(a===s){const d=n[i];return d?{x:s<i?d.left+d.width-(l.left+l.width):d.left-l.left,y:0,...N1}:null}return a>s&&a<=i?{x:-l.width-c,y:0,...N1}:a<s&&a>=i?{x:l.width+c,y:0,...N1}:{x:0,y:0,...N1}};function Cve(t,e,n){const r=t[e],s=t[e-1],i=t[e+1];return!r||!s&&!i?0:n<e?s?r.left-(s.left+s.width):i.left-(r.left+r.width):i?i.left-(r.left+r.width):r.left-(s.left+s.width)}const zQ=t=>{let{rects:e,activeIndex:n,overIndex:r,index:s}=t;const i=iN(e,r,n),a=e[s],l=i[s];return!l||!a?null:{x:l.left-a.left,y:l.top-a.top,scaleX:l.width/a.width,scaleY:l.height/a.height}},IQ="Sortable",LQ=ae.createContext({activeIndex:-1,containerId:IQ,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:zQ,disabled:{draggable:!1,droppable:!1}});function Tve(t){let{children:e,id:n,items:r,strategy:s=zQ,disabled:i=!1}=t;const{active:a,dragOverlay:l,droppableRects:c,over:d,measureDroppableContainers:h}=yve(),m=cg(IQ,n),g=l.rect!==null,x=b.useMemo(()=>r.map(_=>typeof _=="object"&&"id"in _?_.id:_),[r]),y=a!=null,w=a?x.indexOf(a.id):-1,S=d?x.indexOf(d.id):-1,k=b.useRef(x),j=!Ove(x,k.current),N=S!==-1&&w===-1||j,T=jve(i);Bo(()=>{j&&y&&h(x)},[j,x,y,h]),b.useEffect(()=>{k.current=x},[x]);const E=b.useMemo(()=>({activeIndex:w,containerId:m,disabled:T,disableTransforms:N,items:x,overIndex:S,useDragOverlay:g,sortedRects:kve(x,c),strategy:s}),[w,m,T.draggable,T.droppable,N,x,S,c,g,s]);return ae.createElement(LQ.Provider,{value:E},e)}const Eve=t=>{let{id:e,items:n,activeIndex:r,overIndex:s}=t;return iN(n,r,s).indexOf(e)},_ve=t=>{let{containerId:e,isSorting:n,wasDragging:r,index:s,items:i,newIndex:a,previousItems:l,previousContainerId:c,transition:d}=t;return!d||!r||l!==i&&s===a?!1:n?!0:a!==s&&e===c},Ave={duration:200,easing:"ease"},BQ="transform",Mve=hp.Transition.toString({property:BQ,duration:0,easing:"linear"}),Rve={roleDescription:"sortable"};function Dve(t){let{disabled:e,index:n,node:r,rect:s}=t;const[i,a]=b.useState(null),l=b.useRef(n);return Bo(()=>{if(!e&&n!==l.current&&r.current){const c=s.current;if(c){const d=Lf(r.current,{ignoreTransform:!0}),h={x:c.left-d.left,y:c.top-d.top,scaleX:c.width/d.width,scaleY:c.height/d.height};(h.x||h.y)&&a(h)}}n!==l.current&&(l.current=n)},[e,n,r,s]),b.useEffect(()=>{i&&a(null)},[i]),i}function Pve(t){let{animateLayoutChanges:e=_ve,attributes:n,disabled:r,data:s,getNewIndex:i=Eve,id:a,strategy:l,resizeObserverConfig:c,transition:d=Ave}=t;const{items:h,containerId:m,activeIndex:g,disabled:x,disableTransforms:y,sortedRects:w,overIndex:S,useDragOverlay:k,strategy:j}=b.useContext(LQ),N=zve(r,x),T=h.indexOf(a),E=b.useMemo(()=>({sortable:{containerId:m,index:T,items:h},...s}),[m,s,T,h]),_=b.useMemo(()=>h.slice(h.indexOf(a)),[h,a]),{rect:A,node:L,isOver:P,setNodeRef:B}=Sve({id:a,data:E,disabled:N.droppable,resizeObserverConfig:{updateMeasurementsFor:_,...c}}),{active:$,activatorEvent:U,activeNodeRect:te,attributes:z,setNodeRef:Q,listeners:F,isDragging:Y,over:J,setActivatorNodeRef:X,transform:R}=vve({id:a,data:E,attributes:{...Rve,...n},disabled:N.draggable}),ie=Jxe(B,Q),G=!!$,I=G&&!y&&j1(g)&&j1(S),V=!k&&Y,ee=V&&I?R:null,W=I?ee??(l??j)({rects:w,activeNodeRect:te,activeIndex:g,overIndex:S,index:T}):null,se=j1(g)&&j1(S)?i({id:a,items:h,activeIndex:g,overIndex:S}):T,re=$?.id,oe=b.useRef({activeId:re,items:h,newIndex:se,containerId:m}),Te=h!==oe.current.items,We=e({active:$,containerId:m,isDragging:Y,isSorting:G,id:a,index:T,items:h,newIndex:oe.current.newIndex,previousItems:oe.current.items,previousContainerId:oe.current.containerId,transition:d,wasDragging:oe.current.activeId!=null}),Ye=Dve({disabled:!We,index:T,node:L,rect:A});return b.useEffect(()=>{G&&oe.current.newIndex!==se&&(oe.current.newIndex=se),m!==oe.current.containerId&&(oe.current.containerId=m),h!==oe.current.items&&(oe.current.items=h)},[G,se,m,h]),b.useEffect(()=>{if(re===oe.current.activeId)return;if(re!=null&&oe.current.activeId==null){oe.current.activeId=re;return}const Oe=setTimeout(()=>{oe.current.activeId=re},50);return()=>clearTimeout(Oe)},[re]),{active:$,activeIndex:g,attributes:z,data:E,rect:A,index:T,newIndex:se,items:h,isOver:P,isSorting:G,isDragging:Y,listeners:F,node:L,overIndex:S,over:J,setNodeRef:ie,setActivatorNodeRef:X,setDroppableNodeRef:B,setDraggableNodeRef:Q,transform:Ye??W,transition:Je()};function Je(){if(Ye||Te&&oe.current.newIndex===T)return Mve;if(!(V&&!eN(U)||!d)&&(G||We))return hp.Transition.toString({...d,property:BQ})}}function zve(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 xy(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 Ive=[bn.Down,bn.Right,bn.Up,bn.Left],Lve=(t,e)=>{let{context:{active:n,collisionRect:r,droppableRects:s,droppableContainers:i,over:a,scrollableAncestors:l}}=e;if(Ive.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 bn.Down:r.top<g.top&&c.push(m);break;case bn.Up:r.top>g.top&&c.push(m);break;case bn.Left:r.left>g.left&&c.push(m);break;case bn.Right:r.left<g.left&&c.push(m);break}});const d=g1e({collisionRect:r,droppableRects:s,droppableContainers:c});let h=kQ(d,"id");if(h===a?.id&&d.length>1&&(h=d[1].id),h!=null){const m=i.get(n.id),g=i.get(h),x=g?s.get(g.id):null,y=g?.node.current;if(y&&x&&m&&g){const S=Mb(y).some((_,A)=>l[A]!==_),k=FQ(m,g),j=Bve(m,g),N=S||!k?{x:0,y:0}:{x:j?r.width-x.width:0,y:j?r.height-x.height:0},T={x:x.left,y:x.top};return N.x&&N.y?T:dp(T,N)}}}};function FQ(t,e){return!xy(t)||!xy(e)?!1:t.data.current.sortable.containerId===e.data.current.sortable.containerId}function Bve(t,e){return!xy(t)||!xy(e)||!FQ(t,e)?!1:t.data.current.sortable.index<e.data.current.sortable.index}function Fve({value:t,label:e,onRemove:n}){const{attributes:r,listeners:s,setNodeRef:i,transform:a,transition:l,isDragging:c}=Pve({id:t}),d={transform:hp.Transform.toString(a),transition:l,opacity:c?.5:1};return o.jsx("div",{ref:i,style:d,className:xe("inline-flex items-center gap-1",c&&"shadow-lg"),children:o.jsxs(Xn,{variant:"secondary",className:"cursor-move hover:bg-secondary/80 flex items-center gap-1",children:[o.jsx("div",{...r,...s,className:"cursor-grab active:cursor-grabbing flex items-center",children:o.jsx(Xee,{className:"h-3 w-3 text-muted-foreground"})}),o.jsx("span",{children:e}),o.jsx(_p,{className:"ml-1 h-3 w-3 cursor-pointer hover:text-destructive",strokeWidth:2,fill:"none",onClick:h=>{h.stopPropagation(),n(t)}})]})})}function qve({options:t,selected:e,onChange:n,placeholder:r="选择选项...",emptyText:s="未找到选项",className:i}){const[a,l]=b.useState(!1),c=f1e(tM(sN,{activationConstraint:{distance:8}}),tM(nN,{coordinateGetter:Lve})),d=g=>{e.includes(g)?n(e.filter(x=>x!==g)):n([...e,g])},h=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(iN(e,w,S))}};return o.jsxs(zo,{open:a,onOpenChange:l,children:[o.jsx(Io,{asChild:!0,children:o.jsxs(de,{variant:"outline",role:"combobox","aria-expanded":a,className:xe("w-full justify-between min-h-10 h-auto",i),children:[o.jsx(pve,{sensors:c,collisionDetection:p1e,onDragEnd:m,children:o.jsx(Tve,{items:e,strategy:Nve,children:o.jsx("div",{className:"flex gap-1 flex-wrap flex-1",children:e.length===0?o.jsx("span",{className:"text-muted-foreground",children:r}):e.map(g=>{const x=t.find(y=>y.value===g);return o.jsx(Fve,{value:g,label:x?.label||g,onRemove:h},g)})})})}),o.jsx(Mj,{className:"ml-2 h-4 w-4 shrink-0 opacity-50",strokeWidth:2,fill:"none"})]})}),o.jsx(Xa,{className:"w-full p-0",align:"start",children:o.jsxs(Ob,{children:[o.jsx(jb,{placeholder:"搜索...",className:"h-9"}),o.jsxs(Nb,{children:[o.jsx(Cb,{children:s}),o.jsx(ap,{children:t.map(g=>{const x=e.includes(g.value);return o.jsxs(op,{value:g.value,onSelect:()=>d(g.value),children:[o.jsx("div",{className:xe("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:o.jsx(Ro,{className:"h-3 w-3",strokeWidth:2,fill:"none"})}),o.jsx("span",{children:g.label})]},g.value)})})]})]})})]})}const mM=new Map,$ve=300*1e3;function Hve(){const[t,e]=b.useState([]),[n,r]=b.useState([]),[s,i]=b.useState([]),[a,l]=b.useState([]),[c,d]=b.useState(null),[h,m]=b.useState(!0),[g,x]=b.useState(!1),[y,w]=b.useState(!1),[S,k]=b.useState(!1),[j,N]=b.useState(!1),[T,E]=b.useState(!1),[_,A]=b.useState(!1),[L,P]=b.useState(null),[B,$]=b.useState(null),[U,te]=b.useState(!1),[z,Q]=b.useState(null),[F,Y]=b.useState(""),[J,X]=b.useState(new Set),[R,ie]=b.useState(!1),[G,I]=b.useState(1),[V,ee]=b.useState(20),[ne,W]=b.useState(""),[se,re]=b.useState([]),[oe,Te]=b.useState(!1),[We,Ye]=b.useState(null),[Je,Oe]=b.useState(!1),[Ve,Ue]=b.useState(null),{toast:He}=as(),Ot=Zi(),{registerTour:xt,startTour:kn,state:It,goToStep:Yt}=Y6(),_t=b.useRef(null),mt=b.useRef(null),Ne=b.useRef(!0);b.useEffect(()=>{xt(_l,gQ)},[xt]),b.useEffect(()=>{if(It.activeTourId===_l&&It.isRunning){const ge=xQ[It.stepIndex];ge&&!window.location.pathname.endsWith(ge.replace("/config/",""))&&Ot({to:ge})}},[It.stepIndex,It.activeTourId,It.isRunning,Ot]);const Ie=b.useRef(It.stepIndex);b.useEffect(()=>{if(It.activeTourId===_l&&It.isRunning){const ge=Ie.current,Le=It.stepIndex;ge>=12&&ge<=17&&Le<12&&A(!1),Ie.current=Le}},[It.stepIndex,It.activeTourId,It.isRunning]),b.useEffect(()=>{if(It.activeTourId!==_l||!It.isRunning)return;const ge=Le=>{const Ct=Le.target,vn=It.stepIndex;vn===2&&Ct.closest('[data-tour="add-provider-button"]')?setTimeout(()=>Yt(3),300):vn===9&&Ct.closest('[data-tour="provider-cancel-button"]')?setTimeout(()=>Yt(10),300):vn===11&&Ct.closest('[data-tour="add-model-button"]')?setTimeout(()=>Yt(12),300):vn===17&&Ct.closest('[data-tour="model-cancel-button"]')?setTimeout(()=>Yt(18),300):vn===18&&Ct.closest('[data-tour="tasks-tab-trigger"]')&&setTimeout(()=>Yt(19),300)};return document.addEventListener("click",ge,!0),()=>document.removeEventListener("click",ge,!0)},[It,Yt]);const st=()=>{kn(_l)};b.useEffect(()=>{yt()},[]);const yt=async()=>{try{m(!0);const ge=await Rh(),Le=ge.models||[];e(Le),l(Le.map(vn=>vn.name));const Ct=ge.api_providers||[];r(Ct.map(vn=>vn.name)),i(Ct),d(ge.model_task_config||null),k(!1),Ne.current=!1}catch(ge){console.error("加载配置失败:",ge)}finally{m(!1)}},Pt=b.useCallback(ge=>s.find(Le=>Le.name===ge),[s]),Mt=b.useCallback(async(ge,Le=!1)=>{const Ct=Pt(ge);if(!Ct?.base_url){re([]),Ue(null),Ye('提供商配置不完整,请先在"模型提供商配置"中配置');return}if(!Ct.api_key){re([]),Ue(null),Ye('该提供商未配置 API Key请先在"模型提供商配置"中填写');return}const vn=Kxe(Ct.base_url);if(Ue(vn),!vn?.modelFetcher){re([]),Ye(null);return}const Fr=`${ge}:${Ct.base_url}`,Cr=mM.get(Fr);if(!Le&&Cr&&Date.now()-Cr.timestamp<$ve){re(Cr.models),Ye(null);return}Te(!0),Ye(null);try{const Tr=await kae(ge,vn.modelFetcher.parser,vn.modelFetcher.endpoint);re(Tr),mM.set(Fr,{models:Tr,timestamp:Date.now()})}catch(Tr){console.error("获取模型列表失败:",Tr);const Ns=Tr.message||"获取模型列表失败";Ns.includes("无效")||Ns.includes("过期")||Ns.includes("API Key")?Ye('API Key 无效或已过期,请检查"模型提供商配置"中的密钥'):Ns.includes("权限")?Ye("没有权限获取模型列表,请检查 API Key 权限"):Ns.includes("timeout")||Ns.includes("超时")?Ye("请求超时,请检查网络连接后重试"):Ns.includes("不支持")?Ye("该提供商不支持自动获取模型列表,请手动输入"):Ye(Ns),re([])}finally{Te(!1)}},[Pt]);b.useEffect(()=>{_&&L?.api_provider&&Mt(L.api_provider)},[_,L?.api_provider,Mt]);const zn=async()=>{try{N(!0),ib().catch(()=>{}),E(!0)}catch(ge){console.error("重启失败:",ge),E(!1),He({title:"重启失败",description:"无法发送重启请求,请手动重启",variant:"destructive"}),N(!1)}},Fe=async()=>{try{x(!0),_t.current&&clearTimeout(_t.current),mt.current&&clearTimeout(mt.current);const ge=await Rh();ge.models=t,ge.model_task_config=c,await qv(ge),k(!1),He({title:"保存成功",description:"正在重启麦麦..."}),await zn()}catch(ge){console.error("保存配置失败:",ge),He({title:"保存失败",description:ge.message,variant:"destructive"}),x(!1)}},rt=()=>{localStorage.removeItem("access-token"),window.location.href="/auth"},tn=()=>{E(!1),N(!1),He({title:"重启超时",description:"服务未能在预期时间内恢复,请手动检查或刷新页面",variant:"destructive"})},Rt=b.useCallback(async ge=>{if(!Ne.current)try{w(!0),await xk("models",ge),k(!1)}catch(Le){console.error("自动保存模型列表失败:",Le),k(!0)}finally{w(!1)}},[]),ke=b.useCallback(async ge=>{if(!Ne.current)try{w(!0),await xk("model_task_config",ge),k(!1)}catch(Le){console.error("自动保存任务配置失败:",Le),k(!0)}finally{w(!1)}},[]);b.useEffect(()=>{if(!Ne.current)return k(!0),_t.current&&clearTimeout(_t.current),_t.current=setTimeout(()=>{Rt(t)},2e3),()=>{_t.current&&clearTimeout(_t.current)}},[t,Rt]),b.useEffect(()=>{if(!(Ne.current||!c))return k(!0),mt.current&&clearTimeout(mt.current),mt.current=setTimeout(()=>{ke(c)},2e3),()=>{mt.current&&clearTimeout(mt.current)}},[c,ke]);const Pe=async()=>{try{x(!0),_t.current&&clearTimeout(_t.current),mt.current&&clearTimeout(mt.current);const ge=await Rh();ge.models=t,ge.model_task_config=c,await qv(ge),k(!1),He({title:"保存成功",description:"模型配置已保存"}),await yt()}catch(ge){console.error("保存配置失败:",ge),He({title:"保存失败",description:ge.message,variant:"destructive"})}finally{x(!1)}},it=(ge,Le)=>{P(ge||{model_identifier:"",name:"",api_provider:n[0]||"",price_in:0,price_out:0,force_stream_mode:!1,extra_params:{}}),$(Le),A(!0)},ot=()=>{if(!L)return;const ge={...L,price_in:L.price_in??0,price_out:L.price_out??0};let Le;B!==null?(Le=[...t],Le[B]=ge):Le=[...t,ge],e(Le),l(Le.map(Ct=>Ct.name)),A(!1),P(null),$(null)},nn=ge=>{if(!ge&&L){const Le={...L,price_in:L.price_in??0,price_out:L.price_out??0};P(Le)}A(ge)},Kt=ge=>{Q(ge),te(!0)},pt=()=>{if(z!==null){const ge=t.filter((Le,Ct)=>Ct!==z);e(ge),l(ge.map(Le=>Le.name)),He({title:"删除成功",description:"模型已从列表中移除"})}te(!1),Q(null)},xr=ge=>{const Le=new Set(J);Le.has(ge)?Le.delete(ge):Le.add(ge),X(Le)},Ur=()=>{if(J.size===cr.length)X(new Set);else{const ge=cr.map((Le,Ct)=>t.findIndex(vn=>vn===cr[Ct]));X(new Set(ge))}},Wr=()=>{if(J.size===0){He({title:"提示",description:"请先选择要删除的模型",variant:"default"});return}ie(!0)},vr=()=>{const ge=t.filter((Le,Ct)=>!J.has(Ct));e(ge),l(ge.map(Le=>Le.name)),X(new Set),ie(!1),He({title:"批量删除成功",description:`已删除 ${J.size} 个模型`})},In=(ge,Le,Ct)=>{c&&d({...c,[ge]:{...c[ge],[Le]:Ct}})},cr=t.filter(ge=>{if(!F)return!0;const Le=F.toLowerCase();return ge.name.toLowerCase().includes(Le)||ge.model_identifier.toLowerCase().includes(Le)||ge.api_provider.toLowerCase().includes(Le)}),nr=Math.ceil(cr.length/V),gs=cr.slice((G-1)*V,G*V),xs=()=>{const ge=parseInt(ne);ge>=1&&ge<=nr&&(I(ge),W(""))},js=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(Ct=>Ct.includes(ge)):!1;return h?o.jsx(gn,{className:"h-full",children:o.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:o.jsx("div",{className:"flex items-center justify-center h-64",children:o.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})})}):o.jsx(gn,{className:"h-full",children:o.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"模型管理与分配"}),o.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"添加模型并为模型分配功能"})]}),o.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[o.jsxs(de,{onClick:Pe,disabled:g||y||!S||j,size:"sm",variant:"outline",className:"flex-1 sm:flex-none sm:min-w-[120px]",children:[o.jsx(Gy,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),g?"保存中...":y?"自动保存中...":S?"保存配置":"已保存"]}),o.jsxs(Dn,{children:[o.jsx(rs,{asChild:!0,children:o.jsxs(de,{disabled:g||y||j,size:"sm",className:"flex-1 sm:flex-none sm:min-w-[120px]",children:[o.jsx(Aj,{className:"mr-2 h-4 w-4"}),j?"重启中...":S?"保存并重启":"重启麦麦"]})}),o.jsxs(Nn,{children:[o.jsxs(Cn,{children:[o.jsx(En,{children:"确认重启麦麦?"}),o.jsx(_n,{className:"space-y-3",asChild:!0,children:o.jsxs("div",{children:[o.jsx("p",{children:S?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"}),o.jsxs(ga,{className:"border-yellow-500/50 bg-yellow-500/10",children:[o.jsx(Oa,{className:"h-4 w-4 text-yellow-600"}),o.jsxs(xa,{className:"text-yellow-900 dark:text-yellow-100",children:[o.jsx("strong",{children:"重要提示:"}),"由于技术原因,使用重启功能后,将无法再使用 ",o.jsx("code",{className:"px-1 py-0.5 bg-yellow-200 dark:bg-yellow-900 rounded",children:"Ctrl+C"})," 结束程序。",o.jsxs(Dr,{children:[o.jsx(Of,{asChild:!0,children:o.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:[o.jsx(Wy,{className:"h-3 w-3"}),"如何结束程序?"]})}),o.jsxs(Sr,{className:"max-w-2xl",children:[o.jsxs(kr,{children:[o.jsx(Or,{children:"如何结束使用重启功能后的麦麦程序"}),o.jsx(ss,{children:"由于重启功能会使程序脱离终端控制,需要通过系统命令来结束进程"})]}),o.jsxs(ja,{defaultValue:"windows",className:"w-full",children:[o.jsxs(Wi,{className:"grid w-full grid-cols-3",children:[o.jsx(Lt,{value:"windows",children:"Windows"}),o.jsx(Lt,{value:"macos",children:"macOS"}),o.jsx(Lt,{value:"linux",children:"Linux"})]}),o.jsxs(un,{value:"windows",className:"space-y-4 mt-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"font-semibold",children:"方法一:使用任务管理器"}),o.jsxs("ol",{className:"list-decimal list-inside space-y-1 text-sm text-muted-foreground",children:[o.jsxs("li",{children:["按 ",o.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"Ctrl + Shift + Esc"})," 打开任务管理器"]}),o.jsxs("li",{children:['在"进程"或"详细信息"标签页中找到 ',o.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"python.exe"})]}),o.jsx("li",{children:'右键点击并选择"结束任务"'})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"font-semibold",children:"方法二:使用命令行"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"打开 PowerShell 或命令提示符,执行以下命令:"}),o.jsxs("div",{className:"bg-muted p-3 rounded-md font-mono text-sm",children:[o.jsx("p",{children:"# 查找麦麦进程"}),o.jsx("p",{children:'Get-Process python | Where-Object {$_.MainWindowTitle -eq ""}'}),o.jsx("p",{className:"mt-2",children:"# 结束所有 Python 进程(谨慎使用)"}),o.jsx("p",{children:"Stop-Process -Name python -Force"})]})]})]}),o.jsxs(un,{value:"macos",className:"space-y-4 mt-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"font-semibold",children:"方法一:使用活动监视器"}),o.jsxs("ol",{className:"list-decimal list-inside space-y-1 text-sm text-muted-foreground",children:[o.jsxs("li",{children:["按 ",o.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"Cmd + Space"}),' 打开 Spotlight搜索"活动监视器"']}),o.jsxs("li",{children:["在进程列表中找到 ",o.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"Python"})]}),o.jsx("li",{children:"选中后点击左上角的 X 按钮结束进程"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"font-semibold",children:"方法二:使用终端"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"打开终端,执行以下命令:"}),o.jsxs("div",{className:"bg-muted p-3 rounded-md font-mono text-sm",children:[o.jsx("p",{children:"# 查找麦麦进程"}),o.jsx("p",{children:"ps aux | grep python | grep -v grep"}),o.jsx("p",{className:"mt-2",children:"# 结束指定 PID 的进程"}),o.jsx("p",{children:"kill -9 <PID>"}),o.jsx("p",{className:"mt-2",children:"# 或结束所有 Python 进程(谨慎使用)"}),o.jsx("p",{children:"pkill -9 python"})]})]})]}),o.jsxs(un,{value:"linux",className:"space-y-4 mt-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"font-semibold",children:"使用终端命令"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"打开终端,执行以下命令:"}),o.jsxs("div",{className:"bg-muted p-3 rounded-md font-mono text-sm",children:[o.jsx("p",{children:"# 查找麦麦进程"}),o.jsx("p",{children:"ps aux | grep python | grep -v grep"}),o.jsx("p",{className:"mt-2",children:"# 结束指定 PID 的进程"}),o.jsx("p",{children:"kill -9 <PID>"}),o.jsx("p",{className:"mt-2",children:"# 或使用 pkill 按名称结束"}),o.jsx("p",{children:'pkill -9 -f "bot.py"'}),o.jsx("p",{className:"mt-2",children:"# 或结束所有 Python 进程(谨慎使用)"}),o.jsx("p",{children:"pkill -9 python"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"font-semibold",children:"使用 htop如已安装"}),o.jsxs("ol",{className:"list-decimal list-inside space-y-1 text-sm text-muted-foreground",children:[o.jsxs("li",{children:["在终端输入 ",o.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"htop"})]}),o.jsxs("li",{children:["按 ",o.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"F3"})," 搜索 python"]}),o.jsxs("li",{children:["按 ",o.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"F9"})," 发送信号,选择 SIGKILL"]})]})]})]})]}),o.jsx(ws,{children:o.jsx(Gj,{asChild:!0,children:o.jsx(de,{variant:"outline",children:"关闭"})})})]})]})]})]})]})})]}),o.jsxs(Tn,{children:[o.jsx(Mn,{children:"取消"}),o.jsx(An,{onClick:S?Fe:zn,children:S?"保存并重启":"确认重启"})]})]})]})]})]}),o.jsxs(ga,{children:[o.jsx(Oa,{className:"h-4 w-4"}),o.jsxs(xa,{children:["配置更新后需要",o.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),o.jsxs(ga,{className:"hidden lg:flex border-primary/30 bg-primary/5 cursor-pointer hover:bg-primary/10 transition-colors",onClick:st,children:[o.jsx(Yee,{className:"h-4 w-4 text-primary"}),o.jsxs(xa,{className:"flex items-center justify-between",children:[o.jsxs("span",{children:[o.jsx("strong",{className:"text-primary",children:"新手引导:"}),"不知道如何配置模型?点击这里开始学习如何为麦麦的组件分配模型。"]}),o.jsx(de,{variant:"outline",size:"sm",className:"ml-4 shrink-0",children:"开始引导"})]})]}),o.jsxs(ja,{defaultValue:"models",className:"w-full",children:[o.jsxs(Wi,{className:"grid w-full max-w-full sm:max-w-md grid-cols-2",children:[o.jsx(Lt,{value:"models",children:"添加模型"}),o.jsx(Lt,{value:"tasks","data-tour":"tasks-tab-trigger",children:"为模型分配功能"})]}),o.jsxs(un,{value:"models",className:"space-y-4 mt-0",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-2",children:[o.jsx("p",{className:"text-sm text-muted-foreground",children:"配置可用的模型列表"}),o.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[J.size>0&&o.jsxs(de,{onClick:Wr,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[o.jsx(Sn,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"批量删除 (",J.size,")"]}),o.jsxs(de,{onClick:()=>it(null,null),size:"sm",variant:"outline",className:"w-full sm:w-auto","data-tour":"add-model-button",children:[o.jsx(Ls,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"添加模型"]})]})]}),o.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-2",children:[o.jsxs("div",{className:"relative w-full sm:flex-1 sm:max-w-sm",children:[o.jsx(Ni,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),o.jsx(ze,{placeholder:"搜索模型名称、标识符或提供商...",value:F,onChange:ge=>Y(ge.target.value),className:"pl-9"})]}),F&&o.jsxs("p",{className:"text-sm text-muted-foreground whitespace-nowrap",children:["找到 ",cr.length," 个结果"]})]}),o.jsx("div",{className:"md:hidden space-y-3",children:gs.length===0?o.jsx("div",{className:"text-center text-muted-foreground py-8 rounded-lg border bg-card",children:F?"未找到匹配的模型":"暂无模型配置"}):gs.map((ge,Le)=>{const Ct=t.findIndex(Fr=>Fr===ge),vn=js(ge.name);return o.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[o.jsxs("div",{className:"flex items-start justify-between gap-2",children:[o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[o.jsx("h3",{className:"font-semibold text-base",children:ge.name}),o.jsx(Xn,{variant:vn?"default":"secondary",className:vn?"bg-green-600 hover:bg-green-700":"",children:vn?"已使用":"未使用"})]}),o.jsx("p",{className:"text-xs text-muted-foreground break-all",title:ge.model_identifier,children:ge.model_identifier})]}),o.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[o.jsxs(de,{variant:"default",size:"sm",onClick:()=>it(ge,Ct),children:[o.jsx(Yu,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),o.jsxs(de,{size:"sm",onClick:()=>Kt(Ct),className:"bg-red-600 hover:bg-red-700 text-white",children:[o.jsx(Sn,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground text-xs",children:"提供商"}),o.jsx("p",{className:"font-medium",children:ge.api_provider})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground text-xs",children:"强制流式"}),o.jsx("p",{className:"font-medium",children:ge.force_stream_mode?"是":"否"})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground text-xs",children:"输入价格"}),o.jsxs("p",{className:"font-medium",children:["¥",ge.price_in,"/M"]})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground text-xs",children:"输出价格"}),o.jsxs("p",{className:"font-medium",children:["¥",ge.price_out,"/M"]})]})]})]},Le)})}),o.jsx("div",{className:"hidden md:block rounded-lg border bg-card overflow-hidden",children:o.jsx("div",{className:"overflow-x-auto",children:o.jsxs(_f,{children:[o.jsx(Af,{children:o.jsxs(Is,{children:[o.jsx(pn,{className:"w-12",children:o.jsx(Oi,{checked:J.size===cr.length&&cr.length>0,onCheckedChange:Ur})}),o.jsx(pn,{className:"w-24",children:"使用状态"}),o.jsx(pn,{children:"模型名称"}),o.jsx(pn,{children:"模型标识符"}),o.jsx(pn,{children:"提供商"}),o.jsx(pn,{className:"text-right",children:"输入价格"}),o.jsx(pn,{className:"text-right",children:"输出价格"}),o.jsx(pn,{className:"text-center",children:"强制流式"}),o.jsx(pn,{className:"text-right",children:"操作"})]})}),o.jsx(Mf,{children:gs.length===0?o.jsx(Is,{children:o.jsx(Gt,{colSpan:9,className:"text-center text-muted-foreground py-8",children:F?"未找到匹配的模型":"暂无模型配置"})}):gs.map((ge,Le)=>{const Ct=t.findIndex(Fr=>Fr===ge),vn=js(ge.name);return o.jsxs(Is,{children:[o.jsx(Gt,{children:o.jsx(Oi,{checked:J.has(Ct),onCheckedChange:()=>xr(Ct)})}),o.jsx(Gt,{children:o.jsx(Xn,{variant:vn?"default":"secondary",className:vn?"bg-green-600 hover:bg-green-700":"",children:vn?"已使用":"未使用"})}),o.jsx(Gt,{className:"font-medium",children:ge.name}),o.jsx(Gt,{className:"max-w-xs truncate",title:ge.model_identifier,children:ge.model_identifier}),o.jsx(Gt,{children:ge.api_provider}),o.jsxs(Gt,{className:"text-right",children:["¥",ge.price_in,"/M"]}),o.jsxs(Gt,{className:"text-right",children:["¥",ge.price_out,"/M"]}),o.jsx(Gt,{className:"text-center",children:ge.force_stream_mode?"是":"否"}),o.jsx(Gt,{className:"text-right",children:o.jsxs("div",{className:"flex justify-end gap-2",children:[o.jsxs(de,{variant:"default",size:"sm",onClick:()=>it(ge,Ct),children:[o.jsx(Yu,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),o.jsxs(de,{size:"sm",onClick:()=>Kt(Ct),className:"bg-red-600 hover:bg-red-700 text-white",children:[o.jsx(Sn,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})})]},Le)})})]})})}),cr.length>0&&o.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(he,{htmlFor:"page-size-model",className:"text-sm whitespace-nowrap",children:"每页显示"}),o.jsxs(Vt,{value:V.toString(),onValueChange:ge=>{ee(parseInt(ge)),I(1),X(new Set)},children:[o.jsx($t,{id:"page-size-model",className:"w-20",children:o.jsx(Ut,{})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"10",children:"10"}),o.jsx(De,{value:"20",children:"20"}),o.jsx(De,{value:"50",children:"50"}),o.jsx(De,{value:"100",children:"100"})]})]}),o.jsxs("span",{className:"text-sm text-muted-foreground",children:["显示 ",(G-1)*V+1," 到"," ",Math.min(G*V,cr.length)," 条,共 ",cr.length," 条"]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(de,{variant:"outline",size:"sm",onClick:()=>I(1),disabled:G===1,className:"hidden sm:flex",children:o.jsx(Ap,{className:"h-4 w-4"})}),o.jsxs(de,{variant:"outline",size:"sm",onClick:()=>I(ge=>Math.max(1,ge-1)),disabled:G===1,children:[o.jsx(vd,{className:"h-4 w-4 sm:mr-1"}),o.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(ze,{type:"number",value:ne,onChange:ge=>W(ge.target.value),onKeyDown:ge=>ge.key==="Enter"&&xs(),placeholder:G.toString(),className:"w-16 h-8 text-center",min:1,max:nr}),o.jsx(de,{variant:"outline",size:"sm",onClick:xs,disabled:!ne,className:"h-8",children:"跳转"})]}),o.jsxs(de,{variant:"outline",size:"sm",onClick:()=>I(ge=>ge+1),disabled:G>=nr,children:[o.jsx("span",{className:"hidden sm:inline",children:"下一页"}),o.jsx(yd,{className:"h-4 w-4 sm:ml-1"})]}),o.jsx(de,{variant:"outline",size:"sm",onClick:()=>I(nr),disabled:G>=nr,className:"hidden sm:flex",children:o.jsx(Mp,{className:"h-4 w-4"})})]})]})]}),o.jsxs(un,{value:"tasks",className:"space-y-6 mt-0",children:[o.jsx("p",{className:"text-sm text-muted-foreground",children:"为不同的任务配置使用的模型和参数"}),c&&o.jsxs("div",{className:"grid gap-4 sm:gap-6",children:[o.jsx(Fa,{title:"组件模型 (utils)",description:"用于表情包、取名、关系、情绪变化等组件",taskConfig:c.utils,modelNames:a,onChange:(ge,Le)=>In("utils",ge,Le),dataTour:"task-model-select"}),o.jsx(Fa,{title:"组件小模型 (utils_small)",description:"消耗量较大的组件,建议使用速度较快的小模型",taskConfig:c.utils_small,modelNames:a,onChange:(ge,Le)=>In("utils_small",ge,Le)}),o.jsx(Fa,{title:"工具调用模型 (tool_use)",description:"需要使用支持工具调用的模型",taskConfig:c.tool_use,modelNames:a,onChange:(ge,Le)=>In("tool_use",ge,Le)}),o.jsx(Fa,{title:"首要回复模型 (replyer)",description:"用于表达器和表达方式学习",taskConfig:c.replyer,modelNames:a,onChange:(ge,Le)=>In("replyer",ge,Le)}),o.jsx(Fa,{title:"决策模型 (planner)",description:"负责决定麦麦该什么时候回复",taskConfig:c.planner,modelNames:a,onChange:(ge,Le)=>In("planner",ge,Le)}),o.jsx(Fa,{title:"图像识别模型 (vlm)",description:"视觉语言模型",taskConfig:c.vlm,modelNames:a,onChange:(ge,Le)=>In("vlm",ge,Le),hideTemperature:!0}),o.jsx(Fa,{title:"语音识别模型 (voice)",description:"语音转文字",taskConfig:c.voice,modelNames:a,onChange:(ge,Le)=>In("voice",ge,Le),hideTemperature:!0,hideMaxTokens:!0}),o.jsx(Fa,{title:"嵌入模型 (embedding)",description:"用于向量化",taskConfig:c.embedding,modelNames:a,onChange:(ge,Le)=>In("embedding",ge,Le),hideTemperature:!0,hideMaxTokens:!0}),o.jsxs("div",{className:"space-y-4",children:[o.jsx("h3",{className:"text-lg font-semibold",children:"LPMM 知识库模型"}),o.jsx(Fa,{title:"实体提取模型 (lpmm_entity_extract)",description:"从文本中提取实体",taskConfig:c.lpmm_entity_extract,modelNames:a,onChange:(ge,Le)=>In("lpmm_entity_extract",ge,Le)}),o.jsx(Fa,{title:"RDF 构建模型 (lpmm_rdf_build)",description:"构建知识图谱",taskConfig:c.lpmm_rdf_build,modelNames:a,onChange:(ge,Le)=>In("lpmm_rdf_build",ge,Le)}),o.jsx(Fa,{title:"问答模型 (lpmm_qa)",description:"知识库问答",taskConfig:c.lpmm_qa,modelNames:a,onChange:(ge,Le)=>In("lpmm_qa",ge,Le)})]})]})]})]}),o.jsx(Dr,{open:_,onOpenChange:nn,children:o.jsxs(Sr,{className:"max-w-[95vw] sm:max-w-2xl max-h-[90vh] overflow-y-auto","data-tour":"model-dialog",preventOutsideClose:It.isRunning,children:[o.jsxs(kr,{children:[o.jsx(Or,{children:B!==null?"编辑模型":"添加模型"}),o.jsx(ss,{children:"配置模型的基本信息和参数"})]}),o.jsxs("div",{className:"grid gap-4 py-4",children:[o.jsxs("div",{className:"grid gap-2","data-tour":"model-name-input",children:[o.jsx(he,{htmlFor:"model_name",children:"模型名称 *"}),o.jsx(ze,{id:"model_name",value:L?.name||"",onChange:ge=>P(Le=>Le?{...Le,name:ge.target.value}:null),placeholder:"例如: qwen3-30b"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"用于在任务配置中引用此模型"})]}),o.jsxs("div",{className:"grid gap-2","data-tour":"model-provider-select",children:[o.jsx(he,{htmlFor:"api_provider",children:"API 提供商 *"}),o.jsxs(Vt,{value:L?.api_provider||"",onValueChange:ge=>{P(Le=>Le?{...Le,api_provider:ge}:null),re([]),Ye(null)},children:[o.jsx($t,{id:"api_provider",children:o.jsx(Ut,{placeholder:"选择提供商"})}),o.jsx(Ht,{children:n.map(ge=>o.jsx(De,{value:ge,children:ge},ge))})]})]}),o.jsxs("div",{className:"grid gap-2","data-tour":"model-identifier-input",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(he,{htmlFor:"model_identifier",children:"模型标识符 *"}),Ve?.modelFetcher&&o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Xn,{variant:"secondary",className:"text-xs",children:Ve.display_name}),o.jsx(de,{variant:"ghost",size:"sm",className:"h-6 px-2",onClick:()=>L?.api_provider&&Mt(L.api_provider,!0),disabled:oe,children:oe?o.jsx(Po,{className:"h-3 w-3 animate-spin"}):o.jsx(Ps,{className:"h-3 w-3"})})]})]}),Ve?.modelFetcher?o.jsxs(zo,{open:Je,onOpenChange:Oe,children:[o.jsx(Io,{asChild:!0,children:o.jsxs(de,{variant:"outline",role:"combobox","aria-expanded":Je,className:"w-full justify-between font-normal",disabled:oe||!!We,children:[oe?o.jsxs("span",{className:"flex items-center gap-2 text-muted-foreground",children:[o.jsx(Po,{className:"h-4 w-4 animate-spin"}),"正在获取模型列表..."]}):We?o.jsx("span",{className:"text-muted-foreground text-sm",children:"点击下方输入框手动填写"}):L?.model_identifier?o.jsx("span",{className:"truncate",children:L.model_identifier}):o.jsx("span",{className:"text-muted-foreground",children:"搜索或选择模型..."}),o.jsx(Mj,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),o.jsx(Xa,{className:"p-0",align:"start",style:{width:"var(--radix-popover-trigger-width)"},children:o.jsxs(Ob,{children:[o.jsx(jb,{placeholder:"搜索模型..."}),o.jsx(gn,{className:"h-[300px]",children:o.jsxs(Nb,{className:"max-h-none overflow-visible",children:[o.jsx(Cb,{children:We?o.jsxs("div",{className:"py-4 px-2 text-center space-y-2",children:[o.jsx("p",{className:"text-sm text-destructive",children:We}),!We.includes("API Key")&&o.jsx(de,{variant:"link",size:"sm",onClick:()=>L?.api_provider&&Mt(L.api_provider,!0),children:"重试"})]}):"未找到匹配的模型"}),o.jsx(ap,{heading:"可用模型",children:se.map(ge=>o.jsxs(op,{value:ge.id,onSelect:()=>{P(Le=>Le?{...Le,model_identifier:ge.id}:null),Oe(!1)},children:[o.jsx(Ro,{className:`mr-2 h-4 w-4 ${L?.model_identifier===ge.id?"opacity-100":"opacity-0"}`}),o.jsxs("div",{className:"flex flex-col",children:[o.jsx("span",{children:ge.id}),ge.name!==ge.id&&o.jsx("span",{className:"text-xs text-muted-foreground",children:ge.name})]})]},ge.id))}),o.jsx(ap,{heading:"手动输入",children:o.jsxs(op,{value:"__manual_input__",onSelect:()=>{Oe(!1)},children:[o.jsx(Yu,{className:"mr-2 h-4 w-4"}),"手动输入模型标识符..."]})})]})})]})})]}):o.jsx(ze,{id:"model_identifier",value:L?.model_identifier||"",onChange:ge=>P(Le=>Le?{...Le,model_identifier:ge.target.value}:null),placeholder:"Qwen/Qwen3-30B-A3B-Instruct-2507"}),We&&Ve?.modelFetcher&&o.jsxs(ga,{variant:"destructive",className:"mt-2 py-2",children:[o.jsx(Oa,{className:"h-4 w-4"}),o.jsx(xa,{className:"text-xs",children:We})]}),Ve?.modelFetcher&&o.jsx(ze,{value:L?.model_identifier||"",onChange:ge=>P(Le=>Le?{...Le,model_identifier:ge.target.value}:null),placeholder:"或手动输入模型标识符",className:"mt-2"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:We?'请手动输入模型标识符,或前往"模型提供商配置"检查 API Key':Ve?.modelFetcher?`已识别为 ${Ve.display_name},支持自动获取模型列表`:"API 提供商提供的模型 ID"})]}),o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"price_in",children:"输入价格 (¥/M token)"}),o.jsx(ze,{id:"price_in",type:"number",step:"0.1",min:"0",value:L?.price_in??"",onChange:ge=>{const Le=ge.target.value===""?null:parseFloat(ge.target.value);P(Ct=>Ct?{...Ct,price_in:Le}:null)},placeholder:"默认: 0"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"price_out",children:"输出价格 (¥/M token)"}),o.jsx(ze,{id:"price_out",type:"number",step:"0.1",min:"0",value:L?.price_out??"",onChange:ge=>{const Le=ge.target.value===""?null:parseFloat(ge.target.value);P(Ct=>Ct?{...Ct,price_out:Le}:null)},placeholder:"默认: 0"})]})]}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Bt,{id:"force_stream_mode",checked:L?.force_stream_mode||!1,onCheckedChange:ge=>P(Le=>Le?{...Le,force_stream_mode:ge}:null)}),o.jsx(he,{htmlFor:"force_stream_mode",className:"cursor-pointer",children:"强制流式输出模式"})]})]}),o.jsxs(ws,{children:[o.jsx(de,{variant:"outline",onClick:()=>A(!1),"data-tour":"model-cancel-button",children:"取消"}),o.jsx(de,{onClick:ot,"data-tour":"model-save-button",children:"保存"})]})]})}),o.jsx(Dn,{open:U,onOpenChange:te,children:o.jsxs(Nn,{children:[o.jsxs(Cn,{children:[o.jsx(En,{children:"确认删除"}),o.jsxs(_n,{children:['确定要删除模型 "',z!==null?t[z]?.name:"",'" 吗? 此操作无法撤销。']})]}),o.jsxs(Tn,{children:[o.jsx(Mn,{children:"取消"}),o.jsx(An,{onClick:pt,children:"删除"})]})]})}),o.jsx(Dn,{open:R,onOpenChange:ie,children:o.jsxs(Nn,{children:[o.jsxs(Cn,{children:[o.jsx(En,{children:"确认批量删除"}),o.jsxs(_n,{children:["确定要删除选中的 ",J.size," 个模型吗? 此操作无法撤销。"]})]}),o.jsxs(Tn,{children:[o.jsx(Mn,{children:"取消"}),o.jsx(An,{onClick:vr,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})}),T&&o.jsx(Kj,{onRestartComplete:rt,onRestartFailed:tn})]})})}function Fa({title:t,description:e,taskConfig:n,modelNames:r,onChange:s,hideTemperature:i=!1,hideMaxTokens:a=!1,dataTour:l}){const c=d=>{s("model_list",d)};return o.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:[o.jsxs("div",{children:[o.jsx("h4",{className:"font-semibold text-base sm:text-lg",children:t}),o.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mt-1",children:e})]}),o.jsxs("div",{className:"grid gap-4",children:[o.jsxs("div",{className:"grid gap-2","data-tour":l,children:[o.jsx(he,{children:"模型列表"}),o.jsx(qve,{options:r.map(d=>({label:d,value:d})),selected:n.model_list||[],onChange:c,placeholder:"选择模型...",emptyText:"暂无可用模型"})]}),o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[!i&&o.jsxs("div",{className:"grid gap-3",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(he,{children:"温度"}),o.jsx(ze,{type:"number",step:"0.1",min:"0",max:"1",value:n.temperature??.3,onChange:d=>{const h=parseFloat(d.target.value);!isNaN(h)&&h>=0&&h<=1&&s("temperature",h)},className:"w-20 h-8 text-sm"})]}),o.jsx(Bp,{value:[n.temperature??.3],onValueChange:d=>s("temperature",d[0]),min:0,max:1,step:.1,className:"w-full"})]}),!a&&o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{children:"最大 Token"}),o.jsx(ze,{type:"number",step:"1",min:"1",value:n.max_tokens??1024,onChange:d=>s("max_tokens",parseInt(d.target.value))})]})]})]})]})}const Pb="/api/webui/config";async function Qve(){const e=await(await St(`${Pb}/adapter-config/path`)).json();return!e.success||!e.path?null:{path:e.path,lastModified:e.lastModified}}async function pM(t){const n=await(await St(`${Pb}/adapter-config/path`,{method:"POST",headers:Dt(),body:JSON.stringify({path:t})})).json();if(!n.success)throw new Error(n.message||"保存路径失败")}async function gM(t){const n=await(await St(`${Pb}/adapter-config?path=${encodeURIComponent(t)}`)).json();if(!n.success)throw new Error("读取配置文件失败");return n.content}async function xM(t,e){const r=await(await St(`${Pb}/adapter-config`,{method:"POST",headers:Dt(),body:JSON.stringify({path:t,content:e})})).json();if(!r.success)throw new Error(r.message||"保存配置失败")}const Fi={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"}},CS={oneclick:{name:"一键包",description:"使用一键包部署的适配器配置",path:"../MaiBot-Napcat-Adapter/config.toml",icon:Gh},docker:{name:"Docker",description:"Docker Compose 部署的适配器配置",path:"/MaiMBot/adapters-config/config.toml",icon:Kee}};function Vve(){const[t,e]=b.useState("upload"),[n,r]=b.useState(null),[s,i]=b.useState(""),[a,l]=b.useState(""),[c,d]=b.useState("oneclick"),[h,m]=b.useState(""),[g,x]=b.useState(!1),[y,w]=b.useState(!1),[S,k]=b.useState(!1),[j,N]=b.useState(!1),[T,E]=b.useState(null),_=b.useRef(null),{toast:A}=as(),L=b.useRef(null),P=W=>{if(!W.trim())return{valid:!1,error:"路径不能为空"};if(!W.toLowerCase().endsWith(".toml"))return{valid:!1,error:"文件必须是 .toml 格式"};const se=/^([a-zA-Z]:\\|\\\\[^\\]+\\[^\\]+\\).+\.toml$/i,re=/^(\/|~\/).+\.toml$/i,oe=/^(\.{1,2}[\\/]|[^:\\/]).+\.toml$/i,Te=se.test(W),We=re.test(W),Ye=oe.test(W);return!Te&&!We&&!Ye?{valid:!1,error:"路径格式错误"}:/[<>"|?*\x00-\x1F]/.test(W)?{valid:!1,error:"路径包含非法字符"}:{valid:!0,error:""}},B=W=>{if(l(W),W.trim()){const se=P(W);m(se.error)}else m("")},$=b.useCallback(async W=>{const se=CS[W];w(!0);try{const re=await gM(se.path),oe=G(re);r(oe),d(W),l(se.path),await pM(se.path),A({title:"加载成功",description:`已从${se.name}预设加载配置`})}catch(re){console.error("加载预设配置失败:",re),A({title:"加载失败",description:re instanceof Error?re.message:"无法读取预设配置文件",variant:"destructive"})}finally{w(!1)}},[A]),U=b.useCallback(async W=>{const se=P(W);if(!se.valid){m(se.error),A({title:"路径无效",description:se.error,variant:"destructive"});return}m(""),w(!0);try{const re=await gM(W),oe=G(re);r(oe),l(W),await pM(W),A({title:"加载成功",description:"已从配置文件加载"})}catch(re){console.error("加载配置失败:",re),A({title:"加载失败",description:re instanceof Error?re.message:"无法读取配置文件",variant:"destructive"})}finally{w(!1)}},[A]);b.useEffect(()=>{(async()=>{try{const se=await Qve();if(se&&se.path){l(se.path);const re=Object.entries(CS).find(([,oe])=>oe.path===se.path);re?(e("preset"),d(re[0]),await $(re[0])):(e("path"),await U(se.path))}}catch(se){console.error("加载保存的路径失败:",se)}})()},[U,$]);const te=b.useCallback(W=>{t!=="path"&&t!=="preset"||!a||(L.current&&clearTimeout(L.current),L.current=setTimeout(async()=>{x(!0);try{const se=I(W);await xM(a,se),A({title:"自动保存成功",description:"配置已保存到文件"})}catch(se){console.error("自动保存失败:",se),A({title:"自动保存失败",description:se instanceof Error?se.message:"保存配置失败",variant:"destructive"})}finally{x(!1)}},1e3))},[t,a,A]),z=async()=>{if(!n||!a)return;const W=P(a);if(!W.valid){A({title:"保存失败",description:W.error,variant:"destructive"});return}x(!0);try{const se=I(n);await xM(a,se),A({title:"保存成功",description:"配置已保存到文件"})}catch(se){console.error("保存失败:",se),A({title:"保存失败",description:se instanceof Error?se.message:"保存配置失败",variant:"destructive"})}finally{x(!1)}},Q=async()=>{a&&await U(a)},F=W=>{if(W!==t){if(n){E(W),k(!0);return}Y(W)}},Y=W=>{r(null),i(""),m(""),e(W),W==="preset"&&$("oneclick"),A({title:"已切换模式",description:{upload:"现在可以上传配置文件",path:"现在可以指定配置文件路径",preset:"现在可以使用预设配置"}[W]})},J=()=>{T&&(Y(T),E(null)),k(!1)},X=()=>{if(n){N(!0);return}R()},R=()=>{l(""),r(null),m(""),A({title:"已清空",description:"路径和配置已清空"})},ie=()=>{R(),N(!1)},G=W=>{const se=JSON.parse(JSON.stringify(Fi)),re=W.split(`
`);let oe="";for(const Te of re){const We=Te.trim();if(!We||We.startsWith("#"))continue;const Ye=We.match(/^\[(\w+)\]/);if(Ye){oe=Ye[1];continue}const Je=We.match(/^(\w+)\s*=\s*(.+)$/);if(Je&&oe){const[,Oe,Ve]=Je;let Ue=Ve.trim();const He=Ue.match(/^("[^"]*")/);if(He)Ue=He[1];else{const xt=Ue.indexOf("#");xt!==-1&&(Ue=Ue.substring(0,xt).trim())}let Ot;if(Ue==="true")Ot=!0;else if(Ue==="false")Ot=!1;else if(Ue.startsWith("[")&&Ue.endsWith("]")){const xt=Ue.slice(1,-1).trim();if(xt){const kn=xt.split(",").map(Yt=>{const _t=Yt.trim();return isNaN(Number(_t))?_t.replace(/"/g,""):Number(_t)}),It=typeof kn[0];Ot=kn.every(Yt=>typeof Yt===It)?kn:kn.filter(Yt=>typeof Yt=="number")}else Ot=[]}else Ue.startsWith('"')&&Ue.endsWith('"')?Ot=Ue.slice(1,-1):isNaN(Number(Ue))?Ot=Ue.replace(/"/g,""):Ot=Number(Ue);if(oe in se){const xt=se[oe];xt[Oe]=Ot}}}return se},I=W=>{const se=[],re=(oe,Te)=>oe===""||oe===null||oe===void 0?Te:oe;return se.push("[inner]"),se.push(`version = "${re(W.inner.version,Fi.inner.version)}" # 版本号`),se.push("# 请勿修改版本号,除非你知道自己在做什么"),se.push(""),se.push("[nickname] # 现在没用"),se.push(`nickname = "${re(W.nickname.nickname,Fi.nickname.nickname)}"`),se.push(""),se.push("[napcat_server] # Napcat连接的ws服务设置"),se.push(`host = "${re(W.napcat_server.host,Fi.napcat_server.host)}" # Napcat设定的主机地址`),se.push(`port = ${re(W.napcat_server.port||0,Fi.napcat_server.port)} # Napcat设定的端口`),se.push(`token = "${re(W.napcat_server.token,Fi.napcat_server.token)}" # Napcat设定的访问令牌若无则留空`),se.push(`heartbeat_interval = ${re(W.napcat_server.heartbeat_interval||0,Fi.napcat_server.heartbeat_interval)} # 与Napcat设置的心跳相同按秒计`),se.push(""),se.push("[maibot_server] # 连接麦麦的ws服务设置"),se.push(`host = "${re(W.maibot_server.host,Fi.maibot_server.host)}" # 麦麦在.env文件中设置的主机地址即HOST字段`),se.push(`port = ${re(W.maibot_server.port||0,Fi.maibot_server.port)} # 麦麦在.env文件中设置的端口即PORT字段`),se.push(""),se.push("[chat] # 黑白名单功能"),se.push(`group_list_type = "${re(W.chat.group_list_type,Fi.chat.group_list_type)}" # 群组名单类型可选为whitelist, blacklist`),se.push(`group_list = [${W.chat.group_list.join(", ")}] # 群组名单`),se.push("# 当group_list_type为whitelist时只有群组名单中的群组可以聊天"),se.push("# 当group_list_type为blacklist时群组名单中的任何群组无法聊天"),se.push(`private_list_type = "${re(W.chat.private_list_type,Fi.chat.private_list_type)}" # 私聊名单类型可选为whitelist, blacklist`),se.push(`private_list = [${W.chat.private_list.join(", ")}] # 私聊名单`),se.push("# 当private_list_type为whitelist时只有私聊名单中的用户可以聊天"),se.push("# 当private_list_type为blacklist时私聊名单中的任何用户无法聊天"),se.push(`ban_user_id = [${W.chat.ban_user_id.join(", ")}] # 全局禁止名单(全局禁止名单中的用户无法进行任何聊天)`),se.push(`ban_qq_bot = ${W.chat.ban_qq_bot} # 是否屏蔽QQ官方机器人`),se.push(`enable_poke = ${W.chat.enable_poke} # 是否启用戳一戳功能`),se.push(""),se.push("[voice] # 发送语音设置"),se.push(`use_tts = ${W.voice.use_tts} # 是否使用tts语音请确保你配置了tts并有对应的adapter`),se.push(""),se.push("[debug]"),se.push(`level = "${re(W.debug.level,Fi.debug.level)}" # 日志等级DEBUG, INFO, WARNING, ERROR, CRITICAL`),se.join(`
`)},V=W=>{const se=W.target.files?.[0];if(!se)return;const re=new FileReader;re.onload=oe=>{try{const Te=oe.target?.result,We=G(Te);r(We),i(se.name),A({title:"上传成功",description:`已加载配置文件:${se.name}`})}catch(Te){console.error("解析配置文件失败:",Te),A({title:"解析失败",description:"配置文件格式错误,请检查文件内容",variant:"destructive"})}},re.readAsText(se)},ee=()=>{if(!n)return;const W=I(n),se=new Blob([W],{type:"text/plain;charset=utf-8"}),re=URL.createObjectURL(se),oe=document.createElement("a");oe.href=re,oe.download=s||"config.toml",document.body.appendChild(oe),oe.click(),document.body.removeChild(oe),URL.revokeObjectURL(re),A({title:"下载成功",description:"配置文件已下载,请手动覆盖并重启适配器"})},ne=()=>{r(JSON.parse(JSON.stringify(Fi))),i("config.toml"),A({title:"已加载默认配置",description:"可以开始编辑配置"})};return o.jsx(gn,{className:"h-full",children:o.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[o.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:o.jsxs("div",{children:[o.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"麦麦适配器配置"}),o.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理麦麦的 QQ 适配器的配置文件"})]})}),o.jsxs("div",{className:"flex items-start gap-2 p-3 rounded-lg border border-amber-500/50 bg-amber-500/10 text-amber-700 dark:text-amber-400",children:[o.jsx(Uc,{className:"h-4 w-4 mt-0.5 flex-shrink-0"}),o.jsx("p",{className:"text-sm",children:"适配器配置保存之后使用 WebUI 的重启功能适配器并不会重启,需要手动重启适配器。"})]}),o.jsxs(qt,{children:[o.jsxs(Fn,{children:[o.jsx(qn,{children:"工作模式"}),o.jsx(ts,{children:"选择配置文件的管理方式"})]}),o.jsxs(Gn,{className:"space-y-4",children:[o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3 md:gap-4",children:[o.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:()=>F("preset"),children:o.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[o.jsx(Gh,{className:"h-4 w-4 md:h-5 md:w-5 mt-0.5 flex-shrink-0"}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("h3",{className:"font-semibold text-sm md:text-base",children:"预设模式"}),o.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-1 line-clamp-2",children:"使用预设的部署配置"})]})]})}),o.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:()=>F("upload"),children:o.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[o.jsx(b9,{className:"h-4 w-4 md:h-5 md:w-5 mt-0.5 flex-shrink-0"}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("h3",{className:"font-semibold text-sm md:text-base",children:"上传文件模式"}),o.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-1 line-clamp-2",children:"上传配置文件,编辑后下载并手动覆盖"})]})]})}),o.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:()=>F("path"),children:o.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[o.jsx(Zee,{className:"h-4 w-4 md:h-5 md:w-5 mt-0.5 flex-shrink-0"}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("h3",{className:"font-semibold text-sm md:text-base",children:"指定路径模式"}),o.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-1 line-clamp-2",children:"指定配置文件路径,自动加载和保存"})]})]})})]}),t==="preset"&&o.jsxs("div",{className:"space-y-3 pt-2 border-t",children:[o.jsx(he,{className:"text-sm md:text-base",children:"选择部署方式"}),o.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:Object.entries(CS).map(([W,se])=>{const re=se.icon,oe=c===W;return o.jsx("div",{className:`border-2 rounded-lg p-3 cursor-pointer transition-all ${oe?"border-primary bg-primary/5":"border-muted hover:border-primary/50"}`,onClick:()=>{d(W),$(W)},children:o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsx(re,{className:"h-5 w-5 mt-0.5 flex-shrink-0"}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("h4",{className:"font-semibold text-sm",children:se.name}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:se.description}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1 font-mono break-all",children:se.path})]})]})},W)})})]}),t==="path"&&o.jsxs("div",{className:"space-y-3 pt-2 border-t",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{htmlFor:"config-path",className:"text-sm md:text-base",children:"配置文件路径"}),o.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[o.jsxs("div",{className:"flex-1 space-y-1",children:[o.jsx(ze,{id:"config-path",value:a,onChange:W=>B(W.target.value),placeholder:"例: C:\\Adapter\\config.toml",className:`text-sm ${h?"border-destructive":""}`}),h&&o.jsx("p",{className:"text-xs text-destructive",children:h})]}),o.jsx(de,{onClick:()=>U(a),disabled:y||!a||!!h,className:"w-full sm:w-auto",children:y?o.jsxs(o.Fragment,{children:[o.jsx(Ps,{className:"h-4 w-4 animate-spin mr-2"}),o.jsx("span",{className:"sm:hidden",children:"加载中..."})]}):o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"sm:hidden",children:"加载配置"}),o.jsx("span",{className:"hidden sm:inline",children:"加载"})]})})]})]}),o.jsxs("details",{className:"rounded-lg bg-muted/50 p-3 group",children:[o.jsxs("summary",{className:"text-xs font-medium cursor-pointer select-none list-none flex items-center justify-between",children:[o.jsx("span",{children:"路径格式说明"}),o.jsx("svg",{className:"h-4 w-4 transition-transform group-open:rotate-180",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),o.jsxs("div",{className:"mt-2 space-y-2 text-xs text-muted-foreground",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx("div",{className:"flex items-center gap-2",children:o.jsx("span",{className:"font-mono bg-background px-1.5 py-0.5 rounded text-[10px] md:text-xs whitespace-nowrap",children:"Windows"})}),o.jsxs("div",{className:"pl-2 space-y-0.5 text-[10px] md:text-xs break-all",children:[o.jsx("div",{children:"C:\\Adapter\\config.toml"}),o.jsx("div",{className:"hidden sm:block",children:"D:\\MaiBot\\adapter\\config.toml"}),o.jsx("div",{className:"hidden sm:block",children:"\\\\server\\share\\config.toml"})]})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx("div",{className:"flex items-center gap-2",children:o.jsx("span",{className:"font-mono bg-background px-1.5 py-0.5 rounded text-[10px] md:text-xs whitespace-nowrap",children:"Linux"})}),o.jsxs("div",{className:"pl-2 space-y-0.5 text-[10px] md:text-xs break-all",children:[o.jsx("div",{children:"/opt/adapter/config.toml"}),o.jsx("div",{className:"hidden sm:block",children:"/home/user/adapter/config.toml"}),o.jsx("div",{className:"hidden sm:block",children:"~/adapter/config.toml"})]})]}),o.jsx("p",{className:"pt-1 border-t text-[10px] md:text-xs",children:"💡 配置会自动保存到指定文件,修改后 1 秒自动保存"})]})]})]})]})]}),o.jsxs(ga,{children:[o.jsx(Oa,{className:"h-4 w-4"}),o.jsx(xa,{children:t==="preset"?o.jsxs(o.Fragment,{children:[o.jsx("strong",{children:"预设模式:"}),"选择预设的部署方式,配置会自动加载,修改后 1 秒自动保存",g&&" (正在保存...)"]}):t==="upload"?o.jsxs(o.Fragment,{children:[o.jsx("strong",{children:"上传文件模式:"}),"上传配置文件 → 在线编辑 → 下载文件 → 手动覆盖并重启适配器"]}):o.jsxs(o.Fragment,{children:[o.jsx("strong",{children:"指定路径模式:"}),"指定配置文件路径后,配置会自动加载,修改后 1 秒自动保存",g&&" (正在保存...)"]})})]}),t==="upload"&&!n&&o.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 w-full",children:[o.jsx("input",{ref:_,type:"file",accept:".toml",className:"hidden",onChange:V}),o.jsxs(de,{onClick:()=>_.current?.click(),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[o.jsx(b9,{className:"mr-2 h-4 w-4"}),"上传配置"]}),o.jsxs(de,{onClick:ne,size:"sm",className:"w-full sm:w-auto",children:[o.jsx(zl,{className:"mr-2 h-4 w-4"}),"使用默认配置"]})]}),t==="upload"&&n&&o.jsx("div",{className:"flex gap-2",children:o.jsxs(de,{onClick:ee,size:"sm",className:"w-full sm:w-auto",children:[o.jsx(Ku,{className:"mr-2 h-4 w-4"}),"下载配置"]})}),(t==="preset"||t==="path")&&n&&o.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[o.jsxs(de,{onClick:z,size:"sm",disabled:g||!!h,className:"w-full sm:w-auto",children:[o.jsx(Gy,{className:"mr-2 h-4 w-4"}),g?"保存中...":"立即保存"]}),o.jsxs(de,{onClick:Q,size:"sm",variant:"outline",disabled:y,className:"w-full sm:w-auto",children:[o.jsx(Ps,{className:`mr-2 h-4 w-4 ${y?"animate-spin":""}`}),"刷新"]}),t==="path"&&o.jsxs(de,{onClick:X,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[o.jsx(Sn,{className:"mr-2 h-4 w-4"}),"清空路径"]})]}),n?o.jsxs(ja,{defaultValue:"napcat",className:"w-full",children:[o.jsx("div",{className:"overflow-x-auto -mx-4 px-4 sm:mx-0 sm:px-0",children:o.jsxs(Wi,{className:"inline-flex w-auto min-w-full sm:grid sm:w-full sm:grid-cols-5",children:[o.jsxs(Lt,{value:"napcat",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[o.jsx("span",{className:"hidden sm:inline",children:"Napcat 连接"}),o.jsx("span",{className:"sm:hidden",children:"Napcat"})]}),o.jsxs(Lt,{value:"maibot",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[o.jsx("span",{className:"hidden sm:inline",children:"麦麦连接"}),o.jsx("span",{className:"sm:hidden",children:"麦麦"})]}),o.jsxs(Lt,{value:"chat",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[o.jsx("span",{className:"hidden sm:inline",children:"聊天控制"}),o.jsx("span",{className:"sm:hidden",children:"聊天"})]}),o.jsxs(Lt,{value:"voice",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[o.jsx("span",{className:"hidden sm:inline",children:"语音设置"}),o.jsx("span",{className:"sm:hidden",children:"语音"})]}),o.jsx(Lt,{value:"debug",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:"调试"})]})}),o.jsx(un,{value:"napcat",className:"space-y-4",children:o.jsx(Uve,{config:n,onChange:W=>{r(W),te(W)}})}),o.jsx(un,{value:"maibot",className:"space-y-4",children:o.jsx(Wve,{config:n,onChange:W=>{r(W),te(W)}})}),o.jsx(un,{value:"chat",className:"space-y-4",children:o.jsx(Gve,{config:n,onChange:W=>{r(W),te(W)}})}),o.jsx(un,{value:"voice",className:"space-y-4",children:o.jsx(Xve,{config:n,onChange:W=>{r(W),te(W)}})}),o.jsx(un,{value:"debug",className:"space-y-4",children:o.jsx(Yve,{config:n,onChange:W=>{r(W),te(W)}})})]}):o.jsx("div",{className:"rounded-lg border bg-card p-6 md:p-12",children:o.jsxs("div",{className:"text-center space-y-3 md:space-y-4",children:[o.jsx(zl,{className:"h-12 w-12 md:h-16 md:w-16 mx-auto text-muted-foreground"}),o.jsxs("div",{children:[o.jsx("h3",{className:"text-base md:text-lg font-semibold",children:"尚未加载配置"}),o.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-2 px-4",children:t==="preset"?"请选择预设的部署方式":t==="upload"?"请上传现有配置文件,或使用默认配置开始编辑":"请指定配置文件路径并点击加载按钮"})]})]})}),o.jsx(Dn,{open:S,onOpenChange:k,children:o.jsxs(Nn,{children:[o.jsxs(Cn,{children:[o.jsx(En,{children:"确认切换模式"}),o.jsxs(_n,{children:["切换模式将清空当前配置,确定要继续吗?",o.jsx("br",{}),o.jsx("span",{className:"text-destructive font-medium",children:"请确保已保存重要配置"})]})]}),o.jsxs(Tn,{children:[o.jsx(Mn,{onClick:()=>{k(!1),E(null)},children:"取消"}),o.jsx(An,{onClick:J,children:"确认切换"})]})]})}),o.jsx(Dn,{open:j,onOpenChange:N,children:o.jsxs(Nn,{children:[o.jsxs(Cn,{children:[o.jsx(En,{children:"确认清空路径"}),o.jsxs(_n,{children:["清空路径将清除当前配置,确定要继续吗?",o.jsx("br",{}),o.jsx("span",{className:"text-muted-foreground text-sm",children:"此操作不会删除配置文件,只是清除界面中的配置"})]})]}),o.jsxs(Tn,{children:[o.jsx(Mn,{onClick:()=>N(!1),children:"取消"}),o.jsx(An,{onClick:ie,className:"bg-destructive hover:bg-destructive/90",children:"确认清空"})]})]})})]})})}function Uve({config:t,onChange:e}){return o.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:o.jsxs("div",{children:[o.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"Napcat WebSocket 服务设置"}),o.jsxs("div",{className:"grid gap-3 md:gap-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"napcat-host",className:"text-sm md:text-base",children:"主机地址"}),o.jsx(ze,{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"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的主机地址"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"napcat-port",className:"text-sm md:text-base",children:"端口"}),o.jsx(ze,{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"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的端口(留空使用默认值 8095"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"napcat-token",className:"text-sm md:text-base",children:"访问令牌Token"}),o.jsx(ze,{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"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的访问令牌,若无则留空"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"napcat-heartbeat",className:"text-sm md:text-base",children:"心跳间隔(秒)"}),o.jsx(ze,{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"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"与 Napcat 设置的心跳间隔保持一致(留空使用默认值 30"})]})]})]})})}function Wve({config:t,onChange:e}){return o.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:o.jsxs("div",{children:[o.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"麦麦 WebSocket 服务设置"}),o.jsxs("div",{className:"grid gap-3 md:gap-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"maibot-host",className:"text-sm md:text-base",children:"主机地址"}),o.jsx(ze,{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"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦在 .env 文件中设置的 HOST 字段"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"maibot-port",className:"text-sm md:text-base",children:"端口"}),o.jsx(ze,{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"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦在 .env 文件中设置的 PORT 字段(留空使用默认值 8000"})]})]})]})})}function Gve({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 l={...t};i==="group"?l.chat.group_list=l.chat.group_list.filter((c,d)=>d!==a):i==="private"?l.chat.private_list=l.chat.private_list.filter((c,d)=>d!==a):l.chat.ban_user_id=l.chat.ban_user_id.filter((c,d)=>d!==a),e(l)},s=(i,a,l)=>{const c={...t};i==="group"?c.chat.group_list[a]=l:i==="private"?c.chat.private_list[a]=l:c.chat.ban_user_id[a]=l,e(c)};return o.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:o.jsxs("div",{children:[o.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"聊天黑白名单功能"}),o.jsxs("div",{className:"grid gap-4 md:gap-6",children:[o.jsxs("div",{className:"space-y-3 md:space-y-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{className:"text-sm md:text-base",children:"群组名单类型"}),o.jsxs(Vt,{value:t.chat.group_list_type,onValueChange:i=>e({...t,chat:{...t.chat,group_list_type:i}}),children:[o.jsx($t,{children:o.jsx(Ut,{})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"whitelist",children:"白名单(仅名单内可聊天)"}),o.jsx(De,{value:"blacklist",children:"黑名单(名单内禁止聊天)"})]})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[o.jsx(he,{className:"text-sm md:text-base",children:"群组列表"}),o.jsxs(de,{onClick:()=>n("group"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[o.jsx(zl,{className:"mr-1 h-4 w-4"}),"添加群号"]})]}),t.chat.group_list.map((i,a)=>o.jsxs("div",{className:"flex gap-2",children:[o.jsx(ze,{type:"number",value:i,onChange:l=>s("group",a,parseInt(l.target.value)||0),placeholder:"输入群号",className:"text-sm md:text-base"}),o.jsxs(Dn,{children:[o.jsx(rs,{asChild:!0,children:o.jsx(de,{size:"icon",variant:"outline",children:o.jsx(Sn,{className:"h-4 w-4"})})}),o.jsxs(Nn,{children:[o.jsxs(Cn,{children:[o.jsx(En,{children:"确认删除"}),o.jsxs(_n,{children:["确定要删除群号 ",i," 吗?此操作无法撤销。"]})]}),o.jsxs(Tn,{children:[o.jsx(Mn,{children:"取消"}),o.jsx(An,{onClick:()=>r("group",a),children:"删除"})]})]})]})]},a)),t.chat.group_list.length===0&&o.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无群组"})]})]}),o.jsxs("div",{className:"space-y-3 md:space-y-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{className:"text-sm md:text-base",children:"私聊名单类型"}),o.jsxs(Vt,{value:t.chat.private_list_type,onValueChange:i=>e({...t,chat:{...t.chat,private_list_type:i}}),children:[o.jsx($t,{children:o.jsx(Ut,{})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"whitelist",children:"白名单(仅名单内可聊天)"}),o.jsx(De,{value:"blacklist",children:"黑名单(名单内禁止聊天)"})]})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[o.jsx(he,{className:"text-sm md:text-base",children:"私聊列表"}),o.jsxs(de,{onClick:()=>n("private"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[o.jsx(zl,{className:"mr-1 h-4 w-4"}),"添加用户"]})]}),t.chat.private_list.map((i,a)=>o.jsxs("div",{className:"flex gap-2",children:[o.jsx(ze,{type:"number",value:i,onChange:l=>s("private",a,parseInt(l.target.value)||0),placeholder:"输入QQ号",className:"text-sm md:text-base"}),o.jsxs(Dn,{children:[o.jsx(rs,{asChild:!0,children:o.jsx(de,{size:"icon",variant:"outline",children:o.jsx(Sn,{className:"h-4 w-4"})})}),o.jsxs(Nn,{children:[o.jsxs(Cn,{children:[o.jsx(En,{children:"确认删除"}),o.jsxs(_n,{children:["确定要删除用户 ",i," 吗?此操作无法撤销。"]})]}),o.jsxs(Tn,{children:[o.jsx(Mn,{children:"取消"}),o.jsx(An,{onClick:()=>r("private",a),children:"删除"})]})]})]})]},a)),t.chat.private_list.length===0&&o.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无用户"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[o.jsxs("div",{children:[o.jsx(he,{className:"text-sm md:text-base",children:"全局禁止名单"}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"名单中的用户无法进行任何聊天"})]}),o.jsxs(de,{onClick:()=>n("ban"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[o.jsx(zl,{className:"mr-1 h-4 w-4"}),"添加用户"]})]}),t.chat.ban_user_id.map((i,a)=>o.jsxs("div",{className:"flex gap-2",children:[o.jsx(ze,{type:"number",value:i,onChange:l=>s("ban",a,parseInt(l.target.value)||0),placeholder:"输入QQ号",className:"text-sm md:text-base"}),o.jsxs(Dn,{children:[o.jsx(rs,{asChild:!0,children:o.jsx(de,{size:"icon",variant:"outline",children:o.jsx(Sn,{className:"h-4 w-4"})})}),o.jsxs(Nn,{children:[o.jsxs(Cn,{children:[o.jsx(En,{children:"确认删除"}),o.jsxs(_n,{children:["确定要从全局禁止名单中删除用户 ",i," 吗?此操作无法撤销。"]})]}),o.jsxs(Tn,{children:[o.jsx(Mn,{children:"取消"}),o.jsx(An,{onClick:()=>r("ban",a),children:"删除"})]})]})]})]},a)),t.chat.ban_user_id.length===0&&o.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无禁止用户"})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsx(he,{className:"text-sm md:text-base",children:"屏蔽QQ官方机器人"}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"是否屏蔽来自QQ官方机器人的消息"})]}),o.jsx(Bt,{checked:t.chat.ban_qq_bot,onCheckedChange:i=>e({...t,chat:{...t.chat,ban_qq_bot:i}})})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsx(he,{className:"text-sm md:text-base",children:"启用戳一戳功能"}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"是否响应戳一戳消息"})]}),o.jsx(Bt,{checked:t.chat.enable_poke,onCheckedChange:i=>e({...t,chat:{...t.chat,enable_poke:i}})})]})]})]})})}function Xve({config:t,onChange:e}){return o.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:o.jsxs("div",{children:[o.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"发送语音设置"}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsx(he,{className:"text-sm md:text-base",children:"使用 TTS 语音"}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"请确保已配置 TTS 并有对应的适配器"})]}),o.jsx(Bt,{checked:t.voice.use_tts,onCheckedChange:n=>e({...t,voice:{use_tts:n}})})]})]})})}function Yve({config:t,onChange:e}){return o.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:o.jsxs("div",{children:[o.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"调试设置"}),o.jsx("div",{className:"grid gap-3 md:gap-4",children:o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{className:"text-sm md:text-base",children:"日志等级"}),o.jsxs(Vt,{value:t.debug.level,onValueChange:n=>e({...t,debug:{level:n}}),children:[o.jsx($t,{children:o.jsx(Ut,{})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"DEBUG",children:"DEBUG调试"}),o.jsx(De,{value:"INFO",children:"INFO信息"}),o.jsx(De,{value:"WARNING",children:"WARNING警告"}),o.jsx(De,{value:"ERROR",children:"ERROR错误"}),o.jsx(De,{value:"CRITICAL",children:"CRITICAL严重"})]})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"设置适配器的日志输出等级"})]})})]})})}function vM(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 Kve(t,e){const n={};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const Zve=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Jve=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,eye={};function yM(t,e){return(eye.jsx?Jve:Zve).test(t)}const tye=/[ \t\n\f\r]/g;function nye(t){return typeof t=="object"?t.type==="text"?bM(t.value):!1:bM(t)}function bM(t){return t.replace(tye,"")===""}class ug{constructor(e,n,r){this.normal=n,this.property=e,r&&(this.space=r)}}ug.prototype.normal={};ug.prototype.property={};ug.prototype.space=void 0;function qQ(t,e){const n={},r={};for(const s of t)Object.assign(n,s.property),Object.assign(r,s.normal);return new ug(n,r,e)}function mp(t){return t.toLowerCase()}class Ei{constructor(e,n){this.attribute=n,this.property=e}}Ei.prototype.attribute="";Ei.prototype.booleanish=!1;Ei.prototype.boolean=!1;Ei.prototype.commaOrSpaceSeparated=!1;Ei.prototype.commaSeparated=!1;Ei.prototype.defined=!1;Ei.prototype.mustUseProperty=!1;Ei.prototype.number=!1;Ei.prototype.overloadedBoolean=!1;Ei.prototype.property="";Ei.prototype.spaceSeparated=!1;Ei.prototype.space=void 0;let rye=0;const Jt=wd(),Jr=wd(),TO=wd(),Qe=wd(),ur=wd(),qh=wd(),qi=wd();function wd(){return 2**++rye}const EO=Object.freeze(Object.defineProperty({__proto__:null,boolean:Jt,booleanish:Jr,commaOrSpaceSeparated:qi,commaSeparated:qh,number:Qe,overloadedBoolean:TO,spaceSeparated:ur},Symbol.toStringTag,{value:"Module"})),TS=Object.keys(EO);class aN extends Ei{constructor(e,n,r,s){let i=-1;if(super(e,n),wM(this,"space",s),typeof r=="number")for(;++i<TS.length;){const a=TS[i];wM(this,TS[i],(r&EO[a])===EO[a])}}}aN.prototype.defined=!0;function wM(t,e,n){n&&(t[e]=n)}function Bf(t){const e={},n={};for(const[r,s]of Object.entries(t.properties)){const i=new aN(r,t.transform(t.attributes||{},r),s,t.space);t.mustUseProperty&&t.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),e[r]=i,n[mp(r)]=r,n[mp(i.attribute)]=r}return new ug(e,n,t.space)}const $Q=Bf({properties:{ariaActiveDescendant:null,ariaAtomic:Jr,ariaAutoComplete:null,ariaBusy:Jr,ariaChecked:Jr,ariaColCount:Qe,ariaColIndex:Qe,ariaColSpan:Qe,ariaControls:ur,ariaCurrent:null,ariaDescribedBy:ur,ariaDetails:null,ariaDisabled:Jr,ariaDropEffect:ur,ariaErrorMessage:null,ariaExpanded:Jr,ariaFlowTo:ur,ariaGrabbed:Jr,ariaHasPopup:null,ariaHidden:Jr,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:ur,ariaLevel:Qe,ariaLive:null,ariaModal:Jr,ariaMultiLine:Jr,ariaMultiSelectable:Jr,ariaOrientation:null,ariaOwns:ur,ariaPlaceholder:null,ariaPosInSet:Qe,ariaPressed:Jr,ariaReadOnly:Jr,ariaRelevant:null,ariaRequired:Jr,ariaRoleDescription:ur,ariaRowCount:Qe,ariaRowIndex:Qe,ariaRowSpan:Qe,ariaSelected:Jr,ariaSetSize:Qe,ariaSort:null,ariaValueMax:Qe,ariaValueMin:Qe,ariaValueNow:Qe,ariaValueText:null,role:null},transform(t,e){return e==="role"?e:"aria-"+e.slice(4).toLowerCase()}});function HQ(t,e){return e in t?t[e]:e}function QQ(t,e){return HQ(t,e.toLowerCase())}const sye=Bf({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:qh,acceptCharset:ur,accessKey:ur,action:null,allow:null,allowFullScreen:Jt,allowPaymentRequest:Jt,allowUserMedia:Jt,alt:null,as:null,async:Jt,autoCapitalize:null,autoComplete:ur,autoFocus:Jt,autoPlay:Jt,blocking:ur,capture:null,charSet:null,checked:Jt,cite:null,className:ur,cols:Qe,colSpan:null,content:null,contentEditable:Jr,controls:Jt,controlsList:ur,coords:Qe|qh,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Jt,defer:Jt,dir:null,dirName:null,disabled:Jt,download:TO,draggable:Jr,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Jt,formTarget:null,headers:ur,height:Qe,hidden:TO,high:Qe,href:null,hrefLang:null,htmlFor:ur,httpEquiv:ur,id:null,imageSizes:null,imageSrcSet:null,inert:Jt,inputMode:null,integrity:null,is:null,isMap:Jt,itemId:null,itemProp:ur,itemRef:ur,itemScope:Jt,itemType:ur,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Jt,low:Qe,manifest:null,max:null,maxLength:Qe,media:null,method:null,min:null,minLength:Qe,multiple:Jt,muted:Jt,name:null,nonce:null,noModule:Jt,noValidate:Jt,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Jt,optimum:Qe,pattern:null,ping:ur,placeholder:null,playsInline:Jt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Jt,referrerPolicy:null,rel:ur,required:Jt,reversed:Jt,rows:Qe,rowSpan:Qe,sandbox:ur,scope:null,scoped:Jt,seamless:Jt,selected:Jt,shadowRootClonable:Jt,shadowRootDelegatesFocus:Jt,shadowRootMode:null,shape:null,size:Qe,sizes:null,slot:null,span:Qe,spellCheck:Jr,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Qe,step:null,style:null,tabIndex:Qe,target:null,title:null,translate:null,type:null,typeMustMatch:Jt,useMap:null,value:Jr,width:Qe,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:ur,axis:null,background:null,bgColor:null,border:Qe,borderColor:null,bottomMargin:Qe,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Jt,declare:Jt,event:null,face:null,frame:null,frameBorder:null,hSpace:Qe,leftMargin:Qe,link:null,longDesc:null,lowSrc:null,marginHeight:Qe,marginWidth:Qe,noResize:Jt,noHref:Jt,noShade:Jt,noWrap:Jt,object:null,profile:null,prompt:null,rev:null,rightMargin:Qe,rules:null,scheme:null,scrolling:Jr,standby:null,summary:null,text:null,topMargin:Qe,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Qe,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Jt,disableRemotePlayback:Jt,prefix:null,property:null,results:Qe,security:null,unselectable:null},space:"html",transform:QQ}),iye=Bf({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:qi,accentHeight:Qe,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Qe,amplitude:Qe,arabicForm:null,ascent:Qe,attributeName:null,attributeType:null,azimuth:Qe,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Qe,by:null,calcMode:null,capHeight:Qe,className:ur,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Qe,diffuseConstant:Qe,direction:null,display:null,dur:null,divisor:Qe,dominantBaseline:null,download:Jt,dx:null,dy:null,edgeMode:null,editable:null,elevation:Qe,enableBackground:null,end:null,event:null,exponent:Qe,externalResourcesRequired:null,fill:null,fillOpacity:Qe,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:qh,g2:qh,glyphName:qh,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Qe,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Qe,horizOriginX:Qe,horizOriginY:Qe,id:null,ideographic:Qe,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Qe,k:Qe,k1:Qe,k2:Qe,k3:Qe,k4:Qe,kernelMatrix:qi,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Qe,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Qe,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Qe,overlineThickness:Qe,paintOrder:null,panose1:null,path:null,pathLength:Qe,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:ur,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Qe,pointsAtY:Qe,pointsAtZ:Qe,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:qi,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:qi,rev:qi,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:qi,requiredFeatures:qi,requiredFonts:qi,requiredFormats:qi,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Qe,specularExponent:Qe,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Qe,strikethroughThickness:Qe,string:null,stroke:null,strokeDashArray:qi,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Qe,strokeOpacity:Qe,strokeWidth:null,style:null,surfaceScale:Qe,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:qi,tabIndex:Qe,tableValues:null,target:null,targetX:Qe,targetY:Qe,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:qi,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Qe,underlineThickness:Qe,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Qe,values:null,vAlphabetic:Qe,vMathematical:Qe,vectorEffect:null,vHanging:Qe,vIdeographic:Qe,version:null,vertAdvY:Qe,vertOriginX:Qe,vertOriginY:Qe,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Qe,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:HQ}),VQ=Bf({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(t,e){return"xlink:"+e.slice(5).toLowerCase()}}),UQ=Bf({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:QQ}),WQ=Bf({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,e){return"xml:"+e.slice(3).toLowerCase()}}),aye={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},oye=/[A-Z]/g,SM=/-[a-z]/g,lye=/^data[-\w.:]+$/i;function GQ(t,e){const n=mp(e);let r=e,s=Ei;if(n in t.normal)return t.property[t.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&lye.test(e)){if(e.charAt(4)==="-"){const i=e.slice(5).replace(SM,uye);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=e.slice(4);if(!SM.test(i)){let a=i.replace(oye,cye);a.charAt(0)!=="-"&&(a="-"+a),e="data"+a}}s=aN}return new s(r,e)}function cye(t){return"-"+t.toLowerCase()}function uye(t){return t.charAt(1).toUpperCase()}const XQ=qQ([$Q,sye,VQ,UQ,WQ],"html"),zb=qQ([$Q,iye,VQ,UQ,WQ],"svg");function kM(t){const e=String(t||"").trim();return e?e.split(/[ \t\n\r\f]+/g):[]}function dye(t){return t.join(" ").trim()}var oh={},ES,OM;function hye(){if(OM)return ES;OM=1;var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,e=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,i=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,a=/^[;\s]*/,l=/^\s+|\s+$/g,c=`
`,d="/",h="*",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 j=1,N=1;function T(z){var Q=z.match(e);Q&&(j+=Q.length);var F=z.lastIndexOf(c);N=~F?z.length-F:N+z.length}function E(){var z={line:j,column:N};return function(Q){return Q.position=new _(z),P(),Q}}function _(z){this.start=z,this.end={line:j,column:N},this.source=k.source}_.prototype.content=S;function A(z){var Q=new Error(k.source+":"+j+":"+N+": "+z);if(Q.reason=z,Q.filename=k.source,Q.line=j,Q.column=N,Q.source=S,!k.silent)throw Q}function L(z){var Q=z.exec(S);if(Q){var F=Q[0];return T(F),S=S.slice(F.length),Q}}function P(){L(n)}function B(z){var Q;for(z=z||[];Q=$();)Q!==!1&&z.push(Q);return z}function $(){var z=E();if(!(d!=S.charAt(0)||h!=S.charAt(1))){for(var Q=2;m!=S.charAt(Q)&&(h!=S.charAt(Q)||d!=S.charAt(Q+1));)++Q;if(Q+=2,m===S.charAt(Q-1))return A("End of comment missing");var F=S.slice(2,Q-2);return N+=2,T(F),S=S.slice(Q),N+=2,z({type:g,comment:F})}}function U(){var z=E(),Q=L(r);if(Q){if($(),!L(s))return A("property missing ':'");var F=L(i),Y=z({type:x,property:w(Q[0].replace(t,m)),value:F?w(F[0].replace(t,m)):m});return L(a),Y}}function te(){var z=[];B(z);for(var Q;Q=U();)Q!==!1&&(z.push(Q),B(z));return z}return P(),te()}function w(S){return S?S.replace(l,m):m}return ES=y,ES}var jM;function fye(){if(jM)return oh;jM=1;var t=oh&&oh.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(oh,"__esModule",{value:!0}),oh.default=n;const e=t(hye());function n(r,s){let i=null;if(!r||typeof r!="string")return i;const a=(0,e.default)(r),l=typeof s=="function";return a.forEach(c=>{if(c.type!=="declaration")return;const{property:d,value:h}=c;l?s(d,h,c):h&&(i=i||{},i[d]=h)}),i}return oh}var Ym={},NM;function mye(){if(NM)return Ym;NM=1,Object.defineProperty(Ym,"__esModule",{value:!0}),Ym.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,e=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,s=/^-(ms)-/,i=function(d){return!d||n.test(d)||t.test(d)},a=function(d,h){return h.toUpperCase()},l=function(d,h){return"".concat(h,"-")},c=function(d,h){return h===void 0&&(h={}),i(d)?d:(d=d.toLowerCase(),h.reactCompat?d=d.replace(s,l):d=d.replace(r,l),d.replace(e,a))};return Ym.camelCase=c,Ym}var Km,CM;function pye(){if(CM)return Km;CM=1;var t=Km&&Km.__importDefault||function(s){return s&&s.__esModule?s:{default:s}},e=t(fye()),n=mye();function r(s,i){var a={};return!s||typeof s!="string"||(0,e.default)(s,function(l,c){l&&c&&(a[(0,n.camelCase)(l,i)]=c)}),a}return r.default=r,Km=r,Km}var gye=pye();const xye=gd(gye),YQ=KQ("end"),oN=KQ("start");function KQ(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 vye(t){const e=oN(t),n=YQ(t);if(e&&n)return{start:e,end:n}}function _0(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?TM(t.position):"start"in t||"end"in t?TM(t):"line"in t||"column"in t?_O(t):""}function _O(t){return EM(t&&t.line)+":"+EM(t&&t.column)}function TM(t){return _O(t&&t.start)+"-"+_O(t&&t.end)}function EM(t){return t&&typeof t=="number"?t:1}class Ws 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 l=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=l?l.line:void 0,this.name=_0(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}}Ws.prototype.file="";Ws.prototype.name="";Ws.prototype.reason="";Ws.prototype.message="";Ws.prototype.stack="";Ws.prototype.column=void 0;Ws.prototype.line=void 0;Ws.prototype.ancestors=void 0;Ws.prototype.cause=void 0;Ws.prototype.fatal=void 0;Ws.prototype.place=void 0;Ws.prototype.ruleId=void 0;Ws.prototype.source=void 0;const lN={}.hasOwnProperty,yye=new Map,bye=/[A-Z]/g,wye=new Set(["table","tbody","thead","tfoot","tr"]),Sye=new Set(["td","th"]),ZQ="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function kye(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=Aye(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=_ye(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"?zb:XQ,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},i=JQ(s,t,void 0);return i&&typeof i!="string"?i:s.create(t,s.Fragment,{children:i||void 0},void 0)}function JQ(t,e,n){if(e.type==="element")return Oye(t,e,n);if(e.type==="mdxFlowExpression"||e.type==="mdxTextExpression")return jye(t,e);if(e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement")return Cye(t,e,n);if(e.type==="mdxjsEsm")return Nye(t,e);if(e.type==="root")return Tye(t,e,n);if(e.type==="text")return Eye(t,e)}function Oye(t,e,n){const r=t.schema;let s=r;e.tagName.toLowerCase()==="svg"&&r.space==="html"&&(s=zb,t.schema=s),t.ancestors.push(e);const i=tV(t,e.tagName,!1),a=Mye(t,e);let l=uN(t,e);return wye.has(e.tagName)&&(l=l.filter(function(c){return typeof c=="string"?!nye(c):!0})),eV(t,a,i,e),cN(a,l),t.ancestors.pop(),t.schema=r,t.create(e,i,a,n)}function jye(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)}pp(t,e.position)}function Nye(t,e){if(e.data&&e.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(e.data.estree);pp(t,e.position)}function Cye(t,e,n){const r=t.schema;let s=r;e.name==="svg"&&r.space==="html"&&(s=zb,t.schema=s),t.ancestors.push(e);const i=e.name===null?t.Fragment:tV(t,e.name,!0),a=Rye(t,e),l=uN(t,e);return eV(t,a,i,e),cN(a,l),t.ancestors.pop(),t.schema=r,t.create(e,i,a,n)}function Tye(t,e,n){const r={};return cN(r,uN(t,e)),t.create(e,t.Fragment,r,n)}function Eye(t,e){return e.value}function eV(t,e,n,r){typeof n!="string"&&n!==t.Fragment&&t.passNode&&(e.node=r)}function cN(t,e){if(e.length>0){const n=e.length>1?e:e[0];n&&(t.children=n)}}function _ye(t,e,n){return r;function r(s,i,a,l){const d=Array.isArray(a.children)?n:e;return l?d(i,a,l):d(i,a)}}function Aye(t,e){return n;function n(r,s,i,a){const l=Array.isArray(i.children),c=oN(r);return e(s,i,a,l,{columnNumber:c?c.column-1:void 0,fileName:t,lineNumber:c?c.line:void 0},void 0)}}function Mye(t,e){const n={};let r,s;for(s in e.properties)if(s!=="children"&&lN.call(e.properties,s)){const i=Dye(t,s,e.properties[s]);if(i){const[a,l]=i;t.tableCellAlignToStyle&&a==="align"&&typeof l=="string"&&Sye.has(e.tagName)?r=l:n[a]=l}}if(r){const i=n.style||(n.style={});i[t.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function Rye(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 l=a.properties[0];l.type,Object.assign(n,t.evaluater.evaluateExpression(l.argument))}else pp(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 l=r.value.data.estree.body[0];l.type,i=t.evaluater.evaluateExpression(l.expression)}else pp(t,e.position);else i=r.value===null?!0:r.value;n[s]=i}return n}function uN(t,e){const n=[];let r=-1;const s=t.passKeys?new Map:yye;for(;++r<e.children.length;){const i=e.children[r];let a;if(t.passKeys){const c=i.type==="element"?i.tagName:i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement"?i.name:void 0;if(c){const d=s.get(c)||0;a=c+"-"+d,s.set(c,d+1)}}const l=JQ(t,i,a);l!==void 0&&n.push(l)}return n}function Dye(t,e,n){const r=GQ(t.schema,e);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?Kve(n):dye(n)),r.property==="style"){let s=typeof n=="object"?n:Pye(t,String(n));return t.stylePropertyNameCase==="css"&&(s=zye(s)),["style",s]}return[t.elementAttributeNameCase==="react"&&r.space?aye[r.property]||r.property:r.attribute,n]}}function Pye(t,e){try{return xye(e,{reactCompat:!0})}catch(n){if(t.ignoreInvalidStyle)return{};const r=n,s=new Ws("Cannot parse `style` attribute",{ancestors:t.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw s.file=t.filePath||void 0,s.url=ZQ+"#cannot-parse-style-attribute",s}}function tV(t,e,n){let r;if(!n)r={type:"Literal",value:e};else if(e.includes(".")){const s=e.split(".");let i=-1,a;for(;++i<s.length;){const l=yM(s[i])?{type:"Identifier",name:s[i]}:{type:"Literal",value:s[i]};a=a?{type:"MemberExpression",object:a,property:l,computed:!!(i&&l.type==="Literal"),optional:!1}:l}r=a}else r=yM(e)&&!/^[a-z]/.test(e)?{type:"Identifier",name:e}:{type:"Literal",value:e};if(r.type==="Literal"){const s=r.value;return lN.call(t.components,s)?t.components[s]:s}if(t.evaluater)return t.evaluater.evaluateExpression(r);pp(t)}function pp(t,e){const n=new Ws("Cannot handle MDX estrees without `createEvaluater`",{ancestors:t.ancestors,place:e,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=t.filePath||void 0,n.url=ZQ+"#cannot-handle-mdx-estrees-without-createevaluater",n}function zye(t){const e={};let n;for(n in t)lN.call(t,n)&&(e[Iye(n)]=t[n]);return e}function Iye(t){let e=t.replace(bye,Lye);return e.slice(0,3)==="ms-"&&(e="-"+e),e}function Lye(t){return"-"+t.toLowerCase()}const _S={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},Bye={};function dN(t,e){const n=Bye,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,s=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return nV(t,r,s)}function nV(t,e,n){if(Fye(t)){if("value"in t)return t.type==="html"&&!n?"":t.value;if(e&&"alt"in t&&t.alt)return t.alt;if("children"in t)return _M(t.children,e,n)}return Array.isArray(t)?_M(t,e,n):""}function _M(t,e,n){const r=[];let s=-1;for(;++s<t.length;)r[s]=nV(t[s],e,n);return r.join("")}function Fye(t){return!!(t&&typeof t=="object")}const AM=document.createElement("i");function hN(t){const e="&"+t+";";AM.innerHTML=e;const n=AM.textContent;return n.charCodeAt(n.length-1)===59&&t!=="semi"||n===e?!1:n}function Gi(t,e,n,r){const s=t.length;let i=0,a;if(e<0?e=-e>s?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);i<r.length;)a=r.slice(i,i+1e4),a.unshift(e,0),t.splice(...a),i+=1e4,e+=1e4}function fa(t,e){return t.length>0?(Gi(t,t.length,0,e),t):e}const MM={}.hasOwnProperty;function rV(t){const e={};let n=-1;for(;++n<t.length;)qye(e,t[n]);return e}function qye(t,e){let n;for(n in e){const s=(MM.call(t,n)?t[n]:void 0)||(t[n]={}),i=e[n];let a;if(i)for(a in i){MM.call(s,a)||(s[a]=[]);const l=i[a];$ye(s[a],Array.isArray(l)?l:l?[l]:[])}}}function $ye(t,e){let n=-1;const r=[];for(;++n<e.length;)(e[n].add==="after"?t:r).push(e[n]);Gi(t,0,0,r)}function sV(t,e){const n=Number.parseInt(t,e);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"<22>":String.fromCodePoint(n)}function Ga(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Js=uu(/[A-Za-z]/),Vs=uu(/[\dA-Za-z]/),Hye=uu(/[#-'*+\--9=?A-Z^-~]/);function vy(t){return t!==null&&(t<32||t===127)}const AO=uu(/\d/),Qye=uu(/[\dA-Fa-f]/),Vye=uu(/[!-/:-@[-`{-~]/);function bt(t){return t!==null&&t<-2}function or(t){return t!==null&&(t<0||t===32)}function dn(t){return t===-2||t===-1||t===32}const Ib=uu(new RegExp("\\p{P}|\\p{S}","u")),fd=uu(/\s/);function uu(t){return e;function e(n){return n!==null&&n>-1&&t.test(String.fromCharCode(n))}}function Ff(t){const e=[];let n=-1,r=0,s=0;for(;++n<t.length;){const i=t.charCodeAt(n);let a="";if(i===37&&Vs(t.charCodeAt(n+1))&&Vs(t.charCodeAt(n+2)))s=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(a=String.fromCharCode(i));else if(i>55295&&i<57344){const l=t.charCodeAt(n+1);i<56320&&l>56319&&l<57344?(a=String.fromCharCode(i,l),s=1):a="<22>"}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 on(t,e,n,r){const s=r?r-1:Number.POSITIVE_INFINITY;let i=0;return a;function a(c){return dn(c)?(t.enter(n),l(c)):e(c)}function l(c){return dn(c)&&i++<s?(t.consume(c),l):(t.exit(n),e(c))}}const Uye={tokenize:Wye};function Wye(t){const e=t.attempt(this.parser.constructs.contentInitial,r,s);let n;return e;function r(l){if(l===null){t.consume(l);return}return t.enter("lineEnding"),t.consume(l),t.exit("lineEnding"),on(t,e,"linePrefix")}function s(l){return t.enter("paragraph"),i(l)}function i(l){const c=t.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=c),n=c,a(l)}function a(l){if(l===null){t.exit("chunkText"),t.exit("paragraph"),t.consume(l);return}return bt(l)?(t.consume(l),t.exit("chunkText"),i):(t.consume(l),a)}}const Gye={tokenize:Xye},RM={tokenize:Yye};function Xye(t){const e=this,n=[];let r=0,s,i,a;return l;function l(N){if(r<n.length){const T=n[r];return e.containerState=T[1],t.attempt(T[0].continuation,c,d)(N)}return d(N)}function c(N){if(r++,e.containerState._closeFlow){e.containerState._closeFlow=void 0,s&&j();const T=e.events.length;let E=T,_;for(;E--;)if(e.events[E][0]==="exit"&&e.events[E][1].type==="chunkFlow"){_=e.events[E][1].end;break}k(r);let A=T;for(;A<e.events.length;)e.events[A][1].end={..._},A++;return Gi(e.events,E+1,0,e.events.slice(T)),e.events.length=A,d(N)}return l(N)}function d(N){if(r===n.length){if(!s)return g(N);if(s.currentConstruct&&s.currentConstruct.concrete)return y(N);e.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return e.containerState={},t.check(RM,h,m)(N)}function h(N){return s&&j(),k(r),g(N)}function m(N){return e.parser.lazy[e.now().line]=r!==n.length,a=e.now().offset,y(N)}function g(N){return e.containerState={},t.attempt(RM,x,y)(N)}function x(N){return r++,n.push([e.currentConstruct,e.containerState]),g(N)}function y(N){if(N===null){s&&j(),k(0),t.consume(N);return}return s=s||e.parser.flow(e.now()),t.enter("chunkFlow",{_tokenizer:s,contentType:"flow",previous:i}),w(N)}function w(N){if(N===null){S(t.exit("chunkFlow"),!0),k(0),t.consume(N);return}return bt(N)?(t.consume(N),S(t.exit("chunkFlow")),r=0,e.interrupt=void 0,l):(t.consume(N),w)}function S(N,T){const E=e.sliceStream(N);if(T&&E.push(null),N.previous=i,i&&(i.next=N),i=N,s.defineSkip(N.start),s.write(E),e.parser.lazy[N.start.line]){let _=s.events.length;for(;_--;)if(s.events[_][1].start.offset<a&&(!s.events[_][1].end||s.events[_][1].end.offset>a))return;const A=e.events.length;let L=A,P,B;for(;L--;)if(e.events[L][0]==="exit"&&e.events[L][1].type==="chunkFlow"){if(P){B=e.events[L][1].end;break}P=!0}for(k(r),_=A;_<e.events.length;)e.events[_][1].end={...B},_++;Gi(e.events,L+1,0,e.events.slice(A)),e.events.length=_}}function k(N){let T=n.length;for(;T-- >N;){const E=n[T];e.containerState=E[1],E[0].exit.call(e,t)}n.length=N}function j(){s.write([null]),i=void 0,s=void 0,e.containerState._closeFlow=void 0}}function Yye(t,e,n){return on(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function hf(t){if(t===null||or(t)||fd(t))return 1;if(Ib(t))return 2}function Lb(t,e,n){const r=[];let s=-1;for(;++s<t.length;){const i=t[s].resolveAll;i&&!r.includes(i)&&(e=i(e,n),r.push(i))}return e}const MO={name:"attention",resolveAll:Kye,tokenize:Zye};function Kye(t,e){let n=-1,r,s,i,a,l,c,d,h;for(;++n<t.length;)if(t[n][0]==="enter"&&t[n][1].type==="attentionSequence"&&t[n][1]._close){for(r=n;r--;)if(t[r][0]==="exit"&&t[r][1].type==="attentionSequence"&&t[r][1]._open&&e.sliceSerialize(t[r][1]).charCodeAt(0)===e.sliceSerialize(t[n][1]).charCodeAt(0)){if((t[r][1]._close||t[n][1]._open)&&(t[n][1].end.offset-t[n][1].start.offset)%3&&!((t[r][1].end.offset-t[r][1].start.offset+t[n][1].end.offset-t[n][1].start.offset)%3))continue;c=t[r][1].end.offset-t[r][1].start.offset>1&&t[n][1].end.offset-t[n][1].start.offset>1?2:1;const m={...t[r][1].end},g={...t[n][1].start};DM(m,-c),DM(g,c),a={type:c>1?"strongSequence":"emphasisSequence",start:m,end:{...t[r][1].end}},l={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:{...l.end}},t[r][1].end={...a.start},t[n][1].start={...l.end},d=[],t[r][1].end.offset-t[r][1].start.offset&&(d=fa(d,[["enter",t[r][1],e],["exit",t[r][1],e]])),d=fa(d,[["enter",s,e],["enter",a,e],["exit",a,e],["enter",i,e]]),d=fa(d,Lb(e.parser.constructs.insideSpan.null,t.slice(r+1,n),e)),d=fa(d,[["exit",i,e],["enter",l,e],["exit",l,e],["exit",s,e]]),t[n][1].end.offset-t[n][1].start.offset?(h=2,d=fa(d,[["enter",t[n][1],e],["exit",t[n][1],e]])):h=0,Gi(t,r-1,n-r+3,d),n=r+d.length-h-2;break}}for(n=-1;++n<t.length;)t[n][1].type==="attentionSequence"&&(t[n][1].type="data");return t}function Zye(t,e){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,s=hf(r);let i;return a;function a(c){return i=c,t.enter("attentionSequence"),l(c)}function l(c){if(c===i)return t.consume(c),l;const d=t.exit("attentionSequence"),h=hf(c),m=!h||h===2&&s||n.includes(c),g=!s||s===2&&h||n.includes(r);return d._open=!!(i===42?m:m&&(s||!g)),d._close=!!(i===42?g:g&&(h||!m)),e(c)}}function DM(t,e){t.column+=e,t.offset+=e,t._bufferIndex+=e}const Jye={name:"autolink",tokenize:ebe};function ebe(t,e,n){let r=0;return s;function s(x){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(x),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),i}function i(x){return Js(x)?(t.consume(x),a):x===64?n(x):d(x)}function a(x){return x===43||x===45||x===46||Vs(x)?(r=1,l(x)):d(x)}function l(x){return x===58?(t.consume(x),r=0,c):(x===43||x===45||x===46||Vs(x))&&r++<32?(t.consume(x),l):(r=0,d(x))}function c(x){return x===62?(t.exit("autolinkProtocol"),t.enter("autolinkMarker"),t.consume(x),t.exit("autolinkMarker"),t.exit("autolink"),e):x===null||x===32||x===60||vy(x)?n(x):(t.consume(x),c)}function d(x){return x===64?(t.consume(x),h):Hye(x)?(t.consume(x),d):n(x)}function h(x){return Vs(x)?m(x):n(x)}function m(x){return x===46?(t.consume(x),r=0,h):x===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(x),t.exit("autolinkMarker"),t.exit("autolink"),e):g(x)}function g(x){if((x===45||Vs(x))&&r++<63){const y=x===45?g:m;return t.consume(x),y}return n(x)}}const dg={partial:!0,tokenize:tbe};function tbe(t,e,n){return r;function r(i){return dn(i)?on(t,s,"linePrefix")(i):s(i)}function s(i){return i===null||bt(i)?e(i):n(i)}}const iV={continuation:{tokenize:rbe},exit:sbe,name:"blockQuote",tokenize:nbe};function nbe(t,e,n){const r=this;return s;function s(a){if(a===62){const l=r.containerState;return l.open||(t.enter("blockQuote",{_container:!0}),l.open=!0),t.enter("blockQuotePrefix"),t.enter("blockQuoteMarker"),t.consume(a),t.exit("blockQuoteMarker"),i}return n(a)}function i(a){return dn(a)?(t.enter("blockQuotePrefixWhitespace"),t.consume(a),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),e):(t.exit("blockQuotePrefix"),e(a))}}function rbe(t,e,n){const r=this;return s;function s(a){return dn(a)?on(t,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a):i(a)}function i(a){return t.attempt(iV,e,n)(a)}}function sbe(t){t.exit("blockQuote")}const aV={name:"characterEscape",tokenize:ibe};function ibe(t,e,n){return r;function r(i){return t.enter("characterEscape"),t.enter("escapeMarker"),t.consume(i),t.exit("escapeMarker"),s}function s(i){return Vye(i)?(t.enter("characterEscapeValue"),t.consume(i),t.exit("characterEscapeValue"),t.exit("characterEscape"),e):n(i)}}const oV={name:"characterReference",tokenize:abe};function abe(t,e,n){const r=this;let s=0,i,a;return l;function l(m){return t.enter("characterReference"),t.enter("characterReferenceMarker"),t.consume(m),t.exit("characterReferenceMarker"),c}function c(m){return m===35?(t.enter("characterReferenceMarkerNumeric"),t.consume(m),t.exit("characterReferenceMarkerNumeric"),d):(t.enter("characterReferenceValue"),i=31,a=Vs,h(m))}function d(m){return m===88||m===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(m),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),i=6,a=Qye,h):(t.enter("characterReferenceValue"),i=7,a=AO,h(m))}function h(m){if(m===59&&s){const g=t.exit("characterReferenceValue");return a===Vs&&!hN(r.sliceSerialize(g))?n(m):(t.enter("characterReferenceMarker"),t.consume(m),t.exit("characterReferenceMarker"),t.exit("characterReference"),e)}return a(m)&&s++<i?(t.consume(m),h):n(m)}}const PM={partial:!0,tokenize:lbe},zM={concrete:!0,name:"codeFenced",tokenize:obe};function obe(t,e,n){const r=this,s={partial:!0,tokenize:E};let i=0,a=0,l;return c;function c(_){return d(_)}function d(_){const A=r.events[r.events.length-1];return i=A&&A[1].type==="linePrefix"?A[2].sliceSerialize(A[1],!0).length:0,l=_,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),h(_)}function h(_){return _===l?(a++,t.consume(_),h):a<3?n(_):(t.exit("codeFencedFenceSequence"),dn(_)?on(t,m,"whitespace")(_):m(_))}function m(_){return _===null||bt(_)?(t.exit("codeFencedFence"),r.interrupt?e(_):t.check(PM,w,T)(_)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),g(_))}function g(_){return _===null||bt(_)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),m(_)):dn(_)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),on(t,x,"whitespace")(_)):_===96&&_===l?n(_):(t.consume(_),g)}function x(_){return _===null||bt(_)?m(_):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),y(_))}function y(_){return _===null||bt(_)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),m(_)):_===96&&_===l?n(_):(t.consume(_),y)}function w(_){return t.attempt(s,T,S)(_)}function S(_){return t.enter("lineEnding"),t.consume(_),t.exit("lineEnding"),k}function k(_){return i>0&&dn(_)?on(t,j,"linePrefix",i+1)(_):j(_)}function j(_){return _===null||bt(_)?t.check(PM,w,T)(_):(t.enter("codeFlowValue"),N(_))}function N(_){return _===null||bt(_)?(t.exit("codeFlowValue"),j(_)):(t.consume(_),N)}function T(_){return t.exit("codeFenced"),e(_)}function E(_,A,L){let P=0;return B;function B(Q){return _.enter("lineEnding"),_.consume(Q),_.exit("lineEnding"),$}function $(Q){return _.enter("codeFencedFence"),dn(Q)?on(_,U,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(Q):U(Q)}function U(Q){return Q===l?(_.enter("codeFencedFenceSequence"),te(Q)):L(Q)}function te(Q){return Q===l?(P++,_.consume(Q),te):P>=a?(_.exit("codeFencedFenceSequence"),dn(Q)?on(_,z,"whitespace")(Q):z(Q)):L(Q)}function z(Q){return Q===null||bt(Q)?(_.exit("codeFencedFence"),A(Q)):L(Q)}}}function lbe(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 AS={name:"codeIndented",tokenize:ube},cbe={partial:!0,tokenize:dbe};function ube(t,e,n){const r=this;return s;function s(d){return t.enter("codeIndented"),on(t,i,"linePrefix",5)(d)}function i(d){const h=r.events[r.events.length-1];return h&&h[1].type==="linePrefix"&&h[2].sliceSerialize(h[1],!0).length>=4?a(d):n(d)}function a(d){return d===null?c(d):bt(d)?t.attempt(cbe,a,c)(d):(t.enter("codeFlowValue"),l(d))}function l(d){return d===null||bt(d)?(t.exit("codeFlowValue"),a(d)):(t.consume(d),l)}function c(d){return t.exit("codeIndented"),e(d)}}function dbe(t,e,n){const r=this;return s;function s(a){return r.parser.lazy[r.now().line]?n(a):bt(a)?(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),s):on(t,i,"linePrefix",5)(a)}function i(a){const l=r.events[r.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?e(a):bt(a)?s(a):n(a)}}const hbe={name:"codeText",previous:mbe,resolve:fbe,tokenize:pbe};function fbe(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<e;)if(t[r][1].type==="codeTextData"){t[n][1].type="codeTextPadding",t[e][1].type="codeTextPadding",n+=2,e-=2;break}}for(r=n-1,e++;++r<=e;)s===void 0?r!==e&&t[r][1].type!=="lineEnding"&&(s=r):(r===e||t[r][1].type==="lineEnding")&&(t[s][1].type="codeTextData",r!==s+2&&(t[s][1].end=t[r-1][1].end,t.splice(s+2,r-s-2),e-=r-s-2,r=s+2),s=void 0);return t}function mbe(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function pbe(t,e,n){let r=0,s,i;return a;function a(m){return t.enter("codeText"),t.enter("codeTextSequence"),l(m)}function l(m){return m===96?(t.consume(m),r++,l):(t.exit("codeTextSequence"),c(m))}function c(m){return m===null?n(m):m===32?(t.enter("space"),t.consume(m),t.exit("space"),c):m===96?(i=t.enter("codeTextSequence"),s=0,h(m)):bt(m)?(t.enter("lineEnding"),t.consume(m),t.exit("lineEnding"),c):(t.enter("codeTextData"),d(m))}function d(m){return m===null||m===32||m===96||bt(m)?(t.exit("codeTextData"),c(m)):(t.consume(m),d)}function h(m){return m===96?(t.consume(m),s++,h):s===r?(t.exit("codeTextSequence"),t.exit("codeText"),e(m)):(i.type="codeTextData",d(m))}}class gbe{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=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 e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(e,r):e>this.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&&Zm(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),Zm(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),Zm(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<this.left.length){const n=this.left.splice(e,Number.POSITIVE_INFINITY);Zm(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);Zm(this.left,n.reverse())}}}function Zm(t,e){let n=0;if(e.length<1e4)t.push(...e);else for(;n<e.length;)t.push(...e.slice(n,n+1e4)),n+=1e4}function lV(t){const e={};let n=-1,r,s,i,a,l,c,d;const h=new gbe(t);for(;++n<h.length;){for(;n in e;)n=e[n];if(r=h.get(n),n&&r[1].type==="chunkFlow"&&h.get(n-1)[1].type==="listItemPrefix"&&(c=r[1]._tokenizer.events,i=0,i<c.length&&c[i][1].type==="lineEndingBlank"&&(i+=2),i<c.length&&c[i][1].type==="content"))for(;++i<c.length&&c[i][1].type!=="content";)c[i][1].type==="chunkText"&&(c[i][1]._isInFirstContentOfListItem=!0,i++);if(r[0]==="enter")r[1].contentType&&(Object.assign(e,xbe(h,n)),n=e[n],d=!0);else if(r[1]._container){for(i=n,s=void 0;i--;)if(a=h.get(i),a[1].type==="lineEnding"||a[1].type==="lineEndingBlank")a[0]==="enter"&&(s&&(h.get(s)[1].type="lineEndingBlank"),a[1].type="lineEnding",s=i);else if(!(a[1].type==="linePrefix"||a[1].type==="listItemIndent"))break;s&&(r[1].end={...h.get(s)[1].start},l=h.slice(s,n),l.unshift(r),h.splice(s,n-s+1,l))}}return Gi(t,0,Number.POSITIVE_INFINITY,h.slice(0)),!d}function xbe(t,e){const n=t.get(e)[1],r=t.get(e)[2];let s=e-1;const i=[];let a=n._tokenizer;a||(a=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(a._contentTypeTextTrailing=!0));const l=a.events,c=[],d={};let h,m,g=-1,x=n,y=0,w=0;const S=[w];for(;x;){for(;t.get(++s)[1]!==x;);i.push(s),x._tokenizer||(h=r.sliceStream(x),x.next||h.push(null),m&&a.defineSkip(x.start),x._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=!0),a.write(h),x._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=void 0)),m=x,x=x.next}for(x=n;++g<l.length;)l[g][0]==="exit"&&l[g-1][0]==="enter"&&l[g][1].type===l[g-1][1].type&&l[g][1].start.line!==l[g][1].end.line&&(w=g+1,S.push(w),x._tokenizer=void 0,x.previous=void 0,x=x.next);for(a.events=[],x?(x._tokenizer=void 0,x.previous=void 0):S.pop(),g=S.length;g--;){const k=l.slice(S[g],S[g+1]),j=i.pop();c.push([j,j+k.length-1]),t.splice(j,2,k)}for(c.reverse(),g=-1;++g<c.length;)d[y+c[g][0]]=y+c[g][1],y+=c[g][1]-c[g][0]-1;return d}const vbe={resolve:bbe,tokenize:wbe},ybe={partial:!0,tokenize:Sbe};function bbe(t){return lV(t),t}function wbe(t,e){let n;return r;function r(l){return t.enter("content"),n=t.enter("chunkContent",{contentType:"content"}),s(l)}function s(l){return l===null?i(l):bt(l)?t.check(ybe,a,i)(l):(t.consume(l),s)}function i(l){return t.exit("chunkContent"),t.exit("content"),e(l)}function a(l){return t.consume(l),t.exit("chunkContent"),n.next=t.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,s}}function Sbe(t,e,n){const r=this;return s;function s(a){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),on(t,i,"linePrefix")}function i(a){if(a===null||bt(a))return n(a);const l=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?e(a):t.interrupt(r.parser.constructs.flow,n,e)(a)}}function cV(t,e,n,r,s,i,a,l,c){const d=c||Number.POSITIVE_INFINITY;let h=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||vy(k)?n(k):(t.enter(r),t.enter(a),t.enter(l),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(l),t.enter("chunkString",{contentType:"string"}),x(k))}function x(k){return k===62?(t.exit("chunkString"),t.exit(l),g(k)):k===null||k===60||bt(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!h&&(k===null||k===41||or(k))?(t.exit("chunkString"),t.exit(l),t.exit(a),t.exit(r),e(k)):h<d&&k===40?(t.consume(k),h++,w):k===41?(t.consume(k),h--,w):k===null||k===32||k===40||vy(k)?n(k):(t.consume(k),k===92?S:w)}function S(k){return k===40||k===41||k===92?(t.consume(k),w):w(k)}}function uV(t,e,n,r,s,i){const a=this;let l=0,c;return d;function d(x){return t.enter(r),t.enter(s),t.consume(x),t.exit(s),t.enter(i),h}function h(x){return l>999||x===null||x===91||x===93&&!c||x===94&&!l&&"_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):bt(x)?(t.enter("lineEnding"),t.consume(x),t.exit("lineEnding"),h):(t.enter("chunkString",{contentType:"string"}),m(x))}function m(x){return x===null||x===91||x===93||bt(x)||l++>999?(t.exit("chunkString"),h(x)):(t.consume(x),c||(c=!dn(x)),x===92?g:m)}function g(x){return x===91||x===92||x===93?(t.consume(x),l++,m):m(x)}}function dV(t,e,n,r,s,i){let a;return l;function l(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),d(g))}function d(g){return g===a?(t.exit(i),c(a)):g===null?n(g):bt(g)?(t.enter("lineEnding"),t.consume(g),t.exit("lineEnding"),on(t,d,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),h(g))}function h(g){return g===a||g===null||bt(g)?(t.exit("chunkString"),d(g)):(t.consume(g),g===92?m:h)}function m(g){return g===a||g===92?(t.consume(g),h):h(g)}}function A0(t,e){let n;return r;function r(s){return bt(s)?(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),n=!0,r):dn(s)?on(t,r,n?"linePrefix":"lineSuffix")(s):e(s)}}const kbe={name:"definition",tokenize:jbe},Obe={partial:!0,tokenize:Nbe};function jbe(t,e,n){const r=this;let s;return i;function i(x){return t.enter("definition"),a(x)}function a(x){return uV.call(r,t,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(x)}function l(x){return s=Ga(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 or(x)?A0(t,d)(x):d(x)}function d(x){return cV(t,h,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(x)}function h(x){return t.attempt(Obe,m,m)(x)}function m(x){return dn(x)?on(t,g,"whitespace")(x):g(x)}function g(x){return x===null||bt(x)?(t.exit("definition"),r.parser.defined.push(s),e(x)):n(x)}}function Nbe(t,e,n){return r;function r(l){return or(l)?A0(t,s)(l):n(l)}function s(l){return dV(t,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function i(l){return dn(l)?on(t,a,"whitespace")(l):a(l)}function a(l){return l===null||bt(l)?e(l):n(l)}}const Cbe={name:"hardBreakEscape",tokenize:Tbe};function Tbe(t,e,n){return r;function r(i){return t.enter("hardBreakEscape"),t.consume(i),s}function s(i){return bt(i)?(t.exit("hardBreakEscape"),e(i)):n(i)}}const Ebe={name:"headingAtx",resolve:_be,tokenize:Abe};function _be(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"},Gi(t,r,n-r+1,[["enter",s,e],["enter",i,e],["exit",i,e],["exit",s,e]])),t}function Abe(t,e,n){let r=0;return s;function s(h){return t.enter("atxHeading"),i(h)}function i(h){return t.enter("atxHeadingSequence"),a(h)}function a(h){return h===35&&r++<6?(t.consume(h),a):h===null||or(h)?(t.exit("atxHeadingSequence"),l(h)):n(h)}function l(h){return h===35?(t.enter("atxHeadingSequence"),c(h)):h===null||bt(h)?(t.exit("atxHeading"),e(h)):dn(h)?on(t,l,"whitespace")(h):(t.enter("atxHeadingText"),d(h))}function c(h){return h===35?(t.consume(h),c):(t.exit("atxHeadingSequence"),l(h))}function d(h){return h===null||h===35||or(h)?(t.exit("atxHeadingText"),l(h)):(t.consume(h),d)}}const Mbe=["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"],IM=["pre","script","style","textarea"],Rbe={concrete:!0,name:"htmlFlow",resolveTo:zbe,tokenize:Ibe},Dbe={partial:!0,tokenize:Bbe},Pbe={partial:!0,tokenize:Lbe};function zbe(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 Ibe(t,e,n){const r=this;let s,i,a,l,c;return d;function d(I){return h(I)}function h(I){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(I),m}function m(I){return I===33?(t.consume(I),g):I===47?(t.consume(I),i=!0,w):I===63?(t.consume(I),s=3,r.interrupt?e:R):Js(I)?(t.consume(I),a=String.fromCharCode(I),S):n(I)}function g(I){return I===45?(t.consume(I),s=2,x):I===91?(t.consume(I),s=5,l=0,y):Js(I)?(t.consume(I),s=4,r.interrupt?e:R):n(I)}function x(I){return I===45?(t.consume(I),r.interrupt?e:R):n(I)}function y(I){const V="CDATA[";return I===V.charCodeAt(l++)?(t.consume(I),l===V.length?r.interrupt?e:U:y):n(I)}function w(I){return Js(I)?(t.consume(I),a=String.fromCharCode(I),S):n(I)}function S(I){if(I===null||I===47||I===62||or(I)){const V=I===47,ee=a.toLowerCase();return!V&&!i&&IM.includes(ee)?(s=1,r.interrupt?e(I):U(I)):Mbe.includes(a.toLowerCase())?(s=6,V?(t.consume(I),k):r.interrupt?e(I):U(I)):(s=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(I):i?j(I):N(I))}return I===45||Vs(I)?(t.consume(I),a+=String.fromCharCode(I),S):n(I)}function k(I){return I===62?(t.consume(I),r.interrupt?e:U):n(I)}function j(I){return dn(I)?(t.consume(I),j):B(I)}function N(I){return I===47?(t.consume(I),B):I===58||I===95||Js(I)?(t.consume(I),T):dn(I)?(t.consume(I),N):B(I)}function T(I){return I===45||I===46||I===58||I===95||Vs(I)?(t.consume(I),T):E(I)}function E(I){return I===61?(t.consume(I),_):dn(I)?(t.consume(I),E):N(I)}function _(I){return I===null||I===60||I===61||I===62||I===96?n(I):I===34||I===39?(t.consume(I),c=I,A):dn(I)?(t.consume(I),_):L(I)}function A(I){return I===c?(t.consume(I),c=null,P):I===null||bt(I)?n(I):(t.consume(I),A)}function L(I){return I===null||I===34||I===39||I===47||I===60||I===61||I===62||I===96||or(I)?E(I):(t.consume(I),L)}function P(I){return I===47||I===62||dn(I)?N(I):n(I)}function B(I){return I===62?(t.consume(I),$):n(I)}function $(I){return I===null||bt(I)?U(I):dn(I)?(t.consume(I),$):n(I)}function U(I){return I===45&&s===2?(t.consume(I),F):I===60&&s===1?(t.consume(I),Y):I===62&&s===4?(t.consume(I),ie):I===63&&s===3?(t.consume(I),R):I===93&&s===5?(t.consume(I),X):bt(I)&&(s===6||s===7)?(t.exit("htmlFlowData"),t.check(Dbe,G,te)(I)):I===null||bt(I)?(t.exit("htmlFlowData"),te(I)):(t.consume(I),U)}function te(I){return t.check(Pbe,z,G)(I)}function z(I){return t.enter("lineEnding"),t.consume(I),t.exit("lineEnding"),Q}function Q(I){return I===null||bt(I)?te(I):(t.enter("htmlFlowData"),U(I))}function F(I){return I===45?(t.consume(I),R):U(I)}function Y(I){return I===47?(t.consume(I),a="",J):U(I)}function J(I){if(I===62){const V=a.toLowerCase();return IM.includes(V)?(t.consume(I),ie):U(I)}return Js(I)&&a.length<8?(t.consume(I),a+=String.fromCharCode(I),J):U(I)}function X(I){return I===93?(t.consume(I),R):U(I)}function R(I){return I===62?(t.consume(I),ie):I===45&&s===2?(t.consume(I),R):U(I)}function ie(I){return I===null||bt(I)?(t.exit("htmlFlowData"),G(I)):(t.consume(I),ie)}function G(I){return t.exit("htmlFlow"),e(I)}}function Lbe(t,e,n){const r=this;return s;function s(a){return bt(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 Bbe(t,e,n){return r;function r(s){return t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),t.attempt(dg,e,n)}}const Fbe={name:"htmlText",tokenize:qbe};function qbe(t,e,n){const r=this;let s,i,a;return l;function l(R){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(R),c}function c(R){return R===33?(t.consume(R),d):R===47?(t.consume(R),E):R===63?(t.consume(R),N):Js(R)?(t.consume(R),L):n(R)}function d(R){return R===45?(t.consume(R),h):R===91?(t.consume(R),i=0,y):Js(R)?(t.consume(R),j):n(R)}function h(R){return R===45?(t.consume(R),x):n(R)}function m(R){return R===null?n(R):R===45?(t.consume(R),g):bt(R)?(a=m,Y(R)):(t.consume(R),m)}function g(R){return R===45?(t.consume(R),x):m(R)}function x(R){return R===62?F(R):R===45?g(R):m(R)}function y(R){const ie="CDATA[";return R===ie.charCodeAt(i++)?(t.consume(R),i===ie.length?w:y):n(R)}function w(R){return R===null?n(R):R===93?(t.consume(R),S):bt(R)?(a=w,Y(R)):(t.consume(R),w)}function S(R){return R===93?(t.consume(R),k):w(R)}function k(R){return R===62?F(R):R===93?(t.consume(R),k):w(R)}function j(R){return R===null||R===62?F(R):bt(R)?(a=j,Y(R)):(t.consume(R),j)}function N(R){return R===null?n(R):R===63?(t.consume(R),T):bt(R)?(a=N,Y(R)):(t.consume(R),N)}function T(R){return R===62?F(R):N(R)}function E(R){return Js(R)?(t.consume(R),_):n(R)}function _(R){return R===45||Vs(R)?(t.consume(R),_):A(R)}function A(R){return bt(R)?(a=A,Y(R)):dn(R)?(t.consume(R),A):F(R)}function L(R){return R===45||Vs(R)?(t.consume(R),L):R===47||R===62||or(R)?P(R):n(R)}function P(R){return R===47?(t.consume(R),F):R===58||R===95||Js(R)?(t.consume(R),B):bt(R)?(a=P,Y(R)):dn(R)?(t.consume(R),P):F(R)}function B(R){return R===45||R===46||R===58||R===95||Vs(R)?(t.consume(R),B):$(R)}function $(R){return R===61?(t.consume(R),U):bt(R)?(a=$,Y(R)):dn(R)?(t.consume(R),$):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,te):bt(R)?(a=U,Y(R)):dn(R)?(t.consume(R),U):(t.consume(R),z)}function te(R){return R===s?(t.consume(R),s=void 0,Q):R===null?n(R):bt(R)?(a=te,Y(R)):(t.consume(R),te)}function z(R){return R===null||R===34||R===39||R===60||R===61||R===96?n(R):R===47||R===62||or(R)?P(R):(t.consume(R),z)}function Q(R){return R===47||R===62||or(R)?P(R):n(R)}function F(R){return R===62?(t.consume(R),t.exit("htmlTextData"),t.exit("htmlText"),e):n(R)}function Y(R){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(R),t.exit("lineEnding"),J}function J(R){return dn(R)?on(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 fN={name:"labelEnd",resolveAll:Vbe,resolveTo:Ube,tokenize:Wbe},$be={tokenize:Gbe},Hbe={tokenize:Xbe},Qbe={tokenize:Ybe};function Vbe(t){let e=-1;const n=[];for(;++e<t.length;){const r=t[e][1];if(n.push(t[e]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const s=r.type==="labelImage"?4:2;r.type="data",e+=s}}return t.length!==n.length&&Gi(t,0,t.length,n),t}function Ube(t,e){let n=t.length,r=0,s,i,a,l;for(;n--;)if(s=t[n][1],i){if(s.type==="link"||s.type==="labelLink"&&s._inactive)break;t[n][0]==="enter"&&s.type==="labelLink"&&(s._inactive=!0)}else if(a){if(t[n][0]==="enter"&&(s.type==="labelImage"||s.type==="labelLink")&&!s._balanced&&(i=n,s.type!=="labelLink")){r=2;break}}else s.type==="labelEnd"&&(a=n);const c={type:t[i][1].type==="labelLink"?"link":"image",start:{...t[i][1].start},end:{...t[t.length-1][1].end}},d={type:"label",start:{...t[i][1].start},end:{...t[a][1].end}},h={type:"labelText",start:{...t[i+r+2][1].end},end:{...t[a-2][1].start}};return l=[["enter",c,e],["enter",d,e]],l=fa(l,t.slice(i+1,i+r+3)),l=fa(l,[["enter",h,e]]),l=fa(l,Lb(e.parser.constructs.insideSpan.null,t.slice(i+r+4,a-3),e)),l=fa(l,[["exit",h,e],t[a-2],t[a-1],["exit",d,e]]),l=fa(l,t.slice(a+1)),l=fa(l,[["exit",c,e]]),Gi(t,i,t.length,l),t}function Wbe(t,e,n){const r=this;let s=r.events.length,i,a;for(;s--;)if((r.events[s][1].type==="labelImage"||r.events[s][1].type==="labelLink")&&!r.events[s][1]._balanced){i=r.events[s][1];break}return l;function l(g){return i?i._inactive?m(g):(a=r.parser.defined.includes(Ga(r.sliceSerialize({start:i.end,end:r.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(g),t.exit("labelMarker"),t.exit("labelEnd"),c):n(g)}function c(g){return g===40?t.attempt($be,h,a?h:m)(g):g===91?t.attempt(Hbe,h,a?d:m)(g):a?h(g):m(g)}function d(g){return t.attempt(Qbe,h,m)(g)}function h(g){return e(g)}function m(g){return i._balanced=!0,n(g)}}function Gbe(t,e,n){return r;function r(m){return t.enter("resource"),t.enter("resourceMarker"),t.consume(m),t.exit("resourceMarker"),s}function s(m){return or(m)?A0(t,i)(m):i(m)}function i(m){return m===41?h(m):cV(t,a,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(m)}function a(m){return or(m)?A0(t,c)(m):h(m)}function l(m){return n(m)}function c(m){return m===34||m===39||m===40?dV(t,d,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(m):h(m)}function d(m){return or(m)?A0(t,h)(m):h(m)}function h(m){return m===41?(t.enter("resourceMarker"),t.consume(m),t.exit("resourceMarker"),t.exit("resource"),e):n(m)}}function Xbe(t,e,n){const r=this;return s;function s(l){return uV.call(r,t,i,a,"reference","referenceMarker","referenceString")(l)}function i(l){return r.parser.defined.includes(Ga(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?e(l):n(l)}function a(l){return n(l)}}function Ybe(t,e,n){return r;function r(i){return t.enter("reference"),t.enter("referenceMarker"),t.consume(i),t.exit("referenceMarker"),s}function s(i){return i===93?(t.enter("referenceMarker"),t.consume(i),t.exit("referenceMarker"),t.exit("reference"),e):n(i)}}const Kbe={name:"labelStartImage",resolveAll:fN.resolveAll,tokenize:Zbe};function Zbe(t,e,n){const r=this;return s;function s(l){return t.enter("labelImage"),t.enter("labelImageMarker"),t.consume(l),t.exit("labelImageMarker"),i}function i(l){return l===91?(t.enter("labelMarker"),t.consume(l),t.exit("labelMarker"),t.exit("labelImage"),a):n(l)}function a(l){return l===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(l):e(l)}}const Jbe={name:"labelStartLink",resolveAll:fN.resolveAll,tokenize:ewe};function ewe(t,e,n){const r=this;return s;function s(a){return t.enter("labelLink"),t.enter("labelMarker"),t.consume(a),t.exit("labelMarker"),t.exit("labelLink"),i}function i(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):e(a)}}const MS={name:"lineEnding",tokenize:twe};function twe(t,e){return n;function n(r){return t.enter("lineEnding"),t.consume(r),t.exit("lineEnding"),on(t,e,"linePrefix")}}const Sv={name:"thematicBreak",tokenize:nwe};function nwe(t,e,n){let r=0,s;return i;function i(d){return t.enter("thematicBreak"),a(d)}function a(d){return s=d,l(d)}function l(d){return d===s?(t.enter("thematicBreakSequence"),c(d)):r>=3&&(d===null||bt(d))?(t.exit("thematicBreak"),e(d)):n(d)}function c(d){return d===s?(t.consume(d),r++,c):(t.exit("thematicBreakSequence"),dn(d)?on(t,l,"whitespace")(d):l(d))}}const fi={continuation:{tokenize:awe},exit:lwe,name:"list",tokenize:iwe},rwe={partial:!0,tokenize:cwe},swe={partial:!0,tokenize:owe};function iwe(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 l;function l(x){const y=r.containerState.type||(x===42||x===43||x===45?"listUnordered":"listOrdered");if(y==="listUnordered"?!r.containerState.marker||x===r.containerState.marker:AO(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(Sv,n,d)(x):d(x);if(!r.interrupt||x===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),c(x)}return n(x)}function c(x){return AO(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"),d(x)):n(x)}function d(x){return t.enter("listItemMarker"),t.consume(x),t.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||x,t.check(dg,r.interrupt?n:h,t.attempt(rwe,g,m))}function h(x){return r.containerState.initialBlankLine=!0,i++,g(x)}function m(x){return dn(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 awe(t,e,n){const r=this;return r.containerState._closeFlow=void 0,t.check(dg,s,i);function s(l){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,on(t,e,"listItemIndent",r.containerState.size+1)(l)}function i(l){return r.containerState.furtherBlankLines||!dn(l)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,a(l)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,t.attempt(swe,e,a)(l))}function a(l){return r.containerState._closeFlow=!0,r.interrupt=void 0,on(t,t.attempt(fi,e,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function owe(t,e,n){const r=this;return on(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 lwe(t){t.exit(this.containerState.type)}function cwe(t,e,n){const r=this;return on(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!dn(i)&&a&&a[1].type==="listItemPrefixWhitespace"?e(i):n(i)}}const LM={name:"setextUnderline",resolveTo:uwe,tokenize:dwe};function uwe(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 dwe(t,e,n){const r=this;let s;return i;function i(d){let h=r.events.length,m;for(;h--;)if(r.events[h][1].type!=="lineEnding"&&r.events[h][1].type!=="linePrefix"&&r.events[h][1].type!=="content"){m=r.events[h][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||m)?(t.enter("setextHeadingLine"),s=d,a(d)):n(d)}function a(d){return t.enter("setextHeadingLineSequence"),l(d)}function l(d){return d===s?(t.consume(d),l):(t.exit("setextHeadingLineSequence"),dn(d)?on(t,c,"lineSuffix")(d):c(d))}function c(d){return d===null||bt(d)?(t.exit("setextHeadingLine"),e(d)):n(d)}}const hwe={tokenize:fwe};function fwe(t){const e=this,n=t.attempt(dg,r,t.attempt(this.parser.constructs.flowInitial,s,on(t,t.attempt(this.parser.constructs.flow,s,t.attempt(vbe,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 mwe={resolveAll:fV()},pwe=hV("string"),gwe=hV("text");function hV(t){return{resolveAll:fV(t==="text"?xwe:void 0),tokenize:e};function e(n){const r=this,s=this.parser.constructs[t],i=n.attempt(s,a,l);return a;function a(h){return d(h)?i(h):l(h)}function l(h){if(h===null){n.consume(h);return}return n.enter("data"),n.consume(h),c}function c(h){return d(h)?(n.exit("data"),i(h)):(n.consume(h),c)}function d(h){if(h===null)return!0;const m=s[h];let g=-1;if(m)for(;++g<m.length;){const x=m[g];if(!x.previous||x.previous.call(r,r.previous))return!0}return!1}}}function fV(t){return e;function e(n,r){let s=-1,i;for(;++s<=n.length;)i===void 0?n[s]&&n[s][1].type==="data"&&(i=s,s++):(!n[s]||n[s][1].type!=="data")&&(s!==i+2&&(n[i][1].end=n[s-1][1].end,n.splice(i+2,s-i-2),s=i+2),i=void 0);return t?t(n,r):n}}function xwe(t,e){let n=0;for(;++n<=t.length;)if((n===t.length||t[n][1].type==="lineEnding")&&t[n-1][1].type==="data"){const r=t[n-1][1],s=e.sliceStream(r);let i=s.length,a=-1,l=0,c;for(;i--;){const d=s[i];if(typeof d=="string"){for(a=d.length;d.charCodeAt(a-1)===32;)l++,a--;if(a)break;a=-1}else if(d===-2)c=!0,l++;else if(d!==-1){i++;break}}if(e._contentTypeTextTrailing&&n===t.length&&(l=0),l){const d={type:n===t.length||c||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?a:r.start._bufferIndex+a,_index:r.start._index+i,line:r.end.line,column:r.end.column-l,offset:r.end.offset-l},end:{...r.end}};r.end={...d.start},r.start.offset===r.end.offset?Object.assign(r,d):(t.splice(n,0,["enter",d,e],["exit",d,e]),n+=2)}n++}return t}const vwe={42:fi,43:fi,45:fi,48:fi,49:fi,50:fi,51:fi,52:fi,53:fi,54:fi,55:fi,56:fi,57:fi,62:iV},ywe={91:kbe},bwe={[-2]:AS,[-1]:AS,32:AS},wwe={35:Ebe,42:Sv,45:[LM,Sv],60:Rbe,61:LM,95:Sv,96:zM,126:zM},Swe={38:oV,92:aV},kwe={[-5]:MS,[-4]:MS,[-3]:MS,33:Kbe,38:oV,42:MO,60:[Jye,Fbe],91:Jbe,92:[Cbe,aV],93:fN,95:MO,96:hbe},Owe={null:[MO,mwe]},jwe={null:[42,95]},Nwe={null:[]},Cwe=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:jwe,contentInitial:ywe,disable:Nwe,document:vwe,flow:wwe,flowInitial:bwe,insideSpan:Owe,string:Swe,text:kwe},Symbol.toStringTag,{value:"Module"}));function Twe(t,e,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const s={},i=[];let a=[],l=[];const c={attempt:A(E),check:A(_),consume:j,enter:N,exit:T,interrupt:A(_,{interrupt:!0})},d={code:null,containerState:{},defineSkip:w,events:[],now:y,parser:t,previous:null,sliceSerialize:g,sliceStream:x,write:m};let h=e.tokenize.call(d,c);return e.resolveAll&&i.push(e),d;function m($){return a=fa(a,$),S(),a[a.length-1]!==null?[]:(L(e,0),d.events=Lb(i,d.events,d),d.events)}function g($,U){return _we(x($),U)}function x($){return Ewe(a,$)}function y(){const{_bufferIndex:$,_index:U,line:te,column:z,offset:Q}=r;return{_bufferIndex:$,_index:U,line:te,column:z,offset:Q}}function w($){s[$.line]=$.column,B()}function S(){let $;for(;r._index<a.length;){const U=a[r._index];if(typeof U=="string")for($=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===$&&r._bufferIndex<U.length;)k(U.charCodeAt(r._bufferIndex));else k(U)}}function k($){h=h($)}function j($){bt($)?(r.line++,r.column=1,r.offset+=$===-3?2:1,B()):$!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===a[r._index].length&&(r._bufferIndex=-1,r._index++)),d.previous=$}function N($,U){const te=U||{};return te.type=$,te.start=y(),d.events.push(["enter",te,d]),l.push(te),te}function T($){const U=l.pop();return U.end=y(),d.events.push(["exit",U,d]),U}function E($,U){L($,U.from)}function _($,U){U.restore()}function A($,U){return te;function te(z,Q,F){let Y,J,X,R;return Array.isArray(z)?G(z):"tokenize"in z?G([z]):ie(z);function ie(ne){return W;function W(se){const re=se!==null&&ne[se],oe=se!==null&&ne.null,Te=[...Array.isArray(re)?re:re?[re]:[],...Array.isArray(oe)?oe:oe?[oe]:[]];return G(Te)(se)}}function G(ne){return Y=ne,J=0,ne.length===0?F:I(ne[J])}function I(ne){return W;function W(se){return R=P(),X=ne,ne.partial||(d.currentConstruct=ne),ne.name&&d.parser.constructs.disable.null.includes(ne.name)?ee():ne.tokenize.call(U?Object.assign(Object.create(d),U):d,c,V,ee)(se)}}function V(ne){return $(X,R),Q}function ee(ne){return R.restore(),++J<Y.length?I(Y[J]):F}}}function L($,U){$.resolveAll&&!i.includes($)&&i.push($),$.resolve&&Gi(d.events,U,d.events.length-U,$.resolve(d.events.slice(U),d)),$.resolveTo&&(d.events=$.resolveTo(d.events,d))}function P(){const $=y(),U=d.previous,te=d.currentConstruct,z=d.events.length,Q=Array.from(l);return{from:z,restore:F};function F(){r=$,d.previous=U,d.currentConstruct=te,d.events.length=z,l=Q,B()}}function B(){r.line in s&&r.column<2&&(r.column=s[r.line],r.offset+=s[r.line]-1)}}function Ewe(t,e){const n=e.start._index,r=e.start._bufferIndex,s=e.end._index,i=e.end._bufferIndex;let a;if(n===s)a=[t[n].slice(r,i)];else{if(a=t.slice(n,s),r>-1){const l=a[0];typeof l=="string"?a[0]=l.slice(r):a.shift()}i>0&&a.push(t[s].slice(0,i))}return a}function _we(t,e){let n=-1;const r=[];let s;for(;++n<t.length;){const i=t[n];let a;if(typeof i=="string")a=i;else switch(i){case-5:{a="\r";break}case-4:{a=`
`;break}case-3:{a=`\r
`;break}case-2:{a=e?" ":" ";break}case-1:{if(!e&&s)continue;a=" ";break}default:a=String.fromCharCode(i)}s=i===-2,r.push(a)}return r.join("")}function Awe(t){const r={constructs:rV([Cwe,...(t||{}).extensions||[]]),content:s(Uye),defined:[],document:s(Gye),flow:s(hwe),lazy:{},string:s(pwe),text:s(gwe)};return r;function s(i){return a;function a(l){return Twe(r,i,l)}}}function Mwe(t){for(;!lV(t););return t}const BM=/[\0\t\n\r]/g;function Rwe(){let t=1,e="",n=!0,r;return s;function s(i,a,l){const c=[];let d,h,m,g,x;for(i=e+(typeof i=="string"?i.toString():new TextDecoder(a||void 0).decode(i)),m=0,e="",n&&(i.charCodeAt(0)===65279&&m++,n=void 0);m<i.length;){if(BM.lastIndex=m,d=BM.exec(i),g=d&&d.index!==void 0?d.index:i.length,x=i.charCodeAt(g),!d){e=i.slice(m);break}if(x===10&&m===g&&r)c.push(-3),r=void 0;else switch(r&&(c.push(-5),r=void 0),m<g&&(c.push(i.slice(m,g)),t+=g-m),x){case 0:{c.push(65533),t++;break}case 9:{for(h=Math.ceil(t/4)*4,c.push(-2);t++<h;)c.push(-1);break}case 10:{c.push(-4),t=1;break}default:r=!0,t=1}m=g+1}return l&&(r&&c.push(-5),e&&c.push(e),c.push(null)),c}}const Dwe=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Pwe(t){return t.replace(Dwe,zwe)}function zwe(t,e,n){if(e)return e;if(n.charCodeAt(0)===35){const s=n.charCodeAt(1),i=s===120||s===88;return sV(n.slice(i?2:1),i?16:10)}return hN(n)||t}const mV={}.hasOwnProperty;function Iwe(t,e,n){return typeof e!="string"&&(n=e,e=void 0),Lwe(n)(Mwe(Awe(n).document().write(Rwe()(t,e,!0))))}function Lwe(t){const e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(Ot),autolinkProtocol:P,autolinkEmail:P,atxHeading:i(Oe),blockQuote:i(oe),characterEscape:P,characterReference:P,codeFenced:i(Te),codeFencedFenceInfo:a,codeFencedFenceMeta:a,codeIndented:i(Te,a),codeText:i(We,a),codeTextData:P,data:P,codeFlowValue:P,definition:i(Ye),definitionDestinationString:a,definitionLabelString:a,definitionTitleString:a,emphasis:i(Je),hardBreakEscape:i(Ve),hardBreakTrailing:i(Ve),htmlFlow:i(Ue,a),htmlFlowData:P,htmlText:i(Ue,a),htmlTextData:P,image:i(He),label:a,link:i(Ot),listItem:i(kn),listItemValue:g,listOrdered:i(xt,m),listUnordered:i(xt),paragraph:i(It),reference:I,referenceString:a,resourceDestinationString:a,resourceTitleString:a,setextHeading:i(Oe),strong:i(Yt),thematicBreak:i(mt)},exit:{atxHeading:c(),atxHeadingSequence:E,autolink:c(),autolinkEmail:re,autolinkProtocol:se,blockQuote:c(),characterEscapeValue:B,characterReferenceMarkerHexadecimal:ee,characterReferenceMarkerNumeric:ee,characterReferenceValue:ne,characterReference:W,codeFenced:c(S),codeFencedFence:w,codeFencedFenceInfo:x,codeFencedFenceMeta:y,codeFlowValue:B,codeIndented:c(k),codeText:c(Q),codeTextData:B,data:B,definition:c(),definitionDestinationString:T,definitionLabelString:j,definitionTitleString:N,emphasis:c(),hardBreakEscape:c(U),hardBreakTrailing:c(U),htmlFlow:c(te),htmlFlowData:B,htmlText:c(z),htmlTextData:B,image:c(Y),label:X,labelText:J,lineEnding:$,link:c(F),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:V,resourceDestinationString:R,resourceTitleString:ie,resource:G,setextHeading:c(L),setextHeadingLineSequence:A,setextHeadingText:_,strong:c(),thematicBreak:c()}};pV(e,(t||{}).mdastExtensions||[]);const n={};return r;function r(Ne){let Ie={type:"root",children:[]};const st={stack:[Ie],tokenStack:[],config:e,enter:l,exit:d,buffer:a,resume:h,data:n},yt=[];let Pt=-1;for(;++Pt<Ne.length;)if(Ne[Pt][1].type==="listOrdered"||Ne[Pt][1].type==="listUnordered")if(Ne[Pt][0]==="enter")yt.push(Pt);else{const Mt=yt.pop();Pt=s(Ne,Mt,Pt)}for(Pt=-1;++Pt<Ne.length;){const Mt=e[Ne[Pt][0]];mV.call(Mt,Ne[Pt][1].type)&&Mt[Ne[Pt][1].type].call(Object.assign({sliceSerialize:Ne[Pt][2].sliceSerialize},st),Ne[Pt][1])}if(st.tokenStack.length>0){const Mt=st.tokenStack[st.tokenStack.length-1];(Mt[1]||FM).call(st,void 0,Mt[0])}for(Ie.position={start:Nc(Ne.length>0?Ne[0][1].start:{line:1,column:1,offset:0}),end:Nc(Ne.length>0?Ne[Ne.length-2][1].end:{line:1,column:1,offset:0})},Pt=-1;++Pt<e.transforms.length;)Ie=e.transforms[Pt](Ie)||Ie;return Ie}function s(Ne,Ie,st){let yt=Ie-1,Pt=-1,Mt=!1,zn,Fe,rt,tn;for(;++yt<=st;){const Rt=Ne[yt];switch(Rt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Rt[0]==="enter"?Pt++:Pt--,tn=void 0;break}case"lineEndingBlank":{Rt[0]==="enter"&&(zn&&!tn&&!Pt&&!rt&&(rt=yt),tn=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:tn=void 0}if(!Pt&&Rt[0]==="enter"&&Rt[1].type==="listItemPrefix"||Pt===-1&&Rt[0]==="exit"&&(Rt[1].type==="listUnordered"||Rt[1].type==="listOrdered")){if(zn){let ke=yt;for(Fe=void 0;ke--;){const Pe=Ne[ke];if(Pe[1].type==="lineEnding"||Pe[1].type==="lineEndingBlank"){if(Pe[0]==="exit")continue;Fe&&(Ne[Fe][1].type="lineEndingBlank",Mt=!0),Pe[1].type="lineEnding",Fe=ke}else if(!(Pe[1].type==="linePrefix"||Pe[1].type==="blockQuotePrefix"||Pe[1].type==="blockQuotePrefixWhitespace"||Pe[1].type==="blockQuoteMarker"||Pe[1].type==="listItemIndent"))break}rt&&(!Fe||rt<Fe)&&(zn._spread=!0),zn.end=Object.assign({},Fe?Ne[Fe][1].start:Rt[1].end),Ne.splice(Fe||yt,0,["exit",zn,Rt[2]]),yt++,st++}if(Rt[1].type==="listItemPrefix"){const ke={type:"listItem",_spread:!1,start:Object.assign({},Rt[1].start),end:void 0};zn=ke,Ne.splice(yt,0,["enter",ke,Rt[2]]),yt++,st++,rt=void 0,tn=!0}}}return Ne[Ie][1]._spread=Mt,st}function i(Ne,Ie){return st;function st(yt){l.call(this,Ne(yt),yt),Ie&&Ie.call(this,yt)}}function a(){this.stack.push({type:"fragment",children:[]})}function l(Ne,Ie,st){this.stack[this.stack.length-1].children.push(Ne),this.stack.push(Ne),this.tokenStack.push([Ie,st||void 0]),Ne.position={start:Nc(Ie.start),end:void 0}}function c(Ne){return Ie;function Ie(st){Ne&&Ne.call(this,st),d.call(this,st)}}function d(Ne,Ie){const st=this.stack.pop(),yt=this.tokenStack.pop();if(yt)yt[0].type!==Ne.type&&(Ie?Ie.call(this,Ne,yt[0]):(yt[1]||FM).call(this,Ne,yt[0]));else throw new Error("Cannot close `"+Ne.type+"` ("+_0({start:Ne.start,end:Ne.end})+"): its not open");st.position.end=Nc(Ne.end)}function h(){return dN(this.stack.pop())}function m(){this.data.expectingFirstListItemValue=!0}function g(Ne){if(this.data.expectingFirstListItemValue){const Ie=this.stack[this.stack.length-2];Ie.start=Number.parseInt(this.sliceSerialize(Ne),10),this.data.expectingFirstListItemValue=void 0}}function x(){const Ne=this.resume(),Ie=this.stack[this.stack.length-1];Ie.lang=Ne}function y(){const Ne=this.resume(),Ie=this.stack[this.stack.length-1];Ie.meta=Ne}function w(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function S(){const Ne=this.resume(),Ie=this.stack[this.stack.length-1];Ie.value=Ne.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function k(){const Ne=this.resume(),Ie=this.stack[this.stack.length-1];Ie.value=Ne.replace(/(\r?\n|\r)$/g,"")}function j(Ne){const Ie=this.resume(),st=this.stack[this.stack.length-1];st.label=Ie,st.identifier=Ga(this.sliceSerialize(Ne)).toLowerCase()}function N(){const Ne=this.resume(),Ie=this.stack[this.stack.length-1];Ie.title=Ne}function T(){const Ne=this.resume(),Ie=this.stack[this.stack.length-1];Ie.url=Ne}function E(Ne){const Ie=this.stack[this.stack.length-1];if(!Ie.depth){const st=this.sliceSerialize(Ne).length;Ie.depth=st}}function _(){this.data.setextHeadingSlurpLineEnding=!0}function A(Ne){const Ie=this.stack[this.stack.length-1];Ie.depth=this.sliceSerialize(Ne).codePointAt(0)===61?1:2}function L(){this.data.setextHeadingSlurpLineEnding=void 0}function P(Ne){const st=this.stack[this.stack.length-1].children;let yt=st[st.length-1];(!yt||yt.type!=="text")&&(yt=_t(),yt.position={start:Nc(Ne.start),end:void 0},st.push(yt)),this.stack.push(yt)}function B(Ne){const Ie=this.stack.pop();Ie.value+=this.sliceSerialize(Ne),Ie.position.end=Nc(Ne.end)}function $(Ne){const Ie=this.stack[this.stack.length-1];if(this.data.atHardBreak){const st=Ie.children[Ie.children.length-1];st.position.end=Nc(Ne.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&e.canContainEols.includes(Ie.type)&&(P.call(this,Ne),B.call(this,Ne))}function U(){this.data.atHardBreak=!0}function te(){const Ne=this.resume(),Ie=this.stack[this.stack.length-1];Ie.value=Ne}function z(){const Ne=this.resume(),Ie=this.stack[this.stack.length-1];Ie.value=Ne}function Q(){const Ne=this.resume(),Ie=this.stack[this.stack.length-1];Ie.value=Ne}function F(){const Ne=this.stack[this.stack.length-1];if(this.data.inReference){const Ie=this.data.referenceType||"shortcut";Ne.type+="Reference",Ne.referenceType=Ie,delete Ne.url,delete Ne.title}else delete Ne.identifier,delete Ne.label;this.data.referenceType=void 0}function Y(){const Ne=this.stack[this.stack.length-1];if(this.data.inReference){const Ie=this.data.referenceType||"shortcut";Ne.type+="Reference",Ne.referenceType=Ie,delete Ne.url,delete Ne.title}else delete Ne.identifier,delete Ne.label;this.data.referenceType=void 0}function J(Ne){const Ie=this.sliceSerialize(Ne),st=this.stack[this.stack.length-2];st.label=Pwe(Ie),st.identifier=Ga(Ie).toLowerCase()}function X(){const Ne=this.stack[this.stack.length-1],Ie=this.resume(),st=this.stack[this.stack.length-1];if(this.data.inReference=!0,st.type==="link"){const yt=Ne.children;st.children=yt}else st.alt=Ie}function R(){const Ne=this.resume(),Ie=this.stack[this.stack.length-1];Ie.url=Ne}function ie(){const Ne=this.resume(),Ie=this.stack[this.stack.length-1];Ie.title=Ne}function G(){this.data.inReference=void 0}function I(){this.data.referenceType="collapsed"}function V(Ne){const Ie=this.resume(),st=this.stack[this.stack.length-1];st.label=Ie,st.identifier=Ga(this.sliceSerialize(Ne)).toLowerCase(),this.data.referenceType="full"}function ee(Ne){this.data.characterReferenceType=Ne.type}function ne(Ne){const Ie=this.sliceSerialize(Ne),st=this.data.characterReferenceType;let yt;st?(yt=sV(Ie,st==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):yt=hN(Ie);const Pt=this.stack[this.stack.length-1];Pt.value+=yt}function W(Ne){const Ie=this.stack.pop();Ie.position.end=Nc(Ne.end)}function se(Ne){B.call(this,Ne);const Ie=this.stack[this.stack.length-1];Ie.url=this.sliceSerialize(Ne)}function re(Ne){B.call(this,Ne);const Ie=this.stack[this.stack.length-1];Ie.url="mailto:"+this.sliceSerialize(Ne)}function oe(){return{type:"blockquote",children:[]}}function Te(){return{type:"code",lang:null,meta:null,value:""}}function We(){return{type:"inlineCode",value:""}}function Ye(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Je(){return{type:"emphasis",children:[]}}function Oe(){return{type:"heading",depth:0,children:[]}}function Ve(){return{type:"break"}}function Ue(){return{type:"html",value:""}}function He(){return{type:"image",title:null,url:"",alt:null}}function Ot(){return{type:"link",title:null,url:"",children:[]}}function xt(Ne){return{type:"list",ordered:Ne.type==="listOrdered",start:null,spread:Ne._spread,children:[]}}function kn(Ne){return{type:"listItem",spread:Ne._spread,checked:null,children:[]}}function It(){return{type:"paragraph",children:[]}}function Yt(){return{type:"strong",children:[]}}function _t(){return{type:"text",value:""}}function mt(){return{type:"thematicBreak"}}}function Nc(t){return{line:t.line,column:t.column,offset:t.offset}}function pV(t,e){let n=-1;for(;++n<e.length;){const r=e[n];Array.isArray(r)?pV(t,r):Bwe(t,r)}}function Bwe(t,e){let n;for(n in e)if(mV.call(e,n))switch(n){case"canContainEols":{const r=e[n];r&&t[n].push(...r);break}case"transforms":{const r=e[n];r&&t[n].push(...r);break}case"enter":case"exit":{const r=e[n];r&&Object.assign(t[n],r);break}}}function FM(t,e){throw t?new Error("Cannot close `"+t.type+"` ("+_0({start:t.start,end:t.end})+"): a different token (`"+e.type+"`, "+_0({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+_0({start:e.start,end:e.end})+") is still open")}function Fwe(t){const e=this;e.parser=n;function n(r){return Iwe(r,{...e.data("settings"),...t,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}function qwe(t,e){const n={type:"element",tagName:"blockquote",properties:{},children:t.wrap(t.all(e),!0)};return t.patch(e,n),t.applyData(e,n)}function $we(t,e){const n={type:"element",tagName:"br",properties:{},children:[]};return t.patch(e,n),[t.applyData(e,n),{type:"text",value:`
`}]}function Hwe(t,e){const n=e.value?e.value+`
`:"",r={};e.lang&&(r.className=["language-"+e.lang]);let s={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return e.meta&&(s.data={meta:e.meta}),t.patch(e,s),s=t.applyData(e,s),s={type:"element",tagName:"pre",properties:{},children:[s]},t.patch(e,s),s}function Qwe(t,e){const n={type:"element",tagName:"del",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function Vwe(t,e){const n={type:"element",tagName:"em",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function Uwe(t,e){const n=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",r=String(e.identifier).toUpperCase(),s=Ff(r.toLowerCase()),i=t.footnoteOrder.indexOf(r);let a,l=t.footnoteCounts.get(r);l===void 0?(l=0,t.footnoteOrder.push(r),a=t.footnoteOrder.length):a=i+1,l+=1,t.footnoteCounts.set(r,l);const c={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+s,id:n+"fnref-"+s+(l>1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(a)}]};t.patch(e,c);const d={type:"element",tagName:"sup",properties:{},children:[c]};return t.patch(e,d),t.applyData(e,d)}function Wwe(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 Gwe(t,e){if(t.options.allowDangerousHtml){const n={type:"raw",value:e.value};return t.patch(e,n),t.applyData(e,n)}}function gV(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 Xwe(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return gV(t,e);const s={src:Ff(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 Ywe(t,e){const n={src:Ff(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 Kwe(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 Zwe(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return gV(t,e);const s={href:Ff(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 Jwe(t,e){const n={href:Ff(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 e2e(t,e,n){const r=t.all(e),s=n?t2e(n):xV(e),i={},a=[];if(typeof e.checked=="boolean"){const h=r[0];let m;h&&h.type==="element"&&h.tagName==="p"?m=h:(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 l=-1;for(;++l<r.length;){const h=r[l];(s||l!==0||h.type!=="element"||h.tagName!=="p")&&a.push({type:"text",value:`
`}),h.type==="element"&&h.tagName==="p"&&!s?a.push(...h.children):a.push(h)}const c=r[r.length-1];c&&(s||c.type!=="element"||c.tagName!=="p")&&a.push({type:"text",value:`
`});const d={type:"element",tagName:"li",properties:i,children:a};return t.patch(e,d),t.applyData(e,d)}function t2e(t){let e=!1;if(t.type==="list"){e=t.spread||!1;const n=t.children;let r=-1;for(;!e&&++r<n.length;)e=xV(n[r])}return e}function xV(t){const e=t.spread;return e??t.children.length>1}function n2e(t,e){const n={},r=t.all(e);let s=-1;for(typeof e.start=="number"&&e.start!==1&&(n.start=e.start);++s<r.length;){const a=r[s];if(a.type==="element"&&a.tagName==="li"&&a.properties&&Array.isArray(a.properties.className)&&a.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const i={type:"element",tagName:e.ordered?"ol":"ul",properties:n,children:t.wrap(r,!0)};return t.patch(e,i),t.applyData(e,i)}function r2e(t,e){const n={type:"element",tagName:"p",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function s2e(t,e){const n={type:"root",children:t.wrap(t.all(e))};return t.patch(e,n),t.applyData(e,n)}function i2e(t,e){const n={type:"element",tagName:"strong",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function a2e(t,e){const n=t.all(e),r=n.shift(),s=[];if(r){const a={type:"element",tagName:"thead",properties:{},children:t.wrap([r],!0)};t.patch(e.children[0],a),s.push(a)}if(n.length>0){const a={type:"element",tagName:"tbody",properties:{},children:t.wrap(n,!0)},l=oN(e.children[1]),c=YQ(e.children[e.children.length-1]);l&&c&&(a.position={start:l,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 o2e(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,l=a?a.length:e.children.length;let c=-1;const d=[];for(;++c<l;){const m=e.children[c],g={},x=a?a[c]:void 0;x&&(g.align=x);let y={type:"element",tagName:i,properties:g,children:[]};m&&(y.children=t.all(m),t.patch(m,y),y=t.applyData(m,y)),d.push(y)}const h={type:"element",tagName:"tr",properties:{},children:t.wrap(d,!0)};return t.patch(e,h),t.applyData(e,h)}function l2e(t,e){const n={type:"element",tagName:"td",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}const qM=9,$M=32;function c2e(t){const e=String(t),n=/\r?\n|\r/g;let r=n.exec(e),s=0;const i=[];for(;r;)i.push(HM(e.slice(s,r.index),s>0,!0),r[0]),s=r.index+r[0].length,r=n.exec(e);return i.push(HM(e.slice(s),s>0,!1)),i.join("")}function HM(t,e,n){let r=0,s=t.length;if(e){let i=t.codePointAt(r);for(;i===qM||i===$M;)r++,i=t.codePointAt(r)}if(n){let i=t.codePointAt(s-1);for(;i===qM||i===$M;)s--,i=t.codePointAt(s-1)}return s>r?t.slice(r,s):""}function u2e(t,e){const n={type:"text",value:c2e(String(e.value))};return t.patch(e,n),t.applyData(e,n)}function d2e(t,e){const n={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(e,n),t.applyData(e,n)}const h2e={blockquote:qwe,break:$we,code:Hwe,delete:Qwe,emphasis:Vwe,footnoteReference:Uwe,heading:Wwe,html:Gwe,imageReference:Xwe,image:Ywe,inlineCode:Kwe,linkReference:Zwe,link:Jwe,listItem:e2e,list:n2e,paragraph:r2e,root:s2e,strong:i2e,table:a2e,tableCell:l2e,tableRow:o2e,text:u2e,thematicBreak:d2e,toml:C1,yaml:C1,definition:C1,footnoteDefinition:C1};function C1(){}const vV=-1,Bb=0,M0=1,yy=2,mN=3,pN=4,gN=5,xN=6,yV=7,bV=8,QM=typeof self=="object"?self:globalThis,f2e=(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 Bb:case vV:return n(a,s);case M0:{const l=n([],s);for(const c of a)l.push(r(c));return l}case yy:{const l=n({},s);for(const[c,d]of a)l[r(c)]=r(d);return l}case mN:return n(new Date(a),s);case pN:{const{source:l,flags:c}=a;return n(new RegExp(l,c),s)}case gN:{const l=n(new Map,s);for(const[c,d]of a)l.set(r(c),r(d));return l}case xN:{const l=n(new Set,s);for(const c of a)l.add(r(c));return l}case yV:{const{name:l,message:c}=a;return n(new QM[l](c),s)}case bV: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:l}=new Uint8Array(a);return n(new DataView(l),a)}}return n(new QM[i](a),s)};return r},VM=t=>f2e(new Map,t)(0),lh="",{toString:m2e}={},{keys:p2e}=Object,Jm=t=>{const e=typeof t;if(e!=="object"||!t)return[Bb,e];const n=m2e.call(t).slice(8,-1);switch(n){case"Array":return[M0,lh];case"Object":return[yy,lh];case"Date":return[mN,lh];case"RegExp":return[pN,lh];case"Map":return[gN,lh];case"Set":return[xN,lh];case"DataView":return[M0,n]}return n.includes("Array")?[M0,n]:n.includes("Error")?[yV,n]:[yy,n]},T1=([t,e])=>t===Bb&&(e==="function"||e==="symbol"),g2e=(t,e,n,r)=>{const s=(a,l)=>{const c=r.push(a)-1;return n.set(l,c),c},i=a=>{if(n.has(a))return n.get(a);let[l,c]=Jm(a);switch(l){case Bb:{let h=a;switch(c){case"bigint":l=bV,h=a.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+c);h=null;break;case"undefined":return s([vV],a)}return s([l,h],a)}case M0:{if(c){let g=a;return c==="DataView"?g=new Uint8Array(a.buffer):c==="ArrayBuffer"&&(g=new Uint8Array(a)),s([c,[...g]],a)}const h=[],m=s([l,h],a);for(const g of a)h.push(i(g));return m}case yy:{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 h=[],m=s([l,h],a);for(const g of p2e(a))(t||!T1(Jm(a[g])))&&h.push([i(g),i(a[g])]);return m}case mN:return s([l,a.toISOString()],a);case pN:{const{source:h,flags:m}=a;return s([l,{source:h,flags:m}],a)}case gN:{const h=[],m=s([l,h],a);for(const[g,x]of a)(t||!(T1(Jm(g))||T1(Jm(x))))&&h.push([i(g),i(x)]);return m}case xN:{const h=[],m=s([l,h],a);for(const g of a)(t||!T1(Jm(g)))&&h.push(i(g));return m}}const{message:d}=a;return s([l,{name:c,message:d}],a)};return i},UM=(t,{json:e,lossy:n}={})=>{const r=[];return g2e(!(e||n),!!e,new Map,r)(t),r},by=typeof structuredClone=="function"?(t,e)=>e&&("json"in e||"lossy"in e)?VM(UM(t,e)):structuredClone(t):(t,e)=>VM(UM(t,e));function x2e(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 v2e(t,e){return"Back to reference "+(t+1)+(e>1?"-"+e:"")}function y2e(t){const e=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",n=t.options.footnoteBackContent||x2e,r=t.options.footnoteBackLabel||v2e,s=t.options.footnoteLabel||"Footnotes",i=t.options.footnoteLabelTagName||"h2",a=t.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let c=-1;for(;++c<t.footnoteOrder.length;){const d=t.footnoteById.get(t.footnoteOrder[c]);if(!d)continue;const h=t.all(d),m=String(d.identifier).toUpperCase(),g=Ff(m.toLowerCase());let x=0;const y=[],w=t.footnoteCounts.get(m);for(;w!==void 0&&++x<=w;){y.length>0&&y.push({type:"text",value:" "});let j=typeof n=="string"?n:n(c,x);typeof j=="string"&&(j={type:"text",value:j}),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(j)?j:[j]})}const S=h[h.length-1];if(S&&S.type==="element"&&S.tagName==="p"){const j=S.children[S.children.length-1];j&&j.type==="text"?j.value+=" ":S.children.push({type:"text",value:" "}),S.children.push(...y)}else h.push(...y);const k={type:"element",tagName:"li",properties:{id:e+"fn-"+g},children:t.wrap(h,!0)};t.patch(d,k),l.push(k)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...by(a),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:`
`},{type:"element",tagName:"ol",properties:{},children:t.wrap(l,!0)},{type:"text",value:`
`}]}}const hg=(function(t){if(t==null)return k2e;if(typeof t=="function")return Fb(t);if(typeof t=="object")return Array.isArray(t)?b2e(t):w2e(t);if(typeof t=="string")return S2e(t);throw new Error("Expected function, string, or object as test")});function b2e(t){const e=[];let n=-1;for(;++n<t.length;)e[n]=hg(t[n]);return Fb(r);function r(...s){let i=-1;for(;++i<e.length;)if(e[i].apply(this,s))return!0;return!1}}function w2e(t){const e=t;return Fb(n);function n(r){const s=r;let i;for(i in t)if(s[i]!==e[i])return!1;return!0}}function S2e(t){return Fb(e);function e(n){return n&&n.type===t}}function Fb(t){return e;function e(n,r,s){return!!(O2e(n)&&t.call(this,n,typeof r=="number"?r:void 0,s||void 0))}}function k2e(){return!0}function O2e(t){return t!==null&&typeof t=="object"&&"type"in t}const wV=[],j2e=!0,RO=!1,SV="skip";function vN(t,e,n,r){let s;typeof e=="function"&&typeof n!="function"?(r=n,n=e):s=e;const i=hg(s),a=r?-1:1;l(t,void 0,[])();function l(c,d,h){const m=c&&typeof c=="object"?c:{};if(typeof m.type=="string"){const x=typeof m.tagName=="string"?m.tagName:typeof m.name=="string"?m.name:void 0;Object.defineProperty(g,"name",{value:"node ("+(c.type+(x?"<"+x+">":""))+")"})}return g;function g(){let x=wV,y,w,S;if((!e||i(c,d,h[h.length-1]||void 0))&&(x=N2e(n(c,h)),x[0]===RO))return x;if("children"in c&&c.children){const k=c;if(k.children&&x[0]!==SV)for(w=(r?k.children.length:-1)+a,S=h.concat(k);w>-1&&w<k.children.length;){const j=k.children[w];if(y=l(j,w,S)(),y[0]===RO)return y;w=typeof y[1]=="number"?y[1]:w+a}}return x}}}function N2e(t){return Array.isArray(t)?t:typeof t=="number"?[j2e,t]:t==null?wV:[t]}function yN(t,e,n,r){let s,i,a;typeof e=="function"&&typeof n!="function"?(i=void 0,a=e,s=n):(i=e,a=n,s=r),vN(t,i,l,s);function l(c,d){const h=d[d.length-1],m=h?h.children.indexOf(c):void 0;return a(c,m,h)}}const DO={}.hasOwnProperty,C2e={};function T2e(t,e){const n=e||C2e,r=new Map,s=new Map,i=new Map,a={...h2e,...n.handlers},l={all:d,applyData:_2e,definitionById:r,footnoteById:s,footnoteCounts:i,footnoteOrder:[],handlers:a,one:c,options:n,patch:E2e,wrap:M2e};return yN(t,function(h){if(h.type==="definition"||h.type==="footnoteDefinition"){const m=h.type==="definition"?r:s,g=String(h.identifier).toUpperCase();m.has(g)||m.set(g,h)}}),l;function c(h,m){const g=h.type,x=l.handlers[g];if(DO.call(l.handlers,g)&&x)return x(l,h,m);if(l.options.passThrough&&l.options.passThrough.includes(g)){if("children"in h){const{children:w,...S}=h,k=by(S);return k.children=l.all(h),k}return by(h)}return(l.options.unknownHandler||A2e)(l,h,m)}function d(h){const m=[];if("children"in h){const g=h.children;let x=-1;for(;++x<g.length;){const y=l.one(g[x],h);if(y){if(x&&g[x-1].type==="break"&&(!Array.isArray(y)&&y.type==="text"&&(y.value=WM(y.value)),!Array.isArray(y)&&y.type==="element")){const w=y.children[0];w&&w.type==="text"&&(w.value=WM(w.value))}Array.isArray(y)?m.push(...y):m.push(y)}}}return m}}function E2e(t,e){t.position&&(e.position=vye(t))}function _2e(t,e){let n=e;if(t&&t.data){const r=t.data.hName,s=t.data.hChildren,i=t.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const a="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:a}}n.type==="element"&&i&&Object.assign(n.properties,by(i)),"children"in n&&n.children&&s!==null&&s!==void 0&&(n.children=s)}return n}function A2e(t,e){const n=e.data||{},r="value"in e&&!(DO.call(n,"hProperties")||DO.call(n,"hChildren"))?{type:"text",value:e.value}:{type:"element",tagName:"div",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function M2e(t,e){const n=[];let r=-1;for(e&&n.push({type:"text",value:`
`});++r<t.length;)r&&n.push({type:"text",value:`
`}),n.push(t[r]);return e&&t.length>0&&n.push({type:"text",value:`
`}),n}function WM(t){let e=0,n=t.charCodeAt(e);for(;n===9||n===32;)e++,n=t.charCodeAt(e);return t.slice(e)}function GM(t,e){const n=T2e(t,e),r=n.one(t,void 0),s=y2e(n),i=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return s&&i.children.push({type:"text",value:`
`},s),i}function R2e(t,e){return t&&"run"in t?async function(n,r){const s=GM(n,{file:r,...e});await t.run(s,r)}:function(n,r){return GM(n,{file:r,...t||e})}}function XM(t){if(t)throw t}var RS,YM;function D2e(){if(YM)return RS;YM=1;var t=Object.prototype.hasOwnProperty,e=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,s=function(d){return typeof Array.isArray=="function"?Array.isArray(d):e.call(d)==="[object Array]"},i=function(d){if(!d||e.call(d)!=="[object Object]")return!1;var h=t.call(d,"constructor"),m=d.constructor&&d.constructor.prototype&&t.call(d.constructor.prototype,"isPrototypeOf");if(d.constructor&&!h&&!m)return!1;var g;for(g in d);return typeof g>"u"||t.call(d,g)},a=function(d,h){n&&h.name==="__proto__"?n(d,h.name,{enumerable:!0,configurable:!0,value:h.newValue,writable:!0}):d[h.name]=h.newValue},l=function(d,h){if(h==="__proto__")if(t.call(d,h)){if(r)return r(d,h).value}else return;return d[h]};return RS=function c(){var d,h,m,g,x,y,w=arguments[0],S=1,k=arguments.length,j=!1;for(typeof w=="boolean"&&(j=w,w=arguments[1]||{},S=2),(w==null||typeof w!="object"&&typeof w!="function")&&(w={});S<k;++S)if(d=arguments[S],d!=null)for(h in d)m=l(w,h),g=l(d,h),w!==g&&(j&&g&&(i(g)||(x=s(g)))?(x?(x=!1,y=m&&s(m)?m:[]):y=m&&i(m)?m:{},a(w,{name:h,newValue:c(j,y,g)})):typeof g<"u"&&a(w,{name:h,newValue:g}));return w},RS}var P2e=D2e();const DS=gd(P2e);function PO(t){if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}function z2e(){const t=[],e={run:n,use:r};return e;function n(...s){let i=-1;const a=s.pop();if(typeof a!="function")throw new TypeError("Expected function as last argument, not "+a);l(null,...s);function l(c,...d){const h=t[++i];let m=-1;if(c){a(c);return}for(;++m<s.length;)(d[m]===null||d[m]===void 0)&&(d[m]=s[m]);s=d,h?I2e(h,l)(...d):a(null,...d)}}function r(s){if(typeof s!="function")throw new TypeError("Expected `middelware` to be a function, not "+s);return t.push(s),e}}function I2e(t,e){let n;return r;function r(...a){const l=t.length>a.length;let c;l&&a.push(s);try{c=t.apply(this,a)}catch(d){const h=d;if(l&&n)throw h;return s(h)}l||(c&&c.then&&typeof c.then=="function"?c.then(i,s):c instanceof Error?s(c):i(c))}function s(a,...l){n||(n=!0,e(a,...l))}function i(a){s(null,a)}}const go={basename:L2e,dirname:B2e,extname:F2e,join:q2e,sep:"/"};function L2e(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');fg(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,l=e.length-1;for(;s--;)if(t.codePointAt(s)===47){if(i){n=s+1;break}}else a<0&&(i=!0,a=s+1),l>-1&&(t.codePointAt(s)===e.codePointAt(l--)?l<0&&(r=s):(l=-1,r=a));return n===r?r=a:r<0&&(r=t.length),t.slice(n,r)}function B2e(t){if(fg(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 F2e(t){fg(t);let e=t.length,n=-1,r=0,s=-1,i=0,a;for(;e--;){const l=t.codePointAt(e);if(l===47){if(a){r=e+1;break}continue}n<0&&(a=!0,n=e+1),l===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 q2e(...t){let e=-1,n;for(;++e<t.length;)fg(t[e]),t[e]&&(n=n===void 0?t[e]:n+"/"+t[e]);return n===void 0?".":$2e(n)}function $2e(t){fg(t);const e=t.codePointAt(0)===47;let n=H2e(t,!e);return n.length===0&&!e&&(n="."),n.length>0&&t.codePointAt(t.length-1)===47&&(n+="/"),e?"/"+n:n}function H2e(t,e){let n="",r=0,s=-1,i=0,a=-1,l,c;for(;++a<=t.length;){if(a<t.length)l=t.codePointAt(a);else{if(l===47)break;l=47}if(l===47){if(!(s===a-1||i===1))if(s!==a-1&&i===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(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 l===46&&i>-1?i++:i=-1}return n}function fg(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const Q2e={cwd:V2e};function V2e(){return"/"}function zO(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function U2e(t){if(typeof t=="string")t=new URL(t);else if(!zO(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 W2e(t)}function W2e(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(;++n<e.length;)if(e.codePointAt(n)===37&&e.codePointAt(n+1)===50){const r=e.codePointAt(n+2);if(r===70||r===102){const s=new TypeError("File URL path must not include encoded / characters");throw s.code="ERR_INVALID_FILE_URL_PATH",s}}return decodeURIComponent(e)}const PS=["history","path","basename","stem","extname","dirname"];class kV{constructor(e){let n;e?zO(e)?n={path:e}:typeof e=="string"||G2e(e)?n={value:e}:n=e:n={},this.cwd="cwd"in n?"":Q2e.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<PS.length;){const i=PS[r];i in n&&n[i]!==void 0&&n[i]!==null&&(this[i]=i==="history"?[...n[i]]:n[i])}let s;for(s in n)PS.includes(s)||(this[s]=n[s])}get basename(){return typeof this.path=="string"?go.basename(this.path):void 0}set basename(e){IS(e,"basename"),zS(e,"basename"),this.path=go.join(this.dirname||"",e)}get dirname(){return typeof this.path=="string"?go.dirname(this.path):void 0}set dirname(e){KM(this.basename,"dirname"),this.path=go.join(e||"",this.basename)}get extname(){return typeof this.path=="string"?go.extname(this.path):void 0}set extname(e){if(zS(e,"extname"),KM(this.dirname,"extname"),e){if(e.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(e.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=go.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){zO(e)&&(e=U2e(e)),IS(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path=="string"?go.basename(this.path,this.extname):void 0}set stem(e){IS(e,"stem"),zS(e,"stem"),this.path=go.join(this.dirname||"",e+(this.extname||""))}fail(e,n,r){const s=this.message(e,n,r);throw s.fatal=!0,s}info(e,n,r){const s=this.message(e,n,r);return s.fatal=void 0,s}message(e,n,r){const s=new Ws(e,n,r);return this.path&&(s.name=this.path+":"+s.name,s.file=this.path),s.fatal=!1,this.messages.push(s),s}toString(e){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(e||void 0).decode(this.value)}}function zS(t,e){if(t&&t.includes(go.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+go.sep+"`")}function IS(t,e){if(!t)throw new Error("`"+e+"` cannot be empty")}function KM(t,e){if(!t)throw new Error("Setting `"+e+"` requires `path` to be set too")}function G2e(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const X2e=(function(t){const r=this.constructor.prototype,s=r[t],i=function(){return s.apply(i,arguments)};return Object.setPrototypeOf(i,r),i}),Y2e={}.hasOwnProperty;class bN extends X2e{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=z2e()}copy(){const e=new bN;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];e.use(...r)}return e.data(DS(!0,{},this.namespace)),e}data(e,n){return typeof e=="string"?arguments.length===2?(FS("data",this.frozen),this.namespace[e]=n,this):Y2e.call(this.namespace,e)&&this.namespace[e]||void 0:e?(FS("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;const e=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const s=n.call(e,...r);typeof s=="function"&&this.transformers.use(s)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(e){this.freeze();const n=E1(e),r=this.parser||this.Parser;return LS("parse",r),r(String(n),n)}process(e,n){const r=this;return this.freeze(),LS("process",this.parser||this.Parser),BS("process",this.compiler||this.Compiler),n?s(void 0,n):new Promise(s);function s(i,a){const l=E1(e),c=r.parse(l);r.run(c,l,function(h,m,g){if(h||!m||!g)return d(h);const x=m,y=r.stringify(x,g);J2e(y)?g.value=y:g.result=y,d(h,g)});function d(h,m){h||!m?a(h):i?i(m):n(void 0,m)}}}processSync(e){let n=!1,r;return this.freeze(),LS("processSync",this.parser||this.Parser),BS("processSync",this.compiler||this.Compiler),this.process(e,s),JM("processSync","process",n),r;function s(i,a){n=!0,XM(i),r=a}}run(e,n,r){ZM(e),this.freeze();const s=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?i(void 0,r):new Promise(i);function i(a,l){const c=E1(n);s.run(e,c,d);function d(h,m,g){const x=m||e;h?l(h):a?a(x):r(void 0,x,g)}}}runSync(e,n){let r=!1,s;return this.run(e,n,i),JM("runSync","run",r),s;function i(a,l){XM(a),s=l,r=!0}}stringify(e,n){this.freeze();const r=E1(n),s=this.compiler||this.Compiler;return BS("stringify",s),ZM(e),s(e,r)}use(e,...n){const r=this.attachers,s=this.namespace;if(FS("use",this.frozen),e!=null)if(typeof e=="function")c(e,n);else if(typeof e=="object")Array.isArray(e)?l(e):a(e);else throw new TypeError("Expected usable value, not `"+e+"`");return this;function i(d){if(typeof d=="function")c(d,[]);else if(typeof d=="object")if(Array.isArray(d)){const[h,...m]=d;c(h,m)}else a(d);else throw new TypeError("Expected usable value, not `"+d+"`")}function a(d){if(!("plugins"in d)&&!("settings"in d))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");l(d.plugins),d.settings&&(s.settings=DS(!0,s.settings,d.settings))}function l(d){let h=-1;if(d!=null)if(Array.isArray(d))for(;++h<d.length;){const m=d[h];i(m)}else throw new TypeError("Expected a list of plugins, not `"+d+"`")}function c(d,h){let m=-1,g=-1;for(;++m<r.length;)if(r[m][0]===d){g=m;break}if(g===-1)r.push([d,...h]);else if(h.length>0){let[x,...y]=h;const w=r[g][1];PO(w)&&PO(x)&&(x=DS(!0,w,x)),r[g]=[d,x,...y]}}}}const K2e=new bN().freeze();function LS(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function BS(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function FS(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 ZM(t){if(!PO(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function JM(t,e,n){if(!n)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function E1(t){return Z2e(t)?t:new kV(t)}function Z2e(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function J2e(t){return typeof t=="string"||e4e(t)}function e4e(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const t4e="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",eR=[],tR={allowDangerousHtml:!0},n4e=/^(https?|ircs?|mailto|xmpp)$/i,r4e=[{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 s4e(t){const e=i4e(t),n=a4e(t);return o4e(e.runSync(e.parse(n),n),t)}function i4e(t){const e=t.rehypePlugins||eR,n=t.remarkPlugins||eR,r=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...tR}:tR;return K2e().use(Fwe).use(n).use(R2e,r).use(e)}function a4e(t){const e=t.children||"",n=new kV;return typeof e=="string"&&(n.value=e),n}function o4e(t,e){const n=e.allowedElements,r=e.allowElement,s=e.components,i=e.disallowedElements,a=e.skipHtml,l=e.unwrapDisallowed,c=e.urlTransform||l4e;for(const h of r4e)Object.hasOwn(e,h.from)&&(""+h.from+(h.to?"use `"+h.to+"` instead":"remove it")+t4e+h.id,void 0);return yN(t,d),kye(t,{Fragment:o.Fragment,components:s,ignoreInvalidStyle:!0,jsx:o.jsx,jsxs:o.jsxs,passKeys:!0,passNode:!0});function d(h,m,g){if(h.type==="raw"&&g&&typeof m=="number")return a?g.children.splice(m,1):g.children[m]={type:"text",value:h.value},m;if(h.type==="element"){let x;for(x in _S)if(Object.hasOwn(_S,x)&&Object.hasOwn(h.properties,x)){const y=h.properties[x],w=_S[x];(w===null||w.includes(h.tagName))&&(h.properties[x]=c(String(y||""),x,h))}}if(h.type==="element"){let x=n?!n.includes(h.tagName):i?i.includes(h.tagName):!1;if(!x&&r&&typeof m=="number"&&(x=!r(h,m,g)),x&&g&&typeof m=="number")return l&&h.children?g.children.splice(m,1,...h.children):g.children.splice(m,1),m}}}function l4e(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||n4e.test(t.slice(0,e))?t:""}function nR(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 c4e(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function u4e(t,e,n){const s=hg((n||{}).ignore||[]),i=d4e(e);let a=-1;for(;++a<i.length;)vN(t,"text",l);function l(d,h){let m=-1,g;for(;++m<h.length;){const x=h[m],y=g?g.children:void 0;if(s(x,y?y.indexOf(x):void 0,g))return;g=x}if(g)return c(d,h)}function c(d,h){const m=h[h.length-1],g=i[a][0],x=i[a][1];let y=0;const S=m.children.indexOf(d);let k=!1,j=[];g.lastIndex=0;let N=g.exec(d.value);for(;N;){const T=N.index,E={index:N.index,input:N.input,stack:[...h,d]};let _=x(...N,E);if(typeof _=="string"&&(_=_.length>0?{type:"text",value:_}:void 0),_===!1?g.lastIndex=T+1:(y!==T&&j.push({type:"text",value:d.value.slice(y,T)}),Array.isArray(_)?j.push(..._):_&&j.push(_),y=T+N[0].length,k=!0),!g.global)break;N=g.exec(d.value)}return k?(y<d.value.length&&j.push({type:"text",value:d.value.slice(y)}),m.children.splice(S,1,...j)):j=[d],S+j.length}}function d4e(t){const e=[];if(!Array.isArray(t))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!t[0]||Array.isArray(t[0])?t:[t];let r=-1;for(;++r<n.length;){const s=n[r];e.push([h4e(s[0]),f4e(s[1])])}return e}function h4e(t){return typeof t=="string"?new RegExp(c4e(t),"g"):t}function f4e(t){return typeof t=="function"?t:function(){return t}}const qS="phrasing",$S=["autolink","link","image","label"];function m4e(){return{transforms:[w4e],enter:{literalAutolink:g4e,literalAutolinkEmail:HS,literalAutolinkHttp:HS,literalAutolinkWww:HS},exit:{literalAutolink:b4e,literalAutolinkEmail:y4e,literalAutolinkHttp:x4e,literalAutolinkWww:v4e}}}function p4e(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:qS,notInConstruct:$S},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:qS,notInConstruct:$S},{character:":",before:"[ps]",after:"\\/",inConstruct:qS,notInConstruct:$S}]}}function g4e(t){this.enter({type:"link",title:null,url:"",children:[]},t)}function HS(t){this.config.enter.autolinkProtocol.call(this,t)}function x4e(t){this.config.exit.autolinkProtocol.call(this,t)}function v4e(t){this.config.exit.data.call(this,t);const e=this.stack[this.stack.length-1];e.type,e.url="http://"+this.sliceSerialize(t)}function y4e(t){this.config.exit.autolinkEmail.call(this,t)}function b4e(t){this.exit(t)}function w4e(t){u4e(t,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,S4e],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),k4e]],{ignore:["link","linkReference"]})}function S4e(t,e,n,r,s){let i="";if(!OV(s)||(/^w/i.test(e)&&(n=e+n,e="",i="http://"),!O4e(n)))return!1;const a=j4e(n+r);if(!a[0])return!1;const l={type:"link",title:null,url:i+e+a[0],children:[{type:"text",value:e+a[0]}]};return a[1]?[l,{type:"text",value:a[1]}]:l}function k4e(t,e,n,r){return!OV(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+e+"@"+n,children:[{type:"text",value:e+"@"+n}]}}function O4e(t){const e=t.split(".");return!(e.length<2||e[e.length-1]&&(/_/.test(e[e.length-1])||!/[a-zA-Z\d]/.test(e[e.length-1]))||e[e.length-2]&&(/_/.test(e[e.length-2])||!/[a-zA-Z\d]/.test(e[e.length-2])))}function j4e(t){const e=/[!"&'),.:;<>?\]}]+$/.exec(t);if(!e)return[t,void 0];t=t.slice(0,e.index);let n=e[0],r=n.indexOf(")");const s=nR(t,"(");let i=nR(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 OV(t,e){const n=t.input.charCodeAt(t.index-1);return(t.index===0||fd(n)||Ib(n))&&(!e||n!==47)}jV.peek=D4e;function N4e(){this.buffer()}function C4e(t){this.enter({type:"footnoteReference",identifier:"",label:""},t)}function T4e(){this.buffer()}function E4e(t){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},t)}function _4e(t){const e=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Ga(this.sliceSerialize(t)).toLowerCase(),n.label=e}function A4e(t){this.exit(t)}function M4e(t){const e=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Ga(this.sliceSerialize(t)).toLowerCase(),n.label=e}function R4e(t){this.exit(t)}function D4e(){return"["}function jV(t,e,n,r){const s=n.createTracker(r);let i=s.move("[^");const a=n.enter("footnoteReference"),l=n.enter("reference");return i+=s.move(n.safe(n.associationId(t),{after:"]",before:i})),l(),a(),i+=s.move("]"),i}function P4e(){return{enter:{gfmFootnoteCallString:N4e,gfmFootnoteCall:C4e,gfmFootnoteDefinitionLabelString:T4e,gfmFootnoteDefinition:E4e},exit:{gfmFootnoteCallString:_4e,gfmFootnoteCall:A4e,gfmFootnoteDefinitionLabelString:M4e,gfmFootnoteDefinition:R4e}}}function z4e(t){let e=!1;return t&&t.firstLineBlank&&(e=!0),{handlers:{footnoteDefinition:n,footnoteReference:jV},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,s,i,a){const l=i.createTracker(a);let c=l.move("[^");const d=i.enter("footnoteDefinition"),h=i.enter("label");return c+=l.move(i.safe(i.associationId(r),{before:c,after:"]"})),h(),c+=l.move("]:"),r.children&&r.children.length>0&&(l.shift(4),c+=l.move((e?`
`:" ")+i.indentLines(i.containerFlow(r,l.current()),e?NV:I4e))),d(),c}}function I4e(t,e,n){return e===0?t:NV(t,e,n)}function NV(t,e,n){return(n?"":" ")+t}const L4e=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];CV.peek=H4e;function B4e(){return{canContainEols:["delete"],enter:{strikethrough:q4e},exit:{strikethrough:$4e}}}function F4e(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:L4e}],handlers:{delete:CV}}}function q4e(t){this.enter({type:"delete",children:[]},t)}function $4e(t){this.exit(t)}function CV(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 H4e(){return"~"}function Q4e(t){return t.length}function V4e(t,e){const n=e||{},r=(n.align||[]).concat(),s=n.stringLength||Q4e,i=[],a=[],l=[],c=[];let d=0,h=-1;for(;++h<t.length;){const w=[],S=[];let k=-1;for(t[h].length>d&&(d=t[h].length);++k<t[h].length;){const j=U4e(t[h][k]);if(n.alignDelimiters!==!1){const N=s(j);S[k]=N,(c[k]===void 0||N>c[k])&&(c[k]=N)}w.push(j)}a[h]=w,l[h]=S}let m=-1;if(typeof r=="object"&&"length"in r)for(;++m<d;)i[m]=rR(r[m]);else{const w=rR(r);for(;++m<d;)i[m]=w}m=-1;const g=[],x=[];for(;++m<d;){const w=i[m];let S="",k="";w===99?(S=":",k=":"):w===108?S=":":w===114&&(k=":");let j=n.alignDelimiters===!1?1:Math.max(1,c[m]-S.length-k.length);const N=S+"-".repeat(j)+k;n.alignDelimiters!==!1&&(j=S.length+j+k.length,j>c[m]&&(c[m]=j),x[m]=j),g[m]=N}a.splice(1,0,g),l.splice(1,0,x),h=-1;const y=[];for(;++h<a.length;){const w=a[h],S=l[h];m=-1;const k=[];for(;++m<d;){const j=w[m]||"";let N="",T="";if(n.alignDelimiters!==!1){const E=c[m]-(S[m]||0),_=i[m];_===114?N=" ".repeat(E):_===99?E%2?(N=" ".repeat(E/2+.5),T=" ".repeat(E/2-.5)):(N=" ".repeat(E/2),T=N):T=" ".repeat(E)}n.delimiterStart!==!1&&!m&&k.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&j==="")&&(n.delimiterStart!==!1||m)&&k.push(" "),n.alignDelimiters!==!1&&k.push(N),k.push(j),n.alignDelimiters!==!1&&k.push(T),n.padding!==!1&&k.push(" "),(n.delimiterEnd!==!1||m!==d-1)&&k.push("|")}y.push(n.delimiterEnd===!1?k.join("").replace(/ +$/,""):k.join(""))}return y.join(`
`)}function U4e(t){return t==null?"":String(t)}function rR(t){const e=typeof t=="string"?t.codePointAt(0):0;return e===67||e===99?99:e===76||e===108?108:e===82||e===114?114:0}function W4e(t,e,n,r){const s=n.enter("blockquote"),i=n.createTracker(r);i.move("> "),i.shift(2);const a=n.indentLines(n.containerFlow(t,i.current()),G4e);return s(),a}function G4e(t,e,n){return">"+(n?"":" ")+t}function X4e(t,e){return sR(t,e.inConstruct,!0)&&!sR(t,e.notInConstruct,!1)}function sR(t,e,n){if(typeof e=="string"&&(e=[e]),!e||e.length===0)return n;let r=-1;for(;++r<e.length;)if(t.includes(e[r]))return!0;return!1}function iR(t,e,n,r){let s=-1;for(;++s<n.unsafe.length;)if(n.unsafe[s].character===`
`&&X4e(n.stack,n.unsafe[s]))return/[ \t]/.test(r.before)?"":" ";return`\\
`}function TV(t,e){const n=String(t);let r=n.indexOf(e),s=r,i=0,a=0;if(typeof e!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===s?++i>a&&(a=i):i=1,s=r+e.length,r=n.indexOf(e,s);return a}function Y4e(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 K4e(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 Z4e(t,e,n,r){const s=K4e(n),i=t.value||"",a=s==="`"?"GraveAccent":"Tilde";if(Y4e(t,n)){const m=n.enter("codeIndented"),g=n.indentLines(i,J4e);return m(),g}const l=n.createTracker(r),c=s.repeat(Math.max(TV(i,s)+1,3)),d=n.enter("codeFenced");let h=l.move(c);if(t.lang){const m=n.enter(`codeFencedLang${a}`);h+=l.move(n.safe(t.lang,{before:h,after:" ",encode:["`"],...l.current()})),m()}if(t.lang&&t.meta){const m=n.enter(`codeFencedMeta${a}`);h+=l.move(" "),h+=l.move(n.safe(t.meta,{before:h,after:`
`,encode:["`"],...l.current()})),m()}return h+=l.move(`
`),i&&(h+=l.move(i+`
`)),h+=l.move(c),d(),h}function J4e(t,e,n){return(n?"":" ")+t}function wN(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 eSe(t,e,n,r){const s=wN(n),i=s==='"'?"Quote":"Apostrophe",a=n.enter("definition");let l=n.enter("label");const c=n.createTracker(r);let d=c.move("[");return d+=c.move(n.safe(n.associationId(t),{before:d,after:"]",...c.current()})),d+=c.move("]: "),l(),!t.url||/[\0- \u007F]/.test(t.url)?(l=n.enter("destinationLiteral"),d+=c.move("<"),d+=c.move(n.safe(t.url,{before:d,after:">",...c.current()})),d+=c.move(">")):(l=n.enter("destinationRaw"),d+=c.move(n.safe(t.url,{before:d,after:t.title?" ":`
`,...c.current()}))),l(),t.title&&(l=n.enter(`title${i}`),d+=c.move(" "+s),d+=c.move(n.safe(t.title,{before:d,after:s,...c.current()})),d+=c.move(s),l()),a(),d}function tSe(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 gp(t){return"&#x"+t.toString(16).toUpperCase()+";"}function wy(t,e,n){const r=hf(t),s=hf(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}}EV.peek=nSe;function EV(t,e,n,r){const s=tSe(n),i=n.enter("emphasis"),a=n.createTracker(r),l=a.move(s);let c=a.move(n.containerPhrasing(t,{after:s,before:l,...a.current()}));const d=c.charCodeAt(0),h=wy(r.before.charCodeAt(r.before.length-1),d,s);h.inside&&(c=gp(d)+c.slice(1));const m=c.charCodeAt(c.length-1),g=wy(r.after.charCodeAt(0),m,s);g.inside&&(c=c.slice(0,-1)+gp(m));const x=a.move(s);return i(),n.attentionEncodeSurroundingInfo={after:g.outside,before:h.outside},l+c+x}function nSe(t,e,n){return n.options.emphasis||"*"}function rSe(t,e){let n=!1;return yN(t,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,RO}),!!((!t.depth||t.depth<3)&&dN(t)&&(e.options.setext||n))}function sSe(t,e,n,r){const s=Math.max(Math.min(6,t.depth||1),1),i=n.createTracker(r);if(rSe(t,n)){const h=n.enter("headingSetext"),m=n.enter("phrasing"),g=n.containerPhrasing(t,{...i.current(),before:`
`,after:`
`});return m(),h(),g+`
`+(s===1?"=":"-").repeat(g.length-(Math.max(g.lastIndexOf("\r"),g.lastIndexOf(`
`))+1))}const a="#".repeat(s),l=n.enter("headingAtx"),c=n.enter("phrasing");i.move(a+" ");let d=n.containerPhrasing(t,{before:"# ",after:`
`,...i.current()});return/^[\t ]/.test(d)&&(d=gp(d.charCodeAt(0))+d.slice(1)),d=d?a+" "+d:a,n.options.closeAtx&&(d+=" "+a),c(),l(),d}_V.peek=iSe;function _V(t){return t.value||""}function iSe(){return"<"}AV.peek=aSe;function AV(t,e,n,r){const s=wN(n),i=s==='"'?"Quote":"Apostrophe",a=n.enter("image");let l=n.enter("label");const c=n.createTracker(r);let d=c.move("![");return d+=c.move(n.safe(t.alt,{before:d,after:"]",...c.current()})),d+=c.move("]("),l(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(l=n.enter("destinationLiteral"),d+=c.move("<"),d+=c.move(n.safe(t.url,{before:d,after:">",...c.current()})),d+=c.move(">")):(l=n.enter("destinationRaw"),d+=c.move(n.safe(t.url,{before:d,after:t.title?" ":")",...c.current()}))),l(),t.title&&(l=n.enter(`title${i}`),d+=c.move(" "+s),d+=c.move(n.safe(t.title,{before:d,after:s,...c.current()})),d+=c.move(s),l()),d+=c.move(")"),a(),d}function aSe(){return"!"}MV.peek=oSe;function MV(t,e,n,r){const s=t.referenceType,i=n.enter("imageReference");let a=n.enter("label");const l=n.createTracker(r);let c=l.move("![");const d=n.safe(t.alt,{before:c,after:"]",...l.current()});c+=l.move(d+"]["),a();const h=n.stack;n.stack=[],a=n.enter("reference");const m=n.safe(n.associationId(t),{before:c,after:"]",...l.current()});return a(),n.stack=h,i(),s==="full"||!d||d!==m?c+=l.move(m+"]"):s==="shortcut"?c=c.slice(0,-1):c+=l.move("]"),c}function oSe(){return"!"}RV.peek=lSe;function RV(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<n.unsafe.length;){const a=n.unsafe[i],l=n.compilePattern(a);let c;if(a.atBreak)for(;c=l.exec(r);){let d=c.index;r.charCodeAt(d)===10&&r.charCodeAt(d-1)===13&&d--,r=r.slice(0,d)+" "+r.slice(c.index+1)}}return s+r+s}function lSe(){return"`"}function DV(t,e){const n=dN(t);return!!(!e.options.resourceLink&&t.url&&!t.title&&t.children&&t.children.length===1&&t.children[0].type==="text"&&(n===t.url||"mailto:"+n===t.url)&&/^[a-z][a-z+.-]+:/i.test(t.url)&&!/[\0- <>\u007F]/.test(t.url))}PV.peek=cSe;function PV(t,e,n,r){const s=wN(n),i=s==='"'?"Quote":"Apostrophe",a=n.createTracker(r);let l,c;if(DV(t,n)){const h=n.stack;n.stack=[],l=n.enter("autolink");let m=a.move("<");return m+=a.move(n.containerPhrasing(t,{before:m,after:">",...a.current()})),m+=a.move(">"),l(),n.stack=h,m}l=n.enter("link"),c=n.enter("label");let d=a.move("[");return d+=a.move(n.containerPhrasing(t,{before:d,after:"](",...a.current()})),d+=a.move("]("),c(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(c=n.enter("destinationLiteral"),d+=a.move("<"),d+=a.move(n.safe(t.url,{before:d,after:">",...a.current()})),d+=a.move(">")):(c=n.enter("destinationRaw"),d+=a.move(n.safe(t.url,{before:d,after:t.title?" ":")",...a.current()}))),c(),t.title&&(c=n.enter(`title${i}`),d+=a.move(" "+s),d+=a.move(n.safe(t.title,{before:d,after:s,...a.current()})),d+=a.move(s),c()),d+=a.move(")"),l(),d}function cSe(t,e,n){return DV(t,n)?"<":"["}zV.peek=uSe;function zV(t,e,n,r){const s=t.referenceType,i=n.enter("linkReference");let a=n.enter("label");const l=n.createTracker(r);let c=l.move("[");const d=n.containerPhrasing(t,{before:c,after:"]",...l.current()});c+=l.move(d+"]["),a();const h=n.stack;n.stack=[],a=n.enter("reference");const m=n.safe(n.associationId(t),{before:c,after:"]",...l.current()});return a(),n.stack=h,i(),s==="full"||!d||d!==m?c+=l.move(m+"]"):s==="shortcut"?c=c.slice(0,-1):c+=l.move("]"),c}function uSe(){return"["}function SN(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 dSe(t){const e=SN(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 hSe(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 IV(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 fSe(t,e,n,r){const s=n.enter("list"),i=n.bulletCurrent;let a=t.ordered?hSe(n):SN(n);const l=t.ordered?a==="."?")":".":dSe(n);let c=e&&n.bulletLastUsed?a===n.bulletLastUsed:!1;if(!t.ordered){const h=t.children?t.children[0]:void 0;if((a==="*"||a==="-")&&h&&(!h.children||!h.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),IV(n)===a&&h){let m=-1;for(;++m<t.children.length;){const g=t.children[m];if(g&&g.type==="listItem"&&g.children&&g.children[0]&&g.children[0].type==="thematicBreak"){c=!0;break}}}}c&&(a=l),n.bulletCurrent=a;const d=n.containerFlow(t,r);return n.bulletLastUsed=a,n.bulletCurrent=i,s(),d}function mSe(t){const e=t.options.listItemIndent||"one";if(e!=="tab"&&e!=="one"&&e!=="mixed")throw new Error("Cannot serialize items with `"+e+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return e}function pSe(t,e,n,r){const s=mSe(n);let i=n.bulletCurrent||SN(n);e&&e.type==="list"&&e.ordered&&(i=(typeof e.start=="number"&&e.start>-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 l=n.createTracker(r);l.move(i+" ".repeat(a-i.length)),l.shift(a);const c=n.enter("listItem"),d=n.indentLines(n.containerFlow(t,l.current()),h);return c(),d;function h(m,g,x){return g?(x?"":" ".repeat(a))+m:(x?i:i+" ".repeat(a-i.length))+m}}function gSe(t,e,n,r){const s=n.enter("paragraph"),i=n.enter("phrasing"),a=n.containerPhrasing(t,r);return i(),s(),a}const xSe=hg(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function vSe(t,e,n,r){return(t.children.some(function(a){return xSe(a)})?n.containerPhrasing:n.containerFlow).call(n,t,r)}function ySe(t){const e=t.options.strong||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize strong with `"+e+"` for `options.strong`, expected `*`, or `_`");return e}LV.peek=bSe;function LV(t,e,n,r){const s=ySe(n),i=n.enter("strong"),a=n.createTracker(r),l=a.move(s+s);let c=a.move(n.containerPhrasing(t,{after:s,before:l,...a.current()}));const d=c.charCodeAt(0),h=wy(r.before.charCodeAt(r.before.length-1),d,s);h.inside&&(c=gp(d)+c.slice(1));const m=c.charCodeAt(c.length-1),g=wy(r.after.charCodeAt(0),m,s);g.inside&&(c=c.slice(0,-1)+gp(m));const x=a.move(s+s);return i(),n.attentionEncodeSurroundingInfo={after:g.outside,before:h.outside},l+c+x}function bSe(t,e,n){return n.options.strong||"*"}function wSe(t,e,n,r){return n.safe(t.value,r)}function SSe(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 kSe(t,e,n){const r=(IV(n)+(n.options.ruleSpaces?" ":"")).repeat(SSe(n));return n.options.ruleSpaces?r.slice(0,-1):r}const BV={blockquote:W4e,break:iR,code:Z4e,definition:eSe,emphasis:EV,hardBreak:iR,heading:sSe,html:_V,image:AV,imageReference:MV,inlineCode:RV,link:PV,linkReference:zV,list:fSe,listItem:pSe,paragraph:gSe,root:vSe,strong:LV,text:wSe,thematicBreak:kSe};function OSe(){return{enter:{table:jSe,tableData:aR,tableHeader:aR,tableRow:CSe},exit:{codeText:TSe,table:NSe,tableData:QS,tableHeader:QS,tableRow:QS}}}function jSe(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 NSe(t){this.exit(t),this.data.inTable=void 0}function CSe(t){this.enter({type:"tableRow",children:[]},t)}function QS(t){this.exit(t)}function aR(t){this.enter({type:"tableCell",children:[]},t)}function TSe(t){let e=this.resume();this.data.inTable&&(e=e.replace(/\\([\\|])/g,ESe));const n=this.stack[this.stack.length-1];n.type,n.value=e,this.exit(t)}function ESe(t,e){return e==="|"?e:t}function _Se(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:l}};function a(x,y,w,S){return d(h(x,w,S),x.align)}function l(x,y,w,S){const k=m(x,w,S),j=d([k]);return j.slice(0,j.indexOf(`
`))}function c(x,y,w,S){const k=w.enter("tableCell"),j=w.enter("phrasing"),N=w.containerPhrasing(x,{...S,before:i,after:i});return j(),k(),N}function d(x,y){return V4e(x,{align:y,alignDelimiters:r,padding:n,stringLength:s})}function h(x,y,w){const S=x.children;let k=-1;const j=[],N=y.enter("table");for(;++k<S.length;)j[k]=m(S[k],y,w);return N(),j}function m(x,y,w){const S=x.children;let k=-1;const j=[],N=y.enter("tableRow");for(;++k<S.length;)j[k]=c(S[k],x,y,w);return N(),j}function g(x,y,w){let S=BV.inlineCode(x,y,w);return w.stack.includes("tableCell")&&(S=S.replace(/\|/g,"\\$&")),S}}function ASe(){return{exit:{taskListCheckValueChecked:oR,taskListCheckValueUnchecked:oR,paragraph:RSe}}}function MSe(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:DSe}}}function oR(t){const e=this.stack[this.stack.length-2];e.type,e.checked=t.type==="taskListCheckValueChecked"}function RSe(t){const e=this.stack[this.stack.length-2];if(e&&e.type==="listItem"&&typeof e.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const s=e.children;let i=-1,a;for(;++i<s.length;){const l=s[i];if(l.type==="paragraph"){a=l;break}}a===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(t)}function DSe(t,e,n,r){const s=t.children[0],i=typeof t.checked=="boolean"&&s&&s.type==="paragraph",a="["+(t.checked?"x":" ")+"] ",l=n.createTracker(r);i&&l.move(a);let c=BV.listItem(t,e,n,{...r,...l.current()});return i&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,d)),c;function d(h){return h+a}}function PSe(){return[m4e(),P4e(),B4e(),OSe(),ASe()]}function zSe(t){return{extensions:[p4e(),z4e(t),F4e(),_Se(t),MSe()]}}const ISe={tokenize:HSe,partial:!0},FV={tokenize:QSe,partial:!0},qV={tokenize:VSe,partial:!0},$V={tokenize:USe,partial:!0},LSe={tokenize:WSe,partial:!0},HV={name:"wwwAutolink",tokenize:qSe,previous:VV},QV={name:"protocolAutolink",tokenize:$Se,previous:UV},Kl={name:"emailAutolink",tokenize:FSe,previous:WV},Qo={};function BSe(){return{text:Qo}}let Du=48;for(;Du<123;)Qo[Du]=Kl,Du++,Du===58?Du=65:Du===91&&(Du=97);Qo[43]=Kl;Qo[45]=Kl;Qo[46]=Kl;Qo[95]=Kl;Qo[72]=[Kl,QV];Qo[104]=[Kl,QV];Qo[87]=[Kl,HV];Qo[119]=[Kl,HV];function FSe(t,e,n){const r=this;let s,i;return a;function a(m){return!IO(m)||!WV.call(r,r.previous)||kN(r.events)?n(m):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),l(m))}function l(m){return IO(m)?(t.consume(m),l):m===64?(t.consume(m),c):n(m)}function c(m){return m===46?t.check(LSe,h,d)(m):m===45||m===95||Vs(m)?(i=!0,t.consume(m),c):h(m)}function d(m){return t.consume(m),s=!0,c}function h(m){return i&&s&&Js(r.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),e(m)):n(m)}}function qSe(t,e,n){const r=this;return s;function s(a){return a!==87&&a!==119||!VV.call(r,r.previous)||kN(r.events)?n(a):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(ISe,t.attempt(FV,t.attempt(qV,i),n),n)(a))}function i(a){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),e(a)}}function $Se(t,e,n){const r=this;let s="",i=!1;return a;function a(m){return(m===72||m===104)&&UV.call(r,r.previous)&&!kN(r.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),s+=String.fromCodePoint(m),t.consume(m),l):n(m)}function l(m){if(Js(m)&&s.length<5)return s+=String.fromCodePoint(m),t.consume(m),l;if(m===58){const g=s.toLowerCase();if(g==="http"||g==="https")return t.consume(m),c}return n(m)}function c(m){return m===47?(t.consume(m),i?d:(i=!0,c)):n(m)}function d(m){return m===null||vy(m)||or(m)||fd(m)||Ib(m)?n(m):t.attempt(FV,t.attempt(qV,h),n)(m)}function h(m){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),e(m)}}function HSe(t,e,n){let r=0;return s;function s(a){return(a===87||a===119)&&r<3?(r++,t.consume(a),s):a===46&&r===3?(t.consume(a),i):n(a)}function i(a){return a===null?n(a):e(a)}}function QSe(t,e,n){let r,s,i;return a;function a(d){return d===46||d===95?t.check($V,c,l)(d):d===null||or(d)||fd(d)||d!==45&&Ib(d)?c(d):(i=!0,t.consume(d),a)}function l(d){return d===95?r=!0:(s=r,r=void 0),t.consume(d),a}function c(d){return s||r||!i?n(d):e(d)}}function VSe(t,e){let n=0,r=0;return s;function s(a){return a===40?(n++,t.consume(a),s):a===41&&r<n?i(a):a===33||a===34||a===38||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===60||a===63||a===93||a===95||a===126?t.check($V,e,i)(a):a===null||or(a)||fd(a)?e(a):(t.consume(a),s)}function i(a){return a===41&&r++,t.consume(a),s}}function USe(t,e,n){return r;function r(l){return l===33||l===34||l===39||l===41||l===42||l===44||l===46||l===58||l===59||l===63||l===95||l===126?(t.consume(l),r):l===38?(t.consume(l),i):l===93?(t.consume(l),s):l===60||l===null||or(l)||fd(l)?e(l):n(l)}function s(l){return l===null||l===40||l===91||or(l)||fd(l)?e(l):r(l)}function i(l){return Js(l)?a(l):n(l)}function a(l){return l===59?(t.consume(l),r):Js(l)?(t.consume(l),a):n(l)}}function WSe(t,e,n){return r;function r(i){return t.consume(i),s}function s(i){return Vs(i)?n(i):e(i)}}function VV(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||or(t)}function UV(t){return!Js(t)}function WV(t){return!(t===47||IO(t))}function IO(t){return t===43||t===45||t===46||t===95||Vs(t)}function kN(t){let e=t.length,n=!1;for(;e--;){const r=t[e][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return t.length>0&&!n&&(t[t.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const GSe={tokenize:n5e,partial:!0};function XSe(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:JSe,continuation:{tokenize:e5e},exit:t5e}},text:{91:{name:"gfmFootnoteCall",tokenize:ZSe},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:YSe,resolveTo:KSe}}}}function YSe(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 l;function l(c){if(!a||!a._balanced)return n(c);const d=Ga(r.sliceSerialize({start:a.end,end:r.now()}));return d.codePointAt(0)!==94||!i.includes(d.slice(1))?n(c):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(c),t.exit("gfmFootnoteCallLabelMarker"),e(c))}}function KSe(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)},l=[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,...l),t}function ZSe(t,e,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i=0,a;return l;function l(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",d)}function d(m){if(i>999||m===93&&!a||m===null||m===91||or(m))return n(m);if(m===93){t.exit("chunkString");const g=t.exit("gfmFootnoteCallString");return s.includes(Ga(r.sliceSerialize(g)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(m),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),e):n(m)}return or(m)||(a=!0),i++,t.consume(m),m===92?h:d}function h(m){return m===91||m===92||m===93?(t.consume(m),i++,d):d(m)}}function JSe(t,e,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i,a=0,l;return c;function c(y){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(y),t.exit("gfmFootnoteDefinitionLabelMarker"),d}function d(y){return y===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(y),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",h):n(y)}function h(y){if(a>999||y===93&&!l||y===null||y===91||or(y))return n(y);if(y===93){t.exit("chunkString");const w=t.exit("gfmFootnoteDefinitionLabelString");return i=Ga(r.sliceSerialize(w)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(y),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),g}return or(y)||(l=!0),a++,t.consume(y),y===92?m:h}function m(y){return y===91||y===92||y===93?(t.consume(y),a++,h):h(y)}function g(y){return y===58?(t.enter("definitionMarker"),t.consume(y),t.exit("definitionMarker"),s.includes(i)||s.push(i),on(t,x,"gfmFootnoteDefinitionWhitespace")):n(y)}function x(y){return e(y)}}function e5e(t,e,n){return t.check(dg,e,t.attempt(GSe,e,n))}function t5e(t){t.exit("gfmFootnoteDefinition")}function n5e(t,e,n){const r=this;return on(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 r5e(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,l){let c=-1;for(;++c<a.length;)if(a[c][0]==="enter"&&a[c][1].type==="strikethroughSequenceTemporary"&&a[c][1]._close){let d=c;for(;d--;)if(a[d][0]==="exit"&&a[d][1].type==="strikethroughSequenceTemporary"&&a[d][1]._open&&a[c][1].end.offset-a[c][1].start.offset===a[d][1].end.offset-a[d][1].start.offset){a[c][1].type="strikethroughSequence",a[d][1].type="strikethroughSequence";const h={type:"strikethrough",start:Object.assign({},a[d][1].start),end:Object.assign({},a[c][1].end)},m={type:"strikethroughText",start:Object.assign({},a[d][1].end),end:Object.assign({},a[c][1].start)},g=[["enter",h,l],["enter",a[d][1],l],["exit",a[d][1],l],["enter",m,l]],x=l.parser.constructs.insideSpan.null;x&&Gi(g,g.length,0,Lb(x,a.slice(d+1,c),l)),Gi(g,g.length,0,[["exit",m,l],["enter",a[c][1],l],["exit",a[c][1],l],["exit",h,l]]),Gi(a,d-1,c-d+3,g),c=d+g.length-2;break}}for(c=-1;++c<a.length;)a[c][1].type==="strikethroughSequenceTemporary"&&(a[c][1].type="data");return a}function i(a,l,c){const d=this.previous,h=this.events;let m=0;return g;function g(y){return d===126&&h[h.length-1][1].type!=="characterEscape"?c(y):(a.enter("strikethroughSequenceTemporary"),x(y))}function x(y){const w=hf(d);if(y===126)return m>1?c(y):(a.consume(y),m++,x);if(m<2&&!n)return c(y);const S=a.exit("strikethroughSequenceTemporary"),k=hf(y);return S._open=!k||k===2&&!!w,S._close=!w||w===2&&!!k,l(y)}}}class s5e{constructor(){this.map=[]}add(e,n,r){i5e(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 i5e(t,e,n,r){let s=0;if(!(n===0&&r.length===0)){for(;s<t.map.length;){if(t.map[s][0]===e){t.map[s][1]+=n,t.map[s][2].push(...r);return}s+=1}t.map.push([e,n,r])}}function a5e(t,e){let n=!1;const r=[];for(;e<t.length;){const s=t[e];if(n){if(s[0]==="enter")s[1].type==="tableContent"&&r.push(t[e+1][1].type==="tableDelimiterMarker"?"left":"none");else if(s[1].type==="tableContent"){if(t[e-1][1].type==="tableDelimiterMarker"){const i=r.length-1;r[i]=r[i]==="left"?"center":"right"}}else if(s[1].type==="tableDelimiterRow")break}else s[0]==="enter"&&s[1].type==="tableDelimiterRow"&&(n=!0);e+=1}return r}function o5e(){return{flow:{null:{name:"table",tokenize:l5e,resolveAll:c5e}}}}function l5e(t,e,n){const r=this;let s=0,i=0,a;return l;function l(B){let $=r.events.length-1;for(;$>-1;){const z=r.events[$][1].type;if(z==="lineEnding"||z==="linePrefix")$--;else break}const U=$>-1?r.events[$][1].type:null,te=U==="tableHead"||U==="tableRow"?_:c;return te===_&&r.parser.lazy[r.now().line]?n(B):te(B)}function c(B){return t.enter("tableHead"),t.enter("tableRow"),d(B)}function d(B){return B===124||(a=!0,i+=1),h(B)}function h(B){return B===null?n(B):bt(B)?i>1?(i=0,r.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(B),t.exit("lineEnding"),x):n(B):dn(B)?on(t,h,"whitespace")(B):(i+=1,a&&(a=!1,s+=1),B===124?(t.enter("tableCellDivider"),t.consume(B),t.exit("tableCellDivider"),a=!0,h):(t.enter("data"),m(B)))}function m(B){return B===null||B===124||or(B)?(t.exit("data"),h(B)):(t.consume(B),B===92?g:m)}function g(B){return B===92||B===124?(t.consume(B),m):m(B)}function x(B){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(B):(t.enter("tableDelimiterRow"),a=!1,dn(B)?on(t,y,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(B):y(B))}function y(B){return B===45||B===58?S(B):B===124?(a=!0,t.enter("tableCellDivider"),t.consume(B),t.exit("tableCellDivider"),w):E(B)}function w(B){return dn(B)?on(t,S,"whitespace")(B):S(B)}function S(B){return B===58?(i+=1,a=!0,t.enter("tableDelimiterMarker"),t.consume(B),t.exit("tableDelimiterMarker"),k):B===45?(i+=1,k(B)):B===null||bt(B)?T(B):E(B)}function k(B){return B===45?(t.enter("tableDelimiterFiller"),j(B)):E(B)}function j(B){return B===45?(t.consume(B),j):B===58?(a=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(B),t.exit("tableDelimiterMarker"),N):(t.exit("tableDelimiterFiller"),N(B))}function N(B){return dn(B)?on(t,T,"whitespace")(B):T(B)}function T(B){return B===124?y(B):B===null||bt(B)?!a||s!==i?E(B):(t.exit("tableDelimiterRow"),t.exit("tableHead"),e(B)):E(B)}function E(B){return n(B)}function _(B){return t.enter("tableRow"),A(B)}function A(B){return B===124?(t.enter("tableCellDivider"),t.consume(B),t.exit("tableCellDivider"),A):B===null||bt(B)?(t.exit("tableRow"),e(B)):dn(B)?on(t,A,"whitespace")(B):(t.enter("data"),L(B))}function L(B){return B===null||B===124||or(B)?(t.exit("data"),A(B)):(t.consume(B),B===92?P:L)}function P(B){return B===92||B===124?(t.consume(B),L):L(B)}}function c5e(t,e){let n=-1,r=!0,s=0,i=[0,0,0,0],a=[0,0,0,0],l=!1,c=0,d,h,m;const g=new s5e;for(;++n<t.length;){const x=t[n],y=x[1];x[0]==="enter"?y.type==="tableHead"?(l=!1,c!==0&&(lR(g,e,c,d,h),h=void 0,c=0),d={type:"table",start:Object.assign({},y.start),end:Object.assign({},y.end)},g.add(n,0,[["enter",d,e]])):y.type==="tableRow"||y.type==="tableDelimiterRow"?(r=!0,m=void 0,i=[0,0,0,0],a=[0,n+1,0,0],l&&(l=!1,h={type:"tableBody",start:Object.assign({},y.start),end:Object.assign({},y.end)},g.add(n,0,[["enter",h,e]])),s=y.type==="tableDelimiterRow"?2:h?3:1):s&&(y.type==="data"||y.type==="tableDelimiterMarker"||y.type==="tableDelimiterFiller")?(r=!1,a[2]===0&&(i[1]!==0&&(a[0]=a[1],m=_1(g,e,i,s,void 0,m),i=[0,0,0,0]),a[2]=n)):y.type==="tableCellDivider"&&(r?r=!1:(i[1]!==0&&(a[0]=a[1],m=_1(g,e,i,s,void 0,m)),i=a,a=[i[1],n,0,0])):y.type==="tableHead"?(l=!0,c=n):y.type==="tableRow"||y.type==="tableDelimiterRow"?(c=n,i[1]!==0?(a[0]=a[1],m=_1(g,e,i,s,n,m)):a[1]!==0&&(m=_1(g,e,a,s,n,m)),s=0):s&&(y.type==="data"||y.type==="tableDelimiterMarker"||y.type==="tableDelimiterFiller")&&(a[3]=n)}for(c!==0&&lR(g,e,c,d,h),g.consume(e.events),n=-1;++n<e.events.length;){const x=e.events[n];x[0]==="enter"&&x[1].type==="table"&&(x[1]._align=a5e(e.events,n))}return t}function _1(t,e,n,r,s,i){const a=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",l="tableContent";n[0]!==0&&(i.end=Object.assign({},kh(e.events,n[0])),t.add(n[0],0,[["exit",i,e]]));const c=kh(e.events,n[1]);if(i={type:a,start:Object.assign({},c),end:Object.assign({},c)},t.add(n[1],0,[["enter",i,e]]),n[2]!==0){const d=kh(e.events,n[2]),h=kh(e.events,n[3]),m={type:l,start:Object.assign({},d),end:Object.assign({},h)};if(t.add(n[2],0,[["enter",m,e]]),r!==2){const g=e.events[n[2]],x=e.events[n[3]];if(g[1].end=Object.assign({},x[1].end),g[1].type="chunkText",g[1].contentType="text",n[3]>n[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({},kh(e.events,s)),t.add(s,0,[["exit",i,e]]),i=void 0),i}function lR(t,e,n,r,s){const i=[],a=kh(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 kh(t,e){const n=t[e],r=n[0]==="enter"?"start":"end";return n[1][r]}const u5e={name:"tasklistCheck",tokenize:h5e};function d5e(){return{text:{91:u5e}}}function h5e(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 or(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"),l):n(c)}function l(c){return bt(c)?e(c):dn(c)?t.check({tokenize:f5e},e,n)(c):n(c)}}function f5e(t,e,n){return on(t,r,"whitespace");function r(s){return s===null?n(s):e(s)}}function m5e(t){return rV([BSe(),XSe(),r5e(t),o5e(),d5e()])}const p5e={};function g5e(t){const e=this,n=t||p5e,r=e.data(),s=r.micromarkExtensions||(r.micromarkExtensions=[]),i=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),a=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);s.push(m5e(n)),i.push(PSe()),a.push(zSe(n))}function x5e(){return{enter:{mathFlow:t,mathFlowFenceMeta:e,mathText:i},exit:{mathFlow:s,mathFlowFence:r,mathFlowFenceMeta:n,mathFlowValue:l,mathText:a,mathTextData:l}};function t(c){const d={type:"element",tagName:"code",properties:{className:["language-math","math-display"]},children:[]};this.enter({type:"math",meta:null,value:"",data:{hName:"pre",hChildren:[d]}},c)}function e(){this.buffer()}function n(){const c=this.resume(),d=this.stack[this.stack.length-1];d.type,d.meta=c}function r(){this.data.mathFlowInside||(this.buffer(),this.data.mathFlowInside=!0)}function s(c){const d=this.resume().replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),h=this.stack[this.stack.length-1];h.type,this.exit(c),h.value=d;const m=h.data.hChildren[0];m.type,m.tagName,m.children.push({type:"text",value:d}),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 d=this.resume(),h=this.stack[this.stack.length-1];h.type,this.exit(c),h.value=d,h.data.hChildren.push({type:"text",value:d})}function l(c){this.config.enter.data.call(this,c),this.config.exit.data.call(this,c)}}function v5e(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,l,c){const d=i.value||"",h=l.createTracker(c),m="$".repeat(Math.max(TV(d,"$")+1,2)),g=l.enter("mathFlow");let x=h.move(m);if(i.meta){const y=l.enter("mathFlowMeta");x+=h.move(l.safe(i.meta,{after:`
`,before:x,encode:["$"],...h.current()})),y()}return x+=h.move(`
`),d&&(x+=h.move(d+`
`)),x+=h.move(m),g(),x}function r(i,a,l){let c=i.value||"",d=1;for(e||d++;new RegExp("(^|[^$])"+"\\$".repeat(d)+"([^$]|$)").test(c);)d++;const h="$".repeat(d);/[^ \r\n]/.test(c)&&(/^[ \r\n]/.test(c)&&/[ \r\n]$/.test(c)||/^\$|\$$/.test(c))&&(c=" "+c+" ");let m=-1;for(;++m<l.unsafe.length;){const g=l.unsafe[m];if(!g.atBreak)continue;const x=l.compilePattern(g);let y;for(;y=x.exec(c);){let w=y.index;c.codePointAt(w)===10&&c.codePointAt(w-1)===13&&w--,c=c.slice(0,w)+" "+c.slice(y.index+1)}}return h+c+h}function s(){return"$"}}const y5e={tokenize:b5e,concrete:!0,name:"mathFlow"},cR={tokenize:w5e,partial:!0};function b5e(t,e,n){const r=this,s=r.events[r.events.length-1],i=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0;let a=0;return l;function l(j){return t.enter("mathFlow"),t.enter("mathFlowFence"),t.enter("mathFlowFenceSequence"),c(j)}function c(j){return j===36?(t.consume(j),a++,c):a<2?n(j):(t.exit("mathFlowFenceSequence"),on(t,d,"whitespace")(j))}function d(j){return j===null||bt(j)?m(j):(t.enter("mathFlowFenceMeta"),t.enter("chunkString",{contentType:"string"}),h(j))}function h(j){return j===null||bt(j)?(t.exit("chunkString"),t.exit("mathFlowFenceMeta"),m(j)):j===36?n(j):(t.consume(j),h)}function m(j){return t.exit("mathFlowFence"),r.interrupt?e(j):t.attempt(cR,g,S)(j)}function g(j){return t.attempt({tokenize:k,partial:!0},S,x)(j)}function x(j){return(i?on(t,y,"linePrefix",i+1):y)(j)}function y(j){return j===null?S(j):bt(j)?t.attempt(cR,g,S)(j):(t.enter("mathFlowValue"),w(j))}function w(j){return j===null||bt(j)?(t.exit("mathFlowValue"),y(j)):(t.consume(j),w)}function S(j){return t.exit("mathFlow"),e(j)}function k(j,N,T){let E=0;return on(j,_,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4);function _(P){return j.enter("mathFlowFence"),j.enter("mathFlowFenceSequence"),A(P)}function A(P){return P===36?(E++,j.consume(P),A):E<a?T(P):(j.exit("mathFlowFenceSequence"),on(j,L,"whitespace")(P))}function L(P){return P===null||bt(P)?(j.exit("mathFlowFence"),N(P)):T(P)}}}function w5e(t,e,n){const r=this;return s;function s(a){return a===null?e(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)}}function S5e(t){let n=(t||{}).singleDollarTextMath;return n==null&&(n=!0),{tokenize:r,resolve:k5e,previous:O5e,name:"mathText"};function r(s,i,a){let l=0,c,d;return h;function h(w){return s.enter("mathText"),s.enter("mathTextSequence"),m(w)}function m(w){return w===36?(s.consume(w),l++,m):l<2&&!n?a(w):(s.exit("mathTextSequence"),g(w))}function g(w){return w===null?a(w):w===36?(d=s.enter("mathTextSequence"),c=0,y(w)):w===32?(s.enter("space"),s.consume(w),s.exit("space"),g):bt(w)?(s.enter("lineEnding"),s.consume(w),s.exit("lineEnding"),g):(s.enter("mathTextData"),x(w))}function x(w){return w===null||w===32||w===36||bt(w)?(s.exit("mathTextData"),g(w)):(s.consume(w),x)}function y(w){return w===36?(s.consume(w),c++,y):c===l?(s.exit("mathTextSequence"),s.exit("mathText"),i(w)):(d.type="mathTextData",x(w))}}}function k5e(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<e;)if(t[r][1].type==="mathTextData"){t[e][1].type="mathTextPadding",t[n][1].type="mathTextPadding",n+=2,e-=2;break}}for(r=n-1,e++;++r<=e;)s===void 0?r!==e&&t[r][1].type!=="lineEnding"&&(s=r):(r===e||t[r][1].type==="lineEnding")&&(t[s][1].type="mathTextData",r!==s+2&&(t[s][1].end=t[r-1][1].end,t.splice(s+2,r-s-2),e-=r-s-2,r=s+2),s=void 0);return t}function O5e(t){return t!==36||this.events[this.events.length-1][1].type==="characterEscape"}function j5e(t){return{flow:{36:y5e},text:{36:S5e(t)}}}class pi{constructor(e,n,r){this.lexer=void 0,this.start=void 0,this.end=void 0,this.lexer=e,this.start=n,this.end=r}static range(e,n){return n?!e||!e.loc||!n.loc||e.loc.lexer!==n.loc.lexer?null:new pi(e.loc.lexer,e.loc.start,n.loc.end):e&&e.loc}}class Xi{constructor(e,n){this.text=void 0,this.loc=void 0,this.noexpand=void 0,this.treatAsRelax=void 0,this.text=e,this.loc=n}range(e,n){return new Xi(n,pi.range(this,e))}}class $e{constructor(e,n){this.name=void 0,this.position=void 0,this.length=void 0,this.rawMessage=void 0;var r="KaTeX parse error: "+e,s,i,a=n&&n.loc;if(a&&a.start<=a.end){var l=a.lexer.input;s=a.start,i=a.end,s===l.length?r+=" at end of input: ":r+=" at position "+(s+1)+": ";var c=l.slice(s,i).replace(/[^]/g,"$&̲"),d;s>15?d="…"+l.slice(s-15,s):d=l.slice(0,s);var h;i+15<l.length?h=l.slice(i,i+15)+"…":h=l.slice(i),r+=d+c+h}var m=new Error(r);return m.name="ParseError",m.__proto__=$e.prototype,m.position=s,s!=null&&i!=null&&(m.length=i-s),m.rawMessage=e,m}}$e.prototype.__proto__=Error.prototype;var N5e=function(e,n){return e===void 0?n:e},C5e=/([A-Z])/g,T5e=function(e){return e.replace(C5e,"-$1").toLowerCase()},E5e={"&":"&amp;",">":"&gt;","<":"&lt;",'"':"&quot;","'":"&#x27;"},_5e=/[&><"']/g;function A5e(t){return String(t).replace(_5e,e=>E5e[e])}var GV=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},M5e=function(e){var n=GV(e);return n.type==="mathord"||n.type==="textord"||n.type==="atom"},R5e=function(e){if(!e)throw new Error("Expected non-null, but got "+String(e));return e},D5e=function(e){var n=/^[\x00-\x20]*([^\\/#?]*?)(:|&#0*58|&#x0*3a|&colon)/i.exec(e);return n?n[2]!==":"||!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(n[1])?null:n[1].toLowerCase():"_relative"},$n={deflt:N5e,escape:A5e,hyphenate:T5e,getBaseElem:GV,isCharacterBox:M5e,protocolFromUrl:D5e},kv={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 <type>"},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 <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 <def>",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 <size>",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 <n>",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 <n>",cliProcessor:t=>t==="Infinity"?1/0:parseInt(t)},globalGroup:{type:"boolean",cli:!1}};function P5e(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 ON{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 kv)if(kv.hasOwnProperty(n)){var r=kv[n];this[n]=e[n]!==void 0?r.processor?r.processor(e[n]):e[n]:P5e(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=$n.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 Cc{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 bo[z5e[this.id]]}sub(){return bo[I5e[this.id]]}fracNum(){return bo[L5e[this.id]]}fracDen(){return bo[B5e[this.id]]}cramp(){return bo[F5e[this.id]]}text(){return bo[q5e[this.id]]}isTight(){return this.size>=2}}var jN=0,Sy=1,$h=2,Ll=3,xp=4,Sa=5,ff=6,ti=7,bo=[new Cc(jN,0,!1),new Cc(Sy,0,!0),new Cc($h,1,!1),new Cc(Ll,1,!0),new Cc(xp,2,!1),new Cc(Sa,2,!0),new Cc(ff,3,!1),new Cc(ti,3,!0)],z5e=[xp,Sa,xp,Sa,ff,ti,ff,ti],I5e=[Sa,Sa,Sa,Sa,ti,ti,ti,ti],L5e=[$h,Ll,xp,Sa,ff,ti,ff,ti],B5e=[Ll,Ll,Sa,Sa,ti,ti,ti,ti],F5e=[Sy,Sy,Ll,Ll,Sa,Sa,ti,ti],q5e=[jN,Sy,$h,Ll,$h,Ll,$h,Ll],Et={DISPLAY:bo[jN],TEXT:bo[$h],SCRIPT:bo[xp],SCRIPTSCRIPT:bo[ff]},LO=[{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 $5e(t){for(var e=0;e<LO.length;e++)for(var n=LO[e],r=0;r<n.blocks.length;r++){var s=n.blocks[r];if(t>=s[0]&&t<=s[1])return n.name}return null}var Ov=[];LO.forEach(t=>t.blocks.forEach(e=>Ov.push(...e)));function XV(t){for(var e=0;e<Ov.length;e+=2)if(t>=Ov[e]&&t<=Ov[e+1])return!0;return!1}var ch=80,H5e=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
s173,378,173,378c0.7,0,35.3,-71,104,-213c68.7,-142,137.5,-285,206.5,-429
c69,-144,104.5,-217.7,106.5,-221
l`+e/2.075+" -"+e+`
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"},Q5e=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+`
c4.7,-7.3,11,-11,19,-11
H40000v`+(40+e)+`H1012.3
s-271.3,567,-271.3,567c-38.7,80.7,-84,175,-136,283c-52,108,-89.167,185.3,-111.5,232
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"},V5e=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
s-12,0,-12,0c-1.3,-3.3,-3.7,-11.7,-7,-25c-35.3,-125.3,-106.7,-373.3,-214,-744
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"},U5e=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
s209,968,209,968c0,-2,84.7,-361.7,254,-1079c169.3,-717.3,254.7,-1077.7,256,-1081
l`+e/4.223+" -"+e+`c4,-6.7,10,-10,18,-10 H400000
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"},W5e=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"},G5e=function(e){var n=e/2;return"M400000 "+e+" H0 L"+n+" 0 l65 45 L145 "+(e-80)+" H400000z"},X5e=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"},Y5e=function(e,n,r){n=1e3*n;var s="";switch(e){case"sqrtMain":s=H5e(n,ch);break;case"sqrtSize1":s=Q5e(n,ch);break;case"sqrtSize2":s=V5e(n,ch);break;case"sqrtSize3":s=U5e(n,ch);break;case"sqrtSize4":s=W5e(n,ch);break;case"sqrtTall":s=X5e(n,ch,r)}return s},K5e=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""}},uR={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
c2 1.7 6.3 3.5 13 5.5 68 17.3 128.2 47.8 180.5 91.5 52.3 43.7 93.8 96.2 124.5
157.5 9.3 8 15.3 12.3 18 13h6c12-.7 18-4 18-10 0-2-1.7-7-5-15-23.3-46-52-87
-86-123l-10-10h399738v-40H218c328 0 0 0 0 0l-10-8c-26.7-20-65.7-43-117-69 2.7
-2 6-3.7 10-5 36.7-16 72.3-37.3 107-64l10-8h399782v-40z
m8 0v40h399730v-40zm0 194v40h399730v-40z`,doublerightarrow:`M399738 392l
-10 10c-34 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.5s-1-5.8-3-7.5c-2-1.7-6.3-3.5-13-5.5-68
-17.3-128.2-47.8-180.5-91.5-52.3-43.7-93.8-96.2-124.5-157.5-9.3-8-15.3-12.3-18
-13h-6c-12 .7-18 4-18 10 0 2 1.7 7 5 15 23.3 46 52 87 86 123l10 10H0v40h399782
c-328 0 0 0 0 0l10 8c26.7 20 65.7 43 117 69-2.7 2-6 3.7-10 5-36.7 16-72.3 37.3
-107 64l-10 8H0v40zM0 157v40h399730v-40zm0 194v40h399730v-40z`,leftarrow:`M400000 241H110l3-3c68.7-52.7 113.7-120
135-202 4-14.7 6-23 6-25 0-7.3-7-11-21-11-8 0-13.2.8-15.5 2.5-2.3 1.7-4.2 5.8
-5.5 12.5-1.3 4.7-2.7 10.3-4 17-12 48.7-34.8 92-68.5 130S65.3 228.3 18 247
c-10 4-16 7.7-18 11 0 8.7 6 14.3 18 17 47.3 18.7 87.8 47 121.5 85S196 441.3 208
490c.7 2 1.3 5 2 9s1.2 6.7 1.5 8c.3 1.3 1 3.3 2 6s2.2 4.5 3.5 5.5c1.3 1 3.3
1.8 6 2.5s6 1 10 1c14 0 21-3.7 21-11 0-2-2-10.3-6-25-20-79.3-65-146.7-135-202
l-3-3h399890zM100 241v40h399900v-40z`,leftbrace:`M6 548l-6-6v-35l6-11c56-104 135.3-181.3 238-232 57.3-28.7 117
-45 179-50h399577v120H403c-43.3 7-81 15-113 26-100.7 33-179.7 91-237 174-2.7
5-6 9-10 13-.7 1-7.3 1-20 1H6z`,leftbraceunder:`M0 6l6-6h17c12.688 0 19.313.3 20 1 4 4 7.313 8.3 10 13
35.313 51.3 80.813 93.8 136.5 127.5 55.688 33.7 117.188 55.8 184.5 66.5.688
0 2 .3 4 1 18.688 2.7 76 4.3 172 5h399450v120H429l-6-1c-124.688-8-235-61.7
-331-161C60.687 138.7 32.312 99.3 7 54L0 41V6z`,leftgroup:`M400000 80
H435C64 80 168.3 229.4 21 260c-5.9 1.2-18 0-18 0-2 0-3-1-3-3v-38C76 61 257 0
435 0h399565z`,leftgroupunder:`M400000 262
H435C64 262 168.3 112.6 21 82c-5.9-1.2-18 0-18 0-2 0-3 1-3 3v38c76 158 257 219
435 219h399565z`,leftharpoon:`M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3
-3.3 10.2-9.5 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5
-18.3 3-21-1.3-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7
-196 228-6.7 4.7-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40z`,leftharpoonplus:`M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3-3.3 10.2-9.5
20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5-18.3 3-21-1.3
-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7-196 228-6.7 4.7
-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40zM0 435v40h400000v-40z
m0 0v40h400000v-40z`,leftharpoondown:`M7 241c-4 4-6.333 8.667-7 14 0 5.333.667 9 2 11s5.333
5.333 12 10c90.667 54 156 130 196 228 3.333 10.667 6.333 16.333 9 17 2 .667 5
1 9 1h5c10.667 0 16.667-2 18-6 2-2.667 1-9.667-3-21-32-87.333-82.667-157.667
-152-211l-3-3h399907v-40zM93 281 H400000 v-40L7 241z`,leftharpoondownplus:`M7 435c-4 4-6.3 8.7-7 14 0 5.3.7 9 2 11s5.3 5.3 12
10c90.7 54 156 130 196 228 3.3 10.7 6.3 16.3 9 17 2 .7 5 1 9 1h5c10.7 0 16.7
-2 18-6 2-2.7 1-9.7-3-21-32-87.3-82.7-157.7-152-211l-3-3h399907v-40H7zm93 0
v40h399900v-40zM0 241v40h399900v-40zm0 0v40h399900v-40z`,lefthook:`M400000 281 H103s-33-11.2-61-33.5S0 197.3 0 164s14.2-61.2 42.5
-83.5C70.8 58.2 104 47 142 47 c16.7 0 25 6.7 25 20 0 12-8.7 18.7-26 20-40 3.3
-68.7 15.7-86 37-10 12-15 25.3-15 40 0 22.7 9.8 40.7 29.5 54 19.7 13.3 43.5 21
71.5 23h399859zM103 281v-40h399897v40z`,leftlinesegment:`M40 281 V428 H0 V94 H40 V241 H400000 v40z
M40 281 V428 H0 V94 H40 V241 H400000 v40z`,leftmapsto:`M40 281 V448H0V74H40V241H400000v40z
M40 281 V448H0V74H40V241H400000v40z`,leftToFrom:`M0 147h400000v40H0zm0 214c68 40 115.7 95.7 143 167h22c15.3 0 23
-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69-70-101l-7-8h399905v-40H95l7-8
c28.7-32 52-65.7 70-101 10.7-23.3 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 265.3
68 321 0 361zm0-174v-40h399900v40zm100 154v40h399900v-40z`,longequal:`M0 50 h400000 v40H0z m0 194h40000v40H0z
M0 50 h400000 v40H0z m0 194h40000v40H0z`,midbrace:`M200428 334
c-100.7-8.3-195.3-44-280-108-55.3-42-101.7-93-139-153l-9-14c-2.7 4-5.7 8.7-9 14
-53.3 86.7-123.7 153-211 199-66.7 36-137.3 56.3-212 62H0V214h199568c178.3-11.7
311.7-78.3 403-201 6-8 9.7-12 11-12 .7-.7 6.7-1 18-1s17.3.3 18 1c1.3 0 5 4 11
12 44.7 59.3 101.3 106.3 170 141s145.3 54.3 229 60h199572v120z`,midbraceunder:`M199572 214
c100.7 8.3 195.3 44 280 108 55.3 42 101.7 93 139 153l9 14c2.7-4 5.7-8.7 9-14
53.3-86.7 123.7-153 211-199 66.7-36 137.3-56.3 212-62h199568v120H200432c-178.3
11.7-311.7 78.3-403 201-6 8-9.7 12-11 12-.7.7-6.7 1-18 1s-17.3-.3-18-1c-1.3 0
-5-4-11-12-44.7-59.3-101.3-106.3-170-141s-145.3-54.3-229-60H0V214z`,oiintSize1:`M512.6 71.6c272.6 0 320.3 106.8 320.3 178.2 0 70.8-47.7 177.6
-320.3 177.6S193.1 320.6 193.1 249.8c0-71.4 46.9-178.2 319.5-178.2z
m368.1 178.2c0-86.4-60.9-215.4-368.1-215.4-306.4 0-367.3 129-367.3 215.4 0 85.8
60.9 214.8 367.3 214.8 307.2 0 368.1-129 368.1-214.8z`,oiintSize2:`M757.8 100.1c384.7 0 451.1 137.6 451.1 230 0 91.3-66.4 228.8
-451.1 228.8-386.3 0-452.7-137.5-452.7-228.8 0-92.4 66.4-230 452.7-230z
m502.4 230c0-111.2-82.4-277.2-502.4-277.2s-504 166-504 277.2
c0 110 84 276 504 276s502.4-166 502.4-276z`,oiiintSize1:`M681.4 71.6c408.9 0 480.5 106.8 480.5 178.2 0 70.8-71.6 177.6
-480.5 177.6S202.1 320.6 202.1 249.8c0-71.4 70.5-178.2 479.3-178.2z
m525.8 178.2c0-86.4-86.8-215.4-525.7-215.4-437.9 0-524.7 129-524.7 215.4 0
85.8 86.8 214.8 524.7 214.8 438.9 0 525.7-129 525.7-214.8z`,oiiintSize2:`M1021.2 53c603.6 0 707.8 165.8 707.8 277.2 0 110-104.2 275.8
-707.8 275.8-606 0-710.2-165.8-710.2-275.8C311 218.8 415.2 53 1021.2 53z
m770.4 277.1c0-131.2-126.4-327.6-770.5-327.6S248.4 198.9 248.4 330.1
c0 130 128.8 326.4 772.7 326.4s770.5-196.4 770.5-326.4z`,rightarrow:`M0 241v40h399891c-47.3 35.3-84 78-110 128
-16.7 32-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20
11 8 0 13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7
39-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85
-40.5-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5
-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67
151.7 139 205zm0 0v40h399900v-40z`,rightbrace:`M400000 542l
-6 6h-17c-12.7 0-19.3-.3-20-1-4-4-7.3-8.3-10-13-35.3-51.3-80.8-93.8-136.5-127.5
s-117.2-55.8-184.5-66.5c-.7 0-2-.3-4-1-18.7-2.7-76-4.3-172-5H0V214h399571l6 1
c124.7 8 235 61.7 331 161 31.3 33.3 59.7 72.7 85 118l7 13v35z`,rightbraceunder:`M399994 0l6 6v35l-6 11c-56 104-135.3 181.3-238 232-57.3
28.7-117 45-179 50H-300V214h399897c43.3-7 81-15 113-26 100.7-33 179.7-91 237
-174 2.7-5 6-9 10-13 .7-1 7.3-1 20-1h17z`,rightgroup:`M0 80h399565c371 0 266.7 149.4 414 180 5.9 1.2 18 0 18 0 2 0
3-1 3-3v-38c-76-158-257-219-435-219H0z`,rightgroupunder:`M0 262h399565c371 0 266.7-149.4 414-180 5.9-1.2 18 0 18
0 2 0 3 1 3 3v38c-76 158-257 219-435 219H0z`,rightharpoon:`M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3
-3.7-15.3-11-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2
-10.7 0-16.7 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58
69.2 92 94.5zm0 0v40h399900v-40z`,rightharpoonplus:`M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3-3.7-15.3-11
-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2-10.7 0-16.7
2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58 69.2 92 94.5z
m0 0v40h399900v-40z m100 194v40h399900v-40zm0 0v40h399900v-40z`,rightharpoondown:`M399747 511c0 7.3 6.7 11 20 11 8 0 13-.8 15-2.5s4.7-6.8
8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3 8.5-5.8 9.5
-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3-64.7 57-92 95
-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 241v40h399900v-40z`,rightharpoondownplus:`M399747 705c0 7.3 6.7 11 20 11 8 0 13-.8
15-2.5s4.7-6.8 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3
8.5-5.8 9.5-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3
-64.7 57-92 95-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 435v40h399900v-40z
m0-194v40h400000v-40zm0 0v40h400000v-40z`,righthook:`M399859 241c-764 0 0 0 0 0 40-3.3 68.7-15.7 86-37 10-12 15-25.3
15-40 0-22.7-9.8-40.7-29.5-54-19.7-13.3-43.5-21-71.5-23-17.3-1.3-26-8-26-20 0
-13.3 8.7-20 26-20 38 0 71 11.2 99 33.5 0 0 7 5.6 21 16.7 14 11.2 21 33.5 21
66.8s-14 61.2-42 83.5c-28 22.3-61 33.5-99 33.5L0 241z M0 281v-40h399859v40z`,rightlinesegment:`M399960 241 V94 h40 V428 h-40 V281 H0 v-40z
M399960 241 V94 h40 V428 h-40 V281 H0 v-40z`,rightToFrom:`M400000 167c-70.7-42-118-97.7-142-167h-23c-15.3 0-23 .3-23
1 0 1.3 5.3 13.7 16 37 18 35.3 41.3 69 70 101l7 8H0v40h399905l-7 8c-28.7 32
-52 65.7-70 101-10.7 23.3-16 35.7-16 37 0 .7 7.7 1 23 1h23c24-69.3 71.3-125 142
-167z M100 147v40h399900v-40zM0 341v40h399900v-40z`,twoheadleftarrow:`M0 167c68 40
115.7 95.7 143 167h22c15.3 0 23-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69
-70-101l-7-8h125l9 7c50.7 39.3 85 86 103 140h46c0-4.7-6.3-18.7-19-42-18-35.3
-40-67.3-66-96l-9-9h399716v-40H284l9-9c26-28.7 48-60.7 66-96 12.7-23.333 19
-37.333 19-42h-46c-18 54-52.3 100.7-103 140l-9 7H95l7-8c28.7-32 52-65.7 70-101
10.7-23.333 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 71.3 68 127 0 167z`,twoheadrightarrow:`M400000 167
c-68-40-115.7-95.7-143-167h-22c-15.3 0-23 .3-23 1 0 1.3 5.3 13.7 16 37 18 35.3
41.3 69 70 101l7 8h-125l-9-7c-50.7-39.3-85-86-103-140h-46c0 4.7 6.3 18.7 19 42
18 35.3 40 67.3 66 96l9 9H0v40h399716l-9 9c-26 28.7-48 60.7-66 96-12.7 23.333
-19 37.333-19 42h46c18-54 52.3-100.7 103-140l9-7h125l-7 8c-28.7 32-52 65.7-70
101-10.7 23.333-16 35.7-16 37 0 .7 7.7 1 23 1h22c27.3-71.3 75-127 143-167z`,tilde1:`M200 55.538c-77 0-168 73.953-177 73.953-3 0-7
-2.175-9-5.437L2 97c-1-2-2-4-2-6 0-4 2-7 5-9l20-12C116 12 171 0 207 0c86 0
114 68 191 68 78 0 168-68 177-68 4 0 7 2 9 5l12 19c1 2.175 2 4.35 2 6.525 0
4.35-2 7.613-5 9.788l-19 13.05c-92 63.077-116.937 75.308-183 76.128
-68.267.847-113-73.952-191-73.952z`,tilde2:`M344 55.266c-142 0-300.638 81.316-311.5 86.418
-8.01 3.762-22.5 10.91-23.5 5.562L1 120c-1-2-1-3-1-4 0-5 3-9 8-10l18.4-9C160.9
31.9 283 0 358 0c148 0 188 122 331 122s314-97 326-97c4 0 8 2 10 7l7 21.114
c1 2.14 1 3.21 1 4.28 0 5.347-3 9.626-7 10.696l-22.3 12.622C852.6 158.372 751
181.476 676 181.476c-149 0-189-126.21-332-126.21z`,tilde3:`M786 59C457 59 32 175.242 13 175.242c-6 0-10-3.457
-11-10.37L.15 138c-1-7 3-12 10-13l19.2-6.4C378.4 40.7 634.3 0 804.3 0c337 0
411.8 157 746.8 157 328 0 754-112 773-112 5 0 10 3 11 9l1 14.075c1 8.066-.697
16.595-6.697 17.492l-21.052 7.31c-367.9 98.146-609.15 122.696-778.15 122.696
-338 0-409-156.573-744-156.573z`,tilde4:`M786 58C457 58 32 177.487 13 177.487c-6 0-10-3.345
-11-10.035L.15 143c-1-7 3-12 10-13l22-6.7C381.2 35 637.15 0 807.15 0c337 0 409
177 744 177 328 0 754-127 773-127 5 0 10 3 11 9l1 14.794c1 7.805-3 13.38-9
14.495l-20.7 5.574c-366.85 99.79-607.3 139.372-776.3 139.372-338 0-409
-175.236-744-175.236z`,vec:`M377 20c0-5.333 1.833-10 5.5-14S391 0 397 0c4.667 0 8.667 1.667 12 5
3.333 2.667 6.667 9 10 19 6.667 24.667 20.333 43.667 41 57 7.333 4.667 11
10.667 11 18 0 6-1 10-3 12s-6.667 5-14 9c-28.667 14.667-53.667 35.667-75 63
-1.333 1.333-3.167 3.5-5.5 6.5s-4 4.833-5 5.5c-1 .667-2.5 1.333-4.5 2s-4.333 1
-7 1c-4.667 0-9.167-1.833-13.5-5.5S337 184 337 178c0-12.667 15.667-32.333 47-59
H213l-171-1c-8.667-6-13-12.333-13-19 0-4.667 4.333-11.333 13-20h359
c-16-25.333-24-45-24-59z`,widehat1:`M529 0h5l519 115c5 1 9 5 9 10 0 1-1 2-1 3l-4 22
c-1 5-5 9-11 9h-2L532 67 19 159h-2c-5 0-9-4-11-9l-5-22c-1-6 2-12 8-13z`,widehat2:`M1181 0h2l1171 176c6 0 10 5 10 11l-2 23c-1 6-5 10
-11 10h-1L1182 67 15 220h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,widehat3:`M1181 0h2l1171 236c6 0 10 5 10 11l-2 23c-1 6-5 10
-11 10h-1L1182 67 15 280h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,widehat4:`M1181 0h2l1171 296c6 0 10 5 10 11l-2 23c-1 6-5 10
-11 10h-1L1182 67 15 340h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,widecheck1:`M529,159h5l519,-115c5,-1,9,-5,9,-10c0,-1,-1,-2,-1,-3l-4,-22c-1,
-5,-5,-9,-11,-9h-2l-512,92l-513,-92h-2c-5,0,-9,4,-11,9l-5,22c-1,6,2,12,8,13z`,widecheck2:`M1181,220h2l1171,-176c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,
-11,-10h-1l-1168,153l-1167,-153h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,widecheck3:`M1181,280h2l1171,-236c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,
-11,-10h-1l-1168,213l-1167,-213h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,widecheck4:`M1181,340h2l1171,-296c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,
-11,-10h-1l-1168,273l-1167,-273h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,baraboveleftarrow:`M400000 620h-399890l3 -3c68.7 -52.7 113.7 -120 135 -202
c4 -14.7 6 -23 6 -25c0 -7.3 -7 -11 -21 -11c-8 0 -13.2 0.8 -15.5 2.5
c-2.3 1.7 -4.2 5.8 -5.5 12.5c-1.3 4.7 -2.7 10.3 -4 17c-12 48.7 -34.8 92 -68.5 130
s-74.2 66.3 -121.5 85c-10 4 -16 7.7 -18 11c0 8.7 6 14.3 18 17c47.3 18.7 87.8 47
121.5 85s56.5 81.3 68.5 130c0.7 2 1.3 5 2 9s1.2 6.7 1.5 8c0.3 1.3 1 3.3 2 6
s2.2 4.5 3.5 5.5c1.3 1 3.3 1.8 6 2.5s6 1 10 1c14 0 21 -3.7 21 -11
c0 -2 -2 -10.3 -6 -25c-20 -79.3 -65 -146.7 -135 -202l-3 -3h399890z
M100 620v40h399900v-40z M0 241v40h399900v-40zM0 241v40h399900v-40z`,rightarrowabovebar:`M0 241v40h399891c-47.3 35.3-84 78-110 128-16.7 32
-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20 11 8 0
13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7 39
-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85-40.5
-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5
-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67
151.7 139 205zm96 379h399894v40H0zm0 0h399904v40H0z`,baraboveshortleftharpoon:`M507,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11
c1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17
c2,0.7,5,1,9,1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21
c-32,-87.3,-82.7,-157.7,-152,-211c0,0,-3,-3,-3,-3l399351,0l0,-40
c-398570,0,-399437,0,-399437,0z M593 435 v40 H399500 v-40z
M0 281 v-40 H399908 v40z M0 281 v-40 H399908 v40z`,rightharpoonaboveshortbar:`M0,241 l0,40c399126,0,399993,0,399993,0
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
M0 241 v40 H399908 v-40z M0 475 v-40 H399500 v40z M0 475 v-40 H399500 v40z`,shortbaraboveleftharpoon:`M7,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11
c1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17c2,0.7,5,1,9,
1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21c-32,-87.3,-82.7,-157.7,
-152,-211c0,0,-3,-3,-3,-3l399907,0l0,-40c-399126,0,-399993,0,-399993,0z
M93 435 v40 H400000 v-40z M500 241 v40 H400000 v-40z M500 241 v40 H400000 v-40z`,shortrightharpoonabovebar:`M53,241l0,40c398570,0,399437,0,399437,0
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`},Z5e=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
c-10,0,-16.667,5,-20,15z M188 15 H145 v585 v`+n+" v585 h43z";case"doublevert":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
c-10,0,-16.667,5,-20,15z M188 15 H145 v585 v`+n+` v585 h43z
M367 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
c-10,0,-16.667,5,-20,15z M410 15 H367 v585 v`+n+" v585 h43z";case"lfloor":return"M319 602 V0 H403 V602 v"+n+` v1715 h263 v84 H319z
MM319 602 V0 H403 V602 v`+n+" v1715 H319z";case"rfloor":return"M319 602 V0 H403 V602 v"+n+` v1799 H0 v-84 H319z
MM319 602 V0 H403 V602 v`+n+" v1715 H319z";case"lceil":return"M403 1759 V84 H666 V0 H319 V1759 v"+n+` v602 h84z
M403 1759 V0 H319 V1759 v`+n+" v602 h84z";case"rceil":return"M347 1759 V0 H0 V84 H263 V1759 v"+n+` v602 h84z
M347 1759 V0 h-84 V1759 v`+n+" v602 h84z";case"lparen":return`M863,9c0,-2,-2,-5,-6,-9c0,0,-17,0,-17,0c-12.7,0,-19.3,0.3,-20,1
c-5.3,5.3,-10.3,11,-15,17c-242.7,294.7,-395.3,682,-458,1162c-21.3,163.3,-33.3,349,
-36,557 l0,`+(n+84)+`c0.2,6,0,26,0,60c2,159.3,10,310.7,24,454c53.3,528,210,
949.7,470,1265c4.7,6,9.7,11.7,15,17c0.7,0.7,7,1,19,1c0,0,18,0,18,0c4,-4,6,-7,6,-9
c0,-2.7,-3.3,-8.7,-10,-18c-135.3,-192.7,-235.5,-414.3,-300.5,-665c-65,-250.7,-102.5,
-544.7,-112.5,-882c-2,-104,-3,-167,-3,-189
l0,-`+(n+92)+`c0,-162.7,5.7,-314,17,-454c20.7,-272,63.7,-513,129,-723c65.3,
-210,155.3,-396.3,270,-559c6.7,-9.3,10,-15.3,10,-18z`;case"rparen":return`M76,0c-16.7,0,-25,3,-25,9c0,2,2,6.3,6,13c21.3,28.7,42.3,60.3,
63,95c96.7,156.7,172.8,332.5,228.5,527.5c55.7,195,92.8,416.5,111.5,664.5
c11.3,139.3,17,290.7,17,454c0,28,1.7,43,3.3,45l0,`+(n+9)+`
c-3,4,-3.3,16.7,-3.3,38c0,162,-5.7,313.7,-17,455c-18.7,248,-55.8,469.3,-111.5,664
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,11
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 mg{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;n<this.children.length;n++)e.appendChild(this.children[n].toNode());return e}toMarkup(){for(var e="",n=0;n<this.children.length;n++)e+=this.children[n].toMarkup();return e}toText(){var e=n=>n.toText();return this.children.map(e).join("")}}var _o={"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]}},A1={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]},dR={Å:"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 J5e(t,e){_o[t]=e}function NN(t,e,n){if(!_o[e])throw new Error("Font metrics not found for font: "+e+".");var r=t.charCodeAt(0),s=_o[e][r];if(!s&&t[0]in dR&&(r=dR[t[0]].charCodeAt(0),s=_o[e][r]),!s&&n==="text"&&XV(r)&&(s=_o[e][77]),s)return{depth:s[0],height:s[1],italic:s[2],skew:s[3],width:s[4]}}var VS={};function e3e(t){var e;if(t>=5?e=0:t>=3?e=1:e=2,!VS[e]){var n=VS[e]={cssEmPerMu:A1.quad[e]/18};for(var r in A1)A1.hasOwnProperty(r)&&(n[r]=A1[r][e])}return VS[e]}var t3e=[[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]],hR=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],fR=function(e,n){return n.size<2?e:t3e[e-1][n.size-1]};class Tl{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||Tl.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=hR[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 Tl(n)}havingStyle(e){return this.style===e?this:this.extend({style:e,size:fR(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:hR[e-1]})}havingBaseStyle(e){e=e||this.style.text();var n=fR(Tl.BASESIZE,e);return this.size===n&&this.textSize===Tl.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!==Tl.BASESIZE?["sizing","reset-size"+this.size,"size"+Tl.BASESIZE]:[]}fontMetrics(){return this._fontMetrics||(this._fontMetrics=e3e(this.size)),this._fontMetrics}getColor(){return this.phantom?"transparent":this.color}}Tl.BASESIZE=6;var BO={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},n3e={ex:!0,em:!0,mu:!0},YV=function(e){return typeof e!="string"&&(e=e.unit),e in BO||e in n3e||e==="ex"},Rr=function(e,n){var r;if(e.unit in BO)r=BO[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)},Xe=function(e){return+e.toFixed(4)+"em"},eu=function(e){return e.filter(n=>n).join(" ")},KV=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)}},ZV=function(e){var n=document.createElement(e);n.className=eu(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<this.children.length;i++)n.appendChild(this.children[i].toNode());return n},r3e=/[\s"'>/=\x00-\x1f]/,JV=function(e){var n="<"+e;this.classes.length&&(n+=' class="'+$n.escape(eu(this.classes))+'"');var r="";for(var s in this.style)this.style.hasOwnProperty(s)&&(r+=$n.hyphenate(s)+":"+this.style[s]+";");r&&(n+=' style="'+$n.escape(r)+'"');for(var i in this.attributes)if(this.attributes.hasOwnProperty(i)){if(r3e.test(i))throw new $e("Invalid attribute name '"+i+"'");n+=" "+i+'="'+$n.escape(this.attributes[i])+'"'}n+=">";for(var a=0;a<this.children.length;a++)n+=this.children[a].toMarkup();return n+="</"+e+">",n};class pg{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,KV.call(this,e,r,s),this.children=n||[]}setAttribute(e,n){this.attributes[e]=n}hasClass(e){return this.classes.includes(e)}toNode(){return ZV.call(this,"span")}toMarkup(){return JV.call(this,"span")}}class CN{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,KV.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 ZV.call(this,"a")}toMarkup(){return JV.call(this,"a")}}class s3e{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='<img src="'+$n.escape(this.src)+'"'+(' alt="'+$n.escape(this.alt)+'"'),n="";for(var r in this.style)this.style.hasOwnProperty(r)&&(n+=$n.hyphenate(r)+":"+this.style[r]+";");return n&&(e+=' style="'+$n.escape(n)+'"'),e+="'/>",e}}var i3e={î:"ı̂",ï:"ı̈",í:"ı́",ì:"ı̀"};class Aa{constructor(e,n,r,s,i,a,l,c){this.text=void 0,this.height=void 0,this.depth=void 0,this.italic=void 0,this.skew=void 0,this.width=void 0,this.maxFontSize=void 0,this.classes=void 0,this.style=void 0,this.text=e,this.height=n||0,this.depth=r||0,this.italic=s||0,this.skew=i||0,this.width=a||0,this.classes=l||[],this.style=c||{},this.maxFontSize=0;var d=$5e(this.text.charCodeAt(0));d&&this.classes.push(d+"_fallback"),/[îïíì]/.test(this.text)&&(this.text=i3e[this.text])}hasClass(e){return this.classes.includes(e)}toNode(){var e=document.createTextNode(this.text),n=null;this.italic>0&&(n=document.createElement("span"),n.style.marginRight=Xe(this.italic)),this.classes.length>0&&(n=n||document.createElement("span"),n.className=eu(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="<span";this.classes.length&&(e=!0,n+=' class="',n+=$n.escape(eu(this.classes)),n+='"');var r="";this.italic>0&&(r+="margin-right:"+this.italic+"em;");for(var s in this.style)this.style.hasOwnProperty(s)&&(r+=$n.hyphenate(s)+":"+this.style[s]+";");r&&(e=!0,n+=' style="'+$n.escape(r)+'"');var i=$n.escape(this.text);return e?(n+=">",n+=i,n+="</span>",n):i}}class Ql{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<this.children.length;s++)n.appendChild(this.children[s].toNode());return n}toMarkup(){var e='<svg xmlns="http://www.w3.org/2000/svg"';for(var n in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,n)&&(e+=" "+n+'="'+$n.escape(this.attributes[n])+'"');e+=">";for(var r=0;r<this.children.length;r++)e+=this.children[r].toMarkup();return e+="</svg>",e}}class tu{constructor(e,n){this.pathName=void 0,this.alternate=void 0,this.pathName=e,this.alternate=n}toNode(){var e="http://www.w3.org/2000/svg",n=document.createElementNS(e,"path");return this.alternate?n.setAttribute("d",this.alternate):n.setAttribute("d",uR[this.pathName]),n}toMarkup(){return this.alternate?'<path d="'+$n.escape(this.alternate)+'"/>':'<path d="'+$n.escape(uR[this.pathName])+'"/>'}}class FO{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="<line";for(var n in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,n)&&(e+=" "+n+'="'+$n.escape(this.attributes[n])+'"');return e+="/>",e}}function mR(t){if(t instanceof Aa)return t;throw new Error("Expected symbolNode but got "+String(t)+".")}function a3e(t){if(t instanceof pg)return t;throw new Error("Expected span<HtmlDomNode> but got "+String(t)+".")}var o3e={bin:1,close:1,inner:1,open:1,punct:1,rel:1},l3e={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1},dr={math:{},text:{}};function M(t,e,n,r,s,i){dr[t][s]={font:e,group:n,replace:r},i&&r&&(dr[t][r]=dr[t][s])}var D="math",Be="text",H="main",le="ams",jr="accent-token",lt="bin",ai="close",qf="inner",Tt="mathord",os="op-token",Ji="open",qb="punct",ce="rel",Zl="spacing",me="textord";M(D,H,ce,"≡","\\equiv",!0);M(D,H,ce,"≺","\\prec",!0);M(D,H,ce,"≻","\\succ",!0);M(D,H,ce,"","\\sim",!0);M(D,H,ce,"⊥","\\perp");M(D,H,ce,"⪯","\\preceq",!0);M(D,H,ce,"⪰","\\succeq",!0);M(D,H,ce,"≃","\\simeq",!0);M(D,H,ce,"","\\mid",!0);M(D,H,ce,"≪","\\ll",!0);M(D,H,ce,"≫","\\gg",!0);M(D,H,ce,"≍","\\asymp",!0);M(D,H,ce,"∥","\\parallel");M(D,H,ce,"⋈","\\bowtie",!0);M(D,H,ce,"⌣","\\smile",!0);M(D,H,ce,"⊑","\\sqsubseteq",!0);M(D,H,ce,"⊒","\\sqsupseteq",!0);M(D,H,ce,"≐","\\doteq",!0);M(D,H,ce,"⌢","\\frown",!0);M(D,H,ce,"∋","\\ni",!0);M(D,H,ce,"∝","\\propto",!0);M(D,H,ce,"⊢","\\vdash",!0);M(D,H,ce,"⊣","\\dashv",!0);M(D,H,ce,"∋","\\owns");M(D,H,qb,".","\\ldotp");M(D,H,qb,"⋅","\\cdotp");M(D,H,me,"#","\\#");M(Be,H,me,"#","\\#");M(D,H,me,"&","\\&");M(Be,H,me,"&","\\&");M(D,H,me,"ℵ","\\aleph",!0);M(D,H,me,"∀","\\forall",!0);M(D,H,me,"ℏ","\\hbar",!0);M(D,H,me,"∃","\\exists",!0);M(D,H,me,"∇","\\nabla",!0);M(D,H,me,"♭","\\flat",!0);M(D,H,me,"","\\ell",!0);M(D,H,me,"♮","\\natural",!0);M(D,H,me,"♣","\\clubsuit",!0);M(D,H,me,"℘","\\wp",!0);M(D,H,me,"♯","\\sharp",!0);M(D,H,me,"♢","\\diamondsuit",!0);M(D,H,me,"","\\Re",!0);M(D,H,me,"♡","\\heartsuit",!0);M(D,H,me,"","\\Im",!0);M(D,H,me,"♠","\\spadesuit",!0);M(D,H,me,"§","\\S",!0);M(Be,H,me,"§","\\S");M(D,H,me,"¶","\\P",!0);M(Be,H,me,"¶","\\P");M(D,H,me,"†","\\dag");M(Be,H,me,"†","\\dag");M(Be,H,me,"†","\\textdagger");M(D,H,me,"‡","\\ddag");M(Be,H,me,"‡","\\ddag");M(Be,H,me,"‡","\\textdaggerdbl");M(D,H,ai,"⎱","\\rmoustache",!0);M(D,H,Ji,"⎰","\\lmoustache",!0);M(D,H,ai,"⟯","\\rgroup",!0);M(D,H,Ji,"⟮","\\lgroup",!0);M(D,H,lt,"∓","\\mp",!0);M(D,H,lt,"⊖","\\ominus",!0);M(D,H,lt,"⊎","\\uplus",!0);M(D,H,lt,"⊓","\\sqcap",!0);M(D,H,lt,"","\\ast");M(D,H,lt,"⊔","\\sqcup",!0);M(D,H,lt,"◯","\\bigcirc",!0);M(D,H,lt,"∙","\\bullet",!0);M(D,H,lt,"‡","\\ddagger");M(D,H,lt,"≀","\\wr",!0);M(D,H,lt,"⨿","\\amalg");M(D,H,lt,"&","\\And");M(D,H,ce,"⟵","\\longleftarrow",!0);M(D,H,ce,"⇐","\\Leftarrow",!0);M(D,H,ce,"⟸","\\Longleftarrow",!0);M(D,H,ce,"⟶","\\longrightarrow",!0);M(D,H,ce,"⇒","\\Rightarrow",!0);M(D,H,ce,"⟹","\\Longrightarrow",!0);M(D,H,ce,"↔","\\leftrightarrow",!0);M(D,H,ce,"⟷","\\longleftrightarrow",!0);M(D,H,ce,"⇔","\\Leftrightarrow",!0);M(D,H,ce,"⟺","\\Longleftrightarrow",!0);M(D,H,ce,"↦","\\mapsto",!0);M(D,H,ce,"⟼","\\longmapsto",!0);M(D,H,ce,"↗","\\nearrow",!0);M(D,H,ce,"↩","\\hookleftarrow",!0);M(D,H,ce,"↪","\\hookrightarrow",!0);M(D,H,ce,"↘","\\searrow",!0);M(D,H,ce,"↼","\\leftharpoonup",!0);M(D,H,ce,"⇀","\\rightharpoonup",!0);M(D,H,ce,"↙","\\swarrow",!0);M(D,H,ce,"↽","\\leftharpoondown",!0);M(D,H,ce,"⇁","\\rightharpoondown",!0);M(D,H,ce,"↖","\\nwarrow",!0);M(D,H,ce,"⇌","\\rightleftharpoons",!0);M(D,le,ce,"≮","\\nless",!0);M(D,le,ce,"","\\@nleqslant");M(D,le,ce,"","\\@nleqq");M(D,le,ce,"⪇","\\lneq",!0);M(D,le,ce,"≨","\\lneqq",!0);M(D,le,ce,"","\\@lvertneqq");M(D,le,ce,"⋦","\\lnsim",!0);M(D,le,ce,"⪉","\\lnapprox",!0);M(D,le,ce,"⊀","\\nprec",!0);M(D,le,ce,"⋠","\\npreceq",!0);M(D,le,ce,"⋨","\\precnsim",!0);M(D,le,ce,"⪹","\\precnapprox",!0);M(D,le,ce,"≁","\\nsim",!0);M(D,le,ce,"","\\@nshortmid");M(D,le,ce,"∤","\\nmid",!0);M(D,le,ce,"⊬","\\nvdash",!0);M(D,le,ce,"⊭","\\nvDash",!0);M(D,le,ce,"⋪","\\ntriangleleft");M(D,le,ce,"⋬","\\ntrianglelefteq",!0);M(D,le,ce,"⊊","\\subsetneq",!0);M(D,le,ce,"","\\@varsubsetneq");M(D,le,ce,"⫋","\\subsetneqq",!0);M(D,le,ce,"","\\@varsubsetneqq");M(D,le,ce,"≯","\\ngtr",!0);M(D,le,ce,"","\\@ngeqslant");M(D,le,ce,"","\\@ngeqq");M(D,le,ce,"⪈","\\gneq",!0);M(D,le,ce,"≩","\\gneqq",!0);M(D,le,ce,"","\\@gvertneqq");M(D,le,ce,"⋧","\\gnsim",!0);M(D,le,ce,"⪊","\\gnapprox",!0);M(D,le,ce,"⊁","\\nsucc",!0);M(D,le,ce,"⋡","\\nsucceq",!0);M(D,le,ce,"⋩","\\succnsim",!0);M(D,le,ce,"⪺","\\succnapprox",!0);M(D,le,ce,"≆","\\ncong",!0);M(D,le,ce,"","\\@nshortparallel");M(D,le,ce,"∦","\\nparallel",!0);M(D,le,ce,"⊯","\\nVDash",!0);M(D,le,ce,"⋫","\\ntriangleright");M(D,le,ce,"⋭","\\ntrianglerighteq",!0);M(D,le,ce,"","\\@nsupseteqq");M(D,le,ce,"⊋","\\supsetneq",!0);M(D,le,ce,"","\\@varsupsetneq");M(D,le,ce,"⫌","\\supsetneqq",!0);M(D,le,ce,"","\\@varsupsetneqq");M(D,le,ce,"⊮","\\nVdash",!0);M(D,le,ce,"⪵","\\precneqq",!0);M(D,le,ce,"⪶","\\succneqq",!0);M(D,le,ce,"","\\@nsubseteqq");M(D,le,lt,"⊴","\\unlhd");M(D,le,lt,"⊵","\\unrhd");M(D,le,ce,"↚","\\nleftarrow",!0);M(D,le,ce,"↛","\\nrightarrow",!0);M(D,le,ce,"⇍","\\nLeftarrow",!0);M(D,le,ce,"⇏","\\nRightarrow",!0);M(D,le,ce,"↮","\\nleftrightarrow",!0);M(D,le,ce,"⇎","\\nLeftrightarrow",!0);M(D,le,ce,"△","\\vartriangle");M(D,le,me,"ℏ","\\hslash");M(D,le,me,"▽","\\triangledown");M(D,le,me,"◊","\\lozenge");M(D,le,me,"Ⓢ","\\circledS");M(D,le,me,"®","\\circledR");M(Be,le,me,"®","\\circledR");M(D,le,me,"∡","\\measuredangle",!0);M(D,le,me,"∄","\\nexists");M(D,le,me,"℧","\\mho");M(D,le,me,"Ⅎ","\\Finv",!0);M(D,le,me,"⅁","\\Game",!0);M(D,le,me,"","\\backprime");M(D,le,me,"▲","\\blacktriangle");M(D,le,me,"▼","\\blacktriangledown");M(D,le,me,"■","\\blacksquare");M(D,le,me,"⧫","\\blacklozenge");M(D,le,me,"★","\\bigstar");M(D,le,me,"∢","\\sphericalangle",!0);M(D,le,me,"∁","\\complement",!0);M(D,le,me,"ð","\\eth",!0);M(Be,H,me,"ð","ð");M(D,le,me,"","\\diagup");M(D,le,me,"╲","\\diagdown");M(D,le,me,"□","\\square");M(D,le,me,"□","\\Box");M(D,le,me,"◊","\\Diamond");M(D,le,me,"¥","\\yen",!0);M(Be,le,me,"¥","\\yen",!0);M(D,le,me,"✓","\\checkmark",!0);M(Be,le,me,"✓","\\checkmark");M(D,le,me,"ℶ","\\beth",!0);M(D,le,me,"ℸ","\\daleth",!0);M(D,le,me,"ℷ","\\gimel",!0);M(D,le,me,"ϝ","\\digamma",!0);M(D,le,me,"ϰ","\\varkappa");M(D,le,Ji,"┌","\\@ulcorner",!0);M(D,le,ai,"┐","\\@urcorner",!0);M(D,le,Ji,"└","\\@llcorner",!0);M(D,le,ai,"┘","\\@lrcorner",!0);M(D,le,ce,"≦","\\leqq",!0);M(D,le,ce,"⩽","\\leqslant",!0);M(D,le,ce,"⪕","\\eqslantless",!0);M(D,le,ce,"≲","\\lesssim",!0);M(D,le,ce,"⪅","\\lessapprox",!0);M(D,le,ce,"≊","\\approxeq",!0);M(D,le,lt,"⋖","\\lessdot");M(D,le,ce,"⋘","\\lll",!0);M(D,le,ce,"≶","\\lessgtr",!0);M(D,le,ce,"⋚","\\lesseqgtr",!0);M(D,le,ce,"⪋","\\lesseqqgtr",!0);M(D,le,ce,"≑","\\doteqdot");M(D,le,ce,"≓","\\risingdotseq",!0);M(D,le,ce,"≒","\\fallingdotseq",!0);M(D,le,ce,"∽","\\backsim",!0);M(D,le,ce,"⋍","\\backsimeq",!0);M(D,le,ce,"⫅","\\subseteqq",!0);M(D,le,ce,"⋐","\\Subset",!0);M(D,le,ce,"⊏","\\sqsubset",!0);M(D,le,ce,"≼","\\preccurlyeq",!0);M(D,le,ce,"⋞","\\curlyeqprec",!0);M(D,le,ce,"≾","\\precsim",!0);M(D,le,ce,"⪷","\\precapprox",!0);M(D,le,ce,"⊲","\\vartriangleleft");M(D,le,ce,"⊴","\\trianglelefteq");M(D,le,ce,"⊨","\\vDash",!0);M(D,le,ce,"⊪","\\Vvdash",!0);M(D,le,ce,"⌣","\\smallsmile");M(D,le,ce,"⌢","\\smallfrown");M(D,le,ce,"≏","\\bumpeq",!0);M(D,le,ce,"≎","\\Bumpeq",!0);M(D,le,ce,"≧","\\geqq",!0);M(D,le,ce,"⩾","\\geqslant",!0);M(D,le,ce,"⪖","\\eqslantgtr",!0);M(D,le,ce,"≳","\\gtrsim",!0);M(D,le,ce,"⪆","\\gtrapprox",!0);M(D,le,lt,"⋗","\\gtrdot");M(D,le,ce,"⋙","\\ggg",!0);M(D,le,ce,"≷","\\gtrless",!0);M(D,le,ce,"⋛","\\gtreqless",!0);M(D,le,ce,"⪌","\\gtreqqless",!0);M(D,le,ce,"≖","\\eqcirc",!0);M(D,le,ce,"≗","\\circeq",!0);M(D,le,ce,"≜","\\triangleq",!0);M(D,le,ce,"","\\thicksim");M(D,le,ce,"≈","\\thickapprox");M(D,le,ce,"⫆","\\supseteqq",!0);M(D,le,ce,"⋑","\\Supset",!0);M(D,le,ce,"⊐","\\sqsupset",!0);M(D,le,ce,"≽","\\succcurlyeq",!0);M(D,le,ce,"⋟","\\curlyeqsucc",!0);M(D,le,ce,"≿","\\succsim",!0);M(D,le,ce,"⪸","\\succapprox",!0);M(D,le,ce,"⊳","\\vartriangleright");M(D,le,ce,"⊵","\\trianglerighteq");M(D,le,ce,"⊩","\\Vdash",!0);M(D,le,ce,"","\\shortmid");M(D,le,ce,"∥","\\shortparallel");M(D,le,ce,"≬","\\between",!0);M(D,le,ce,"⋔","\\pitchfork",!0);M(D,le,ce,"∝","\\varpropto");M(D,le,ce,"◀","\\blacktriangleleft");M(D,le,ce,"∴","\\therefore",!0);M(D,le,ce,"∍","\\backepsilon");M(D,le,ce,"▶","\\blacktriangleright");M(D,le,ce,"∵","\\because",!0);M(D,le,ce,"⋘","\\llless");M(D,le,ce,"⋙","\\gggtr");M(D,le,lt,"⊲","\\lhd");M(D,le,lt,"⊳","\\rhd");M(D,le,ce,"≂","\\eqsim",!0);M(D,H,ce,"⋈","\\Join");M(D,le,ce,"≑","\\Doteq",!0);M(D,le,lt,"∔","\\dotplus",!0);M(D,le,lt,"","\\smallsetminus");M(D,le,lt,"⋒","\\Cap",!0);M(D,le,lt,"⋓","\\Cup",!0);M(D,le,lt,"⩞","\\doublebarwedge",!0);M(D,le,lt,"⊟","\\boxminus",!0);M(D,le,lt,"⊞","\\boxplus",!0);M(D,le,lt,"⋇","\\divideontimes",!0);M(D,le,lt,"⋉","\\ltimes",!0);M(D,le,lt,"⋊","\\rtimes",!0);M(D,le,lt,"⋋","\\leftthreetimes",!0);M(D,le,lt,"⋌","\\rightthreetimes",!0);M(D,le,lt,"⋏","\\curlywedge",!0);M(D,le,lt,"⋎","\\curlyvee",!0);M(D,le,lt,"⊝","\\circleddash",!0);M(D,le,lt,"⊛","\\circledast",!0);M(D,le,lt,"⋅","\\centerdot");M(D,le,lt,"⊺","\\intercal",!0);M(D,le,lt,"⋒","\\doublecap");M(D,le,lt,"⋓","\\doublecup");M(D,le,lt,"⊠","\\boxtimes",!0);M(D,le,ce,"⇢","\\dashrightarrow",!0);M(D,le,ce,"⇠","\\dashleftarrow",!0);M(D,le,ce,"⇇","\\leftleftarrows",!0);M(D,le,ce,"⇆","\\leftrightarrows",!0);M(D,le,ce,"⇚","\\Lleftarrow",!0);M(D,le,ce,"↞","\\twoheadleftarrow",!0);M(D,le,ce,"↢","\\leftarrowtail",!0);M(D,le,ce,"↫","\\looparrowleft",!0);M(D,le,ce,"⇋","\\leftrightharpoons",!0);M(D,le,ce,"↶","\\curvearrowleft",!0);M(D,le,ce,"↺","\\circlearrowleft",!0);M(D,le,ce,"↰","\\Lsh",!0);M(D,le,ce,"⇈","\\upuparrows",!0);M(D,le,ce,"↿","\\upharpoonleft",!0);M(D,le,ce,"⇃","\\downharpoonleft",!0);M(D,H,ce,"⊶","\\origof",!0);M(D,H,ce,"⊷","\\imageof",!0);M(D,le,ce,"⊸","\\multimap",!0);M(D,le,ce,"↭","\\leftrightsquigarrow",!0);M(D,le,ce,"⇉","\\rightrightarrows",!0);M(D,le,ce,"⇄","\\rightleftarrows",!0);M(D,le,ce,"↠","\\twoheadrightarrow",!0);M(D,le,ce,"↣","\\rightarrowtail",!0);M(D,le,ce,"↬","\\looparrowright",!0);M(D,le,ce,"↷","\\curvearrowright",!0);M(D,le,ce,"↻","\\circlearrowright",!0);M(D,le,ce,"↱","\\Rsh",!0);M(D,le,ce,"⇊","\\downdownarrows",!0);M(D,le,ce,"↾","\\upharpoonright",!0);M(D,le,ce,"⇂","\\downharpoonright",!0);M(D,le,ce,"⇝","\\rightsquigarrow",!0);M(D,le,ce,"⇝","\\leadsto");M(D,le,ce,"⇛","\\Rrightarrow",!0);M(D,le,ce,"↾","\\restriction");M(D,H,me,"","`");M(D,H,me,"$","\\$");M(Be,H,me,"$","\\$");M(Be,H,me,"$","\\textdollar");M(D,H,me,"%","\\%");M(Be,H,me,"%","\\%");M(D,H,me,"_","\\_");M(Be,H,me,"_","\\_");M(Be,H,me,"_","\\textunderscore");M(D,H,me,"∠","\\angle",!0);M(D,H,me,"∞","\\infty",!0);M(D,H,me,"","\\prime");M(D,H,me,"△","\\triangle");M(D,H,me,"Γ","\\Gamma",!0);M(D,H,me,"Δ","\\Delta",!0);M(D,H,me,"Θ","\\Theta",!0);M(D,H,me,"Λ","\\Lambda",!0);M(D,H,me,"Ξ","\\Xi",!0);M(D,H,me,"Π","\\Pi",!0);M(D,H,me,"Σ","\\Sigma",!0);M(D,H,me,"Υ","\\Upsilon",!0);M(D,H,me,"Φ","\\Phi",!0);M(D,H,me,"Ψ","\\Psi",!0);M(D,H,me,"Ω","\\Omega",!0);M(D,H,me,"A","Α");M(D,H,me,"B","Β");M(D,H,me,"E","Ε");M(D,H,me,"Z","Ζ");M(D,H,me,"H","Η");M(D,H,me,"I","Ι");M(D,H,me,"K","Κ");M(D,H,me,"M","Μ");M(D,H,me,"N","Ν");M(D,H,me,"O","Ο");M(D,H,me,"P","Ρ");M(D,H,me,"T","Τ");M(D,H,me,"X","Χ");M(D,H,me,"¬","\\neg",!0);M(D,H,me,"¬","\\lnot");M(D,H,me,"","\\top");M(D,H,me,"⊥","\\bot");M(D,H,me,"∅","\\emptyset");M(D,le,me,"∅","\\varnothing");M(D,H,Tt,"α","\\alpha",!0);M(D,H,Tt,"β","\\beta",!0);M(D,H,Tt,"γ","\\gamma",!0);M(D,H,Tt,"δ","\\delta",!0);M(D,H,Tt,"ϵ","\\epsilon",!0);M(D,H,Tt,"ζ","\\zeta",!0);M(D,H,Tt,"η","\\eta",!0);M(D,H,Tt,"θ","\\theta",!0);M(D,H,Tt,"ι","\\iota",!0);M(D,H,Tt,"κ","\\kappa",!0);M(D,H,Tt,"λ","\\lambda",!0);M(D,H,Tt,"μ","\\mu",!0);M(D,H,Tt,"ν","\\nu",!0);M(D,H,Tt,"ξ","\\xi",!0);M(D,H,Tt,"ο","\\omicron",!0);M(D,H,Tt,"π","\\pi",!0);M(D,H,Tt,"ρ","\\rho",!0);M(D,H,Tt,"σ","\\sigma",!0);M(D,H,Tt,"τ","\\tau",!0);M(D,H,Tt,"υ","\\upsilon",!0);M(D,H,Tt,"ϕ","\\phi",!0);M(D,H,Tt,"χ","\\chi",!0);M(D,H,Tt,"ψ","\\psi",!0);M(D,H,Tt,"ω","\\omega",!0);M(D,H,Tt,"ε","\\varepsilon",!0);M(D,H,Tt,"ϑ","\\vartheta",!0);M(D,H,Tt,"ϖ","\\varpi",!0);M(D,H,Tt,"ϱ","\\varrho",!0);M(D,H,Tt,"ς","\\varsigma",!0);M(D,H,Tt,"φ","\\varphi",!0);M(D,H,lt,"","*",!0);M(D,H,lt,"+","+");M(D,H,lt,"","-",!0);M(D,H,lt,"⋅","\\cdot",!0);M(D,H,lt,"∘","\\circ",!0);M(D,H,lt,"÷","\\div",!0);M(D,H,lt,"±","\\pm",!0);M(D,H,lt,"×","\\times",!0);M(D,H,lt,"∩","\\cap",!0);M(D,H,lt,"","\\cup",!0);M(D,H,lt,"","\\setminus",!0);M(D,H,lt,"∧","\\land");M(D,H,lt,"","\\lor");M(D,H,lt,"∧","\\wedge",!0);M(D,H,lt,"","\\vee",!0);M(D,H,me,"√","\\surd");M(D,H,Ji,"⟨","\\langle",!0);M(D,H,Ji,"","\\lvert");M(D,H,Ji,"∥","\\lVert");M(D,H,ai,"?","?");M(D,H,ai,"!","!");M(D,H,ai,"⟩","\\rangle",!0);M(D,H,ai,"","\\rvert");M(D,H,ai,"∥","\\rVert");M(D,H,ce,"=","=");M(D,H,ce,":",":");M(D,H,ce,"≈","\\approx",!0);M(D,H,ce,"≅","\\cong",!0);M(D,H,ce,"≥","\\ge");M(D,H,ce,"≥","\\geq",!0);M(D,H,ce,"←","\\gets");M(D,H,ce,">","\\gt",!0);M(D,H,ce,"∈","\\in",!0);M(D,H,ce,"","\\@not");M(D,H,ce,"⊂","\\subset",!0);M(D,H,ce,"⊃","\\supset",!0);M(D,H,ce,"⊆","\\subseteq",!0);M(D,H,ce,"⊇","\\supseteq",!0);M(D,le,ce,"⊈","\\nsubseteq",!0);M(D,le,ce,"⊉","\\nsupseteq",!0);M(D,H,ce,"⊨","\\models");M(D,H,ce,"←","\\leftarrow",!0);M(D,H,ce,"≤","\\le");M(D,H,ce,"≤","\\leq",!0);M(D,H,ce,"<","\\lt",!0);M(D,H,ce,"→","\\rightarrow",!0);M(D,H,ce,"→","\\to");M(D,le,ce,"≱","\\ngeq",!0);M(D,le,ce,"≰","\\nleq",!0);M(D,H,Zl," ","\\ ");M(D,H,Zl," ","\\space");M(D,H,Zl," ","\\nobreakspace");M(Be,H,Zl," ","\\ ");M(Be,H,Zl," "," ");M(Be,H,Zl," ","\\space");M(Be,H,Zl," ","\\nobreakspace");M(D,H,Zl,null,"\\nobreak");M(D,H,Zl,null,"\\allowbreak");M(D,H,qb,",",",");M(D,H,qb,";",";");M(D,le,lt,"⊼","\\barwedge",!0);M(D,le,lt,"⊻","\\veebar",!0);M(D,H,lt,"⊙","\\odot",!0);M(D,H,lt,"⊕","\\oplus",!0);M(D,H,lt,"⊗","\\otimes",!0);M(D,H,me,"∂","\\partial",!0);M(D,H,lt,"⊘","\\oslash",!0);M(D,le,lt,"⊚","\\circledcirc",!0);M(D,le,lt,"⊡","\\boxdot",!0);M(D,H,lt,"△","\\bigtriangleup");M(D,H,lt,"▽","\\bigtriangledown");M(D,H,lt,"†","\\dagger");M(D,H,lt,"⋄","\\diamond");M(D,H,lt,"⋆","\\star");M(D,H,lt,"◃","\\triangleleft");M(D,H,lt,"▹","\\triangleright");M(D,H,Ji,"{","\\{");M(Be,H,me,"{","\\{");M(Be,H,me,"{","\\textbraceleft");M(D,H,ai,"}","\\}");M(Be,H,me,"}","\\}");M(Be,H,me,"}","\\textbraceright");M(D,H,Ji,"{","\\lbrace");M(D,H,ai,"}","\\rbrace");M(D,H,Ji,"[","\\lbrack",!0);M(Be,H,me,"[","\\lbrack",!0);M(D,H,ai,"]","\\rbrack",!0);M(Be,H,me,"]","\\rbrack",!0);M(D,H,Ji,"(","\\lparen",!0);M(D,H,ai,")","\\rparen",!0);M(Be,H,me,"<","\\textless",!0);M(Be,H,me,">","\\textgreater",!0);M(D,H,Ji,"⌊","\\lfloor",!0);M(D,H,ai,"⌋","\\rfloor",!0);M(D,H,Ji,"⌈","\\lceil",!0);M(D,H,ai,"⌉","\\rceil",!0);M(D,H,me,"\\","\\backslash");M(D,H,me,"","|");M(D,H,me,"","\\vert");M(Be,H,me,"|","\\textbar",!0);M(D,H,me,"∥","\\|");M(D,H,me,"∥","\\Vert");M(Be,H,me,"∥","\\textbardbl");M(Be,H,me,"~","\\textasciitilde");M(Be,H,me,"\\","\\textbackslash");M(Be,H,me,"^","\\textasciicircum");M(D,H,ce,"↑","\\uparrow",!0);M(D,H,ce,"⇑","\\Uparrow",!0);M(D,H,ce,"↓","\\downarrow",!0);M(D,H,ce,"⇓","\\Downarrow",!0);M(D,H,ce,"↕","\\updownarrow",!0);M(D,H,ce,"⇕","\\Updownarrow",!0);M(D,H,os,"∐","\\coprod");M(D,H,os,"","\\bigvee");M(D,H,os,"⋀","\\bigwedge");M(D,H,os,"⨄","\\biguplus");M(D,H,os,"⋂","\\bigcap");M(D,H,os,"","\\bigcup");M(D,H,os,"∫","\\int");M(D,H,os,"∫","\\intop");M(D,H,os,"∬","\\iint");M(D,H,os,"∭","\\iiint");M(D,H,os,"∏","\\prod");M(D,H,os,"∑","\\sum");M(D,H,os,"⨂","\\bigotimes");M(D,H,os,"⨁","\\bigoplus");M(D,H,os,"⨀","\\bigodot");M(D,H,os,"∮","\\oint");M(D,H,os,"∯","\\oiint");M(D,H,os,"∰","\\oiiint");M(D,H,os,"⨆","\\bigsqcup");M(D,H,os,"∫","\\smallint");M(Be,H,qf,"…","\\textellipsis");M(D,H,qf,"…","\\mathellipsis");M(Be,H,qf,"…","\\ldots",!0);M(D,H,qf,"…","\\ldots",!0);M(D,H,qf,"⋯","\\@cdots",!0);M(D,H,qf,"⋱","\\ddots",!0);M(D,H,me,"⋮","\\varvdots");M(Be,H,me,"⋮","\\varvdots");M(D,H,jr,"ˊ","\\acute");M(D,H,jr,"ˋ","\\grave");M(D,H,jr,"¨","\\ddot");M(D,H,jr,"~","\\tilde");M(D,H,jr,"ˉ","\\bar");M(D,H,jr,"˘","\\breve");M(D,H,jr,"ˇ","\\check");M(D,H,jr,"^","\\hat");M(D,H,jr,"⃗","\\vec");M(D,H,jr,"˙","\\dot");M(D,H,jr,"˚","\\mathring");M(D,H,Tt,"","\\@imath");M(D,H,Tt,"","\\@jmath");M(D,H,me,"ı","ı");M(D,H,me,"ȷ","ȷ");M(Be,H,me,"ı","\\i",!0);M(Be,H,me,"ȷ","\\j",!0);M(Be,H,me,"ß","\\ss",!0);M(Be,H,me,"æ","\\ae",!0);M(Be,H,me,"œ","\\oe",!0);M(Be,H,me,"ø","\\o",!0);M(Be,H,me,"Æ","\\AE",!0);M(Be,H,me,"Œ","\\OE",!0);M(Be,H,me,"Ø","\\O",!0);M(Be,H,jr,"ˊ","\\'");M(Be,H,jr,"ˋ","\\`");M(Be,H,jr,"ˆ","\\^");M(Be,H,jr,"˜","\\~");M(Be,H,jr,"ˉ","\\=");M(Be,H,jr,"˘","\\u");M(Be,H,jr,"˙","\\.");M(Be,H,jr,"¸","\\c");M(Be,H,jr,"˚","\\r");M(Be,H,jr,"ˇ","\\v");M(Be,H,jr,"¨",'\\"');M(Be,H,jr,"˝","\\H");M(Be,H,jr,"◯","\\textcircled");var eU={"--":!0,"---":!0,"``":!0,"''":!0};M(Be,H,me,"","--",!0);M(Be,H,me,"","\\textendash");M(Be,H,me,"—","---",!0);M(Be,H,me,"—","\\textemdash");M(Be,H,me,"","`",!0);M(Be,H,me,"","\\textquoteleft");M(Be,H,me,"","'",!0);M(Be,H,me,"","\\textquoteright");M(Be,H,me,"“","``",!0);M(Be,H,me,"“","\\textquotedblleft");M(Be,H,me,"”","''",!0);M(Be,H,me,"”","\\textquotedblright");M(D,H,me,"°","\\degree",!0);M(Be,H,me,"°","\\degree");M(Be,H,me,"°","\\textdegree",!0);M(D,H,me,"£","\\pounds");M(D,H,me,"£","\\mathsterling",!0);M(Be,H,me,"£","\\pounds");M(Be,H,me,"£","\\textsterling",!0);M(D,le,me,"✠","\\maltese");M(Be,le,me,"✠","\\maltese");var pR='0123456789/@."';for(var US=0;US<pR.length;US++){var gR=pR.charAt(US);M(D,H,me,gR,gR)}var xR='0123456789!@*()-=+";:?/.,';for(var WS=0;WS<xR.length;WS++){var vR=xR.charAt(WS);M(Be,H,me,vR,vR)}var ky="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";for(var GS=0;GS<ky.length;GS++){var M1=ky.charAt(GS);M(D,H,Tt,M1,M1),M(Be,H,me,M1,M1)}M(D,le,me,"C","");M(Be,le,me,"C","");M(D,le,me,"H","");M(Be,le,me,"H","");M(D,le,me,"N","");M(Be,le,me,"N","");M(D,le,me,"P","");M(Be,le,me,"P","");M(D,le,me,"Q","");M(Be,le,me,"Q","");M(D,le,me,"R","");M(Be,le,me,"R","");M(D,le,me,"Z","");M(Be,le,me,"Z","");M(D,H,Tt,"h","");M(Be,H,Tt,"h","");var zt="";for(var Ks=0;Ks<ky.length;Ks++){var Ir=ky.charAt(Ks);zt=String.fromCharCode(55349,56320+Ks),M(D,H,Tt,Ir,zt),M(Be,H,me,Ir,zt),zt=String.fromCharCode(55349,56372+Ks),M(D,H,Tt,Ir,zt),M(Be,H,me,Ir,zt),zt=String.fromCharCode(55349,56424+Ks),M(D,H,Tt,Ir,zt),M(Be,H,me,Ir,zt),zt=String.fromCharCode(55349,56580+Ks),M(D,H,Tt,Ir,zt),M(Be,H,me,Ir,zt),zt=String.fromCharCode(55349,56684+Ks),M(D,H,Tt,Ir,zt),M(Be,H,me,Ir,zt),zt=String.fromCharCode(55349,56736+Ks),M(D,H,Tt,Ir,zt),M(Be,H,me,Ir,zt),zt=String.fromCharCode(55349,56788+Ks),M(D,H,Tt,Ir,zt),M(Be,H,me,Ir,zt),zt=String.fromCharCode(55349,56840+Ks),M(D,H,Tt,Ir,zt),M(Be,H,me,Ir,zt),zt=String.fromCharCode(55349,56944+Ks),M(D,H,Tt,Ir,zt),M(Be,H,me,Ir,zt),Ks<26&&(zt=String.fromCharCode(55349,56632+Ks),M(D,H,Tt,Ir,zt),M(Be,H,me,Ir,zt),zt=String.fromCharCode(55349,56476+Ks),M(D,H,Tt,Ir,zt),M(Be,H,me,Ir,zt))}zt="𝕜";M(D,H,Tt,"k",zt);M(Be,H,me,"k",zt);for(var Pu=0;Pu<10;Pu++){var Tc=Pu.toString();zt=String.fromCharCode(55349,57294+Pu),M(D,H,Tt,Tc,zt),M(Be,H,me,Tc,zt),zt=String.fromCharCode(55349,57314+Pu),M(D,H,Tt,Tc,zt),M(Be,H,me,Tc,zt),zt=String.fromCharCode(55349,57324+Pu),M(D,H,Tt,Tc,zt),M(Be,H,me,Tc,zt),zt=String.fromCharCode(55349,57334+Pu),M(D,H,Tt,Tc,zt),M(Be,H,me,Tc,zt)}var qO="ÐÞþ";for(var XS=0;XS<qO.length;XS++){var R1=qO.charAt(XS);M(D,H,Tt,R1,R1),M(Be,H,me,R1,R1)}var D1=[["mathbf","textbf","Main-Bold"],["mathbf","textbf","Main-Bold"],["mathnormal","textit","Math-Italic"],["mathnormal","textit","Math-Italic"],["boldsymbol","boldsymbol","Main-BoldItalic"],["boldsymbol","boldsymbol","Main-BoldItalic"],["mathscr","textscr","Script-Regular"],["","",""],["","",""],["","",""],["mathfrak","textfrak","Fraktur-Regular"],["mathfrak","textfrak","Fraktur-Regular"],["mathbb","textbb","AMS-Regular"],["mathbb","textbb","AMS-Regular"],["mathboldfrak","textboldfrak","Fraktur-Regular"],["mathboldfrak","textboldfrak","Fraktur-Regular"],["mathsf","textsf","SansSerif-Regular"],["mathsf","textsf","SansSerif-Regular"],["mathboldsf","textboldsf","SansSerif-Bold"],["mathboldsf","textboldsf","SansSerif-Bold"],["mathitsf","textitsf","SansSerif-Italic"],["mathitsf","textitsf","SansSerif-Italic"],["","",""],["","",""],["mathtt","texttt","Typewriter-Regular"],["mathtt","texttt","Typewriter-Regular"]],yR=[["mathbf","textbf","Main-Bold"],["","",""],["mathsf","textsf","SansSerif-Regular"],["mathboldsf","textboldsf","SansSerif-Bold"],["mathtt","texttt","Typewriter-Regular"]],c3e=function(e,n){var r=e.charCodeAt(0),s=e.charCodeAt(1),i=(r-55296)*1024+(s-56320)+65536,a=n==="math"?0:1;if(119808<=i&&i<120484){var l=Math.floor((i-119808)/26);return[D1[l][2],D1[l][a]]}else if(120782<=i&&i<=120831){var c=Math.floor((i-120782)/10);return[yR[c][2],yR[c][a]]}else{if(i===120485||i===120486)return[D1[0][2],D1[0][a]];if(120486<i&&i<120782)return["",""];throw new $e("Unsupported character: "+e)}},$b=function(e,n,r){return dr[r][e]&&dr[r][e].replace&&(e=dr[r][e].replace),{value:e,metrics:NN(e,n,r)}},$a=function(e,n,r,s,i){var a=$b(e,n,r),l=a.metrics;e=a.value;var c;if(l){var d=l.italic;(r==="text"||s&&s.font==="mathit")&&(d=0),c=new Aa(e,l.height,l.depth,d,l.skew,l.width,i)}else typeof console<"u"&&console.warn("No character metrics "+("for '"+e+"' in style '"+n+"' and mode '"+r+"'")),c=new Aa(e,0,0,0,0,0,i);if(s){c.maxFontSize=s.sizeMultiplier,s.style.isTight()&&c.classes.push("mtight");var h=s.getColor();h&&(c.style.color=h)}return c},u3e=function(e,n,r,s){return s===void 0&&(s=[]),r.font==="boldsymbol"&&$b(e,"Main-Bold",n).metrics?$a(e,"Main-Bold",n,r,s.concat(["mathbf"])):e==="\\"||dr[n][e].font==="main"?$a(e,"Main-Regular",n,r,s):$a(e,"AMS-Regular",n,r,s.concat(["amsrm"]))},d3e=function(e,n,r,s,i){return i!=="textord"&&$b(e,"Math-BoldItalic",n).metrics?{fontName:"Math-BoldItalic",fontClass:"boldsymbol"}:{fontName:"Main-Bold",fontClass:"mathbf"}},h3e=function(e,n,r){var s=e.mode,i=e.text,a=["mord"],l=s==="math"||s==="text"&&n.font,c=l?n.font:n.fontFamily,d="",h="";if(i.charCodeAt(0)===55349&&([d,h]=c3e(i,s)),d.length>0)return $a(i,d,s,n,a.concat(h));if(c){var m,g;if(c==="boldsymbol"){var x=d3e(i,s,n,a,r);m=x.fontName,g=[x.fontClass]}else l?(m=rU[c].fontName,g=[c]):(m=P1(c,n.fontWeight,n.fontShape),g=[c,n.fontWeight,n.fontShape]);if($b(i,m,s).metrics)return $a(i,m,s,n,a.concat(g));if(eU.hasOwnProperty(i)&&m.slice(0,10)==="Typewriter"){for(var y=[],w=0;w<i.length;w++)y.push($a(i[w],m,s,n,a.concat(g)));return nU(y)}}if(r==="mathord")return $a(i,"Math-Italic",s,n,a.concat(["mathnormal"]));if(r==="textord"){var S=dr[s][i]&&dr[s][i].font;if(S==="ams"){var k=P1("amsrm",n.fontWeight,n.fontShape);return $a(i,k,s,n,a.concat("amsrm",n.fontWeight,n.fontShape))}else if(S==="main"||!S){var j=P1("textrm",n.fontWeight,n.fontShape);return $a(i,j,s,n,a.concat(n.fontWeight,n.fontShape))}else{var N=P1(S,n.fontWeight,n.fontShape);return $a(i,N,s,n,a.concat(N,n.fontWeight,n.fontShape))}}else throw new Error("unexpected type: "+r+" in makeOrd")},f3e=(t,e)=>{if(eu(t.classes)!==eu(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},m3e=t=>{for(var e=0;e<t.length-1;e++){var n=t[e],r=t[e+1];n instanceof Aa&&r instanceof Aa&&f3e(n,r)&&(n.text+=r.text,n.height=Math.max(n.height,r.height),n.depth=Math.max(n.depth,r.depth),n.italic=r.italic,t.splice(e+1,1),e--)}return t},TN=function(e){for(var n=0,r=0,s=0,i=0;i<e.children.length;i++){var a=e.children[i];a.height>n&&(n=a.height),a.depth>r&&(r=a.depth),a.maxFontSize>s&&(s=a.maxFontSize)}e.height=n,e.depth=r,e.maxFontSize=s},mi=function(e,n,r,s){var i=new pg(e,n,r,s);return TN(i),i},tU=(t,e,n,r)=>new pg(t,e,n,r),p3e=function(e,n,r){var s=mi([e],[],n);return s.height=Math.max(r||n.fontMetrics().defaultRuleThickness,n.minRuleThickness),s.style.borderBottomWidth=Xe(s.height),s.maxFontSize=1,s},g3e=function(e,n,r,s){var i=new CN(e,n,r,s);return TN(i),i},nU=function(e){var n=new mg(e);return TN(n),n},x3e=function(e,n){return e instanceof mg?mi([],[e],n):e},v3e=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<n.length;a++){var l=-n[a].shift-i-n[a].elem.depth,c=l-(n[a-1].elem.height+n[a-1].elem.depth);i=i+l,r.push({type:"kern",size:c}),r.push(n[a])}return{children:r,depth:s}}var d;if(e.positionType==="top"){for(var h=e.positionData,m=0;m<e.children.length;m++){var g=e.children[m];h-=g.type==="kern"?g.size:g.elem.height+g.elem.depth}d=h}else if(e.positionType==="bottom")d=-e.positionData;else{var x=e.children[0];if(x.type!=="elem")throw new Error('First child must have type "elem".');if(e.positionType==="shift")d=-x.elem.depth-e.positionData;else if(e.positionType==="firstBaseline")d=-x.elem.depth;else throw new Error("Invalid positionType "+e.positionType+".")}return{children:e.children,depth:d}},y3e=function(e,n){for(var{children:r,depth:s}=v3e(e),i=0,a=0;a<r.length;a++){var l=r[a];if(l.type==="elem"){var c=l.elem;i=Math.max(i,c.maxFontSize,c.height)}}i+=2;var d=mi(["pstrut"],[]);d.style.height=Xe(i);for(var h=[],m=s,g=s,x=s,y=0;y<r.length;y++){var w=r[y];if(w.type==="kern")x+=w.size;else{var S=w.elem,k=w.wrapperClasses||[],j=w.wrapperStyle||{},N=mi(k,[d,S],void 0,j);N.style.top=Xe(-i-x-S.depth),w.marginLeft&&(N.style.marginLeft=w.marginLeft),w.marginRight&&(N.style.marginRight=w.marginRight),h.push(N),x+=S.height+S.depth}m=Math.min(m,x),g=Math.max(g,x)}var T=mi(["vlist"],h);T.style.height=Xe(g);var E;if(m<0){var _=mi([],[]),A=mi(["vlist"],[_]);A.style.height=Xe(-m);var L=mi(["vlist-s"],[new Aa("")]);E=[mi(["vlist-r"],[T,L]),mi(["vlist-r"],[A])]}else E=[mi(["vlist-r"],[T])];var P=mi(["vlist-t"],E);return E.length===2&&P.classes.push("vlist-t2"),P.height=g,P.depth=-m,P},b3e=(t,e)=>{var n=mi(["mspace"],[],e),r=Rr(t,e);return n.style.marginRight=Xe(r),n},P1=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},rU={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"}},sU={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659]},w3e=function(e,n){var[r,s,i]=sU[e],a=new tu(r),l=new Ql([a],{width:Xe(s),height:Xe(i),style:"width:"+Xe(s),viewBox:"0 0 "+1e3*s+" "+1e3*i,preserveAspectRatio:"xMinYMin"}),c=tU(["overlay"],[l],n);return c.height=i,c.style.height=Xe(i),c.style.width=Xe(s),c},be={fontMap:rU,makeSymbol:$a,mathsym:u3e,makeSpan:mi,makeSvgSpan:tU,makeLineSpan:p3e,makeAnchor:g3e,makeFragment:nU,wrapFragment:x3e,makeVList:y3e,makeOrd:h3e,makeGlue:b3e,staticSvg:w3e,svgData:sU,tryCombineChars:m3e},_r={number:3,unit:"mu"},zu={number:4,unit:"mu"},yl={number:5,unit:"mu"},S3e={mord:{mop:_r,mbin:zu,mrel:yl,minner:_r},mop:{mord:_r,mop:_r,mrel:yl,minner:_r},mbin:{mord:zu,mop:zu,mopen:zu,minner:zu},mrel:{mord:yl,mop:yl,mopen:yl,minner:yl},mopen:{},mclose:{mop:_r,mbin:zu,mrel:yl,minner:_r},mpunct:{mord:_r,mop:_r,mrel:yl,mopen:_r,mclose:_r,mpunct:_r,minner:_r},minner:{mord:_r,mop:_r,mbin:zu,mrel:yl,mopen:_r,mpunct:_r,minner:_r}},k3e={mord:{mop:_r},mop:{mord:_r,mop:_r},mbin:{},mrel:{},mopen:{},mclose:{mop:_r},mpunct:{},minner:{mop:_r}},iU={},Oy={},jy={};function tt(t){for(var{type:e,names:n,props:r,handler:s,htmlBuilder:i,mathmlBuilder:a}=t,l={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<n.length;++c)iU[n[c]]=l;e&&(i&&(Oy[e]=i),a&&(jy[e]=a))}function Sd(t){var{type:e,htmlBuilder:n,mathmlBuilder:r}=t;tt({type:e,names:[],props:{numArgs:0},handler(){throw new Error("Should never be called.")},htmlBuilder:n,mathmlBuilder:r})}var Ny=function(e){return e.type==="ordgroup"&&e.body.length===1?e.body[0]:e},Qr=function(e){return e.type==="ordgroup"?e.body:[e]},Vl=be.makeSpan,O3e=["leftmost","mbin","mopen","mrel","mop","mpunct"],j3e=["rightmost","mrel","mclose","mpunct"],N3e={display:Et.DISPLAY,text:Et.TEXT,script:Et.SCRIPT,scriptscript:Et.SCRIPTSCRIPT},C3e={mord:"mord",mop:"mop",mbin:"mbin",mrel:"mrel",mopen:"mopen",mclose:"mclose",mpunct:"mpunct",minner:"minner"},fs=function(e,n,r,s){s===void 0&&(s=[null,null]);for(var i=[],a=0;a<e.length;a++){var l=Pn(e[a],n);if(l instanceof mg){var c=l.children;i.push(...c)}else i.push(l)}if(be.tryCombineChars(i),!r)return i;var d=n;if(e.length===1){var h=e[0];h.type==="sizing"?d=n.havingSize(h.size):h.type==="styling"&&(d=n.havingStyle(N3e[h.style]))}var m=Vl([s[0]||"leftmost"],[],n),g=Vl([s[1]||"rightmost"],[],n),x=r==="root";return bR(i,(y,w)=>{var S=w.classes[0],k=y.classes[0];S==="mbin"&&j3e.includes(k)?w.classes[0]="mord":k==="mbin"&&O3e.includes(S)&&(y.classes[0]="mord")},{node:m},g,x),bR(i,(y,w)=>{var S=$O(w),k=$O(y),j=S&&k?y.hasClass("mtight")?k3e[S][k]:S3e[S][k]:null;if(j)return be.makeGlue(j,d)},{node:m},g,x),i},bR=function t(e,n,r,s,i){s&&e.push(s);for(var a=0;a<e.length;a++){var l=e[a],c=aU(l);if(c){t(c.children,n,r,null,i);continue}var d=!l.hasClass("mspace");if(d){var h=n(l,r.node);h&&(r.insertAfter?r.insertAfter(h):(e.unshift(h),a++))}d?r.node=l:i&&l.hasClass("newline")&&(r.node=Vl(["leftmost"])),r.insertAfter=(m=>g=>{e.splice(m+1,0,g),a++})(a)}s&&e.pop()},aU=function(e){return e instanceof mg||e instanceof CN||e instanceof pg&&e.hasClass("enclosing")?e:null},T3e=function t(e,n){var r=aU(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},$O=function(e,n){return e?(n&&(e=T3e(e,n)),C3e[e.classes[0]]||null):null},vp=function(e,n){var r=["nulldelimiter"].concat(e.baseSizingClasses());return Vl(n.concat(r))},Pn=function(e,n,r){if(!e)return Vl();if(Oy[e.type]){var s=Oy[e.type](e,n);if(r&&n.size!==r.size){s=Vl(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 z1(t,e){var n=Vl(["base"],t,e),r=Vl(["strut"]);return r.style.height=Xe(n.height+n.depth),n.depth&&(r.style.verticalAlign=Xe(-n.depth)),n.children.unshift(r),n}function HO(t,e){var n=null;t.length===1&&t[0].type==="tag"&&(n=t[0].tag,t=t[0].body);var r=fs(t,e,"root"),s;r.length===2&&r[1].hasClass("tag")&&(s=r.pop());for(var i=[],a=[],l=0;l<r.length;l++)if(a.push(r[l]),r[l].hasClass("mbin")||r[l].hasClass("mrel")||r[l].hasClass("allowbreak")){for(var c=!1;l<r.length-1&&r[l+1].hasClass("mspace")&&!r[l+1].hasClass("newline");)l++,a.push(r[l]),r[l].hasClass("nobreak")&&(c=!0);c||(i.push(z1(a,e)),a=[])}else r[l].hasClass("newline")&&(a.pop(),a.length>0&&(i.push(z1(a,e)),a=[]),i.push(r[l]));a.length>0&&i.push(z1(a,e));var d;n?(d=z1(fs(n,e,!0)),d.classes=["tag"],i.push(d)):s&&i.push(s);var h=Vl(["katex-html"],i);if(h.setAttribute("aria-hidden","true"),d){var m=d.children[0];m.style.height=Xe(h.height+h.depth),h.depth&&(m.style.verticalAlign=Xe(-h.depth))}return h}function oU(t){return new mg(t)}class Qi{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=eu(this.classes));for(var r=0;r<this.children.length;r++)if(this.children[r]instanceof Ao&&this.children[r+1]instanceof Ao){for(var s=this.children[r].toText()+this.children[++r].toText();this.children[r+1]instanceof Ao;)s+=this.children[++r].toText();e.appendChild(new Ao(s).toNode())}else e.appendChild(this.children[r].toNode());return e}toMarkup(){var e="<"+this.type;for(var n in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,n)&&(e+=" "+n+'="',e+=$n.escape(this.attributes[n]),e+='"');this.classes.length>0&&(e+=' class ="'+$n.escape(eu(this.classes))+'"'),e+=">";for(var r=0;r<this.children.length;r++)e+=this.children[r].toMarkup();return e+="</"+this.type+">",e}toText(){return this.children.map(e=>e.toText()).join("")}}class Ao{constructor(e){this.text=void 0,this.text=e}toNode(){return document.createTextNode(this.text)}toMarkup(){return $n.escape(this.toText())}toText(){return this.text}}class E3e{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",Xe(this.width)),e}toMarkup(){return this.character?"<mtext>"+this.character+"</mtext>":'<mspace width="'+Xe(this.width)+'"/>'}toText(){return this.character?this.character:" "}}var qe={MathNode:Qi,TextNode:Ao,SpaceNode:E3e,newDocumentFragment:oU},Ma=function(e,n,r){return dr[n][e]&&dr[n][e].replace&&e.charCodeAt(0)!==55349&&!(eU.hasOwnProperty(e)&&r&&(r.fontFamily&&r.fontFamily.slice(4,6)==="tt"||r.font&&r.font.slice(4,6)==="tt"))&&(e=dr[n][e].replace),new qe.TextNode(e)},EN=function(e){return e.length===1?e[0]:new qe.MathNode("mrow",e)},_N=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;dr[s][i]&&dr[s][i].replace&&(i=dr[s][i].replace);var a=be.fontMap[r].fontName;return NN(i,a,s)?be.fontMap[r].variant:null};function YS(t){if(!t)return!1;if(t.type==="mi"&&t.children.length===1){var e=t.children[0];return e instanceof Ao&&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 Ao&&n.text===","}else return!1}var _i=function(e,n,r){if(e.length===1){var s=lr(e[0],n);return r&&s instanceof Qi&&s.type==="mo"&&(s.setAttribute("lspace","0em"),s.setAttribute("rspace","0em")),[s]}for(var i=[],a,l=0;l<e.length;l++){var c=lr(e[l],n);if(c instanceof Qi&&a instanceof Qi){if(c.type==="mtext"&&a.type==="mtext"&&c.getAttribute("mathvariant")===a.getAttribute("mathvariant")){a.children.push(...c.children);continue}else if(c.type==="mn"&&a.type==="mn"){a.children.push(...c.children);continue}else if(YS(c)&&a.type==="mn"){a.children.push(...c.children);continue}else if(c.type==="mn"&&YS(a))c.children=[...a.children,...c.children],i.pop();else if((c.type==="msup"||c.type==="msub")&&c.children.length>=1&&(a.type==="mn"||YS(a))){var d=c.children[0];d instanceof Qi&&d.type==="mn"&&(d.children=[...a.children,...d.children],i.pop())}else if(a.type==="mi"&&a.children.length===1){var h=a.children[0];if(h instanceof Ao&&h.text==="̸"&&(c.type==="mo"||c.type==="mi"||c.type==="mn")){var m=c.children[0];m instanceof Ao&&m.text.length>0&&(m.text=m.text.slice(0,1)+"̸"+m.text.slice(1),i.pop())}}}i.push(c),a=c}return i},nu=function(e,n,r){return EN(_i(e,n,r))},lr=function(e,n){if(!e)return new qe.MathNode("mrow");if(jy[e.type]){var r=jy[e.type](e,n);return r}else throw new $e("Got group of unknown type: '"+e.type+"'")};function wR(t,e,n,r,s){var i=_i(t,n),a;i.length===1&&i[0]instanceof Qi&&["mrow","mtable"].includes(i[0].type)?a=i[0]:a=new qe.MathNode("mrow",i);var l=new qe.MathNode("annotation",[new qe.TextNode(e)]);l.setAttribute("encoding","application/x-tex");var c=new qe.MathNode("semantics",[a,l]),d=new qe.MathNode("math",[c]);d.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),r&&d.setAttribute("display","block");var h=s?"katex":"katex-mathml";return be.makeSpan([h],[d])}var lU=function(e){return new Tl({style:e.displayMode?Et.DISPLAY:Et.TEXT,maxSize:e.maxSize,minRuleThickness:e.minRuleThickness})},cU=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},_3e=function(e,n,r){var s=lU(r),i;if(r.output==="mathml")return wR(e,n,s,r.displayMode,!0);if(r.output==="html"){var a=HO(e,s);i=be.makeSpan(["katex"],[a])}else{var l=wR(e,n,s,r.displayMode,!1),c=HO(e,s);i=be.makeSpan(["katex"],[l,c])}return cU(i,r)},A3e=function(e,n,r){var s=lU(r),i=HO(e,s),a=be.makeSpan(["katex"],[i]);return cU(a,r)},M3e={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":"="},R3e=function(e){var n=new qe.MathNode("mo",[new qe.TextNode(M3e[e.replace(/^\\/,"")])]);return n.setAttribute("stretchy","true"),n},D3e={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]},P3e=function(e){return e.type==="ordgroup"?e.body.length:1},z3e=function(e,n){function r(){var l=4e5,c=e.label.slice(1);if(["widehat","widecheck","widetilde","utilde"].includes(c)){var d=e,h=P3e(d.base),m,g,x;if(h>5)c==="widehat"||c==="widecheck"?(m=420,l=2364,x=.42,g=c+"4"):(m=312,l=2340,x=.34,g="tilde4");else{var y=[1,1,2,2,3,3][h];c==="widehat"||c==="widecheck"?(l=[0,1062,2364,2364,2364][y],m=[0,239,300,360,420][y],x=[0,.24,.3,.3,.36,.42][y],g=c+y):(l=[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 tu(g),S=new Ql([w],{width:"100%",height:Xe(x),viewBox:"0 0 "+l+" "+m,preserveAspectRatio:"none"});return{span:be.makeSvgSpan([],[S],n),minWidth:0,height:x}}else{var k=[],j=D3e[c],[N,T,E]=j,_=E/1e3,A=N.length,L,P;if(A===1){var B=j[3];L=["hide-tail"],P=[B]}else if(A===2)L=["halfarrow-left","halfarrow-right"],P=["xMinYMin","xMaxYMin"];else if(A===3)L=["brace-left","brace-center","brace-right"],P=["xMinYMin","xMidYMin","xMaxYMin"];else throw new Error(`Correct katexImagesData or update code here to support
`+A+" children.");for(var $=0;$<A;$++){var U=new tu(N[$]),te=new Ql([U],{width:"400em",height:Xe(_),viewBox:"0 0 "+l+" "+E,preserveAspectRatio:P[$]+" slice"}),z=be.makeSvgSpan([L[$]],[te],n);if(A===1)return{span:z,minWidth:T,height:_};z.style.height=Xe(_),k.push(z)}return{span:be.makeSpan(["stretchy"],k,n),minWidth:T,height:_}}}var{span:s,minWidth:i,height:a}=r();return s.height=a,s.style.height=Xe(a),i>0&&(s.style.minWidth=Xe(i)),s},I3e=function(e,n,r,s,i){var a,l=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 d=[];/^[bx]cancel$/.test(n)&&d.push(new FO({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(n)&&d.push(new FO({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var h=new Ql(d,{width:"100%",height:Xe(l)});a=be.makeSvgSpan([],[h],i)}return a.height=l,a.style.height=Xe(l),a},Ul={encloseSpan:I3e,mathMLnode:R3e,svgSpan:z3e};function en(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 AN(t){var e=Hb(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 Hb(t){return t&&(t.type==="atom"||l3e.hasOwnProperty(t.type))?t:null}var MN=(t,e)=>{var n,r,s;t&&t.type==="supsub"?(r=en(t.base,"accent"),n=r.base,t.base=n,s=a3e(Pn(t,e)),t.base=r):(r=en(t,"accent"),n=r.base);var i=Pn(n,e.havingCrampedStyle()),a=r.isShifty&&$n.isCharacterBox(n),l=0;if(a){var c=$n.getBaseElem(n),d=Pn(c,e.havingCrampedStyle());l=mR(d).skew}var h=r.label==="\\c",m=h?i.height+i.depth:Math.min(i.height,e.fontMetrics().xHeight),g;if(r.isStretchy)g=Ul.svgSpan(r,e),g=be.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"elem",elem:g,wrapperClasses:["svg-align"],wrapperStyle:l>0?{width:"calc(100% - "+Xe(2*l)+")",marginLeft:Xe(2*l)}: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=mR(x),x.italic=0,y=x.width,h&&(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=l;w||(S-=y/2),g.style.left=Xe(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},uU=(t,e)=>{var n=t.isStretchy?Ul.mathMLnode(t.label):new qe.MathNode("mo",[Ma(t.label,t.mode)]),r=new qe.MathNode("mover",[lr(t.base,e),n]);return r.setAttribute("accent","true"),r},L3e=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map(t=>"\\"+t).join("|"));tt({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=Ny(e[0]),r=!L3e.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:MN,mathmlBuilder:uU});tt({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:MN,mathmlBuilder:uU});tt({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=Pn(t.base,e),r=Ul.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=Ul.mathMLnode(t.label),r=new qe.MathNode("munder",[lr(t.base,e),n]);return r.setAttribute("accentunder","true"),r}});var I1=t=>{var e=new qe.MathNode("mpadded",t?[t]:[]);return e.setAttribute("width","+0.6em"),e.setAttribute("lspace","0.3em"),e};tt({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(Pn(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(Pn(t.below,r,e),e),a.classes.push(i+"-arrow-pad"));var l=Ul.svgSpan(t,e),c=-e.fontMetrics().axisHeight+.5*l.height,d=-e.fontMetrics().axisHeight-.5*l.height-.111;(s.depth>.25||t.label==="\\xleftequilibrium")&&(d-=s.depth);var h;if(a){var m=-e.fontMetrics().axisHeight+a.height+.5*l.height+.111;h=be.makeVList({positionType:"individualShift",children:[{type:"elem",elem:s,shift:d},{type:"elem",elem:l,shift:c},{type:"elem",elem:a,shift:m}]},e)}else h=be.makeVList({positionType:"individualShift",children:[{type:"elem",elem:s,shift:d},{type:"elem",elem:l,shift:c}]},e);return h.children[0].children[0].children[1].classes.push("svg-align"),be.makeSpan(["mrel","x-arrow"],[h],e)},mathmlBuilder(t,e){var n=Ul.mathMLnode(t.label);n.setAttribute("minsize",t.label.charAt(0)==="x"?"1.75em":"3.0em");var r;if(t.body){var s=I1(lr(t.body,e));if(t.below){var i=I1(lr(t.below,e));r=new qe.MathNode("munderover",[n,i,s])}else r=new qe.MathNode("mover",[n,s])}else if(t.below){var a=I1(lr(t.below,e));r=new qe.MathNode("munder",[n,a])}else r=I1(),r=new qe.MathNode("mover",[n,r]);return r}});var B3e=be.makeSpan;function dU(t,e){var n=fs(t.body,e,!0);return B3e([t.mclass],n,e)}function hU(t,e){var n,r=_i(t.body,e);return t.mclass==="minner"?n=new qe.MathNode("mpadded",r):t.mclass==="mord"?t.isCharacterBox?(n=r[0],n.type="mi"):n=new qe.MathNode("mi",r):(t.isCharacterBox?(n=r[0],n.type="mo"):n=new qe.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}tt({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:Qr(s),isCharacterBox:$n.isCharacterBox(s)}},htmlBuilder:dU,mathmlBuilder:hU});var Qb=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"};tt({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler(t,e){var{parser:n}=t;return{type:"mclass",mode:n.mode,mclass:Qb(e[0]),body:Qr(e[1]),isCharacterBox:$n.isCharacterBox(e[1])}}});tt({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=Qb(s):a="mrel";var l={type:"op",mode:s.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:r!=="\\stackrel",body:Qr(s)},c={type:"supsub",mode:i.mode,base:l,sup:r==="\\underset"?null:i,sub:r==="\\underset"?i:null};return{type:"mclass",mode:n.mode,mclass:a,body:[c],isCharacterBox:$n.isCharacterBox(c)}},htmlBuilder:dU,mathmlBuilder:hU});tt({type:"pmb",names:["\\pmb"],props:{numArgs:1,allowedInText:!0},handler(t,e){var{parser:n}=t;return{type:"pmb",mode:n.mode,mclass:Qb(e[0]),body:Qr(e[0])}},htmlBuilder(t,e){var n=fs(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=_i(t.body,e),r=new qe.MathNode("mstyle",n);return r.setAttribute("style","text-shadow: 0.02em 0.01em 0.04px"),r}});var F3e={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},SR=()=>({type:"styling",body:[],mode:"math",style:"display"}),kR=t=>t.type==="textord"&&t.text==="@",q3e=(t,e)=>(t.type==="mathord"||t.type==="atom")&&t.text===e;function $3e(t,e,n){var r=F3e[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],[]),l=n.callFunction("\\\\cdright",[e[1]],[]),c={type:"ordgroup",mode:"math",body:[s,a,l]};return n.callFunction("\\\\cdparent",[c],[])}case"\\\\cdlongequal":return n.callFunction("\\\\cdlongequal",[],[]);case"\\Vert":{var d={type:"textord",text:"\\Vert",mode:"math"};return n.callFunction("\\Big",[d],[])}default:return{type:"textord",text:" ",mode:"math"}}}function H3e(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<e.length;i++){for(var a=e[i],l=SR(),c=0;c<a.length;c++)if(!kR(a[c]))l.body.push(a[c]);else{r.push(l),c+=1;var d=AN(a[c]).text,h=new Array(2);if(h[0]={type:"ordgroup",mode:"math",body:[]},h[1]={type:"ordgroup",mode:"math",body:[]},!("=|.".indexOf(d)>-1))if("<>AV".indexOf(d)>-1)for(var m=0;m<2;m++){for(var g=!0,x=c+1;x<a.length;x++){if(q3e(a[x],d)){g=!1,c=x;break}if(kR(a[x]))throw new $e("Missing a "+d+" character to complete a CD arrow.",a[x]);h[m].body.push(a[x])}if(g)throw new $e("Missing a "+d+" character to complete a CD arrow.",a[c])}else throw new $e('Expected one of "<>AV=|." after @',a[c]);var y=$3e(d,h,t),w={type:"styling",body:[y],mode:"math",style:"display"};r.push(w),l=SR()}i%2===0?r.push(l):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([])}}tt({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(Pn(t.label,n,e),e);return r.classes.push("cd-label-"+t.side),r.style.bottom=Xe(.8-r.depth),r.height=0,r.depth=0,r},mathmlBuilder(t,e){var n=new qe.MathNode("mrow",[lr(t.label,e)]);return n=new qe.MathNode("mpadded",[n]),n.setAttribute("width","0"),t.side==="left"&&n.setAttribute("lspace","-1width"),n.setAttribute("voffset","0.7em"),n=new qe.MathNode("mstyle",[n]),n.setAttribute("displaystyle","false"),n.setAttribute("scriptlevel","1"),n}});tt({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(Pn(t.fragment,e),e);return n.classes.push("cd-vert-arrow"),n},mathmlBuilder(t,e){return new qe.MathNode("mrow",[lr(t.fragment,e)])}});tt({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler(t,e){for(var{parser:n}=t,r=en(e[0],"ordgroup"),s=r.body,i="",a=0;a<s.length;a++){var l=en(s[a],"textord");i+=l.text}var c=parseInt(i),d;if(isNaN(c))throw new $e("\\@char has non-numeric argument "+i);if(c<0||c>=1114111)throw new $e("\\@char with invalid code point "+i);return c<=65535?d=String.fromCharCode(c):(c-=65536,d=String.fromCharCode((c>>10)+55296,(c&1023)+56320)),{type:"textord",mode:n.mode,text:d}}});var fU=(t,e)=>{var n=fs(t.body,e.withColor(t.color),!1);return be.makeFragment(n)},mU=(t,e)=>{var n=_i(t.body,e.withColor(t.color)),r=new qe.MathNode("mstyle",n);return r.setAttribute("mathcolor",t.color),r};tt({type:"color",names:["\\textcolor"],props:{numArgs:2,allowedInText:!0,argTypes:["color","original"]},handler(t,e){var{parser:n}=t,r=en(e[0],"color-token").color,s=e[1];return{type:"color",mode:n.mode,color:r,body:Qr(s)}},htmlBuilder:fU,mathmlBuilder:mU});tt({type:"color",names:["\\color"],props:{numArgs:1,allowedInText:!0,argTypes:["color"]},handler(t,e){var{parser:n,breakOnTokenText:r}=t,s=en(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:fU,mathmlBuilder:mU});tt({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&&en(s,"size").value}},htmlBuilder(t,e){var n=be.makeSpan(["mspace"],[],e);return t.newLine&&(n.classes.push("newline"),t.size&&(n.style.marginTop=Xe(Rr(t.size,e)))),n},mathmlBuilder(t,e){var n=new qe.MathNode("mspace");return t.newLine&&(n.setAttribute("linebreak","newline"),t.size&&n.setAttribute("height",Xe(Rr(t.size,e)))),n}});var QO={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},pU=t=>{var e=t.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(e))throw new $e("Expected a control sequence",t);return e},Q3e=t=>{var e=t.gullet.popToken();return e.text==="="&&(e=t.gullet.popToken(),e.text===" "&&(e=t.gullet.popToken())),e},gU=(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)};tt({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(QO[r.text])return(n==="\\global"||n==="\\\\globallong")&&(r.text=QO[r.text]),en(e.parseFunction(),"internal");throw new $e("Invalid token after macro prefix",r)}});tt({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,l=[[]];e.gullet.future().text!=="{";)if(r=e.gullet.popToken(),r.text==="#"){if(e.gullet.future().text==="{"){a=e.gullet.future(),l[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++,l.push([])}else{if(r.text==="EOF")throw new $e("Expected a macro definition");l[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:l},n===QO[n]),{type:"internal",mode:e.mode}}});tt({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t){var{parser:e,funcName:n}=t,r=pU(e.gullet.popToken());e.gullet.consumeSpaces();var s=Q3e(e);return gU(e,r,s,n==="\\\\globallet"),{type:"internal",mode:e.mode}}});tt({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t){var{parser:e,funcName:n}=t,r=pU(e.gullet.popToken()),s=e.gullet.popToken(),i=e.gullet.popToken();return gU(e,r,i,n==="\\\\globalfuture"),e.gullet.pushToken(i),e.gullet.pushToken(s),{type:"internal",mode:e.mode}}});var h0=function(e,n,r){var s=dr.math[e]&&dr.math[e].replace,i=NN(s||e,n,r);if(!i)throw new Error("Unsupported symbol "+e+" and font size "+n+".");return i},RN=function(e,n,r,s){var i=r.havingBaseStyle(n),a=be.makeSpan(s.concat(i.sizingClasses(r)),[e],r),l=i.sizeMultiplier/r.sizeMultiplier;return a.height*=l,a.depth*=l,a.maxFontSize=i.sizeMultiplier,a},xU=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=Xe(i),e.height-=i,e.depth+=i},V3e=function(e,n,r,s,i,a){var l=be.makeSymbol(e,"Main-Regular",i,s),c=RN(l,n,s,a);return r&&xU(c,s,n),c},U3e=function(e,n,r,s){return be.makeSymbol(e,"Size"+n+"-Regular",r,s)},vU=function(e,n,r,s,i,a){var l=U3e(e,n,i,s),c=RN(be.makeSpan(["delimsizing","size"+n],[l],s),Et.TEXT,s,a);return r&&xU(c,s,Et.TEXT),c},KS=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}},ZS=function(e,n,r){var s=_o["Size4-Regular"][e.charCodeAt(0)]?_o["Size4-Regular"][e.charCodeAt(0)][4]:_o["Size1-Regular"][e.charCodeAt(0)][4],i=new tu("inner",K5e(e,Math.round(1e3*n))),a=new Ql([i],{width:Xe(s),height:Xe(n),style:"width:"+Xe(s),viewBox:"0 0 "+1e3*s+" "+Math.round(1e3*n),preserveAspectRatio:"xMinYMin"}),l=be.makeSvgSpan([],[a],r);return l.height=n,l.style.height=Xe(n),l.style.width=Xe(s),{type:"elem",elem:l}},VO=.008,L1={type:"kern",size:-1*VO},W3e=["|","\\lvert","\\rvert","\\vert"],G3e=["\\|","\\lVert","\\rVert","\\Vert"],yU=function(e,n,r,s,i,a){var l,c,d,h,m="",g=0;l=d=h=e,c=null;var x="Size1-Regular";e==="\\uparrow"?d=h="⏐":e==="\\Uparrow"?d=h="‖":e==="\\downarrow"?l=d="⏐":e==="\\Downarrow"?l=d="‖":e==="\\updownarrow"?(l="\\uparrow",d="⏐",h="\\downarrow"):e==="\\Updownarrow"?(l="\\Uparrow",d="‖",h="\\Downarrow"):W3e.includes(e)?(d="",m="vert",g=333):G3e.includes(e)?(d="∥",m="doublevert",g=556):e==="["||e==="\\lbrack"?(l="⎡",d="⎢",h="⎣",x="Size4-Regular",m="lbrack",g=667):e==="]"||e==="\\rbrack"?(l="⎤",d="⎥",h="⎦",x="Size4-Regular",m="rbrack",g=667):e==="\\lfloor"||e==="⌊"?(d=l="⎢",h="⎣",x="Size4-Regular",m="lfloor",g=667):e==="\\lceil"||e==="⌈"?(l="⎡",d=h="⎢",x="Size4-Regular",m="lceil",g=667):e==="\\rfloor"||e==="⌋"?(d=l="⎥",h="⎦",x="Size4-Regular",m="rfloor",g=667):e==="\\rceil"||e==="⌉"?(l="⎤",d=h="⎥",x="Size4-Regular",m="rceil",g=667):e==="("||e==="\\lparen"?(l="⎛",d="⎜",h="⎝",x="Size4-Regular",m="lparen",g=875):e===")"||e==="\\rparen"?(l="⎞",d="⎟",h="⎠",x="Size4-Regular",m="rparen",g=875):e==="\\{"||e==="\\lbrace"?(l="⎧",c="⎨",h="⎩",d="⎪",x="Size4-Regular"):e==="\\}"||e==="\\rbrace"?(l="⎫",c="⎬",h="⎭",d="⎪",x="Size4-Regular"):e==="\\lgroup"||e==="⟮"?(l="⎧",h="⎩",d="⎪",x="Size4-Regular"):e==="\\rgroup"||e==="⟯"?(l="⎫",h="⎭",d="⎪",x="Size4-Regular"):e==="\\lmoustache"||e==="⎰"?(l="⎧",h="⎭",d="⎪",x="Size4-Regular"):(e==="\\rmoustache"||e==="⎱")&&(l="⎫",h="⎩",d="⎪",x="Size4-Regular");var y=h0(l,x,i),w=y.height+y.depth,S=h0(d,x,i),k=S.height+S.depth,j=h0(h,x,i),N=j.height+j.depth,T=0,E=1;if(c!==null){var _=h0(c,x,i);T=_.height+_.depth,E=2}var A=w+N+T,L=Math.max(0,Math.ceil((n-A)/(E*k))),P=A+L*E*k,B=s.fontMetrics().axisHeight;r&&(B*=s.sizeMultiplier);var $=P/2-B,U=[];if(m.length>0){var te=P-w-N,z=Math.round(P*1e3),Q=Z5e(m,Math.round(te*1e3)),F=new tu(m,Q),Y=(g/1e3).toFixed(3)+"em",J=(z/1e3).toFixed(3)+"em",X=new Ql([F],{width:Y,height:J,viewBox:"0 0 "+g+" "+z}),R=be.makeSvgSpan([],[X],s);R.height=z/1e3,R.style.width=Y,R.style.height=J,U.push({type:"elem",elem:R})}else{if(U.push(KS(h,x,i)),U.push(L1),c===null){var ie=P-w-N+2*VO;U.push(ZS(d,ie,s))}else{var G=(P-w-N-T)/2+2*VO;U.push(ZS(d,G,s)),U.push(L1),U.push(KS(c,x,i)),U.push(L1),U.push(ZS(d,G,s))}U.push(L1),U.push(KS(l,x,i))}var I=s.havingBaseStyle(Et.TEXT),V=be.makeVList({positionType:"bottom",positionData:$,children:U},I);return RN(be.makeSpan(["delimsizing","mult"],[V],I),Et.TEXT,s,a)},JS=80,e5=.08,t5=function(e,n,r,s,i){var a=Y5e(e,s,r),l=new tu(e,a),c=new Ql([l],{width:"400em",height:Xe(n),viewBox:"0 0 400000 "+r,preserveAspectRatio:"xMinYMin slice"});return be.makeSvgSpan(["hide-tail"],[c],i)},X3e=function(e,n){var r=n.havingBaseSizing(),s=kU("\\surd",e*r.sizeMultiplier,SU,r),i=r.sizeMultiplier,a=Math.max(0,n.minRuleThickness-n.fontMetrics().sqrtRuleThickness),l,c=0,d=0,h=0,m;return s.type==="small"?(h=1e3+1e3*a+JS,e<1?i=1:e<1.4&&(i=.7),c=(1+a+e5)/i,d=(1+a)/i,l=t5("sqrtMain",c,h,a,n),l.style.minWidth="0.853em",m=.833/i):s.type==="large"?(h=(1e3+JS)*R0[s.size],d=(R0[s.size]+a)/i,c=(R0[s.size]+a+e5)/i,l=t5("sqrtSize"+s.size,c,h,a,n),l.style.minWidth="1.02em",m=1/i):(c=e+a+e5,d=e+a,h=Math.floor(1e3*e+a)+JS,l=t5("sqrtTall",c,h,a,n),l.style.minWidth="0.742em",m=1.056),l.height=d,l.style.height=Xe(c),{span:l,advanceWidth:m,ruleWidth:(n.fontMetrics().sqrtRuleThickness+a)*i}},bU=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","\\surd"],Y3e=["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱"],wU=["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"],R0=[0,1.2,1.8,2.4,3],K3e=function(e,n,r,s,i){if(e==="<"||e==="\\lt"||e==="⟨"?e="\\langle":(e===">"||e==="\\gt"||e==="⟩")&&(e="\\rangle"),bU.includes(e)||wU.includes(e))return vU(e,n,!1,r,s,i);if(Y3e.includes(e))return yU(e,R0[n],!1,r,s,i);throw new $e("Illegal delimiter: '"+e+"'")},Z3e=[{type:"small",style:Et.SCRIPTSCRIPT},{type:"small",style:Et.SCRIPT},{type:"small",style:Et.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],J3e=[{type:"small",style:Et.SCRIPTSCRIPT},{type:"small",style:Et.SCRIPT},{type:"small",style:Et.TEXT},{type:"stack"}],SU=[{type:"small",style:Et.SCRIPTSCRIPT},{type:"small",style:Et.SCRIPT},{type:"small",style:Et.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],eke=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.")},kU=function(e,n,r,s){for(var i=Math.min(2,3-s.style.size),a=i;a<r.length&&r[a].type!=="stack";a++){var l=h0(e,eke(r[a]),"math"),c=l.height+l.depth;if(r[a].type==="small"){var d=s.havingBaseStyle(r[a].style);c*=d.sizeMultiplier}if(c>n)return r[a]}return r[r.length-1]},OU=function(e,n,r,s,i,a){e==="<"||e==="\\lt"||e==="⟨"?e="\\langle":(e===">"||e==="\\gt"||e==="⟩")&&(e="\\rangle");var l;wU.includes(e)?l=Z3e:bU.includes(e)?l=SU:l=J3e;var c=kU(e,n,l,s);return c.type==="small"?V3e(e,c.style,r,s,i,a):c.type==="large"?vU(e,c.size,r,s,i,a):yU(e,n,r,s,i,a)},tke=function(e,n,r,s,i,a){var l=s.fontMetrics().axisHeight*s.sizeMultiplier,c=901,d=5/s.fontMetrics().ptPerEm,h=Math.max(n-l,r+l),m=Math.max(h/500*c,2*h-d);return OU(e,m,!0,s,i,a)},Bl={sqrtImage:X3e,sizedDelim:K3e,sizeToMaxHeight:R0,customSizedDelim:OU,leftRightDelim:tke},OR={"\\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}},nke=["(","\\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 Vb(t,e){var n=Hb(t);if(n&&nke.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)}tt({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=Vb(e[0],t);return{type:"delimsizing",mode:t.parser.mode,size:OR[t.funcName].size,mclass:OR[t.funcName].mclass,delim:n.text}},htmlBuilder:(t,e)=>t.delim==="."?be.makeSpan([t.mclass]):Bl.sizedDelim(t.delim,t.size,e,t.mode,[t.mclass]),mathmlBuilder:t=>{var e=[];t.delim!=="."&&e.push(Ma(t.delim,t.mode));var n=new qe.MathNode("mo",e);t.mclass==="mopen"||t.mclass==="mclose"?n.setAttribute("fence","true"):n.setAttribute("fence","false"),n.setAttribute("stretchy","true");var r=Xe(Bl.sizeToMaxHeight[t.size]);return n.setAttribute("minsize",r),n.setAttribute("maxsize",r),n}});function jR(t){if(!t.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}tt({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:Vb(e[0],t).text,color:n}}});tt({type:"leftright",names:["\\left"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var n=Vb(e[0],t),r=t.parser;++r.leftrightDepth;var s=r.parseExpression(!1);--r.leftrightDepth,r.expect("\\right",!1);var i=en(r.parseFunction(),"leftright-right");return{type:"leftright",mode:r.mode,body:s,left:n.text,right:i.delim,rightColor:i.color}},htmlBuilder:(t,e)=>{jR(t);for(var n=fs(t.body,e,!0,["mopen","mclose"]),r=0,s=0,i=!1,a=0;a<n.length;a++)n[a].isMiddle?i=!0:(r=Math.max(n[a].height,r),s=Math.max(n[a].depth,s));r*=e.sizeMultiplier,s*=e.sizeMultiplier;var l;if(t.left==="."?l=vp(e,["mopen"]):l=Bl.leftRightDelim(t.left,r,s,e,t.mode,["mopen"]),n.unshift(l),i)for(var c=1;c<n.length;c++){var d=n[c],h=d.isMiddle;h&&(n[c]=Bl.leftRightDelim(h.delim,r,s,h.options,t.mode,[]))}var m;if(t.right===".")m=vp(e,["mclose"]);else{var g=t.rightColor?e.withColor(t.rightColor):e;m=Bl.leftRightDelim(t.right,r,s,g,t.mode,["mclose"])}return n.push(m),be.makeSpan(["minner"],n,e)},mathmlBuilder:(t,e)=>{jR(t);var n=_i(t.body,e);if(t.left!=="."){var r=new qe.MathNode("mo",[Ma(t.left,t.mode)]);r.setAttribute("fence","true"),n.unshift(r)}if(t.right!=="."){var s=new qe.MathNode("mo",[Ma(t.right,t.mode)]);s.setAttribute("fence","true"),t.rightColor&&s.setAttribute("mathcolor",t.rightColor),n.push(s)}return EN(n)}});tt({type:"middle",names:["\\middle"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var n=Vb(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=vp(e,[]);else{n=Bl.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==="|"?Ma("|","text"):Ma(t.delim,t.mode),r=new qe.MathNode("mo",[n]);return r.setAttribute("fence","true"),r.setAttribute("lspace","0.05em"),r.setAttribute("rspace","0.05em"),r}});var DN=(t,e)=>{var n=be.wrapFragment(Pn(t.body,e),e),r=t.label.slice(1),s=e.sizeMultiplier,i,a=0,l=$n.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=Rr({number:.6,unit:"pt"},e),d=Rr({number:.35,unit:"ex"},e),h=e.havingBaseSizing();s=s/h.sizeMultiplier;var m=n.height+n.depth+c+d;n.style.paddingLeft=Xe(m/2+c);var g=Math.floor(1e3*m*s),x=G5e(g),y=new Ql([new tu("phase",x)],{width:"400em",height:Xe(g/1e3),viewBox:"0 0 400000 "+g,preserveAspectRatio:"xMinYMin slice"});i=be.makeSvgSpan(["hide-tail"],[y],e),i.style.height=Xe(m),a=n.depth+c+d}else{/cancel/.test(r)?l||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=l?.2:0,S=w),i=Ul.encloseSpan(n,r,w,S,e),/fbox|boxed|fcolorbox/.test(r)?(i.style.borderStyle="solid",i.style.borderWidth=Xe(k)):r==="angl"&&k!==.049&&(i.style.borderTopWidth=Xe(k),i.style.borderRightWidth=Xe(k)),a=n.depth+S,t.backgroundColor&&(i.style.backgroundColor=t.backgroundColor,t.borderColor&&(i.style.borderColor=t.borderColor))}var j;if(t.backgroundColor)j=be.makeVList({positionType:"individualShift",children:[{type:"elem",elem:i,shift:a},{type:"elem",elem:n,shift:0}]},e);else{var N=/cancel|phase/.test(r)?["svg-align"]:[];j=be.makeVList({positionType:"individualShift",children:[{type:"elem",elem:n,shift:0},{type:"elem",elem:i,shift:a,wrapperClasses:N}]},e)}return/cancel/.test(r)&&(j.height=n.height,j.depth=n.depth),/cancel/.test(r)&&!l?be.makeSpan(["mord","cancel-lap"],[j],e):be.makeSpan(["mord"],[j],e)},PN=(t,e)=>{var n=0,r=new qe.MathNode(t.label.indexOf("colorbox")>-1?"mpadded":"menclose",[lr(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};tt({type:"enclose",names:["\\colorbox"],props:{numArgs:2,allowedInText:!0,argTypes:["color","text"]},handler(t,e,n){var{parser:r,funcName:s}=t,i=en(e[0],"color-token").color,a=e[1];return{type:"enclose",mode:r.mode,label:s,backgroundColor:i,body:a}},htmlBuilder:DN,mathmlBuilder:PN});tt({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,allowedInText:!0,argTypes:["color","color","text"]},handler(t,e,n){var{parser:r,funcName:s}=t,i=en(e[0],"color-token").color,a=en(e[1],"color-token").color,l=e[2];return{type:"enclose",mode:r.mode,label:s,backgroundColor:a,borderColor:i,body:l}},htmlBuilder:DN,mathmlBuilder:PN});tt({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]}}});tt({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:DN,mathmlBuilder:PN});tt({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 jU={};function Vo(t){for(var{type:e,names:n,props:r,handler:s,htmlBuilder:i,mathmlBuilder:a}=t,l={type:e,numArgs:r.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:s},c=0;c<n.length;++c)jU[n[c]]=l;i&&(Oy[e]=i),a&&(jy[e]=a)}var NU={};function Z(t,e){NU[t]=e}function NR(t){var e=[];t.consumeSpaces();var n=t.fetch().text;for(n==="\\relax"&&(t.consume(),t.consumeSpaces(),n=t.fetch().text);n==="\\hline"||n==="\\hdashline";)t.consume(),e.push(n==="\\hdashline"),t.consumeSpaces(),n=t.fetch().text;return e}var Ub=t=>{var e=t.parser.settings;if(!e.displayMode)throw new $e("{"+t.envName+"} can be used only in display mode.")};function zN(t){if(t.indexOf("ed")===-1)return t.indexOf("*")===-1}function du(t,e,n){var{hskipBeforeAndAfter:r,addJot:s,cols:i,arraystretch:a,colSeparationType:l,autoTag:c,singleRow:d,emptySingleRow:h,maxNumCols:m,leqno:g}=e;if(t.gullet.beginGroup(),d||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=[],j=c!=null?[]:void 0;function N(){c&&t.gullet.macros.set("\\@eqnsw","1",!0)}function T(){j&&(t.gullet.macros.get("\\df@tag")?(j.push(t.subparse([new Xi("\\df@tag")])),t.gullet.macros.set("\\df@tag",void 0,!0)):j.push(!!c&&t.gullet.macros.get("\\@eqnsw")==="1"))}for(N(),k.push(NR(t));;){var E=t.parseExpression(!1,d?"\\end":"\\\\");t.gullet.endGroup(),t.gullet.beginGroup(),E={type:"ordgroup",mode:t.mode,body:E},n&&(E={type:"styling",mode:t.mode,style:n,body:[E]}),y.push(E);var _=t.fetch().text;if(_==="&"){if(m&&y.length===m){if(d||l)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(_==="\\end"){T(),y.length===1&&E.type==="styling"&&E.body[0].body.length===0&&(w.length>1||!h)&&w.pop(),k.length<w.length+1&&k.push([]);break}else if(_==="\\\\"){t.consume();var A=void 0;t.gullet.future().text!==" "&&(A=t.parseSizeGroup(!0)),S.push(A?A.value:null),T(),k.push(NR(t)),y=[],w.push(y),N()}else throw new $e("Expected & or \\\\ or \\cr or \\end",t.nextToken)}return t.gullet.endGroup(),t.gullet.endGroup(),{type:"array",mode:t.mode,addJot:s,arraystretch:a,body:w,cols:i,rowGaps:S,hskipBeforeAndAfter:r,hLinesBeforeRow:k,colSeparationType:l,tags:j,leqno:g}}function IN(t){return t.slice(0,1)==="d"?"display":"text"}var Uo=function(e,n){var r,s,i=e.body.length,a=e.hLinesBeforeRow,l=0,c=new Array(i),d=[],h=Math.max(n.fontMetrics().arrayRuleWidth,n.minRuleThickness),m=1/n.fontMetrics().ptPerEm,g=5*m;if(e.colSeparationType&&e.colSeparationType==="small"){var x=n.havingStyle(Et.SCRIPT).sizeMultiplier;g=.2778*(x/n.sizeMultiplier)}var y=e.colSeparationType==="CD"?Rr({number:3,unit:"ex"},n):12*m,w=3*m,S=e.arraystretch*y,k=.7*S,j=.3*S,N=0;function T(He){for(var Ot=0;Ot<He.length;++Ot)Ot>0&&(N+=.25),d.push({pos:N,isDashed:He[Ot]})}for(T(a[0]),r=0;r<e.body.length;++r){var E=e.body[r],_=k,A=j;l<E.length&&(l=E.length);var L=new Array(E.length);for(s=0;s<E.length;++s){var P=Pn(E[s],n);A<P.depth&&(A=P.depth),_<P.height&&(_=P.height),L[s]=P}var B=e.rowGaps[r],$=0;B&&($=Rr(B,n),$>0&&($+=j,A<$&&(A=$),$=0)),e.addJot&&(A+=w),L.height=_,L.depth=A,N+=_,L.pos=N,N+=A+$,c[r]=L,T(a[r+1])}var U=N/2+n.fontMetrics().axisHeight,te=e.cols||[],z=[],Q,F,Y=[];if(e.tags&&e.tags.some(He=>He))for(r=0;r<i;++r){var J=c[r],X=J.pos-U,R=e.tags[r],ie=void 0;R===!0?ie=be.makeSpan(["eqn-num"],[],n):R===!1?ie=be.makeSpan([],[],n):ie=be.makeSpan([],fs(R,n,!0),n),ie.depth=J.depth,ie.height=J.height,Y.push({type:"elem",elem:ie,shift:X})}for(s=0,F=0;s<l||F<te.length;++s,++F){for(var G=te[F]||{},I=!0;G.type==="separator";){if(I||(Q=be.makeSpan(["arraycolsep"],[]),Q.style.width=Xe(n.fontMetrics().doubleRuleSep),z.push(Q)),G.separator==="|"||G.separator===":"){var V=G.separator==="|"?"solid":"dashed",ee=be.makeSpan(["vertical-separator"],[],n);ee.style.height=Xe(N),ee.style.borderRightWidth=Xe(h),ee.style.borderRightStyle=V,ee.style.margin="0 "+Xe(-h/2);var ne=N-U;ne&&(ee.style.verticalAlign=Xe(-ne)),z.push(ee)}else throw new $e("Invalid separator type: "+G.separator);F++,G=te[F]||{},I=!1}if(!(s>=l)){var W=void 0;(s>0||e.hskipBeforeAndAfter)&&(W=$n.deflt(G.pregap,g),W!==0&&(Q=be.makeSpan(["arraycolsep"],[]),Q.style.width=Xe(W),z.push(Q)));var se=[];for(r=0;r<i;++r){var re=c[r],oe=re[s];if(oe){var Te=re.pos-U;oe.depth=re.depth,oe.height=re.height,se.push({type:"elem",elem:oe,shift:Te})}}se=be.makeVList({positionType:"individualShift",children:se},n),se=be.makeSpan(["col-align-"+(G.align||"c")],[se]),z.push(se),(s<l-1||e.hskipBeforeAndAfter)&&(W=$n.deflt(G.postgap,g),W!==0&&(Q=be.makeSpan(["arraycolsep"],[]),Q.style.width=Xe(W),z.push(Q)))}}if(c=be.makeSpan(["mtable"],z),d.length>0){for(var We=be.makeLineSpan("hline",n,h),Ye=be.makeLineSpan("hdashline",n,h),Je=[{type:"elem",elem:c,shift:0}];d.length>0;){var Oe=d.pop(),Ve=Oe.pos-U;Oe.isDashed?Je.push({type:"elem",elem:Ye,shift:Ve}):Je.push({type:"elem",elem:We,shift:Ve})}c=be.makeVList({positionType:"individualShift",children:Je},n)}if(Y.length===0)return be.makeSpan(["mord"],[c],n);var Ue=be.makeVList({positionType:"individualShift",children:Y},n);return Ue=be.makeSpan(["tag"],[Ue],n),be.makeFragment([c,Ue])},rke={c:"center ",l:"left ",r:"right "},Wo=function(e,n){for(var r=[],s=new qe.MathNode("mtd",[],["mtr-glue"]),i=new qe.MathNode("mtd",[],["mml-eqn-num"]),a=0;a<e.body.length;a++){for(var l=e.body[a],c=[],d=0;d<l.length;d++)c.push(new qe.MathNode("mtd",[lr(l[d],n)]));e.tags&&e.tags[a]&&(c.unshift(s),c.push(s),e.leqno?c.unshift(i):c.push(i)),r.push(new qe.MathNode("mtr",c))}var h=new qe.MathNode("mtable",r),m=e.arraystretch===.5?.1:.16+e.arraystretch-1+(e.addJot?.09:0);h.setAttribute("rowspacing",Xe(m));var g="",x="";if(e.cols&&e.cols.length>0){var y=e.cols,w="",S=!1,k=0,j=y.length;y[0].type==="separator"&&(g+="top ",k=1),y[y.length-1].type==="separator"&&(g+="bottom ",j-=1);for(var N=k;N<j;N++)y[N].type==="align"?(x+=rke[y[N].align],S&&(w+="none "),S=!0):y[N].type==="separator"&&S&&(w+=y[N].separator==="|"?"solid ":"dashed ",S=!1);h.setAttribute("columnalign",x.trim()),/[sd]/.test(w)&&h.setAttribute("columnlines",w.trim())}if(e.colSeparationType==="align"){for(var T=e.cols||[],E="",_=1;_<T.length;_++)E+=_%2?"0em ":"1em ";h.setAttribute("columnspacing",E.trim())}else e.colSeparationType==="alignat"||e.colSeparationType==="gather"?h.setAttribute("columnspacing","0em"):e.colSeparationType==="small"?h.setAttribute("columnspacing","0.2778em"):e.colSeparationType==="CD"?h.setAttribute("columnspacing","0.5em"):h.setAttribute("columnspacing","1em");var A="",L=e.hLinesBeforeRow;g+=L[0].length>0?"left ":"",g+=L[L.length-1].length>0?"right ":"";for(var P=1;P<L.length-1;P++)A+=L[P].length===0?"none ":L[P][0]?"dashed ":"solid ";return/[sd]/.test(A)&&h.setAttribute("rowlines",A.trim()),g!==""&&(h=new qe.MathNode("menclose",[h]),h.setAttribute("notation",g.trim())),e.arraystretch&&e.arraystretch<1&&(h=new qe.MathNode("mstyle",[h]),h.setAttribute("scriptlevel","1")),h},CU=function(e,n){e.envName.indexOf("ed")===-1&&Ub(e);var r=[],s=e.envName.indexOf("at")>-1?"alignat":"align",i=e.envName==="split",a=du(e.parser,{cols:r,addJot:!0,autoTag:i?void 0:zN(e.envName),emptySingleRow:!0,colSeparationType:s,maxNumCols:i?2:void 0,leqno:e.parser.settings.leqno},"display"),l,c=0,d={type:"ordgroup",mode:e.mode,body:[]};if(n[0]&&n[0].type==="ordgroup"){for(var h="",m=0;m<n[0].body.length;m++){var g=en(n[0].body[m],"textord");h+=g.text}l=Number(h),c=l*2}var x=!c;a.body.forEach(function(k){for(var j=1;j<k.length;j+=2){var N=en(k[j],"styling"),T=en(N.body[0],"ordgroup");T.body.unshift(d)}if(x)c<k.length&&(c=k.length);else{var E=k.length/2;if(l<E)throw new $e("Too many math in a row: "+("expected "+l+", but got "+E),k[0])}});for(var y=0;y<c;++y){var w="r",S=0;y%2===1?w="l":y>0&&x&&(S=1),r[y]={type:"align",align:w,pregap:S,postgap:0}}return a.colSeparationType=x?"align":"alignat",a};Vo({type:"array",names:["array","darray"],props:{numArgs:1},handler(t,e){var n=Hb(e[0]),r=n?[e[0]]:en(e[0],"ordgroup").body,s=r.map(function(a){var l=AN(a),c=l.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 du(t.parser,i,IN(t.envName))},htmlBuilder:Uo,mathmlBuilder:Wo});Vo({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=du(t.parser,r,IN(t.envName)),a=Math.max(0,...i.body.map(l=>l.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:Uo,mathmlBuilder:Wo});Vo({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(t){var e={arraystretch:.5},n=du(t.parser,e,"script");return n.colSeparationType="small",n},htmlBuilder:Uo,mathmlBuilder:Wo});Vo({type:"array",names:["subarray"],props:{numArgs:1},handler(t,e){var n=Hb(e[0]),r=n?[e[0]]:en(e[0],"ordgroup").body,s=r.map(function(a){var l=AN(a),c=l.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=du(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:Uo,mathmlBuilder:Wo});Vo({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=du(t.parser,e,IN(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:Uo,mathmlBuilder:Wo});Vo({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:CU,htmlBuilder:Uo,mathmlBuilder:Wo});Vo({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(t){["gather","gather*"].includes(t.envName)&&Ub(t);var e={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",autoTag:zN(t.envName),emptySingleRow:!0,leqno:t.parser.settings.leqno};return du(t.parser,e,"display")},htmlBuilder:Uo,mathmlBuilder:Wo});Vo({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:CU,htmlBuilder:Uo,mathmlBuilder:Wo});Vo({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(t){Ub(t);var e={autoTag:zN(t.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:t.parser.settings.leqno};return du(t.parser,e,"display")},htmlBuilder:Uo,mathmlBuilder:Wo});Vo({type:"array",names:["CD"],props:{numArgs:0},handler(t){return Ub(t),H3e(t.parser)},htmlBuilder:Uo,mathmlBuilder:Wo});Z("\\nonumber","\\gdef\\@eqnsw{0}");Z("\\notag","\\nonumber");tt({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 CR=jU;tt({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<s.body.length;++a)i+=en(s.body[a],"textord").text;if(r==="\\begin"){if(!CR.hasOwnProperty(i))throw new $e("No such environment: "+i,s);var l=CR[i],{args:c,optArgs:d}=n.parseArguments("\\begin{"+i+"}",l),h={mode:n.mode,envName:i,parser:n},m=l.handler(h,c,d);n.expect("\\end",!1);var g=n.nextToken,x=en(n.parseFunction(),"environment");if(x.name!==i)throw new $e("Mismatch: \\begin{"+i+"} matched by \\end{"+x.name+"}",g);return m}return{type:"environment",mode:n.mode,name:i,nameGroup:s}}});var TU=(t,e)=>{var n=t.font,r=e.withFont(n);return Pn(t.body,r)},EU=(t,e)=>{var n=t.font,r=e.withFont(n);return lr(t.body,r)},TR={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak","\\bm":"\\boldsymbol"};tt({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=Ny(e[0]),i=r;return i in TR&&(i=TR[i]),{type:"font",mode:n.mode,font:i.slice(1),body:s}},htmlBuilder:TU,mathmlBuilder:EU});tt({type:"mclass",names:["\\boldsymbol","\\bm"],props:{numArgs:1},handler:(t,e)=>{var{parser:n}=t,r=e[0],s=$n.isCharacterBox(r);return{type:"mclass",mode:n.mode,mclass:Qb(r),body:[{type:"font",mode:n.mode,font:"boldsymbol",body:r}],isCharacterBox:s}}});tt({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),l="math"+r.slice(1);return{type:"font",mode:i,font:l,body:{type:"ordgroup",mode:n.mode,body:a}}},htmlBuilder:TU,mathmlBuilder:EU});var _U=(t,e)=>{var n=e;return t==="display"?n=n.id>=Et.SCRIPT.id?n.text():Et.DISPLAY:t==="text"&&n.size===Et.DISPLAY.size?n=Et.TEXT:t==="script"?n=Et.SCRIPT:t==="scriptscript"&&(n=Et.SCRIPTSCRIPT),n},LN=(t,e)=>{var n=_U(t.size,e.style),r=n.fracNum(),s=n.fracDen(),i;i=e.havingStyle(r);var a=Pn(t.numer,i,e);if(t.continued){var l=8.5/e.fontMetrics().ptPerEm,c=3.5/e.fontMetrics().ptPerEm;a.height=a.height<l?l:a.height,a.depth=a.depth<c?c:a.depth}i=e.havingStyle(s);var d=Pn(t.denom,i,e),h,m,g;t.hasBarLine?(t.barSize?(m=Rr(t.barSize,e),h=be.makeLineSpan("frac-line",e,m)):h=be.makeLineSpan("frac-line",e),m=h.height,g=h.height):(h=null,m=0,g=e.fontMetrics().defaultRuleThickness);var x,y,w;n.size===Et.DISPLAY.size||t.size==="display"?(x=e.fontMetrics().num1,m>0?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(h){var j=e.fontMetrics().axisHeight;x-a.depth-(j+.5*m)<y&&(x+=y-(x-a.depth-(j+.5*m))),j-.5*m-(d.height-w)<y&&(w+=y-(j-.5*m-(d.height-w)));var N=-(j-.5*m);S=be.makeVList({positionType:"individualShift",children:[{type:"elem",elem:d,shift:w},{type:"elem",elem:h,shift:N},{type:"elem",elem:a,shift:-x}]},e)}else{var k=x-a.depth-(d.height-w);k<y&&(x+=.5*(y-k),w+=.5*(y-k)),S=be.makeVList({positionType:"individualShift",children:[{type:"elem",elem:d,shift:w},{type:"elem",elem:a,shift:-x}]},e)}i=e.havingStyle(n),S.height*=i.sizeMultiplier/e.sizeMultiplier,S.depth*=i.sizeMultiplier/e.sizeMultiplier;var T;n.size===Et.DISPLAY.size?T=e.fontMetrics().delim1:n.size===Et.SCRIPTSCRIPT.size?T=e.havingStyle(Et.SCRIPT).fontMetrics().delim2:T=e.fontMetrics().delim2;var E,_;return t.leftDelim==null?E=vp(e,["mopen"]):E=Bl.customSizedDelim(t.leftDelim,T,!0,e.havingStyle(n),t.mode,["mopen"]),t.continued?_=be.makeSpan([]):t.rightDelim==null?_=vp(e,["mclose"]):_=Bl.customSizedDelim(t.rightDelim,T,!0,e.havingStyle(n),t.mode,["mclose"]),be.makeSpan(["mord"].concat(i.sizingClasses(e)),[E,be.makeSpan(["mfrac"],[S]),_],e)},BN=(t,e)=>{var n=new qe.MathNode("mfrac",[lr(t.numer,e),lr(t.denom,e)]);if(!t.hasBarLine)n.setAttribute("linethickness","0px");else if(t.barSize){var r=Rr(t.barSize,e);n.setAttribute("linethickness",Xe(r))}var s=_U(t.size,e.style);if(s.size!==e.style.size){n=new qe.MathNode("mstyle",[n]);var i=s.size===Et.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 l=new qe.MathNode("mo",[new qe.TextNode(t.leftDelim.replace("\\",""))]);l.setAttribute("fence","true"),a.push(l)}if(a.push(n),t.rightDelim!=null){var c=new qe.MathNode("mo",[new qe.TextNode(t.rightDelim.replace("\\",""))]);c.setAttribute("fence","true"),a.push(c)}return EN(a)}return n};tt({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,l=null,c=null,d="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,l="(",c=")";break;case"\\\\bracefrac":a=!1,l="\\{",c="\\}";break;case"\\\\brackfrac":a=!1,l="[",c="]";break;default:throw new Error("Unrecognized genfrac command")}switch(r){case"\\dfrac":case"\\dbinom":d="display";break;case"\\tfrac":case"\\tbinom":d="text";break}return{type:"genfrac",mode:n.mode,continued:!1,numer:s,denom:i,hasBarLine:a,leftDelim:l,rightDelim:c,size:d,barSize:null}},htmlBuilder:LN,mathmlBuilder:BN});tt({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}}});tt({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 ER=["display","text","script","scriptscript"],_R=function(e){var n=null;return e.length>0&&(n=e,n=n==="."?null:n),n};tt({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=Ny(e[0]),a=i.type==="atom"&&i.family==="open"?_R(i.text):null,l=Ny(e[1]),c=l.type==="atom"&&l.family==="close"?_R(l.text):null,d=en(e[2],"size"),h,m=null;d.isBlank?h=!0:(m=d.value,h=m.number>0);var g="auto",x=e[3];if(x.type==="ordgroup"){if(x.body.length>0){var y=en(x.body[0],"textord");g=ER[Number(y.text)]}}else x=en(x,"textord"),g=ER[Number(x.text)];return{type:"genfrac",mode:n.mode,numer:r,denom:s,continued:!1,hasBarLine:h,barSize:m,leftDelim:a,rightDelim:c,size:g}},htmlBuilder:LN,mathmlBuilder:BN});tt({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:en(e[0],"size").value,token:s}}});tt({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=e[0],i=R5e(en(e[1],"infix").size),a=e[2],l=i.number>0;return{type:"genfrac",mode:n.mode,numer:s,denom:a,continued:!1,hasBarLine:l,barSize:i,leftDelim:null,rightDelim:null,size:"auto"}},htmlBuilder:LN,mathmlBuilder:BN});var AU=(t,e)=>{var n=e.style,r,s;t.type==="supsub"?(r=t.sup?Pn(t.sup,e.havingStyle(n.sup()),e):Pn(t.sub,e.havingStyle(n.sub()),e),s=en(t.base,"horizBrace")):s=en(t,"horizBrace");var i=Pn(s.base,e.havingBaseStyle(Et.DISPLAY)),a=Ul.svgSpan(s,e),l;if(s.isOver?(l=be.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:.1},{type:"elem",elem:a}]},e),l.children[0].children[0].children[1].classes.push("svg-align")):(l=be.makeVList({positionType:"bottom",positionData:i.depth+.1+a.height,children:[{type:"elem",elem:a},{type:"kern",size:.1},{type:"elem",elem:i}]},e),l.children[0].children[0].children[0].classes.push("svg-align")),r){var c=be.makeSpan(["mord",s.isOver?"mover":"munder"],[l],e);s.isOver?l=be.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:c},{type:"kern",size:.2},{type:"elem",elem:r}]},e):l=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"],[l],e)},ske=(t,e)=>{var n=Ul.mathMLnode(t.label);return new qe.MathNode(t.isOver?"mover":"munder",[lr(t.base,e),n])};tt({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:AU,mathmlBuilder:ske});tt({type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=e[1],s=en(e[0],"url").url;return n.settings.isTrusted({command:"\\href",url:s})?{type:"href",mode:n.mode,href:s,body:Qr(r)}:n.formatUnsupportedCmd("\\href")},htmlBuilder:(t,e)=>{var n=fs(t.body,e,!1);return be.makeAnchor(t.href,[],n,e)},mathmlBuilder:(t,e)=>{var n=nu(t.body,e);return n instanceof Qi||(n=new Qi("mrow",[n])),n.setAttribute("href",t.href),n}});tt({type:"href",names:["\\url"],props:{numArgs:1,argTypes:["url"],allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=en(e[0],"url").url;if(!n.settings.isTrusted({command:"\\url",url:r}))return n.formatUnsupportedCmd("\\url");for(var s=[],i=0;i<r.length;i++){var a=r[i];a==="~"&&(a="\\textasciitilde"),s.push({type:"textord",mode:"text",text:a})}var l={type:"text",mode:n.mode,font:"\\texttt",body:s};return{type:"href",mode:n.mode,href:r,body:Qr(l)}}});tt({type:"hbox",names:["\\hbox"],props:{numArgs:1,argTypes:["text"],allowedInText:!0,primitive:!0},handler(t,e){var{parser:n}=t;return{type:"hbox",mode:n.mode,body:Qr(e[0])}},htmlBuilder(t,e){var n=fs(t.body,e,!1);return be.makeFragment(n)},mathmlBuilder(t,e){return new qe.MathNode("mrow",_i(t.body,e))}});tt({type:"html",names:["\\htmlClass","\\htmlId","\\htmlStyle","\\htmlData"],props:{numArgs:2,argTypes:["raw","original"],allowedInText:!0},handler:(t,e)=>{var{parser:n,funcName:r,token:s}=t,i=en(e[0],"raw").string,a=e[1];n.settings.strict&&n.settings.reportNonstrict("htmlExtension","HTML extension is disabled on strict mode");var l,c={};switch(r){case"\\htmlClass":c.class=i,l={command:"\\htmlClass",class:i};break;case"\\htmlId":c.id=i,l={command:"\\htmlId",id:i};break;case"\\htmlStyle":c.style=i,l={command:"\\htmlStyle",style:i};break;case"\\htmlData":{for(var d=i.split(","),h=0;h<d.length;h++){var m=d[h].split("=");if(m.length!==2)throw new $e("Error parsing key-value for \\htmlData");c["data-"+m[0].trim()]=m[1].trim()}l={command:"\\htmlData",attributes:c};break}default:throw new Error("Unrecognized html command")}return n.settings.isTrusted(l)?{type:"html",mode:n.mode,attributes:c,body:Qr(a)}:n.formatUnsupportedCmd(r)},htmlBuilder:(t,e)=>{var n=fs(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)=>nu(t.body,e)});tt({type:"htmlmathml",names:["\\html@mathml"],props:{numArgs:2,allowedInText:!0},handler:(t,e)=>{var{parser:n}=t;return{type:"htmlmathml",mode:n.mode,html:Qr(e[0]),mathml:Qr(e[1])}},htmlBuilder:(t,e)=>{var n=fs(t.html,e,!1);return be.makeFragment(n)},mathmlBuilder:(t,e)=>nu(t.mathml,e)});var n5=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(!YV(r))throw new $e("Invalid unit: '"+r.unit+"' in \\includegraphics.");return r};tt({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"},l="";if(n[0])for(var c=en(n[0],"raw").string,d=c.split(","),h=0;h<d.length;h++){var m=d[h].split("=");if(m.length===2){var g=m[1].trim();switch(m[0].trim()){case"alt":l=g;break;case"width":s=n5(g);break;case"height":i=n5(g);break;case"totalheight":a=n5(g);break;default:throw new $e("Invalid key: '"+m[0]+"' in \\includegraphics.")}}}var x=en(e[0],"url").url;return l===""&&(l=x,l=l.replace(/^.*[\\/]/,""),l=l.substring(0,l.lastIndexOf("."))),r.settings.isTrusted({command:"\\includegraphics",url:x})?{type:"includegraphics",mode:r.mode,alt:l,width:s,height:i,totalheight:a,src:x}:r.formatUnsupportedCmd("\\includegraphics")},htmlBuilder:(t,e)=>{var n=Rr(t.height,e),r=0;t.totalheight.number>0&&(r=Rr(t.totalheight,e)-n);var s=0;t.width.number>0&&(s=Rr(t.width,e));var i={height:Xe(n+r)};s>0&&(i.width=Xe(s)),r>0&&(i.verticalAlign=Xe(-r));var a=new s3e(t.src,t.alt,i);return a.height=n,a.depth=r,a},mathmlBuilder:(t,e)=>{var n=new qe.MathNode("mglyph",[]);n.setAttribute("alt",t.alt);var r=Rr(t.height,e),s=0;if(t.totalheight.number>0&&(s=Rr(t.totalheight,e)-r,n.setAttribute("valign",Xe(-s))),n.setAttribute("height",Xe(r+s)),t.width.number>0){var i=Rr(t.width,e);n.setAttribute("width",Xe(i))}return n.setAttribute("src",t.src),n}});tt({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=en(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=Rr(t.dimension,e);return new qe.SpaceNode(n)}});tt({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([],[Pn(t.body,e)]),n=be.makeSpan(["inner"],[n],e)):n=be.makeSpan(["inner"],[Pn(t.body,e)]);var r=be.makeSpan(["fix"],[]),s=be.makeSpan([t.alignment],[n,r],e),i=be.makeSpan(["strut"]);return i.style.height=Xe(s.height+s.depth),s.depth&&(i.style.verticalAlign=Xe(-s.depth)),s.children.unshift(i),s=be.makeSpan(["thinbox"],[s],e),be.makeSpan(["mord","vbox"],[s],e)},mathmlBuilder:(t,e)=>{var n=new qe.MathNode("mpadded",[lr(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}});tt({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}}});tt({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(t,e){throw new $e("Mismatched "+t.funcName)}});var AR=(t,e)=>{switch(e.style.size){case Et.DISPLAY.size:return t.display;case Et.TEXT.size:return t.text;case Et.SCRIPT.size:return t.script;case Et.SCRIPTSCRIPT.size:return t.scriptscript;default:return t.text}};tt({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:(t,e)=>{var{parser:n}=t;return{type:"mathchoice",mode:n.mode,display:Qr(e[0]),text:Qr(e[1]),script:Qr(e[2]),scriptscript:Qr(e[3])}},htmlBuilder:(t,e)=>{var n=AR(t,e),r=fs(n,e,!1);return be.makeFragment(r)},mathmlBuilder:(t,e)=>{var n=AR(t,e);return nu(n,e)}});var MU=(t,e,n,r,s,i,a)=>{t=be.makeSpan([],[t]);var l=n&&$n.isCharacterBox(n),c,d;if(e){var h=Pn(e,r.havingStyle(s.sup()),r);d={elem:h,kern:Math.max(r.fontMetrics().bigOpSpacing1,r.fontMetrics().bigOpSpacing3-h.depth)}}if(n){var m=Pn(n,r.havingStyle(s.sub()),r);c={elem:m,kern:Math.max(r.fontMetrics().bigOpSpacing2,r.fontMetrics().bigOpSpacing4-m.height)}}var g;if(d&&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:Xe(-i)},{type:"kern",size:c.kern},{type:"elem",elem:t},{type:"kern",size:d.kern},{type:"elem",elem:d.elem,marginLeft:Xe(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:Xe(-i)},{type:"kern",size:c.kern},{type:"elem",elem:t}]},r)}else if(d){var w=t.depth+a;g=be.makeVList({positionType:"bottom",positionData:w,children:[{type:"elem",elem:t},{type:"kern",size:d.kern},{type:"elem",elem:d.elem,marginLeft:Xe(i)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]},r)}else return t;var S=[g];if(c&&i!==0&&!l){var k=be.makeSpan(["mspace"],[],r);k.style.marginRight=Xe(i),S.unshift(k)}return be.makeSpan(["mop","op-limits"],S,r)},RU=["\\smallint"],$f=(t,e)=>{var n,r,s=!1,i;t.type==="supsub"?(n=t.sup,r=t.sub,i=en(t.base,"op"),s=!0):i=en(t,"op");var a=e.style,l=!1;a.size===Et.DISPLAY.size&&i.symbol&&!RU.includes(i.name)&&(l=!0);var c;if(i.symbol){var d=l?"Size2-Regular":"Size1-Regular",h="";if((i.name==="\\oiint"||i.name==="\\oiiint")&&(h=i.name.slice(1),i.name=h==="oiint"?"\\iint":"\\iiint"),c=be.makeSymbol(i.name,d,"math",e,["mop","op-symbol",l?"large-op":"small-op"]),h.length>0){var m=c.italic,g=be.staticSvg(h+"Size"+(l?"2":"1"),e);c=be.makeVList({positionType:"individualShift",children:[{type:"elem",elem:c,shift:0},{type:"elem",elem:g,shift:l?.08:0}]},e),i.name="\\"+h,c.classes.unshift("mop"),c.italic=m}}else if(i.body){var x=fs(i.body,e,!0);x.length===1&&x[0]instanceof Aa?(c=x[0],c.classes[0]="mop"):c=be.makeSpan(["mop"],x,e)}else{for(var y=[],w=1;w<i.name.length;w++)y.push(be.mathsym(i.name[w],i.mode,e));c=be.makeSpan(["mop"],y,e)}var S=0,k=0;return(c instanceof Aa||i.name==="\\oiint"||i.name==="\\oiiint")&&!i.suppressBaseShift&&(S=(c.height-c.depth)/2-e.fontMetrics().axisHeight,k=c.italic),s?MU(c,n,r,e,a,k,S):(S&&(c.style.position="relative",c.style.top=Xe(S)),c)},gg=(t,e)=>{var n;if(t.symbol)n=new Qi("mo",[Ma(t.name,t.mode)]),RU.includes(t.name)&&n.setAttribute("largeop","false");else if(t.body)n=new Qi("mo",_i(t.body,e));else{n=new Qi("mi",[new Ao(t.name.slice(1))]);var r=new Qi("mo",[Ma("","text")]);t.parentIsSupSub?n=new Qi("mrow",[n,r]):n=oU([n,r])}return n},ike={"∏":"\\prod","∐":"\\coprod","∑":"\\sum","⋀":"\\bigwedge","":"\\bigvee","⋂":"\\bigcap","":"\\bigcup","⨀":"\\bigodot","⨁":"\\bigoplus","⨂":"\\bigotimes","⨄":"\\biguplus","⨆":"\\bigsqcup"};tt({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=ike[s]),{type:"op",mode:n.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:s}},htmlBuilder:$f,mathmlBuilder:gg});tt({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:Qr(r)}},htmlBuilder:$f,mathmlBuilder:gg});var ake={"∫":"\\int","∬":"\\iint","∭":"\\iiint","∮":"\\oint","∯":"\\oiint","∰":"\\oiiint"};tt({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:$f,mathmlBuilder:gg});tt({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:$f,mathmlBuilder:gg});tt({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=ake[r]),{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:r}},htmlBuilder:$f,mathmlBuilder:gg});var DU=(t,e)=>{var n,r,s=!1,i;t.type==="supsub"?(n=t.sup,r=t.sub,i=en(t.base,"operatorname"),s=!0):i=en(t,"operatorname");var a;if(i.body.length>0){for(var l=i.body.map(m=>{var g=m.text;return typeof g=="string"?{type:"textord",mode:m.mode,text:g}:m}),c=fs(l,e.withFont("mathrm"),!0),d=0;d<c.length;d++){var h=c[d];h instanceof Aa&&(h.text=h.text.replace(/\u2212/,"-").replace(/\u2217/,"*"))}a=be.makeSpan(["mop"],c,e)}else a=be.makeSpan(["mop"],[],e);return s?MU(a,n,r,e,e.style,0,0):a},oke=(t,e)=>{for(var n=_i(t.body,e.withFont("mathrm")),r=!0,s=0;s<n.length;s++){var i=n[s];if(!(i instanceof qe.SpaceNode))if(i instanceof qe.MathNode)switch(i.type){case"mi":case"mn":case"ms":case"mspace":case"mtext":break;case"mo":{var a=i.children[0];i.children.length===1&&a instanceof qe.TextNode?a.text=a.text.replace(/\u2212/,"-").replace(/\u2217/,"*"):r=!1;break}default:r=!1}else r=!1}if(r){var l=n.map(h=>h.toText()).join("");n=[new qe.TextNode(l)]}var c=new qe.MathNode("mi",n);c.setAttribute("mathvariant","normal");var d=new qe.MathNode("mo",[Ma("","text")]);return t.parentIsSupSub?new qe.MathNode("mrow",[c,d]):qe.newDocumentFragment([c,d])};tt({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:Qr(s),alwaysHandleSupSub:r==="\\operatornamewithlimits",limits:!1,parentIsSupSub:!1}},htmlBuilder:DU,mathmlBuilder:oke});Z("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@");Sd({type:"ordgroup",htmlBuilder(t,e){return t.semisimple?be.makeFragment(fs(t.body,e,!1)):be.makeSpan(["mord"],fs(t.body,e,!0),e)},mathmlBuilder(t,e){return nu(t.body,e,!0)}});tt({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=Pn(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 qe.MathNode("mo",[new qe.TextNode("‾")]);n.setAttribute("stretchy","true");var r=new qe.MathNode("mover",[lr(t.body,e),n]);return r.setAttribute("accent","true"),r}});tt({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:Qr(r)}},htmlBuilder:(t,e)=>{var n=fs(t.body,e.withPhantom(),!1);return be.makeFragment(n)},mathmlBuilder:(t,e)=>{var n=_i(t.body,e);return new qe.MathNode("mphantom",n)}});tt({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([],[Pn(t.body,e.withPhantom())]);if(n.height=0,n.depth=0,n.children)for(var r=0;r<n.children.length;r++)n.children[r].height=0,n.children[r].depth=0;return n=be.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:n}]},e),be.makeSpan(["mord"],[n],e)},mathmlBuilder:(t,e)=>{var n=_i(Qr(t.body),e),r=new qe.MathNode("mphantom",n),s=new qe.MathNode("mpadded",[r]);return s.setAttribute("height","0px"),s.setAttribute("depth","0px"),s}});tt({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"],[Pn(t.body,e.withPhantom())]),r=be.makeSpan(["fix"],[]);return be.makeSpan(["mord","rlap"],[n,r],e)},mathmlBuilder:(t,e)=>{var n=_i(Qr(t.body),e),r=new qe.MathNode("mphantom",n),s=new qe.MathNode("mpadded",[r]);return s.setAttribute("width","0px"),s}});tt({type:"raisebox",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:!0},handler(t,e){var{parser:n}=t,r=en(e[0],"size").value,s=e[1];return{type:"raisebox",mode:n.mode,dy:r,body:s}},htmlBuilder(t,e){var n=Pn(t.body,e),r=Rr(t.dy,e);return be.makeVList({positionType:"shift",positionData:-r,children:[{type:"elem",elem:n}]},e)},mathmlBuilder(t,e){var n=new qe.MathNode("mpadded",[lr(t.body,e)]),r=t.dy.number+t.dy.unit;return n.setAttribute("voffset",r),n}});tt({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0,allowedInArgument:!0},handler(t){var{parser:e}=t;return{type:"internal",mode:e.mode}}});tt({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=en(e[0],"size"),a=en(e[1],"size");return{type:"rule",mode:r.mode,shift:s&&en(s,"size").value,width:i.value,height:a.value}},htmlBuilder(t,e){var n=be.makeSpan(["mord","rule"],[],e),r=Rr(t.width,e),s=Rr(t.height,e),i=t.shift?Rr(t.shift,e):0;return n.style.borderRightWidth=Xe(r),n.style.borderTopWidth=Xe(s),n.style.bottom=Xe(i),n.width=r,n.height=s+i,n.depth=-i,n.maxFontSize=s*1.125*e.sizeMultiplier,n},mathmlBuilder(t,e){var n=Rr(t.width,e),r=Rr(t.height,e),s=t.shift?Rr(t.shift,e):0,i=e.color&&e.getColor()||"black",a=new qe.MathNode("mspace");a.setAttribute("mathbackground",i),a.setAttribute("width",Xe(n)),a.setAttribute("height",Xe(r));var l=new qe.MathNode("mpadded",[a]);return s>=0?l.setAttribute("height",Xe(s)):(l.setAttribute("height",Xe(s)),l.setAttribute("depth",Xe(-s))),l.setAttribute("voffset",Xe(s)),l}});function PU(t,e,n){for(var r=fs(t,e,!1),s=e.sizeMultiplier/n.sizeMultiplier,i=0;i<r.length;i++){var a=r[i].classes.indexOf("sizing");a<0?Array.prototype.push.apply(r[i].classes,e.sizingClasses(n)):r[i].classes[a+1]==="reset-size"+e.size&&(r[i].classes[a+1]="reset-size"+n.size),r[i].height*=s,r[i].depth*=s}return be.makeFragment(r)}var MR=["\\tiny","\\sixptsize","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"],lke=(t,e)=>{var n=e.havingSize(t.size);return PU(t.body,n,e)};tt({type:"sizing",names:MR,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:MR.indexOf(r)+1,body:i}},htmlBuilder:lke,mathmlBuilder:(t,e)=>{var n=e.havingSize(t.size),r=_i(t.body,n),s=new qe.MathNode("mstyle",r);return s.setAttribute("mathsize",Xe(n.sizeMultiplier)),s}});tt({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]&&en(n[0],"ordgroup");if(a)for(var l="",c=0;c<a.body.length;++c){var d=a.body[c];if(l=d.text,l==="t")s=!0;else if(l==="b")i=!0;else{s=!1,i=!1;break}}else s=!0,i=!0;var h=e[0];return{type:"smash",mode:r.mode,body:h,smashHeight:s,smashDepth:i}},htmlBuilder:(t,e)=>{var n=be.makeSpan([],[Pn(t.body,e)]);if(!t.smashHeight&&!t.smashDepth)return n;if(t.smashHeight&&(n.height=0,n.children))for(var r=0;r<n.children.length;r++)n.children[r].height=0;if(t.smashDepth&&(n.depth=0,n.children))for(var s=0;s<n.children.length;s++)n.children[s].depth=0;var i=be.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:n}]},e);return be.makeSpan(["mord"],[i],e)},mathmlBuilder:(t,e)=>{var n=new qe.MathNode("mpadded",[lr(t.body,e)]);return t.smashHeight&&n.setAttribute("height","0px"),t.smashDepth&&n.setAttribute("depth","0px"),n}});tt({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=Pn(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.id<Et.TEXT.id&&(i=e.fontMetrics().xHeight);var a=s+i/4,l=n.height+n.depth+a+s,{span:c,ruleWidth:d,advanceWidth:h}=Bl.sqrtImage(l,e),m=c.height-d;m>n.height+n.depth+a&&(a=(a+m-n.height-n.depth)/2);var g=c.height-n.height-a-d;n.style.paddingLeft=Xe(h);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:d}]},e);if(t.index){var y=e.havingStyle(Et.SCRIPTSCRIPT),w=Pn(t.index,y,e),S=.6*(x.height-x.depth),k=be.makeVList({positionType:"shift",positionData:-S,children:[{type:"elem",elem:w}]},e),j=be.makeSpan(["root"],[k]);return be.makeSpan(["mord","sqrt"],[j,x],e)}else return be.makeSpan(["mord","sqrt"],[x],e)},mathmlBuilder(t,e){var{body:n,index:r}=t;return r?new qe.MathNode("mroot",[lr(n,e),lr(r,e)]):new qe.MathNode("msqrt",[lr(n,e)])}});var RR={display:Et.DISPLAY,text:Et.TEXT,script:Et.SCRIPT,scriptscript:Et.SCRIPTSCRIPT};tt({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=RR[t.style],r=e.havingStyle(n).withFont("");return PU(t.body,r,e)},mathmlBuilder(t,e){var n=RR[t.style],r=e.havingStyle(n),s=_i(t.body,r),i=new qe.MathNode("mstyle",s),a={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]},l=a[t.style];return i.setAttribute("scriptlevel",l[0]),i.setAttribute("displaystyle",l[1]),i}});var cke=function(e,n){var r=e.base;if(r)if(r.type==="op"){var s=r.limits&&(n.style.size===Et.DISPLAY.size||r.alwaysHandleSupSub);return s?$f:null}else if(r.type==="operatorname"){var i=r.alwaysHandleSupSub&&(n.style.size===Et.DISPLAY.size||r.limits);return i?DU:null}else{if(r.type==="accent")return $n.isCharacterBox(r.base)?MN:null;if(r.type==="horizBrace"){var a=!e.sub;return a===r.isOver?AU:null}else return null}else return null};Sd({type:"supsub",htmlBuilder(t,e){var n=cke(t,e);if(n)return n(t,e);var{base:r,sup:s,sub:i}=t,a=Pn(r,e),l,c,d=e.fontMetrics(),h=0,m=0,g=r&&$n.isCharacterBox(r);if(s){var x=e.havingStyle(e.style.sup());l=Pn(s,x,e),g||(h=a.height-x.fontMetrics().supDrop*x.sizeMultiplier/e.sizeMultiplier)}if(i){var y=e.havingStyle(e.style.sub());c=Pn(i,y,e),g||(m=a.depth+y.fontMetrics().subDrop*y.sizeMultiplier/e.sizeMultiplier)}var w;e.style===Et.DISPLAY?w=d.sup1:e.style.cramped?w=d.sup3:w=d.sup2;var S=e.sizeMultiplier,k=Xe(.5/d.ptPerEm/S),j=null;if(c){var N=t.base&&t.base.type==="op"&&t.base.name&&(t.base.name==="\\oiint"||t.base.name==="\\oiiint");(a instanceof Aa||N)&&(j=Xe(-a.italic))}var T;if(l&&c){h=Math.max(h,w,l.depth+.25*d.xHeight),m=Math.max(m,d.sub2);var E=d.defaultRuleThickness,_=4*E;if(h-l.depth-(c.height-m)<_){m=_-(h-l.depth)+c.height;var A=.8*d.xHeight-(h-l.depth);A>0&&(h+=A,m-=A)}var L=[{type:"elem",elem:c,shift:m,marginRight:k,marginLeft:j},{type:"elem",elem:l,shift:-h,marginRight:k}];T=be.makeVList({positionType:"individualShift",children:L},e)}else if(c){m=Math.max(m,d.sub1,c.height-.8*d.xHeight);var P=[{type:"elem",elem:c,marginLeft:j,marginRight:k}];T=be.makeVList({positionType:"shift",positionData:m,children:P},e)}else if(l)h=Math.max(h,w,l.depth+.25*d.xHeight),T=be.makeVList({positionType:"shift",positionData:-h,children:[{type:"elem",elem:l,marginRight:k}]},e);else throw new Error("supsub must have either sup or sub.");var B=$O(a,"right")||"mord";return be.makeSpan([B],[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=[lr(t.base,e)];t.sub&&i.push(lr(t.sub,e)),t.sup&&i.push(lr(t.sup,e));var a;if(n)a=r?"mover":"munder";else if(t.sub)if(t.sup){var d=t.base;d&&d.type==="op"&&d.limits&&e.style===Et.DISPLAY||d&&d.type==="operatorname"&&d.alwaysHandleSupSub&&(e.style===Et.DISPLAY||d.limits)?a="munderover":a="msubsup"}else{var c=t.base;c&&c.type==="op"&&c.limits&&(e.style===Et.DISPLAY||c.alwaysHandleSupSub)||c&&c.type==="operatorname"&&c.alwaysHandleSupSub&&(c.limits||e.style===Et.DISPLAY)?a="munder":a="msub"}else{var l=t.base;l&&l.type==="op"&&l.limits&&(e.style===Et.DISPLAY||l.alwaysHandleSupSub)||l&&l.type==="operatorname"&&l.alwaysHandleSupSub&&(l.limits||e.style===Et.DISPLAY)?a="mover":a="msup"}return new qe.MathNode(a,i)}});Sd({type:"atom",htmlBuilder(t,e){return be.mathsym(t.text,t.mode,e,["m"+t.family])},mathmlBuilder(t,e){var n=new qe.MathNode("mo",[Ma(t.text,t.mode)]);if(t.family==="bin"){var r=_N(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 zU={mi:"italic",mn:"normal",mtext:"normal"};Sd({type:"mathord",htmlBuilder(t,e){return be.makeOrd(t,e,"mathord")},mathmlBuilder(t,e){var n=new qe.MathNode("mi",[Ma(t.text,t.mode,e)]),r=_N(t,e)||"italic";return r!==zU[n.type]&&n.setAttribute("mathvariant",r),n}});Sd({type:"textord",htmlBuilder(t,e){return be.makeOrd(t,e,"textord")},mathmlBuilder(t,e){var n=Ma(t.text,t.mode,e),r=_N(t,e)||"normal",s;return t.mode==="text"?s=new qe.MathNode("mtext",[n]):/[0-9]/.test(t.text)?s=new qe.MathNode("mn",[n]):t.text==="\\prime"?s=new qe.MathNode("mo",[n]):s=new qe.MathNode("mi",[n]),r!==zU[s.type]&&s.setAttribute("mathvariant",r),s}});var r5={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},s5={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};Sd({type:"spacing",htmlBuilder(t,e){if(s5.hasOwnProperty(t.text)){var n=s5[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(r5.hasOwnProperty(t.text))return be.makeSpan(["mspace",r5[t.text]],[],e);throw new $e('Unknown type of space "'+t.text+'"')}},mathmlBuilder(t,e){var n;if(s5.hasOwnProperty(t.text))n=new qe.MathNode("mtext",[new qe.TextNode(" ")]);else{if(r5.hasOwnProperty(t.text))return new qe.MathNode("mspace");throw new $e('Unknown type of space "'+t.text+'"')}return n}});var DR=()=>{var t=new qe.MathNode("mtd",[]);return t.setAttribute("width","50%"),t};Sd({type:"tag",mathmlBuilder(t,e){var n=new qe.MathNode("mtable",[new qe.MathNode("mtr",[DR(),new qe.MathNode("mtd",[nu(t.body,e)]),DR(),new qe.MathNode("mtd",[nu(t.tag,e)])])]);return n.setAttribute("width","100%"),n}});var PR={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},zR={"\\textbf":"textbf","\\textmd":"textmd"},uke={"\\textit":"textit","\\textup":"textup"},IR=(t,e)=>{var n=t.font;if(n){if(PR[n])return e.withTextFontFamily(PR[n]);if(zR[n])return e.withTextFontWeight(zR[n]);if(n==="\\emph")return e.fontShape==="textit"?e.withTextFontShape("textup"):e.withTextFontShape("textit")}else return e;return e.withTextFontShape(uke[n])};tt({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:Qr(s),font:r}},htmlBuilder(t,e){var n=IR(t,e),r=fs(t.body,n,!0);return be.makeSpan(["mord","text"],r,n)},mathmlBuilder(t,e){var n=IR(t,e);return nu(t.body,n)}});tt({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=Pn(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 qe.MathNode("mo",[new qe.TextNode("‾")]);n.setAttribute("stretchy","true");var r=new qe.MathNode("munder",[lr(t.body,e),n]);return r.setAttribute("accentunder","true"),r}});tt({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=Pn(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 qe.MathNode("mpadded",[lr(t.body,e)],["vcenter"])}});tt({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=LR(t),r=[],s=e.havingStyle(e.style.text()),i=0;i<n.length;i++){var a=n[i];a==="~"&&(a="\\textasciitilde"),r.push(be.makeSymbol(a,"Typewriter-Regular",t.mode,s,["mord","texttt"]))}return be.makeSpan(["mord","text"].concat(s.sizingClasses(e)),be.tryCombineChars(r),s)},mathmlBuilder(t,e){var n=new qe.TextNode(LR(t)),r=new qe.MathNode("mtext",[n]);return r.setAttribute("mathvariant","monospace"),r}});var LR=t=>t.body.replace(/ /g,t.star?"␣":" "),qc=iU,IU=`[ \r
]`,dke="\\\\[a-zA-Z@]+",hke="\\\\[^\uD800-\uDFFF]",fke="("+dke+")"+IU+"*",mke=`\\\\(
|[ \r ]+
?)[ \r ]*`,UO="[̀-ͯ]",pke=new RegExp(UO+"+$"),gke="("+IU+"+)|"+(mke+"|")+"([!-\\[\\]-‧‪-퟿豈-￿]"+(UO+"*")+"|[\uD800-\uDBFF][\uDC00-\uDFFF]"+(UO+"*")+"|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5"+("|"+fke)+("|"+hke+")");class BR{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(gke,"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 Xi("EOF",new pi(this,n,n));var r=this.tokenRegex.exec(e);if(r===null||r.index!==n)throw new $e("Unexpected character: '"+e[n]+"'",new Xi(e[n],new pi(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 Xi(s,new pi(this,n,this.tokenRegex.lastIndex))}}class xke{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 $e("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;s<this.undefStack.length;s++)delete this.undefStack[s][e];this.undefStack.length>0&&(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 vke=NU;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 FR={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=FR[e.text],r==null||r>=n)throw new $e("Invalid base-"+n+" digit "+e.text);for(var s;(s=FR[t.future().text])!=null&&s<n;)r*=n,r+=s,t.popToken()}return"\\@char{"+r+"}"});var FN=(t,e,n,r)=>{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 l=0;if(s=t.consumeArg().tokens,s.length===1&&s[0].text==="["){for(var c="",d=t.expandNextToken();d.text!=="]"&&d.text!=="EOF";)c+=d.text,d=t.expandNextToken();if(!c.match(/^\s*[0-9]+\s*$/))throw new $e("Invalid number of arguments: "+c);l=parseInt(c),s=t.consumeArg().tokens}return a&&r||t.macros.set(i,{tokens:s,numArgs:l}),""};Z("\\newcommand",t=>FN(t,!1,!0,!1));Z("\\renewcommand",t=>FN(t,!0,!1,!1));Z("\\providecommand",t=>FN(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),qc[n],dr.math[n],dr.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 qR={",":"\\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 qR?e=qR[n]:(n.slice(0,4)==="\\not"||n in dr.math&&["bin","rel"].includes(dr.math[n].group))&&(e="\\dotsb"),e});var qN={")":!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 qN?"\\ldots\\,":"\\ldots"});Z("\\dotsc",function(t){var e=t.future().text;return e in qN&&e!==","?"\\ldots\\,":"\\ldots"});Z("\\cdots",function(t){var e=t.future().text;return e in qN?"\\@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 LU=Xe(_o["Main-Regular"][84][1]-.7*_o["Main-Regular"][65][1]);Z("\\LaTeX","\\textrm{\\html@mathml{"+("L\\kern-.36em\\raisebox{"+LU+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{LaTeX}}");Z("\\KaTeX","\\textrm{\\html@mathml{"+("K\\kern-.17em\\raisebox{"+LU+"}{\\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 BU=t=>e=>{var n=e.consumeArg().tokens,r=e.consumeArg().tokens,s=e.consumeArg().tokens,i=e.consumeArg().tokens,a=e.macros.get("|"),l=e.macros.get("\\|");e.macros.beginGroup();var c=m=>g=>{t&&(g.macros.set("|",a),s.length&&g.macros.set("\\|",l));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 d=e.consumeArg().tokens,h=e.expandTokens([...i,...d,...n]);return e.macros.endGroup(),{tokens:h.reverse(),numArgs:0}};Z("\\bra@ket",BU(!1));Z("\\bra@set",BU(!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 FU={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0};class yke{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 xke(vke,n.macros),this.mode=r,this.stack=[]}feed(e){this.lexer=new BR(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 Xi("EOF",r.loc)),this.pushTokens(s),new Xi("",pi.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,l=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[l]:"}")+"'",i);if(e&&r)if((a===0||a===1&&e[l]==="{")&&i.text===e[l]){if(++l,l===e.length){n.splice(-l,l);break}}else l=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;s<r.length;s++){var i=this.popToken();if(r[s]!==i.text)throw new $e("Use of the macro doesn't match its definition",i)}}for(var a=[],l=0;l<e;l++)a.push(this.consumeArg(n&&n[l+1]).tokens);return a}countExpansion(e){if(this.expansionCount+=e,this.expansionCount>this.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 l=i.length-1;l>=0;--l){var c=i[l];if(c.text==="#"){if(l===0)throw new $e("Incomplete placeholder at end of macro body",c);if(c=i[--l],c.text==="#")i.splice(l+1,1);else if(/^[1-9]$/.test(c.text))i.splice(l,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 Xi(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 l=new BR(s,this.settings),c=[],d=l.lex();d.text!=="EOF";)c.push(d),d=l.lex();c.reverse();var h={tokens:c,numArgs:i};return h}return s}isDefined(e){return this.macros.has(e)||qc.hasOwnProperty(e)||dr.math.hasOwnProperty(e)||dr.text.hasOwnProperty(e)||FU.hasOwnProperty(e)}isExpandable(e){var n=this.macros.get(e);return n!=null?typeof n=="string"||typeof n=="function"||!n.unexpandable:qc.hasOwnProperty(e)&&!qc[e].primitive}}var $R=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,B1=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","ᵝ":"β","ᵞ":"γ","ᵟ":"δ","ᵠ":"ϕ","ᵡ":"χ","ᶿ":"θ"}),i5={"́":{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"}},HR={á:"á",à:"à",ä:"ä",ǟ:"ǟ",ã:"ã",ā:"ā",ă:"ă",ắ:"ắ",ằ:"ằ",ẵ:"ẵ",ǎ:"ǎ",â:"â",ấ:"ấ",ầ:"ầ",ẫ:"ẫ",ȧ:"ȧ",ǡ:"ǡ",å:"å",ǻ:"ǻ",ḃ:"ḃ",ć:"ć",ḉ:"ḉ",č:"č",ĉ:"ĉ",ċ:"ċ",ç:"ç",ď:"ď",ḋ:"ḋ",ḑ:"ḑ",é:"é",è:"è",ë:"ë",ẽ:"ẽ",ē:"ē",ḗ:"ḗ",ḕ:"ḕ",ĕ:"ĕ",ḝ:"ḝ",ě:"ě",ê:"ê",ế:"ế",ề:"ề",ễ:"ễ",ė:"ė",ȩ:"ȩ",ḟ:"ḟ",ǵ:"ǵ",ḡ:"ḡ",ğ:"ğ",ǧ:"ǧ",ĝ:"ĝ",ġ:"ġ",ģ:"ģ",ḧ:"ḧ",ȟ:"ȟ",ĥ:"ĥ",ḣ:"ḣ",ḩ:"ḩ",í:"í",ì:"ì",ï:"ï",ḯ:"ḯ",ĩ:"ĩ",ī:"ī",ĭ:"ĭ",ǐ:"ǐ",î:"î",ǰ:"ǰ",ĵ:"ĵ",ḱ:"ḱ",ǩ:"ǩ",ķ:"ķ",ĺ:"ĺ",ľ:"ľ",ļ:"ļ",ḿ:"ḿ",ṁ:"ṁ",ń:"ń",ǹ:"ǹ",ñ:"ñ",ň:"ň",ṅ:"ṅ",ņ:"ņ",ó:"ó",ò:"ò",ö:"ö",ȫ:"ȫ",õ:"õ",ṍ:"ṍ",ṏ:"ṏ",ȭ:"ȭ",ō:"ō",ṓ:"ṓ",ṑ:"ṑ",ŏ:"ŏ",ǒ:"ǒ",ô:"ô",ố:"ố",ồ:"ồ",ỗ:"ỗ",ȯ:"ȯ",ȱ:"ȱ",ő:"ő",ṕ:"ṕ",ṗ:"ṗ",ŕ:"ŕ",ř:"ř",ṙ:"ṙ",ŗ:"ŗ",ś:"ś",ṥ:"ṥ",š:"š",ṧ:"ṧ",ŝ:"ŝ",ṡ:"ṡ",ş:"ş",ẗ:"ẗ",ť:"ť",ṫ:"ṫ",ţ:"ţ",ú:"ú",ù:"ù",ü:"ü",ǘ:"ǘ",ǜ:"ǜ",ǖ:"ǖ",ǚ:"ǚ",ũ:"ũ",ṹ:"ṹ",ū:"ū",ṻ:"ṻ",ŭ:"ŭ",ǔ:"ǔ",û:"û",ů:"ů",ű:"ű",ṽ:"ṽ",ẃ:"ẃ",ẁ:"ẁ",ẅ:"ẅ",ŵ:"ŵ",ẇ:"ẇ",ẘ:"ẘ",ẍ:"ẍ",ẋ:"ẋ",ý:"ý",ỳ:"ỳ",ÿ:"ÿ",ỹ:"ỹ",ȳ:"ȳ",ŷ:"ŷ",ẏ:"ẏ",ẙ:"ẙ",ź:"ź",ž:"ž",ẑ:"ẑ",ż:"ż",Á:"Á",À:"À",Ä:"Ä",Ǟ:"Ǟ",Ã:"Ã",Ā:"Ā",Ă:"Ă",Ắ:"Ắ",Ằ:"Ằ",Ẵ:"Ẵ",Ǎ:"Ǎ",Â:"Â",Ấ:"Ấ",Ầ:"Ầ",Ẫ:"Ẫ",Ȧ:"Ȧ",Ǡ:"Ǡ",Å:"Å",Ǻ:"Ǻ",Ḃ:"Ḃ",Ć:"Ć",Ḉ:"Ḉ",Č:"Č",Ĉ:"Ĉ",Ċ:"Ċ",Ç:"Ç",Ď:"Ď",Ḋ:"Ḋ",Ḑ:"Ḑ",É:"É",È:"È",Ë:"Ë",Ẽ:"Ẽ",Ē:"Ē",Ḗ:"Ḗ",Ḕ:"Ḕ",Ĕ:"Ĕ",Ḝ:"Ḝ",Ě:"Ě",Ê:"Ê",Ế:"Ế",Ề:"Ề",Ễ:"Ễ",Ė:"Ė",Ȩ:"Ȩ",Ḟ:"Ḟ",Ǵ:"Ǵ",Ḡ:"Ḡ",Ğ:"Ğ",Ǧ:"Ǧ",Ĝ:"Ĝ",Ġ:"Ġ",Ģ:"Ģ",Ḧ:"Ḧ",Ȟ:"Ȟ",Ĥ:"Ĥ",Ḣ:"Ḣ",Ḩ:"Ḩ",Í:"Í",Ì:"Ì",Ï:"Ï",Ḯ:"Ḯ",Ĩ:"Ĩ",Ī:"Ī",Ĭ:"Ĭ",Ǐ:"Ǐ",Î:"Î",İ:"İ",Ĵ:"Ĵ",Ḱ:"Ḱ",Ǩ:"Ǩ",Ķ:"Ķ",Ĺ:"Ĺ",Ľ:"Ľ",Ļ:"Ļ",Ḿ:"Ḿ",Ṁ:"Ṁ",Ń:"Ń",Ǹ:"Ǹ",Ñ:"Ñ",Ň:"Ň",Ṅ:"Ṅ",Ņ:"Ņ",Ó:"Ó",Ò:"Ò",Ö:"Ö",Ȫ:"Ȫ",Õ:"Õ",Ṍ:"Ṍ",Ṏ:"Ṏ",Ȭ:"Ȭ",Ō:"Ō",Ṓ:"Ṓ",Ṑ:"Ṑ",Ŏ:"Ŏ",Ǒ:"Ǒ",Ô:"Ô",Ố:"Ố",Ồ:"Ồ",Ỗ:"Ỗ",Ȯ:"Ȯ",Ȱ:"Ȱ",Ő:"Ő",Ṕ:"Ṕ",Ṗ:"Ṗ",Ŕ:"Ŕ",Ř:"Ř",Ṙ:"Ṙ",Ŗ:"Ŗ",Ś:"Ś",Ṥ:"Ṥ",Š:"Š",Ṧ:"Ṧ",Ŝ:"Ŝ",Ṡ:"Ṡ",Ş:"Ş",Ť:"Ť",Ṫ:"Ṫ",Ţ:"Ţ",Ú:"Ú",Ù:"Ù",Ü:"Ü",Ǘ:"Ǘ",Ǜ:"Ǜ",Ǖ:"Ǖ",Ǚ:"Ǚ",Ũ:"Ũ",Ṹ:"Ṹ",Ū:"Ū",Ṻ:"Ṻ",Ŭ:"Ŭ",Ǔ:"Ǔ",Û:"Û",Ů:"Ů",Ű:"Ű",Ṽ:"Ṽ",Ẃ:"Ẃ",Ẁ:"Ẁ",Ẅ:"Ẅ",Ŵ:"Ŵ",Ẇ:"Ẇ",Ẍ:"Ẍ",Ẋ:"Ẋ",Ý:"Ý",Ỳ:"Ỳ",Ÿ:"Ÿ",Ỹ:"Ỹ",Ȳ:"Ȳ",Ŷ:"Ŷ",Ẏ:"Ẏ",Ź:"Ź",Ž:"Ž",Ẑ:"Ẑ",Ż:"Ż",ά:"ά",ὰ:"ὰ",ᾱ:"ᾱ",ᾰ:"ᾰ",έ:"έ",ὲ:"ὲ",ή:"ή",ὴ:"ὴ",ί:"ί",ὶ:"ὶ",ϊ:"ϊ",ΐ:"ΐ",ῒ:"ῒ",ῑ:"ῑ",ῐ:"ῐ",ό:"ό",ὸ:"ὸ",ύ:"ύ",ὺ:"ὺ",ϋ:"ϋ",ΰ:"ΰ",ῢ:"ῢ",ῡ:"ῡ",ῠ:"ῠ",ώ:"ώ",ὼ:"ὼ",Ύ:"Ύ",Ὺ:"Ὺ",Ϋ:"Ϋ",Ῡ:"Ῡ",Ῠ:"Ῠ",Ώ:"Ώ",Ὼ:"Ὼ"};class Wb{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 yke(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 Xi("}")),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(Wb.endOfExpression.indexOf(s.text)!==-1||n&&s.text===n||e&&qc[s.text]&&qc[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<e.length;s++)if(e[s].type==="infix"){if(n!==-1)throw new $e("only one infix operator per group",e[s].token);n=s,r=e[s].replaceWith}if(n!==-1&&r){var i,a,l=e.slice(0,n),c=e.slice(n+1);l.length===1&&l[0].type==="ordgroup"?i=l[0]:i={type:"ordgroup",mode:this.mode,body:l},c.length===1&&c[0].type==="ordgroup"?a=c[0]:a={type:"ordgroup",mode:this.mode,body:c};var d;return r==="\\\\abovefrac"?d=this.callFunction(r,[i,e[n],a],[]):d=this.callFunction(r,[i,a],[]),[d]}else return e}handleSupSubscript(e){var n=this.fetch(),r=n.text;this.consume(),this.consumeSpaces();var s;do{var i;s=this.parseGroup(e)}while(((i=s)==null?void 0:i.type)==="internal");if(!s)throw new $e("Expected group after '"+r+"'",n);return s}formatUnsupportedCmd(e){for(var n=[],r=0;r<e.length;r++)n.push({type:"textord",mode:"text",text:e[r]});var s={type:"text",mode:this.mode,body:n},i={type:"color",mode:this.mode,color:this.settings.errorColor,body:[s]};return i}parseAtom(e){var n=this.parseGroup("atom",e);if(n?.type==="internal"||this.mode==="text")return n;for(var r,s;;){this.consumeSpaces();var i=this.fetch();if(i.text==="\\limits"||i.text==="\\nolimits"){if(n&&n.type==="op"){var a=i.text==="\\limits";n.limits=a,n.alwaysHandleSupSub=!0}else if(n&&n.type==="operatorname")n.alwaysHandleSupSub&&(n.limits=i.text==="\\limits");else throw new $e("Limit controls must follow a math operator",i);this.consume()}else if(i.text==="^"){if(r)throw new $e("Double superscript",i);r=this.handleSupSubscript("superscript")}else if(i.text==="_"){if(s)throw new $e("Double subscript",i);s=this.handleSupSubscript("subscript")}else if(i.text==="'"){if(r)throw new $e("Double superscript",i);var l={type:"textord",mode:this.mode,text:"\\prime"},c=[l];for(this.consume();this.fetch().text==="'";)c.push(l),this.consume();this.fetch().text==="^"&&c.push(this.handleSupSubscript("superscript")),r={type:"ordgroup",mode:this.mode,body:c}}else if(B1[i.text]){var d=$R.test(i.text),h=[];for(h.push(new Xi(B1[i.text])),this.consume();;){var m=this.fetch().text;if(!B1[m]||$R.test(m)!==d)break;h.unshift(new Xi(B1[m])),this.consume()}var g=this.subparse(h);d?s={type:"ordgroup",mode:"math",body:g}:r={type:"ordgroup",mode:"math",body:g}}else break}return r||s?{type:"supsub",mode:this.mode,base:n,sup:r,sub:s}:n}parseFunction(e,n){var r=this.fetch(),s=r.text,i=qc[s];if(!i)return null;if(this.consume(),n&&n!=="atom"&&!i.allowedInArgument)throw new $e("Got function '"+s+"' with no arguments"+(n?" as "+n:""),r);if(this.mode==="text"&&!i.allowedInText)throw new $e("Can't use function '"+s+"' in text mode",r);if(this.mode==="math"&&i.allowedInMath===!1)throw new $e("Can't use function '"+s+"' in math mode",r);var{args:a,optArgs:l}=this.parseArguments(s,i);return this.callFunction(s,a,l,r,e)}callFunction(e,n,r,s,i){var a={funcName:e,parser:this,token:s,breakOnTokenText:i},l=qc[e];if(l&&l.handler)return l.handler(a,n,r);throw new $e("No function handler for "+e)}parseArguments(e,n){var r=n.numArgs+n.numOptionalArgs;if(r===0)return{args:[],optArgs:[]};for(var s=[],i=[],a=0;a<r;a++){var l=n.argTypes&&n.argTypes[a],c=a<n.numOptionalArgs;(n.primitive&&l==null||n.type==="sqrt"&&a===1&&i[0]==null)&&(l="primitive");var d=this.parseGroupOfType("argument to '"+e+"'",l,c);if(c)i.push(d);else if(d!=null)s.push(d);else throw new $e("Null argument, please report this as a bug")}return{args:s,optArgs:i}}parseGroupOfType(e,n,r){switch(n){case"color":return this.parseColorGroup(r);case"size":return this.parseSizeGroup(r);case"url":return this.parseUrlGroup(r);case"math":case"text":return this.parseArgumentGroup(r,n);case"hbox":{var s=this.parseArgumentGroup(r,"text");return s!=null?{type:"styling",mode:s.mode,body:[s],style:"text"}:null}case"raw":{var i=this.parseStringGroup("raw",r);return i!=null?{type:"raw",mode:"text",string:i.text}:null}case"primitive":{if(r)throw new $e("A primitive argument cannot be optional");var a=this.parseGroup(e);if(a==null)throw new $e("Expected group as "+e,this.fetch());return a}case"original":case null:case void 0:return this.parseArgumentGroup(r);default:throw new $e("Unknown group type as "+e,this.fetch())}}consumeSpaces(){for(;this.fetch().text===" ";)this.consume()}parseStringGroup(e,n){var r=this.gullet.scanArgument(n);if(r==null)return null;for(var s="",i;(i=this.fetch()).text!=="EOF";)s+=i.text,this.consume();return this.consume(),r.text=s,r}parseRegexGroup(e,n){for(var r=this.fetch(),s=r,i="",a;(a=this.fetch()).text!=="EOF"&&e.test(i+a.text);)s=a,i+=s.text,this.consume();if(i==="")throw new $e("Invalid "+n+": '"+r.text+"'",r);return r.range(s,i)}parseColorGroup(e){var n=this.parseStringGroup("color",e);if(n==null)return null;var r=/^(#[a-f0-9]{3,4}|#[a-f0-9]{6}|#[a-f0-9]{8}|[a-f0-9]{6}|[a-z]+)$/i.exec(n.text);if(!r)throw new $e("Invalid color: '"+n.text+"'",n);var s=r[0];return/^[0-9a-f]{6}$/i.test(s)&&(s="#"+s),{type:"color-token",mode:this.mode,color:s}}parseSizeGroup(e){var n,r=!1;if(this.gullet.consumeSpaces(),!e&&this.gullet.future().text!=="{"?n=this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/,"size"):n=this.parseStringGroup("size",e),!n)return null;!e&&n.text.length===0&&(n.text="0pt",r=!0);var s=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(n.text);if(!s)throw new $e("Invalid size: '"+n.text+"'",n);var i={number:+(s[1]+s[2]),unit:s[3]};if(!YV(i))throw new $e("Invalid unit: '"+i.unit+"'",n);return{type:"size",mode:this.mode,value:i,isBlank:r}}parseUrlGroup(e){this.gullet.lexer.setCatcode("%",13),this.gullet.lexer.setCatcode("~",12);var n=this.parseStringGroup("url",e);if(this.gullet.lexer.setCatcode("%",14),this.gullet.lexer.setCatcode("~",13),n==null)return null;var r=n.text.replace(/\\([#$%&~_^{}])/g,"$1");return{type:"url",mode:this.mode,url:r}}parseArgumentGroup(e,n){var r=this.gullet.scanArgument(e);if(r==null)return null;var s=this.mode;n&&this.switchMode(n),this.gullet.beginGroup();var i=this.parseExpression(!1,"EOF");this.expect("EOF"),this.gullet.endGroup();var a={type:"ordgroup",mode:this.mode,loc:r.loc,body:i};return n&&this.switchMode(s),a}parseGroup(e,n){var r=this.fetch(),s=r.text,i;if(s==="{"||s==="\\begingroup"){this.consume();var a=s==="{"?"}":"\\endgroup";this.gullet.beginGroup();var l=this.parseExpression(!1,a),c=this.fetch();this.expect(a),this.gullet.endGroup(),i={type:"ordgroup",mode:this.mode,loc:pi.range(r,c),body:l,semisimple:s==="\\begingroup"||void 0}}else if(i=this.parseFunction(n,e)||this.parseSymbol(),i==null&&s[0]==="\\"&&!FU.hasOwnProperty(s)){if(this.settings.throwOnError)throw new $e("Undefined control sequence: "+s,r);i=this.formatUnsupportedCmd(s),this.consume()}return i}formLigatures(e){for(var n=e.length-1,r=0;r<n;++r){var s=e[r],i=s.text;i==="-"&&e[r+1].text==="-"&&(r+1<n&&e[r+2].text==="-"?(e.splice(r,3,{type:"textord",mode:"text",loc:pi.range(s,e[r+2]),text:"---"}),n-=2):(e.splice(r,2,{type:"textord",mode:"text",loc:pi.range(s,e[r+1]),text:"--"}),n-=1)),(i==="'"||i==="`")&&e[r+1].text===i&&(e.splice(r,2,{type:"textord",mode:"text",loc:pi.range(s,e[r+1]),text:i+i}),n-=1)}}parseSymbol(){var e=this.fetch(),n=e.text;if(/^\\verb[^a-zA-Z]/.test(n)){this.consume();var r=n.slice(5),s=r.charAt(0)==="*";if(s&&(r=r.slice(1)),r.length<2||r.charAt(0)!==r.slice(-1))throw new $e(`\\verb assertion failed --
please report what input caused this bug`);return r=r.slice(1,-1),{type:"verb",mode:"text",body:r,star:s}}HR.hasOwnProperty(n[0])&&!dr[this.mode][n[0]]&&(this.settings.strict&&this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Accented Unicode text character "'+n[0]+'" used in math mode',e),n=HR[n[0]]+n.slice(1));var i=pke.exec(n);i&&(n=n.substring(0,i.index),n==="i"?n="ı":n==="j"&&(n="ȷ"));var a;if(dr[this.mode][n]){this.settings.strict&&this.mode==="math"&&qO.indexOf(n)>=0&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+n[0]+'" used in math mode',e);var l=dr[this.mode][n].group,c=pi.range(e),d;if(o3e.hasOwnProperty(l)){var h=l;d={type:"atom",mode:this.mode,family:h,loc:c,text:n}}else d={type:l,mode:this.mode,loc:c,text:n};a=d}else if(n.charCodeAt(0)>=128)this.settings.strict&&(XV(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:pi.range(e),text:n};else return null;if(this.consume(),i)for(var m=0;m<i[0].length;m++){var g=i[0][m];if(!i5[g])throw new $e("Unknown accent ' "+g+"'",e);var x=i5[g][this.mode]||i5[g].text;if(!x)throw new $e("Accent "+g+" unsupported in "+this.mode+" mode",e);a={type:"accent",mode:this.mode,loc:pi.range(e),label:x,isStretchy:!1,isShifty:!0,base:a}}return a}}Wb.endOfExpression=["}","\\endgroup","\\end","\\right","&"];var $N=function(e,n){if(!(typeof e=="string"||e instanceof String))throw new TypeError("KaTeX can only parse string typed expression");var r=new Wb(e,n);delete r.gullet.macros.current["\\df@tag"];var s=r.parse();if(delete r.gullet.macros.current["\\current@color"],delete r.gullet.macros.current["\\color"],r.gullet.macros.get("\\df@tag")){if(!n.displayMode)throw new $e("\\tag works only in display equations");s=[{type:"tag",mode:"text",body:s,tag:r.subparse([new Xi("\\df@tag")])}]}return s},qU=function(e,n,r){n.textContent="";var s=HN(e,r).toNode();n.appendChild(s)};typeof document<"u"&&document.compatMode!=="CSS1Compat"&&(typeof console<"u"&&console.warn("Warning: KaTeX doesn't work in quirks mode. Make sure your website has a suitable doctype."),qU=function(){throw new $e("KaTeX doesn't work in quirks mode.")});var bke=function(e,n){var r=HN(e,n).toMarkup();return r},wke=function(e,n){var r=new ON(n);return $N(e,r)},$U=function(e,n,r){if(r.throwOnError||!(e instanceof $e))throw e;var s=be.makeSpan(["katex-error"],[new Aa(n)]);return s.setAttribute("title",e.toString()),s.setAttribute("style","color:"+r.errorColor),s},HN=function(e,n){var r=new ON(n);try{var s=$N(e,r);return _3e(s,e,r)}catch(i){return $U(i,e,r)}},Ske=function(e,n){var r=new ON(n);try{var s=$N(e,r);return A3e(s,e,r)}catch(i){return $U(i,e,r)}},kke="0.16.25",Oke={Span:pg,Anchor:CN,SymbolNode:Aa,SvgNode:Ql,PathNode:tu,LineNode:FO},QR={version:kke,render:qU,renderToString:bke,ParseError:$e,SETTINGS_SCHEMA:kv,__parse:wke,__renderToDomTree:HN,__renderToHTMLTree:Ske,__setFontMetrics:J5e,__defineSymbol:M,__defineFunction:tt,__defineMacro:Z,__domTree:Oke};const jke={};function Nke(t){const e=this,n=t||jke,r=e.data(),s=r.micromarkExtensions||(r.micromarkExtensions=[]),i=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),a=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);s.push(j5e(n)),i.push(x5e()),a.push(v5e(n))}const VR=/[#.]/g;function Cke(t,e){const n=t||"",r={};let s=0,i,a;for(;s<n.length;){VR.lastIndex=s;const l=VR.exec(n),c=n.slice(s,l?l.index:n.length);c&&(i?i==="#"?r.id=c:Array.isArray(r.className)?r.className.push(c):r.className=[c]:a=c,s+=c.length),l&&(i=l[0],s++)}return{type:"element",tagName:a||e||"div",properties:r,children:[]}}function HU(t,e,n){const r=n?Ake(n):void 0;function s(i,a,...l){let c;if(i==null){c={type:"root",children:[]};const d=a;l.unshift(d)}else{c=Cke(i,e);const d=c.tagName.toLowerCase(),h=r?r.get(d):void 0;if(c.tagName=h||d,Tke(a))l.unshift(a);else for(const[m,g]of Object.entries(a))Eke(t,c.properties,m,g)}for(const d of l)WO(c.children,d);return c.type==="element"&&c.tagName==="template"&&(c.content={type:"root",children:c.children},c.children=[]),c}return s}function Tke(t){if(t===null||typeof t!="object"||Array.isArray(t))return!0;if(typeof t.type!="string")return!1;const e=t,n=Object.keys(t);for(const r of n){const s=e[r];if(s&&typeof s=="object"){if(!Array.isArray(s))return!0;const i=s;for(const a of i)if(typeof a!="number"&&typeof a!="string")return!0}}return!!("children"in t&&Array.isArray(t.children))}function Eke(t,e,n,r){const s=GQ(t,n);let i;if(r!=null){if(typeof r=="number"){if(Number.isNaN(r))return;i=r}else typeof r=="boolean"?i=r:typeof r=="string"?s.spaceSeparated?i=kM(r):s.commaSeparated?i=vM(r):s.commaOrSpaceSeparated?i=kM(vM(r).join(" ")):i=UR(s,s.property,r):Array.isArray(r)?i=[...r]:i=s.property==="style"?_ke(r):String(r);if(Array.isArray(i)){const a=[];for(const l of i)a.push(UR(s,s.property,l));i=a}s.property==="className"&&Array.isArray(e.className)&&(i=e.className.concat(i)),e[s.property]=i}}function WO(t,e){if(e!=null)if(typeof e=="number"||typeof e=="string")t.push({type:"text",value:String(e)});else if(Array.isArray(e))for(const n of e)WO(t,n);else if(typeof e=="object"&&"type"in e)e.type==="root"?WO(t,e.children):t.push(e);else throw new Error("Expected node, nodes, or string, got `"+e+"`")}function UR(t,e,n){if(typeof n=="string"){if(t.number&&n&&!Number.isNaN(Number(n)))return Number(n);if((t.boolean||t.overloadedBoolean)&&(n===""||mp(n)===mp(e)))return!0}return n}function _ke(t){const e=[];for(const[n,r]of Object.entries(t))e.push([n,r].join(": "));return e.join("; ")}function Ake(t){const e=new Map;for(const n of t)e.set(n.toLowerCase(),n);return e}const Mke=["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","solidColor","textArea","textPath"],Rke=HU(XQ,"div"),Dke=HU(zb,"g",Mke),a5={html:"http://www.w3.org/1999/xhtml",svg:"http://www.w3.org/2000/svg"};function Pke(t,e){return QU(t,{})||{type:"root",children:[]}}function QU(t,e){const n=zke(t,e);return n&&e.afterTransform&&e.afterTransform(t,n),n}function zke(t,e){switch(t.nodeType){case 1:return Fke(t,e);case 3:return Lke(t);case 8:return Bke(t);case 9:return WR(t,e);case 10:return Ike();case 11:return WR(t,e);default:return}}function WR(t,e){return{type:"root",children:VU(t,e)}}function Ike(){return{type:"doctype"}}function Lke(t){return{type:"text",value:t.nodeValue||""}}function Bke(t){return{type:"comment",value:t.nodeValue||""}}function Fke(t,e){const n=t.namespaceURI,r=n===a5.svg?Dke:Rke,s=n===a5.html?t.tagName.toLowerCase():t.tagName,i=n===a5.html&&s==="template"?t.content:t,a=t.getAttributeNames(),l={};let c=-1;for(;++c<a.length;)l[a[c]]=t.getAttribute(a[c])||"";return r(s,l,VU(i,e))}function VU(t,e){const n=t.childNodes,r=[];let s=-1;for(;++s<n.length;){const i=QU(n[s],e);i!==void 0&&r.push(i)}return r}new DOMParser;function qke(t,e){const n=$ke(t);return Pke(n)}function $ke(t){const e=document.createElement("template");return e.innerHTML=t,e.content}const GR=(function(t,e,n){const r=hg(n);if(!t||!t.type||!t.children)throw new Error("Expected parent node");if(typeof e=="number"){if(e<0||e===Number.POSITIVE_INFINITY)throw new Error("Expected positive finite number as index")}else if(e=t.children.indexOf(e),e<0)throw new Error("Expected child node or index");for(;++e<t.children.length;)if(r(t.children[e],e,t))return t.children[e]}),kd=(function(t){if(t==null)return Vke;if(typeof t=="string")return Qke(t);if(typeof t=="object")return Hke(t);if(typeof t=="function")return QN(t);throw new Error("Expected function, string, or array as `test`")});function Hke(t){const e=[];let n=-1;for(;++n<t.length;)e[n]=kd(t[n]);return QN(r);function r(...s){let i=-1;for(;++i<e.length;)if(e[i].apply(this,s))return!0;return!1}}function Qke(t){return QN(e);function e(n){return n.tagName===t}}function QN(t){return e;function e(n,r,s){return!!(Uke(n)&&t.call(this,n,typeof r=="number"?r:void 0,s||void 0))}}function Vke(t){return!!(t&&typeof t=="object"&&"type"in t&&t.type==="element"&&"tagName"in t&&typeof t.tagName=="string")}function Uke(t){return t!==null&&typeof t=="object"&&"type"in t&&"tagName"in t}const XR=/\n/g,YR=/[\t ]+/g,GO=kd("br"),KR=kd(eOe),Wke=kd("p"),ZR=kd("tr"),Gke=kd(["datalist","head","noembed","noframes","noscript","rp","script","style","template","title",Jke,tOe]),UU=kd(["address","article","aside","blockquote","body","caption","center","dd","dialog","dir","dl","dt","div","figure","figcaption","footer","form,","h1","h2","h3","h4","h5","h6","header","hgroup","hr","html","legend","li","listing","main","menu","nav","ol","p","plaintext","pre","section","ul","xmp"]);function Xke(t,e){const n=e||{},r="children"in t?t.children:[],s=UU(t),i=XU(t,{whitespace:n.whitespace||"normal"}),a=[];(t.type==="text"||t.type==="comment")&&a.push(...GU(t,{breakBefore:!0,breakAfter:!0}));let l=-1;for(;++l<r.length;)a.push(...WU(r[l],t,{whitespace:i,breakBefore:l?void 0:s,breakAfter:l<r.length-1?GO(r[l+1]):s}));const c=[];let d;for(l=-1;++l<a.length;){const h=a[l];typeof h=="number"?d!==void 0&&h>d&&(d=h):h&&(d!==void 0&&d>-1&&c.push(`
`.repeat(d)||" "),d=-1,c.push(h))}return c.join("")}function WU(t,e,n){return t.type==="element"?Yke(t,e,n):t.type==="text"?n.whitespace==="normal"?GU(t,n):Kke(t):[]}function Yke(t,e,n){const r=XU(t,n),s=t.children||[];let i=-1,a=[];if(Gke(t))return a;let l,c;for(GO(t)||ZR(t)&&GR(e,t,ZR)?c=`
`:Wke(t)?(l=2,c=2):UU(t)&&(l=1,c=1);++i<s.length;)a=a.concat(WU(s[i],t,{whitespace:r,breakBefore:i?void 0:l,breakAfter:i<s.length-1?GO(s[i+1]):c}));return KR(t)&&GR(e,t,KR)&&a.push(" "),l&&a.unshift(l),c&&a.push(c),a}function GU(t,e){const n=String(t.value),r=[],s=[];let i=0;for(;i<=n.length;){XR.lastIndex=i;const c=XR.exec(n),d=c&&"index"in c?c.index:n.length;r.push(Zke(n.slice(i,d).replace(/[\u061C\u200E\u200F\u202A-\u202E\u2066-\u2069]/g,""),i===0?e.breakBefore:!0,d===n.length?e.breakAfter:!0)),i=d+1}let a=-1,l;for(;++a<r.length;)r[a].charCodeAt(r[a].length-1)===8203||a<r.length-1&&r[a+1].charCodeAt(0)===8203?(s.push(r[a]),l=void 0):r[a]?(typeof l=="number"&&s.push(l),s.push(r[a]),l=0):(a===0||a===r.length-1)&&s.push(0);return s}function Kke(t){return[String(t.value)]}function Zke(t,e,n){const r=[];let s=0,i;for(;s<t.length;){YR.lastIndex=s;const a=YR.exec(t);i=a?a.index:t.length,!s&&!i&&a&&!e&&r.push(""),s!==i&&r.push(t.slice(s,i)),s=a?i+a[0].length:i}return s!==i&&!n&&r.push(""),r.join(" ")}function XU(t,e){if(t.type==="element"){const n=t.properties||{};switch(t.tagName){case"listing":case"plaintext":case"xmp":return"pre";case"nobr":return"nowrap";case"pre":return n.wrap?"pre-wrap":"pre";case"td":case"th":return n.noWrap?"nowrap":e.whitespace;case"textarea":return"pre-wrap"}}return e.whitespace}function Jke(t){return!!(t.properties||{}).hidden}function eOe(t){return t.tagName==="td"||t.tagName==="th"}function tOe(t){return t.tagName==="dialog"&&!(t.properties||{}).open}const nOe={},rOe=[];function sOe(t){const e=t||nOe;return function(n,r){vN(n,"element",function(s,i){const a=Array.isArray(s.properties.className)?s.properties.className:rOe,l=a.includes("language-math"),c=a.includes("math-display"),d=a.includes("math-inline");let h=c;if(!l&&!c&&!d)return;let m=i[i.length-1],g=s;if(s.tagName==="code"&&l&&m&&m.type==="element"&&m.tagName==="pre"&&(g=m,m=i[i.length-2],h=!0),!m)return;const x=Xke(g,{whitespace:"pre"});let y;try{y=QR.renderToString(x,{...e,displayMode:h,throwOnError:!0})}catch(S){const k=S,j=k.name.toLowerCase();r.message("Could not render math with KaTeX",{ancestors:[...i,s],cause:k,place:s.position,ruleId:j,source:"rehype-katex"});try{y=QR.renderToString(x,{...e,displayMode:h,strict:"ignore",throwOnError:!1})}catch{y=[{type:"element",tagName:"span",properties:{className:["katex-error"],style:"color:"+(e.errorColor||"#cc0000"),title:String(S)},children:[{type:"text",value:x}]}]}}typeof y=="string"&&(y=qke(y).children);const w=m.children.indexOf(g);return m.children.splice(w,1,...y),SV})}}function iOe({content:t,className:e=""}){return o.jsx("div",{className:`prose prose-sm dark:prose-invert max-w-none ${e}`,children:o.jsx(s4e,{remarkPlugins:[g5e,Nke],rehypePlugins:[sOe],components:{code({inline:n,className:r,children:s,...i}){return n?o.jsx("code",{className:"bg-muted px-1.5 py-0.5 rounded text-sm font-mono",...i,children:s}):o.jsx("code",{className:`${r} block bg-muted p-4 rounded-lg overflow-x-auto`,...i,children:s})},table({children:n,...r}){return o.jsx("div",{className:"overflow-x-auto",children:o.jsx("table",{className:"border-collapse border border-border",...r,children:n})})},th({children:n,...r}){return o.jsx("th",{className:"border border-border bg-muted px-4 py-2 text-left font-semibold",...r,children:n})},td({children:n,...r}){return o.jsx("td",{className:"border border-border px-4 py-2",...r,children:n})},a({children:n,...r}){return o.jsx("a",{className:"text-primary hover:underline",target:"_blank",rel:"noopener noreferrer",...r,children:n})},blockquote({children:n,...r}){return o.jsx("blockquote",{className:"border-l-4 border-primary pl-4 italic text-muted-foreground",...r,children:n})},h1({children:n,...r}){return o.jsx("h1",{className:"text-3xl font-bold mt-6 mb-4",...r,children:n})},h2({children:n,...r}){return o.jsx("h2",{className:"text-2xl font-bold mt-5 mb-3",...r,children:n})},h3({children:n,...r}){return o.jsx("h3",{className:"text-xl font-bold mt-4 mb-2",...r,children:n})},h4({children:n,...r}){return o.jsx("h4",{className:"text-lg font-semibold mt-3 mb-2",...r,children:n})},ul({children:n,...r}){return o.jsx("ul",{className:"list-disc list-inside space-y-1 my-2",...r,children:n})},ol({children:n,...r}){return o.jsx("ol",{className:"list-decimal list-inside space-y-1 my-2",...r,children:n})},p({children:n,...r}){return o.jsx("p",{className:"my-2 leading-relaxed",...r,children:n})},hr({...n}){return o.jsx("hr",{className:"my-4 border-border",...n})}},children:t})})}function aOe({children:t,className:e}){return o.jsx(iOe,{content:t,className:e})}const Jl="/api/webui/emoji";async function oOe(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_registered!==void 0&&e.append("is_registered",t.is_registered.toString()),t.is_banned!==void 0&&e.append("is_banned",t.is_banned.toString()),t.format&&e.append("format",t.format),t.sort_by&&e.append("sort_by",t.sort_by),t.sort_order&&e.append("sort_order",t.sort_order);const n=await St(`${Jl}/list?${e}`,{headers:Dt()});if(!n.ok)throw new Error(`获取表情包列表失败: ${n.statusText}`);return n.json()}async function lOe(t){const e=await St(`${Jl}/${t}`,{headers:Dt()});if(!e.ok)throw new Error(`获取表情包详情失败: ${e.statusText}`);return e.json()}async function cOe(t,e){const n=await St(`${Jl}/${t}`,{method:"PATCH",headers:Dt(),body:JSON.stringify(e)});if(!n.ok)throw new Error(`更新表情包失败: ${n.statusText}`);return n.json()}async function uOe(t){const e=await St(`${Jl}/${t}`,{method:"DELETE",headers:Dt()});if(!e.ok)throw new Error(`删除表情包失败: ${e.statusText}`);return e.json()}async function dOe(){const t=await St(`${Jl}/stats/summary`,{headers:Dt()});if(!t.ok)throw new Error(`获取统计数据失败: ${t.statusText}`);return t.json()}async function hOe(t){const e=await St(`${Jl}/${t}/register`,{method:"POST",headers:Dt()});if(!e.ok)throw new Error(`注册表情包失败: ${e.statusText}`);return e.json()}async function fOe(t){const e=await St(`${Jl}/${t}/ban`,{method:"POST",headers:Dt()});if(!e.ok)throw new Error(`封禁表情包失败: ${e.statusText}`);return e.json()}function YU(t){const e=localStorage.getItem("access-token");return`${Jl}/${t}/thumbnail?token=${encodeURIComponent(e||"")}`}async function mOe(t){const e=await St(`${Jl}/batch/delete`,{method:"POST",headers:Dt(),body:JSON.stringify({emoji_ids:t})});if(!e.ok){const n=await e.json();throw new Error(n.detail||"批量删除失败")}return e.json()}function pOe(){const[t,e]=b.useState([]),[n,r]=b.useState(null),[s,i]=b.useState(!1),[a,l]=b.useState(1),[c,d]=b.useState(0),[h,m]=b.useState(20),[g,x]=b.useState("all"),[y,w]=b.useState("all"),[S,k]=b.useState("all"),[j,N]=b.useState("usage_count"),[T,E]=b.useState("desc"),[_,A]=b.useState(null),[L,P]=b.useState(!1),[B,$]=b.useState(!1),[U,te]=b.useState(!1),[z,Q]=b.useState(new Set),[F,Y]=b.useState(!1),[J,X]=b.useState(""),[R,ie]=b.useState("medium"),{toast:G}=as(),I=b.useCallback(async()=>{try{i(!0);const Oe=await oOe({page:a,page_size:h,is_registered:g==="all"?void 0:g==="registered",is_banned:y==="all"?void 0:y==="banned",format:S==="all"?void 0:S,sort_by:j,sort_order:T});e(Oe.data),d(Oe.total)}catch(Oe){const Ve=Oe instanceof Error?Oe.message:"加载表情包列表失败";G({title:"错误",description:Ve,variant:"destructive"})}finally{i(!1)}},[a,h,g,y,S,j,T,G]),V=async()=>{try{const Oe=await dOe();r(Oe.data)}catch(Oe){console.error("加载统计数据失败:",Oe)}};b.useEffect(()=>{I()},[I]),b.useEffect(()=>{V()},[]);const ee=async Oe=>{try{const Ve=await lOe(Oe.id);A(Ve.data),P(!0)}catch(Ve){const Ue=Ve instanceof Error?Ve.message:"加载详情失败";G({title:"错误",description:Ue,variant:"destructive"})}},ne=Oe=>{A(Oe),$(!0)},W=Oe=>{A(Oe),te(!0)},se=async()=>{if(_)try{await uOe(_.id),G({title:"成功",description:"表情包已删除"}),te(!1),A(null),I(),V()}catch(Oe){const Ve=Oe instanceof Error?Oe.message:"删除失败";G({title:"错误",description:Ve,variant:"destructive"})}},re=async Oe=>{try{await hOe(Oe.id),G({title:"成功",description:"表情包已注册"}),I(),V()}catch(Ve){const Ue=Ve instanceof Error?Ve.message:"注册失败";G({title:"错误",description:Ue,variant:"destructive"})}},oe=async Oe=>{try{await fOe(Oe.id),G({title:"成功",description:"表情包已封禁"}),I(),V()}catch(Ve){const Ue=Ve instanceof Error?Ve.message:"封禁失败";G({title:"错误",description:Ue,variant:"destructive"})}},Te=Oe=>{const Ve=new Set(z);Ve.has(Oe)?Ve.delete(Oe):Ve.add(Oe),Q(Ve)},We=async()=>{try{const Oe=await mOe(Array.from(z));G({title:"批量删除完成",description:Oe.message}),Q(new Set),Y(!1),I(),V()}catch(Oe){G({title:"批量删除失败",description:Oe instanceof Error?Oe.message:"批量删除失败",variant:"destructive"})}},Ye=()=>{const Oe=parseInt(J),Ve=Math.ceil(c/h);Oe>=1&&Oe<=Ve?(l(Oe),X("")):G({title:"无效的页码",description:`请输入1-${Ve}之间的页码`,variant:"destructive"})},Je=n?.formats?Object.keys(n.formats):[];return o.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[o.jsxs("div",{className:"mb-4 sm:mb-6",children:[o.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"表情包管理"}),o.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"管理麦麦的表情包资源"})]}),o.jsx(gn,{className:"flex-1",children:o.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[n&&o.jsxs("div",{className:"grid gap-4 grid-cols-2 lg:grid-cols-4",children:[o.jsx(qt,{children:o.jsxs(Fn,{className:"pb-2",children:[o.jsx(ts,{children:"总数"}),o.jsx(qn,{className:"text-2xl",children:n.total})]})}),o.jsx(qt,{children:o.jsxs(Fn,{className:"pb-2",children:[o.jsx(ts,{children:"已注册"}),o.jsx(qn,{className:"text-2xl text-green-600",children:n.registered})]})}),o.jsx(qt,{children:o.jsxs(Fn,{className:"pb-2",children:[o.jsx(ts,{children:"已封禁"}),o.jsx(qn,{className:"text-2xl text-red-600",children:n.banned})]})}),o.jsx(qt,{children:o.jsxs(Fn,{className:"pb-2",children:[o.jsx(ts,{children:"未注册"}),o.jsx(qn,{className:"text-2xl text-gray-600",children:n.unregistered})]})})]}),o.jsxs(qt,{children:[o.jsx(Fn,{children:o.jsxs(qn,{className:"flex items-center gap-2",children:[o.jsx(sk,{className:"h-5 w-5"}),"筛选和排序"]})}),o.jsxs(Gn,{className:"space-y-4",children:[o.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{children:"排序方式"}),o.jsxs(Vt,{value:`${j}-${T}`,onValueChange:Oe=>{const[Ve,Ue]=Oe.split("-");N(Ve),E(Ue),l(1)},children:[o.jsx($t,{children:o.jsx(Ut,{})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"usage_count-desc",children:"使用次数 (多→少)"}),o.jsx(De,{value:"usage_count-asc",children:"使用次数 (少→多)"}),o.jsx(De,{value:"register_time-desc",children:"注册时间 (新→旧)"}),o.jsx(De,{value:"register_time-asc",children:"注册时间 (旧→新)"}),o.jsx(De,{value:"record_time-desc",children:"记录时间 (新→旧)"}),o.jsx(De,{value:"record_time-asc",children:"记录时间 (旧→新)"}),o.jsx(De,{value:"last_used_time-desc",children:"最后使用 (新→旧)"}),o.jsx(De,{value:"last_used_time-asc",children:"最后使用 (旧→新)"})]})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{children:"注册状态"}),o.jsxs(Vt,{value:g,onValueChange:Oe=>{x(Oe),l(1)},children:[o.jsx($t,{children:o.jsx(Ut,{})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"all",children:"全部"}),o.jsx(De,{value:"registered",children:"已注册"}),o.jsx(De,{value:"unregistered",children:"未注册"})]})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{children:"封禁状态"}),o.jsxs(Vt,{value:y,onValueChange:Oe=>{w(Oe),l(1)},children:[o.jsx($t,{children:o.jsx(Ut,{})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"all",children:"全部"}),o.jsx(De,{value:"banned",children:"已封禁"}),o.jsx(De,{value:"unbanned",children:"未封禁"})]})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{children:"格式"}),o.jsxs(Vt,{value:S,onValueChange:Oe=>{k(Oe),l(1)},children:[o.jsx($t,{children:o.jsx(Ut,{})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"all",children:"全部"}),Je.map(Oe=>o.jsxs(De,{value:Oe,children:[Oe.toUpperCase()," (",n?.formats[Oe],")"]},Oe))]})]})]})]}),o.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 pt-4 border-t",children:[o.jsxs("div",{className:"flex items-center gap-4",children:[z.size>0&&o.jsxs("span",{className:"text-sm text-muted-foreground",children:["已选择 ",z.size," 个表情包"]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(he,{className:"text-sm whitespace-nowrap",children:"卡片大小"}),o.jsxs(Vt,{value:R,onValueChange:Oe=>ie(Oe),children:[o.jsx($t,{className:"w-24",children:o.jsx(Ut,{})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"small",children:"小"}),o.jsx(De,{value:"medium",children:"中"}),o.jsx(De,{value:"large",children:"大"})]})]})]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(he,{htmlFor:"emoji-page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),o.jsxs(Vt,{value:h.toString(),onValueChange:Oe=>{m(parseInt(Oe)),l(1),Q(new Set)},children:[o.jsx($t,{id:"emoji-page-size",className:"w-20",children:o.jsx(Ut,{})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"20",children:"20"}),o.jsx(De,{value:"40",children:"40"}),o.jsx(De,{value:"60",children:"60"}),o.jsx(De,{value:"100",children:"100"})]})]}),z.size>0&&o.jsxs(o.Fragment,{children:[o.jsx(de,{variant:"outline",size:"sm",onClick:()=>Q(new Set),children:"取消选择"}),o.jsxs(de,{variant:"destructive",size:"sm",onClick:()=>Y(!0),children:[o.jsx(Sn,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]})]}),o.jsx("div",{className:"flex justify-end pt-4 border-t",children:o.jsxs(de,{variant:"outline",size:"sm",onClick:I,disabled:s,children:[o.jsx(Ps,{className:`h-4 w-4 mr-2 ${s?"animate-spin":""}`}),"刷新"]})})]})]}),o.jsxs(qt,{children:[o.jsxs(Fn,{children:[o.jsx(qn,{children:"表情包列表"}),o.jsxs(ts,{children:["共 ",c," 个表情包,当前第 ",a," 页"]})]}),o.jsxs(Gn,{children:[t.length===0?o.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"暂无数据"}):o.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=>o.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:()=>Te(Oe.id),children:[o.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:o.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)&&o.jsx(Vc,{className:"h-3 w-3"})})}),o.jsxs("div",{className:"absolute top-1 right-1 z-10 flex flex-col gap-0.5",children:[Oe.is_registered&&o.jsx(Xn,{variant:"default",className:"bg-green-600 text-[10px] px-1 py-0",children:"已注册"}),Oe.is_banned&&o.jsx(Xn,{variant:"destructive",className:"text-[10px] px-1 py-0",children:"已封禁"})]}),o.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:o.jsx("img",{src:YU(Oe.id),alt:"表情包",className:"w-full h-full object-contain",loading:"lazy",onError:Ve=>{const Ue=Ve.target;Ue.style.display="none";const He=Ue.parentElement;He&&(He.innerHTML='<svg class="h-8 w-8 text-muted-foreground" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z" /></svg>')}})}),o.jsxs("div",{className:`border-t bg-card ${R==="small"?"p-1":"p-2"}`,children:[o.jsxs("div",{className:"flex items-center justify-between gap-1 text-xs text-muted-foreground mb-1",children:[o.jsx(Xn,{variant:"outline",className:"text-[10px] px-1 py-0",children:Oe.format.toUpperCase()}),o.jsxs("span",{className:"font-mono",children:[Oe.usage_count,"次"]})]}),o.jsxs("div",{className:`flex gap-1 justify-center opacity-0 group-hover:opacity-100 transition-opacity ${R==="small"?"flex-wrap":""}`,children:[o.jsx(de,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:Ve=>{Ve.stopPropagation(),ne(Oe)},title:"编辑",children:o.jsx(z0,{className:"h-3 w-3"})}),o.jsx(de,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:Ve=>{Ve.stopPropagation(),ee(Oe)},title:"详情",children:o.jsx(Oa,{className:"h-3 w-3"})}),!Oe.is_registered&&o.jsx(de,{variant:"ghost",size:"icon",className:"h-6 w-6 text-green-600 hover:text-green-700",onClick:Ve=>{Ve.stopPropagation(),re(Oe)},title:"注册",children:o.jsx(Vc,{className:"h-3 w-3"})}),!Oe.is_banned&&o.jsx(de,{variant:"ghost",size:"icon",className:"h-6 w-6 text-orange-600 hover:text-orange-700",onClick:Ve=>{Ve.stopPropagation(),oe(Oe)},title:"封禁",children:o.jsx(Jee,{className:"h-3 w-3"})}),o.jsx(de,{variant:"ghost",size:"icon",className:"h-6 w-6 text-red-600 hover:text-red-700",onClick:Ve=>{Ve.stopPropagation(),W(Oe)},title:"删除",children:o.jsx(Sn,{className:"h-3 w-3"})})]})]})]},Oe.id))}),c>0&&o.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[o.jsxs("div",{className:"text-sm text-muted-foreground",children:["显示 ",(a-1)*h+1," 到"," ",Math.min(a*h,c)," 条,共 ",c," 条"]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(de,{variant:"outline",size:"sm",onClick:()=>l(1),disabled:a===1,className:"hidden sm:flex",children:o.jsx(Ap,{className:"h-4 w-4"})}),o.jsxs(de,{variant:"outline",size:"sm",onClick:()=>l(Oe=>Math.max(1,Oe-1)),disabled:a===1,children:[o.jsx(vd,{className:"h-4 w-4 sm:mr-1"}),o.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(ze,{type:"number",value:J,onChange:Oe=>X(Oe.target.value),onKeyDown:Oe=>Oe.key==="Enter"&&Ye(),placeholder:a.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(c/h)}),o.jsx(de,{variant:"outline",size:"sm",onClick:Ye,disabled:!J,className:"h-8",children:"跳转"})]}),o.jsxs(de,{variant:"outline",size:"sm",onClick:()=>l(Oe=>Oe+1),disabled:a>=Math.ceil(c/h),children:[o.jsx("span",{className:"hidden sm:inline",children:"下一页"}),o.jsx(yd,{className:"h-4 w-4 sm:ml-1"})]}),o.jsx(de,{variant:"outline",size:"sm",onClick:()=>l(Math.ceil(c/h)),disabled:a>=Math.ceil(c/h),className:"hidden sm:flex",children:o.jsx(Mp,{className:"h-4 w-4"})})]})]})]})]}),o.jsx(gOe,{emoji:_,open:L,onOpenChange:P}),o.jsx(xOe,{emoji:_,open:B,onOpenChange:$,onSuccess:()=>{I(),V()}})]})}),o.jsx(Dn,{open:F,onOpenChange:Y,children:o.jsxs(Nn,{children:[o.jsxs(Cn,{children:[o.jsx(En,{children:"确认批量删除"}),o.jsxs(_n,{children:["你确定要删除选中的 ",z.size," 个表情包吗?此操作不可撤销。"]})]}),o.jsxs(Tn,{children:[o.jsx(Mn,{children:"取消"}),o.jsx(An,{onClick:We,children:"确认删除"})]})]})}),o.jsx(Dr,{open:U,onOpenChange:te,children:o.jsxs(Sr,{children:[o.jsxs(kr,{children:[o.jsx(Or,{children:"确认删除"}),o.jsx(ss,{children:"确定要删除这个表情包吗?此操作无法撤销。"})]}),o.jsxs(ws,{children:[o.jsx(de,{variant:"outline",onClick:()=>te(!1),children:"取消"}),o.jsx(de,{variant:"destructive",onClick:se,children:"删除"})]})]})})]})}function gOe({emoji:t,open:e,onOpenChange:n}){if(!t)return null;const r=s=>s?new Date(s*1e3).toLocaleString("zh-CN"):"-";return o.jsx(Dr,{open:e,onOpenChange:n,children:o.jsxs(Sr,{className:"max-w-2xl max-h-[90vh]",children:[o.jsx(kr,{children:o.jsx(Or,{children:"表情包详情"})}),o.jsx(gn,{className:"max-h-[calc(90vh-8rem)] pr-4",children:o.jsxs("div",{className:"space-y-4",children:[o.jsx("div",{className:"flex justify-center",children:o.jsx("div",{className:"w-32 h-32 bg-muted rounded-lg flex items-center justify-center overflow-hidden",children:o.jsx("img",{src:YU(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='<svg class="h-16 w-16 text-muted-foreground" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z" /></svg>')}})})}),o.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[o.jsxs("div",{children:[o.jsx(he,{className:"text-muted-foreground",children:"ID"}),o.jsx("div",{className:"mt-1 font-mono",children:t.id})]}),o.jsxs("div",{children:[o.jsx(he,{className:"text-muted-foreground",children:"格式"}),o.jsx("div",{className:"mt-1",children:o.jsx(Xn,{variant:"outline",children:t.format.toUpperCase()})})]})]}),o.jsxs("div",{children:[o.jsx(he,{className:"text-muted-foreground",children:"文件路径"}),o.jsx("div",{className:"mt-1 font-mono text-sm break-all bg-muted p-2 rounded",children:t.full_path})]}),o.jsxs("div",{children:[o.jsx(he,{className:"text-muted-foreground",children:"哈希值"}),o.jsx("div",{className:"mt-1 font-mono text-sm break-all bg-muted p-2 rounded",children:t.emoji_hash})]}),o.jsxs("div",{children:[o.jsx(he,{className:"text-muted-foreground",children:"描述"}),t.description?o.jsx("div",{className:"mt-1 rounded-lg border bg-muted/50 p-3",children:o.jsx(aOe,{className:"prose-sm",children:t.description})}):o.jsx("div",{className:"mt-1 text-sm text-muted-foreground",children:"-"})]}),o.jsxs("div",{children:[o.jsx(he,{className:"text-muted-foreground",children:"情绪"}),o.jsx("div",{className:"mt-1",children:t.emotion?o.jsx("span",{className:"text-sm",children:t.emotion}):o.jsx("span",{className:"text-sm text-muted-foreground",children:"-"})})]}),o.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[o.jsxs("div",{children:[o.jsx(he,{className:"text-muted-foreground",children:"状态"}),o.jsxs("div",{className:"mt-2 flex gap-2",children:[t.is_registered&&o.jsx(Xn,{variant:"default",className:"bg-green-600",children:"已注册"}),t.is_banned&&o.jsx(Xn,{variant:"destructive",children:"已封禁"}),!t.is_registered&&!t.is_banned&&o.jsx(Xn,{variant:"outline",children:"未注册"})]})]}),o.jsxs("div",{children:[o.jsx(he,{className:"text-muted-foreground",children:"使用次数"}),o.jsx("div",{className:"mt-1 font-mono text-lg",children:t.usage_count})]})]}),o.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[o.jsxs("div",{children:[o.jsx(he,{className:"text-muted-foreground",children:"记录时间"}),o.jsx("div",{className:"mt-1 text-sm",children:r(t.record_time)})]}),o.jsxs("div",{children:[o.jsx(he,{className:"text-muted-foreground",children:"注册时间"}),o.jsx("div",{className:"mt-1 text-sm",children:r(t.register_time)})]})]}),o.jsxs("div",{children:[o.jsx(he,{className:"text-muted-foreground",children:"最后使用"}),o.jsx("div",{className:"mt-1 text-sm",children:r(t.last_used_time)})]})]})})]})})}function xOe({emoji:t,open:e,onOpenChange:n,onSuccess:r}){const[s,i]=b.useState(""),[a,l]=b.useState(!1),[c,d]=b.useState(!1),[h,m]=b.useState(!1),{toast:g}=as();b.useEffect(()=>{t&&(i(t.emotion||""),l(t.is_registered),d(t.is_banned))},[t]);const x=async()=>{if(t)try{m(!0);const y=s.split(/[,,]/).map(w=>w.trim()).filter(Boolean).join(",");await cOe(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?o.jsx(Dr,{open:e,onOpenChange:n,children:o.jsxs(Sr,{className:"max-w-2xl",children:[o.jsxs(kr,{children:[o.jsx(Or,{children:"编辑表情包"}),o.jsx(ss,{children:"修改表情包的情绪和状态信息"})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{children:[o.jsx(he,{children:"情绪"}),o.jsx(Mr,{value:s,onChange:y=>i(y.target.value),placeholder:"输入情绪描述...",rows:2,className:"mt-1"}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"输入情绪相关的文本描述"})]}),o.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Oi,{id:"is_registered",checked:a,onCheckedChange:y=>{y===!0?(l(!0),d(!1)):l(!1)}}),o.jsx(he,{htmlFor:"is_registered",className:"cursor-pointer",children:"已注册"})]}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Oi,{id:"is_banned",checked:c,onCheckedChange:y=>{y===!0?(d(!0),l(!1)):d(!1)}}),o.jsx(he,{htmlFor:"is_banned",className:"cursor-pointer",children:"已封禁"})]})]})]}),o.jsxs(ws,{children:[o.jsx(de,{variant:"outline",onClick:()=>n(!1),children:"取消"}),o.jsx(de,{onClick:x,disabled:h,children:h?"保存中...":"保存"})]})]})}):null}const hu="/api/webui/expression";async function vOe(){const t=await St(`${hu}/chats`,{headers:Dt()});if(!t.ok){const e=await t.json();throw new Error(e.detail||"获取聊天列表失败")}return t.json()}async function yOe(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 St(`${hu}/list?${e}`,{headers:Dt()});if(!n.ok){const r=await n.json();throw new Error(r.detail||"获取表达方式列表失败")}return n.json()}async function bOe(t){const e=await St(`${hu}/${t}`,{headers:Dt()});if(!e.ok){const n=await e.json();throw new Error(n.detail||"获取表达方式详情失败")}return e.json()}async function wOe(t){const e=await St(`${hu}/`,{method:"POST",headers:Dt(),body:JSON.stringify(t)});if(!e.ok){const n=await e.json();throw new Error(n.detail||"创建表达方式失败")}return e.json()}async function SOe(t,e){const n=await St(`${hu}/${t}`,{method:"PATCH",headers:Dt(),body:JSON.stringify(e)});if(!n.ok){const r=await n.json();throw new Error(r.detail||"更新表达方式失败")}return n.json()}async function kOe(t){const e=await St(`${hu}/${t}`,{method:"DELETE",headers:Dt()});if(!e.ok){const n=await e.json();throw new Error(n.detail||"删除表达方式失败")}return e.json()}async function OOe(t){const e=await St(`${hu}/batch/delete`,{method:"POST",headers:Dt(),body:JSON.stringify({ids:t})});if(!e.ok){const n=await e.json();throw new Error(n.detail||"批量删除表达方式失败")}return e.json()}async function jOe(){const t=await St(`${hu}/stats/summary`,{headers:Dt()});if(!t.ok){const e=await t.json();throw new Error(e.detail||"获取统计数据失败")}return t.json()}function NOe(){const[t,e]=b.useState([]),[n,r]=b.useState(!0),[s,i]=b.useState(0),[a,l]=b.useState(1),[c,d]=b.useState(20),[h,m]=b.useState(""),[g,x]=b.useState(null),[y,w]=b.useState(!1),[S,k]=b.useState(!1),[j,N]=b.useState(!1),[T,E]=b.useState(null),[_,A]=b.useState(new Set),[L,P]=b.useState(!1),[B,$]=b.useState(""),[U,te]=b.useState({total:0,recent_7days:0,chat_count:0,top_chats:{}}),[z,Q]=b.useState([]),[F,Y]=b.useState(new Map),{toast:J}=as(),X=async()=>{try{r(!0);const oe=await yOe({page:a,page_size:c,search:h||void 0});e(oe.data),i(oe.total)}catch(oe){J({title:"加载失败",description:oe instanceof Error?oe.message:"无法加载表达方式",variant:"destructive"})}finally{r(!1)}},R=async()=>{try{const oe=await jOe();oe?.data&&te(oe.data)}catch(oe){console.error("加载统计数据失败:",oe)}},ie=async()=>{try{const oe=await vOe();if(oe?.data){Q(oe.data);const Te=new Map;oe.data.forEach(We=>{Te.set(We.chat_id,We.chat_name)}),Y(Te)}}catch(oe){console.error("加载聊天列表失败:",oe)}},G=oe=>F.get(oe)||oe;b.useEffect(()=>{X(),R(),ie()},[a,c,h]);const I=async oe=>{try{const Te=await bOe(oe.id);x(Te.data),w(!0)}catch(Te){J({title:"加载详情失败",description:Te instanceof Error?Te.message:"无法加载表达方式详情",variant:"destructive"})}},V=oe=>{x(oe),k(!0)},ee=async oe=>{try{await kOe(oe.id),J({title:"删除成功",description:`已删除表达方式: ${oe.situation}`}),E(null),X(),R()}catch(Te){J({title:"删除失败",description:Te instanceof Error?Te.message:"无法删除表达方式",variant:"destructive"})}},ne=oe=>{const Te=new Set(_);Te.has(oe)?Te.delete(oe):Te.add(oe),A(Te)},W=()=>{_.size===t.length&&t.length>0?A(new Set):A(new Set(t.map(oe=>oe.id)))},se=async()=>{try{await OOe(Array.from(_)),J({title:"批量删除成功",description:`已删除 ${_.size} 个表达方式`}),A(new Set),P(!1),X(),R()}catch(oe){J({title:"批量删除失败",description:oe instanceof Error?oe.message:"无法批量删除表达方式",variant:"destructive"})}},re=()=>{const oe=parseInt(B),Te=Math.ceil(s/c);oe>=1&&oe<=Te?(l(oe),$("")):J({title:"无效的页码",description:`请输入1-${Te}之间的页码`,variant:"destructive"})};return o.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[o.jsx("div",{className:"mb-4 sm:mb-6",children:o.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[o.jsxs("div",{children:[o.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[o.jsx(Wh,{className:"h-8 w-8",strokeWidth:2}),"表达方式管理"]}),o.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"管理麦麦的表达方式和话术模板"})]}),o.jsxs(de,{onClick:()=>N(!0),className:"gap-2",children:[o.jsx(Ls,{className:"h-4 w-4"}),"新增表达方式"]})]})}),o.jsx(gn,{className:"flex-1",children:o.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[o.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[o.jsx("div",{className:"text-sm text-muted-foreground",children:"总数量"}),o.jsx("div",{className:"text-2xl font-bold mt-1",children:U.total})]}),o.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[o.jsx("div",{className:"text-sm text-muted-foreground",children:"近7天新增"}),o.jsx("div",{className:"text-2xl font-bold mt-1 text-green-600",children:U.recent_7days})]}),o.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[o.jsx("div",{className:"text-sm text-muted-foreground",children:"关联聊天数"}),o.jsx("div",{className:"text-2xl font-bold mt-1 text-blue-600",children:U.chat_count})]})]}),o.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[o.jsx(he,{htmlFor:"search",children:"搜索"}),o.jsx("div",{className:"flex flex-col sm:flex-row gap-2 mt-1.5",children:o.jsxs("div",{className:"flex-1 relative",children:[o.jsx(Ni,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),o.jsx(ze,{id:"search",placeholder:"搜索情境、风格或上下文...",value:h,onChange:oe=>m(oe.target.value),className:"pl-9"})]})}),o.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:[o.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:_.size>0&&o.jsxs("span",{children:["已选择 ",_.size," 个表达方式"]})}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(he,{htmlFor:"page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),o.jsxs(Vt,{value:c.toString(),onValueChange:oe=>{d(parseInt(oe)),l(1),A(new Set)},children:[o.jsx($t,{id:"page-size",className:"w-20",children:o.jsx(Ut,{})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"10",children:"10"}),o.jsx(De,{value:"20",children:"20"}),o.jsx(De,{value:"50",children:"50"}),o.jsx(De,{value:"100",children:"100"})]})]}),_.size>0&&o.jsxs(o.Fragment,{children:[o.jsx(de,{variant:"outline",size:"sm",onClick:()=>A(new Set),children:"取消选择"}),o.jsxs(de,{variant:"destructive",size:"sm",onClick:()=>P(!0),children:[o.jsx(Sn,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]})]})]}),o.jsxs("div",{className:"rounded-lg border bg-card",children:[o.jsx("div",{className:"hidden md:block",children:o.jsxs(_f,{children:[o.jsx(Af,{children:o.jsxs(Is,{children:[o.jsx(pn,{className:"w-12",children:o.jsx(Oi,{checked:_.size===t.length&&t.length>0,onCheckedChange:W})}),o.jsx(pn,{children:"情境"}),o.jsx(pn,{children:"风格"}),o.jsx(pn,{children:"聊天"}),o.jsx(pn,{className:"text-right",children:"操作"})]})}),o.jsx(Mf,{children:n?o.jsx(Is,{children:o.jsx(Gt,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):t.length===0?o.jsx(Is,{children:o.jsx(Gt,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):t.map(oe=>o.jsxs(Is,{children:[o.jsx(Gt,{children:o.jsx(Oi,{checked:_.has(oe.id),onCheckedChange:()=>ne(oe.id)})}),o.jsx(Gt,{className:"font-medium max-w-xs truncate",children:oe.situation}),o.jsx(Gt,{className:"max-w-xs truncate",children:oe.style}),o.jsx(Gt,{className:"max-w-[200px] truncate",title:G(oe.chat_id),style:{wordBreak:"keep-all"},children:o.jsx("span",{className:"whitespace-nowrap overflow-hidden text-ellipsis block",children:G(oe.chat_id)})}),o.jsx(Gt,{className:"text-right",children:o.jsxs("div",{className:"flex justify-end gap-2",children:[o.jsxs(de,{variant:"default",size:"sm",onClick:()=>V(oe),children:[o.jsx(z0,{className:"h-4 w-4 mr-1"}),"编辑"]}),o.jsx(de,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>I(oe),title:"查看详情",children:o.jsx(Ea,{className:"h-4 w-4"})}),o.jsxs(de,{size:"sm",onClick:()=>E(oe),className:"bg-red-600 hover:bg-red-700 text-white",children:[o.jsx(Sn,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},oe.id))})]})}),o.jsx("div",{className:"md:hidden space-y-3 p-4",children:n?o.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):t.length===0?o.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):t.map(oe=>o.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3 overflow-hidden",children:[o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsx(Oi,{checked:_.has(oe.id),onCheckedChange:()=>ne(oe.id),className:"mt-1"}),o.jsxs("div",{className:"min-w-0 flex-1 overflow-hidden space-y-2",children:[o.jsxs("div",{children:[o.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"情境"}),o.jsx("h3",{className:"font-semibold text-sm line-clamp-2 w-full break-all",title:oe.situation,children:oe.situation})]}),o.jsxs("div",{children:[o.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"风格"}),o.jsx("p",{className:"text-sm line-clamp-2 w-full break-all",title:oe.style,children:oe.style})]})]})]}),o.jsxs("div",{className:"text-sm",children:[o.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"聊天"}),o.jsx("p",{className:"text-sm truncate",title:G(oe.chat_id),style:{wordBreak:"keep-all"},children:G(oe.chat_id)})]}),o.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t overflow-hidden",children:[o.jsxs(de,{variant:"outline",size:"sm",onClick:()=>V(oe),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[o.jsx(z0,{className:"h-3 w-3 mr-1"}),"编辑"]}),o.jsx(de,{variant:"outline",size:"sm",onClick:()=>I(oe),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:o.jsx(Ea,{className:"h-3 w-3"})}),o.jsxs(de,{variant:"outline",size:"sm",onClick:()=>E(oe),className:"text-xs px-2 py-1 h-auto flex-shrink-0 text-destructive hover:text-destructive",children:[o.jsx(Sn,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},oe.id))}),s>0&&o.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 px-4 py-3 border-t",children:[o.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",s," 条记录,第 ",a," / ",Math.ceil(s/c)," 页"]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(de,{variant:"outline",size:"sm",onClick:()=>l(1),disabled:a===1,className:"hidden sm:flex",children:o.jsx(Ap,{className:"h-4 w-4"})}),o.jsxs(de,{variant:"outline",size:"sm",onClick:()=>l(a-1),disabled:a===1,children:[o.jsx(vd,{className:"h-4 w-4 sm:mr-1"}),o.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(ze,{type:"number",value:B,onChange:oe=>$(oe.target.value),onKeyDown:oe=>oe.key==="Enter"&&re(),placeholder:a.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(s/c)}),o.jsx(de,{variant:"outline",size:"sm",onClick:re,disabled:!B,className:"h-8",children:"跳转"})]}),o.jsxs(de,{variant:"outline",size:"sm",onClick:()=>l(a+1),disabled:a>=Math.ceil(s/c),children:[o.jsx("span",{className:"hidden sm:inline",children:"下一页"}),o.jsx(yd,{className:"h-4 w-4 sm:ml-1"})]}),o.jsx(de,{variant:"outline",size:"sm",onClick:()=>l(Math.ceil(s/c)),disabled:a>=Math.ceil(s/c),className:"hidden sm:flex",children:o.jsx(Mp,{className:"h-4 w-4"})})]})]})]})]})}),o.jsx(COe,{expression:g,open:y,onOpenChange:w,chatNameMap:F}),o.jsx(TOe,{open:j,onOpenChange:N,chatList:z,onSuccess:()=>{X(),R(),N(!1)}}),o.jsx(EOe,{expression:g,open:S,onOpenChange:k,chatList:z,onSuccess:()=>{X(),R(),k(!1)}}),o.jsx(Dn,{open:!!T,onOpenChange:()=>E(null),children:o.jsxs(Nn,{children:[o.jsxs(Cn,{children:[o.jsx(En,{children:"确认删除"}),o.jsxs(_n,{children:['确定要删除表达方式 "',T?.situation,'" 吗? 此操作不可撤销。']})]}),o.jsxs(Tn,{children:[o.jsx(Mn,{children:"取消"}),o.jsx(An,{onClick:()=>T&&ee(T),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})}),o.jsx(_Oe,{open:L,onOpenChange:P,onConfirm:se,count:_.size})]})}function COe({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 o.jsx(Dr,{open:e,onOpenChange:n,children:o.jsxs(Sr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[o.jsxs(kr,{children:[o.jsx(Or,{children:"表达方式详情"}),o.jsx(ss,{children:"查看表达方式的完整信息"})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsx(e0,{label:"情境",value:t.situation}),o.jsx(e0,{label:"风格",value:t.style}),o.jsx(e0,{label:"聊天",value:i(t.chat_id)}),o.jsx(e0,{icon:ik,label:"记录ID",value:t.id.toString(),mono:!0})]}),o.jsx("div",{className:"grid grid-cols-2 gap-4",children:o.jsx(e0,{icon:_h,label:"创建时间",value:s(t.create_date)})})]}),o.jsx(ws,{children:o.jsx(de,{onClick:()=>n(!1),children:"关闭"})})]})})}function e0({icon:t,label:e,value:n,mono:r=!1}){return o.jsxs("div",{className:"space-y-1",children:[o.jsxs(he,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[t&&o.jsx(t,{className:"h-3 w-3"}),e]}),o.jsx("div",{className:xe("text-sm",r&&"font-mono",!n&&"text-muted-foreground"),children:n||"-"})]})}function TOe({open:t,onOpenChange:e,chatList:n,onSuccess:r}){const[s,i]=b.useState({situation:"",style:"",chat_id:""}),[a,l]=b.useState(!1),{toast:c}=as(),d=async()=>{if(!s.situation||!s.style||!s.chat_id){c({title:"验证失败",description:"请填写必填字段:情境、风格和聊天",variant:"destructive"});return}try{l(!0),await wOe(s),c({title:"创建成功",description:"表达方式已创建"}),i({situation:"",style:"",chat_id:""}),r()}catch(h){c({title:"创建失败",description:h instanceof Error?h.message:"无法创建表达方式",variant:"destructive"})}finally{l(!1)}};return o.jsx(Dr,{open:t,onOpenChange:e,children:o.jsxs(Sr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[o.jsxs(kr,{children:[o.jsx(Or,{children:"新增表达方式"}),o.jsx(ss,{children:"创建新的表达方式记录"})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsxs(he,{htmlFor:"situation",children:["情境 ",o.jsx("span",{className:"text-destructive",children:"*"})]}),o.jsx(ze,{id:"situation",value:s.situation,onChange:h=>i({...s,situation:h.target.value}),placeholder:"描述使用场景"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs(he,{htmlFor:"style",children:["风格 ",o.jsx("span",{className:"text-destructive",children:"*"})]}),o.jsx(ze,{id:"style",value:s.style,onChange:h=>i({...s,style:h.target.value}),placeholder:"描述表达风格"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs(he,{htmlFor:"chat_id",children:["聊天 ",o.jsx("span",{className:"text-destructive",children:"*"})]}),o.jsxs(Vt,{value:s.chat_id,onValueChange:h=>i({...s,chat_id:h}),children:[o.jsx($t,{children:o.jsx(Ut,{placeholder:"选择关联的聊天"})}),o.jsx(Ht,{children:n.map(h=>o.jsx(De,{value:h.chat_id,children:o.jsxs("span",{className:"truncate",style:{wordBreak:"keep-all"},children:[h.chat_name,h.is_group&&o.jsx("span",{className:"text-muted-foreground ml-1",children:"(群聊)"})]})},h.chat_id))})]})]})]}),o.jsxs(ws,{children:[o.jsx(de,{variant:"outline",onClick:()=>e(!1),children:"取消"}),o.jsx(de,{onClick:d,disabled:a,children:a?"创建中...":"创建"})]})]})})}function EOe({expression:t,open:e,onOpenChange:n,chatList:r,onSuccess:s}){const[i,a]=b.useState({}),[l,c]=b.useState(!1),{toast:d}=as();b.useEffect(()=>{t&&a({situation:t.situation,style:t.style,chat_id:t.chat_id})},[t]);const h=async()=>{if(t)try{c(!0),await SOe(t.id,i),d({title:"保存成功",description:"表达方式已更新"}),s()}catch(m){d({title:"保存失败",description:m instanceof Error?m.message:"无法更新表达方式",variant:"destructive"})}finally{c(!1)}};return t?o.jsx(Dr,{open:e,onOpenChange:n,children:o.jsxs(Sr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[o.jsxs(kr,{children:[o.jsx(Or,{children:"编辑表达方式"}),o.jsx(ss,{children:"修改表达方式的信息"})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{htmlFor:"edit_situation",children:"情境"}),o.jsx(ze,{id:"edit_situation",value:i.situation||"",onChange:m=>a({...i,situation:m.target.value}),placeholder:"描述使用场景"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{htmlFor:"edit_style",children:"风格"}),o.jsx(ze,{id:"edit_style",value:i.style||"",onChange:m=>a({...i,style:m.target.value}),placeholder:"描述表达风格"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{htmlFor:"edit_chat_id",children:"聊天"}),o.jsxs(Vt,{value:i.chat_id||"",onValueChange:m=>a({...i,chat_id:m}),children:[o.jsx($t,{children:o.jsx(Ut,{placeholder:"选择关联的聊天"})}),o.jsx(Ht,{children:r.map(m=>o.jsx(De,{value:m.chat_id,children:o.jsxs("span",{className:"truncate",style:{wordBreak:"keep-all"},children:[m.chat_name,m.is_group&&o.jsx("span",{className:"text-muted-foreground ml-1",children:"(群聊)"})]})},m.chat_id))})]})]})]}),o.jsxs(ws,{children:[o.jsx(de,{variant:"outline",onClick:()=>n(!1),children:"取消"}),o.jsx(de,{onClick:h,disabled:l,children:l?"保存中...":"保存"})]})]})}):null}function _Oe({open:t,onOpenChange:e,onConfirm:n,count:r}){return o.jsx(Dn,{open:t,onOpenChange:e,children:o.jsxs(Nn,{children:[o.jsxs(Cn,{children:[o.jsx(En,{children:"确认批量删除"}),o.jsxs(_n,{children:["您即将删除 ",r," 个表达方式,此操作无法撤销。确定要继续吗?"]})]}),o.jsxs(Tn,{children:[o.jsx(Mn,{children:"取消"}),o.jsx(An,{onClick:n,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"确认删除"})]})]})})}const Hf="/api/webui/person";async function AOe(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 St(`${Hf}/list?${e}`,{headers:Dt()});if(!n.ok){const r=await n.json();throw new Error(r.detail||"获取人物列表失败")}return n.json()}async function MOe(t){const e=await St(`${Hf}/${t}`,{headers:Dt()});if(!e.ok){const n=await e.json();throw new Error(n.detail||"获取人物详情失败")}return e.json()}async function ROe(t,e){const n=await St(`${Hf}/${t}`,{method:"PATCH",headers:Dt(),body:JSON.stringify(e)});if(!n.ok){const r=await n.json();throw new Error(r.detail||"更新人物信息失败")}return n.json()}async function DOe(t){const e=await St(`${Hf}/${t}`,{method:"DELETE",headers:Dt()});if(!e.ok){const n=await e.json();throw new Error(n.detail||"删除人物信息失败")}return e.json()}async function POe(){const t=await St(`${Hf}/stats/summary`,{headers:Dt()});if(!t.ok){const e=await t.json();throw new Error(e.detail||"获取统计数据失败")}return t.json()}async function zOe(t){const e=await St(`${Hf}/batch/delete`,{method:"POST",headers:Dt(),body:JSON.stringify({person_ids:t})});if(!e.ok){const n=await e.json();throw new Error(n.detail||"批量删除失败")}return e.json()}function IOe(){const[t,e]=b.useState([]),[n,r]=b.useState(!0),[s,i]=b.useState(0),[a,l]=b.useState(1),[c,d]=b.useState(20),[h,m]=b.useState(""),[g,x]=b.useState(void 0),[y,w]=b.useState(void 0),[S,k]=b.useState(null),[j,N]=b.useState(!1),[T,E]=b.useState(!1),[_,A]=b.useState(null),[L,P]=b.useState({total:0,known:0,unknown:0,platforms:{}}),[B,$]=b.useState(new Set),[U,te]=b.useState(!1),[z,Q]=b.useState(""),{toast:F}=as(),Y=async()=>{try{r(!0);const re=await AOe({page:a,page_size:c,search:h||void 0,is_known:g,platform:y});e(re.data),i(re.total)}catch(re){F({title:"加载失败",description:re instanceof Error?re.message:"无法加载人物信息",variant:"destructive"})}finally{r(!1)}},J=async()=>{try{const re=await POe();re?.data&&P(re.data)}catch(re){console.error("加载统计数据失败:",re)}};b.useEffect(()=>{Y(),J()},[a,c,h,g,y]);const X=async re=>{try{const oe=await MOe(re.person_id);k(oe.data),N(!0)}catch(oe){F({title:"加载详情失败",description:oe instanceof Error?oe.message:"无法加载人物详情",variant:"destructive"})}},R=re=>{k(re),E(!0)},ie=async re=>{try{await DOe(re.person_id),F({title:"删除成功",description:`已删除人物信息: ${re.person_name||re.nickname||re.user_id}`}),A(null),Y(),J()}catch(oe){F({title:"删除失败",description:oe instanceof Error?oe.message:"无法删除人物信息",variant:"destructive"})}},G=b.useMemo(()=>Object.keys(L.platforms),[L.platforms]),I=re=>{const oe=new Set(B);oe.has(re)?oe.delete(re):oe.add(re),$(oe)},V=()=>{B.size===t.length&&t.length>0?$(new Set):$(new Set(t.map(re=>re.person_id)))},ee=()=>{if(B.size===0){F({title:"未选择任何人物",description:"请先选择要删除的人物",variant:"destructive"});return}te(!0)},ne=async()=>{try{const re=await zOe(Array.from(B));F({title:"批量删除完成",description:re.message}),$(new Set),te(!1),Y(),J()}catch(re){F({title:"批量删除失败",description:re instanceof Error?re.message:"批量删除失败",variant:"destructive"})}},W=()=>{const re=parseInt(z),oe=Math.ceil(s/c);re>=1&&re<=oe?(l(re),Q("")):F({title:"无效的页码",description:`请输入1-${oe}之间的页码`,variant:"destructive"})},se=re=>re?new Date(re*1e3).toLocaleString("zh-CN"):"-";return o.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[o.jsx("div",{className:"mb-4 sm:mb-6",children:o.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:o.jsxs("div",{children:[o.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[o.jsx(ete,{className:"h-8 w-8",strokeWidth:2}),"人物信息管理"]}),o.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"管理麦麦认识的所有人物信息"})]})})}),o.jsx(gn,{className:"flex-1",children:o.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[o.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[o.jsx("div",{className:"text-sm text-muted-foreground",children:"总人数"}),o.jsx("div",{className:"text-2xl font-bold mt-1",children:L.total})]}),o.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[o.jsx("div",{className:"text-sm text-muted-foreground",children:"已认识"}),o.jsx("div",{className:"text-2xl font-bold mt-1 text-green-600",children:L.known})]}),o.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[o.jsx("div",{className:"text-sm text-muted-foreground",children:"未认识"}),o.jsx("div",{className:"text-2xl font-bold mt-1 text-muted-foreground",children:L.unknown})]})]}),o.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-4 gap-4",children:[o.jsxs("div",{className:"sm:col-span-2",children:[o.jsx(he,{htmlFor:"search",children:"搜索"}),o.jsxs("div",{className:"relative mt-1.5",children:[o.jsx(Ni,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),o.jsx(ze,{id:"search",placeholder:"搜索名称、昵称或用户ID...",value:h,onChange:re=>m(re.target.value),className:"pl-9"})]})]}),o.jsxs("div",{children:[o.jsx(he,{htmlFor:"filter-known",children:"认识状态"}),o.jsxs(Vt,{value:g===void 0?"all":g.toString(),onValueChange:re=>{x(re==="all"?void 0:re==="true"),l(1)},children:[o.jsx($t,{id:"filter-known",className:"mt-1.5",children:o.jsx(Ut,{})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"all",children:"全部"}),o.jsx(De,{value:"true",children:"已认识"}),o.jsx(De,{value:"false",children:"未认识"})]})]})]}),o.jsxs("div",{children:[o.jsx(he,{htmlFor:"filter-platform",children:"平台"}),o.jsxs(Vt,{value:y||"all",onValueChange:re=>{w(re==="all"?void 0:re),l(1)},children:[o.jsx($t,{id:"filter-platform",className:"mt-1.5",children:o.jsx(Ut,{})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"all",children:"全部平台"}),G.map(re=>o.jsxs(De,{value:re,children:[re," (",L.platforms[re],")"]},re))]})]})]})]}),o.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:[o.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:B.size>0&&o.jsxs("span",{children:["已选择 ",B.size," 个人物"]})}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(he,{htmlFor:"page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),o.jsxs(Vt,{value:c.toString(),onValueChange:re=>{d(parseInt(re)),l(1),$(new Set)},children:[o.jsx($t,{id:"page-size",className:"w-20",children:o.jsx(Ut,{})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"10",children:"10"}),o.jsx(De,{value:"20",children:"20"}),o.jsx(De,{value:"50",children:"50"}),o.jsx(De,{value:"100",children:"100"})]})]}),B.size>0&&o.jsxs(o.Fragment,{children:[o.jsx(de,{variant:"outline",size:"sm",onClick:()=>$(new Set),children:"取消选择"}),o.jsxs(de,{variant:"destructive",size:"sm",onClick:ee,children:[o.jsx(Sn,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]})]})]}),o.jsxs("div",{className:"rounded-lg border bg-card",children:[o.jsx("div",{className:"hidden md:block",children:o.jsxs(_f,{children:[o.jsx(Af,{children:o.jsxs(Is,{children:[o.jsx(pn,{className:"w-12",children:o.jsx(Oi,{checked:t.length>0&&B.size===t.length,onCheckedChange:V,"aria-label":"全选"})}),o.jsx(pn,{children:"状态"}),o.jsx(pn,{children:"名称"}),o.jsx(pn,{children:"昵称"}),o.jsx(pn,{children:"平台"}),o.jsx(pn,{children:"用户ID"}),o.jsx(pn,{children:"最后更新"}),o.jsx(pn,{className:"text-right",children:"操作"})]})}),o.jsx(Mf,{children:n?o.jsx(Is,{children:o.jsx(Gt,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):t.length===0?o.jsx(Is,{children:o.jsx(Gt,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):t.map(re=>o.jsxs(Is,{children:[o.jsx(Gt,{children:o.jsx(Oi,{checked:B.has(re.person_id),onCheckedChange:()=>I(re.person_id),"aria-label":`选择 ${re.person_name||re.nickname||re.user_id}`})}),o.jsx(Gt,{children:o.jsx("div",{className:xe("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?"已认识":"未认识"})}),o.jsx(Gt,{className:"font-medium",children:re.person_name||o.jsx("span",{className:"text-muted-foreground",children:"-"})}),o.jsx(Gt,{children:re.nickname||"-"}),o.jsx(Gt,{children:re.platform}),o.jsx(Gt,{className:"font-mono text-sm",children:re.user_id}),o.jsx(Gt,{className:"text-sm text-muted-foreground",children:se(re.last_know)}),o.jsx(Gt,{className:"text-right",children:o.jsxs("div",{className:"flex justify-end gap-2",children:[o.jsxs(de,{variant:"default",size:"sm",onClick:()=>X(re),children:[o.jsx(Ea,{className:"h-4 w-4 mr-1"}),"详情"]}),o.jsxs(de,{variant:"default",size:"sm",onClick:()=>R(re),children:[o.jsx(z0,{className:"h-4 w-4 mr-1"}),"编辑"]}),o.jsxs(de,{size:"sm",onClick:()=>A(re),className:"bg-red-600 hover:bg-red-700 text-white",children:[o.jsx(Sn,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},re.id))})]})}),o.jsx("div",{className:"md:hidden space-y-3 p-4",children:n?o.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):t.length===0?o.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):t.map(re=>o.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3 overflow-hidden",children:[o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsx(Oi,{checked:B.has(re.person_id),onCheckedChange:()=>I(re.person_id),className:"mt-1"}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:xe("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?"已认识":"未认识"}),o.jsx("h3",{className:"font-semibold text-sm line-clamp-1 w-full break-all",children:re.person_name||o.jsx("span",{className:"text-muted-foreground",children:"未命名"})}),re.nickname&&o.jsxs("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-1 w-full break-all",children:["昵称: ",re.nickname]})]})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[o.jsxs("div",{children:[o.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"平台"}),o.jsx("p",{className:"font-medium text-xs",children:re.platform})]}),o.jsxs("div",{children:[o.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"用户ID"}),o.jsx("p",{className:"font-mono text-xs truncate",title:re.user_id,children:re.user_id})]}),o.jsxs("div",{className:"col-span-2",children:[o.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"最后更新"}),o.jsx("p",{className:"text-xs",children:se(re.last_know)})]})]}),o.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t overflow-hidden",children:[o.jsxs(de,{variant:"outline",size:"sm",onClick:()=>X(re),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[o.jsx(Ea,{className:"h-3 w-3 mr-1"}),"查看"]}),o.jsxs(de,{variant:"outline",size:"sm",onClick:()=>R(re),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[o.jsx(z0,{className:"h-3 w-3 mr-1"}),"编辑"]}),o.jsxs(de,{variant:"outline",size:"sm",onClick:()=>A(re),className:"text-xs px-2 py-1 h-auto flex-shrink-0 text-destructive hover:text-destructive",children:[o.jsx(Sn,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},re.id))}),s>0&&o.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 px-4 py-3 border-t",children:[o.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",s," 条记录,第 ",a," / ",Math.ceil(s/c)," 页"]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(de,{variant:"outline",size:"sm",onClick:()=>l(1),disabled:a===1,className:"hidden sm:flex",children:o.jsx(Ap,{className:"h-4 w-4"})}),o.jsxs(de,{variant:"outline",size:"sm",onClick:()=>l(a-1),disabled:a===1,children:[o.jsx(vd,{className:"h-4 w-4 sm:mr-1"}),o.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(ze,{type:"number",value:z,onChange:re=>Q(re.target.value),onKeyDown:re=>re.key==="Enter"&&W(),placeholder:a.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(s/c)}),o.jsx(de,{variant:"outline",size:"sm",onClick:W,disabled:!z,className:"h-8",children:"跳转"})]}),o.jsxs(de,{variant:"outline",size:"sm",onClick:()=>l(a+1),disabled:a>=Math.ceil(s/c),children:[o.jsx("span",{className:"hidden sm:inline",children:"下一页"}),o.jsx(yd,{className:"h-4 w-4 sm:ml-1"})]}),o.jsx(de,{variant:"outline",size:"sm",onClick:()=>l(Math.ceil(s/c)),disabled:a>=Math.ceil(s/c),className:"hidden sm:flex",children:o.jsx(Mp,{className:"h-4 w-4"})})]})]})]})]})}),o.jsx(LOe,{person:S,open:j,onOpenChange:N}),o.jsx(BOe,{person:S,open:T,onOpenChange:E,onSuccess:()=>{Y(),J(),E(!1)}}),o.jsx(Dn,{open:!!_,onOpenChange:()=>A(null),children:o.jsxs(Nn,{children:[o.jsxs(Cn,{children:[o.jsx(En,{children:"确认删除"}),o.jsxs(_n,{children:['确定要删除人物信息 "',_?.person_name||_?.nickname||_?.user_id,'" 吗? 此操作不可撤销。']})]}),o.jsxs(Tn,{children:[o.jsx(Mn,{children:"取消"}),o.jsx(An,{onClick:()=>_&&ie(_),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})}),o.jsx(Dn,{open:U,onOpenChange:te,children:o.jsxs(Nn,{children:[o.jsxs(Cn,{children:[o.jsx(En,{children:"确认批量删除"}),o.jsxs(_n,{children:["确定要删除选中的 ",B.size," 个人物信息吗? 此操作不可撤销。"]})]}),o.jsxs(Tn,{children:[o.jsx(Mn,{children:"取消"}),o.jsx(An,{onClick:ne,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})})]})}function LOe({person:t,open:e,onOpenChange:n}){if(!t)return null;const r=s=>s?new Date(s*1e3).toLocaleString("zh-CN"):"-";return o.jsx(Dr,{open:e,onOpenChange:n,children:o.jsxs(Sr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[o.jsxs(kr,{children:[o.jsx(Or,{children:"人物详情"}),o.jsxs(ss,{children:["查看 ",t.person_name||t.nickname||t.user_id," 的完整信息"]})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsx(bl,{icon:Dv,label:"人物名称",value:t.person_name}),o.jsx(bl,{icon:Wh,label:"昵称",value:t.nickname}),o.jsx(bl,{icon:ik,label:"用户ID",value:t.user_id,mono:!0}),o.jsx(bl,{icon:ik,label:"人物ID",value:t.person_id,mono:!0}),o.jsx(bl,{label:"平台",value:t.platform}),o.jsx(bl,{label:"状态",value:t.is_known?"已认识":"未认识"})]}),t.name_reason&&o.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[o.jsx(he,{className:"text-xs text-muted-foreground",children:"名称设定原因"}),o.jsx("p",{className:"mt-1 text-sm",children:t.name_reason})]}),t.memory_points&&o.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[o.jsx(he,{className:"text-xs text-muted-foreground",children:"个人印象"}),o.jsx("p",{className:"mt-1 text-sm whitespace-pre-wrap",children:t.memory_points})]}),t.group_nick_name&&t.group_nick_name.length>0&&o.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[o.jsx(he,{className:"text-xs text-muted-foreground",children:"群昵称"}),o.jsx("div",{className:"mt-2 space-y-1",children:t.group_nick_name.map((s,i)=>o.jsxs("div",{className:"text-sm flex items-center gap-2",children:[o.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:s.group_id}),o.jsx("span",{children:"→"}),o.jsx("span",{children:s.group_nick_name})]},i))})]}),o.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[o.jsx(bl,{icon:_h,label:"认识时间",value:r(t.know_times)}),o.jsx(bl,{icon:_h,label:"首次记录",value:r(t.know_since)}),o.jsx(bl,{icon:_h,label:"最后更新",value:r(t.last_know)})]})]}),o.jsx(ws,{children:o.jsx(de,{onClick:()=>n(!1),children:"关闭"})})]})})}function bl({icon:t,label:e,value:n,mono:r=!1}){return o.jsxs("div",{className:"space-y-1",children:[o.jsxs(he,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[t&&o.jsx(t,{className:"h-3 w-3"}),e]}),o.jsx("div",{className:xe("text-sm",r&&"font-mono",!n&&"text-muted-foreground"),children:n||"-"})]})}function BOe({person:t,open:e,onOpenChange:n,onSuccess:r}){const[s,i]=b.useState({}),[a,l]=b.useState(!1),{toast:c}=as();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 d=async()=>{if(t)try{l(!0),await ROe(t.person_id,s),c({title:"保存成功",description:"人物信息已更新"}),r()}catch(h){c({title:"保存失败",description:h instanceof Error?h.message:"无法更新人物信息",variant:"destructive"})}finally{l(!1)}};return t?o.jsx(Dr,{open:e,onOpenChange:n,children:o.jsxs(Sr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[o.jsxs(kr,{children:[o.jsx(Or,{children:"编辑人物信息"}),o.jsxs(ss,{children:["修改 ",t.person_name||t.nickname||t.user_id," 的信息"]})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{htmlFor:"person_name",children:"人物名称"}),o.jsx(ze,{id:"person_name",value:s.person_name||"",onChange:h=>i({...s,person_name:h.target.value}),placeholder:"为这个人设置一个名称"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{htmlFor:"nickname",children:"昵称"}),o.jsx(ze,{id:"nickname",value:s.nickname||"",onChange:h=>i({...s,nickname:h.target.value}),placeholder:"昵称"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{htmlFor:"name_reason",children:"名称设定原因"}),o.jsx(Mr,{id:"name_reason",value:s.name_reason||"",onChange:h=>i({...s,name_reason:h.target.value}),placeholder:"为什么这样称呼这个人?",rows:2})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{htmlFor:"memory_points",children:"个人印象"}),o.jsx(Mr,{id:"memory_points",value:s.memory_points||"",onChange:h=>i({...s,memory_points:h.target.value}),placeholder:"对这个人的印象和记忆点...",rows:4})]}),o.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[o.jsxs("div",{children:[o.jsx(he,{htmlFor:"is_known",className:"text-base font-medium",children:"已认识"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"标记是否已经认识这个人"})]}),o.jsx(Bt,{id:"is_known",checked:s.is_known,onCheckedChange:h=>i({...s,is_known:h})})]})]}),o.jsxs(ws,{children:[o.jsx(de,{variant:"outline",onClick:()=>n(!1),children:"取消"}),o.jsx(de,{onClick:d,disabled:a,children:a?"保存中...":"保存"})]})]})}):null}function Bs(t){if(typeof t=="string"||typeof t=="number")return""+t;let e="";if(Array.isArray(t))for(let n=0,r;n<t.length;n++)(r=Bs(t[n]))!==""&&(e+=(e&&" ")+r);else for(let n in t)t[n]&&(e+=(e&&" ")+n);return e}const FOe={},JR=t=>{let e;const n=new Set,r=(h,m)=>{const g=typeof h=="function"?h(e):h;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:()=>d,subscribe:h=>(n.add(h),()=>n.delete(h)),destroy:()=>{(FOe?"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()}},d=e=t(r,s,c);return c},qOe=t=>t?JR(t):JR,{useDebugValue:$Oe}=ae,{useSyncExternalStoreWithSelector:HOe}=pJ,QOe=t=>t;function KU(t,e=QOe,n){const r=HOe(t.subscribe,t.getState,t.getServerState||t.getInitialState,e,n);return $Oe(r),r}const eD=(t,e)=>{const n=qOe(t),r=(s,i=e)=>KU(n,s,i);return Object.assign(r,n),r},VOe=(t,e)=>t?eD(t,e):eD;function ks(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 UOe={value:()=>{}};function Gb(){for(var t=0,e=arguments.length,n={},r;t<e;++t){if(!(r=arguments[t]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new jv(n)}function jv(t){this._=t}function WOe(t,e){return t.trim().split(/^|\s+/).map(function(n){var r="",s=n.indexOf(".");if(s>=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}})}jv.prototype=Gb.prototype={constructor:jv,on:function(t,e){var n=this._,r=WOe(t+"",n),s,i=-1,a=r.length;if(arguments.length<2){for(;++i<a;)if((s=(t=r[i]).type)&&(s=GOe(n[s],t.name)))return s;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++i<a;)if(s=(t=r[i]).type)n[s]=tD(n[s],t.name,e);else if(e==null)for(s in n)n[s]=tD(n[s],t.name,null);return this},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new jv(t)},call:function(t,e){if((s=arguments.length-2)>0)for(var n=new Array(s),r=0,s,i;r<s;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(i=this._[t],r=0,s=i.length;r<s;++r)i[r].value.apply(e,n)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],s=0,i=r.length;s<i;++s)r[s].value.apply(e,n)}};function GOe(t,e){for(var n=0,r=t.length,s;n<r;++n)if((s=t[n]).name===e)return s.value}function tD(t,e,n){for(var r=0,s=t.length;r<s;++r)if(t[r].name===e){t[r]=UOe,t=t.slice(0,r).concat(t.slice(r+1));break}return n!=null&&t.push({name:e,value:n}),t}var XO="http://www.w3.org/1999/xhtml";const nD={svg:"http://www.w3.org/2000/svg",xhtml:XO,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Xb(t){var e=t+="",n=e.indexOf(":");return n>=0&&(e=t.slice(0,n))!=="xmlns"&&(t=t.slice(n+1)),nD.hasOwnProperty(e)?{space:nD[e],local:t}:t}function XOe(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===XO&&e.documentElement.namespaceURI===XO?e.createElement(t):e.createElementNS(n,t)}}function YOe(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function ZU(t){var e=Xb(t);return(e.local?YOe:XOe)(e)}function KOe(){}function VN(t){return t==null?KOe:function(){return this.querySelector(t)}}function ZOe(t){typeof t!="function"&&(t=VN(t));for(var e=this._groups,n=e.length,r=new Array(n),s=0;s<n;++s)for(var i=e[s],a=i.length,l=r[s]=new Array(a),c,d,h=0;h<a;++h)(c=i[h])&&(d=t.call(c,c.__data__,h,i))&&("__data__"in c&&(d.__data__=c.__data__),l[h]=d);return new Yi(r,this._parents)}function JOe(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}function eje(){return[]}function JU(t){return t==null?eje:function(){return this.querySelectorAll(t)}}function tje(t){return function(){return JOe(t.apply(this,arguments))}}function nje(t){typeof t=="function"?t=tje(t):t=JU(t);for(var e=this._groups,n=e.length,r=[],s=[],i=0;i<n;++i)for(var a=e[i],l=a.length,c,d=0;d<l;++d)(c=a[d])&&(r.push(t.call(c,c.__data__,d,a)),s.push(c));return new Yi(r,s)}function eW(t){return function(){return this.matches(t)}}function tW(t){return function(e){return e.matches(t)}}var rje=Array.prototype.find;function sje(t){return function(){return rje.call(this.children,t)}}function ije(){return this.firstElementChild}function aje(t){return this.select(t==null?ije:sje(typeof t=="function"?t:tW(t)))}var oje=Array.prototype.filter;function lje(){return Array.from(this.children)}function cje(t){return function(){return oje.call(this.children,t)}}function uje(t){return this.selectAll(t==null?lje:cje(typeof t=="function"?t:tW(t)))}function dje(t){typeof t!="function"&&(t=eW(t));for(var e=this._groups,n=e.length,r=new Array(n),s=0;s<n;++s)for(var i=e[s],a=i.length,l=r[s]=[],c,d=0;d<a;++d)(c=i[d])&&t.call(c,c.__data__,d,i)&&l.push(c);return new Yi(r,this._parents)}function nW(t){return new Array(t.length)}function hje(){return new Yi(this._enter||this._groups.map(nW),this._parents)}function Cy(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}Cy.prototype={constructor:Cy,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};function fje(t){return function(){return t}}function mje(t,e,n,r,s,i){for(var a=0,l,c=e.length,d=i.length;a<d;++a)(l=e[a])?(l.__data__=i[a],r[a]=l):n[a]=new Cy(t,i[a]);for(;a<c;++a)(l=e[a])&&(s[a]=l)}function pje(t,e,n,r,s,i,a){var l,c,d=new Map,h=e.length,m=i.length,g=new Array(h),x;for(l=0;l<h;++l)(c=e[l])&&(g[l]=x=a.call(c,c.__data__,l,e)+"",d.has(x)?s[l]=c:d.set(x,c));for(l=0;l<m;++l)x=a.call(t,i[l],l,i)+"",(c=d.get(x))?(r[l]=c,c.__data__=i[l],d.delete(x)):n[l]=new Cy(t,i[l]);for(l=0;l<h;++l)(c=e[l])&&d.get(g[l])===c&&(s[l]=c)}function gje(t){return t.__data__}function xje(t,e){if(!arguments.length)return Array.from(this,gje);var n=e?pje:mje,r=this._parents,s=this._groups;typeof t!="function"&&(t=fje(t));for(var i=s.length,a=new Array(i),l=new Array(i),c=new Array(i),d=0;d<i;++d){var h=r[d],m=s[d],g=m.length,x=vje(t.call(h,h&&h.__data__,d,r)),y=x.length,w=l[d]=new Array(y),S=a[d]=new Array(y),k=c[d]=new Array(g);n(h,m,w,S,k,x,e);for(var j=0,N=0,T,E;j<y;++j)if(T=w[j]){for(j>=N&&(N=j+1);!(E=S[N])&&++N<y;);T._next=E||null}}return a=new Yi(a,r),a._enter=l,a._exit=c,a}function vje(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function yje(){return new Yi(this._exit||this._groups.map(nW),this._parents)}function bje(t,e,n){var r=this.enter(),s=this,i=this.exit();return typeof t=="function"?(r=t(r),r&&(r=r.selection())):r=r.append(t+""),e!=null&&(s=e(s),s&&(s=s.selection())),n==null?i.remove():n(i),r&&s?r.merge(s).order():s}function wje(t){for(var e=t.selection?t.selection():t,n=this._groups,r=e._groups,s=n.length,i=r.length,a=Math.min(s,i),l=new Array(s),c=0;c<a;++c)for(var d=n[c],h=r[c],m=d.length,g=l[c]=new Array(m),x,y=0;y<m;++y)(x=d[y]||h[y])&&(g[y]=x);for(;c<s;++c)l[c]=n[c];return new Yi(l,this._parents)}function Sje(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var r=t[e],s=r.length-1,i=r[s],a;--s>=0;)(a=r[s])&&(i&&a.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(a,i),i=a);return this}function kje(t){t||(t=Oje);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;i<r;++i){for(var a=n[i],l=a.length,c=s[i]=new Array(l),d,h=0;h<l;++h)(d=a[h])&&(c[h]=d);c.sort(e)}return new Yi(s,this._parents).order()}function Oje(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function jje(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function Nje(){return Array.from(this)}function Cje(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],s=0,i=r.length;s<i;++s){var a=r[s];if(a)return a}return null}function Tje(){let t=0;for(const e of this)++t;return t}function Eje(){return!this.node()}function _je(t){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var s=e[n],i=0,a=s.length,l;i<a;++i)(l=s[i])&&t.call(l,l.__data__,i,s);return this}function Aje(t){return function(){this.removeAttribute(t)}}function Mje(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Rje(t,e){return function(){this.setAttribute(t,e)}}function Dje(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function Pje(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttribute(t):this.setAttribute(t,n)}}function zje(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function Ije(t,e){var n=Xb(t);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((e==null?n.local?Mje:Aje:typeof e=="function"?n.local?zje:Pje:n.local?Dje:Rje)(n,e))}function rW(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function Lje(t){return function(){this.style.removeProperty(t)}}function Bje(t,e,n){return function(){this.style.setProperty(t,e,n)}}function Fje(t,e,n){return function(){var r=e.apply(this,arguments);r==null?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}function qje(t,e,n){return arguments.length>1?this.each((e==null?Lje:typeof e=="function"?Fje:Bje)(t,e,n??"")):mf(this.node(),t)}function mf(t,e){return t.style.getPropertyValue(e)||rW(t).getComputedStyle(t,null).getPropertyValue(e)}function $je(t){return function(){delete this[t]}}function Hje(t,e){return function(){this[t]=e}}function Qje(t,e){return function(){var n=e.apply(this,arguments);n==null?delete this[t]:this[t]=n}}function Vje(t,e){return arguments.length>1?this.each((e==null?$je:typeof e=="function"?Qje:Hje)(t,e)):this.node()[t]}function sW(t){return t.trim().split(/^|\s+/)}function UN(t){return t.classList||new iW(t)}function iW(t){this._node=t,this._names=sW(t.getAttribute("class")||"")}iW.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 aW(t,e){for(var n=UN(t),r=-1,s=e.length;++r<s;)n.add(e[r])}function oW(t,e){for(var n=UN(t),r=-1,s=e.length;++r<s;)n.remove(e[r])}function Uje(t){return function(){aW(this,t)}}function Wje(t){return function(){oW(this,t)}}function Gje(t,e){return function(){(e.apply(this,arguments)?aW:oW)(this,t)}}function Xje(t,e){var n=sW(t+"");if(arguments.length<2){for(var r=UN(this.node()),s=-1,i=n.length;++s<i;)if(!r.contains(n[s]))return!1;return!0}return this.each((typeof e=="function"?Gje:e?Uje:Wje)(n,e))}function Yje(){this.textContent=""}function Kje(t){return function(){this.textContent=t}}function Zje(t){return function(){var e=t.apply(this,arguments);this.textContent=e??""}}function Jje(t){return arguments.length?this.each(t==null?Yje:(typeof t=="function"?Zje:Kje)(t)):this.node().textContent}function e6e(){this.innerHTML=""}function t6e(t){return function(){this.innerHTML=t}}function n6e(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e??""}}function r6e(t){return arguments.length?this.each(t==null?e6e:(typeof t=="function"?n6e:t6e)(t)):this.node().innerHTML}function s6e(){this.nextSibling&&this.parentNode.appendChild(this)}function i6e(){return this.each(s6e)}function a6e(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function o6e(){return this.each(a6e)}function l6e(t){var e=typeof t=="function"?t:ZU(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function c6e(){return null}function u6e(t,e){var n=typeof t=="function"?t:ZU(t),r=e==null?c6e:typeof e=="function"?e:VN(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function d6e(){var t=this.parentNode;t&&t.removeChild(this)}function h6e(){return this.each(d6e)}function f6e(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function m6e(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function p6e(t){return this.select(t?m6e:f6e)}function g6e(t){return arguments.length?this.property("__data__",t):this.node().__data__}function x6e(t){return function(e){t.call(this,e,this.__data__)}}function v6e(t){return t.trim().split(/^|\s+/).map(function(e){var n="",r=e.indexOf(".");return r>=0&&(n=e.slice(r+1),e=e.slice(0,r)),{type:e,name:n}})}function y6e(t){return function(){var e=this.__on;if(e){for(var n=0,r=-1,s=e.length,i;n<s;++n)i=e[n],(!t.type||i.type===t.type)&&i.name===t.name?this.removeEventListener(i.type,i.listener,i.options):e[++r]=i;++r?e.length=r:delete this.__on}}}function b6e(t,e,n){return function(){var r=this.__on,s,i=x6e(e);if(r){for(var a=0,l=r.length;a<l;++a)if((s=r[a]).type===t.type&&s.name===t.name){this.removeEventListener(s.type,s.listener,s.options),this.addEventListener(s.type,s.listener=i,s.options=n),s.value=e;return}}this.addEventListener(t.type,i,n),s={type:t.type,name:t.name,value:e,listener:i,options:n},r?r.push(s):this.__on=[s]}}function w6e(t,e,n){var r=v6e(t+""),s,i=r.length,a;if(arguments.length<2){var l=this.node().__on;if(l){for(var c=0,d=l.length,h;c<d;++c)for(s=0,h=l[c];s<i;++s)if((a=r[s]).type===h.type&&a.name===h.name)return h.value}return}for(l=e?b6e:y6e,s=0;s<i;++s)this.each(l(r[s],e,n));return this}function lW(t,e,n){var r=rW(t),s=r.CustomEvent;typeof s=="function"?s=new s(e,n):(s=r.document.createEvent("Event"),n?(s.initEvent(e,n.bubbles,n.cancelable),s.detail=n.detail):s.initEvent(e,!1,!1)),t.dispatchEvent(s)}function S6e(t,e){return function(){return lW(this,t,e)}}function k6e(t,e){return function(){return lW(this,t,e.apply(this,arguments))}}function O6e(t,e){return this.each((typeof e=="function"?k6e:S6e)(t,e))}function*j6e(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],s=0,i=r.length,a;s<i;++s)(a=r[s])&&(yield a)}var cW=[null];function Yi(t,e){this._groups=t,this._parents=e}function xg(){return new Yi([[document.documentElement]],cW)}function N6e(){return this}Yi.prototype=xg.prototype={constructor:Yi,select:ZOe,selectAll:nje,selectChild:aje,selectChildren:uje,filter:dje,data:xje,enter:hje,exit:yje,join:bje,merge:wje,selection:N6e,order:Sje,sort:kje,call:jje,nodes:Nje,node:Cje,size:Tje,empty:Eje,each:_je,attr:Ije,style:qje,property:Vje,classed:Xje,text:Jje,html:r6e,raise:i6e,lower:o6e,append:l6e,insert:u6e,remove:h6e,clone:p6e,datum:g6e,on:w6e,dispatch:O6e,[Symbol.iterator]:j6e};function ma(t){return typeof t=="string"?new Yi([[document.querySelector(t)]],[document.documentElement]):new Yi([[t]],cW)}function C6e(t){let e;for(;e=t.sourceEvent;)t=e;return t}function Ha(t,e){if(t=C6e(t),e===void 0&&(e=t.currentTarget),e){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=t.clientX,r.y=t.clientY,r=r.matrixTransform(e.getScreenCTM().inverse()),[r.x,r.y]}if(e.getBoundingClientRect){var s=e.getBoundingClientRect();return[t.clientX-s.left-e.clientLeft,t.clientY-s.top-e.clientTop]}}return[t.pageX,t.pageY]}const T6e={passive:!1},yp={capture:!0,passive:!1};function o5(t){t.stopImmediatePropagation()}function Hh(t){t.preventDefault(),t.stopImmediatePropagation()}function uW(t){var e=t.document.documentElement,n=ma(t).on("dragstart.drag",Hh,yp);"onselectstart"in e?n.on("selectstart.drag",Hh,yp):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function dW(t,e){var n=t.document.documentElement,r=ma(t).on("dragstart.drag",null);e&&(r.on("click.drag",Hh,yp),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const F1=t=>()=>t;function YO(t,{sourceEvent:e,subject:n,target:r,identifier:s,active:i,x:a,y:l,dx:c,dy:d,dispatch:h}){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:l,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:d,enumerable:!0,configurable:!0},_:{value:h}})}YO.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};function E6e(t){return!t.ctrlKey&&!t.button}function _6e(){return this.parentNode}function A6e(t,e){return e??{x:t.x,y:t.y}}function M6e(){return navigator.maxTouchPoints||"ontouchstart"in this}function R6e(){var t=E6e,e=_6e,n=A6e,r=M6e,s={},i=Gb("start","drag","end"),a=0,l,c,d,h,m=0;function g(T){T.on("mousedown.drag",x).filter(r).on("touchstart.drag",S).on("touchmove.drag",k,T6e).on("touchend.drag touchcancel.drag",j).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function x(T,E){if(!(h||!t.call(this,T,E))){var _=N(this,e.call(this,T,E),T,E,"mouse");_&&(ma(T.view).on("mousemove.drag",y,yp).on("mouseup.drag",w,yp),uW(T.view),o5(T),d=!1,l=T.clientX,c=T.clientY,_("start",T))}}function y(T){if(Hh(T),!d){var E=T.clientX-l,_=T.clientY-c;d=E*E+_*_>m}s.mouse("drag",T)}function w(T){ma(T.view).on("mousemove.drag mouseup.drag",null),dW(T.view,d),Hh(T),s.mouse("end",T)}function S(T,E){if(t.call(this,T,E)){var _=T.changedTouches,A=e.call(this,T,E),L=_.length,P,B;for(P=0;P<L;++P)(B=N(this,A,T,E,_[P].identifier,_[P]))&&(o5(T),B("start",T,_[P]))}}function k(T){var E=T.changedTouches,_=E.length,A,L;for(A=0;A<_;++A)(L=s[E[A].identifier])&&(Hh(T),L("drag",T,E[A]))}function j(T){var E=T.changedTouches,_=E.length,A,L;for(h&&clearTimeout(h),h=setTimeout(function(){h=null},500),A=0;A<_;++A)(L=s[E[A].identifier])&&(o5(T),L("end",T,E[A]))}function N(T,E,_,A,L,P){var B=i.copy(),$=Ha(P||_,E),U,te,z;if((z=n.call(T,new YO("beforestart",{sourceEvent:_,target:g,identifier:L,active:a,x:$[0],y:$[1],dx:0,dy:0,dispatch:B}),A))!=null)return U=z.x-$[0]||0,te=z.y-$[1]||0,function Q(F,Y,J){var X=$,R;switch(F){case"start":s[L]=Q,R=a++;break;case"end":delete s[L],--a;case"drag":$=Ha(J||Y,E),R=a;break}B.call(F,T,new YO(F,{sourceEvent:Y,subject:z,target:g,identifier:L,active:R,x:$[0]+U,y:$[1]+te,dx:$[0]-X[0],dy:$[1]-X[1],dispatch:B}),A)}}return g.filter=function(T){return arguments.length?(t=typeof T=="function"?T:F1(!!T),g):t},g.container=function(T){return arguments.length?(e=typeof T=="function"?T:F1(T),g):e},g.subject=function(T){return arguments.length?(n=typeof T=="function"?T:F1(T),g):n},g.touchable=function(T){return arguments.length?(r=typeof T=="function"?T:F1(!!T),g):r},g.on=function(){var T=i.on.apply(i,arguments);return T===i?g:T},g.clickDistance=function(T){return arguments.length?(m=(T=+T)*T,g):Math.sqrt(m)},g}var pf=0,f0=0,t0=0,hW=1e3,Ty,m0,Ey=0,md=0,Yb=0,bp=typeof performance=="object"&&performance.now?performance:Date,fW=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function WN(){return md||(fW(D6e),md=bp.now()+Yb)}function D6e(){md=0}function _y(){this._call=this._time=this._next=null}_y.prototype=mW.prototype={constructor:_y,restart:function(t,e,n){if(typeof t!="function")throw new TypeError("callback is not a function");n=(n==null?WN():+n)+(e==null?0:+e),!this._next&&m0!==this&&(m0?m0._next=this:Ty=this,m0=this),this._call=t,this._time=n,KO()},stop:function(){this._call&&(this._call=null,this._time=1/0,KO())}};function mW(t,e,n){var r=new _y;return r.restart(t,e,n),r}function P6e(){WN(),++pf;for(var t=Ty,e;t;)(e=md-t._time)>=0&&t._call.call(void 0,e),t=t._next;--pf}function rD(){md=(Ey=bp.now())+Yb,pf=f0=0;try{P6e()}finally{pf=0,I6e(),md=0}}function z6e(){var t=bp.now(),e=t-Ey;e>hW&&(Yb-=e,Ey=t)}function I6e(){for(var t,e=Ty,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:Ty=n);m0=t,KO(r)}function KO(t){if(!pf){f0&&(f0=clearTimeout(f0));var e=t-md;e>24?(t<1/0&&(f0=setTimeout(rD,t-bp.now()-Yb)),t0&&(t0=clearInterval(t0))):(t0||(Ey=bp.now(),t0=setInterval(z6e,hW)),pf=1,fW(rD))}}function sD(t,e,n){var r=new _y;return e=e==null?0:+e,r.restart(s=>{r.stop(),t(s+e)},e,n),r}var L6e=Gb("start","end","cancel","interrupt"),B6e=[],pW=0,iD=1,ZO=2,Nv=3,aD=4,JO=5,Cv=6;function Kb(t,e,n,r,s,i){var a=t.__transition;if(!a)t.__transition={};else if(n in a)return;F6e(t,n,{name:e,index:r,group:s,on:L6e,tween:B6e,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:pW})}function GN(t,e){var n=io(t,e);if(n.state>pW)throw new Error("too late; already scheduled");return n}function Go(t,e){var n=io(t,e);if(n.state>Nv)throw new Error("too late; already running");return n}function io(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function F6e(t,e,n){var r=t.__transition,s;r[e]=n,n.timer=mW(i,0,n.time);function i(d){n.state=iD,n.timer.restart(a,n.delay,n.time),n.delay<=d&&a(d-n.delay)}function a(d){var h,m,g,x;if(n.state!==iD)return c();for(h in r)if(x=r[h],x.name===n.name){if(x.state===Nv)return sD(a);x.state===aD?(x.state=Cv,x.timer.stop(),x.on.call("interrupt",t,t.__data__,x.index,x.group),delete r[h]):+h<e&&(x.state=Cv,x.timer.stop(),x.on.call("cancel",t,t.__data__,x.index,x.group),delete r[h])}if(sD(function(){n.state===Nv&&(n.state=aD,n.timer.restart(l,n.delay,n.time),l(d))}),n.state=ZO,n.on.call("start",t,t.__data__,n.index,n.group),n.state===ZO){for(n.state=Nv,s=new Array(g=n.tween.length),h=0,m=-1;h<g;++h)(x=n.tween[h].value.call(t,t.__data__,n.index,n.group))&&(s[++m]=x);s.length=m+1}}function l(d){for(var h=d<n.duration?n.ease.call(null,d/n.duration):(n.timer.restart(c),n.state=JO,1),m=-1,g=s.length;++m<g;)s[m].call(t,h);n.state===JO&&(n.on.call("end",t,t.__data__,n.index,n.group),c())}function c(){n.state=Cv,n.timer.stop(),delete r[e];for(var d in r)return;delete t.__transition}}function Tv(t,e){var n=t.__transition,r,s,i=!0,a;if(n){e=e==null?null:e+"";for(a in n){if((r=n[a]).name!==e){i=!1;continue}s=r.state>ZO&&r.state<JO,r.state=Cv,r.timer.stop(),r.on.call(s?"interrupt":"cancel",t,t.__data__,r.index,r.group),delete n[a]}i&&delete t.__transition}}function q6e(t){return this.each(function(){Tv(this,t)})}function $6e(t,e){var n,r;return function(){var s=Go(this,t),i=s.tween;if(i!==n){r=n=i;for(var a=0,l=r.length;a<l;++a)if(r[a].name===e){r=r.slice(),r.splice(a,1);break}}s.tween=r}}function H6e(t,e,n){var r,s;if(typeof n!="function")throw new Error;return function(){var i=Go(this,t),a=i.tween;if(a!==r){s=(r=a).slice();for(var l={name:e,value:n},c=0,d=s.length;c<d;++c)if(s[c].name===e){s[c]=l;break}c===d&&s.push(l)}i.tween=s}}function Q6e(t,e){var n=this._id;if(t+="",arguments.length<2){for(var r=io(this.node(),n).tween,s=0,i=r.length,a;s<i;++s)if((a=r[s]).name===t)return a.value;return null}return this.each((e==null?$6e:H6e)(n,t,e))}function XN(t,e,n){var r=t._id;return t.each(function(){var s=Go(this,r);(s.value||(s.value={}))[e]=n.apply(this,arguments)}),function(s){return io(s,r).value[e]}}function gW(t,e){var n;return(typeof e=="number"?PJ:e instanceof v9?x9:(n=v9(e))?(e=n,x9):zJ)(t,e)}function V6e(t){return function(){this.removeAttribute(t)}}function U6e(t){return function(){this.removeAttributeNS(t.space,t.local)}}function W6e(t,e,n){var r,s=n+"",i;return function(){var a=this.getAttribute(t);return a===s?null:a===r?i:i=e(r=a,n)}}function G6e(t,e,n){var r,s=n+"",i;return function(){var a=this.getAttributeNS(t.space,t.local);return a===s?null:a===r?i:i=e(r=a,n)}}function X6e(t,e,n){var r,s,i;return function(){var a,l=n(this),c;return l==null?void this.removeAttribute(t):(a=this.getAttribute(t),c=l+"",a===c?null:a===r&&c===s?i:(s=c,i=e(r=a,l)))}}function Y6e(t,e,n){var r,s,i;return function(){var a,l=n(this),c;return l==null?void this.removeAttributeNS(t.space,t.local):(a=this.getAttributeNS(t.space,t.local),c=l+"",a===c?null:a===r&&c===s?i:(s=c,i=e(r=a,l)))}}function K6e(t,e){var n=Xb(t),r=n==="transform"?IJ:gW;return this.attrTween(t,typeof e=="function"?(n.local?Y6e:X6e)(n,r,XN(this,"attr."+t,e)):e==null?(n.local?U6e:V6e)(n):(n.local?G6e:W6e)(n,r,e))}function Z6e(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}function J6e(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}function eNe(t,e){var n,r;function s(){var i=e.apply(this,arguments);return i!==r&&(n=(r=i)&&J6e(t,i)),n}return s._value=e,s}function tNe(t,e){var n,r;function s(){var i=e.apply(this,arguments);return i!==r&&(n=(r=i)&&Z6e(t,i)),n}return s._value=e,s}function nNe(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;var r=Xb(t);return this.tween(n,(r.local?eNe:tNe)(r,e))}function rNe(t,e){return function(){GN(this,t).delay=+e.apply(this,arguments)}}function sNe(t,e){return e=+e,function(){GN(this,t).delay=e}}function iNe(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?rNe:sNe)(e,t)):io(this.node(),e).delay}function aNe(t,e){return function(){Go(this,t).duration=+e.apply(this,arguments)}}function oNe(t,e){return e=+e,function(){Go(this,t).duration=e}}function lNe(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?aNe:oNe)(e,t)):io(this.node(),e).duration}function cNe(t,e){if(typeof e!="function")throw new Error;return function(){Go(this,t).ease=e}}function uNe(t){var e=this._id;return arguments.length?this.each(cNe(e,t)):io(this.node(),e).ease}function dNe(t,e){return function(){var n=e.apply(this,arguments);if(typeof n!="function")throw new Error;Go(this,t).ease=n}}function hNe(t){if(typeof t!="function")throw new Error;return this.each(dNe(this._id,t))}function fNe(t){typeof t!="function"&&(t=eW(t));for(var e=this._groups,n=e.length,r=new Array(n),s=0;s<n;++s)for(var i=e[s],a=i.length,l=r[s]=[],c,d=0;d<a;++d)(c=i[d])&&t.call(c,c.__data__,d,i)&&l.push(c);return new Wl(r,this._parents,this._name,this._id)}function mNe(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,r=e.length,s=n.length,i=Math.min(r,s),a=new Array(r),l=0;l<i;++l)for(var c=e[l],d=n[l],h=c.length,m=a[l]=new Array(h),g,x=0;x<h;++x)(g=c[x]||d[x])&&(m[x]=g);for(;l<r;++l)a[l]=e[l];return new Wl(a,this._parents,this._name,this._id)}function pNe(t){return(t+"").trim().split(/^|\s+/).every(function(e){var n=e.indexOf(".");return n>=0&&(e=e.slice(0,n)),!e||e==="start"})}function gNe(t,e,n){var r,s,i=pNe(e)?GN:Go;return function(){var a=i(this,t),l=a.on;l!==r&&(s=(r=l).copy()).on(e,n),a.on=s}}function xNe(t,e){var n=this._id;return arguments.length<2?io(this.node(),n).on.on(t):this.each(gNe(n,t,e))}function vNe(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}function yNe(){return this.on("end.remove",vNe(this._id))}function bNe(t){var e=this._name,n=this._id;typeof t!="function"&&(t=VN(t));for(var r=this._groups,s=r.length,i=new Array(s),a=0;a<s;++a)for(var l=r[a],c=l.length,d=i[a]=new Array(c),h,m,g=0;g<c;++g)(h=l[g])&&(m=t.call(h,h.__data__,g,l))&&("__data__"in h&&(m.__data__=h.__data__),d[g]=m,Kb(d[g],e,n,g,d,io(h,n)));return new Wl(i,this._parents,e,n)}function wNe(t){var e=this._name,n=this._id;typeof t!="function"&&(t=JU(t));for(var r=this._groups,s=r.length,i=[],a=[],l=0;l<s;++l)for(var c=r[l],d=c.length,h,m=0;m<d;++m)if(h=c[m]){for(var g=t.call(h,h.__data__,m,c),x,y=io(h,n),w=0,S=g.length;w<S;++w)(x=g[w])&&Kb(x,e,n,w,g,y);i.push(g),a.push(h)}return new Wl(i,a,e,n)}var SNe=xg.prototype.constructor;function kNe(){return new SNe(this._groups,this._parents)}function ONe(t,e){var n,r,s;return function(){var i=mf(this,t),a=(this.style.removeProperty(t),mf(this,t));return i===a?null:i===n&&a===r?s:s=e(n=i,r=a)}}function xW(t){return function(){this.style.removeProperty(t)}}function jNe(t,e,n){var r,s=n+"",i;return function(){var a=mf(this,t);return a===s?null:a===r?i:i=e(r=a,n)}}function NNe(t,e,n){var r,s,i;return function(){var a=mf(this,t),l=n(this),c=l+"";return l==null&&(c=l=(this.style.removeProperty(t),mf(this,t))),a===c?null:a===r&&c===s?i:(s=c,i=e(r=a,l))}}function CNe(t,e){var n,r,s,i="style."+e,a="end."+i,l;return function(){var c=Go(this,t),d=c.on,h=c.value[i]==null?l||(l=xW(e)):void 0;(d!==n||s!==h)&&(r=(n=d).copy()).on(a,s=h),c.on=r}}function TNe(t,e,n){var r=(t+="")=="transform"?LJ:gW;return e==null?this.styleTween(t,ONe(t,r)).on("end.style."+t,xW(t)):typeof e=="function"?this.styleTween(t,NNe(t,r,XN(this,"style."+t,e))).each(CNe(this._id,t)):this.styleTween(t,jNe(t,r,e),n).on("end.style."+t,null)}function ENe(t,e,n){return function(r){this.style.setProperty(t,e.call(this,r),n)}}function _Ne(t,e,n){var r,s;function i(){var a=e.apply(this,arguments);return a!==s&&(r=(s=a)&&ENe(t,a,n)),r}return i._value=e,i}function ANe(t,e,n){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(e==null)return this.tween(r,null);if(typeof e!="function")throw new Error;return this.tween(r,_Ne(t,e,n??""))}function MNe(t){return function(){this.textContent=t}}function RNe(t){return function(){var e=t(this);this.textContent=e??""}}function DNe(t){return this.tween("text",typeof t=="function"?RNe(XN(this,"text",t)):MNe(t==null?"":t+""))}function PNe(t){return function(e){this.textContent=t.call(this,e)}}function zNe(t){var e,n;function r(){var s=t.apply(this,arguments);return s!==n&&(e=(n=s)&&PNe(s)),e}return r._value=t,r}function INe(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(t==null)return this.tween(e,null);if(typeof t!="function")throw new Error;return this.tween(e,zNe(t))}function LNe(){for(var t=this._name,e=this._id,n=vW(),r=this._groups,s=r.length,i=0;i<s;++i)for(var a=r[i],l=a.length,c,d=0;d<l;++d)if(c=a[d]){var h=io(c,e);Kb(c,t,n,d,a,{time:h.time+h.delay+h.duration,delay:0,duration:h.duration,ease:h.ease})}return new Wl(r,this._parents,t,n)}function BNe(){var t,e,n=this,r=n._id,s=n.size();return new Promise(function(i,a){var l={value:a},c={value:function(){--s===0&&i()}};n.each(function(){var d=Go(this,r),h=d.on;h!==t&&(e=(t=h).copy(),e._.cancel.push(l),e._.interrupt.push(l),e._.end.push(c)),d.on=e}),s===0&&i()})}var FNe=0;function Wl(t,e,n,r){this._groups=t,this._parents=e,this._name=n,this._id=r}function vW(){return++FNe}var wl=xg.prototype;Wl.prototype={constructor:Wl,select:bNe,selectAll:wNe,selectChild:wl.selectChild,selectChildren:wl.selectChildren,filter:fNe,merge:mNe,selection:kNe,transition:LNe,call:wl.call,nodes:wl.nodes,node:wl.node,size:wl.size,empty:wl.empty,each:wl.each,on:xNe,attr:K6e,attrTween:nNe,style:TNe,styleTween:ANe,text:DNe,textTween:INe,remove:yNe,tween:Q6e,delay:iNe,duration:lNe,ease:uNe,easeVarying:hNe,end:BNe,[Symbol.iterator]:wl[Symbol.iterator]};function qNe(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var $Ne={time:null,delay:0,duration:250,ease:qNe};function HNe(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return n}function QNe(t){var e,n;t instanceof Wl?(e=t._id,t=t._name):(e=vW(),(n=$Ne).time=WN(),t=t==null?null:t+"");for(var r=this._groups,s=r.length,i=0;i<s;++i)for(var a=r[i],l=a.length,c,d=0;d<l;++d)(c=a[d])&&Kb(c,t,e,d,a,n||HNe(c,e));return new Wl(r,this._parents,t,e)}xg.prototype.interrupt=q6e;xg.prototype.transition=QNe;const q1=t=>()=>t;function VNe(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 Rl(t,e,n){this.k=t,this.x=e,this.y=n}Rl.prototype={constructor:Rl,scale:function(t){return t===1?this:new Rl(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new Rl(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 Fl=new Rl(1,0,0);Rl.prototype;function l5(t){t.stopImmediatePropagation()}function n0(t){t.preventDefault(),t.stopImmediatePropagation()}function UNe(t){return(!t.ctrlKey||t.type==="wheel")&&!t.button}function WNe(){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 oD(){return this.__zoom||Fl}function GNe(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function XNe(){return navigator.maxTouchPoints||"ontouchstart"in this}function YNe(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 yW(){var t=UNe,e=WNe,n=YNe,r=GNe,s=XNe,i=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],l=250,c=BJ,d=Gb("start","zoom","end"),h,m,g,x=500,y=150,w=0,S=10;function k(z){z.property("__zoom",oD).on("wheel.zoom",L,{passive:!1}).on("mousedown.zoom",P).on("dblclick.zoom",B).filter(s).on("touchstart.zoom",$).on("touchmove.zoom",U).on("touchend.zoom touchcancel.zoom",te).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}k.transform=function(z,Q,F,Y){var J=z.selection?z.selection():z;J.property("__zoom",oD),z!==J?E(z,Q,F,Y):J.interrupt().each(function(){_(this,arguments).event(Y).start().zoom(null,typeof Q=="function"?Q.apply(this,arguments):Q).end()})},k.scaleBy=function(z,Q,F,Y){k.scaleTo(z,function(){var J=this.__zoom.k,X=typeof Q=="function"?Q.apply(this,arguments):Q;return J*X},F,Y)},k.scaleTo=function(z,Q,F,Y){k.transform(z,function(){var J=e.apply(this,arguments),X=this.__zoom,R=F==null?T(J):typeof F=="function"?F.apply(this,arguments):F,ie=X.invert(R),G=typeof Q=="function"?Q.apply(this,arguments):Q;return n(N(j(X,G),R,ie),J,a)},F,Y)},k.translateBy=function(z,Q,F,Y){k.transform(z,function(){return n(this.__zoom.translate(typeof Q=="function"?Q.apply(this,arguments):Q,typeof F=="function"?F.apply(this,arguments):F),e.apply(this,arguments),a)},null,Y)},k.translateTo=function(z,Q,F,Y,J){k.transform(z,function(){var X=e.apply(this,arguments),R=this.__zoom,ie=Y==null?T(X):typeof Y=="function"?Y.apply(this,arguments):Y;return n(Fl.translate(ie[0],ie[1]).scale(R.k).translate(typeof Q=="function"?-Q.apply(this,arguments):-Q,typeof F=="function"?-F.apply(this,arguments):-F),X,a)},Y,J)};function j(z,Q){return Q=Math.max(i[0],Math.min(i[1],Q)),Q===z.k?z:new Rl(Q,z.x,z.y)}function N(z,Q,F){var Y=Q[0]-F[0]*z.k,J=Q[1]-F[1]*z.k;return Y===z.x&&J===z.y?z:new Rl(z.k,Y,J)}function T(z){return[(+z[0][0]+ +z[1][0])/2,(+z[0][1]+ +z[1][1])/2]}function E(z,Q,F,Y){z.on("start.zoom",function(){_(this,arguments).event(Y).start()}).on("interrupt.zoom end.zoom",function(){_(this,arguments).event(Y).end()}).tween("zoom",function(){var J=this,X=arguments,R=_(J,X).event(Y),ie=e.apply(J,X),G=F==null?T(ie):typeof F=="function"?F.apply(J,X):F,I=Math.max(ie[1][0]-ie[0][0],ie[1][1]-ie[0][1]),V=J.__zoom,ee=typeof Q=="function"?Q.apply(J,X):Q,ne=c(V.invert(G).concat(I/V.k),ee.invert(G).concat(I/ee.k));return function(W){if(W===1)W=ee;else{var se=ne(W),re=I/se[2];W=new Rl(re,G[0]-se[0]*re,G[1]-se[1]*re)}R.zoom(null,W)}})}function _(z,Q,F){return!F&&z.__zooming||new A(z,Q)}function A(z,Q){this.that=z,this.args=Q,this.active=0,this.sourceEvent=null,this.extent=e.apply(z,Q),this.taps=0}A.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,Q){return this.mouse&&z!=="mouse"&&(this.mouse[1]=Q.invert(this.mouse[0])),this.touch0&&z!=="touch"&&(this.touch0[1]=Q.invert(this.touch0[0])),this.touch1&&z!=="touch"&&(this.touch1[1]=Q.invert(this.touch1[0])),this.that.__zoom=Q,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(z){var Q=ma(this.that).datum();d.call(z,this.that,new VNe(z,{sourceEvent:this.sourceEvent,target:k,transform:this.that.__zoom,dispatch:d}),Q)}};function L(z,...Q){if(!t.apply(this,arguments))return;var F=_(this,Q).event(z),Y=this.__zoom,J=Math.max(i[0],Math.min(i[1],Y.k*Math.pow(2,r.apply(this,arguments)))),X=Ha(z);if(F.wheel)(F.mouse[0][0]!==X[0]||F.mouse[0][1]!==X[1])&&(F.mouse[1]=Y.invert(F.mouse[0]=X)),clearTimeout(F.wheel);else{if(Y.k===J)return;F.mouse=[X,Y.invert(X)],Tv(this),F.start()}n0(z),F.wheel=setTimeout(R,y),F.zoom("mouse",n(N(j(Y,J),F.mouse[0],F.mouse[1]),F.extent,a));function R(){F.wheel=null,F.end()}}function P(z,...Q){if(g||!t.apply(this,arguments))return;var F=z.currentTarget,Y=_(this,Q,!0).event(z),J=ma(z.view).on("mousemove.zoom",G,!0).on("mouseup.zoom",I,!0),X=Ha(z,F),R=z.clientX,ie=z.clientY;uW(z.view),l5(z),Y.mouse=[X,this.__zoom.invert(X)],Tv(this),Y.start();function G(V){if(n0(V),!Y.moved){var ee=V.clientX-R,ne=V.clientY-ie;Y.moved=ee*ee+ne*ne>w}Y.event(V).zoom("mouse",n(N(Y.that.__zoom,Y.mouse[0]=Ha(V,F),Y.mouse[1]),Y.extent,a))}function I(V){J.on("mousemove.zoom mouseup.zoom",null),dW(V.view,Y.moved),n0(V),Y.event(V).end()}}function B(z,...Q){if(t.apply(this,arguments)){var F=this.__zoom,Y=Ha(z.changedTouches?z.changedTouches[0]:z,this),J=F.invert(Y),X=F.k*(z.shiftKey?.5:2),R=n(N(j(F,X),Y,J),e.apply(this,Q),a);n0(z),l>0?ma(this).transition().duration(l).call(E,R,Y,z):ma(this).call(k.transform,R,Y,z)}}function $(z,...Q){if(t.apply(this,arguments)){var F=z.touches,Y=F.length,J=_(this,Q,z.changedTouches.length===Y).event(z),X,R,ie,G;for(l5(z),R=0;R<Y;++R)ie=F[R],G=Ha(ie,this),G=[G,this.__zoom.invert(G),ie.identifier],J.touch0?!J.touch1&&J.touch0[2]!==G[2]&&(J.touch1=G,J.taps=0):(J.touch0=G,X=!0,J.taps=1+!!h);h&&(h=clearTimeout(h)),X&&(J.taps<2&&(m=G[0],h=setTimeout(function(){h=null},x)),Tv(this),J.start())}}function U(z,...Q){if(this.__zooming){var F=_(this,Q).event(z),Y=z.changedTouches,J=Y.length,X,R,ie,G;for(n0(z),X=0;X<J;++X)R=Y[X],ie=Ha(R,this),F.touch0&&F.touch0[2]===R.identifier?F.touch0[0]=ie:F.touch1&&F.touch1[2]===R.identifier&&(F.touch1[0]=ie);if(R=F.that.__zoom,F.touch1){var I=F.touch0[0],V=F.touch0[1],ee=F.touch1[0],ne=F.touch1[1],W=(W=ee[0]-I[0])*W+(W=ee[1]-I[1])*W,se=(se=ne[0]-V[0])*se+(se=ne[1]-V[1])*se;R=j(R,Math.sqrt(W/se)),ie=[(I[0]+ee[0])/2,(I[1]+ee[1])/2],G=[(V[0]+ne[0])/2,(V[1]+ne[1])/2]}else if(F.touch0)ie=F.touch0[0],G=F.touch0[1];else return;F.zoom("touch",n(N(R,ie,G),F.extent,a))}}function te(z,...Q){if(this.__zooming){var F=_(this,Q).event(z),Y=z.changedTouches,J=Y.length,X,R;for(l5(z),g&&clearTimeout(g),g=setTimeout(function(){g=null},x),X=0;X<J;++X)R=Y[X],F.touch0&&F.touch0[2]===R.identifier?delete F.touch0:F.touch1&&F.touch1[2]===R.identifier&&delete F.touch1;if(F.touch1&&!F.touch0&&(F.touch0=F.touch1,delete F.touch1),F.touch0)F.touch0[1]=this.__zoom.invert(F.touch0[0]);else if(F.end(),F.taps===2&&(R=Ha(R,this),Math.hypot(m[0]-R[0],m[1]-R[1])<S)){var ie=ma(this).on("dblclick.zoom");ie&&ie.apply(this,arguments)}}}return k.wheelDelta=function(z){return arguments.length?(r=typeof z=="function"?z:q1(+z),k):r},k.filter=function(z){return arguments.length?(t=typeof z=="function"?z:q1(!!z),k):t},k.touchable=function(z){return arguments.length?(s=typeof z=="function"?z:q1(!!z),k):s},k.extent=function(z){return arguments.length?(e=typeof z=="function"?z:q1([[+z[0][0],+z[0][1]],[+z[1][0],+z[1][1]]]),k):e},k.scaleExtent=function(z){return arguments.length?(i[0]=+z[0],i[1]=+z[1],k):[i[0],i[1]]},k.translateExtent=function(z){return arguments.length?(a[0][0]=+z[0][0],a[1][0]=+z[1][0],a[0][1]=+z[0][1],a[1][1]=+z[1][1],k):[[a[0][0],a[0][1]],[a[1][0],a[1][1]]]},k.constrain=function(z){return arguments.length?(n=z,k):n},k.duration=function(z){return arguments.length?(l=+z,k):l},k.interpolate=function(z){return arguments.length?(c=z,k):c},k.on=function(){var z=d.on.apply(d,arguments);return z===d?k:z},k.clickDistance=function(z){return arguments.length?(w=(z=+z)*z,k):Math.sqrt(w)},k.tapDistance=function(z){return arguments.length?(S=+z,k):S},k}const Zb=b.createContext(null),KNe=Zb.Provider,Gl={error001:()=>"[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.`},bW=Gl.error001();function hr(t,e){const n=b.useContext(Zb);if(n===null)throw new Error(bW);return KU(n,t,e)}const ps=()=>{const t=b.useContext(Zb);if(t===null)throw new Error(bW);return b.useMemo(()=>({getState:t.getState,setState:t.setState,subscribe:t.subscribe,destroy:t.destroy}),[t])},ZNe=t=>t.userSelectionActive?"none":"all";function Jb({position:t,children:e,className:n,style:r,...s}){const i=hr(ZNe),a=`${t}`.split("-");return ae.createElement("div",{className:Bs(["react-flow__panel",n,...a]),style:{...r,pointerEvents:i},...s},e)}function JNe({proOptions:t,position:e="bottom-right"}){return t?.hideAttribution?null:ae.createElement(Jb,{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"},ae.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}const e7e=({x:t,y:e,label:n,labelStyle:r={},labelShowBg:s=!0,labelBgStyle:i={},labelBgPadding:a=[2,4],labelBgBorderRadius:l=2,children:c,className:d,...h})=>{const m=b.useRef(null),[g,x]=b.useState({x:0,y:0,width:0,height:0}),y=Bs(["react-flow__edge-textwrapper",d]);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:ae.createElement("g",{transform:`translate(${t-g.width/2} ${e-g.height/2})`,className:y,visibility:g.width?"visible":"hidden",...h},s&&ae.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:l,ry:l}),ae.createElement("text",{className:"react-flow__edge-text",y:g.height/2,dy:"0.3em",ref:m,style:r},n),c)};var t7e=b.memo(e7e);const YN=t=>({width:t.offsetWidth,height:t.offsetHeight}),gf=(t,e=0,n=1)=>Math.min(Math.max(t,e),n),KN=(t={x:0,y:0},e)=>({x:gf(t.x,e[0][0],e[1][0]),y:gf(t.y,e[0][1],e[1][1])}),lD=(t,e,n)=>t<e?gf(Math.abs(t-e),1,50)/50:t>n?-gf(Math.abs(t-n),1,50)/50:0,wW=(t,e)=>{const n=lD(t.x,35,e.width-35)*20,r=lD(t.y,35,e.height-35)*20;return[n,r]},SW=t=>t.getRootNode?.()||window?.document,kW=(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)}),wp=({x:t,y:e,width:n,height:r})=>({x:t,y:e,x2:t+n,y2:e+r}),OW=({x:t,y:e,x2:n,y2:r})=>({x:t,y:e,width:n-t,height:r-e}),cD=t=>({...t.positionAbsolute||{x:0,y:0},width:t.width||0,height:t.height||0}),n7e=(t,e)=>OW(kW(wp(t),wp(e))),ej=(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)},r7e=t=>ka(t.width)&&ka(t.height)&&ka(t.x)&&ka(t.y),ka=t=>!isNaN(t)&&isFinite(t),Lr=Symbol.for("internals"),jW=["Enter"," ","Escape"],s7e=(t,e)=>{},i7e=t=>"nativeEvent"in t;function tj(t){const n=(i7e(t)?t.nativeEvent:t).composedPath?.()?.[0]||t.target;return["INPUT","SELECT","TEXTAREA"].includes(n?.nodeName)||n?.hasAttribute("contenteditable")||!!n?.closest(".nokey")}const NW=t=>"clientX"in t,Hc=(t,e)=>{const n=NW(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)}},Ay=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0,vg=({id:t,path:e,labelX:n,labelY:r,label:s,labelStyle:i,labelShowBg:a,labelBgStyle:l,labelBgPadding:c,labelBgBorderRadius:d,style:h,markerEnd:m,markerStart:g,interactionWidth:x=20})=>ae.createElement(ae.Fragment,null,ae.createElement("path",{id:t,style:h,d:e,fill:"none",className:"react-flow__edge-path",markerEnd:m,markerStart:g}),x&&ae.createElement("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:x,className:"react-flow__edge-interaction"}),s&&ka(n)&&ka(r)?ae.createElement(t7e,{x:n,y:r,label:s,labelStyle:i,labelShowBg:a,labelBgStyle:l,labelBgPadding:c,labelBgBorderRadius:d}):null);vg.displayName="BaseEdge";function r0(t,e,n){return n===void 0?n:r=>{const s=e().edges.find(i=>i.id===t);s&&n(r,{...s})}}function CW({sourceX:t,sourceY:e,targetX:n,targetY:r}){const s=Math.abs(n-t)/2,i=n<t?n+s:n-s,a=Math.abs(r-e)/2,l=r<e?r+a:r-a;return[i,l,s,a]}function TW({sourceX:t,sourceY:e,targetX:n,targetY:r,sourceControlX:s,sourceControlY:i,targetControlX:a,targetControlY:l}){const c=t*.125+s*.375+a*.375+n*.125,d=e*.125+i*.375+l*.375+r*.125,h=Math.abs(c-t),m=Math.abs(d-e);return[c,d,h,m]}var pd;(function(t){t.Strict="strict",t.Loose="loose"})(pd||(pd={}));var Wu;(function(t){t.Free="free",t.Vertical="vertical",t.Horizontal="horizontal"})(Wu||(Wu={}));var Sp;(function(t){t.Partial="partial",t.Full="full"})(Sp||(Sp={}));var Lc;(function(t){t.Bezier="default",t.Straight="straight",t.Step="step",t.SmoothStep="smoothstep",t.SimpleBezier="simplebezier"})(Lc||(Lc={}));var My;(function(t){t.Arrow="arrow",t.ArrowClosed="arrowclosed"})(My||(My={}));var wt;(function(t){t.Left="left",t.Top="top",t.Right="right",t.Bottom="bottom"})(wt||(wt={}));function uD({pos:t,x1:e,y1:n,x2:r,y2:s}){return t===wt.Left||t===wt.Right?[.5*(e+r),n]:[e,.5*(n+s)]}function EW({sourceX:t,sourceY:e,sourcePosition:n=wt.Bottom,targetX:r,targetY:s,targetPosition:i=wt.Top}){const[a,l]=uD({pos:n,x1:t,y1:e,x2:r,y2:s}),[c,d]=uD({pos:i,x1:r,y1:s,x2:t,y2:e}),[h,m,g,x]=TW({sourceX:t,sourceY:e,targetX:r,targetY:s,sourceControlX:a,sourceControlY:l,targetControlX:c,targetControlY:d});return[`M${t},${e} C${a},${l} ${c},${d} ${r},${s}`,h,m,g,x]}const ZN=b.memo(({sourceX:t,sourceY:e,targetX:n,targetY:r,sourcePosition:s=wt.Bottom,targetPosition:i=wt.Top,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:d,labelBgPadding:h,labelBgBorderRadius:m,style:g,markerEnd:x,markerStart:y,interactionWidth:w})=>{const[S,k,j]=EW({sourceX:t,sourceY:e,sourcePosition:s,targetX:n,targetY:r,targetPosition:i});return ae.createElement(vg,{path:S,labelX:k,labelY:j,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:d,labelBgPadding:h,labelBgBorderRadius:m,style:g,markerEnd:x,markerStart:y,interactionWidth:w})});ZN.displayName="SimpleBezierEdge";const dD={[wt.Left]:{x:-1,y:0},[wt.Right]:{x:1,y:0},[wt.Top]:{x:0,y:-1},[wt.Bottom]:{x:0,y:1}},a7e=({source:t,sourcePosition:e=wt.Bottom,target:n})=>e===wt.Left||e===wt.Right?t.x<n.x?{x:1,y:0}:{x:-1,y:0}:t.y<n.y?{x:0,y:1}:{x:0,y:-1},hD=(t,e)=>Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2));function o7e({source:t,sourcePosition:e=wt.Bottom,target:n,targetPosition:r=wt.Top,center:s,offset:i}){const a=dD[e],l=dD[r],c={x:t.x+a.x*i,y:t.y+a.y*i},d={x:n.x+l.x*i,y:n.y+l.y*i},h=a7e({source:c,sourcePosition:e,target:d}),m=h.x!==0?"x":"y",g=h[m];let x=[],y,w;const S={x:0,y:0},k={x:0,y:0},[j,N,T,E]=CW({sourceX:t.x,sourceY:t.y,targetX:n.x,targetY:n.y});if(a[m]*l[m]===-1){y=s.x??j,w=s.y??N;const A=[{x:y,y:c.y},{x:y,y:d.y}],L=[{x:c.x,y:w},{x:d.x,y:w}];a[m]===g?x=m==="x"?A:L:x=m==="x"?L:A}else{const A=[{x:c.x,y:d.y}],L=[{x:d.x,y:c.y}];if(m==="x"?x=a.x===g?L:A:x=a.y===g?A:L,e===r){const te=Math.abs(t[m]-n[m]);if(te<=i){const z=Math.min(i-1,i-te);a[m]===g?S[m]=(c[m]>t[m]?-1:1)*z:k[m]=(d[m]>n[m]?-1:1)*z}}if(e!==r){const te=m==="x"?"y":"x",z=a[m]===l[te],Q=c[te]>d[te],F=c[te]<d[te];(a[m]===1&&(!z&&Q||z&&F)||a[m]!==1&&(!z&&F||z&&Q))&&(x=m==="x"?A:L)}const P={x:c.x+S.x,y:c.y+S.y},B={x:d.x+k.x,y:d.y+k.y},$=Math.max(Math.abs(P.x-x[0].x),Math.abs(B.x-x[0].x)),U=Math.max(Math.abs(P.y-x[0].y),Math.abs(B.y-x[0].y));$>=U?(y=(P.x+B.x)/2,w=x[0].y):(y=x[0].x,w=(P.y+B.y)/2)}return[[t,{x:c.x+S.x,y:c.y+S.y},...x,{x:d.x+k.x,y:d.y+k.y},n],y,w,T,E]}function l7e(t,e,n,r){const s=Math.min(hD(t,e)/2,hD(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 d=t.x<n.x?-1:1,h=t.y<n.y?1:-1;return`L ${i+s*d},${a}Q ${i},${a} ${i},${a+s*h}`}const l=t.x<n.x?1:-1,c=t.y<n.y?-1:1;return`L ${i},${a+s*c}Q ${i},${a} ${i+s*l},${a}`}function nj({sourceX:t,sourceY:e,sourcePosition:n=wt.Bottom,targetX:r,targetY:s,targetPosition:i=wt.Top,borderRadius:a=5,centerX:l,centerY:c,offset:d=20}){const[h,m,g,x,y]=o7e({source:{x:t,y:e},sourcePosition:n,target:{x:r,y:s},targetPosition:i,center:{x:l,y:c},offset:d});return[h.reduce((S,k,j)=>{let N="";return j>0&&j<h.length-1?N=l7e(h[j-1],k,h[j+1],a):N=`${j===0?"M":"L"}${k.x} ${k.y}`,S+=N,S},""),m,g,x,y]}const ew=b.memo(({sourceX:t,sourceY:e,targetX:n,targetY:r,label:s,labelStyle:i,labelShowBg:a,labelBgStyle:l,labelBgPadding:c,labelBgBorderRadius:d,style:h,sourcePosition:m=wt.Bottom,targetPosition:g=wt.Top,markerEnd:x,markerStart:y,pathOptions:w,interactionWidth:S})=>{const[k,j,N]=nj({sourceX:t,sourceY:e,sourcePosition:m,targetX:n,targetY:r,targetPosition:g,borderRadius:w?.borderRadius,offset:w?.offset});return ae.createElement(vg,{path:k,labelX:j,labelY:N,label:s,labelStyle:i,labelShowBg:a,labelBgStyle:l,labelBgPadding:c,labelBgBorderRadius:d,style:h,markerEnd:x,markerStart:y,interactionWidth:S})});ew.displayName="SmoothStepEdge";const JN=b.memo(t=>ae.createElement(ew,{...t,pathOptions:b.useMemo(()=>({borderRadius:0,offset:t.pathOptions?.offset}),[t.pathOptions?.offset])}));JN.displayName="StepEdge";function c7e({sourceX:t,sourceY:e,targetX:n,targetY:r}){const[s,i,a,l]=CW({sourceX:t,sourceY:e,targetX:n,targetY:r});return[`M ${t},${e}L ${n},${r}`,s,i,a,l]}const e7=b.memo(({sourceX:t,sourceY:e,targetX:n,targetY:r,label:s,labelStyle:i,labelShowBg:a,labelBgStyle:l,labelBgPadding:c,labelBgBorderRadius:d,style:h,markerEnd:m,markerStart:g,interactionWidth:x})=>{const[y,w,S]=c7e({sourceX:t,sourceY:e,targetX:n,targetY:r});return ae.createElement(vg,{path:y,labelX:w,labelY:S,label:s,labelStyle:i,labelShowBg:a,labelBgStyle:l,labelBgPadding:c,labelBgBorderRadius:d,style:h,markerEnd:m,markerStart:g,interactionWidth:x})});e7.displayName="StraightEdge";function $1(t,e){return t>=0?.5*t:e*25*Math.sqrt(-t)}function fD({pos:t,x1:e,y1:n,x2:r,y2:s,c:i}){switch(t){case wt.Left:return[e-$1(e-r,i),n];case wt.Right:return[e+$1(r-e,i),n];case wt.Top:return[e,n-$1(n-s,i)];case wt.Bottom:return[e,n+$1(s-n,i)]}}function _W({sourceX:t,sourceY:e,sourcePosition:n=wt.Bottom,targetX:r,targetY:s,targetPosition:i=wt.Top,curvature:a=.25}){const[l,c]=fD({pos:n,x1:t,y1:e,x2:r,y2:s,c:a}),[d,h]=fD({pos:i,x1:r,y1:s,x2:t,y2:e,c:a}),[m,g,x,y]=TW({sourceX:t,sourceY:e,targetX:r,targetY:s,sourceControlX:l,sourceControlY:c,targetControlX:d,targetControlY:h});return[`M${t},${e} C${l},${c} ${d},${h} ${r},${s}`,m,g,x,y]}const Ry=b.memo(({sourceX:t,sourceY:e,targetX:n,targetY:r,sourcePosition:s=wt.Bottom,targetPosition:i=wt.Top,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:d,labelBgPadding:h,labelBgBorderRadius:m,style:g,markerEnd:x,markerStart:y,pathOptions:w,interactionWidth:S})=>{const[k,j,N]=_W({sourceX:t,sourceY:e,sourcePosition:s,targetX:n,targetY:r,targetPosition:i,curvature:w?.curvature});return ae.createElement(vg,{path:k,labelX:j,labelY:N,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:d,labelBgPadding:h,labelBgBorderRadius:m,style:g,markerEnd:x,markerStart:y,interactionWidth:S})});Ry.displayName="BezierEdge";const t7=b.createContext(null),u7e=t7.Provider;t7.Consumer;const d7e=()=>b.useContext(t7),h7e=t=>"id"in t&&"source"in t&&"target"in t,f7e=({source:t,sourceHandle:e,target:n,targetHandle:r})=>`reactflow__edge-${t}${e||""}-${n}${r||""}`,rj=(t,e)=>typeof t>"u"?"":typeof t=="string"?t:`${e?`${e}__`:""}${Object.keys(t).sort().map(r=>`${r}=${t[r]}`).join("&")}`,m7e=(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)),p7e=(t,e)=>{if(!t.source||!t.target)return e;let n;return h7e(t)?n={...t}:n={...t,id:f7e(t)},m7e(n,e)?e:e.concat(n)},sj=({x:t,y:e},[n,r,s],i,[a,l])=>{const c={x:(t-n)/s,y:(e-r)/s};return i?{x:a*Math.round(c.x/a),y:l*Math.round(c.y/l)}:c},AW=({x:t,y:e},[n,r,s])=>({x:t*s+n,y:e*s+r}),td=(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}},tw=(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}=td(s,e).positionAbsolute;return kW(r,wp({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 OW(n)},MW=(t,e,[n,r,s]=[0,0,1],i=!1,a=!1,l=[0,0])=>{const c={x:(e.x-n)/s,y:(e.y-r)/s,width:e.width/s,height:e.height/s},d=[];return t.forEach(h=>{const{width:m,height:g,selectable:x=!0,hidden:y=!1}=h;if(a&&!x||y)return!1;const{positionAbsolute:w}=td(h,l),S={x:w.x,y:w.y,width:m||0,height:g||0},k=ej(c,S),j=typeof m>"u"||typeof g>"u"||m===null||g===null,N=i&&k>0,T=(m||0)*(g||0);(j||N||k>=T||h.dragging)&&d.push(h)}),d},RW=(t,e)=>{const n=t.map(r=>r.id);return e.filter(r=>n.includes(r.source)||n.includes(r.target))},DW=(t,e,n,r,s,i=.1)=>{const a=e/(t.width*(1+i)),l=n/(t.height*(1+i)),c=Math.min(a,l),d=gf(c,r,s),h=t.x+t.width/2,m=t.y+t.height/2,g=e/2-h*d,x=n/2-m*d;return{x:g,y:x,zoom:d}},Lu=(t,e=0)=>t.transition().duration(e);function mD(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 g7e(t,e,n,r,s,i){const{x:a,y:l}=Hc(t),d=e.elementsFromPoint(a,l).find(y=>y.classList.contains("react-flow__handle"));if(d){const y=d.getAttribute("data-nodeid");if(y){const w=n7(void 0,d),S=d.getAttribute("data-handleid"),k=i({nodeId:y,id:S,type:w});if(k){const j=s.find(N=>N.nodeId===y&&N.type===w&&N.id===S);return{handle:{id:S,type:w,nodeId:y,x:j?.x||n.x,y:j?.y||n.y},validHandleResult:k}}}}let h=[],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&&(w<m?h=[{handle:y,validHandleResult:S}]:w===m&&h.push({handle:y,validHandleResult:S}),m=w)}}),!h.length)return{handle:null,validHandleResult:PW()};if(h.length===1)return h[0];const g=h.some(({validHandleResult:y})=>y.isValid),x=h.some(({handle:y})=>y.type==="target");return h.find(({handle:y,validHandleResult:w})=>x?y.type==="target":g?w.isValid:!0)||h[0]}const x7e={source:null,target:null,sourceHandle:null,targetHandle:null},PW=()=>({handleDomNode:null,isValid:!1,connection:x7e,endHandle:null});function zW(t,e,n,r,s,i,a){const l=s==="target",c=a.querySelector(`.react-flow__handle[data-id="${t?.nodeId}-${t?.id}-${t?.type}"]`),d={...PW(),handleDomNode:c};if(c){const h=n7(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:l?m:n,sourceHandle:l?g:r,target:l?n:m,targetHandle:l?r:g};d.connection=w,x&&y&&(e===pd.Strict?l&&h==="source"||!l&&h==="target":m!==n||g!==r)&&(d.endHandle={nodeId:m,handleId:g,type:h},d.isValid=i(w))}return d}function v7e({nodes:t,nodeId:e,handleId:n,handleType:r}){return t.reduce((s,i)=>{if(i[Lr]){const{handleBounds:a}=i[Lr];let l=[],c=[];a&&(l=mD(i,a,"source",`${e}-${n}-${r}`),c=mD(i,a,"target",`${e}-${n}-${r}`)),s.push(...l,...c)}return s},[])}function n7(t,e){return t||(e?.classList.contains("target")?"target":e?.classList.contains("source")?"source":null)}function c5(t){t?.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function y7e(t,e){let n=null;return e?n="valid":t&&!e&&(n="invalid"),n}function IW({event:t,handleId:e,nodeId:n,onConnect:r,isTarget:s,getState:i,setState:a,isValidConnection:l,edgeUpdaterType:c,onReconnectEnd:d}){const h=SW(t.target),{connectionMode:m,domNode:g,autoPanOnConnect:x,connectionRadius:y,onConnectStart:w,panBy:S,getNodes:k,cancelConnection:j}=i();let N=0,T;const{x:E,y:_}=Hc(t),A=h?.elementFromPoint(E,_),L=n7(c,A),P=g?.getBoundingClientRect();if(!P||!L)return;let B,$=Hc(t,P),U=!1,te=null,z=!1,Q=null;const F=v7e({nodes:k(),nodeId:n,handleId:e,handleType:L}),Y=()=>{if(!x)return;const[R,ie]=wW($,P);S({x:R,y:ie}),N=requestAnimationFrame(Y)};a({connectionPosition:$,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:ie}=i();$=Hc(R,P);const{handle:G,validHandleResult:I}=g7e(R,h,sj($,ie,!1,[1,1]),y,F,V=>zW(V,m,n,e,s?"target":"source",l,h));if(T=G,U||(Y(),U=!0),Q=I.handleDomNode,te=I.connection,z=I.isValid,a({connectionPosition:T&&z?AW({x:T.x,y:T.y},ie):$,connectionStatus:y7e(!!T,z),connectionEndHandle:I.endHandle}),!T&&!z&&!Q)return c5(B);te.source!==te.target&&Q&&(c5(B),B=Q,Q.classList.add("connecting","react-flow__handle-connecting"),Q.classList.toggle("valid",z),Q.classList.toggle("react-flow__handle-valid",z))}function X(R){(T||Q)&&te&&z&&r?.(te),i().onConnectEnd?.(R),c&&d?.(R),c5(B),j(),cancelAnimationFrame(N),U=!1,z=!1,te=null,Q=null,h.removeEventListener("mousemove",J),h.removeEventListener("mouseup",X),h.removeEventListener("touchmove",J),h.removeEventListener("touchend",X)}h.addEventListener("mousemove",J),h.addEventListener("mouseup",X),h.addEventListener("touchmove",J),h.addEventListener("touchend",X)}const pD=()=>!0,b7e=t=>({connectionStartHandle:t.connectionStartHandle,connectOnClick:t.connectOnClick,noPanClassName:t.noPanClassName}),w7e=(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}},LW=b.forwardRef(({type:t="source",position:e=wt.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:s=!0,isConnectableEnd:i=!0,id:a,onConnect:l,children:c,className:d,onMouseDown:h,onTouchStart:m,...g},x)=>{const y=a||null,w=t==="target",S=ps(),k=d7e(),{connectOnClick:j,noPanClassName:N}=hr(b7e,ks),{connecting:T,clickConnecting:E}=hr(w7e(k,y,t),ks);k||S.getState().onError?.("010",Gl.error010());const _=P=>{const{defaultEdgeOptions:B,onConnect:$,hasDefaultEdges:U}=S.getState(),te={...B,...P};if(U){const{edges:z,setEdges:Q}=S.getState();Q(p7e(te,z))}$?.(te),l?.(te)},A=P=>{if(!k)return;const B=NW(P);s&&(B&&P.button===0||!B)&&IW({event:P,handleId:y,nodeId:k,onConnect:_,isTarget:w,getState:S.getState,setState:S.setState,isValidConnection:n||S.getState().isValidConnection||pD}),B?h?.(P):m?.(P)},L=P=>{const{onClickConnectStart:B,onClickConnectEnd:$,connectionClickStartHandle:U,connectionMode:te,isValidConnection:z}=S.getState();if(!k||!U&&!s)return;if(!U){B?.(P,{nodeId:k,handleId:y,handleType:t}),S.setState({connectionClickStartHandle:{nodeId:k,type:t,handleId:y}});return}const Q=SW(P.target),F=n||z||pD,{connection:Y,isValid:J}=zW({nodeId:k,id:y,type:t},te,U.nodeId,U.handleId||null,U.type,F,Q);J&&_(Y),$?.(P),S.setState({connectionClickStartHandle:null})};return ae.createElement("div",{"data-handleid":y,"data-nodeid":k,"data-handlepos":e,"data-id":`${k}-${y}-${t}`,className:Bs(["react-flow__handle",`react-flow__handle-${e}`,"nodrag",N,d,{source:!w,target:w,connectable:r,connectablestart:s,connectableend:i,connecting:E,connectionindicator:r&&(s&&!T||i&&T)}]),onMouseDown:A,onTouchStart:A,onClick:j?L:void 0,ref:x,...g},c)});LW.displayName="Handle";var ru=b.memo(LW);const BW=({data:t,isConnectable:e,targetPosition:n=wt.Top,sourcePosition:r=wt.Bottom})=>ae.createElement(ae.Fragment,null,ae.createElement(ru,{type:"target",position:n,isConnectable:e}),t?.label,ae.createElement(ru,{type:"source",position:r,isConnectable:e}));BW.displayName="DefaultNode";var ij=b.memo(BW);const FW=({data:t,isConnectable:e,sourcePosition:n=wt.Bottom})=>ae.createElement(ae.Fragment,null,t?.label,ae.createElement(ru,{type:"source",position:n,isConnectable:e}));FW.displayName="InputNode";var qW=b.memo(FW);const $W=({data:t,isConnectable:e,targetPosition:n=wt.Top})=>ae.createElement(ae.Fragment,null,ae.createElement(ru,{type:"target",position:n,isConnectable:e}),t?.label);$W.displayName="OutputNode";var HW=b.memo($W);const r7=()=>null;r7.displayName="GroupNode";const S7e=t=>({selectedNodes:t.getNodes().filter(e=>e.selected),selectedEdges:t.edges.filter(e=>e.selected).map(e=>({...e}))}),H1=t=>t.id;function k7e(t,e){return ks(t.selectedNodes.map(H1),e.selectedNodes.map(H1))&&ks(t.selectedEdges.map(H1),e.selectedEdges.map(H1))}const QW=b.memo(({onSelectionChange:t})=>{const e=ps(),{selectedNodes:n,selectedEdges:r}=hr(S7e,k7e);return b.useEffect(()=>{const s={nodes:n,edges:r};t?.(s),e.getState().onSelectionChange.forEach(i=>i(s))},[n,r,t]),null});QW.displayName="SelectionListener";const O7e=t=>!!t.onSelectionChange;function j7e({onSelectionChange:t}){const e=hr(O7e);return t||e?ae.createElement(QW,{onSelectionChange:t}):null}const N7e=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 uh(t,e){b.useEffect(()=>{typeof t<"u"&&e(t)},[t])}function an(t,e,n){b.useEffect(()=>{typeof e<"u"&&n({[t]:e})},[e])}const C7e=({nodes:t,edges:e,defaultNodes:n,defaultEdges:r,onConnect:s,onConnectStart:i,onConnectEnd:a,onClickConnectStart:l,onClickConnectEnd:c,nodesDraggable:d,nodesConnectable:h,nodesFocusable:m,edgesFocusable:g,edgesUpdatable:x,elevateNodesOnSelect:y,minZoom:w,maxZoom:S,nodeExtent:k,onNodesChange:j,onEdgesChange:N,elementsSelectable:T,connectionMode:E,snapGrid:_,snapToGrid:A,translateExtent:L,connectOnClick:P,defaultEdgeOptions:B,fitView:$,fitViewOptions:U,onNodesDelete:te,onEdgesDelete:z,onNodeDrag:Q,onNodeDragStart:F,onNodeDragStop:Y,onSelectionDrag:J,onSelectionDragStart:X,onSelectionDragStop:R,noPanClassName:ie,nodeOrigin:G,rfId:I,autoPanOnConnect:V,autoPanOnNodeDrag:ee,onError:ne,connectionRadius:W,isValidConnection:se,nodeDragThreshold:re})=>{const{setNodes:oe,setEdges:Te,setDefaultNodesAndEdges:We,setMinZoom:Ye,setMaxZoom:Je,setTranslateExtent:Oe,setNodeExtent:Ve,reset:Ue}=hr(N7e,ks),He=ps();return b.useEffect(()=>{const Ot=r?.map(xt=>({...xt,...B}));return We(n,Ot),()=>{Ue()}},[]),an("defaultEdgeOptions",B,He.setState),an("connectionMode",E,He.setState),an("onConnect",s,He.setState),an("onConnectStart",i,He.setState),an("onConnectEnd",a,He.setState),an("onClickConnectStart",l,He.setState),an("onClickConnectEnd",c,He.setState),an("nodesDraggable",d,He.setState),an("nodesConnectable",h,He.setState),an("nodesFocusable",m,He.setState),an("edgesFocusable",g,He.setState),an("edgesUpdatable",x,He.setState),an("elementsSelectable",T,He.setState),an("elevateNodesOnSelect",y,He.setState),an("snapToGrid",A,He.setState),an("snapGrid",_,He.setState),an("onNodesChange",j,He.setState),an("onEdgesChange",N,He.setState),an("connectOnClick",P,He.setState),an("fitViewOnInit",$,He.setState),an("fitViewOnInitOptions",U,He.setState),an("onNodesDelete",te,He.setState),an("onEdgesDelete",z,He.setState),an("onNodeDrag",Q,He.setState),an("onNodeDragStart",F,He.setState),an("onNodeDragStop",Y,He.setState),an("onSelectionDrag",J,He.setState),an("onSelectionDragStart",X,He.setState),an("onSelectionDragStop",R,He.setState),an("noPanClassName",ie,He.setState),an("nodeOrigin",G,He.setState),an("rfId",I,He.setState),an("autoPanOnConnect",V,He.setState),an("autoPanOnNodeDrag",ee,He.setState),an("onError",ne,He.setState),an("connectionRadius",W,He.setState),an("isValidConnection",se,He.setState),an("nodeDragThreshold",re,He.setState),uh(t,oe),uh(e,Te),uh(w,Ye),uh(S,Je),uh(L,Oe),uh(k,Ve),null},gD={display:"none"},T7e={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},VW="react-flow__node-desc",UW="react-flow__edge-desc",E7e="react-flow__aria-live",_7e=t=>t.ariaLiveMessage;function A7e({rfId:t}){const e=hr(_7e);return ae.createElement("div",{id:`${E7e}-${t}`,"aria-live":"assertive","aria-atomic":"true",style:T7e},e)}function M7e({rfId:t,disableKeyboardA11y:e}){return ae.createElement(ae.Fragment,null,ae.createElement("div",{id:`${VW}-${t}`,style:gD},"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."," "),ae.createElement("div",{id:`${UW}-${t}`,style:gD},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!e&&ae.createElement(A7e,{rfId:t}))}var kp=(t=null,e={actInsideInputWithModifier:!0})=>{const[n,r]=b.useState(!1),s=b.useRef(!1),i=b.useRef(new Set([])),[a,l]=b.useMemo(()=>{if(t!==null){const d=(Array.isArray(t)?t:[t]).filter(m=>typeof m=="string").map(m=>m.split("+")),h=d.reduce((m,g)=>m.concat(...g),[]);return[d,h]}return[[],[]]},[t]);return b.useEffect(()=>{const c=typeof document<"u"?document:null,d=e?.target||c;if(t!==null){const h=x=>{if(s.current=x.ctrlKey||x.metaKey||x.shiftKey,(!s.current||s.current&&!e.actInsideInputWithModifier)&&tj(x))return!1;const w=vD(x.code,l);i.current.add(x[w]),xD(a,i.current,!1)&&(x.preventDefault(),r(!0))},m=x=>{if((!s.current||s.current&&!e.actInsideInputWithModifier)&&tj(x))return!1;const w=vD(x.code,l);xD(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 d?.addEventListener("keydown",h),d?.addEventListener("keyup",m),window.addEventListener("blur",g),()=>{d?.removeEventListener("keydown",h),d?.removeEventListener("keyup",m),window.removeEventListener("blur",g)}}},[t,r]),n};function xD(t,e,n){return t.filter(r=>n||r.length===e.size).some(r=>r.every(s=>e.has(s)))}function vD(t,e){return e.includes(t)?"code":"key"}function WW(t,e,n,r){const s=t.parentNode||t.parentId;if(!s)return n;const i=e.get(s),a=td(i,r);return WW(i,e,{x:(n.x??0)+a.x,y:(n.y??0)+a.y,z:(i[Lr]?.z??0)>(n.z??0)?i[Lr]?.z??0:n.z??0},r)}function GW(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:l}=WW(r,t,{...r.position,z:r[Lr]?.z??0},e);r.positionAbsolute={x:i,y:a},r[Lr].z=l,n?.[r.id]&&(r[Lr].isParent=!0)}})}function u5(t,e,n,r){const s=new Map,i={},a=r?1e3:0;return t.forEach(l=>{const c=(ka(l.zIndex)?l.zIndex:0)+(l.selected?a:0),d=e.get(l.id),h={...l,positionAbsolute:{x:l.position.x,y:l.position.y}},m=l.parentNode||l.parentId;m&&(i[m]=!0);const g=d?.type&&d?.type!==l.type;Object.defineProperty(h,Lr,{enumerable:!1,value:{handleBounds:g?void 0:d?.[Lr]?.handleBounds,z:c}}),s.set(l.id,h)}),GW(s,n,i),s}function XW(t,e={}){const{getNodes:n,width:r,height:s,minZoom:i,maxZoom:a,d3Zoom:l,d3Selection:c,fitViewOnInitDone:d,fitViewOnInit:h,nodeOrigin:m}=t(),g=e.initial&&!d&&h;if(l&&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(j=>j.id===S.id):k}),w=y.every(S=>S.width&&S.height);if(y.length>0&&w){const S=tw(y,m),{x:k,y:j,zoom:N}=DW(S,r,s,e.minZoom??i,e.maxZoom??a,e.padding??.1),T=Fl.translate(k,j).scale(N);return typeof e.duration=="number"&&e.duration>0?l.transform(Lu(c,e.duration),T):l.transform(c,T),!0}}return!1}function R7e(t,e){return t.forEach(n=>{const r=e.get(n.id);r&&e.set(r.id,{...r,[Lr]:r[Lr],selected:n.selected})}),new Map(e)}function D7e(t,e){return e.map(n=>{const r=t.find(s=>s.id===n.id);return r&&(n.selected=r.selected),n})}function Q1({changedNodes:t,changedEdges:e,get:n,set:r}){const{nodeInternals:s,edges:i,onNodesChange:a,onEdgesChange:l,hasDefaultNodes:c,hasDefaultEdges:d}=n();t?.length&&(c&&r({nodeInternals:R7e(t,s)}),a?.(t)),e?.length&&(d&&r({edges:D7e(e,i)}),l?.(e))}const dh=()=>{},P7e={zoomIn:dh,zoomOut:dh,zoomTo:dh,getZoom:()=>1,setViewport:dh,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:dh,fitBounds:dh,project:t=>t,screenToFlowPosition:t=>t,flowToScreenPosition:t=>t,viewportInitialized:!1},z7e=t=>({d3Zoom:t.d3Zoom,d3Selection:t.d3Selection}),I7e=()=>{const t=ps(),{d3Zoom:e,d3Selection:n}=hr(z7e,ks);return b.useMemo(()=>n&&e?{zoomIn:s=>e.scaleBy(Lu(n,s?.duration),1.2),zoomOut:s=>e.scaleBy(Lu(n,s?.duration),1/1.2),zoomTo:(s,i)=>e.scaleTo(Lu(n,i?.duration),s),getZoom:()=>t.getState().transform[2],setViewport:(s,i)=>{const[a,l,c]=t.getState().transform,d=Fl.translate(s.x??a,s.y??l).scale(s.zoom??c);e.transform(Lu(n,i?.duration),d)},getViewport:()=>{const[s,i,a]=t.getState().transform;return{x:s,y:i,zoom:a}},fitView:s=>XW(t.getState,s),setCenter:(s,i,a)=>{const{width:l,height:c,maxZoom:d}=t.getState(),h=typeof a?.zoom<"u"?a.zoom:d,m=l/2-s*h,g=c/2-i*h,x=Fl.translate(m,g).scale(h);e.transform(Lu(n,a?.duration),x)},fitBounds:(s,i)=>{const{width:a,height:l,minZoom:c,maxZoom:d}=t.getState(),{x:h,y:m,zoom:g}=DW(s,a,l,c,d,i?.padding??.1),x=Fl.translate(h,m).scale(g);e.transform(Lu(n,i?.duration),x)},project:s=>{const{transform:i,snapToGrid:a,snapGrid:l}=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"),sj(s,i,a,l)},screenToFlowPosition:s=>{const{transform:i,snapToGrid:a,snapGrid:l,domNode:c}=t.getState();if(!c)return s;const{x:d,y:h}=c.getBoundingClientRect(),m={x:s.x-d,y:s.y-h};return sj(m,i,a,l)},flowToScreenPosition:s=>{const{transform:i,domNode:a}=t.getState();if(!a)return s;const{x:l,y:c}=a.getBoundingClientRect(),d=AW(s,i);return{x:d.x+l,y:d.y+c}},viewportInitialized:!0}:P7e,[e,n])};function s7(){const t=I7e(),e=ps(),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:j,onNodesChange:N}=e.getState(),T=S(),E=typeof w=="function"?w(T):w;if(j)k(E);else if(N){const _=E.length===0?T.map(A=>({type:"remove",id:A.id})):E.map(A=>({item:A,type:"reset"}));N(_)}},[]),l=b.useCallback(w=>{const{edges:S=[],setEdges:k,hasDefaultEdges:j,onEdgesChange:N}=e.getState(),T=typeof w=="function"?w(S):w;if(j)k(T);else if(N){const E=T.length===0?S.map(_=>({type:"remove",id:_.id})):T.map(_=>({item:_,type:"reset"}));N(E)}},[]),c=b.useCallback(w=>{const S=Array.isArray(w)?w:[w],{getNodes:k,setNodes:j,hasDefaultNodes:N,onNodesChange:T}=e.getState();if(N){const _=[...k(),...S];j(_)}else if(T){const E=S.map(_=>({item:_,type:"add"}));T(E)}},[]),d=b.useCallback(w=>{const S=Array.isArray(w)?w:[w],{edges:k=[],setEdges:j,hasDefaultEdges:N,onEdgesChange:T}=e.getState();if(N)j([...k,...S]);else if(T){const E=S.map(_=>({item:_,type:"add"}));T(E)}},[]),h=b.useCallback(()=>{const{getNodes:w,edges:S=[],transform:k}=e.getState(),[j,N,T]=k;return{nodes:w().map(E=>({...E})),edges:S.map(E=>({...E})),viewport:{x:j,y:N,zoom:T}}},[]),m=b.useCallback(({nodes:w,edges:S})=>{const{nodeInternals:k,getNodes:j,edges:N,hasDefaultNodes:T,hasDefaultEdges:E,onNodesDelete:_,onEdgesDelete:A,onNodesChange:L,onEdgesChange:P}=e.getState(),B=(w||[]).map(Q=>Q.id),$=(S||[]).map(Q=>Q.id),U=j().reduce((Q,F)=>{const Y=F.parentNode||F.parentId,J=!B.includes(F.id)&&Y&&Q.find(R=>R.id===Y);return(typeof F.deletable=="boolean"?F.deletable:!0)&&(B.includes(F.id)||J)&&Q.push(F),Q},[]),te=N.filter(Q=>typeof Q.deletable=="boolean"?Q.deletable:!0),z=te.filter(Q=>$.includes(Q.id));if(U||z){const Q=RW(U,te),F=[...z,...Q],Y=F.reduce((J,X)=>(J.includes(X.id)||J.push(X.id),J),[]);if((E||T)&&(E&&e.setState({edges:N.filter(J=>!Y.includes(J.id))}),T&&(U.forEach(J=>{k.delete(J.id)}),e.setState({nodeInternals:new Map(k)}))),Y.length>0&&(A?.(F),P&&P(Y.map(J=>({id:J,type:"remove"})))),U.length>0&&(_?.(U),L)){const J=U.map(X=>({id:X.id,type:"remove"}));L(J)}}},[]),g=b.useCallback(w=>{const S=r7e(w),k=S?null:e.getState().nodeInternals.get(w.id);return!S&&!k?[null,null,S]:[S?w:cD(k),k,S]},[]),x=b.useCallback((w,S=!0,k)=>{const[j,N,T]=g(w);return j?(k||e.getState().getNodes()).filter(E=>{if(!T&&(E.id===N.id||!E.positionAbsolute))return!1;const _=cD(E),A=ej(_,j);return S&&A>0||A>=j.width*j.height}):[]},[]),y=b.useCallback((w,S,k=!0)=>{const[j]=g(w);if(!j)return!1;const N=ej(j,S);return k&&N>0||N>=j.width*j.height},[]);return b.useMemo(()=>({...t,getNodes:n,getNode:r,getEdges:s,getEdge:i,setNodes:a,setEdges:l,addNodes:c,addEdges:d,toObject:h,deleteElements:m,getIntersectingNodes:x,isNodeIntersecting:y}),[t,n,r,s,i,a,l,c,d,h,m,x,y])}const L7e={actInsideInputWithModifier:!1};var B7e=({deleteKeyCode:t,multiSelectionKeyCode:e})=>{const n=ps(),{deleteElements:r}=s7(),s=kp(t,L7e),i=kp(e);b.useEffect(()=>{if(s){const{edges:a,getNodes:l}=n.getState(),c=l().filter(h=>h.selected),d=a.filter(h=>h.selected);r({nodes:c,edges:d}),n.setState({nodesSelectionActive:!1})}},[s]),b.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])};function F7e(t){const e=ps();b.useEffect(()=>{let n;const r=()=>{if(!t.current)return;const s=YN(t.current);(s.height===0||s.width===0)&&e.getState().onError?.("004",Gl.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 i7={position:"absolute",width:"100%",height:"100%",top:0,left:0},q7e=(t,e)=>t.x!==e.x||t.y!==e.y||t.zoom!==e.k,V1=t=>({x:t.x,y:t.y,zoom:t.k}),hh=(t,e)=>t.target.closest(`.${e}`),yD=(t,e)=>e===2&&Array.isArray(t)&&t.includes(2),bD=t=>{const e=t.ctrlKey&&Ay()?10:1;return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*e},$7e=t=>({d3Zoom:t.d3Zoom,d3Selection:t.d3Selection,d3ZoomHandler:t.d3ZoomHandler,userSelectionActive:t.userSelectionActive}),H7e=({onMove:t,onMoveStart:e,onMoveEnd:n,onPaneContextMenu:r,zoomOnScroll:s=!0,zoomOnPinch:i=!0,panOnScroll:a=!1,panOnScrollSpeed:l=.5,panOnScrollMode:c=Wu.Free,zoomOnDoubleClick:d=!0,elementsSelectable:h,panOnDrag:m=!0,defaultViewport:g,translateExtent:x,minZoom:y,maxZoom:w,zoomActivationKeyCode:S,preventScrolling:k=!0,children:j,noWheelClassName:N,noPanClassName:T})=>{const E=b.useRef(),_=ps(),A=b.useRef(!1),L=b.useRef(!1),P=b.useRef(null),B=b.useRef({x:0,y:0,zoom:0}),{d3Zoom:$,d3Selection:U,d3ZoomHandler:te,userSelectionActive:z}=hr($7e,ks),Q=kp(S),F=b.useRef(0),Y=b.useRef(!1),J=b.useRef();return F7e(P),b.useEffect(()=>{if(P.current){const X=P.current.getBoundingClientRect(),R=yW().scaleExtent([y,w]).translateExtent(x),ie=ma(P.current).call(R),G=Fl.translate(g.x,g.y).scale(gf(g.zoom,y,w)),I=[[0,0],[X.width,X.height]],V=R.constrain()(G,I,x);R.transform(ie,V),R.wheelDelta(bD),_.setState({d3Zoom:R,d3Selection:ie,d3ZoomHandler:ie.on("wheel.zoom"),transform:[V.x,V.y,V.k],domNode:P.current.closest(".react-flow")})}},[]),b.useEffect(()=>{U&&$&&(a&&!Q&&!z?U.on("wheel.zoom",X=>{if(hh(X,N))return!1;X.preventDefault(),X.stopImmediatePropagation();const R=U.property("__zoom").k||1;if(X.ctrlKey&&i){const se=Ha(X),re=bD(X),oe=R*Math.pow(2,re);$.scaleTo(U,oe,se,X);return}const ie=X.deltaMode===1?20:1;let G=c===Wu.Vertical?0:X.deltaX*ie,I=c===Wu.Horizontal?0:X.deltaY*ie;!Ay()&&X.shiftKey&&c!==Wu.Vertical&&(G=X.deltaY*ie,I=0),$.translateBy(U,-(G/R)*l,-(I/R)*l,{internal:!0});const V=V1(U.property("__zoom")),{onViewportChangeStart:ee,onViewportChange:ne,onViewportChangeEnd:W}=_.getState();clearTimeout(J.current),Y.current||(Y.current=!0,e?.(X,V),ee?.(V)),Y.current&&(t?.(X,V),ne?.(V),J.current=setTimeout(()=>{n?.(X,V),W?.(V),Y.current=!1},150))},{passive:!1}):typeof te<"u"&&U.on("wheel.zoom",function(X,R){if(!k&&X.type==="wheel"&&!X.ctrlKey||hh(X,N))return null;X.preventDefault(),te.call(this,X,R)},{passive:!1}))},[z,a,c,U,$,te,Q,i,k,N,e,t,n]),b.useEffect(()=>{$&&$.on("start",X=>{if(!X.sourceEvent||X.sourceEvent.internal)return null;F.current=X.sourceEvent?.button;const{onViewportChangeStart:R}=_.getState(),ie=V1(X.transform);A.current=!0,B.current=ie,X.sourceEvent?.type==="mousedown"&&_.setState({paneDragging:!0}),R?.(ie),e?.(X.sourceEvent,ie)})},[$,e]),b.useEffect(()=>{$&&(z&&!A.current?$.on("zoom",null):z||$.on("zoom",X=>{const{onViewportChange:R}=_.getState();if(_.setState({transform:[X.transform.x,X.transform.y,X.transform.k]}),L.current=!!(r&&yD(m,F.current??0)),(t||R)&&!X.sourceEvent?.internal){const ie=V1(X.transform);R?.(ie),t?.(X.sourceEvent,ie)}}))},[z,$,t,m,r]),b.useEffect(()=>{$&&$.on("end",X=>{if(!X.sourceEvent||X.sourceEvent.internal)return null;const{onViewportChangeEnd:R}=_.getState();if(A.current=!1,_.setState({paneDragging:!1}),r&&yD(m,F.current??0)&&!L.current&&r(X.sourceEvent),L.current=!1,(n||R)&&q7e(B.current,X.transform)){const ie=V1(X.transform);B.current=ie,clearTimeout(E.current),E.current=setTimeout(()=>{R?.(ie),n?.(X.sourceEvent,ie)},a?150:0)}})},[$,a,m,n,r]),b.useEffect(()=>{$&&$.filter(X=>{const R=Q||s,ie=i&&X.ctrlKey;if((m===!0||Array.isArray(m)&&m.includes(1))&&X.button===1&&X.type==="mousedown"&&(hh(X,"react-flow__node")||hh(X,"react-flow__edge")))return!0;if(!m&&!R&&!a&&!d&&!i||z||!d&&X.type==="dblclick"||hh(X,N)&&X.type==="wheel"||hh(X,T)&&(X.type!=="wheel"||a&&X.type==="wheel"&&!Q)||!i&&X.ctrlKey&&X.type==="wheel"||!R&&!a&&!ie&&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,d,m,h,Q]),ae.createElement("div",{className:"react-flow__renderer",ref:P,style:i7},j)},Q7e=t=>({userSelectionActive:t.userSelectionActive,userSelectionRect:t.userSelectionRect});function V7e(){const{userSelectionActive:t,userSelectionRect:e}=hr(Q7e,ks);return t&&e?ae.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 wD(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 YW(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(l=>l.id===s.id);if(i.length===0)return r.push(s),r;const a={...s};for(const l of i)if(l)switch(l.type){case"select":{a.selected=l.selected;break}case"position":{typeof l.position<"u"&&(a.position=l.position),typeof l.positionAbsolute<"u"&&(a.positionAbsolute=l.positionAbsolute),typeof l.dragging<"u"&&(a.dragging=l.dragging),a.expandParent&&wD(r,a);break}case"dimensions":{typeof l.dimensions<"u"&&(a.width=l.dimensions.width,a.height=l.dimensions.height),typeof l.updateStyle<"u"&&(a.style={...a.style||{},...l.dimensions}),typeof l.resizing=="boolean"&&(a.resizing=l.resizing),a.expandParent&&wD(r,a);break}case"remove":return r}return r.push(a),r},n)}function KW(t,e){return YW(t,e)}function U7e(t,e){return YW(t,e)}const Pc=(t,e)=>({id:t,type:"select",selected:e});function Eh(t,e){return t.reduce((n,r)=>{const s=e.includes(r.id);return!r.selected&&s?(r.selected=!0,n.push(Pc(r.id,!0))):r.selected&&!s&&(r.selected=!1,n.push(Pc(r.id,!1))),n},[])}const d5=(t,e)=>n=>{n.target===e.current&&t?.(n)},W7e=t=>({userSelectionActive:t.userSelectionActive,elementsSelectable:t.elementsSelectable,dragging:t.paneDragging}),ZW=b.memo(({isSelecting:t,selectionMode:e=Sp.Full,panOnDrag:n,onSelectionStart:r,onSelectionEnd:s,onPaneClick:i,onPaneContextMenu:a,onPaneScroll:l,onPaneMouseEnter:c,onPaneMouseMove:d,onPaneMouseLeave:h,children:m})=>{const g=b.useRef(null),x=ps(),y=b.useRef(0),w=b.useRef(0),S=b.useRef(),{userSelectionActive:k,elementsSelectable:j,dragging:N}=hr(W7e,ks),T=()=>{x.setState({userSelectionActive:!1,userSelectionRect:null}),y.current=0,w.current=0},E=te=>{i?.(te),x.getState().resetSelectedElements(),x.setState({nodesSelectionActive:!1})},_=te=>{if(Array.isArray(n)&&n?.includes(2)){te.preventDefault();return}a?.(te)},A=l?te=>l(te):void 0,L=te=>{const{resetSelectedElements:z,domNode:Q}=x.getState();if(S.current=Q?.getBoundingClientRect(),!j||!t||te.button!==0||te.target!==g.current||!S.current)return;const{x:F,y:Y}=Hc(te,S.current);z(),x.setState({userSelectionRect:{width:0,height:0,startX:F,startY:Y,x:F,y:Y}}),r?.(te)},P=te=>{const{userSelectionRect:z,nodeInternals:Q,edges:F,transform:Y,onNodesChange:J,onEdgesChange:X,nodeOrigin:R,getNodes:ie}=x.getState();if(!t||!S.current||!z)return;x.setState({userSelectionActive:!0,nodesSelectionActive:!1});const G=Hc(te,S.current),I=z.startX??0,V=z.startY??0,ee={...z,x:G.x<I?G.x:I,y:G.y<V?G.y:V,width:Math.abs(G.x-I),height:Math.abs(G.y-V)},ne=ie(),W=MW(Q,ee,Y,e===Sp.Partial,!0,R),se=RW(W,F).map(oe=>oe.id),re=W.map(oe=>oe.id);if(y.current!==re.length){y.current=re.length;const oe=Eh(ne,re);oe.length&&J?.(oe)}if(w.current!==se.length){w.current=se.length;const oe=Eh(F,se);oe.length&&X?.(oe)}x.setState({userSelectionRect:ee})},B=te=>{if(te.button!==0)return;const{userSelectionRect:z}=x.getState();!k&&z&&te.target===g.current&&E?.(te),x.setState({nodesSelectionActive:y.current>0}),T(),s?.(te)},$=te=>{k&&(x.setState({nodesSelectionActive:y.current>0}),s?.(te)),T()},U=j&&(t||k);return ae.createElement("div",{className:Bs(["react-flow__pane",{dragging:N,selection:t}]),onClick:U?void 0:d5(E,g),onContextMenu:d5(_,g),onWheel:d5(A,g),onMouseEnter:U?void 0:c,onMouseDown:U?L:void 0,onMouseMove:U?P:d,onMouseUp:U?B:void 0,onMouseLeave:U?$:h,ref:g,style:i7},m,ae.createElement(V7e,null))});ZW.displayName="Pane";function JW(t,e){const n=t.parentNode||t.parentId;if(!n)return!1;const r=e.get(n);return r?r.selected?!0:JW(r,e):!1}function SD(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 G7e(t,e,n,r){return Array.from(t.values()).filter(s=>(s.selected||s.id===r)&&(!s.parentNode||s.parentId||!JW(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 X7e(t,e){return!e||e==="parent"?e:[e[0],[e[1][0]-(t.width||0),e[1][1]-(t.height||0)]]}function eG(t,e,n,r,s=[0,0],i){const a=X7e(t,t.extent||r);let l=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}=td(m,s).positionAbsolute;l=m&&ka(g)&&ka(x)&&ka(m.width)&&ka(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]]]:l}else i?.("005",Gl.error005()),l=a;else if(t.extent&&c&&t.extent!=="parent"){const m=n.get(c),{x:g,y:x}=td(m,s).positionAbsolute;l=[[t.extent[0][0]+g,t.extent[0][1]+x],[t.extent[1][0]+g,t.extent[1][1]+x]]}let d={x:0,y:0};if(c){const m=n.get(c);d=td(m,s).positionAbsolute}const h=l&&l!=="parent"?KN(e,l):e;return{position:{x:h.x-d.x,y:h.y-d.y},positionAbsolute:h}}function h5({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 kD=(t,e,n,r)=>{const s=e.querySelectorAll(t);if(!s||!s.length)return null;const i=Array.from(s),a=e.getBoundingClientRect(),l={x:a.width*r[0],y:a.height*r[1]};return i.map(c=>{const d=c.getBoundingClientRect();return{id:c.getAttribute("data-handleid"),position:c.getAttribute("data-handlepos"),x:(d.left-a.left-l.x)/n,y:(d.top-a.top-l.y)/n,...YN(c)}})};function s0(t,e,n){return n===void 0?n:r=>{const s=e().nodeInternals.get(t);s&&n(r,{...s})}}function aj({id:t,store:e,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:s,unselectNodesAndEdges:i,multiSelectionActive:a,nodeInternals:l,onError:c}=e.getState(),d=l.get(t);if(!d){c?.("012",Gl.error012(t));return}e.setState({nodesSelectionActive:!1}),d.selected?(n||d.selected&&a)&&(i({nodes:[d],edges:[]}),requestAnimationFrame(()=>r?.current?.blur())):s([t])}function Y7e(){const t=ps();return b.useCallback(({sourceEvent:n})=>{const{transform:r,snapGrid:s,snapToGrid:i}=t.getState(),a=n.touches?n.touches[0].clientX:n.clientX,l=n.touches?n.touches[0].clientY:n.clientY,c={x:(a-r[0])/r[2],y:(l-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 f5(t){return(e,n,r)=>t?.(e,r)}function tG({nodeRef:t,disabled:e=!1,noDragClassName:n,handleSelector:r,nodeId:s,isSelectable:i,selectNodesOnDrag:a}){const l=ps(),[c,d]=b.useState(!1),h=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),j=b.useRef(!1),N=Y7e();return b.useEffect(()=>{if(t?.current){const T=ma(t.current),E=({x:L,y:P})=>{const{nodeInternals:B,onNodeDrag:$,onSelectionDrag:U,updateNodePositions:te,nodeExtent:z,snapGrid:Q,snapToGrid:F,nodeOrigin:Y,onError:J}=l.getState();m.current={x:L,y:P};let X=!1,R={x:0,y:0,x2:0,y2:0};if(h.current.length>1&&z){const G=tw(h.current,Y);R=wp(G)}if(h.current=h.current.map(G=>{const I={x:L-G.distance.x,y:P-G.distance.y};F&&(I.x=Q[0]*Math.round(I.x/Q[0]),I.y=Q[1]*Math.round(I.y/Q[1]));const V=[[z[0][0],z[0][1]],[z[1][0],z[1][1]]];h.current.length>1&&z&&!G.extent&&(V[0][0]=G.positionAbsolute.x-R.x+z[0][0],V[1][0]=G.positionAbsolute.x+(G.width??0)-R.x2+z[1][0],V[0][1]=G.positionAbsolute.y-R.y+z[0][1],V[1][1]=G.positionAbsolute.y+(G.height??0)-R.y2+z[1][1]);const ee=eG(G,I,B,V,Y,J);return X=X||G.position.x!==ee.position.x||G.position.y!==ee.position.y,G.position=ee.position,G.positionAbsolute=ee.positionAbsolute,G}),!X)return;te(h.current,!0,!0),d(!0);const ie=s?$:f5(U);if(ie&&w.current){const[G,I]=h5({nodeId:s,dragItems:h.current,nodeInternals:B});ie(w.current,G,I)}},_=()=>{if(!x.current)return;const[L,P]=wW(y.current,x.current);if(L!==0||P!==0){const{transform:B,panBy:$}=l.getState();m.current.x=(m.current.x??0)-L/B[2],m.current.y=(m.current.y??0)-P/B[2],$({x:L,y:P})&&E(m.current)}g.current=requestAnimationFrame(_)},A=L=>{const{nodeInternals:P,multiSelectionActive:B,nodesDraggable:$,unselectNodesAndEdges:U,onNodeDragStart:te,onSelectionDragStart:z}=l.getState();k.current=!0;const Q=s?te:f5(z);(!a||!i)&&!B&&s&&(P.get(s)?.selected||U()),s&&i&&a&&aj({id:s,store:l,nodeRef:t});const F=N(L);if(m.current=F,h.current=G7e(P,$,F,s),Q&&h.current){const[Y,J]=h5({nodeId:s,dragItems:h.current,nodeInternals:P});Q(L.sourceEvent,Y,J)}};if(e)T.on(".drag",null);else{const L=R6e().on("start",P=>{const{domNode:B,nodeDragThreshold:$}=l.getState();$===0&&A(P),j.current=!1;const U=N(P);m.current=U,x.current=B?.getBoundingClientRect()||null,y.current=Hc(P.sourceEvent,x.current)}).on("drag",P=>{const B=N(P),{autoPanOnNodeDrag:$,nodeDragThreshold:U}=l.getState();if(P.sourceEvent.type==="touchmove"&&P.sourceEvent.touches.length>1&&(j.current=!0),!j.current){if(!S.current&&k.current&&$&&(S.current=!0,_()),!k.current){const te=B.xSnapped-(m?.current?.x??0),z=B.ySnapped-(m?.current?.y??0);Math.sqrt(te*te+z*z)>U&&A(P)}(m.current.x!==B.xSnapped||m.current.y!==B.ySnapped)&&h.current&&k.current&&(w.current=P.sourceEvent,y.current=Hc(P.sourceEvent,x.current),E(B))}}).on("end",P=>{if(!(!k.current||j.current)&&(d(!1),S.current=!1,k.current=!1,cancelAnimationFrame(g.current),h.current)){const{updateNodePositions:B,nodeInternals:$,onNodeDragStop:U,onSelectionDragStop:te}=l.getState(),z=s?U:f5(te);if(B(h.current,!1,!1),z){const[Q,F]=h5({nodeId:s,dragItems:h.current,nodeInternals:$});z(P.sourceEvent,Q,F)}}}).filter(P=>{const B=P.target;return!P.button&&(!n||!SD(B,`.${n}`,t))&&(!r||SD(B,r,t))});return T.call(L),()=>{T.on(".drag",null)}}}},[t,e,n,r,i,l,s,a,N]),c}function nG(){const t=ps();return b.useCallback(n=>{const{nodeInternals:r,nodeExtent:s,updateNodePositions:i,getNodes:a,snapToGrid:l,snapGrid:c,onError:d,nodesDraggable:h}=t.getState(),m=a().filter(j=>j.selected&&(j.draggable||h&&typeof j.draggable>"u")),g=l?c[0]:5,x=l?c[1]:5,y=n.isShiftPressed?4:1,w=n.x*g*y,S=n.y*x*y,k=m.map(j=>{if(j.positionAbsolute){const N={x:j.positionAbsolute.x+w,y:j.positionAbsolute.y+S};l&&(N.x=c[0]*Math.round(N.x/c[0]),N.y=c[1]*Math.round(N.y/c[1]));const{positionAbsolute:T,position:E}=eG(j,N,r,s,void 0,d);j.position=E,j.positionAbsolute=T}return j});i(k,!0,!1)},[])}const Qh={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var i0=t=>{const e=({id:n,type:r,data:s,xPos:i,yPos:a,xPosOrigin:l,yPosOrigin:c,selected:d,onClick:h,onMouseEnter:m,onMouseMove:g,onMouseLeave:x,onContextMenu:y,onDoubleClick:w,style:S,className:k,isDraggable:j,isSelectable:N,isConnectable:T,isFocusable:E,selectNodesOnDrag:_,sourcePosition:A,targetPosition:L,hidden:P,resizeObserver:B,dragHandle:$,zIndex:U,isParent:te,noDragClassName:z,noPanClassName:Q,initialized:F,disableKeyboardA11y:Y,ariaLabel:J,rfId:X,hasHandleBounds:R})=>{const ie=ps(),G=b.useRef(null),I=b.useRef(null),V=b.useRef(A),ee=b.useRef(L),ne=b.useRef(r),W=N||j||h||m||g||x,se=nG(),re=s0(n,ie.getState,m),oe=s0(n,ie.getState,g),Te=s0(n,ie.getState,x),We=s0(n,ie.getState,y),Ye=s0(n,ie.getState,w),Je=Ue=>{const{nodeDragThreshold:He}=ie.getState();if(N&&(!_||!j||He>0)&&aj({id:n,store:ie,nodeRef:G}),h){const Ot=ie.getState().nodeInternals.get(n);Ot&&h(Ue,{...Ot})}},Oe=Ue=>{if(!tj(Ue)&&!Y)if(jW.includes(Ue.key)&&N){const He=Ue.key==="Escape";aj({id:n,store:ie,unselect:He,nodeRef:G})}else j&&d&&Object.prototype.hasOwnProperty.call(Qh,Ue.key)&&(ie.setState({ariaLiveMessage:`Moved selected node ${Ue.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~i}, y: ${~~a}`}),se({x:Qh[Ue.key].x,y:Qh[Ue.key].y,isShiftPressed:Ue.shiftKey}))};b.useEffect(()=>()=>{I.current&&(B?.unobserve(I.current),I.current=null)},[]),b.useEffect(()=>{if(G.current&&!P){const Ue=G.current;(!F||!R||I.current!==Ue)&&(I.current&&B?.unobserve(I.current),B?.observe(Ue),I.current=Ue)}},[P,F,R]),b.useEffect(()=>{const Ue=ne.current!==r,He=V.current!==A,Ot=ee.current!==L;G.current&&(Ue||He||Ot)&&(Ue&&(ne.current=r),He&&(V.current=A),Ot&&(ee.current=L),ie.getState().updateNodeDimensions([{id:n,nodeElement:G.current,forceUpdate:!0}]))},[n,r,A,L]);const Ve=tG({nodeRef:G,disabled:P||!j,noDragClassName:z,handleSelector:$,nodeId:n,isSelectable:N,selectNodesOnDrag:_});return P?null:ae.createElement("div",{className:Bs(["react-flow__node",`react-flow__node-${r}`,{[Q]:j},k,{selected:d,selectable:N,parent:te,dragging:Ve}]),ref:G,style:{zIndex:U,transform:`translate(${l}px,${c}px)`,pointerEvents:W?"all":"none",visibility:F?"visible":"hidden",...S},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:re,onMouseMove:oe,onMouseLeave:Te,onContextMenu:We,onClick:Je,onDoubleClick:Ye,onKeyDown:E?Oe:void 0,tabIndex:E?0:void 0,role:E?"button":void 0,"aria-describedby":Y?void 0:`${VW}-${X}`,"aria-label":J},ae.createElement(u7e,{value:n},ae.createElement(t,{id:n,data:s,type:r,xPos:i,yPos:a,selected:d,isConnectable:T,sourcePosition:A,targetPosition:L,dragging:Ve,dragHandle:$,zIndex:U})))};return e.displayName="NodeWrapper",b.memo(e)};const K7e=t=>{const e=t.getNodes().filter(n=>n.selected);return{...tw(e,t.nodeOrigin),transformString:`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]})`,userSelectionActive:t.userSelectionActive}};function Z7e({onSelectionContextMenu:t,noPanClassName:e,disableKeyboardA11y:n}){const r=ps(),{width:s,height:i,x:a,y:l,transformString:c,userSelectionActive:d}=hr(K7e,ks),h=nG(),m=b.useRef(null);if(b.useEffect(()=>{n||m.current?.focus({preventScroll:!0})},[n]),tG({nodeRef:m}),d||!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(Qh,y.key)&&h({x:Qh[y.key].x,y:Qh[y.key].y,isShiftPressed:y.shiftKey})};return ae.createElement("div",{className:Bs(["react-flow__nodesselection","react-flow__container",e]),style:{transform:c}},ae.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:l,left:a}}))}var J7e=b.memo(Z7e);const eCe=t=>t.nodesSelectionActive,rG=({children:t,onPaneClick:e,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:i,onPaneScroll:a,deleteKeyCode:l,onMove:c,onMoveStart:d,onMoveEnd:h,selectionKeyCode:m,selectionOnDrag:g,selectionMode:x,onSelectionStart:y,onSelectionEnd:w,multiSelectionKeyCode:S,panActivationKeyCode:k,zoomActivationKeyCode:j,elementsSelectable:N,zoomOnScroll:T,zoomOnPinch:E,panOnScroll:_,panOnScrollSpeed:A,panOnScrollMode:L,zoomOnDoubleClick:P,panOnDrag:B,defaultViewport:$,translateExtent:U,minZoom:te,maxZoom:z,preventScrolling:Q,onSelectionContextMenu:F,noWheelClassName:Y,noPanClassName:J,disableKeyboardA11y:X})=>{const R=hr(eCe),ie=kp(m),G=kp(k),I=G||B,V=G||_,ee=ie||g&&I!==!0;return B7e({deleteKeyCode:l,multiSelectionKeyCode:S}),ae.createElement(H7e,{onMove:c,onMoveStart:d,onMoveEnd:h,onPaneContextMenu:i,elementsSelectable:N,zoomOnScroll:T,zoomOnPinch:E,panOnScroll:V,panOnScrollSpeed:A,panOnScrollMode:L,zoomOnDoubleClick:P,panOnDrag:!ie&&I,defaultViewport:$,translateExtent:U,minZoom:te,maxZoom:z,zoomActivationKeyCode:j,preventScrolling:Q,noWheelClassName:Y,noPanClassName:J},ae.createElement(ZW,{onSelectionStart:y,onSelectionEnd:w,onPaneClick:e,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:i,onPaneScroll:a,panOnDrag:I,isSelecting:!!ee,selectionMode:x},t,R&&ae.createElement(J7e,{onSelectionContextMenu:F,noPanClassName:J,disableKeyboardA11y:X})))};rG.displayName="FlowRenderer";var tCe=b.memo(rG);function nCe(t){return hr(b.useCallback(n=>t?MW(n.nodeInternals,{x:0,y:0,width:n.width,height:n.height},n.transform,!0):n.getNodes(),[t]))}function rCe(t){const e={input:i0(t.input||qW),default:i0(t.default||ij),output:i0(t.output||HW),group:i0(t.group||r7)},n={},r=Object.keys(t).filter(s=>!["input","default","output","group"].includes(s)).reduce((s,i)=>(s[i]=i0(t[i]||ij),s),n);return{...e,...r}}const sCe=({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]},iCe=t=>({nodesDraggable:t.nodesDraggable,nodesConnectable:t.nodesConnectable,nodesFocusable:t.nodesFocusable,elementsSelectable:t.elementsSelectable,updateNodeDimensions:t.updateNodeDimensions,onError:t.onError}),sG=t=>{const{nodesDraggable:e,nodesConnectable:n,nodesFocusable:r,elementsSelectable:s,updateNodeDimensions:i,onError:a}=hr(iCe,ks),l=nCe(t.onlyRenderVisibleElements),c=b.useRef(),d=b.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const h=new ResizeObserver(m=>{const g=m.map(x=>({id:x.target.getAttribute("data-id"),nodeElement:x.target,forceUpdate:!0}));i(g)});return c.current=h,h},[]);return b.useEffect(()=>()=>{c?.current?.disconnect()},[]),ae.createElement("div",{className:"react-flow__nodes",style:i7},l.map(h=>{let m=h.type||"default";t.nodeTypes[m]||(a?.("003",Gl.error003(m)),m="default");const g=t.nodeTypes[m]||t.nodeTypes.default,x=!!(h.draggable||e&&typeof h.draggable>"u"),y=!!(h.selectable||s&&typeof h.selectable>"u"),w=!!(h.connectable||n&&typeof h.connectable>"u"),S=!!(h.focusable||r&&typeof h.focusable>"u"),k=t.nodeExtent?KN(h.positionAbsolute,t.nodeExtent):h.positionAbsolute,j=k?.x??0,N=k?.y??0,T=sCe({x:j,y:N,width:h.width??0,height:h.height??0,origin:t.nodeOrigin});return ae.createElement(g,{key:h.id,id:h.id,className:h.className,style:h.style,type:m,data:h.data,sourcePosition:h.sourcePosition||wt.Bottom,targetPosition:h.targetPosition||wt.Top,hidden:h.hidden,xPos:j,yPos:N,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:!!h.selected,isDraggable:x,isSelectable:y,isConnectable:w,isFocusable:S,resizeObserver:d,dragHandle:h.dragHandle,zIndex:h[Lr]?.z??0,isParent:!!h[Lr]?.isParent,noDragClassName:t.noDragClassName,noPanClassName:t.noPanClassName,initialized:!!h.width&&!!h.height,rfId:t.rfId,disableKeyboardA11y:t.disableKeyboardA11y,ariaLabel:h.ariaLabel,hasHandleBounds:!!h[Lr]?.handleBounds})}))};sG.displayName="NodeRenderer";var aCe=b.memo(sG);const oCe=(t,e,n)=>n===wt.Left?t-e:n===wt.Right?t+e:t,lCe=(t,e,n)=>n===wt.Top?t-e:n===wt.Bottom?t+e:t,OD="react-flow__edgeupdater",jD=({position:t,centerX:e,centerY:n,radius:r=10,onMouseDown:s,onMouseEnter:i,onMouseOut:a,type:l})=>ae.createElement("circle",{onMouseDown:s,onMouseEnter:i,onMouseOut:a,className:Bs([OD,`${OD}-${l}`]),cx:oCe(e,r,t),cy:lCe(n,r,t),r,stroke:"transparent",fill:"transparent"}),cCe=()=>!0;var fh=t=>{const e=({id:n,className:r,type:s,data:i,onClick:a,onEdgeDoubleClick:l,selected:c,animated:d,label:h,labelStyle:m,labelShowBg:g,labelBgStyle:x,labelBgPadding:y,labelBgBorderRadius:w,style:S,source:k,target:j,sourceX:N,sourceY:T,targetX:E,targetY:_,sourcePosition:A,targetPosition:L,elementsSelectable:P,hidden:B,sourceHandleId:$,targetHandleId:U,onContextMenu:te,onMouseEnter:z,onMouseMove:Q,onMouseLeave:F,reconnectRadius:Y,onReconnect:J,onReconnectStart:X,onReconnectEnd:R,markerEnd:ie,markerStart:G,rfId:I,ariaLabel:V,isFocusable:ee,isReconnectable:ne,pathOptions:W,interactionWidth:se,disableKeyboardA11y:re})=>{const oe=b.useRef(null),[Te,We]=b.useState(!1),[Ye,Je]=b.useState(!1),Oe=ps(),Ve=b.useMemo(()=>`url('#${rj(G,I)}')`,[G,I]),Ue=b.useMemo(()=>`url('#${rj(ie,I)}')`,[ie,I]);if(B)return null;const He=Mt=>{const{edges:zn,addSelectedEdges:Fe,unselectNodesAndEdges:rt,multiSelectionActive:tn}=Oe.getState(),Rt=zn.find(ke=>ke.id===n);Rt&&(P&&(Oe.setState({nodesSelectionActive:!1}),Rt.selected&&tn?(rt({nodes:[],edges:[Rt]}),oe.current?.blur()):Fe([n])),a&&a(Mt,Rt))},Ot=r0(n,Oe.getState,l),xt=r0(n,Oe.getState,te),kn=r0(n,Oe.getState,z),It=r0(n,Oe.getState,Q),Yt=r0(n,Oe.getState,F),_t=(Mt,zn)=>{if(Mt.button!==0)return;const{edges:Fe,isValidConnection:rt}=Oe.getState(),tn=zn?j:k,Rt=(zn?U:$)||null,ke=zn?"target":"source",Pe=rt||cCe,it=zn,ot=Fe.find(pt=>pt.id===n);Je(!0),X?.(Mt,ot,ke);const nn=pt=>{Je(!1),R?.(pt,ot,ke)};IW({event:Mt,handleId:Rt,nodeId:tn,onConnect:pt=>J?.(ot,pt),isTarget:it,getState:Oe.getState,setState:Oe.setState,isValidConnection:Pe,edgeUpdaterType:ke,onReconnectEnd:nn})},mt=Mt=>_t(Mt,!0),Ne=Mt=>_t(Mt,!1),Ie=()=>We(!0),st=()=>We(!1),yt=!P&&!a,Pt=Mt=>{if(!re&&jW.includes(Mt.key)&&P){const{unselectNodesAndEdges:zn,addSelectedEdges:Fe,edges:rt}=Oe.getState();Mt.key==="Escape"?(oe.current?.blur(),zn({edges:[rt.find(Rt=>Rt.id===n)]})):Fe([n])}};return ae.createElement("g",{className:Bs(["react-flow__edge",`react-flow__edge-${s}`,r,{selected:c,animated:d,inactive:yt,updating:Te}]),onClick:He,onDoubleClick:Ot,onContextMenu:xt,onMouseEnter:kn,onMouseMove:It,onMouseLeave:Yt,onKeyDown:ee?Pt:void 0,tabIndex:ee?0:void 0,role:ee?"button":"img","data-testid":`rf__edge-${n}`,"aria-label":V===null?void 0:V||`Edge from ${k} to ${j}`,"aria-describedby":ee?`${UW}-${I}`:void 0,ref:oe},!Ye&&ae.createElement(t,{id:n,source:k,target:j,selected:c,animated:d,label:h,labelStyle:m,labelShowBg:g,labelBgStyle:x,labelBgPadding:y,labelBgBorderRadius:w,data:i,style:S,sourceX:N,sourceY:T,targetX:E,targetY:_,sourcePosition:A,targetPosition:L,sourceHandleId:$,targetHandleId:U,markerStart:Ve,markerEnd:Ue,pathOptions:W,interactionWidth:se}),ne&&ae.createElement(ae.Fragment,null,(ne==="source"||ne===!0)&&ae.createElement(jD,{position:A,centerX:N,centerY:T,radius:Y,onMouseDown:mt,onMouseEnter:Ie,onMouseOut:st,type:"source"}),(ne==="target"||ne===!0)&&ae.createElement(jD,{position:L,centerX:E,centerY:_,radius:Y,onMouseDown:Ne,onMouseEnter:Ie,onMouseOut:st,type:"target"})))};return e.displayName="EdgeWrapper",b.memo(e)};function uCe(t){const e={default:fh(t.default||Ry),straight:fh(t.bezier||e7),step:fh(t.step||JN),smoothstep:fh(t.step||ew),simplebezier:fh(t.simplebezier||ZN)},n={},r=Object.keys(t).filter(s=>!["default","bezier"].includes(s)).reduce((s,i)=>(s[i]=fh(t[i]||Ry),s),n);return{...e,...r}}function ND(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 wt.Top:return{x:r+i/2,y:s};case wt.Right:return{x:r+i,y:s+a/2};case wt.Bottom:return{x:r+i/2,y:s+a};case wt.Left:return{x:r,y:s+a/2}}}function CD(t,e){return t?t.length===1||!e?t[0]:e&&t.find(n=>n.id===e)||null:null}const dCe=(t,e,n,r,s,i)=>{const a=ND(n,t,e),l=ND(i,r,s);return{sourceX:a.x,sourceY:a.y,targetX:l.x,targetY:l.y}};function hCe({sourcePos:t,targetPos:e,sourceWidth:n,sourceHeight:r,targetWidth:s,targetHeight:i,width:a,height:l,transform:c}){const d={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)};d.x===d.x2&&(d.x2+=1),d.y===d.y2&&(d.y2+=1);const h=wp({x:(0-c[0])/c[2],y:(0-c[1])/c[2],width:a/c[2],height:l/c[2]}),m=Math.max(0,Math.min(h.x2,d.x2)-Math.max(h.x,d.x)),g=Math.max(0,Math.min(h.y2,d.y2)-Math.max(h.y,d.y));return Math.ceil(m*g)>0}function TD(t){const e=t?.[Lr]?.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 fCe=[{level:0,isMaxLevel:!0,edges:[]}];function mCe(t,e,n=!1){let r=-1;const s=t.reduce((a,l)=>{const c=ka(l.zIndex);let d=c?l.zIndex:0;if(n){const h=e.get(l.target),m=e.get(l.source),g=l.selected||h?.selected||m?.selected,x=Math.max(m?.[Lr]?.z||0,h?.[Lr]?.z||0,1e3);d=(c?l.zIndex:0)+(g?x:0)}return a[d]?a[d].push(l):a[d]=[l],r=d>r?d:r,a},{}),i=Object.entries(s).map(([a,l])=>{const c=+a;return{edges:l,level:c,isMaxLevel:c===r}});return i.length===0?fCe:i}function pCe(t,e,n){const r=hr(b.useCallback(s=>t?s.edges.filter(i=>{const a=e.get(i.source),l=e.get(i.target);return a?.width&&a?.height&&l?.width&&l?.height&&hCe({sourcePos:a.positionAbsolute||{x:0,y:0},targetPos:l.positionAbsolute||{x:0,y:0},sourceWidth:a.width,sourceHeight:a.height,targetWidth:l.width,targetHeight:l.height,width:s.width,height:s.height,transform:s.transform})}):s.edges,[t,e]));return mCe(r,e,n)}const gCe=({color:t="none",strokeWidth:e=1})=>ae.createElement("polyline",{style:{stroke:t,strokeWidth:e},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),xCe=({color:t="none",strokeWidth:e=1})=>ae.createElement("polyline",{style:{stroke:t,fill:t,strokeWidth:e},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"}),ED={[My.Arrow]:gCe,[My.ArrowClosed]:xCe};function vCe(t){const e=ps();return b.useMemo(()=>Object.prototype.hasOwnProperty.call(ED,t)?ED[t]:(e.getState().onError?.("009",Gl.error009(t)),null),[t])}const yCe=({id:t,type:e,color:n,width:r=12.5,height:s=12.5,markerUnits:i="strokeWidth",strokeWidth:a,orient:l="auto-start-reverse"})=>{const c=vCe(e);return c?ae.createElement("marker",{className:"react-flow__arrowhead",id:t,markerWidth:`${r}`,markerHeight:`${s}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:l,refX:"0",refY:"0"},ae.createElement(c,{color:n,strokeWidth:a})):null},bCe=({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 l=rj(a,e);r.includes(l)||(s.push({id:l,color:a.color||t,...a}),r.push(l))}}),s),[]).sort((s,i)=>s.id.localeCompare(i.id))},iG=({defaultColor:t,rfId:e})=>{const n=hr(b.useCallback(bCe({defaultColor:t,rfId:e}),[t,e]),(r,s)=>!(r.length!==s.length||r.some((i,a)=>i.id!==s[a].id)));return ae.createElement("defs",null,n.map(r=>ae.createElement(yCe,{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})))};iG.displayName="MarkerDefinitions";var wCe=b.memo(iG);const SCe=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}),aG=({defaultMarkerColor:t,onlyRenderVisibleElements:e,elevateEdgesOnSelect:n,rfId:r,edgeTypes:s,noPanClassName:i,onEdgeContextMenu:a,onEdgeMouseEnter:l,onEdgeMouseMove:c,onEdgeMouseLeave:d,onEdgeClick:h,onEdgeDoubleClick:m,onReconnect:g,onReconnectStart:x,onReconnectEnd:y,reconnectRadius:w,children:S,disableKeyboardA11y:k})=>{const{edgesFocusable:j,edgesUpdatable:N,elementsSelectable:T,width:E,height:_,connectionMode:A,nodeInternals:L,onError:P}=hr(SCe,ks),B=pCe(e,L,n);return E?ae.createElement(ae.Fragment,null,B.map(({level:$,edges:U,isMaxLevel:te})=>ae.createElement("svg",{key:$,style:{zIndex:$},width:E,height:_,className:"react-flow__edges react-flow__container"},te&&ae.createElement(wCe,{defaultColor:t,rfId:r}),ae.createElement("g",null,U.map(z=>{const[Q,F,Y]=TD(L.get(z.source)),[J,X,R]=TD(L.get(z.target));if(!Y||!R)return null;let ie=z.type||"default";s[ie]||(P?.("011",Gl.error011(ie)),ie="default");const G=s[ie]||s.default,I=A===pd.Strict?X.target:(X.target??[]).concat(X.source??[]),V=CD(F.source,z.sourceHandle),ee=CD(I,z.targetHandle),ne=V?.position||wt.Bottom,W=ee?.position||wt.Top,se=!!(z.focusable||j&&typeof z.focusable>"u"),re=z.reconnectable||z.updatable,oe=typeof g<"u"&&(re||N&&typeof re>"u");if(!V||!ee)return P?.("008",Gl.error008(V,z)),null;const{sourceX:Te,sourceY:We,targetX:Ye,targetY:Je}=dCe(Q,V,ne,J,ee,W);return ae.createElement(G,{key:z.id,id:z.id,className:Bs([z.className,i]),type:ie,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:Te,sourceY:We,targetX:Ye,targetY:Je,sourcePosition:ne,targetPosition:W,elementsSelectable:T,onContextMenu:a,onMouseEnter:l,onMouseMove:c,onMouseLeave:d,onClick:h,onEdgeDoubleClick:m,onReconnect:g,onReconnectStart:x,onReconnectEnd:y,reconnectRadius:w,rfId:r,ariaLabel:z.ariaLabel,isFocusable:se,isReconnectable:oe,pathOptions:"pathOptions"in z?z.pathOptions:void 0,interactionWidth:z.interactionWidth,disableKeyboardA11y:k})})))),S):null};aG.displayName="EdgeRenderer";var kCe=b.memo(aG);const OCe=t=>`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]})`;function jCe({children:t}){const e=hr(OCe);return ae.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:e}},t)}function NCe(t){const e=s7(),n=b.useRef(!1);b.useEffect(()=>{!n.current&&e.viewportInitialized&&t&&(setTimeout(()=>t(e),1),n.current=!0)},[t,e.viewportInitialized])}const CCe={[wt.Left]:wt.Right,[wt.Right]:wt.Left,[wt.Top]:wt.Bottom,[wt.Bottom]:wt.Top},oG=({nodeId:t,handleType:e,style:n,type:r=Lc.Bezier,CustomComponent:s,connectionStatus:i})=>{const{fromNode:a,handleId:l,toX:c,toY:d,connectionMode:h}=hr(b.useCallback(_=>({fromNode:_.nodeInternals.get(t),handleId:_.connectionHandleId,toX:(_.connectionPosition.x-_.transform[0])/_.transform[2],toY:(_.connectionPosition.y-_.transform[1])/_.transform[2],connectionMode:_.connectionMode}),[t]),ks),m=a?.[Lr]?.handleBounds;let g=m?.[e];if(h===pd.Loose&&(g=g||m?.[e==="source"?"target":"source"]),!a||!g)return null;const x=l?g.find(_=>_.id===l):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,j=x?.position,N=j?CCe[j]:null;if(!j||!N)return null;if(s)return ae.createElement(s,{connectionLineType:r,connectionLineStyle:n,fromNode:a,fromHandle:x,fromX:S,fromY:k,toX:c,toY:d,fromPosition:j,toPosition:N,connectionStatus:i});let T="";const E={sourceX:S,sourceY:k,sourcePosition:j,targetX:c,targetY:d,targetPosition:N};return r===Lc.Bezier?[T]=_W(E):r===Lc.Step?[T]=nj({...E,borderRadius:0}):r===Lc.SmoothStep?[T]=nj(E):r===Lc.SimpleBezier?[T]=EW(E):T=`M${S},${k} ${c},${d}`,ae.createElement("path",{d:T,fill:"none",className:"react-flow__connection-path",style:n})};oG.displayName="ConnectionLine";const TCe=t=>({nodeId:t.connectionNodeId,handleType:t.connectionHandleType,nodesConnectable:t.nodesConnectable,connectionStatus:t.connectionStatus,width:t.width,height:t.height});function ECe({containerStyle:t,style:e,type:n,component:r}){const{nodeId:s,handleType:i,nodesConnectable:a,width:l,height:c,connectionStatus:d}=hr(TCe,ks);return!(s&&i&&l&&a)?null:ae.createElement("svg",{style:t,width:l,height:c,className:"react-flow__edges react-flow__connectionline react-flow__container"},ae.createElement("g",{className:Bs(["react-flow__connection",d])},ae.createElement(oG,{nodeId:s,handleType:i,style:e,type:n,CustomComponent:r,connectionStatus:d})))}function _D(t,e){return b.useRef(null),ps(),b.useMemo(()=>e(t),[t])}const lG=({nodeTypes:t,edgeTypes:e,onMove:n,onMoveStart:r,onMoveEnd:s,onInit:i,onNodeClick:a,onEdgeClick:l,onNodeDoubleClick:c,onEdgeDoubleClick:d,onNodeMouseEnter:h,onNodeMouseMove:m,onNodeMouseLeave:g,onNodeContextMenu:x,onSelectionContextMenu:y,onSelectionStart:w,onSelectionEnd:S,connectionLineType:k,connectionLineStyle:j,connectionLineComponent:N,connectionLineContainerStyle:T,selectionKeyCode:E,selectionOnDrag:_,selectionMode:A,multiSelectionKeyCode:L,panActivationKeyCode:P,zoomActivationKeyCode:B,deleteKeyCode:$,onlyRenderVisibleElements:U,elementsSelectable:te,selectNodesOnDrag:z,defaultViewport:Q,translateExtent:F,minZoom:Y,maxZoom:J,preventScrolling:X,defaultMarkerColor:R,zoomOnScroll:ie,zoomOnPinch:G,panOnScroll:I,panOnScrollSpeed:V,panOnScrollMode:ee,zoomOnDoubleClick:ne,panOnDrag:W,onPaneClick:se,onPaneMouseEnter:re,onPaneMouseMove:oe,onPaneMouseLeave:Te,onPaneScroll:We,onPaneContextMenu:Ye,onEdgeContextMenu:Je,onEdgeMouseEnter:Oe,onEdgeMouseMove:Ve,onEdgeMouseLeave:Ue,onReconnect:He,onReconnectStart:Ot,onReconnectEnd:xt,reconnectRadius:kn,noDragClassName:It,noWheelClassName:Yt,noPanClassName:_t,elevateEdgesOnSelect:mt,disableKeyboardA11y:Ne,nodeOrigin:Ie,nodeExtent:st,rfId:yt})=>{const Pt=_D(t,rCe),Mt=_D(e,uCe);return NCe(i),ae.createElement(tCe,{onPaneClick:se,onPaneMouseEnter:re,onPaneMouseMove:oe,onPaneMouseLeave:Te,onPaneContextMenu:Ye,onPaneScroll:We,deleteKeyCode:$,selectionKeyCode:E,selectionOnDrag:_,selectionMode:A,onSelectionStart:w,onSelectionEnd:S,multiSelectionKeyCode:L,panActivationKeyCode:P,zoomActivationKeyCode:B,elementsSelectable:te,onMove:n,onMoveStart:r,onMoveEnd:s,zoomOnScroll:ie,zoomOnPinch:G,zoomOnDoubleClick:ne,panOnScroll:I,panOnScrollSpeed:V,panOnScrollMode:ee,panOnDrag:W,defaultViewport:Q,translateExtent:F,minZoom:Y,maxZoom:J,onSelectionContextMenu:y,preventScrolling:X,noDragClassName:It,noWheelClassName:Yt,noPanClassName:_t,disableKeyboardA11y:Ne},ae.createElement(jCe,null,ae.createElement(kCe,{edgeTypes:Mt,onEdgeClick:l,onEdgeDoubleClick:d,onlyRenderVisibleElements:U,onEdgeContextMenu:Je,onEdgeMouseEnter:Oe,onEdgeMouseMove:Ve,onEdgeMouseLeave:Ue,onReconnect:He,onReconnectStart:Ot,onReconnectEnd:xt,reconnectRadius:kn,defaultMarkerColor:R,noPanClassName:_t,elevateEdgesOnSelect:!!mt,disableKeyboardA11y:Ne,rfId:yt},ae.createElement(ECe,{style:j,type:k,component:N,containerStyle:T})),ae.createElement("div",{className:"react-flow__edgelabel-renderer"}),ae.createElement(aCe,{nodeTypes:Pt,onNodeClick:a,onNodeDoubleClick:c,onNodeMouseEnter:h,onNodeMouseMove:m,onNodeMouseLeave:g,onNodeContextMenu:x,selectNodesOnDrag:z,onlyRenderVisibleElements:U,noPanClassName:_t,noDragClassName:It,disableKeyboardA11y:Ne,nodeOrigin:Ie,nodeExtent:st,rfId:yt})))};lG.displayName="GraphView";var _Ce=b.memo(lG);const oj=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Ec={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:oj,nodeExtent:oj,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:pd.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:s7e,isValidConnection:void 0},ACe=()=>VOe((t,e)=>({...Ec,setNodes:n=>{const{nodeInternals:r,nodeOrigin:s,elevateNodesOnSelect:i}=e();t({nodeInternals:u5(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?u5(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:l,domNode:c,nodeOrigin:d}=e(),h=c?.querySelector(".react-flow__viewport");if(!h)return;const m=window.getComputedStyle(h),{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,[Lr]:{...k[Lr],handleBounds:void 0}});else if(k){const j=YN(S.nodeElement);!!(j.width&&j.height&&(k.width!==j.width||k.height!==j.height||S.forceUpdate))&&(s.set(k.id,{...k,[Lr]:{...k[Lr],handleBounds:{source:kD(".source",S.nodeElement,g,d),target:kD(".target",S.nodeElement,g,d)}},...j}),w.push({id:k.id,type:"dimensions",dimensions:j}))}return w},[]);GW(s,d);const y=a||i&&!a&&XW(e,{initial:!0,...l});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(l=>{const c={id:l.id,type:"position",dragging:s};return r&&(c.positionAbsolute=l.positionAbsolute,c.position=l.position),c});i(a)},triggerNodeChanges:n=>{const{onNodesChange:r,nodeInternals:s,hasDefaultNodes:i,nodeOrigin:a,getNodes:l,elevateNodesOnSelect:c}=e();if(n?.length){if(i){const d=KW(n,l()),h=u5(d,s,a,c);t({nodeInternals:h})}r?.(n)}},addSelectedNodes:n=>{const{multiSelectionActive:r,edges:s,getNodes:i}=e();let a,l=null;r?a=n.map(c=>Pc(c,!0)):(a=Eh(i(),n),l=Eh(s,[])),Q1({changedNodes:a,changedEdges:l,get:e,set:t})},addSelectedEdges:n=>{const{multiSelectionActive:r,edges:s,getNodes:i}=e();let a,l=null;r?a=n.map(c=>Pc(c,!0)):(a=Eh(s,n),l=Eh(i(),[])),Q1({changedNodes:l,changedEdges:a,get:e,set:t})},unselectNodesAndEdges:({nodes:n,edges:r}={})=>{const{edges:s,getNodes:i}=e(),a=n||i(),l=r||s,c=a.map(h=>(h.selected=!1,Pc(h.id,!1))),d=l.map(h=>Pc(h.id,!1));Q1({changedNodes:c,changedEdges:d,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(l=>l.selected).map(l=>Pc(l.id,!1)),a=n.filter(l=>l.selected).map(l=>Pc(l.id,!1));Q1({changedNodes:i,changedEdges:a,get:e,set:t})},setNodeExtent:n=>{const{nodeInternals:r}=e();r.forEach(s=>{s.positionAbsolute=KN(s.position,n)}),t({nodeExtent:n,nodeInternals:new Map(r)})},panBy:n=>{const{transform:r,width:s,height:i,d3Zoom:a,d3Selection:l,translateExtent:c}=e();if(!a||!l||!n.x&&!n.y)return!1;const d=Fl.translate(r[0]+n.x,r[1]+n.y).scale(r[2]),h=[[0,0],[s,i]],m=a?.constrain()(d,h,c);return a.transform(l,m),r[0]!==m.x||r[1]!==m.y||r[2]!==m.k},cancelConnection:()=>t({connectionNodeId:Ec.connectionNodeId,connectionHandleId:Ec.connectionHandleId,connectionHandleType:Ec.connectionHandleType,connectionStatus:Ec.connectionStatus,connectionStartHandle:Ec.connectionStartHandle,connectionEndHandle:Ec.connectionEndHandle}),reset:()=>t({...Ec})}),Object.is),cG=({children:t})=>{const e=b.useRef(null);return e.current||(e.current=ACe()),ae.createElement(KNe,{value:e.current},t)};cG.displayName="ReactFlowProvider";const uG=({children:t})=>b.useContext(Zb)?ae.createElement(ae.Fragment,null,t):ae.createElement(cG,null,t);uG.displayName="ReactFlowWrapper";const MCe={input:qW,default:ij,output:HW,group:r7},RCe={default:Ry,straight:e7,step:JN,smoothstep:ew,simplebezier:ZN},DCe=[0,0],PCe=[15,15],zCe={x:0,y:0,zoom:1},ICe={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},dG=b.forwardRef(({nodes:t,edges:e,defaultNodes:n,defaultEdges:r,className:s,nodeTypes:i=MCe,edgeTypes:a=RCe,onNodeClick:l,onEdgeClick:c,onInit:d,onMove:h,onMoveStart:m,onMoveEnd:g,onConnect:x,onConnectStart:y,onConnectEnd:w,onClickConnectStart:S,onClickConnectEnd:k,onNodeMouseEnter:j,onNodeMouseMove:N,onNodeMouseLeave:T,onNodeContextMenu:E,onNodeDoubleClick:_,onNodeDragStart:A,onNodeDrag:L,onNodeDragStop:P,onNodesDelete:B,onEdgesDelete:$,onSelectionChange:U,onSelectionDragStart:te,onSelectionDrag:z,onSelectionDragStop:Q,onSelectionContextMenu:F,onSelectionStart:Y,onSelectionEnd:J,connectionMode:X=pd.Strict,connectionLineType:R=Lc.Bezier,connectionLineStyle:ie,connectionLineComponent:G,connectionLineContainerStyle:I,deleteKeyCode:V="Backspace",selectionKeyCode:ee="Shift",selectionOnDrag:ne=!1,selectionMode:W=Sp.Full,panActivationKeyCode:se="Space",multiSelectionKeyCode:re=Ay()?"Meta":"Control",zoomActivationKeyCode:oe=Ay()?"Meta":"Control",snapToGrid:Te=!1,snapGrid:We=PCe,onlyRenderVisibleElements:Ye=!1,selectNodesOnDrag:Je=!0,nodesDraggable:Oe,nodesConnectable:Ve,nodesFocusable:Ue,nodeOrigin:He=DCe,edgesFocusable:Ot,edgesUpdatable:xt,elementsSelectable:kn,defaultViewport:It=zCe,minZoom:Yt=.5,maxZoom:_t=2,translateExtent:mt=oj,preventScrolling:Ne=!0,nodeExtent:Ie,defaultMarkerColor:st="#b1b1b7",zoomOnScroll:yt=!0,zoomOnPinch:Pt=!0,panOnScroll:Mt=!1,panOnScrollSpeed:zn=.5,panOnScrollMode:Fe=Wu.Free,zoomOnDoubleClick:rt=!0,panOnDrag:tn=!0,onPaneClick:Rt,onPaneMouseEnter:ke,onPaneMouseMove:Pe,onPaneMouseLeave:it,onPaneScroll:ot,onPaneContextMenu:nn,children:Kt,onEdgeContextMenu:pt,onEdgeDoubleClick:xr,onEdgeMouseEnter:Ur,onEdgeMouseMove:Wr,onEdgeMouseLeave:vr,onEdgeUpdate:In,onEdgeUpdateStart:cr,onEdgeUpdateEnd:nr,onReconnect:gs,onReconnectStart:xs,onReconnectEnd:js,reconnectRadius:ge=10,edgeUpdaterRadius:Le=10,onNodesChange:Ct,onEdgesChange:vn,noDragClassName:Fr="nodrag",noWheelClassName:Cr="nowheel",noPanClassName:Tr="nopan",fitView:Ns=!1,fitViewOptions:Qf,connectOnClick:lw=!0,attributionPosition:cw,proOptions:Eg,defaultEdgeOptions:mu,elevateNodesOnSelect:Vf=!0,elevateEdgesOnSelect:ec=!1,disableKeyboardA11y:Yo=!1,autoPanOnConnect:pu=!0,autoPanOnNodeDrag:tc=!0,connectionRadius:Gr=20,isValidConnection:_g,onError:Ag,style:Ko,id:Zo,nodeDragThreshold:uw,...Mg},Rg)=>{const Uf=Zo||"1";return ae.createElement("div",{...Mg,style:{...Ko,...ICe},ref:Rg,className:Bs(["react-flow",s]),"data-testid":"rf__wrapper",id:Zo},ae.createElement(uG,null,ae.createElement(_Ce,{onInit:d,onMove:h,onMoveStart:m,onMoveEnd:g,onNodeClick:l,onEdgeClick:c,onNodeMouseEnter:j,onNodeMouseMove:N,onNodeMouseLeave:T,onNodeContextMenu:E,onNodeDoubleClick:_,nodeTypes:i,edgeTypes:a,connectionLineType:R,connectionLineStyle:ie,connectionLineComponent:G,connectionLineContainerStyle:I,selectionKeyCode:ee,selectionOnDrag:ne,selectionMode:W,deleteKeyCode:V,multiSelectionKeyCode:re,panActivationKeyCode:se,zoomActivationKeyCode:oe,onlyRenderVisibleElements:Ye,selectNodesOnDrag:Je,defaultViewport:It,translateExtent:mt,minZoom:Yt,maxZoom:_t,preventScrolling:Ne,zoomOnScroll:yt,zoomOnPinch:Pt,zoomOnDoubleClick:rt,panOnScroll:Mt,panOnScrollSpeed:zn,panOnScrollMode:Fe,panOnDrag:tn,onPaneClick:Rt,onPaneMouseEnter:ke,onPaneMouseMove:Pe,onPaneMouseLeave:it,onPaneScroll:ot,onPaneContextMenu:nn,onSelectionContextMenu:F,onSelectionStart:Y,onSelectionEnd:J,onEdgeContextMenu:pt,onEdgeDoubleClick:xr,onEdgeMouseEnter:Ur,onEdgeMouseMove:Wr,onEdgeMouseLeave:vr,onReconnect:gs??In,onReconnectStart:xs??cr,onReconnectEnd:js??nr,reconnectRadius:ge??Le,defaultMarkerColor:st,noDragClassName:Fr,noWheelClassName:Cr,noPanClassName:Tr,elevateEdgesOnSelect:ec,rfId:Uf,disableKeyboardA11y:Yo,nodeOrigin:He,nodeExtent:Ie}),ae.createElement(C7e,{nodes:t,edges:e,defaultNodes:n,defaultEdges:r,onConnect:x,onConnectStart:y,onConnectEnd:w,onClickConnectStart:S,onClickConnectEnd:k,nodesDraggable:Oe,nodesConnectable:Ve,nodesFocusable:Ue,edgesFocusable:Ot,edgesUpdatable:xt,elementsSelectable:kn,elevateNodesOnSelect:Vf,minZoom:Yt,maxZoom:_t,nodeExtent:Ie,onNodesChange:Ct,onEdgesChange:vn,snapToGrid:Te,snapGrid:We,connectionMode:X,translateExtent:mt,connectOnClick:lw,defaultEdgeOptions:mu,fitView:Ns,fitViewOptions:Qf,onNodesDelete:B,onEdgesDelete:$,onNodeDragStart:A,onNodeDrag:L,onNodeDragStop:P,onSelectionDrag:z,onSelectionDragStart:te,onSelectionDragStop:Q,noPanClassName:Tr,nodeOrigin:He,rfId:Uf,autoPanOnConnect:pu,autoPanOnNodeDrag:tc,onError:Ag,connectionRadius:Gr,isValidConnection:_g,nodeDragThreshold:uw}),ae.createElement(j7e,{onSelectionChange:U}),Kt,ae.createElement(JNe,{proOptions:Eg,position:cw}),ae.createElement(M7e,{rfId:Uf,disableKeyboardA11y:Yo})))});dG.displayName="ReactFlow";function hG(t){return e=>{const[n,r]=b.useState(e),s=b.useCallback(i=>r(a=>t(i,a)),[]);return[n,r,s]}}const LCe=hG(KW),BCe=hG(U7e),fG=({id:t,x:e,y:n,width:r,height:s,style:i,color:a,strokeColor:l,strokeWidth:c,className:d,borderRadius:h,shapeRendering:m,onClick:g,selected:x})=>{const{background:y,backgroundColor:w}=i||{},S=a||y||w;return ae.createElement("rect",{className:Bs(["react-flow__minimap-node",{selected:x},d]),x:e,y:n,rx:h,ry:h,width:r,height:s,fill:S,stroke:l,strokeWidth:c,shapeRendering:m,onClick:g?k=>g(k,t):void 0})};fG.displayName="MiniMapNode";var FCe=b.memo(fG);const qCe=t=>t.nodeOrigin,$Ce=t=>t.getNodes().filter(e=>!e.hidden&&e.width&&e.height),m5=t=>t instanceof Function?t:()=>t;function HCe({nodeStrokeColor:t="transparent",nodeColor:e="#e2e2e2",nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:s=2,nodeComponent:i=FCe,onClick:a}){const l=hr($Ce,ks),c=hr(qCe),d=m5(e),h=m5(t),m=m5(n),g=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return ae.createElement(ae.Fragment,null,l.map(x=>{const{x:y,y:w}=td(x,c).positionAbsolute;return ae.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:d(x),borderRadius:r,strokeColor:h(x),strokeWidth:s,shapeRendering:g,onClick:a,id:x.id})}))}var QCe=b.memo(HCe);const VCe=200,UCe=150,WCe=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?n7e(tw(e,t.nodeOrigin),n):n,rfId:t.rfId}},GCe="react-flow__minimap-desc";function mG({style:t,className:e,nodeStrokeColor:n="transparent",nodeColor:r="#e2e2e2",nodeClassName:s="",nodeBorderRadius:i=5,nodeStrokeWidth:a=2,nodeComponent:l,maskColor:c="rgb(240, 240, 240, 0.6)",maskStrokeColor:d="none",maskStrokeWidth:h=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:j=10,offsetScale:N=5}){const T=ps(),E=b.useRef(null),{boundingRect:_,viewBB:A,rfId:L}=hr(WCe,ks),P=t?.width??VCe,B=t?.height??UCe,$=_.width/P,U=_.height/B,te=Math.max($,U),z=te*P,Q=te*B,F=N*te,Y=_.x-(z-_.width)/2-F,J=_.y-(Q-_.height)/2-F,X=z+F*2,R=Q+F*2,ie=`${GCe}-${L}`,G=b.useRef(0);G.current=te,b.useEffect(()=>{if(E.current){const ee=ma(E.current),ne=re=>{const{transform:oe,d3Selection:Te,d3Zoom:We}=T.getState();if(re.sourceEvent.type!=="wheel"||!Te||!We)return;const Ye=-re.sourceEvent.deltaY*(re.sourceEvent.deltaMode===1?.05:re.sourceEvent.deltaMode?1:.002)*j,Je=oe[2]*Math.pow(2,Ye);We.scaleTo(Te,Je)},W=re=>{const{transform:oe,d3Selection:Te,d3Zoom:We,translateExtent:Ye,width:Je,height:Oe}=T.getState();if(re.sourceEvent.type!=="mousemove"||!Te||!We)return;const Ve=G.current*Math.max(1,oe[2])*(k?-1:1),Ue={x:oe[0]-re.sourceEvent.movementX*Ve,y:oe[1]-re.sourceEvent.movementY*Ve},He=[[0,0],[Je,Oe]],Ot=Fl.translate(Ue.x,Ue.y).scale(oe[2]),xt=We.constrain()(Ot,He,Ye);We.transform(Te,xt)},se=yW().on("zoom",y?W:null).on("zoom.wheel",w?ne:null);return ee.call(se),()=>{ee.on("zoom",null)}}},[y,w,k,j]);const I=g?ee=>{const ne=Ha(ee);g(ee,{x:ne[0],y:ne[1]})}:void 0,V=x?(ee,ne)=>{const W=T.getState().nodeInternals.get(ne);x(ee,W)}:void 0;return ae.createElement(Jb,{position:m,style:t,className:Bs(["react-flow__minimap",e]),"data-testid":"rf__minimap"},ae.createElement("svg",{width:P,height:B,viewBox:`${Y} ${J} ${X} ${R}`,role:"img","aria-labelledby":ie,ref:E,onClick:I},S&&ae.createElement("title",{id:ie},S),ae.createElement(QCe,{onClick:V,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:s,nodeStrokeWidth:a,nodeComponent:l}),ae.createElement("path",{className:"react-flow__minimap-mask",d:`M${Y-F},${J-F}h${X+F*2}v${R+F*2}h${-X-F*2}z
M${A.x},${A.y}h${A.width}v${A.height}h${-A.width}z`,fill:c,fillRule:"evenodd",stroke:d,strokeWidth:h,pointerEvents:"none"})))}mG.displayName="MiniMap";var XCe=b.memo(mG);function YCe(){return ae.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},ae.createElement("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"}))}function KCe(){return ae.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},ae.createElement("path",{d:"M0 0h32v4.2H0z"}))}function ZCe(){return ae.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},ae.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 JCe(){return ae.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},ae.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 e8e(){return ae.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},ae.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 p0=({children:t,className:e,...n})=>ae.createElement("button",{type:"button",className:Bs(["react-flow__controls-button",e]),...n},t);p0.displayName="ControlButton";const t8e=t=>({isInteractive:t.nodesDraggable||t.nodesConnectable||t.elementsSelectable,minZoomReached:t.transform[2]<=t.minZoom,maxZoomReached:t.transform[2]>=t.maxZoom}),pG=({style:t,showZoom:e=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:s,onZoomIn:i,onZoomOut:a,onFitView:l,onInteractiveChange:c,className:d,children:h,position:m="bottom-left"})=>{const g=ps(),[x,y]=b.useState(!1),{isInteractive:w,minZoomReached:S,maxZoomReached:k}=hr(t8e,ks),{zoomIn:j,zoomOut:N,fitView:T}=s7();if(b.useEffect(()=>{y(!0)},[]),!x)return null;const E=()=>{j(),i?.()},_=()=>{N(),a?.()},A=()=>{T(s),l?.()},L=()=>{g.setState({nodesDraggable:!w,nodesConnectable:!w,elementsSelectable:!w}),c?.(!w)};return ae.createElement(Jb,{className:Bs(["react-flow__controls",d]),position:m,style:t,"data-testid":"rf__controls"},e&&ae.createElement(ae.Fragment,null,ae.createElement(p0,{onClick:E,className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:k},ae.createElement(YCe,null)),ae.createElement(p0,{onClick:_,className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:S},ae.createElement(KCe,null))),n&&ae.createElement(p0,{className:"react-flow__controls-fitview",onClick:A,title:"fit view","aria-label":"fit view"},ae.createElement(ZCe,null)),r&&ae.createElement(p0,{className:"react-flow__controls-interactive",onClick:L,title:"toggle interactivity","aria-label":"toggle interactivity"},w?ae.createElement(e8e,null):ae.createElement(JCe,null)),h)};pG.displayName="Controls";var n8e=b.memo(pG),Ca;(function(t){t.Lines="lines",t.Dots="dots",t.Cross="cross"})(Ca||(Ca={}));function r8e({color:t,dimensions:e,lineWidth:n}){return ae.createElement("path",{stroke:t,strokeWidth:n,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`})}function s8e({color:t,radius:e}){return ae.createElement("circle",{cx:e,cy:e,r:e,fill:t})}const i8e={[Ca.Dots]:"#91919a",[Ca.Lines]:"#eee",[Ca.Cross]:"#e2e2e2"},a8e={[Ca.Dots]:1,[Ca.Lines]:1,[Ca.Cross]:6},o8e=t=>({transform:t.transform,patternId:`pattern-${t.rfId}`});function gG({id:t,variant:e=Ca.Dots,gap:n=20,size:r,lineWidth:s=1,offset:i=2,color:a,style:l,className:c}){const d=b.useRef(null),{transform:h,patternId:m}=hr(o8e,ks),g=a||i8e[e],x=r||a8e[e],y=e===Ca.Dots,w=e===Ca.Cross,S=Array.isArray(n)?n:[n,n],k=[S[0]*h[2]||1,S[1]*h[2]||1],j=x*h[2],N=w?[j,j]:k,T=y?[j/i,j/i]:[N[0]/i,N[1]/i];return ae.createElement("svg",{className:Bs(["react-flow__background",c]),style:{...l,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:d,"data-testid":"rf__background"},ae.createElement("pattern",{id:m+t,x:h[0]%k[0],y:h[1]%k[1],width:k[0],height:k[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${T[0]},-${T[1]})`},y?ae.createElement(s8e,{color:g,radius:j/i}):ae.createElement(r8e,{dimensions:N,color:g,lineWidth:s})),ae.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${m+t})`}))}gG.displayName="Background";var l8e=b.memo(gG);function a7(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 p5,AD;function c8e(){if(AD)return p5;AD=1;var t=qz(),e=4;function n(r){return t(r,e)}return p5=n,p5}var g5,MD;function xG(){if(MD)return g5;MD=1;var t=FJ();function e(n){return typeof n=="function"?n:t}return g5=e,g5}var x5,RD;function vG(){if(RD)return x5;RD=1;var t=$z(),e=pj(),n=xG(),r=xd();function s(i,a){var l=r(i)?t:e;return l(i,n(a))}return x5=s,x5}var v5,DD;function yG(){return DD||(DD=1,v5=vG()),v5}var y5,PD;function u8e(){if(PD)return y5;PD=1;var t=pj();function e(n,r){var s=[];return t(n,function(i,a,l){r(i,a,l)&&s.push(i)}),s}return y5=e,y5}var b5,zD;function bG(){if(zD)return b5;zD=1;var t=qJ(),e=u8e(),n=gj(),r=xd();function s(i,a){var l=r(i)?t:e;return l(i,n(a,3))}return b5=s,b5}var w5,ID;function d8e(){if(ID)return w5;ID=1;var t=Object.prototype,e=t.hasOwnProperty;function n(r,s){return r!=null&&e.call(r,s)}return w5=n,w5}var S5,LD;function wG(){if(LD)return S5;LD=1;var t=d8e(),e=$J();function n(r,s){return r!=null&&e(r,s,t)}return S5=n,S5}var k5,BD;function h8e(){if(BD)return k5;BD=1;var t=Hz(),e=Qz(),n=Vz(),r=xd(),s=xj(),i=vj(),a=HJ(),l=yj(),c="[object Map]",d="[object Set]",h=Object.prototype,m=h.hasOwnProperty;function g(x){if(x==null)return!0;if(s(x)&&(r(x)||typeof x=="string"||typeof x.splice=="function"||i(x)||l(x)||n(x)))return!x.length;var y=e(x);if(y==c||y==d)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 k5=g,k5}var O5,FD;function SG(){if(FD)return O5;FD=1;function t(e){return e===void 0}return O5=t,O5}var j5,qD;function f8e(){if(qD)return j5;qD=1;function t(e,n,r,s){var i=-1,a=e==null?0:e.length;for(s&&a&&(r=e[++i]);++i<a;)r=n(r,e[i],i,e);return r}return j5=t,j5}var N5,$D;function m8e(){if($D)return N5;$D=1;function t(e,n,r,s,i){return i(e,function(a,l,c){r=s?(s=!1,a):n(r,a,l,c)}),r}return N5=t,N5}var C5,HD;function kG(){if(HD)return C5;HD=1;var t=f8e(),e=pj(),n=gj(),r=m8e(),s=xd();function i(a,l,c){var d=s(a)?t:r,h=arguments.length<3;return d(a,n(l,4),c,h,e)}return C5=i,C5}var T5,QD;function p8e(){if(QD)return T5;QD=1;var t=QJ(),e=t("length");return T5=e,T5}var E5,VD;function g8e(){if(VD)return E5;VD=1;var t="\\ud800-\\udfff",e="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",r="\\u20d0-\\u20ff",s=e+n+r,i="\\ufe0e\\ufe0f",a="["+t+"]",l="["+s+"]",c="\\ud83c[\\udffb-\\udfff]",d="(?:"+l+"|"+c+")",h="[^"+t+"]",m="(?:\\ud83c[\\udde6-\\uddff]){2}",g="[\\ud800-\\udbff][\\udc00-\\udfff]",x="\\u200d",y=d+"?",w="["+i+"]?",S="(?:"+x+"(?:"+[h,m,g].join("|")+")"+w+y+")*",k=w+y+S,j="(?:"+[h+l+"?",l,m,g,a].join("|")+")",N=RegExp(c+"(?="+c+")|"+j+k,"g");function T(E){for(var _=N.lastIndex=0;N.test(E);)++_;return _}return E5=T,E5}var _5,UD;function x8e(){if(UD)return _5;UD=1;var t=p8e(),e=VJ(),n=g8e();function r(s){return e(s)?n(s):t(s)}return _5=r,_5}var A5,WD;function v8e(){if(WD)return A5;WD=1;var t=Hz(),e=Qz(),n=xj(),r=UJ(),s=x8e(),i="[object Map]",a="[object Set]";function l(c){if(c==null)return 0;if(n(c))return r(c)?s(c):c.length;var d=e(c);return d==i||d==a?c.size:t(c).length}return A5=l,A5}var M5,GD;function y8e(){if(GD)return M5;GD=1;var t=$z(),e=WJ(),n=GJ(),r=gj(),s=XJ(),i=xd(),a=vj(),l=bj(),c=Iy(),d=yj();function h(m,g,x){var y=i(m),w=y||a(m)||d(m);if(g=r(g,4),x==null){var S=m&&m.constructor;w?x=y?new S:[]:c(m)?x=l(S)?e(s(m)):{}:x={}}return(w?t:n)(m,function(k,j,N){return g(x,k,j,N)}),x}return M5=h,M5}var R5,XD;function OG(){if(XD)return R5;XD=1;var t=xj(),e=YJ();function n(r){return e(r)&&t(r)}return R5=n,R5}var D5,YD;function b8e(){if(YD)return D5;YD=1;var t=KJ(),e=wj(),n=ZJ(),r=OG(),s=e(function(i){return n(t(i,1,r,!0))});return D5=s,D5}var P5,KD;function w8e(){if(KD)return P5;KD=1;var t=JJ();function e(n,r){return t(r,function(s){return n[s]})}return P5=e,P5}var z5,ZD;function jG(){if(ZD)return z5;ZD=1;var t=w8e(),e=Uz();function n(r){return r==null?[]:t(r,e(r))}return z5=n,z5}var I5,JD;function za(){if(JD)return I5;JD=1;var t;if(typeof a7=="function")try{t={clone:c8e(),constant:Gz(),each:yG(),filter:bG(),has:wG(),isArray:xd(),isEmpty:h8e(),isFunction:bj(),isUndefined:SG(),keys:Uz(),map:Wz(),reduce:kG(),size:v8e(),transform:y8e(),union:b8e(),values:jG()}}catch{}return t||(t=window._),I5=t,I5}var L5,eP;function o7(){if(eP)return L5;eP=1;var t=za();L5=s;var e="\0",n="\0",r="";function s(h){this._isDirected=t.has(h,"directed")?h.directed:!0,this._isMultigraph=t.has(h,"multigraph")?h.multigraph:!1,this._isCompound=t.has(h,"compound")?h.compound:!1,this._label=void 0,this._defaultNodeLabelFn=t.constant(void 0),this._defaultEdgeLabelFn=t.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[n]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}s.prototype._nodeCount=0,s.prototype._edgeCount=0,s.prototype.isDirected=function(){return this._isDirected},s.prototype.isMultigraph=function(){return this._isMultigraph},s.prototype.isCompound=function(){return this._isCompound},s.prototype.setGraph=function(h){return this._label=h,this},s.prototype.graph=function(){return this._label},s.prototype.setDefaultNodeLabel=function(h){return t.isFunction(h)||(h=t.constant(h)),this._defaultNodeLabelFn=h,this},s.prototype.nodeCount=function(){return this._nodeCount},s.prototype.nodes=function(){return t.keys(this._nodes)},s.prototype.sources=function(){var h=this;return t.filter(this.nodes(),function(m){return t.isEmpty(h._in[m])})},s.prototype.sinks=function(){var h=this;return t.filter(this.nodes(),function(m){return t.isEmpty(h._out[m])})},s.prototype.setNodes=function(h,m){var g=arguments,x=this;return t.each(h,function(y){g.length>1?x.setNode(y,m):x.setNode(y)}),this},s.prototype.setNode=function(h,m){return t.has(this._nodes,h)?(arguments.length>1&&(this._nodes[h]=m),this):(this._nodes[h]=arguments.length>1?m:this._defaultNodeLabelFn(h),this._isCompound&&(this._parent[h]=n,this._children[h]={},this._children[n][h]=!0),this._in[h]={},this._preds[h]={},this._out[h]={},this._sucs[h]={},++this._nodeCount,this)},s.prototype.node=function(h){return this._nodes[h]},s.prototype.hasNode=function(h){return t.has(this._nodes,h)},s.prototype.removeNode=function(h){var m=this;if(t.has(this._nodes,h)){var g=function(x){m.removeEdge(m._edgeObjs[x])};delete this._nodes[h],this._isCompound&&(this._removeFromParentsChildList(h),delete this._parent[h],t.each(this.children(h),function(x){m.setParent(x)}),delete this._children[h]),t.each(t.keys(this._in[h]),g),delete this._in[h],delete this._preds[h],t.each(t.keys(this._out[h]),g),delete this._out[h],delete this._sucs[h],--this._nodeCount}return this},s.prototype.setParent=function(h,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===h)throw new Error("Setting "+m+" as parent of "+h+" would create a cycle");this.setNode(m)}return this.setNode(h),this._removeFromParentsChildList(h),this._parent[h]=m,this._children[m][h]=!0,this},s.prototype._removeFromParentsChildList=function(h){delete this._children[this._parent[h]][h]},s.prototype.parent=function(h){if(this._isCompound){var m=this._parent[h];if(m!==n)return m}},s.prototype.children=function(h){if(t.isUndefined(h)&&(h=n),this._isCompound){var m=this._children[h];if(m)return t.keys(m)}else{if(h===n)return this.nodes();if(this.hasNode(h))return[]}},s.prototype.predecessors=function(h){var m=this._preds[h];if(m)return t.keys(m)},s.prototype.successors=function(h){var m=this._sucs[h];if(m)return t.keys(m)},s.prototype.neighbors=function(h){var m=this.predecessors(h);if(m)return t.union(m,this.successors(h))},s.prototype.isLeaf=function(h){var m;return this.isDirected()?m=this.successors(h):m=this.neighbors(h),m.length===0},s.prototype.filterNodes=function(h){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){h(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(h){return t.isFunction(h)||(h=t.constant(h)),this._defaultEdgeLabelFn=h,this},s.prototype.edgeCount=function(){return this._edgeCount},s.prototype.edges=function(){return t.values(this._edgeObjs)},s.prototype.setPath=function(h,m){var g=this,x=arguments;return t.reduce(h,function(y,w){return x.length>1?g.setEdge(y,w,m):g.setEdge(y,w),w}),this},s.prototype.setEdge=function(){var h,m,g,x,y=!1,w=arguments[0];typeof w=="object"&&w!==null&&"v"in w?(h=w.v,m=w.w,g=w.name,arguments.length===2&&(x=arguments[1],y=!0)):(h=w,m=arguments[1],g=arguments[3],arguments.length>2&&(x=arguments[2],y=!0)),h=""+h,m=""+m,t.isUndefined(g)||(g=""+g);var S=l(this._isDirected,h,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(h),this.setNode(m),this._edgeLabels[S]=y?x:this._defaultEdgeLabelFn(h,m,g);var k=c(this._isDirected,h,m,g);return h=k.v,m=k.w,Object.freeze(k),this._edgeObjs[S]=k,i(this._preds[m],h),i(this._sucs[h],m),this._in[m][S]=k,this._out[h][S]=k,this._edgeCount++,this},s.prototype.edge=function(h,m,g){var x=arguments.length===1?d(this._isDirected,arguments[0]):l(this._isDirected,h,m,g);return this._edgeLabels[x]},s.prototype.hasEdge=function(h,m,g){var x=arguments.length===1?d(this._isDirected,arguments[0]):l(this._isDirected,h,m,g);return t.has(this._edgeLabels,x)},s.prototype.removeEdge=function(h,m,g){var x=arguments.length===1?d(this._isDirected,arguments[0]):l(this._isDirected,h,m,g),y=this._edgeObjs[x];return y&&(h=y.v,m=y.w,delete this._edgeLabels[x],delete this._edgeObjs[x],a(this._preds[m],h),a(this._sucs[h],m),delete this._in[m][x],delete this._out[h][x],this._edgeCount--),this},s.prototype.inEdges=function(h,m){var g=this._in[h];if(g){var x=t.values(g);return m?t.filter(x,function(y){return y.v===m}):x}},s.prototype.outEdges=function(h,m){var g=this._out[h];if(g){var x=t.values(g);return m?t.filter(x,function(y){return y.w===m}):x}},s.prototype.nodeEdges=function(h,m){var g=this.inEdges(h,m);if(g)return g.concat(this.outEdges(h,m))};function i(h,m){h[m]?h[m]++:h[m]=1}function a(h,m){--h[m]||delete h[m]}function l(h,m,g,x){var y=""+m,w=""+g;if(!h&&y>w){var S=y;y=w,w=S}return y+r+w+r+(t.isUndefined(x)?e:x)}function c(h,m,g,x){var y=""+m,w=""+g;if(!h&&y>w){var S=y;y=w,w=S}var k={v:y,w};return x&&(k.name=x),k}function d(h,m){return l(h,m.v,m.w,m.name)}return L5}var B5,tP;function S8e(){return tP||(tP=1,B5="2.1.8"),B5}var F5,nP;function k8e(){return nP||(nP=1,F5={Graph:o7(),version:S8e()}),F5}var q5,rP;function O8e(){if(rP)return q5;rP=1;var t=za(),e=o7();q5={write:n,read:i};function n(a){var l={options:{directed:a.isDirected(),multigraph:a.isMultigraph(),compound:a.isCompound()},nodes:r(a),edges:s(a)};return t.isUndefined(a.graph())||(l.value=t.clone(a.graph())),l}function r(a){return t.map(a.nodes(),function(l){var c=a.node(l),d=a.parent(l),h={v:l};return t.isUndefined(c)||(h.value=c),t.isUndefined(d)||(h.parent=d),h})}function s(a){return t.map(a.edges(),function(l){var c=a.edge(l),d={v:l.v,w:l.w};return t.isUndefined(l.name)||(d.name=l.name),t.isUndefined(c)||(d.value=c),d})}function i(a){var l=new e(a.options).setGraph(a.value);return t.each(a.nodes,function(c){l.setNode(c.v,c.value),c.parent&&l.setParent(c.v,c.parent)}),t.each(a.edges,function(c){l.setEdge({v:c.v,w:c.w,name:c.name},c.value)}),l}return q5}var $5,sP;function j8e(){if(sP)return $5;sP=1;var t=za();$5=e;function e(n){var r={},s=[],i;function a(l){t.has(r,l)||(r[l]=!0,i.push(l),t.each(n.successors(l),a),t.each(n.predecessors(l),a))}return t.each(n.nodes(),function(l){i=[],a(l),i.length&&s.push(i)}),s}return $5}var H5,iP;function NG(){if(iP)return H5;iP=1;var t=za();H5=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<r.length&&(a=r[s].priority<r[a].priority?s:a,i<r.length&&(a=r[i].priority<r[a].priority?i:a),a!==n&&(this._swap(n,a),this._heapify(a)))},e.prototype._decrease=function(n){for(var r=this._arr,s=r[n].priority,i;n!==0&&(i=n>>1,!(r[i].priority<s));)this._swap(n,i),n=i},e.prototype._swap=function(n,r){var s=this._arr,i=this._keyIndices,a=s[n],l=s[r];s[n]=l,s[r]=a,i[l.key]=n,i[a.key]=r},H5}var Q5,aP;function CG(){if(aP)return Q5;aP=1;var t=za(),e=NG();Q5=r;var n=t.constant(1);function r(i,a,l,c){return s(i,String(a),l||n,c||function(d){return i.outEdges(d)})}function s(i,a,l,c){var d={},h=new e,m,g,x=function(y){var w=y.v!==m?y.v:y.w,S=d[w],k=l(y),j=g.distance+k;if(k<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+y+" Weight: "+k);j<S.distance&&(S.distance=j,S.predecessor=m,h.decrease(w,j))};for(i.nodes().forEach(function(y){var w=y===a?0:Number.POSITIVE_INFINITY;d[y]={distance:w},h.add(y,w)});h.size()>0&&(m=h.removeMin(),g=d[m],g.distance!==Number.POSITIVE_INFINITY);)c(m).forEach(x);return d}return Q5}var V5,oP;function N8e(){if(oP)return V5;oP=1;var t=CG(),e=za();V5=n;function n(r,s,i){return e.transform(r.nodes(),function(a,l){a[l]=t(r,l,s,i)},{})}return V5}var U5,lP;function TG(){if(lP)return U5;lP=1;var t=za();U5=e;function e(n){var r=0,s=[],i={},a=[];function l(c){var d=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&&(d.lowlink=Math.min(d.lowlink,i[g].index)):(l(g),d.lowlink=Math.min(d.lowlink,i[g].lowlink))}),d.lowlink===d.index){var h=[],m;do m=s.pop(),i[m].onStack=!1,h.push(m);while(c!==m);a.push(h)}}return n.nodes().forEach(function(c){t.has(i,c)||l(c)}),a}return U5}var W5,cP;function C8e(){if(cP)return W5;cP=1;var t=za(),e=TG();W5=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 W5}var G5,uP;function T8e(){if(uP)return G5;uP=1;var t=za();G5=n;var e=t.constant(1);function n(s,i,a){return r(s,i||e,a||function(l){return s.outEdges(l)})}function r(s,i,a){var l={},c=s.nodes();return c.forEach(function(d){l[d]={},l[d][d]={distance:0},c.forEach(function(h){d!==h&&(l[d][h]={distance:Number.POSITIVE_INFINITY})}),a(d).forEach(function(h){var m=h.v===d?h.w:h.v,g=i(h);l[d][m]={distance:g,predecessor:d}})}),c.forEach(function(d){var h=l[d];c.forEach(function(m){var g=l[m];c.forEach(function(x){var y=g[d],w=h[x],S=g[x],k=y.distance+w.distance;k<S.distance&&(S.distance=k,S.predecessor=w.predecessor)})})}),l}return G5}var X5,dP;function EG(){if(dP)return X5;dP=1;var t=za();X5=e,e.CycleException=n;function e(r){var s={},i={},a=[];function l(c){if(t.has(i,c))throw new n;t.has(s,c)||(i[c]=!0,s[c]=!0,t.each(r.predecessors(c),l),delete i[c],a.push(c))}if(t.each(r.sinks(),l),t.size(s)!==r.nodeCount())throw new n;return a}function n(){}return n.prototype=new Error,X5}var Y5,hP;function E8e(){if(hP)return Y5;hP=1;var t=EG();Y5=e;function e(n){try{t(n)}catch(r){if(r instanceof t.CycleException)return!1;throw r}return!0}return Y5}var K5,fP;function _G(){if(fP)return K5;fP=1;var t=za();K5=e;function e(r,s,i){t.isArray(s)||(s=[s]);var a=(r.isDirected()?r.successors:r.neighbors).bind(r),l=[],c={};return t.each(s,function(d){if(!r.hasNode(d))throw new Error("Graph does not have node: "+d);n(r,d,i==="post",c,a,l)}),l}function n(r,s,i,a,l,c){t.has(a,s)||(a[s]=!0,i||c.push(s),t.each(l(s),function(d){n(r,d,i,a,l,c)}),i&&c.push(s))}return K5}var Z5,mP;function _8e(){if(mP)return Z5;mP=1;var t=_G();Z5=e;function e(n,r){return t(n,r,"post")}return Z5}var J5,pP;function A8e(){if(pP)return J5;pP=1;var t=_G();J5=e;function e(n,r){return t(n,r,"pre")}return J5}var e3,gP;function M8e(){if(gP)return e3;gP=1;var t=za(),e=o7(),n=NG();e3=r;function r(s,i){var a=new e,l={},c=new n,d;function h(g){var x=g.v===d?g.w:g.v,y=c.priority(x);if(y!==void 0){var w=i(g);w<y&&(l[x]=d,c.decrease(x,w))}}if(s.nodeCount()===0)return a;t.each(s.nodes(),function(g){c.add(g,Number.POSITIVE_INFINITY),a.setNode(g)}),c.decrease(s.nodes()[0],0);for(var m=!1;c.size()>0;){if(d=c.removeMin(),t.has(l,d))a.setEdge(d,l[d]);else{if(m)throw new Error("Input graph is not connected: "+s);m=!0}s.nodeEdges(d).forEach(h)}return a}return e3}var t3,xP;function R8e(){return xP||(xP=1,t3={components:j8e(),dijkstra:CG(),dijkstraAll:N8e(),findCycles:C8e(),floydWarshall:T8e(),isAcyclic:E8e(),postorder:_8e(),preorder:A8e(),prim:M8e(),tarjan:TG(),topsort:EG()}),t3}var n3,vP;function D8e(){if(vP)return n3;vP=1;var t=k8e();return n3={Graph:t.Graph,json:O8e(),alg:R8e(),version:t.version},n3}var r3,yP;function Ja(){if(yP)return r3;yP=1;var t;if(typeof a7=="function")try{t=D8e()}catch{}return t||(t=window.graphlib),r3=t,r3}var s3,bP;function P8e(){if(bP)return s3;bP=1;var t=qz(),e=1,n=4;function r(s){return t(s,e|n)}return s3=r,s3}var i3,wP;function z8e(){if(wP)return i3;wP=1;var t=wj(),e=Yz(),n=Xz(),r=Ly(),s=Object.prototype,i=s.hasOwnProperty,a=t(function(l,c){l=Object(l);var d=-1,h=c.length,m=h>2?c[2]:void 0;for(m&&n(c[0],c[1],m)&&(h=1);++d<h;)for(var g=c[d],x=r(g),y=-1,w=x.length;++y<w;){var S=x[y],k=l[S];(k===void 0||e(k,s[S])&&!i.call(l,S))&&(l[S]=g[S])}return l});return i3=a,i3}var a3,SP;function I8e(){if(SP)return a3;SP=1;var t=Kz(),e=xG(),n=Ly();function r(s,i){return s==null?s:t(s,e(i),n)}return a3=r,a3}var o3,kP;function AG(){if(kP)return o3;kP=1;var t=eee(),e=Yz();function n(r,s,i){(i!==void 0&&!e(r[s],i)||i===void 0&&!(s in r))&&t(r,s,i)}return o3=n,o3}var l3,OP;function MG(){if(OP)return l3;OP=1;function t(e,n){if(!(n==="constructor"&&typeof e[n]=="function")&&n!="__proto__")return e[n]}return l3=t,l3}var c3,jP;function L8e(){if(jP)return c3;jP=1;var t=tee(),e=Ly();function n(r){return t(r,e(r))}return c3=n,c3}var u3,NP;function B8e(){if(NP)return u3;NP=1;var t=AG(),e=nee(),n=ree(),r=aee(),s=see(),i=Vz(),a=xd(),l=OG(),c=vj(),d=bj(),h=Iy(),m=iee(),g=yj(),x=MG(),y=L8e();function w(S,k,j,N,T,E,_){var A=x(S,j),L=x(k,j),P=_.get(L);if(P){t(S,j,P);return}var B=E?E(A,L,j+"",S,k,_):void 0,$=B===void 0;if($){var U=a(L),te=!U&&c(L),z=!U&&!te&&g(L);B=L,U||te||z?a(A)?B=A:l(A)?B=r(A):te?($=!1,B=e(L,!0)):z?($=!1,B=n(L,!0)):B=[]:m(L)||i(L)?(B=A,i(A)?B=y(A):(!h(A)||d(A))&&(B=s(L))):$=!1}$&&(_.set(L,B),T(B,L,N,E,_),_.delete(L)),t(S,j,B)}return u3=w,u3}var d3,CP;function F8e(){if(CP)return d3;CP=1;var t=oee(),e=AG(),n=Kz(),r=B8e(),s=Iy(),i=Ly(),a=MG();function l(c,d,h,m,g){c!==d&&n(d,function(x,y){if(g||(g=new t),s(x))r(c,d,y,h,l,m,g);else{var w=m?m(a(c,y),x,y+"",c,d,g):void 0;w===void 0&&(w=x),e(c,y,w)}},i)}return d3=l,d3}var h3,TP;function q8e(){if(TP)return h3;TP=1;var t=wj(),e=Xz();function n(r){return t(function(s,i){var a=-1,l=i.length,c=l>1?i[l-1]:void 0,d=l>2?i[2]:void 0;for(c=r.length>3&&typeof c=="function"?(l--,c):void 0,d&&e(i[0],i[1],d)&&(c=l<3?void 0:c,l=1),s=Object(s);++a<l;){var h=i[a];h&&r(s,h,a,c)}return s})}return h3=n,h3}var f3,EP;function $8e(){if(EP)return f3;EP=1;var t=F8e(),e=q8e(),n=e(function(r,s,i){t(r,s,i)});return f3=n,f3}var m3,_P;function H8e(){if(_P)return m3;_P=1;var t=Zz(),e=Jz(),n=lee(),r=Iy(),s=cee();function i(a,l,c,d){if(!r(a))return a;l=e(l,a);for(var h=-1,m=l.length,g=m-1,x=a;x!=null&&++h<m;){var y=s(l[h]),w=c;if(y==="__proto__"||y==="constructor"||y==="prototype")return a;if(h!=g){var S=x[y];w=d?d(S,y,x):void 0,w===void 0&&(w=r(S)?S:n(l[h+1])?[]:{})}t(x,y,w),x=x[y]}return a}return m3=i,m3}var p3,AP;function Q8e(){if(AP)return p3;AP=1;var t=uee(),e=H8e(),n=Jz();function r(s,i,a){for(var l=-1,c=i.length,d={};++l<c;){var h=i[l],m=t(s,h);a(m,h)&&e(d,n(h,s),m)}return d}return p3=r,p3}var g3,MP;function V8e(){if(MP)return g3;MP=1;var t=Q8e(),e=dee();function n(r,s){return t(r,s,function(i,a){return e(r,a)})}return g3=n,g3}var x3,RP;function U8e(){if(RP)return x3;RP=1;var t=V8e(),e=hee(),n=e(function(r,s){return r==null?{}:t(r,s)});return x3=n,x3}var v3,DP;function W8e(){if(DP)return v3;DP=1;var t=fee(),e=0;function n(r){var s=++e;return t(r)+s}return v3=n,v3}var y3,PP;function G8e(){if(PP)return y3;PP=1;function t(e,n,r){for(var s=-1,i=e.length,a=n.length,l={};++s<i;){var c=s<a?n[s]:void 0;r(l,e[s],c)}return l}return y3=t,y3}var b3,zP;function X8e(){if(zP)return b3;zP=1;var t=Zz(),e=G8e();function n(r,s){return e(r||[],s||[],t)}return b3=n,b3}var w3,IP;function Nr(){if(IP)return w3;IP=1;var t;if(typeof a7=="function")try{t={cloneDeep:P8e(),constant:Gz(),defaults:z8e(),each:yG(),filter:bG(),find:kee(),flatten:See(),forEach:vG(),forIn:I8e(),has:wG(),isUndefined:SG(),last:wee(),map:Wz(),mapValues:bee(),max:yee(),merge:$8e(),min:vee(),minBy:xee(),now:gee(),pick:U8e(),range:pee(),reduce:kG(),sortBy:mee(),uniqueId:W8e(),values:jG(),zipObject:X8e()}}catch{}return t||(t=window._),w3=t,w3}var S3,LP;function Y8e(){if(LP)return S3;LP=1,S3=t;function t(){var r={};r._next=r._prev=r,this._sentinel=r}t.prototype.dequeue=function(){var r=this._sentinel,s=r._prev;if(s!==r)return e(s),s},t.prototype.enqueue=function(r){var s=this._sentinel;r._prev&&r._next&&e(r),r._next=s._next,s._next._prev=r,s._next=r,r._prev=s},t.prototype.toString=function(){for(var r=[],s=this._sentinel,i=s._prev;i!==s;)r.push(JSON.stringify(i,n)),i=i._prev;return"["+r.join(", ")+"]"};function e(r){r._prev._next=r._next,r._next._prev=r._prev,delete r._next,delete r._prev}function n(r,s){if(r!=="_next"&&r!=="_prev")return s}return S3}var k3,BP;function K8e(){if(BP)return k3;BP=1;var t=Nr(),e=Ja().Graph,n=Y8e();k3=s;var r=t.constant(1);function s(d,h){if(d.nodeCount()<=1)return[];var m=l(d,h||r),g=i(m.graph,m.buckets,m.zeroIdx);return t.flatten(t.map(g,function(x){return d.outEdges(x.v,x.w)}),!0)}function i(d,h,m){for(var g=[],x=h[h.length-1],y=h[0],w;d.nodeCount();){for(;w=y.dequeue();)a(d,h,m,w);for(;w=x.dequeue();)a(d,h,m,w);if(d.nodeCount()){for(var S=h.length-2;S>0;--S)if(w=h[S].dequeue(),w){g=g.concat(a(d,h,m,w,!0));break}}}return g}function a(d,h,m,g,x){var y=x?[]:void 0;return t.forEach(d.inEdges(g.v),function(w){var S=d.edge(w),k=d.node(w.v);x&&y.push({v:w.v,w:w.w}),k.out-=S,c(h,m,k)}),t.forEach(d.outEdges(g.v),function(w){var S=d.edge(w),k=w.w,j=d.node(k);j.in-=S,c(h,m,j)}),d.removeNode(g.v),y}function l(d,h){var m=new e,g=0,x=0;t.forEach(d.nodes(),function(S){m.setNode(S,{v:S,in:0,out:0})}),t.forEach(d.edges(),function(S){var k=m.edge(S.v,S.w)||0,j=h(S),N=k+j;m.setEdge(S.v,S.w,N),x=Math.max(x,m.node(S.v).out+=j),g=Math.max(g,m.node(S.w).in+=j)});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(d,h,m){m.out?m.in?d[m.out-m.in+h].enqueue(m):d[d.length-1].enqueue(m):d[0].enqueue(m)}return k3}var O3,FP;function Z8e(){if(FP)return O3;FP=1;var t=Nr(),e=K8e();O3={run:n,undo:s};function n(i){var a=i.graph().acyclicer==="greedy"?e(i,l(i)):r(i);t.forEach(a,function(c){var d=i.edge(c);i.removeEdge(c),d.forwardName=c.name,d.reversed=!0,i.setEdge(c.w,c.v,d,t.uniqueId("rev"))});function l(c){return function(d){return c.edge(d).weight}}}function r(i){var a=[],l={},c={};function d(h){t.has(c,h)||(c[h]=!0,l[h]=!0,t.forEach(i.outEdges(h),function(m){t.has(l,m.w)?a.push(m):d(m.w)}),delete l[h])}return t.forEach(i.nodes(),d),a}function s(i){t.forEach(i.edges(),function(a){var l=i.edge(a);if(l.reversed){i.removeEdge(a);var c=l.forwardName;delete l.reversed,delete l.forwardName,i.setEdge(a.w,a.v,l,c)}})}return O3}var j3,qP;function ji(){if(qP)return j3;qP=1;var t=Nr(),e=Ja().Graph;j3={addDummyNode:n,simplify:r,asNonCompoundGraph:s,successorWeights:i,predecessorWeights:a,intersectRect:l,buildLayerMatrix:c,normalizeRanks:d,removeEmptyRanks:h,addBorderNode:m,maxRank:g,partition:x,time:y,notime:w};function n(S,k,j,N){var T;do T=t.uniqueId(N);while(S.hasNode(T));return j.dummy=k,S.setNode(T,j),T}function r(S){var k=new e().setGraph(S.graph());return t.forEach(S.nodes(),function(j){k.setNode(j,S.node(j))}),t.forEach(S.edges(),function(j){var N=k.edge(j.v,j.w)||{weight:0,minlen:1},T=S.edge(j);k.setEdge(j.v,j.w,{weight:N.weight+T.weight,minlen:Math.max(N.minlen,T.minlen)})}),k}function s(S){var k=new e({multigraph:S.isMultigraph()}).setGraph(S.graph());return t.forEach(S.nodes(),function(j){S.children(j).length||k.setNode(j,S.node(j))}),t.forEach(S.edges(),function(j){k.setEdge(j,S.edge(j))}),k}function i(S){var k=t.map(S.nodes(),function(j){var N={};return t.forEach(S.outEdges(j),function(T){N[T.w]=(N[T.w]||0)+S.edge(T).weight}),N});return t.zipObject(S.nodes(),k)}function a(S){var k=t.map(S.nodes(),function(j){var N={};return t.forEach(S.inEdges(j),function(T){N[T.v]=(N[T.v]||0)+S.edge(T).weight}),N});return t.zipObject(S.nodes(),k)}function l(S,k){var j=S.x,N=S.y,T=k.x-j,E=k.y-N,_=S.width/2,A=S.height/2;if(!T&&!E)throw new Error("Not possible to find intersection inside of the rectangle");var L,P;return Math.abs(E)*_>Math.abs(T)*A?(E<0&&(A=-A),L=A*T/E,P=A):(T<0&&(_=-_),L=_,P=_*E/T),{x:j+L,y:N+P}}function c(S){var k=t.map(t.range(g(S)+1),function(){return[]});return t.forEach(S.nodes(),function(j){var N=S.node(j),T=N.rank;t.isUndefined(T)||(k[T][N.order]=j)}),k}function d(S){var k=t.min(t.map(S.nodes(),function(j){return S.node(j).rank}));t.forEach(S.nodes(),function(j){var N=S.node(j);t.has(N,"rank")&&(N.rank-=k)})}function h(S){var k=t.min(t.map(S.nodes(),function(E){return S.node(E).rank})),j=[];t.forEach(S.nodes(),function(E){var _=S.node(E).rank-k;j[_]||(j[_]=[]),j[_].push(E)});var N=0,T=S.graph().nodeRankFactor;t.forEach(j,function(E,_){t.isUndefined(E)&&_%T!==0?--N:N&&t.forEach(E,function(A){S.node(A).rank+=N})})}function m(S,k,j,N){var T={width:0,height:0};return arguments.length>=4&&(T.rank=j,T.order=N),n(S,"border",T,k)}function g(S){return t.max(t.map(S.nodes(),function(k){var j=S.node(k).rank;if(!t.isUndefined(j))return j}))}function x(S,k){var j={lhs:[],rhs:[]};return t.forEach(S,function(N){k(N)?j.lhs.push(N):j.rhs.push(N)}),j}function y(S,k){var j=t.now();try{return k()}finally{console.log(S+" time: "+(t.now()-j)+"ms")}}function w(S,k){return k()}return j3}var N3,$P;function J8e(){if($P)return N3;$P=1;var t=Nr(),e=ji();N3={run:n,undo:s};function n(i){i.graph().dummyChains=[],t.forEach(i.edges(),function(a){r(i,a)})}function r(i,a){var l=a.v,c=i.node(l).rank,d=a.w,h=i.node(d).rank,m=a.name,g=i.edge(a),x=g.labelRank;if(h!==c+1){i.removeEdge(a);var y,w,S;for(S=0,++c;c<h;++S,++c)g.points=[],w={width:0,height:0,edgeLabel:g,edgeObj:a,rank:c},y=e.addDummyNode(i,"edge",w,"_d"),c===x&&(w.width=g.width,w.height=g.height,w.dummy="edge-label",w.labelpos=g.labelpos),i.setEdge(l,y,{weight:g.weight},m),S===0&&i.graph().dummyChains.push(y),l=y;i.setEdge(l,d,{weight:g.weight},m)}}function s(i){t.forEach(i.graph().dummyChains,function(a){var l=i.node(a),c=l.edgeLabel,d;for(i.setEdge(l.edgeObj,c);l.dummy;)d=i.successors(a)[0],i.removeNode(a),c.points.push({x:l.x,y:l.y}),l.dummy==="edge-label"&&(c.x=l.x,c.y=l.y,c.width=l.width,c.height=l.height),a=d,l=i.node(a)})}return N3}var C3,HP;function Dy(){if(HP)return C3;HP=1;var t=Nr();C3={longestPath:e,slack:n};function e(r){var s={};function i(a){var l=r.node(a);if(t.has(s,a))return l.rank;s[a]=!0;var c=t.min(t.map(r.outEdges(a),function(d){return i(d.w)-r.edge(d).minlen}));return(c===Number.POSITIVE_INFINITY||c===void 0||c===null)&&(c=0),l.rank=c}t.forEach(r.sources(),i)}function n(r,s){return r.node(s.w).rank-r.node(s.v).rank-r.edge(s).minlen}return C3}var T3,QP;function RG(){if(QP)return T3;QP=1;var t=Nr(),e=Ja().Graph,n=Dy().slack;T3=r;function r(l){var c=new e({directed:!1}),d=l.nodes()[0],h=l.nodeCount();c.setNode(d,{});for(var m,g;s(c,l)<h;)m=i(c,l),g=c.hasNode(m.v)?n(l,m):-n(l,m),a(c,l,g);return c}function s(l,c){function d(h){t.forEach(c.nodeEdges(h),function(m){var g=m.v,x=h===g?m.w:g;!l.hasNode(x)&&!n(c,m)&&(l.setNode(x,{}),l.setEdge(h,x,{}),d(x))})}return t.forEach(l.nodes(),d),l.nodeCount()}function i(l,c){return t.minBy(c.edges(),function(d){if(l.hasNode(d.v)!==l.hasNode(d.w))return n(c,d)})}function a(l,c,d){t.forEach(l.nodes(),function(h){c.node(h).rank+=d})}return T3}var E3,VP;function eTe(){if(VP)return E3;VP=1;var t=Nr(),e=RG(),n=Dy().slack,r=Dy().longestPath,s=Ja().alg.preorder,i=Ja().alg.postorder,a=ji().simplify;E3=l,l.initLowLimValues=m,l.initCutValues=c,l.calcCutValue=h,l.leaveEdge=x,l.enterEdge=y,l.exchangeEdges=w;function l(N){N=a(N),r(N);var T=e(N);m(T),c(T,N);for(var E,_;E=x(T);)_=y(T,N,E),w(T,N,E,_)}function c(N,T){var E=i(N,N.nodes());E=E.slice(0,E.length-1),t.forEach(E,function(_){d(N,T,_)})}function d(N,T,E){var _=N.node(E),A=_.parent;N.edge(E,A).cutvalue=h(N,T,E)}function h(N,T,E){var _=N.node(E),A=_.parent,L=!0,P=T.edge(E,A),B=0;return P||(L=!1,P=T.edge(A,E)),B=P.weight,t.forEach(T.nodeEdges(E),function($){var U=$.v===E,te=U?$.w:$.v;if(te!==A){var z=U===L,Q=T.edge($).weight;if(B+=z?Q:-Q,k(N,E,te)){var F=N.edge(E,te).cutvalue;B+=z?-F:F}}}),B}function m(N,T){arguments.length<2&&(T=N.nodes()[0]),g(N,{},1,T)}function g(N,T,E,_,A){var L=E,P=N.node(_);return T[_]=!0,t.forEach(N.neighbors(_),function(B){t.has(T,B)||(E=g(N,T,E,B,_))}),P.low=L,P.lim=E++,A?P.parent=A:delete P.parent,E}function x(N){return t.find(N.edges(),function(T){return N.edge(T).cutvalue<0})}function y(N,T,E){var _=E.v,A=E.w;T.hasEdge(_,A)||(_=E.w,A=E.v);var L=N.node(_),P=N.node(A),B=L,$=!1;L.lim>P.lim&&(B=P,$=!0);var U=t.filter(T.edges(),function(te){return $===j(N,N.node(te.v),B)&&$!==j(N,N.node(te.w),B)});return t.minBy(U,function(te){return n(T,te)})}function w(N,T,E,_){var A=E.v,L=E.w;N.removeEdge(A,L),N.setEdge(_.v,_.w,{}),m(N),c(N,T),S(N,T)}function S(N,T){var E=t.find(N.nodes(),function(A){return!T.node(A).parent}),_=s(N,E);_=_.slice(1),t.forEach(_,function(A){var L=N.node(A).parent,P=T.edge(A,L),B=!1;P||(P=T.edge(L,A),B=!0),T.node(A).rank=T.node(L).rank+(B?P.minlen:-P.minlen)})}function k(N,T,E){return N.hasEdge(T,E)}function j(N,T,E){return E.low<=T.lim&&T.lim<=E.lim}return E3}var _3,UP;function tTe(){if(UP)return _3;UP=1;var t=Dy(),e=t.longestPath,n=RG(),r=eTe();_3=s;function s(c){switch(c.graph().ranker){case"network-simplex":l(c);break;case"tight-tree":a(c);break;case"longest-path":i(c);break;default:l(c)}}var i=e;function a(c){e(c),n(c)}function l(c){r(c)}return _3}var A3,WP;function nTe(){if(WP)return A3;WP=1;var t=Nr();A3=e;function e(s){var i=r(s);t.forEach(s.graph().dummyChains,function(a){for(var l=s.node(a),c=l.edgeObj,d=n(s,i,c.v,c.w),h=d.path,m=d.lca,g=0,x=h[g],y=!0;a!==c.w;){if(l=s.node(a),y){for(;(x=h[g])!==m&&s.node(x).maxRank<l.rank;)g++;x===m&&(y=!1)}if(!y){for(;g<h.length-1&&s.node(x=h[g+1]).minRank<=l.rank;)g++;x=h[g]}s.setParent(a,x),a=s.successors(a)[0]}})}function n(s,i,a,l){var c=[],d=[],h=Math.min(i[a].low,i[l].low),m=Math.max(i[a].lim,i[l].lim),g,x;g=a;do g=s.parent(g),c.push(g);while(g&&(i[g].low>h||m>i[g].lim));for(x=g,g=l;(g=s.parent(g))!==x;)d.push(g);return{path:c.concat(d.reverse()),lca:x}}function r(s){var i={},a=0;function l(c){var d=a;t.forEach(s.children(c),l),i[c]={low:d,lim:a++}}return t.forEach(s.children(),l),i}return A3}var M3,GP;function rTe(){if(GP)return M3;GP=1;var t=Nr(),e=ji();M3={run:n,cleanup:a};function n(l){var c=e.addDummyNode(l,"root",{},"_root"),d=s(l),h=t.max(t.values(d))-1,m=2*h+1;l.graph().nestingRoot=c,t.forEach(l.edges(),function(x){l.edge(x).minlen*=m});var g=i(l)+1;t.forEach(l.children(),function(x){r(l,c,m,g,h,d,x)}),l.graph().nodeRankFactor=m}function r(l,c,d,h,m,g,x){var y=l.children(x);if(!y.length){x!==c&&l.setEdge(c,x,{weight:0,minlen:d});return}var w=e.addBorderNode(l,"_bt"),S=e.addBorderNode(l,"_bb"),k=l.node(x);l.setParent(w,x),k.borderTop=w,l.setParent(S,x),k.borderBottom=S,t.forEach(y,function(j){r(l,c,d,h,m,g,j);var N=l.node(j),T=N.borderTop?N.borderTop:j,E=N.borderBottom?N.borderBottom:j,_=N.borderTop?h:2*h,A=T!==E?1:m-g[x]+1;l.setEdge(w,T,{weight:_,minlen:A,nestingEdge:!0}),l.setEdge(E,S,{weight:_,minlen:A,nestingEdge:!0})}),l.parent(x)||l.setEdge(c,w,{weight:0,minlen:m+g[x]})}function s(l){var c={};function d(h,m){var g=l.children(h);g&&g.length&&t.forEach(g,function(x){d(x,m+1)}),c[h]=m}return t.forEach(l.children(),function(h){d(h,1)}),c}function i(l){return t.reduce(l.edges(),function(c,d){return c+l.edge(d).weight},0)}function a(l){var c=l.graph();l.removeNode(c.nestingRoot),delete c.nestingRoot,t.forEach(l.edges(),function(d){var h=l.edge(d);h.nestingEdge&&l.removeEdge(d)})}return M3}var R3,XP;function sTe(){if(XP)return R3;XP=1;var t=Nr(),e=ji();R3=n;function n(s){function i(a){var l=s.children(a),c=s.node(a);if(l.length&&t.forEach(l,i),t.has(c,"minRank")){c.borderLeft=[],c.borderRight=[];for(var d=c.minRank,h=c.maxRank+1;d<h;++d)r(s,"borderLeft","_bl",a,c,d),r(s,"borderRight","_br",a,c,d)}}t.forEach(s.children(),i)}function r(s,i,a,l,c,d){var h={width:0,height:0,rank:d,borderType:i},m=c[i][d-1],g=e.addDummyNode(s,"border",h,a);c[i][d]=g,s.setParent(g,l),m&&s.setEdge(m,g,{weight:1})}return R3}var D3,YP;function iTe(){if(YP)return D3;YP=1;var t=Nr();D3={adjust:e,undo:n};function e(d){var h=d.graph().rankdir.toLowerCase();(h==="lr"||h==="rl")&&r(d)}function n(d){var h=d.graph().rankdir.toLowerCase();(h==="bt"||h==="rl")&&i(d),(h==="lr"||h==="rl")&&(l(d),r(d))}function r(d){t.forEach(d.nodes(),function(h){s(d.node(h))}),t.forEach(d.edges(),function(h){s(d.edge(h))})}function s(d){var h=d.width;d.width=d.height,d.height=h}function i(d){t.forEach(d.nodes(),function(h){a(d.node(h))}),t.forEach(d.edges(),function(h){var m=d.edge(h);t.forEach(m.points,a),t.has(m,"y")&&a(m)})}function a(d){d.y=-d.y}function l(d){t.forEach(d.nodes(),function(h){c(d.node(h))}),t.forEach(d.edges(),function(h){var m=d.edge(h);t.forEach(m.points,c),t.has(m,"x")&&c(m)})}function c(d){var h=d.x;d.x=d.y,d.y=h}return D3}var P3,KP;function aTe(){if(KP)return P3;KP=1;var t=Nr();P3=e;function e(n){var r={},s=t.filter(n.nodes(),function(d){return!n.children(d).length}),i=t.max(t.map(s,function(d){return n.node(d).rank})),a=t.map(t.range(i+1),function(){return[]});function l(d){if(!t.has(r,d)){r[d]=!0;var h=n.node(d);a[h.rank].push(d),t.forEach(n.successors(d),l)}}var c=t.sortBy(s,function(d){return n.node(d).rank});return t.forEach(c,l),a}return P3}var z3,ZP;function oTe(){if(ZP)return z3;ZP=1;var t=Nr();z3=e;function e(r,s){for(var i=0,a=1;a<s.length;++a)i+=n(r,s[a-1],s[a]);return i}function n(r,s,i){for(var a=t.zipObject(i,t.map(i,function(g,x){return x})),l=t.flatten(t.map(s,function(g){return t.sortBy(t.map(r.outEdges(g),function(x){return{pos:a[x.w],weight:r.edge(x).weight}}),"pos")}),!0),c=1;c<i.length;)c<<=1;var d=2*c-1;c-=1;var h=t.map(new Array(d),function(){return 0}),m=0;return t.forEach(l.forEach(function(g){var x=g.pos+c;h[x]+=g.weight;for(var y=0;x>0;)x%2&&(y+=h[x+1]),x=x-1>>1,h[x]+=g.weight;m+=g.weight*y})),m}return z3}var I3,JP;function lTe(){if(JP)return I3;JP=1;var t=Nr();I3=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(l,c){var d=n.edge(c),h=n.node(c.v);return{sum:l.sum+d.weight*h.order,weight:l.weight+d.weight}},{sum:0,weight:0});return{v:s,barycenter:a.sum/a.weight,weight:a.weight}}else return{v:s}})}return I3}var L3,ez;function cTe(){if(ez)return L3;ez=1;var t=Nr();L3=e;function e(s,i){var a={};t.forEach(s,function(c,d){var h=a[c.v]={indegree:0,in:[],out:[],vs:[c.v],i:d};t.isUndefined(c.barycenter)||(h.barycenter=c.barycenter,h.weight=c.weight)}),t.forEach(i.edges(),function(c){var d=a[c.v],h=a[c.w];!t.isUndefined(d)&&!t.isUndefined(h)&&(h.indegree++,d.out.push(a[c.w]))});var l=t.filter(a,function(c){return!c.indegree});return n(l)}function n(s){var i=[];function a(d){return function(h){h.merged||(t.isUndefined(h.barycenter)||t.isUndefined(d.barycenter)||h.barycenter>=d.barycenter)&&r(d,h)}}function l(d){return function(h){h.in.push(d),--h.indegree===0&&s.push(h)}}for(;s.length;){var c=s.pop();i.push(c),t.forEach(c.in.reverse(),a(c)),t.forEach(c.out,l(c))}return t.map(t.filter(i,function(d){return!d.merged}),function(d){return t.pick(d,["vs","i","barycenter","weight"])})}function r(s,i){var a=0,l=0;s.weight&&(a+=s.barycenter*s.weight,l+=s.weight),i.weight&&(a+=i.barycenter*i.weight,l+=i.weight),s.vs=i.vs.concat(s.vs),s.barycenter=a/l,s.weight=l,s.i=Math.min(i.i,s.i),i.merged=!0}return L3}var B3,tz;function uTe(){if(tz)return B3;tz=1;var t=Nr(),e=ji();B3=n;function n(i,a){var l=e.partition(i,function(w){return t.has(w,"barycenter")}),c=l.lhs,d=t.sortBy(l.rhs,function(w){return-w.i}),h=[],m=0,g=0,x=0;c.sort(s(!!a)),x=r(h,d,x),t.forEach(c,function(w){x+=w.vs.length,h.push(w.vs),m+=w.barycenter*w.weight,g+=w.weight,x=r(h,d,x)});var y={vs:t.flatten(h,!0)};return g&&(y.barycenter=m/g,y.weight=g),y}function r(i,a,l){for(var c;a.length&&(c=t.last(a)).i<=l;)a.pop(),i.push(c.vs),l++;return l}function s(i){return function(a,l){return a.barycenter<l.barycenter?-1:a.barycenter>l.barycenter?1:i?l.i-a.i:a.i-l.i}}return B3}var F3,nz;function dTe(){if(nz)return F3;nz=1;var t=Nr(),e=lTe(),n=cTe(),r=uTe();F3=s;function s(l,c,d,h){var m=l.children(c),g=l.node(c),x=g?g.borderLeft:void 0,y=g?g.borderRight:void 0,w={};x&&(m=t.filter(m,function(E){return E!==x&&E!==y}));var S=e(l,m);t.forEach(S,function(E){if(l.children(E.v).length){var _=s(l,E.v,d,h);w[E.v]=_,t.has(_,"barycenter")&&a(E,_)}});var k=n(S,d);i(k,w);var j=r(k,h);if(x&&(j.vs=t.flatten([x,j.vs,y],!0),l.predecessors(x).length)){var N=l.node(l.predecessors(x)[0]),T=l.node(l.predecessors(y)[0]);t.has(j,"barycenter")||(j.barycenter=0,j.weight=0),j.barycenter=(j.barycenter*j.weight+N.order+T.order)/(j.weight+2),j.weight+=2}return j}function i(l,c){t.forEach(l,function(d){d.vs=t.flatten(d.vs.map(function(h){return c[h]?c[h].vs:h}),!0)})}function a(l,c){t.isUndefined(l.barycenter)?(l.barycenter=c.barycenter,l.weight=c.weight):(l.barycenter=(l.barycenter*l.weight+c.barycenter*c.weight)/(l.weight+c.weight),l.weight+=c.weight)}return F3}var q3,rz;function hTe(){if(rz)return q3;rz=1;var t=Nr(),e=Ja().Graph;q3=n;function n(s,i,a){var l=r(s),c=new e({compound:!0}).setGraph({root:l}).setDefaultNodeLabel(function(d){return s.node(d)});return t.forEach(s.nodes(),function(d){var h=s.node(d),m=s.parent(d);(h.rank===i||h.minRank<=i&&i<=h.maxRank)&&(c.setNode(d),c.setParent(d,m||l),t.forEach(s[a](d),function(g){var x=g.v===d?g.w:g.v,y=c.edge(x,d),w=t.isUndefined(y)?0:y.weight;c.setEdge(x,d,{weight:s.edge(g).weight+w})}),t.has(h,"minRank")&&c.setNode(d,{borderLeft:h.borderLeft[i],borderRight:h.borderRight[i]}))}),c}function r(s){for(var i;s.hasNode(i=t.uniqueId("_root")););return i}return q3}var $3,sz;function fTe(){if(sz)return $3;sz=1;var t=Nr();$3=e;function e(n,r,s){var i={},a;t.forEach(s,function(l){for(var c=n.parent(l),d,h;c;){if(d=n.parent(c),d?(h=i[d],i[d]=c):(h=a,a=c),h&&h!==c){r.setEdge(h,c);return}c=d}})}return $3}var H3,iz;function mTe(){if(iz)return H3;iz=1;var t=Nr(),e=aTe(),n=oTe(),r=dTe(),s=hTe(),i=fTe(),a=Ja().Graph,l=ji();H3=c;function c(g){var x=l.maxRank(g),y=d(g,t.range(1,x+1),"inEdges"),w=d(g,t.range(x-1,-1,-1),"outEdges"),S=e(g);m(g,S);for(var k=Number.POSITIVE_INFINITY,j,N=0,T=0;T<4;++N,++T){h(N%2?y:w,N%4>=2),S=l.buildLayerMatrix(g);var E=n(g,S);E<k&&(T=0,j=t.cloneDeep(S),k=E)}m(g,j)}function d(g,x,y){return t.map(x,function(w){return s(g,w,y)})}function h(g,x){var y=new a;t.forEach(g,function(w){var S=w.graph().root,k=r(w,S,y,x);t.forEach(k.vs,function(j,N){w.node(j).order=N}),i(w,y,k.vs)})}function m(g,x){t.forEach(x,function(y){t.forEach(y,function(w,S){g.node(w).order=S})})}return H3}var Q3,az;function pTe(){if(az)return Q3;az=1;var t=Nr(),e=Ja().Graph,n=ji();Q3={positionX:y,findType1Conflicts:r,findType2Conflicts:s,addConflict:a,hasConflict:l,verticalAlignment:c,horizontalCompaction:d,alignCoordinates:g,findSmallestWidthAlignment:m,balance:x};function r(k,j){var N={};function T(E,_){var A=0,L=0,P=E.length,B=t.last(_);return t.forEach(_,function($,U){var te=i(k,$),z=te?k.node(te).order:P;(te||$===B)&&(t.forEach(_.slice(L,U+1),function(Q){t.forEach(k.predecessors(Q),function(F){var Y=k.node(F),J=Y.order;(J<A||z<J)&&!(Y.dummy&&k.node(Q).dummy)&&a(N,F,Q)})}),L=U+1,A=z)}),_}return t.reduce(j,T),N}function s(k,j){var N={};function T(_,A,L,P,B){var $;t.forEach(t.range(A,L),function(U){$=_[U],k.node($).dummy&&t.forEach(k.predecessors($),function(te){var z=k.node(te);z.dummy&&(z.order<P||z.order>B)&&a(N,te,$)})})}function E(_,A){var L=-1,P,B=0;return t.forEach(A,function($,U){if(k.node($).dummy==="border"){var te=k.predecessors($);te.length&&(P=k.node(te[0]).order,T(A,B,U,L,P),B=U,L=P)}T(A,B,A.length,P,_.length)}),A}return t.reduce(j,E),N}function i(k,j){if(k.node(j).dummy)return t.find(k.predecessors(j),function(N){return k.node(N).dummy})}function a(k,j,N){if(j>N){var T=j;j=N,N=T}var E=k[j];E||(k[j]=E={}),E[N]=!0}function l(k,j,N){if(j>N){var T=j;j=N,N=T}return t.has(k[j],N)}function c(k,j,N,T){var E={},_={},A={};return t.forEach(j,function(L){t.forEach(L,function(P,B){E[P]=P,_[P]=P,A[P]=B})}),t.forEach(j,function(L){var P=-1;t.forEach(L,function(B){var $=T(B);if($.length){$=t.sortBy($,function(F){return A[F]});for(var U=($.length-1)/2,te=Math.floor(U),z=Math.ceil(U);te<=z;++te){var Q=$[te];_[B]===B&&P<A[Q]&&!l(N,B,Q)&&(_[Q]=B,_[B]=E[B]=E[Q],P=A[Q])}}})}),{root:E,align:_}}function d(k,j,N,T,E){var _={},A=h(k,j,N,E),L=E?"borderLeft":"borderRight";function P(U,te){for(var z=A.nodes(),Q=z.pop(),F={};Q;)F[Q]?U(Q):(F[Q]=!0,z.push(Q),z=z.concat(te(Q))),Q=z.pop()}function B(U){_[U]=A.inEdges(U).reduce(function(te,z){return Math.max(te,_[z.v]+A.edge(z))},0)}function $(U){var te=A.outEdges(U).reduce(function(Q,F){return Math.min(Q,_[F.w]-A.edge(F))},Number.POSITIVE_INFINITY),z=k.node(U);te!==Number.POSITIVE_INFINITY&&z.borderType!==L&&(_[U]=Math.max(_[U],te))}return P(B,A.predecessors.bind(A)),P($,A.successors.bind(A)),t.forEach(T,function(U){_[U]=_[N[U]]}),_}function h(k,j,N,T){var E=new e,_=k.graph(),A=w(_.nodesep,_.edgesep,T);return t.forEach(j,function(L){var P;t.forEach(L,function(B){var $=N[B];if(E.setNode($),P){var U=N[P],te=E.edge(U,$);E.setEdge(U,$,Math.max(A(k,B,P),te||0))}P=B})}),E}function m(k,j){return t.minBy(t.values(j),function(N){var T=Number.NEGATIVE_INFINITY,E=Number.POSITIVE_INFINITY;return t.forIn(N,function(_,A){var L=S(k,A)/2;T=Math.max(_+L,T),E=Math.min(_-L,E)}),T-E})}function g(k,j){var N=t.values(j),T=t.min(N),E=t.max(N);t.forEach(["u","d"],function(_){t.forEach(["l","r"],function(A){var L=_+A,P=k[L],B;if(P!==j){var $=t.values(P);B=A==="l"?T-t.min($):E-t.max($),B&&(k[L]=t.mapValues(P,function(U){return U+B}))}})})}function x(k,j){return t.mapValues(k.ul,function(N,T){if(j)return k[j.toLowerCase()][T];var E=t.sortBy(t.map(k,T));return(E[1]+E[2])/2})}function y(k){var j=n.buildLayerMatrix(k),N=t.merge(r(k,j),s(k,j)),T={},E;t.forEach(["u","d"],function(A){E=A==="u"?j:t.values(j).reverse(),t.forEach(["l","r"],function(L){L==="r"&&(E=t.map(E,function(U){return t.values(U).reverse()}));var P=(A==="u"?k.predecessors:k.successors).bind(k),B=c(k,E,N,P),$=d(k,E,B.root,B.align,L==="r");L==="r"&&($=t.mapValues($,function(U){return-U})),T[A+L]=$})});var _=m(k,T);return g(T,_),x(T,k.graph().align)}function w(k,j,N){return function(T,E,_){var A=T.node(E),L=T.node(_),P=0,B;if(P+=A.width/2,t.has(A,"labelpos"))switch(A.labelpos.toLowerCase()){case"l":B=-A.width/2;break;case"r":B=A.width/2;break}if(B&&(P+=N?B:-B),B=0,P+=(A.dummy?j:k)/2,P+=(L.dummy?j:k)/2,P+=L.width/2,t.has(L,"labelpos"))switch(L.labelpos.toLowerCase()){case"l":B=L.width/2;break;case"r":B=-L.width/2;break}return B&&(P+=N?B:-B),B=0,P}}function S(k,j){return k.node(j).width}return Q3}var V3,oz;function gTe(){if(oz)return V3;oz=1;var t=Nr(),e=ji(),n=pTe().positionX;V3=r;function r(i){i=e.asNonCompoundGraph(i),s(i),t.forEach(n(i),function(a,l){i.node(l).x=a})}function s(i){var a=e.buildLayerMatrix(i),l=i.graph().ranksep,c=0;t.forEach(a,function(d){var h=t.max(t.map(d,function(m){return i.node(m).height}));t.forEach(d,function(m){i.node(m).y=c+h/2}),c+=h+l})}return V3}var U3,lz;function xTe(){if(lz)return U3;lz=1;var t=Nr(),e=Z8e(),n=J8e(),r=tTe(),s=ji().normalizeRanks,i=nTe(),a=ji().removeEmptyRanks,l=rTe(),c=sTe(),d=iTe(),h=mTe(),m=gTe(),g=ji(),x=Ja().Graph;U3=y;function y(V,ee){var ne=ee&&ee.debugTiming?g.time:g.notime;ne("layout",function(){var W=ne(" buildLayoutGraph",function(){return P(V)});ne(" runLayout",function(){w(W,ne)}),ne(" updateInputGraph",function(){S(V,W)})})}function w(V,ee){ee(" makeSpaceForEdgeLabels",function(){B(V)}),ee(" removeSelfEdges",function(){X(V)}),ee(" acyclic",function(){e.run(V)}),ee(" nestingGraph.run",function(){l.run(V)}),ee(" rank",function(){r(g.asNonCompoundGraph(V))}),ee(" injectEdgeLabelProxies",function(){$(V)}),ee(" removeEmptyRanks",function(){a(V)}),ee(" nestingGraph.cleanup",function(){l.cleanup(V)}),ee(" normalizeRanks",function(){s(V)}),ee(" assignRankMinMax",function(){U(V)}),ee(" removeEdgeLabelProxies",function(){te(V)}),ee(" normalize.run",function(){n.run(V)}),ee(" parentDummyChains",function(){i(V)}),ee(" addBorderSegments",function(){c(V)}),ee(" order",function(){h(V)}),ee(" insertSelfEdges",function(){R(V)}),ee(" adjustCoordinateSystem",function(){d.adjust(V)}),ee(" position",function(){m(V)}),ee(" positionSelfEdges",function(){ie(V)}),ee(" removeBorderNodes",function(){J(V)}),ee(" normalize.undo",function(){n.undo(V)}),ee(" fixupEdgeLabelCoords",function(){F(V)}),ee(" undoCoordinateSystem",function(){d.undo(V)}),ee(" translateGraph",function(){z(V)}),ee(" assignNodeIntersects",function(){Q(V)}),ee(" reversePoints",function(){Y(V)}),ee(" acyclic.undo",function(){e.undo(V)})}function S(V,ee){t.forEach(V.nodes(),function(ne){var W=V.node(ne),se=ee.node(ne);W&&(W.x=se.x,W.y=se.y,ee.children(ne).length&&(W.width=se.width,W.height=se.height))}),t.forEach(V.edges(),function(ne){var W=V.edge(ne),se=ee.edge(ne);W.points=se.points,t.has(se,"x")&&(W.x=se.x,W.y=se.y)}),V.graph().width=ee.graph().width,V.graph().height=ee.graph().height}var k=["nodesep","edgesep","ranksep","marginx","marginy"],j={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},N=["acyclicer","ranker","rankdir","align"],T=["width","height"],E={width:0,height:0},_=["minlen","weight","width","height","labeloffset"],A={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},L=["labelpos"];function P(V){var ee=new x({multigraph:!0,compound:!0}),ne=I(V.graph());return ee.setGraph(t.merge({},j,G(ne,k),t.pick(ne,N))),t.forEach(V.nodes(),function(W){var se=I(V.node(W));ee.setNode(W,t.defaults(G(se,T),E)),ee.setParent(W,V.parent(W))}),t.forEach(V.edges(),function(W){var se=I(V.edge(W));ee.setEdge(W,t.merge({},A,G(se,_),t.pick(se,L)))}),ee}function B(V){var ee=V.graph();ee.ranksep/=2,t.forEach(V.edges(),function(ne){var W=V.edge(ne);W.minlen*=2,W.labelpos.toLowerCase()!=="c"&&(ee.rankdir==="TB"||ee.rankdir==="BT"?W.width+=W.labeloffset:W.height+=W.labeloffset)})}function $(V){t.forEach(V.edges(),function(ee){var ne=V.edge(ee);if(ne.width&&ne.height){var W=V.node(ee.v),se=V.node(ee.w),re={rank:(se.rank-W.rank)/2+W.rank,e:ee};g.addDummyNode(V,"edge-proxy",re,"_ep")}})}function U(V){var ee=0;t.forEach(V.nodes(),function(ne){var W=V.node(ne);W.borderTop&&(W.minRank=V.node(W.borderTop).rank,W.maxRank=V.node(W.borderBottom).rank,ee=t.max(ee,W.maxRank))}),V.graph().maxRank=ee}function te(V){t.forEach(V.nodes(),function(ee){var ne=V.node(ee);ne.dummy==="edge-proxy"&&(V.edge(ne.e).labelRank=ne.rank,V.removeNode(ee))})}function z(V){var ee=Number.POSITIVE_INFINITY,ne=0,W=Number.POSITIVE_INFINITY,se=0,re=V.graph(),oe=re.marginx||0,Te=re.marginy||0;function We(Ye){var Je=Ye.x,Oe=Ye.y,Ve=Ye.width,Ue=Ye.height;ee=Math.min(ee,Je-Ve/2),ne=Math.max(ne,Je+Ve/2),W=Math.min(W,Oe-Ue/2),se=Math.max(se,Oe+Ue/2)}t.forEach(V.nodes(),function(Ye){We(V.node(Ye))}),t.forEach(V.edges(),function(Ye){var Je=V.edge(Ye);t.has(Je,"x")&&We(Je)}),ee-=oe,W-=Te,t.forEach(V.nodes(),function(Ye){var Je=V.node(Ye);Je.x-=ee,Je.y-=W}),t.forEach(V.edges(),function(Ye){var Je=V.edge(Ye);t.forEach(Je.points,function(Oe){Oe.x-=ee,Oe.y-=W}),t.has(Je,"x")&&(Je.x-=ee),t.has(Je,"y")&&(Je.y-=W)}),re.width=ne-ee+oe,re.height=se-W+Te}function Q(V){t.forEach(V.edges(),function(ee){var ne=V.edge(ee),W=V.node(ee.v),se=V.node(ee.w),re,oe;ne.points?(re=ne.points[0],oe=ne.points[ne.points.length-1]):(ne.points=[],re=se,oe=W),ne.points.unshift(g.intersectRect(W,re)),ne.points.push(g.intersectRect(se,oe))})}function F(V){t.forEach(V.edges(),function(ee){var ne=V.edge(ee);if(t.has(ne,"x"))switch((ne.labelpos==="l"||ne.labelpos==="r")&&(ne.width-=ne.labeloffset),ne.labelpos){case"l":ne.x-=ne.width/2+ne.labeloffset;break;case"r":ne.x+=ne.width/2+ne.labeloffset;break}})}function Y(V){t.forEach(V.edges(),function(ee){var ne=V.edge(ee);ne.reversed&&ne.points.reverse()})}function J(V){t.forEach(V.nodes(),function(ee){if(V.children(ee).length){var ne=V.node(ee),W=V.node(ne.borderTop),se=V.node(ne.borderBottom),re=V.node(t.last(ne.borderLeft)),oe=V.node(t.last(ne.borderRight));ne.width=Math.abs(oe.x-re.x),ne.height=Math.abs(se.y-W.y),ne.x=re.x+ne.width/2,ne.y=W.y+ne.height/2}}),t.forEach(V.nodes(),function(ee){V.node(ee).dummy==="border"&&V.removeNode(ee)})}function X(V){t.forEach(V.edges(),function(ee){if(ee.v===ee.w){var ne=V.node(ee.v);ne.selfEdges||(ne.selfEdges=[]),ne.selfEdges.push({e:ee,label:V.edge(ee)}),V.removeEdge(ee)}})}function R(V){var ee=g.buildLayerMatrix(V);t.forEach(ee,function(ne){var W=0;t.forEach(ne,function(se,re){var oe=V.node(se);oe.order=re+W,t.forEach(oe.selfEdges,function(Te){g.addDummyNode(V,"selfedge",{width:Te.label.width,height:Te.label.height,rank:oe.rank,order:re+ ++W,e:Te.e,label:Te.label},"_se")}),delete oe.selfEdges})})}function ie(V){t.forEach(V.nodes(),function(ee){var ne=V.node(ee);if(ne.dummy==="selfedge"){var W=V.node(ne.e.v),se=W.x+W.width/2,re=W.y,oe=ne.x-se,Te=W.height/2;V.setEdge(ne.e,ne.label),V.removeNode(ee),ne.label.points=[{x:se+2*oe/3,y:re-Te},{x:se+5*oe/6,y:re-Te},{x:se+oe,y:re},{x:se+5*oe/6,y:re+Te},{x:se+2*oe/3,y:re+Te}],ne.label.x=ne.x,ne.label.y=ne.y}})}function G(V,ee){return t.mapValues(t.pick(V,ee),Number)}function I(V){var ee={};return t.forEach(V,function(ne,W){ee[W.toLowerCase()]=ne}),ee}return U3}var W3,cz;function vTe(){if(cz)return W3;cz=1;var t=Nr(),e=ji(),n=Ja().Graph;W3={debugOrdering:r};function r(s){var i=e.buildLayerMatrix(s),a=new n({compound:!0,multigraph:!0}).setGraph({});return t.forEach(s.nodes(),function(l){a.setNode(l,{label:l}),a.setParent(l,"layer"+s.node(l).rank)}),t.forEach(s.edges(),function(l){a.setEdge(l.v,l.w,{},l.name)}),t.forEach(i,function(l,c){var d="layer"+c;a.setNode(d,{rank:"same"}),t.reduce(l,function(h,m){return a.setEdge(h,m,{style:"invis"}),m})}),a}return W3}var G3,uz;function yTe(){return uz||(uz=1,G3="0.8.5"),G3}var X3,dz;function bTe(){return dz||(dz=1,X3={graphlib:Ja(),layout:xTe(),debug:vTe(),util:{time:ji().time,notime:ji().notime},version:yTe()}),X3}var wTe=bTe();const hz=gd(wTe),l7="/api/webui";async function STe(t=100,e="all"){const n=`${l7}/knowledge/graph?limit=${t}&node_type=${e}`,r=await fetch(n);if(!r.ok)throw new Error(`获取知识图谱失败: ${r.status}`);return r.json()}async function kTe(){const t=await fetch(`${l7}/knowledge/stats`);if(!t.ok)throw new Error("获取知识图谱统计信息失败");return t.json()}async function OTe(t){const e=await fetch(`${l7}/knowledge/search?query=${encodeURIComponent(t)}`);if(!e.ok)throw new Error("搜索知识节点失败");return e.json()}const DG=b.memo(({data:t})=>o.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:[o.jsx(ru,{type:"target",position:wt.Top}),o.jsx("div",{className:"font-semibold text-white text-sm truncate max-w-[200px]",title:t.content,children:t.label}),o.jsx(ru,{type:"source",position:wt.Bottom})]}));DG.displayName="EntityNode";const PG=b.memo(({data:t})=>o.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:[o.jsx(ru,{type:"target",position:wt.Top}),o.jsx("div",{className:"font-medium text-white text-xs truncate max-w-[150px]",title:t.content,children:t.label}),o.jsx(ru,{type:"source",position:wt.Bottom})]}));PG.displayName="ParagraphNode";const jTe={entity:DG,paragraph:PG};function NTe(t,e){const n=new hz.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)}),hz.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 l={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&&(l.label=`${i.weight.toFixed(0)}`),s.push(l)}),{nodes:r,edges:s}}function CTe(){const t=Zi(),[e,n]=b.useState(!1),[r,s]=b.useState(null),[i,a]=b.useState(""),[l,c]=b.useState("all"),[d,h]=b.useState(50),[m,g]=b.useState("50"),[x,y]=b.useState(!1),[w,S]=b.useState(!0),[k,j]=b.useState(!1),[N,T]=b.useState(!1),[E,_,A]=LCe([]),[L,P,B]=BCe([]),[$,U]=b.useState(0),[te,z]=b.useState(null),[Q,F]=b.useState(null),{toast:Y}=as(),J=b.useCallback(ne=>ne.type==="entity"?"#6366f1":ne.type==="paragraph"?"#10b981":"#6b7280",[]),X=b.useCallback(async(ne=!1)=>{try{if(!ne&&d>200){T(!0);return}n(!0);const[W,se]=await Promise.all([STe(d,l),kTe()]);if(s(se),W.nodes.length===0){Y({title:"提示",description:"知识库为空,请先导入知识数据"}),_([]),P([]);return}const{nodes:re,edges:oe}=NTe(W.nodes,W.edges);_(re),P(oe),U(re.length),se&&se.total_nodes>d&&Y({title:"提示",description:`知识图谱包含 ${se.total_nodes} 个节点,当前显示 ${re.length} 个`}),Y({title:"加载成功",description:`已加载 ${re.length} 个节点,${oe.length} 条边`})}catch(W){console.error("加载知识图谱失败:",W),Y({title:"加载失败",description:W instanceof Error?W.message:"未知错误",variant:"destructive"})}finally{n(!1)}},[d,l,Y]),R=b.useCallback(async()=>{if(!i.trim()){Y({title:"提示",description:"请输入搜索关键词"});return}try{const ne=await OTe(i);if(ne.length===0){Y({title:"未找到",description:"没有找到匹配的节点"});return}const W=new Set(ne.map(se=>se.id));_(se=>se.map(re=>({...re,style:{...re.style,opacity:W.has(re.id)?1:.3,filter:W.has(re.id)?"brightness(1.2)":"brightness(0.8)"}}))),Y({title:"搜索完成",description:`找到 ${ne.length} 个匹配节点`})}catch(ne){console.error("搜索失败:",ne),Y({title:"搜索失败",description:ne instanceof Error?ne.message:"未知错误",variant:"destructive"})}},[i,Y]),ie=b.useCallback(()=>{_(ne=>ne.map(W=>({...W,style:{...W.style,opacity:1,filter:"brightness(1)"}})))},[]),G=b.useCallback(()=>{S(!1),j(!0),X()},[X]),I=b.useCallback(()=>{T(!1),setTimeout(()=>{X(!0)},0)},[X]),V=b.useCallback((ne,W)=>{E.find(re=>re.id===W.id)&&z({id:W.id,type:W.type,content:W.data.content})},[E]);b.useEffect(()=>{w||k&&X()},[d,l,w,k]);const ee=b.useCallback((ne,W)=>{const se=E.find(Te=>Te.id===W.source),re=E.find(Te=>Te.id===W.target),oe=L.find(Te=>Te.id===W.id);se&&re&&oe&&F({source:{id:se.id,type:se.type,content:se.data.content},target:{id:re.id,type:re.type,content:re.data.content},edge:{source:W.source,target:W.target,weight:parseFloat(W.label||"0")}})},[E,L]);return o.jsxs("div",{className:"h-full flex flex-col",children:[o.jsxs("div",{className:"flex-shrink-0 p-4 border-b bg-background",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"麦麦知识库图谱"}),o.jsx("p",{className:"text-muted-foreground mt-1",children:"可视化知识实体与关系网络"})]}),r&&o.jsxs("div",{className:"flex gap-2 flex-wrap",children:[o.jsxs(Xn,{variant:"outline",className:"gap-1",children:[o.jsx(ek,{className:"h-3 w-3"}),"节点: ",r.total_nodes]}),o.jsxs(Xn,{variant:"outline",className:"gap-1",children:[o.jsx(SI,{className:"h-3 w-3"}),"边: ",r.total_edges]}),o.jsxs(Xn,{variant:"outline",className:"gap-1",children:[o.jsx(Oa,{className:"h-3 w-3"}),"实体: ",r.entity_nodes]}),o.jsxs(Xn,{variant:"outline",className:"gap-1",children:[o.jsx(zl,{className:"h-3 w-3"}),"段落: ",r.paragraph_nodes]})]})]}),o.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 mt-4",children:[o.jsxs("div",{className:"flex-1 flex gap-2",children:[o.jsx(ze,{placeholder:"搜索节点内容...",value:i,onChange:ne=>a(ne.target.value),onKeyDown:ne=>ne.key==="Enter"&&R(),className:"flex-1"}),o.jsx(de,{onClick:R,size:"sm",children:o.jsx(Ni,{className:"h-4 w-4"})}),o.jsx(de,{onClick:ie,variant:"outline",size:"sm",children:"重置"})]}),o.jsxs("div",{className:"flex gap-2",children:[o.jsxs(Vt,{value:l,onValueChange:ne=>c(ne),children:[o.jsx($t,{className:"w-[120px]",children:o.jsx(Ut,{})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"all",children:"全部节点"}),o.jsx(De,{value:"entity",children:"仅实体"}),o.jsx(De,{value:"paragraph",children:"仅段落"})]})]}),o.jsxs(Vt,{value:d===1e4?"all":x?"custom":d.toString(),onValueChange:ne=>{ne==="custom"?(y(!0),g(d.toString())):ne==="all"?(y(!1),h(1e4)):(y(!1),h(Number(ne)))},children:[o.jsx($t,{className:"w-[120px]",children:o.jsx(Ut,{})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"50",children:"50 节点"}),o.jsx(De,{value:"100",children:"100 节点"}),o.jsx(De,{value:"200",children:"200 节点"}),o.jsx(De,{value:"500",children:"500 节点"}),o.jsx(De,{value:"1000",children:"1000 节点"}),o.jsx(De,{value:"all",children:"全部 (最多10000)"}),o.jsx(De,{value:"custom",children:"自定义..."})]})]}),x&&o.jsx(ze,{type:"number",min:"50",value:m,onChange:ne=>g(ne.target.value),onBlur:()=>{const ne=parseInt(m);!isNaN(ne)&&ne>=50?h(ne):(g("50"),h(50))},onKeyDown:ne=>{if(ne.key==="Enter"){const W=parseInt(m);!isNaN(W)&&W>=50?h(W):(g("50"),h(50))}},placeholder:"最少50个",className:"w-[120px]"}),o.jsx(de,{onClick:()=>X(),variant:"outline",size:"sm",disabled:e,children:o.jsx(Ps,{className:xe("h-4 w-4",e&&"animate-spin")})})]})]})]}),o.jsx("div",{className:"flex-1 relative",children:e?o.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:o.jsxs("div",{className:"text-center",children:[o.jsx(Ps,{className:"h-8 w-8 animate-spin mx-auto mb-2 text-muted-foreground"}),o.jsx("p",{className:"text-muted-foreground",children:"加载知识图谱中..."})]})}):E.length===0?o.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:o.jsxs("div",{className:"text-center",children:[o.jsx(ek,{className:"h-12 w-12 mx-auto mb-4 text-muted-foreground"}),o.jsx("h3",{className:"text-lg font-semibold mb-2",children:"知识库为空"}),o.jsx("p",{className:"text-muted-foreground",children:"请先导入知识数据"})]})}):o.jsxs(dG,{nodes:E,edges:L,onNodesChange:A,onEdgesChange:B,onNodeClick:V,onEdgeClick:ee,nodeTypes:jTe,fitView:!0,minZoom:.05,maxZoom:1.5,defaultViewport:{x:0,y:0,zoom:.5},elevateNodesOnSelect:$<=500,nodesDraggable:$<=1e3,attributionPosition:"bottom-left",children:[o.jsx(l8e,{variant:Ca.Dots,gap:12,size:1}),o.jsx(n8e,{}),$<=500&&o.jsx(XCe,{nodeColor:J,nodeBorderRadius:8,pannable:!0,zoomable:!0}),o.jsxs(Jb,{position:"top-right",className:"bg-background/95 backdrop-blur-sm rounded-lg border p-3 shadow-lg",children:[o.jsx("div",{className:"text-sm font-semibold mb-2",children:"图例"}),o.jsxs("div",{className:"space-y-2 text-xs",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("div",{className:"w-4 h-4 rounded bg-gradient-to-br from-blue-500 to-blue-600 border-2 border-blue-700"}),o.jsx("span",{children:"实体节点"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("div",{className:"w-4 h-4 rounded bg-gradient-to-br from-green-500 to-green-600 border-2 border-green-700"}),o.jsx("span",{children:"段落节点"})]}),$>200&&o.jsxs("div",{className:"mt-2 pt-2 border-t text-yellow-600 dark:text-yellow-500",children:[o.jsx("div",{className:"font-semibold",children:"性能模式"}),o.jsx("div",{children:"已禁用动画"}),$>500&&o.jsx("div",{children:"已禁用缩略图"})]})]})]})]})}),o.jsx(Dr,{open:!!te,onOpenChange:ne=>!ne&&z(null),children:o.jsxs(Sr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[o.jsx(kr,{children:o.jsx(Or,{children:"节点详情"})}),te&&o.jsxs("div",{className:"space-y-4",children:[o.jsx("div",{className:"grid grid-cols-2 gap-4",children:o.jsxs("div",{children:[o.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"类型"}),o.jsx("div",{className:"mt-1",children:o.jsx(Xn,{variant:te.type==="entity"?"default":"secondary",children:te.type==="entity"?"🏷️ 实体":"📄 段落"})})]})}),o.jsxs("div",{children:[o.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"ID"}),o.jsx("code",{className:"mt-1 block p-2 bg-muted rounded text-xs break-all",children:te.id})]}),o.jsxs("div",{children:[o.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"内容"}),o.jsx(gn,{className:"mt-1 h-40 p-3 bg-muted rounded",children:o.jsx("p",{className:"text-sm whitespace-pre-wrap",children:te.content})})]})]})]})}),o.jsx(Dr,{open:!!Q,onOpenChange:ne=>!ne&&F(null),children:o.jsxs(Sr,{className:"max-w-2xl max-h-[80vh] overflow-hidden flex flex-col",children:[o.jsx(kr,{children:o.jsx(Or,{children:"边详情"})}),Q&&o.jsx(gn,{className:"flex-1 pr-4",children:o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"flex items-center gap-4",children:[o.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:[o.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"源节点"}),o.jsx("div",{className:"font-medium text-sm mb-2 truncate",children:Q.source.content}),o.jsxs("code",{className:"text-xs text-muted-foreground truncate block",children:[Q.source.id.slice(0,40),"..."]})]}),o.jsx("div",{className:"text-2xl text-muted-foreground flex-shrink-0",children:"→"}),o.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:[o.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"目标节点"}),o.jsx("div",{className:"font-medium text-sm mb-2 truncate",children:Q.target.content}),o.jsxs("code",{className:"text-xs text-muted-foreground truncate block",children:[Q.target.id.slice(0,40),"..."]})]})]}),o.jsxs("div",{children:[o.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"权重"}),o.jsx("div",{className:"mt-1",children:o.jsx(Xn,{variant:"outline",className:"text-base font-mono",children:Q.edge.weight.toFixed(4)})})]})]})})]})}),o.jsx(Dn,{open:w,onOpenChange:S,children:o.jsxs(Nn,{children:[o.jsxs(Cn,{children:[o.jsx(En,{children:"加载知识图谱"}),o.jsxs(_n,{children:["知识图谱的动态展示会消耗较多系统资源。",o.jsx("br",{}),"确定要加载知识图谱吗?"]})]}),o.jsxs(Tn,{children:[o.jsx(Mn,{onClick:()=>t({to:"/"}),children:"取消 (返回首页)"}),o.jsx(An,{onClick:G,children:"确认加载"})]})]})}),o.jsx(Dn,{open:N,onOpenChange:T,children:o.jsxs(Nn,{children:[o.jsxs(Cn,{children:[o.jsx(En,{children:"⚠️ 节点数量较多"}),o.jsx(_n,{asChild:!0,children:o.jsxs("div",{children:[o.jsxs("p",{children:["您正在尝试加载 ",o.jsx("strong",{className:"text-orange-600",children:d>=1e4?"全部 (最多10000个)":d})," 个节点。"]}),o.jsx("p",{className:"mt-4",children:"节点数量过多可能导致:"}),o.jsxs("ul",{className:"list-disc list-inside mt-2 space-y-1",children:[o.jsx("li",{children:"页面加载时间较长"}),o.jsx("li",{children:"浏览器卡顿或崩溃"}),o.jsx("li",{children:"系统资源占用过高"})]}),o.jsx("p",{className:"mt-4",children:"建议先选择较少的节点数量 (50-200 个)。"})]})})]}),o.jsxs(Tn,{children:[o.jsx(Mn,{onClick:()=>{T(!1),d>200&&(h(50),y(!1))},children:"取消"}),o.jsx(An,{onClick:I,className:"bg-orange-600 hover:bg-orange-700",children:"我了解风险,继续加载"})]})]})})]})}function mh(t,e,n){let r=n.initialDeps??[],s;function i(){var a,l,c,d;let h;n.key&&((a=n.debug)!=null&&a.call(n))&&(h=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&&((l=n.debug)!=null&&l.call(n))&&(x=Date.now()),s=e(...m),n.key&&((c=n.debug)!=null&&c.call(n))){const y=Math.round((Date.now()-h)*100)/100,w=Math.round((Date.now()-x)*100)/100,S=w/16,k=(j,N)=>{for(j=String(j);j.length<N;)j=" "+j;return j};console.info(`%c⏱ ${k(w,5)} /${k(y,5)} ms`,`
font-size: .6rem;
font-weight: bold;
color: hsl(${Math.max(0,Math.min(120-120*S,120))}deg 100% 31%);`,n?.key)}return(d=n?.onChange)==null||d.call(n,s),s}return i.updateDeps=a=>{r=a},i}function fz(t,e){if(t===void 0)throw new Error("Unexpected undefined");return t}const TTe=(t,e)=>Math.abs(t-e)<1.01,ETe=(t,e,n)=>{let r;return function(...s){t.clearTimeout(r),r=t.setTimeout(()=>e.apply(this,s),n)}},mz=t=>{const{offsetWidth:e,offsetHeight:n}=t;return{width:e,height:n}},_Te=t=>t,ATe=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},MTe=(t,e)=>{const n=t.scrollElement;if(!n)return;const r=t.targetWindow;if(!r)return;const s=a=>{const{width:l,height:c}=a;e({width:Math.round(l),height:Math.round(c)})};if(s(mz(n)),!r.ResizeObserver)return()=>{};const i=new r.ResizeObserver(a=>{const l=()=>{const c=a[0];if(c?.borderBoxSize){const d=c.borderBoxSize[0];if(d){s({width:d.inlineSize,height:d.blockSize});return}}s(mz(n))};t.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(l):l()});return i.observe(n,{box:"border-box"}),()=>{i.unobserve(n)}},pz={passive:!0},gz=typeof window>"u"?!0:"onscrollend"in window,RTe=(t,e)=>{const n=t.scrollElement;if(!n)return;const r=t.targetWindow;if(!r)return;let s=0;const i=t.options.useScrollendEvent&&gz?()=>{}:ETe(r,()=>{e(s,!1)},t.options.isScrollingResetDelay),a=h=>()=>{const{horizontal:m,isRtl:g}=t.options;s=m?n.scrollLeft*(g&&-1||1):n.scrollTop,i(),e(s,h)},l=a(!0),c=a(!1);c(),n.addEventListener("scroll",l,pz);const d=t.options.useScrollendEvent&&gz;return d&&n.addEventListener("scrollend",c,pz),()=>{n.removeEventListener("scroll",l),d&&n.removeEventListener("scrollend",c)}},DTe=(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"]},PTe=(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 zTe{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:_Te,rangeExtractor:ATe,onChange:()=>{},measureElement:DTe,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=mh(()=>(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()<s?"forward":"backward":null,this.scrollOffset=s,this.isScrolling=i,this.maybeNotify()}))}},this.getSize=()=>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 l=n[a];if(s.has(l.lane))continue;const c=i.get(l.lane);if(c==null||l.end>c.end?i.set(l.lane,l):l.end<c.end&&s.set(l.lane,!0),s.size===this.options.lanes)break}return i.size===this.options.lanes?Array.from(i.values()).sort((a,l)=>a.end===l.end?a.index-l.index:a.end-l.end)[0]:void 0},this.getMeasurementOptions=mh(()=>[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=mh(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:n,paddingStart:r,scrollMargin:s,getItemKey:i,enabled:a},l)=>{if(!a)return this.measurementsCache=[],this.itemSizeCache.clear(),[];this.measurementsCache.length===0&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(h=>{this.itemSizeCache.set(h.key,h.size)}));const c=this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[];const d=this.measurementsCache.slice(0,c);for(let h=c;h<n;h++){const m=i(h),g=this.options.lanes===1?d[h-1]:this.getFurthestMeasurement(d,h),x=g?g.end+this.options.gap:r+s,y=l.get(m),w=typeof y=="number"?y:this.options.estimateSize(h),S=x+w,k=g?g.lane:h%this.options.lanes;d[h]={index:h,start:x,size:w,end:S,key:m,lane:k}}return this.measurementsCache=d,d},{key:!1,debug:()=>this.options.debug}),this.calculateRange=mh(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,r,s,i)=>this.range=n.length>0&&r>0?ITe({measurements:n,outerSize:r,scrollOffset:s,lanes:i}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=mh(()=>{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,l=this.elementsCache.get(a);l!==n&&(l&&this.observer.unobserve(l),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<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=a,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(s.index),this.itemSizeCache=new Map(this.itemSizeCache.set(s.key,r)),this.notify(!1))},this.measureElement=n=>{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=mh(()=>[this.getVirtualIndexes(),this.getMeasurements()],(n,r)=>{const s=[];for(let i=0,a=n.length;i<a;i++){const l=n[i],c=r[l];s.push(c)}return s},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=n=>{const r=this.getMeasurements();if(r.length!==0)return fz(r[zG(0,r.length-1,s=>fz(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 l=this.getTotalSize()+this.options.scrollMargin-i;return Math.max(Math.min(l,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 l=r==="end"?s.end+this.options.scrollPaddingEnd:s.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(l,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,l=d=>{if(!this.targetWindow)return;const h=this.getOffsetForIndex(n,d);if(!h){console.warn("Failed to get offset for index:",n);return}const[m,g]=h;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}TTe(y[0],x)||c(g)})},c=d=>{this.targetWindow&&(i++,i<a?this.targetWindow.requestAnimationFrame(()=>l(d)):console.warn(`Failed to scroll to index ${n} after ${a} attempts.`))};l(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(l=>l===null);){const l=r[a];i[l.lane]===null&&(i[l.lane]=l.end),a--}s=Math.max(...i.filter(l=>l!==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 zG=(t,e,n,r)=>{for(;t<=e;){const s=(t+e)/2|0,i=n(s);if(i<r)t=s+1;else if(i>r)e=s-1;else return s}return t>0?t-1:0};function ITe({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=zG(0,s,i,n),l=a;if(r===1)for(;l<s&&t[l].end<n+e;)l++;else if(r>1){const c=Array(r).fill(0);for(;l<s&&c.some(h=>h<n+e);){const h=t[l];c[h.lane]=h.end,l++}const d=Array(r).fill(n+e);for(;a>=0&&d.some(h=>h>=n);){const h=t[a];d[h.lane]=h.start,a--}a=Math.max(0,a-a%r),l=Math.min(s,l+(r-1-l%r))}return{startIndex:a,endIndex:l}}const xz=typeof document<"u"?b.useLayoutEffect:b.useEffect;function LTe(t){const e=b.useReducer(()=>({}),{})[1],n={...t,onChange:(s,i)=>{var a;i?pa.flushSync(e):e(),(a=t.onChange)==null||a.call(t,s,i)}},[r]=b.useState(()=>new zTe(n));return r.setOptions(n),xz(()=>r._didMount(),[]),xz(()=>r._willUpdate()),r}function BTe(t){return LTe({observeElementRect:MTe,observeElementOffset:RTe,scrollToFn:PTe,...t})}function FTe(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 qTe={},g0={};function Gu(t,e){try{const r=(qTe[t]||=new Intl.DateTimeFormat("en-US",{timeZone:t,timeZoneName:"longOffset"}).format)(e).split("GMT")[1];return r in g0?g0[r]:vz(r,r.split(":"))}catch{if(t in g0)return g0[t];const n=t?.match($Te);return n?vz(t,n.slice(1)):NaN}}const $Te=/([+-]\d\d):?(\d\d)?/;function vz(t,e){const n=+(e[0]||0),r=+(e[1]||0),s=+(e[2]||0)/60;return g0[t]=n*60+r>0?n*60+r+s:n*60-r-s}class Mo extends Date{constructor(...e){super(),e.length>1&&typeof e[e.length-1]=="string"&&(this.timeZone=e.pop()),this.internal=new Date,isNaN(Gu(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)),IG(this),lj(this)):this.setTime(Date.now())}static tz(e,...n){return n.length?new Mo(...n,e):new Mo(Date.now(),e)}withTimeZone(e){return new Mo(+this,e)}getTimezoneOffset(){const e=-Gu(this.timeZone,this);return e>0?Math.floor(e):Math.ceil(e)}setTime(e){return Date.prototype.setTime.apply(this,arguments),lj(this),+this}[Symbol.for("constructDateFrom")](e){return new Mo(+new Date(e),this.timeZone)}}const yz=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(t=>{if(!yz.test(t))return;const e=t.replace(yz,"$1UTC");Mo.prototype[e]&&(t.startsWith("get")?Mo.prototype[t]=function(){return this.internal[e]()}:(Mo.prototype[t]=function(){return Date.prototype[e].apply(this.internal,arguments),HTe(this),+this},Mo.prototype[e]=function(){return Date.prototype[e].apply(this,arguments),lj(this),+this}))});function lj(t){t.internal.setTime(+t),t.internal.setUTCSeconds(t.internal.getUTCSeconds()-Math.round(-Gu(t.timeZone,t)*60))}function HTe(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()),IG(t)}function IG(t){const e=Gu(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,l=Date.prototype.getHours.apply(t)!==t.internal.getUTCHours();a&&l&&t.internal.setUTCMinutes(t.internal.getUTCMinutes()+a);const c=s-n;c&&Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+c);const d=new Date(+t);d.setUTCSeconds(0);const h=s>0?d.getSeconds():(d.getSeconds()-60)%60,m=Math.round(-(Gu(t.timeZone,t)*60))%60;(m||h)&&(t.internal.setUTCSeconds(t.internal.getUTCSeconds()+m),Date.prototype.setUTCSeconds.call(t,Date.prototype.getUTCSeconds.call(t)+m+h));const g=Gu(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 j=Gu(t.timeZone,t),N=j>0?Math.floor(j):Math.ceil(j),T=x-N;T&&(t.internal.setUTCMinutes(t.internal.getUTCMinutes()+T),Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+T))}}class Fs extends Mo{static tz(e,...n){return n.length?new Fs(...n,e):new Fs(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} (${FTe(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 Fs(+this,e)}[Symbol.for("constructDateFrom")](e){return new Fs(+new Date(e),this.timeZone)}}const LG=6048e5,QTe=864e5,bz=Symbol.for("constructDateFrom");function is(t,e){return typeof t=="function"?t(e):t&&typeof t=="object"&&bz in t?t[bz](e):t instanceof Date?new t.constructor(e):new Date(e)}function tr(t,e){return is(e||t,t)}function BG(t,e,n){const r=tr(t,n?.in);return isNaN(e)?is(t,NaN):(e&&r.setDate(r.getDate()+e),r)}function FG(t,e,n){const r=tr(t,n?.in);if(isNaN(e))return is(t,NaN);if(!e)return r;const s=r.getDate(),i=is(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 VTe={};function yg(){return VTe}function su(t,e){const n=yg(),r=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,s=tr(t,e?.in),i=s.getDay(),a=(i<r?7:0)+i-r;return s.setDate(s.getDate()-a),s.setHours(0,0,0,0),s}function Op(t,e){return su(t,{...e,weekStartsOn:1})}function qG(t,e){const n=tr(t,e?.in),r=n.getFullYear(),s=is(n,0);s.setFullYear(r+1,0,4),s.setHours(0,0,0,0);const i=Op(s),a=is(n,0);a.setFullYear(r,0,4),a.setHours(0,0,0,0);const l=Op(a);return n.getTime()>=i.getTime()?r+1:n.getTime()>=l.getTime()?r:r-1}function wz(t){const e=tr(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 Od(t,...e){const n=is.bind(null,t||e.find(r=>typeof r=="object"));return e.map(n)}function jp(t,e){const n=tr(t,e?.in);return n.setHours(0,0,0,0),n}function $G(t,e,n){const[r,s]=Od(n?.in,t,e),i=jp(r),a=jp(s),l=+i-wz(i),c=+a-wz(a);return Math.round((l-c)/QTe)}function UTe(t,e){const n=qG(t,e),r=is(t,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),Op(r)}function WTe(t,e,n){return BG(t,e*7,n)}function GTe(t,e,n){return FG(t,e*12,n)}function XTe(t,e){let n,r=e?.in;return t.forEach(s=>{!r&&typeof s=="object"&&(r=is.bind(null,s));const i=tr(s,r);(!n||n<i||isNaN(+i))&&(n=i)}),is(r,n||NaN)}function YTe(t,e){let n,r=e?.in;return t.forEach(s=>{!r&&typeof s=="object"&&(r=is.bind(null,s));const i=tr(s,r);(!n||n>i||isNaN(+i))&&(n=i)}),is(r,n||NaN)}function KTe(t,e,n){const[r,s]=Od(n?.in,t,e);return+jp(r)==+jp(s)}function HG(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function ZTe(t){return!(!HG(t)&&typeof t!="number"||isNaN(+tr(t)))}function JTe(t,e,n){const[r,s]=Od(n?.in,t,e),i=r.getFullYear()-s.getFullYear(),a=r.getMonth()-s.getMonth();return i*12+a}function e9e(t,e){const n=tr(t,e?.in),r=n.getMonth();return n.setFullYear(n.getFullYear(),r+1,0),n.setHours(23,59,59,999),n}function QG(t,e){const[n,r]=Od(t,e.start,e.end);return{start:n,end:r}}function t9e(t,e){const{start:n,end:r}=QG(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 l=1;const c=[];for(;+a<=i;)c.push(is(n,a)),a.setMonth(a.getMonth()+l);return s?c.reverse():c}function n9e(t,e){const n=tr(t,e?.in);return n.setDate(1),n.setHours(0,0,0,0),n}function r9e(t,e){const n=tr(t,e?.in),r=n.getFullYear();return n.setFullYear(r+1,0,0),n.setHours(23,59,59,999),n}function VG(t,e){const n=tr(t,e?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}function s9e(t,e){const{start:n,end:r}=QG(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 l=1;const c=[];for(;+a<=i;)c.push(is(n,a)),a.setFullYear(a.getFullYear()+l);return s?c.reverse():c}function UG(t,e){const n=yg(),r=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,s=tr(t,e?.in),i=s.getDay(),a=(i<r?-7:0)+6-(i-r);return s.setDate(s.getDate()+a),s.setHours(23,59,59,999),s}function i9e(t,e){return UG(t,{...e,weekStartsOn:1})}const a9e={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},o9e=(t,e,n)=>{let r;const s=a9e[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 Vh(t){return(e={})=>{const n=e.width?String(e.width):t.defaultWidth;return t.formats[n]||t.formats[t.defaultWidth]}}const l9e={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},c9e={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},u9e={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},d9e={date:Vh({formats:l9e,defaultWidth:"full"}),time:Vh({formats:c9e,defaultWidth:"full"}),dateTime:Vh({formats:u9e,defaultWidth:"full"})},h9e={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},f9e=(t,e,n,r)=>h9e[t];function ko(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,l=n?.width?String(n.width):a;s=t.formattingValues[l]||t.formattingValues[a]}else{const a=t.defaultWidth,l=n?.width?String(n.width):t.defaultWidth;s=t.values[l]||t.values[a]}const i=t.argumentCallback?t.argumentCallback(e):e;return s[i]}}const m9e={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},p9e={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},g9e={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"]},x9e={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"]},v9e={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"}},y9e={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"}},b9e=(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"},w9e={ordinalNumber:b9e,era:ko({values:m9e,defaultWidth:"wide"}),quarter:ko({values:p9e,defaultWidth:"wide",argumentCallback:t=>t-1}),month:ko({values:g9e,defaultWidth:"wide"}),day:ko({values:x9e,defaultWidth:"wide"}),dayPeriod:ko({values:v9e,defaultWidth:"wide",formattingValues:y9e,defaultFormattingWidth:"wide"})};function Oo(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],l=r&&t.parsePatterns[r]||t.parsePatterns[t.defaultParseWidth],c=Array.isArray(l)?k9e(l,m=>m.test(a)):S9e(l,m=>m.test(a));let d;d=t.valueCallback?t.valueCallback(c):c,d=n.valueCallback?n.valueCallback(d):d;const h=e.slice(a.length);return{value:d,rest:h}}}function S9e(t,e){for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&e(t[n]))return n}function k9e(t,e){for(let n=0;n<t.length;n++)if(e(t[n]))return n}function WG(t){return(e,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 l=e.slice(s.length);return{value:a,rest:l}}}const O9e=/^(\d+)(th|st|nd|rd)?/i,j9e=/\d+/i,N9e={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},C9e={any:[/^b/i,/^(a|c)/i]},T9e={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},E9e={any:[/1/i,/2/i,/3/i,/4/i]},_9e={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},A9e={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]},M9e={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},R9e={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]},D9e={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},P9e={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}},z9e={ordinalNumber:WG({matchPattern:O9e,parsePattern:j9e,valueCallback:t=>parseInt(t,10)}),era:Oo({matchPatterns:N9e,defaultMatchWidth:"wide",parsePatterns:C9e,defaultParseWidth:"any"}),quarter:Oo({matchPatterns:T9e,defaultMatchWidth:"wide",parsePatterns:E9e,defaultParseWidth:"any",valueCallback:t=>t+1}),month:Oo({matchPatterns:_9e,defaultMatchWidth:"wide",parsePatterns:A9e,defaultParseWidth:"any"}),day:Oo({matchPatterns:M9e,defaultMatchWidth:"wide",parsePatterns:R9e,defaultParseWidth:"any"}),dayPeriod:Oo({matchPatterns:D9e,defaultMatchWidth:"any",parsePatterns:P9e,defaultParseWidth:"any"})},c7={code:"en-US",formatDistance:o9e,formatLong:d9e,formatRelative:f9e,localize:w9e,match:z9e,options:{weekStartsOn:0,firstWeekContainsDate:1}};function I9e(t,e){const n=tr(t,e?.in);return $G(n,VG(n))+1}function GG(t,e){const n=tr(t,e?.in),r=+Op(n)-+UTe(n);return Math.round(r/LG)+1}function XG(t,e){const n=tr(t,e?.in),r=n.getFullYear(),s=yg(),i=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??s.firstWeekContainsDate??s.locale?.options?.firstWeekContainsDate??1,a=is(e?.in||t,0);a.setFullYear(r+1,0,i),a.setHours(0,0,0,0);const l=su(a,e),c=is(e?.in||t,0);c.setFullYear(r,0,i),c.setHours(0,0,0,0);const d=su(c,e);return+n>=+l?r+1:+n>=+d?r:r-1}function L9e(t,e){const n=yg(),r=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,s=XG(t,e),i=is(e?.in||t,0);return i.setFullYear(s,0,r),i.setHours(0,0,0,0),su(i,e)}function YG(t,e){const n=tr(t,e?.in),r=+su(n,e)-+L9e(n,e);return Math.round(r/LG)+1}function Wn(t,e){const n=t<0?"-":"",r=Math.abs(t).toString().padStart(e,"0");return n+r}const _c={y(t,e){const n=t.getFullYear(),r=n>0?n:1-n;return Wn(e==="yy"?r%100:r,e.length)},M(t,e){const n=t.getMonth();return e==="M"?String(n+1):Wn(n+1,2)},d(t,e){return Wn(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 Wn(t.getHours()%12||12,e.length)},H(t,e){return Wn(t.getHours(),e.length)},m(t,e){return Wn(t.getMinutes(),e.length)},s(t,e){return Wn(t.getSeconds(),e.length)},S(t,e){const n=e.length,r=t.getMilliseconds(),s=Math.trunc(r*Math.pow(10,n-3));return Wn(s,e.length)}},ph={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Sz={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 _c.y(t,e)},Y:function(t,e,n,r){const s=XG(t,r),i=s>0?s:1-s;if(e==="YY"){const a=i%100;return Wn(a,2)}return e==="Yo"?n.ordinalNumber(i,{unit:"year"}):Wn(i,e.length)},R:function(t,e){const n=qG(t);return Wn(n,e.length)},u:function(t,e){const n=t.getFullYear();return Wn(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 Wn(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 Wn(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 _c.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 Wn(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=YG(t,r);return e==="wo"?n.ordinalNumber(s,{unit:"week"}):Wn(s,e.length)},I:function(t,e,n){const r=GG(t);return e==="Io"?n.ordinalNumber(r,{unit:"week"}):Wn(r,e.length)},d:function(t,e,n){return e==="do"?n.ordinalNumber(t.getDate(),{unit:"date"}):_c.d(t,e)},D:function(t,e,n){const r=I9e(t);return e==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):Wn(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 Wn(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 Wn(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 Wn(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=ph.noon:r===0?s=ph.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=ph.evening:r>=12?s=ph.afternoon:r>=4?s=ph.morning:s=ph.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 _c.h(t,e)},H:function(t,e,n){return e==="Ho"?n.ordinalNumber(t.getHours(),{unit:"hour"}):_c.H(t,e)},K:function(t,e,n){const r=t.getHours()%12;return e==="Ko"?n.ordinalNumber(r,{unit:"hour"}):Wn(r,e.length)},k:function(t,e,n){let r=t.getHours();return r===0&&(r=24),e==="ko"?n.ordinalNumber(r,{unit:"hour"}):Wn(r,e.length)},m:function(t,e,n){return e==="mo"?n.ordinalNumber(t.getMinutes(),{unit:"minute"}):_c.m(t,e)},s:function(t,e,n){return e==="so"?n.ordinalNumber(t.getSeconds(),{unit:"second"}):_c.s(t,e)},S:function(t,e){return _c.S(t,e)},X:function(t,e,n){const r=t.getTimezoneOffset();if(r===0)return"Z";switch(e){case"X":return Oz(r);case"XXXX":case"XX":return Bu(r);case"XXXXX":case"XXX":default:return Bu(r,":")}},x:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"x":return Oz(r);case"xxxx":case"xx":return Bu(r);case"xxxxx":case"xxx":default:return Bu(r,":")}},O:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+kz(r,":");case"OOOO":default:return"GMT"+Bu(r,":")}},z:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+kz(r,":");case"zzzz":default:return"GMT"+Bu(r,":")}},t:function(t,e,n){const r=Math.trunc(+t/1e3);return Wn(r,e.length)},T:function(t,e,n){return Wn(+t,e.length)}};function kz(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+Wn(i,2)}function Oz(t,e){return t%60===0?(t>0?"-":"+")+Wn(Math.abs(t)/60,2):Bu(t,e)}function Bu(t,e=""){const n=t>0?"-":"+",r=Math.abs(t),s=Wn(Math.trunc(r/60),2),i=Wn(r%60,2);return n+s+e+i}const jz=(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"})}},KG=(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"})}},B9e=(t,e)=>{const n=t.match(/(P+)(p+)?/)||[],r=n[1],s=n[2];if(!s)return jz(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}}",jz(r,e)).replace("{{time}}",KG(s,e))},F9e={p:KG,P:B9e},q9e=/^D+$/,$9e=/^Y+$/,H9e=["D","DD","YY","YYYY"];function Q9e(t){return q9e.test(t)}function V9e(t){return $9e.test(t)}function U9e(t,e,n){const r=W9e(t,e,n);if(console.warn(r),H9e.includes(t))throw new RangeError(r)}function W9e(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 G9e=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,X9e=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Y9e=/^'([^]*?)'?$/,K9e=/''/g,Z9e=/[a-zA-Z]/;function Ev(t,e,n){const r=yg(),s=n?.locale??r.locale??c7,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,l=tr(t,n?.in);if(!ZTe(l))throw new RangeError("Invalid time value");let c=e.match(X9e).map(h=>{const m=h[0];if(m==="p"||m==="P"){const g=F9e[m];return g(h,s.formatLong)}return h}).join("").match(G9e).map(h=>{if(h==="''")return{isToken:!1,value:"'"};const m=h[0];if(m==="'")return{isToken:!1,value:J9e(h)};if(Sz[m])return{isToken:!0,value:h};if(m.match(Z9e))throw new RangeError("Format string contains an unescaped latin alphabet character `"+m+"`");return{isToken:!1,value:h}});s.localize.preprocessor&&(c=s.localize.preprocessor(l,c));const d={firstWeekContainsDate:i,weekStartsOn:a,locale:s};return c.map(h=>{if(!h.isToken)return h.value;const m=h.value;(!n?.useAdditionalWeekYearTokens&&V9e(m)||!n?.useAdditionalDayOfYearTokens&&Q9e(m))&&U9e(m,e,String(t));const g=Sz[m[0]];return g(l,m,s.localize,d)}).join("")}function J9e(t){const e=t.match(Y9e);return e?e[1].replace(K9e,"'"):t}function eEe(t,e){const n=tr(t,e?.in),r=n.getFullYear(),s=n.getMonth(),i=is(n,0);return i.setFullYear(r,s+1,0),i.setHours(0,0,0,0),i.getDate()}function tEe(t,e){return tr(t,e?.in).getMonth()}function nEe(t,e){return tr(t,e?.in).getFullYear()}function rEe(t,e){return+tr(t)>+tr(e)}function sEe(t,e){return+tr(t)<+tr(e)}function iEe(t,e,n){const[r,s]=Od(n?.in,t,e);return+su(r,n)==+su(s,n)}function aEe(t,e,n){const[r,s]=Od(n?.in,t,e);return r.getFullYear()===s.getFullYear()&&r.getMonth()===s.getMonth()}function oEe(t,e,n){const[r,s]=Od(n?.in,t,e);return r.getFullYear()===s.getFullYear()}function lEe(t,e,n){const r=tr(t,n?.in),s=r.getFullYear(),i=r.getDate(),a=is(t,0);a.setFullYear(s,e,15),a.setHours(0,0,0,0);const l=eEe(a);return r.setMonth(e,Math.min(i,l)),r}function cEe(t,e,n){const r=tr(t,n?.in);return isNaN(+r)?is(t,NaN):(r.setFullYear(e),r)}const Nz=5,uEe=4;function dEe(t,e){const n=e.startOfMonth(t),r=n.getDay()>0?n.getDay():7,s=e.addDays(t,-r+1),i=e.addDays(s,Nz*7-1);return e.getMonth(t)===e.getMonth(i)?Nz:uEe}function ZG(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 hEe(t,e){const n=ZG(t,e),r=dEe(t,e);return e.addDays(n,r*7-1)}class Ki{constructor(e,n){this.Date=Date,this.today=()=>this.overrides?.today?this.overrides.today():this.options.timeZone?Fs.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 Fs(r,s,i,this.options.timeZone):new Date(r,s,i),this.addDays=(r,s)=>this.overrides?.addDays?this.overrides.addDays(r,s):BG(r,s),this.addMonths=(r,s)=>this.overrides?.addMonths?this.overrides.addMonths(r,s):FG(r,s),this.addWeeks=(r,s)=>this.overrides?.addWeeks?this.overrides.addWeeks(r,s):WTe(r,s),this.addYears=(r,s)=>this.overrides?.addYears?this.overrides.addYears(r,s):GTe(r,s),this.differenceInCalendarDays=(r,s)=>this.overrides?.differenceInCalendarDays?this.overrides.differenceInCalendarDays(r,s):$G(r,s),this.differenceInCalendarMonths=(r,s)=>this.overrides?.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(r,s):JTe(r,s),this.eachMonthOfInterval=r=>this.overrides?.eachMonthOfInterval?this.overrides.eachMonthOfInterval(r):t9e(r),this.eachYearOfInterval=r=>{const s=this.overrides?.eachYearOfInterval?this.overrides.eachYearOfInterval(r):s9e(r),i=new Set(s.map(l=>this.getYear(l)));if(i.size===s.length)return s;const a=[];return i.forEach(l=>{a.push(new Date(l,0,1))}),a},this.endOfBroadcastWeek=r=>this.overrides?.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(r):hEe(r,this),this.endOfISOWeek=r=>this.overrides?.endOfISOWeek?this.overrides.endOfISOWeek(r):i9e(r),this.endOfMonth=r=>this.overrides?.endOfMonth?this.overrides.endOfMonth(r):e9e(r),this.endOfWeek=(r,s)=>this.overrides?.endOfWeek?this.overrides.endOfWeek(r,s):UG(r,this.options),this.endOfYear=r=>this.overrides?.endOfYear?this.overrides.endOfYear(r):r9e(r),this.format=(r,s,i)=>{const a=this.overrides?.format?this.overrides.format(r,s,this.options):Ev(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):GG(r),this.getMonth=(r,s)=>this.overrides?.getMonth?this.overrides.getMonth(r,this.options):tEe(r,this.options),this.getYear=(r,s)=>this.overrides?.getYear?this.overrides.getYear(r,this.options):nEe(r,this.options),this.getWeek=(r,s)=>this.overrides?.getWeek?this.overrides.getWeek(r,this.options):YG(r,this.options),this.isAfter=(r,s)=>this.overrides?.isAfter?this.overrides.isAfter(r,s):rEe(r,s),this.isBefore=(r,s)=>this.overrides?.isBefore?this.overrides.isBefore(r,s):sEe(r,s),this.isDate=r=>this.overrides?.isDate?this.overrides.isDate(r):HG(r),this.isSameDay=(r,s)=>this.overrides?.isSameDay?this.overrides.isSameDay(r,s):KTe(r,s),this.isSameMonth=(r,s)=>this.overrides?.isSameMonth?this.overrides.isSameMonth(r,s):aEe(r,s),this.isSameYear=(r,s)=>this.overrides?.isSameYear?this.overrides.isSameYear(r,s):oEe(r,s),this.max=r=>this.overrides?.max?this.overrides.max(r):XTe(r),this.min=r=>this.overrides?.min?this.overrides.min(r):YTe(r),this.setMonth=(r,s)=>this.overrides?.setMonth?this.overrides.setMonth(r,s):lEe(r,s),this.setYear=(r,s)=>this.overrides?.setYear?this.overrides.setYear(r,s):cEe(r,s),this.startOfBroadcastWeek=(r,s)=>this.overrides?.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(r,this):ZG(r,this),this.startOfDay=r=>this.overrides?.startOfDay?this.overrides.startOfDay(r):jp(r),this.startOfISOWeek=r=>this.overrides?.startOfISOWeek?this.overrides.startOfISOWeek(r):Op(r),this.startOfMonth=r=>this.overrides?.startOfMonth?this.overrides.startOfMonth(r):n9e(r),this.startOfWeek=(r,s)=>this.overrides?.startOfWeek?this.overrides.startOfWeek(r,this.options):su(r,this.options),this.startOfYear=r=>this.overrides?.startOfYear?this.overrides.startOfYear(r):VG(r),this.options={locale:c7,...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&&Ki.yearFirstLocales.has(e)?"year-first":"month-first"}formatMonthYear(e){const{locale:n,timeZone:r,numerals:s}=this.options,i=n?.code;if(i&&Ki.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)}}Ki.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 Xo=new Ki;class JG{constructor(e,n,r=Xo){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 fEe{constructor(e,n){this.date=e,this.weeks=n}}class mEe{constructor(e,n){this.days=n,this.weekNumber=e}}function pEe(t){return ae.createElement("button",{...t})}function gEe(t){return ae.createElement("span",{...t})}function xEe(t){const{size:e=24,orientation:n="left",className:r}=t;return ae.createElement("svg",{className:r,width:e,height:e,viewBox:"0 0 24 24"},n==="up"&&ae.createElement("polygon",{points:"6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28"}),n==="down"&&ae.createElement("polygon",{points:"6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72"}),n==="left"&&ae.createElement("polygon",{points:"16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20"}),n==="right"&&ae.createElement("polygon",{points:"8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20"}))}function vEe(t){const{day:e,modifiers:n,...r}=t;return ae.createElement("td",{...r})}function yEe(t){const{day:e,modifiers:n,...r}=t,s=ae.useRef(null);return ae.useEffect(()=>{n.focused&&s.current?.focus()},[n.focused]),ae.createElement("button",{ref:s,...r})}var jt;(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"})(jt||(jt={}));var Ar;(function(t){t.disabled="disabled",t.hidden="hidden",t.outside="outside",t.focused="focused",t.today="today"})(Ar||(Ar={}));var Ua;(function(t){t.range_end="range_end",t.range_middle="range_middle",t.range_start="range_start",t.selected="selected"})(Ua||(Ua={}));var Hi;(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"})(Hi||(Hi={}));function bEe(t){const{options:e,className:n,components:r,classNames:s,...i}=t,a=[s[jt.Dropdown],n].join(" "),l=e?.find(({value:c})=>c===i.value);return ae.createElement("span",{"data-disabled":i.disabled,className:s[jt.DropdownRoot]},ae.createElement(r.Select,{className:a,...i},e?.map(({value:c,label:d,disabled:h})=>ae.createElement(r.Option,{key:c,value:c,disabled:h},d))),ae.createElement("span",{className:s[jt.CaptionLabel],"aria-hidden":!0},l?.label,ae.createElement(r.Chevron,{orientation:"down",size:18,className:s[jt.Chevron]})))}function wEe(t){return ae.createElement("div",{...t})}function SEe(t){return ae.createElement("div",{...t})}function kEe(t){const{calendarMonth:e,displayIndex:n,...r}=t;return ae.createElement("div",{...r},t.children)}function OEe(t){const{calendarMonth:e,displayIndex:n,...r}=t;return ae.createElement("div",{...r})}function jEe(t){return ae.createElement("table",{...t})}function NEe(t){return ae.createElement("div",{...t})}const eX=b.createContext(void 0);function bg(){const t=b.useContext(eX);if(t===void 0)throw new Error("useDayPicker() must be used within a custom component.");return t}function CEe(t){const{components:e}=bg();return ae.createElement(e.Dropdown,{...t})}function TEe(t){const{onPreviousClick:e,onNextClick:n,previousMonth:r,nextMonth:s,...i}=t,{components:a,classNames:l,labels:{labelPrevious:c,labelNext:d}}=bg(),h=b.useCallback(g=>{s&&n?.(g)},[s,n]),m=b.useCallback(g=>{r&&e?.(g)},[r,e]);return ae.createElement("nav",{...i},ae.createElement(a.PreviousMonthButton,{type:"button",className:l[jt.PreviousMonthButton],tabIndex:r?void 0:-1,"aria-disabled":r?void 0:!0,"aria-label":c(r),onClick:m},ae.createElement(a.Chevron,{disabled:r?void 0:!0,className:l[jt.Chevron],orientation:"left"})),ae.createElement(a.NextMonthButton,{type:"button",className:l[jt.NextMonthButton],tabIndex:s?void 0:-1,"aria-disabled":s?void 0:!0,"aria-label":d(s),onClick:h},ae.createElement(a.Chevron,{disabled:s?void 0:!0,orientation:"right",className:l[jt.Chevron]})))}function EEe(t){const{components:e}=bg();return ae.createElement(e.Button,{...t})}function _Ee(t){return ae.createElement("option",{...t})}function AEe(t){const{components:e}=bg();return ae.createElement(e.Button,{...t})}function MEe(t){const{rootRef:e,...n}=t;return ae.createElement("div",{...n,ref:e})}function REe(t){return ae.createElement("select",{...t})}function DEe(t){const{week:e,...n}=t;return ae.createElement("tr",{...n})}function PEe(t){return ae.createElement("th",{...t})}function zEe(t){return ae.createElement("thead",{"aria-hidden":!0},ae.createElement("tr",{...t}))}function IEe(t){const{week:e,...n}=t;return ae.createElement("th",{...n})}function LEe(t){return ae.createElement("th",{...t})}function BEe(t){return ae.createElement("tbody",{...t})}function FEe(t){const{components:e}=bg();return ae.createElement(e.Dropdown,{...t})}const qEe=Object.freeze(Object.defineProperty({__proto__:null,Button:pEe,CaptionLabel:gEe,Chevron:xEe,Day:vEe,DayButton:yEe,Dropdown:bEe,DropdownNav:wEe,Footer:SEe,Month:kEe,MonthCaption:OEe,MonthGrid:jEe,Months:NEe,MonthsDropdown:CEe,Nav:TEe,NextMonthButton:EEe,Option:_Ee,PreviousMonthButton:AEe,Root:MEe,Select:REe,Week:DEe,WeekNumber:IEe,WeekNumberHeader:LEe,Weekday:PEe,Weekdays:zEe,Weeks:BEe,YearsDropdown:FEe},Symbol.toStringTag,{value:"Module"}));function Dl(t,e,n=!1,r=Xo){let{from:s,to:i}=t;const{differenceInCalendarDays:a,isSameDay:l}=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?l(i,e):!n&&s?l(s,e):!1}function tX(t){return!!(t&&typeof t=="object"&&"before"in t&&"after"in t)}function u7(t){return!!(t&&typeof t=="object"&&"from"in t)}function nX(t){return!!(t&&typeof t=="object"&&"after"in t)}function rX(t){return!!(t&&typeof t=="object"&&"before"in t)}function sX(t){return!!(t&&typeof t=="object"&&"dayOfWeek"in t)}function iX(t,e){return Array.isArray(t)&&t.every(e.isDate)}function Pl(t,e,n=Xo){const r=Array.isArray(e)?e:[e],{isSameDay:s,differenceInCalendarDays:i,isAfter:a}=n;return r.some(l=>{if(typeof l=="boolean")return l;if(n.isDate(l))return s(t,l);if(iX(l,n))return l.includes(t);if(u7(l))return Dl(l,t,!1,n);if(sX(l))return Array.isArray(l.dayOfWeek)?l.dayOfWeek.includes(t.getDay()):l.dayOfWeek===t.getDay();if(tX(l)){const c=i(l.before,t),d=i(l.after,t),h=c>0,m=d<0;return a(l.before,l.after)?m&&h:h||m}return nX(l)?i(t,l.after)>0:rX(l)?i(l.before,t)>0:typeof l=="function"?l(t):!1})}function $Ee(t,e,n,r,s){const{disabled:i,hidden:a,modifiers:l,showOutsideDays:c,broadcastCalendar:d,today:h}=e,{isSameDay:m,isSameMonth:g,startOfMonth:x,isBefore:y,endOfMonth:w,isAfter:S}=s,k=n&&x(n),j=r&&w(r),N={[Ar.focused]:[],[Ar.outside]:[],[Ar.disabled]:[],[Ar.hidden]:[],[Ar.today]:[]},T={};for(const E of t){const{date:_,displayMonth:A}=E,L=!!(A&&!g(_,A)),P=!!(k&&y(_,k)),B=!!(j&&S(_,j)),$=!!(i&&Pl(_,i,s)),U=!!(a&&Pl(_,a,s))||P||B||!d&&!c&&L||d&&c===!1&&L,te=m(_,h??s.today());L&&N.outside.push(E),$&&N.disabled.push(E),U&&N.hidden.push(E),te&&N.today.push(E),l&&Object.keys(l).forEach(z=>{const Q=l?.[z];Q&&Pl(_,Q,s)&&(T[z]?T[z].push(E):T[z]=[E])})}return E=>{const _={[Ar.focused]:!1,[Ar.disabled]:!1,[Ar.hidden]:!1,[Ar.outside]:!1,[Ar.today]:!1},A={};for(const L in N){const P=N[L];_[L]=P.some(B=>B===E)}for(const L in T)A[L]=T[L].some(P=>P===E);return{..._,...A}}}function HEe(t,e,n={}){return Object.entries(t).filter(([,s])=>s===!0).reduce((s,[i])=>(n[i]?s.push(n[i]):e[Ar[i]]?s.push(e[Ar[i]]):e[Ua[i]]&&s.push(e[Ua[i]]),s),[e[jt.Day]])}function QEe(t){return{...qEe,...t}}function VEe(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 d7(){const t={};for(const e in jt)t[jt[e]]=`rdp-${jt[e]}`;for(const e in Ar)t[Ar[e]]=`rdp-${Ar[e]}`;for(const e in Ua)t[Ua[e]]=`rdp-${Ua[e]}`;for(const e in Hi)t[Hi[e]]=`rdp-${Hi[e]}`;return t}function aX(t,e,n){return(n??new Ki(e)).formatMonthYear(t)}const UEe=aX;function WEe(t,e,n){return(n??new Ki(e)).format(t,"d")}function GEe(t,e=Xo){return e.format(t,"LLLL")}function XEe(t,e,n){return(n??new Ki(e)).format(t,"cccccc")}function YEe(t,e=Xo){return t<10?e.formatNumber(`0${t.toLocaleString()}`):e.formatNumber(`${t.toLocaleString()}`)}function KEe(){return""}function oX(t,e=Xo){return e.format(t,"yyyy")}const ZEe=oX,JEe=Object.freeze(Object.defineProperty({__proto__:null,formatCaption:aX,formatDay:WEe,formatMonthCaption:UEe,formatMonthDropdown:GEe,formatWeekNumber:YEe,formatWeekNumberHeader:KEe,formatWeekdayName:XEe,formatYearCaption:ZEe,formatYearDropdown:oX},Symbol.toStringTag,{value:"Module"}));function e_e(t){return t?.formatMonthCaption&&!t.formatCaption&&(t.formatCaption=t.formatMonthCaption),t?.formatYearCaption&&!t.formatYearDropdown&&(t.formatYearDropdown=t.formatYearCaption),{...JEe,...t}}function t_e(t,e,n,r,s){const{startOfMonth:i,startOfYear:a,endOfYear:l,eachMonthOfInterval:c,getMonth:d}=s;return c({start:a(t),end:l(t)}).map(g=>{const x=r.formatMonthDropdown(g,s),y=d(g),w=e&&g<i(e)||n&&g>i(n)||!1;return{value:y,label:x,disabled:w}})}function n_e(t,e={},n={}){let r={...e?.[jt.Day]};return Object.entries(t).filter(([,s])=>s===!0).forEach(([s])=>{r={...r,...n?.[s]}}),r}function r_e(t,e,n){const r=t.today(),s=e?t.startOfISOWeek(r):t.startOfWeek(r),i=[];for(let a=0;a<7;a++){const l=t.addDays(s,a);i.push(l)}return i}function s_e(t,e,n,r,s=!1){if(!t||!e)return;const{startOfYear:i,endOfYear:a,eachYearOfInterval:l,getYear:c}=r,d=i(t),h=a(e),m=l({start:d,end:h});return s&&m.reverse(),m.map(g=>{const x=n.formatYearDropdown(g,r);return{value:c(g),label:x,disabled:!1}})}function lX(t,e,n,r){let s=(r??new Ki(n)).format(t,"PPPP");return e.today&&(s=`Today, ${s}`),e.selected&&(s=`${s}, selected`),s}const i_e=lX;function cX(t,e,n){return(n??new Ki(e)).formatMonthYear(t)}const a_e=cX;function o_e(t,e,n,r){let s=(r??new Ki(n)).format(t,"PPPP");return e?.today&&(s=`Today, ${s}`),s}function l_e(t){return"Choose the Month"}function c_e(){return""}function u_e(t){return"Go to the Next Month"}function d_e(t){return"Go to the Previous Month"}function h_e(t,e,n){return(n??new Ki(e)).format(t,"cccc")}function f_e(t,e){return`Week ${t}`}function m_e(t){return"Week Number"}function p_e(t){return"Choose the Year"}const g_e=Object.freeze(Object.defineProperty({__proto__:null,labelCaption:a_e,labelDay:i_e,labelDayButton:lX,labelGrid:cX,labelGridcell:o_e,labelMonthDropdown:l_e,labelNav:c_e,labelNext:u_e,labelPrevious:d_e,labelWeekNumber:f_e,labelWeekNumberHeader:m_e,labelWeekday:h_e,labelYearDropdown:p_e},Symbol.toStringTag,{value:"Module"})),wg=t=>t instanceof HTMLElement?t:null,Y3=t=>[...t.querySelectorAll("[data-animated-month]")??[]],x_e=t=>wg(t.querySelector("[data-animated-month]")),K3=t=>wg(t.querySelector("[data-animated-caption]")),Z3=t=>wg(t.querySelector("[data-animated-weeks]")),v_e=t=>wg(t.querySelector("[data-animated-nav]")),y_e=t=>wg(t.querySelector("[data-animated-weekdays]"));function b_e(t,e,{classNames:n,months:r,focused:s,dateLib:i}){const a=b.useRef(null),l=b.useRef(r),c=b.useRef(!1);b.useLayoutEffect(()=>{const d=l.current;if(l.current=r,!e||!t.current||!(t.current instanceof HTMLElement)||r.length===0||d.length===0||r.length!==d.length)return;const h=i.isSameMonth(r[0].date,d[0].date),m=i.isAfter(r[0].date,d[0].date),g=m?n[Hi.caption_after_enter]:n[Hi.caption_before_enter],x=m?n[Hi.weeks_after_enter]:n[Hi.weeks_before_enter],y=a.current,w=t.current.cloneNode(!0);if(w instanceof HTMLElement?(Y3(w).forEach(N=>{if(!(N instanceof HTMLElement))return;const T=x_e(N);T&&N.contains(T)&&N.removeChild(T);const E=K3(N);E&&E.classList.remove(g);const _=Z3(N);_&&_.classList.remove(x)}),a.current=w):a.current=null,c.current||h||s)return;const S=y instanceof HTMLElement?Y3(y):[],k=Y3(t.current);if(k?.every(j=>j instanceof HTMLElement)&&S&&S.every(j=>j instanceof HTMLElement)){c.current=!0,t.current.style.isolation="isolate";const j=v_e(t.current);j&&(j.style.zIndex="1"),k.forEach((N,T)=>{const E=S[T];if(!E)return;N.style.position="relative",N.style.overflow="hidden";const _=K3(N);_&&_.classList.add(g);const A=Z3(N);A&&A.classList.add(x);const L=()=>{c.current=!1,t.current&&(t.current.style.isolation=""),j&&(j.style.zIndex=""),_&&_.classList.remove(g),A&&A.classList.remove(x),N.style.position="",N.style.overflow="",N.contains(E)&&N.removeChild(E)};E.style.pointerEvents="none",E.style.position="absolute",E.style.overflow="hidden",E.setAttribute("aria-hidden","true");const P=y_e(E);P&&(P.style.opacity="0");const B=K3(E);B&&(B.classList.add(m?n[Hi.caption_before_exit]:n[Hi.caption_after_exit]),B.addEventListener("animationend",L));const $=Z3(E);$&&$.classList.add(m?n[Hi.weeks_before_exit]:n[Hi.weeks_after_exit]),N.insertBefore(E,N.firstChild)})}})}function w_e(t,e,n,r){const s=t[0],i=t[t.length-1],{ISOWeek:a,fixedWeeks:l,broadcastCalendar:c}=n??{},{addDays:d,differenceInCalendarDays:h,differenceInCalendarMonths:m,endOfBroadcastWeek:g,endOfISOWeek:x,endOfMonth:y,endOfWeek:w,isAfter:S,startOfBroadcastWeek:k,startOfISOWeek:j,startOfWeek:N}=r,T=c?k(s,r):a?j(s):N(s),E=c?g(i):a?x(y(i)):w(y(i)),_=h(E,T),A=m(i,s)+1,L=[];for(let $=0;$<=_;$++){const U=d(T,$);if(e&&S(U,e))break;L.push(U)}const B=(c?35:42)*A;if(l&&L.length<B){const $=B-L.length;for(let U=0;U<$;U++){const te=d(L[L.length-1],1);L.push(te)}}return L}function S_e(t){const e=[];return t.reduce((n,r)=>{const s=r.weeks.reduce((i,a)=>i.concat(a.days.slice()),e.slice());return n.concat(s.slice())},e.slice())}function k_e(t,e,n,r){const{numberOfMonths:s=1}=n,i=[];for(let a=0;a<s;a++){const l=r.addMonths(t,a);if(e&&l>e)break;i.push(l)}return i}function Cz(t,e,n,r){const{month:s,defaultMonth:i,today:a=r.today(),numberOfMonths:l=1}=t;let c=s||i||a;const{differenceInCalendarMonths:d,addMonths:h,startOfMonth:m}=r;if(n&&d(n,c)<l-1){const g=-1*(l-1);c=h(n,g)}return e&&d(c,e)<0&&(c=e),m(c)}function O_e(t,e,n,r){const{addDays:s,endOfBroadcastWeek:i,endOfISOWeek:a,endOfMonth:l,endOfWeek:c,getISOWeek:d,getWeek:h,startOfBroadcastWeek:m,startOfISOWeek:g,startOfWeek:x}=r,y=t.reduce((w,S)=>{const k=n.broadcastCalendar?m(S,r):n.ISOWeek?g(S):x(S),j=n.broadcastCalendar?i(S):n.ISOWeek?a(l(S)):c(l(S)),N=e.filter(A=>A>=k&&A<=j),T=n.broadcastCalendar?35:42;if(n.fixedWeeks&&N.length<T){const A=e.filter(L=>{const P=T-N.length;return L>j&&L<=s(j,P)});N.push(...A)}const E=N.reduce((A,L)=>{const P=n.ISOWeek?d(L):h(L),B=A.find(U=>U.weekNumber===P),$=new JG(L,S,r);return B?B.days.push($):A.push(new mEe(P,[$])),A},[]),_=new fEe(S,E);return w.push(_),w},[]);return n.reverseMonths?y.reverse():y}function j_e(t,e){let{startMonth:n,endMonth:r}=t;const{startOfYear:s,startOfDay:i,startOfMonth:a,endOfMonth:l,addYears:c,endOfYear:d,newDate:h,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=h(x,11,31));const S=t.captionLayout==="dropdown"||t.captionLayout==="dropdown-years";return n?n=a(n):g?n=h(g,0,1):!n&&S&&(n=s(c(t.today??m(),-100))),r?r=l(r):x?r=h(x,11,31):!r&&S&&(r=d(t.today??m())),[n&&i(n),r&&i(r)]}function N_e(t,e,n,r){if(n.disableNavigation)return;const{pagedNavigation:s,numberOfMonths:i=1}=n,{startOfMonth:a,addMonths:l,differenceInCalendarMonths:c}=r,d=s?i:1,h=a(t);if(!e)return l(h,d);if(!(c(e,t)<i))return l(h,d)}function C_e(t,e,n,r){if(n.disableNavigation)return;const{pagedNavigation:s,numberOfMonths:i}=n,{startOfMonth:a,addMonths:l,differenceInCalendarMonths:c}=r,d=s?i??1:1,h=a(t);if(!e)return l(h,-d);if(!(c(h,e)<=0))return l(h,-d)}function T_e(t){const e=[];return t.reduce((n,r)=>n.concat(r.weeks.slice()),e.slice())}function nw(t,e){const[n,r]=b.useState(t);return[e===void 0?n:e,r]}function E_e(t,e){const[n,r]=j_e(t,e),{startOfMonth:s,endOfMonth:i}=e,a=Cz(t,n,r,e),[l,c]=nw(a,t.month?a:void 0);b.useEffect(()=>{const _=Cz(t,n,r,e);c(_)},[t.timeZone]);const d=k_e(l,r,t,e),h=w_e(d,t.endMonth?i(t.endMonth):void 0,t,e),m=O_e(d,h,t,e),g=T_e(m),x=S_e(m),y=C_e(l,n,t,e),w=N_e(l,r,t,e),{disableNavigation:S,onMonthChange:k}=t,j=_=>g.some(A=>A.days.some(L=>L.isEqualTo(_))),N=_=>{if(S)return;let A=s(_);n&&A<s(n)&&(A=s(n)),r&&A>s(r)&&(A=s(r)),c(A),k?.(A)};return{months:m,weeks:g,days:x,navStart:n,navEnd:r,previousMonth:y,nextMonth:w,goToMonth:N,goToDay:_=>{j(_)||N(_.date)}}}var xo;(function(t){t[t.Today=0]="Today",t[t.Selected=1]="Selected",t[t.LastFocused=2]="LastFocused",t[t.FocusedModifier=3]="FocusedModifier"})(xo||(xo={}));function Tz(t){return!t[Ar.disabled]&&!t[Ar.hidden]&&!t[Ar.outside]}function __e(t,e,n,r){let s,i=-1;for(const a of t){const l=e(a);Tz(l)&&(l[Ar.focused]&&i<xo.FocusedModifier?(s=a,i=xo.FocusedModifier):r?.isEqualTo(a)&&i<xo.LastFocused?(s=a,i=xo.LastFocused):n(a.date)&&i<xo.Selected?(s=a,i=xo.Selected):l[Ar.today]&&i<xo.Today&&(s=a,i=xo.Today))}return s||(s=t.find(a=>Tz(e(a)))),s}function A_e(t,e,n,r,s,i,a){const{ISOWeek:l,broadcastCalendar:c}=i,{addDays:d,addMonths:h,addWeeks:m,addYears:g,endOfBroadcastWeek:x,endOfISOWeek:y,endOfWeek:w,max:S,min:k,startOfBroadcastWeek:j,startOfISOWeek:N,startOfWeek:T}=a;let _={day:d,week:m,month:h,year:g,startOfWeek:A=>c?j(A,a):l?N(A):T(A),endOfWeek:A=>c?x(A):l?y(A):w(A)}[t](n,e==="after"?1:-1);return e==="before"&&r?_=S([r,_]):e==="after"&&s&&(_=k([s,_])),_}function uX(t,e,n,r,s,i,a,l=0){if(l>365)return;const c=A_e(t,e,n.date,r,s,i,a),d=!!(i.disabled&&Pl(c,i.disabled,a)),h=!!(i.hidden&&Pl(c,i.hidden,a)),m=c,g=new JG(c,m,a);return!d&&!h?g:uX(t,e,g,r,s,i,a,l+1)}function M_e(t,e,n,r,s){const{autoFocus:i}=t,[a,l]=b.useState(),c=__e(e.days,n,r||(()=>!1),a),[d,h]=b.useState(i?c:void 0);return{isFocusTarget:w=>!!c?.isEqualTo(w),setFocused:h,focused:d,blur:()=>{l(d),h(void 0)},moveFocus:(w,S)=>{if(!d)return;const k=uX(w,S,d,e.navStart,e.navEnd,t,s);k&&(t.disableNavigation&&!e.days.some(N=>N.isEqualTo(k))||(e.goToDay(k),h(k)))}}}function R_e(t,e){const{selected:n,required:r,onSelect:s}=t,[i,a]=nw(n,s?n:void 0),l=s?n:i,{isSameDay:c}=e,d=x=>l?.some(y=>c(y,x))??!1,{min:h,max:m}=t;return{selected:l,select:(x,y,w)=>{let S=[...l??[]];if(d(x)){if(l?.length===h||r&&l?.length===1)return;S=l?.filter(k=>!c(k,x))}else l?.length===m?S=[x]:S=[...S,x];return s||a(S),s?.(S,x,y,w),S},isSelected:d}}function D_e(t,e,n=0,r=0,s=!1,i=Xo){const{from:a,to:l}=e||{},{isSameDay:c,isAfter:d,isBefore:h}=i;let m;if(!a&&!l)m={from:t,to:n>0?void 0:t};else if(a&&!l)c(a,t)?n===0?m={from:a,to:t}:s?m={from:a,to:void 0}:m=void 0:h(t,a)?m={from:t,to:a}:m={from:a,to:t};else if(a&&l)if(c(a,t)&&c(l,t))s?m={from:a,to:l}:m=void 0;else if(c(a,t))m={from:a,to:n>0?void 0:t};else if(c(l,t))m={from:t,to:n>0?void 0:t};else if(h(t,a))m={from:t,to:l};else if(d(t,a))m={from:a,to:t};else if(d(t,l))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&&g<n&&(m={from:t,to:void 0})}return m}function P_e(t,e,n=Xo){const r=Array.isArray(e)?e:[e];let s=t.from;const i=n.differenceInCalendarDays(t.to,t.from),a=Math.min(i,6);for(let l=0;l<=a;l++){if(r.includes(s.getDay()))return!0;s=n.addDays(s,1)}return!1}function Ez(t,e,n=Xo){return Dl(t,e.from,!1,n)||Dl(t,e.to,!1,n)||Dl(e,t.from,!1,n)||Dl(e,t.to,!1,n)}function z_e(t,e,n=Xo){const r=Array.isArray(e)?e:[e];if(r.filter(l=>typeof l!="function").some(l=>typeof l=="boolean"?l:n.isDate(l)?Dl(t,l,!1,n):iX(l,n)?l.some(c=>Dl(t,c,!1,n)):u7(l)?l.from&&l.to?Ez(t,{from:l.from,to:l.to},n):!1:sX(l)?P_e(t,l.dayOfWeek,n):tX(l)?n.isAfter(l.before,l.after)?Ez(t,{from:n.addDays(l.after,1),to:n.addDays(l.before,-1)},n):Pl(t.from,l,n)||Pl(t.to,l,n):nX(l)||rX(l)?Pl(t.from,l,n)||Pl(t.to,l,n):!1))return!0;const a=r.filter(l=>typeof l=="function");if(a.length){let l=t.from;const c=n.differenceInCalendarDays(t.to,t.from);for(let d=0;d<=c;d++){if(a.some(h=>h(l)))return!0;l=n.addDays(l,1)}}return!1}function I_e(t,e){const{disabled:n,excludeDisabled:r,selected:s,required:i,onSelect:a}=t,[l,c]=nw(s,a?s:void 0),d=a?s:l;return{selected:d,select:(g,x,y)=>{const{min:w,max:S}=t,k=g?D_e(g,d,w,S,i,e):void 0;return r&&n&&k?.from&&k.to&&z_e({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=>d&&Dl(d,g,!1,e)}}function L_e(t,e){const{selected:n,required:r,onSelect:s}=t,[i,a]=nw(n,s?n:void 0),l=s?n:i,{isSameDay:c}=e;return{selected:l,select:(m,g,x)=>{let y=m;return!r&&l&&l&&c(m,l)&&(y=void 0),s||a(y),s?.(y,m,g,x),y},isSelected:m=>l?c(l,m):!1}}function B_e(t,e){const n=L_e(t,e),r=R_e(t,e),s=I_e(t,e);switch(t.mode){case"single":return n;case"multiple":return r;case"range":return s;default:return}}function F_e(t){let e=t;e.timeZone&&(e={...t},e.today&&(e.today=new Fs(e.today,e.timeZone)),e.month&&(e.month=new Fs(e.month,e.timeZone)),e.defaultMonth&&(e.defaultMonth=new Fs(e.defaultMonth,e.timeZone)),e.startMonth&&(e.startMonth=new Fs(e.startMonth,e.timeZone)),e.endMonth&&(e.endMonth=new Fs(e.endMonth,e.timeZone)),e.mode==="single"&&e.selected?e.selected=new Fs(e.selected,e.timeZone):e.mode==="multiple"&&e.selected?e.selected=e.selected?.map(Pe=>new Fs(Pe,e.timeZone)):e.mode==="range"&&e.selected&&(e.selected={from:e.selected.from?new Fs(e.selected.from,e.timeZone):void 0,to:e.selected.to?new Fs(e.selected.to,e.timeZone):void 0}));const{components:n,formatters:r,labels:s,dateLib:i,locale:a,classNames:l}=b.useMemo(()=>{const Pe={...c7,...e.locale};return{dateLib:new Ki({locale:Pe,weekStartsOn:e.broadcastCalendar?1:e.weekStartsOn,firstWeekContainsDate:e.firstWeekContainsDate,useAdditionalWeekYearTokens:e.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:e.useAdditionalDayOfYearTokens,timeZone:e.timeZone,numerals:e.numerals},e.dateLib),components:QEe(e.components),formatters:e_e(e.formatters),labels:{...g_e,...e.labels},locale:Pe,classNames:{...d7(),...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:d,navLayout:h,numberOfMonths:m=1,onDayBlur:g,onDayClick:x,onDayFocus:y,onDayKeyDown:w,onDayMouseEnter:S,onDayMouseLeave:k,onNextClick:j,onPrevClick:N,showWeekNumber:T,styles:E}=e,{formatCaption:_,formatDay:A,formatMonthDropdown:L,formatWeekNumber:P,formatWeekNumberHeader:B,formatWeekdayName:$,formatYearDropdown:U}=r,te=E_e(e,i),{days:z,months:Q,navStart:F,navEnd:Y,previousMonth:J,nextMonth:X,goToMonth:R}=te,ie=$Ee(z,e,F,Y,i),{isSelected:G,select:I,selected:V}=B_e(e,i)??{},{blur:ee,focused:ne,isFocusTarget:W,moveFocus:se,setFocused:re}=M_e(e,te,ie,G??(()=>!1),i),{labelDayButton:oe,labelGridcell:Te,labelGrid:We,labelMonthDropdown:Ye,labelNav:Je,labelPrevious:Oe,labelNext:Ve,labelWeekday:Ue,labelWeekNumber:He,labelWeekNumberHeader:Ot,labelYearDropdown:xt}=s,kn=b.useMemo(()=>r_e(i,e.ISOWeek),[i,e.ISOWeek]),It=d!==void 0||x!==void 0,Yt=b.useCallback(()=>{J&&(R(J),N?.(J))},[J,R,N]),_t=b.useCallback(()=>{X&&(R(X),j?.(X))},[R,X,j]),mt=b.useCallback((Pe,it)=>ot=>{ot.preventDefault(),ot.stopPropagation(),re(Pe),I?.(Pe.date,it,ot),x?.(Pe.date,it,ot)},[I,x,re]),Ne=b.useCallback((Pe,it)=>ot=>{re(Pe),y?.(Pe.date,it,ot)},[y,re]),Ie=b.useCallback((Pe,it)=>ot=>{ee(),g?.(Pe.date,it,ot)},[ee,g]),st=b.useCallback((Pe,it)=>ot=>{const nn={ArrowLeft:[ot.shiftKey?"month":"day",e.dir==="rtl"?"after":"before"],ArrowRight:[ot.shiftKey?"month":"day",e.dir==="rtl"?"before":"after"],ArrowDown:[ot.shiftKey?"year":"week","after"],ArrowUp:[ot.shiftKey?"year":"week","before"],PageUp:[ot.shiftKey?"year":"month","before"],PageDown:[ot.shiftKey?"year":"month","after"],Home:["startOfWeek","before"],End:["endOfWeek","after"]};if(nn[ot.key]){ot.preventDefault(),ot.stopPropagation();const[Kt,pt]=nn[ot.key];se(Kt,pt)}w?.(Pe.date,it,ot)},[se,w,e.dir]),yt=b.useCallback((Pe,it)=>ot=>{S?.(Pe.date,it,ot)},[S]),Pt=b.useCallback((Pe,it)=>ot=>{k?.(Pe.date,it,ot)},[k]),Mt=b.useCallback(Pe=>it=>{const ot=Number(it.target.value),nn=i.setMonth(i.startOfMonth(Pe),ot);R(nn)},[i,R]),zn=b.useCallback(Pe=>it=>{const ot=Number(it.target.value),nn=i.setYear(i.startOfMonth(Pe),ot);R(nn)},[i,R]),{className:Fe,style:rt}=b.useMemo(()=>({className:[l[jt.Root],e.className].filter(Boolean).join(" "),style:{...E?.[jt.Root],...e.style}}),[l,e.className,e.style,E]),tn=VEe(e),Rt=b.useRef(null);b_e(Rt,!!e.animate,{classNames:l,months:Q,focused:ne,dateLib:i});const ke={dayPickerProps:e,selected:V,select:I,isSelected:G,months:Q,nextMonth:X,previousMonth:J,goToMonth:R,getModifiers:ie,components:n,classNames:l,styles:E,labels:s,formatters:r};return ae.createElement(eX.Provider,{value:ke},ae.createElement(n.Root,{rootRef:e.animate?Rt:void 0,className:Fe,style:rt,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"],...tn},ae.createElement(n.Months,{className:l[jt.Months],style:E?.[jt.Months]},!e.hideNavigation&&!h&&ae.createElement(n.Nav,{"data-animated-nav":e.animate?"true":void 0,className:l[jt.Nav],style:E?.[jt.Nav],"aria-label":Je(),onPreviousClick:Yt,onNextClick:_t,previousMonth:J,nextMonth:X}),Q.map((Pe,it)=>ae.createElement(n.Month,{"data-animated-month":e.animate?"true":void 0,className:l[jt.Month],style:E?.[jt.Month],key:it,displayIndex:it,calendarMonth:Pe},h==="around"&&!e.hideNavigation&&it===0&&ae.createElement(n.PreviousMonthButton,{type:"button",className:l[jt.PreviousMonthButton],tabIndex:J?void 0:-1,"aria-disabled":J?void 0:!0,"aria-label":Oe(J),onClick:Yt,"data-animated-button":e.animate?"true":void 0},ae.createElement(n.Chevron,{disabled:J?void 0:!0,className:l[jt.Chevron],orientation:e.dir==="rtl"?"right":"left"})),ae.createElement(n.MonthCaption,{"data-animated-caption":e.animate?"true":void 0,className:l[jt.MonthCaption],style:E?.[jt.MonthCaption],calendarMonth:Pe,displayIndex:it},c?.startsWith("dropdown")?ae.createElement(n.DropdownNav,{className:l[jt.Dropdowns],style:E?.[jt.Dropdowns]},(()=>{const ot=c==="dropdown"||c==="dropdown-months"?ae.createElement(n.MonthsDropdown,{key:"month",className:l[jt.MonthsDropdown],"aria-label":Ye(),classNames:l,components:n,disabled:!!e.disableNavigation,onChange:Mt(Pe.date),options:t_e(Pe.date,F,Y,r,i),style:E?.[jt.Dropdown],value:i.getMonth(Pe.date)}):ae.createElement("span",{key:"month"},L(Pe.date,i)),nn=c==="dropdown"||c==="dropdown-years"?ae.createElement(n.YearsDropdown,{key:"year",className:l[jt.YearsDropdown],"aria-label":xt(i.options),classNames:l,components:n,disabled:!!e.disableNavigation,onChange:zn(Pe.date),options:s_e(F,Y,r,i,!!e.reverseYears),style:E?.[jt.Dropdown],value:i.getYear(Pe.date)}):ae.createElement("span",{key:"year"},U(Pe.date,i));return i.getMonthYearOrder()==="year-first"?[nn,ot]:[ot,nn]})(),ae.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"}},_(Pe.date,i.options,i))):ae.createElement(n.CaptionLabel,{className:l[jt.CaptionLabel],role:"status","aria-live":"polite"},_(Pe.date,i.options,i))),h==="around"&&!e.hideNavigation&&it===m-1&&ae.createElement(n.NextMonthButton,{type:"button",className:l[jt.NextMonthButton],tabIndex:X?void 0:-1,"aria-disabled":X?void 0:!0,"aria-label":Ve(X),onClick:_t,"data-animated-button":e.animate?"true":void 0},ae.createElement(n.Chevron,{disabled:X?void 0:!0,className:l[jt.Chevron],orientation:e.dir==="rtl"?"left":"right"})),it===m-1&&h==="after"&&!e.hideNavigation&&ae.createElement(n.Nav,{"data-animated-nav":e.animate?"true":void 0,className:l[jt.Nav],style:E?.[jt.Nav],"aria-label":Je(),onPreviousClick:Yt,onNextClick:_t,previousMonth:J,nextMonth:X}),ae.createElement(n.MonthGrid,{role:"grid","aria-multiselectable":d==="multiple"||d==="range","aria-label":We(Pe.date,i.options,i)||void 0,className:l[jt.MonthGrid],style:E?.[jt.MonthGrid]},!e.hideWeekdays&&ae.createElement(n.Weekdays,{"data-animated-weekdays":e.animate?"true":void 0,className:l[jt.Weekdays],style:E?.[jt.Weekdays]},T&&ae.createElement(n.WeekNumberHeader,{"aria-label":Ot(i.options),className:l[jt.WeekNumberHeader],style:E?.[jt.WeekNumberHeader],scope:"col"},B()),kn.map(ot=>ae.createElement(n.Weekday,{"aria-label":Ue(ot,i.options,i),className:l[jt.Weekday],key:String(ot),style:E?.[jt.Weekday],scope:"col"},$(ot,i.options,i)))),ae.createElement(n.Weeks,{"data-animated-weeks":e.animate?"true":void 0,className:l[jt.Weeks],style:E?.[jt.Weeks]},Pe.weeks.map(ot=>ae.createElement(n.Week,{className:l[jt.Week],key:ot.weekNumber,style:E?.[jt.Week],week:ot},T&&ae.createElement(n.WeekNumber,{week:ot,style:E?.[jt.WeekNumber],"aria-label":He(ot.weekNumber,{locale:a}),className:l[jt.WeekNumber],scope:"row",role:"rowheader"},P(ot.weekNumber,i)),ot.days.map(nn=>{const{date:Kt}=nn,pt=ie(nn);if(pt[Ar.focused]=!pt.hidden&&!!ne?.isEqualTo(nn),pt[Ua.selected]=G?.(Kt)||pt.selected,u7(V)){const{from:vr,to:In}=V;pt[Ua.range_start]=!!(vr&&In&&i.isSameDay(Kt,vr)),pt[Ua.range_end]=!!(vr&&In&&i.isSameDay(Kt,In)),pt[Ua.range_middle]=Dl(V,Kt,!0,i)}const xr=n_e(pt,E,e.modifiersStyles),Ur=HEe(pt,l,e.modifiersClassNames),Wr=!It&&!pt.hidden?Te(Kt,pt,i.options,i):void 0;return ae.createElement(n.Day,{key:`${i.format(Kt,"yyyy-MM-dd")}_${i.format(nn.displayMonth,"yyyy-MM")}`,day:nn,modifiers:pt,className:Ur.join(" "),style:xr,role:"gridcell","aria-selected":pt.selected||void 0,"aria-label":Wr,"data-day":i.format(Kt,"yyyy-MM-dd"),"data-month":nn.outside?i.format(Kt,"yyyy-MM"):void 0,"data-selected":pt.selected||void 0,"data-disabled":pt.disabled||void 0,"data-hidden":pt.hidden||void 0,"data-outside":nn.outside||void 0,"data-focused":pt.focused||void 0,"data-today":pt.today||void 0},!pt.hidden&&It?ae.createElement(n.DayButton,{className:l[jt.DayButton],style:E?.[jt.DayButton],type:"button",day:nn,modifiers:pt,disabled:pt.disabled||void 0,tabIndex:W(nn)?0:-1,"aria-label":oe(Kt,pt,i.options,i),onClick:mt(nn,pt),onBlur:Ie(nn,pt),onFocus:Ne(nn,pt),onKeyDown:st(nn,pt),onMouseEnter:yt(nn,pt),onMouseLeave:Pt(nn,pt)},A(Kt,i.options,i)):!pt.hidden&&A(nn.date,i.options,i))})))))))),e.footer&&ae.createElement(n.Footer,{className:l[jt.Footer],style:E?.[jt.Footer],role:"status","aria-live":"polite"},e.footer)))}function _z({className:t,classNames:e,showOutsideDays:n=!0,captionLayout:r="label",buttonVariant:s="ghost",formatters:i,components:a,...l}){const c=d7();return o.jsx(F_e,{showOutsideDays:n,className:xe("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:d=>d.toLocaleString("default",{month:"short"}),...i},classNames:{root:xe("w-fit",c.root),months:xe("relative flex flex-col gap-4 md:flex-row",c.months),month:xe("flex w-full flex-col gap-4",c.month),nav:xe("absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1",c.nav),button_previous:xe(I0({variant:s}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",c.button_previous),button_next:xe(I0({variant:s}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",c.button_next),month_caption:xe("flex h-[--cell-size] w-full items-center justify-center px-[--cell-size]",c.month_caption),dropdowns:xe("flex h-[--cell-size] w-full items-center justify-center gap-1.5 text-sm font-medium",c.dropdowns),dropdown_root:xe("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:xe("bg-popover absolute inset-0 opacity-0",c.dropdown),caption_label:xe("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:xe("flex",c.weekdays),weekday:xe("text-muted-foreground flex-1 select-none rounded-md text-[0.8rem] font-normal",c.weekday),week:xe("mt-2 flex w-full",c.week),week_number_header:xe("w-[--cell-size] select-none",c.week_number_header),week_number:xe("text-muted-foreground select-none text-[0.8rem]",c.week_number),day:xe("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:xe("bg-accent rounded-l-md",c.range_start),range_middle:xe("rounded-none",c.range_middle),range_end:xe("bg-accent rounded-r-md",c.range_end),today:xe("bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",c.today),outside:xe("text-muted-foreground aria-selected:text-muted-foreground",c.outside),disabled:xe("text-muted-foreground opacity-50",c.disabled),hidden:xe("invisible",c.hidden),...e},components:{Root:({className:d,rootRef:h,...m})=>o.jsx("div",{"data-slot":"calendar",ref:h,className:xe(d),...m}),Chevron:({className:d,orientation:h,...m})=>h==="left"?o.jsx(vd,{className:xe("size-4",d),...m}):h==="right"?o.jsx(yd,{className:xe("size-4",d),...m}):o.jsx(nd,{className:xe("size-4",d),...m}),DayButton:q_e,WeekNumber:({children:d,...h})=>o.jsx("td",{...h,children:o.jsx("div",{className:"flex size-[--cell-size] items-center justify-center text-center",children:d})}),...a},...l})}function q_e({className:t,day:e,modifiers:n,...r}){const s=d7(),i=b.useRef(null);return b.useEffect(()=>{n.focused&&i.current?.focus()},[n.focused]),o.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:xe("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 $_e{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 Oh=new $_e;typeof window<"u"&&Oh.connect();const H_e={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}} 年"}},Q_e=(t,e,n)=>{let r;const s=H_e[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},V_e={full:"y'年'M'月'd'日' EEEE",long:"y'年'M'月'd'日'",medium:"yyyy-MM-dd",short:"yy-MM-dd"},U_e={full:"zzzz a h:mm:ss",long:"z a h:mm:ss",medium:"a h:mm:ss",short:"a h:mm"},W_e={full:"{{date}} {{time}}",long:"{{date}} {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},G_e={date:Vh({formats:V_e,defaultWidth:"full"}),time:Vh({formats:U_e,defaultWidth:"full"}),dateTime:Vh({formats:W_e,defaultWidth:"full"})};function Az(t,e,n){const r="eeee p";return iEe(t,e,n)?r:t.getTime()>e.getTime()?"'下个'"+r:"'上个'"+r}const X_e={lastWeek:Az,yesterday:"'昨天' p",today:"'今天' p",tomorrow:"'明天' p",nextWeek:Az,other:"PP p"},Y_e=(t,e,n,r)=>{const s=X_e[t];return typeof s=="function"?s(e,n,r):s},K_e={narrow:["前","公元"],abbreviated:["前","公元"],wide:["公元前","公元"]},Z_e={narrow:["1","2","3","4"],abbreviated:["第一季","第二季","第三季","第四季"],wide:["第一季度","第二季度","第三季度","第四季度"]},J_e={narrow:["一","二","三","四","五","六","七","八","九","十","十一","十二"],abbreviated:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],wide:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]},eAe={narrow:["日","一","二","三","四","五","六"],short:["日","一","二","三","四","五","六"],abbreviated:["周日","周一","周二","周三","周四","周五","周六"],wide:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"]},tAe={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:"夜间"}},nAe={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:"夜间"}},rAe=(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()}},sAe={ordinalNumber:rAe,era:ko({values:K_e,defaultWidth:"wide"}),quarter:ko({values:Z_e,defaultWidth:"wide",argumentCallback:t=>t-1}),month:ko({values:J_e,defaultWidth:"wide"}),day:ko({values:eAe,defaultWidth:"wide"}),dayPeriod:ko({values:tAe,defaultWidth:"wide",formattingValues:nAe,defaultFormattingWidth:"wide"})},iAe=/^(第\s*)?\d+(日|时|分|秒)?/i,aAe=/\d+/i,oAe={narrow:/^(前)/i,abbreviated:/^(前)/i,wide:/^(公元前|公元)/i},lAe={any:[/^(前)/i,/^(公元)/i]},cAe={narrow:/^[1234]/i,abbreviated:/^第[一二三四]刻/i,wide:/^第[一二三四]刻钟/i},uAe={any:[/(1|一)/i,/(2|二)/i,/(3|三)/i,/(4|四)/i]},dAe={narrow:/^(一|二|三|四|五|六|七|八|九|十[二一])/i,abbreviated:/^(一|二|三|四|五|六|七|八|九|十[二一]|\d|1[12])月/i,wide:/^(一|二|三|四|五|六|七|八|九|十[二一])月/i},hAe={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]},fAe={narrow:/^[一二三四五六日]/i,short:/^[一二三四五六日]/i,abbreviated:/^周[一二三四五六日]/i,wide:/^星期[一二三四五六日]/i},mAe={any:[/日/i,/一/i,/二/i,/三/i,/四/i,/五/i,/六/i]},pAe={any:/^(上午?|下午?|午夜|[中正]午|早上?|下午|晚上?|凌晨|)/i},gAe={any:{am:/^上午?/i,pm:/^下午?/i,midnight:/^午夜/i,noon:/^[中正]午/i,morning:/^早上/i,afternoon:/^下午/i,evening:/^晚上?/i,night:/^凌晨/i}},xAe={ordinalNumber:WG({matchPattern:iAe,parsePattern:aAe,valueCallback:t=>parseInt(t,10)}),era:Oo({matchPatterns:oAe,defaultMatchWidth:"wide",parsePatterns:lAe,defaultParseWidth:"any"}),quarter:Oo({matchPatterns:cAe,defaultMatchWidth:"wide",parsePatterns:uAe,defaultParseWidth:"any",valueCallback:t=>t+1}),month:Oo({matchPatterns:dAe,defaultMatchWidth:"wide",parsePatterns:hAe,defaultParseWidth:"any"}),day:Oo({matchPatterns:fAe,defaultMatchWidth:"wide",parsePatterns:mAe,defaultParseWidth:"any"}),dayPeriod:Oo({matchPatterns:pAe,defaultMatchWidth:"any",parsePatterns:gAe,defaultParseWidth:"any"})},U1={code:"zh-CN",formatDistance:Q_e,formatLong:G_e,formatRelative:Y_e,localize:sAe,match:xAe,options:{weekStartsOn:1,firstWeekContainsDate:4}},W1={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 vAe(){const[t,e]=b.useState([]),[n,r]=b.useState(""),[s,i]=b.useState("all"),[a,l]=b.useState("all"),[c,d]=b.useState(void 0),[h,m]=b.useState(void 0),[g,x]=b.useState(!0),[y,w]=b.useState(!1),[S,k]=b.useState("xs"),[j,N]=b.useState(4),T=b.useRef(null);b.useEffect(()=>{const F=Oh.getAllLogs();e(F);const Y=Oh.onLog(()=>{e(Oh.getAllLogs())}),J=Oh.onConnectionChange(X=>{w(X)});return()=>{Y(),J()}},[]);const E=b.useMemo(()=>{const F=new Set(t.map(Y=>Y.module));return Array.from(F).sort()},[t]),_=F=>{switch(F){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"}},A=F=>{switch(F){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=()=>{Oh.clearLogs(),e([])},B=()=>{const F=te.map(R=>`${R.timestamp} [${R.level.padEnd(8)}] [${R.module}] ${R.message}`).join(`
`),Y=new Blob([F],{type:"text/plain;charset=utf-8"}),J=URL.createObjectURL(Y),X=document.createElement("a");X.href=J,X.download=`logs-${Ev(new Date,"yyyy-MM-dd-HHmmss")}.txt`,X.click(),URL.revokeObjectURL(J)},$=()=>{x(!g)},U=()=>{d(void 0),m(void 0)},te=b.useMemo(()=>t.filter(F=>{const Y=n===""||F.message.toLowerCase().includes(n.toLowerCase())||F.module.toLowerCase().includes(n.toLowerCase()),J=s==="all"||F.level===s,X=a==="all"||F.module===a;let R=!0;if(c||h){const ie=new Date(F.timestamp);if(c){const G=new Date(c);G.setHours(0,0,0,0),R=R&&ie>=G}if(h){const G=new Date(h);G.setHours(23,59,59,999),R=R&&ie<=G}}return Y&&J&&X&&R}),[t,n,s,a,c,h]),z=W1[S].rowHeight+j,Q=BTe({count:te.length,getScrollElement:()=>T.current,estimateSize:()=>z,overscan:15});return b.useEffect(()=>{g&&te.length>0&&Q.scrollToIndex(te.length-1,{align:"end",behavior:"auto"})},[te.length,g,Q]),o.jsxs("div",{className:"h-full flex flex-col overflow-hidden",children:[o.jsxs("div",{className:"flex-shrink-0 space-y-4 p-3 sm:p-4 lg:p-6",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-xl sm:text-2xl lg:text-3xl font-bold",children:"日志查看器"}),o.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mt-1",children:"实时查看和分析麦麦运行日志"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("div",{className:xe("h-2.5 w-2.5 sm:h-3 sm:w-3 rounded-full",y?"bg-green-500 animate-pulse":"bg-red-500")}),o.jsx("span",{className:"text-xs sm:text-sm text-muted-foreground",children:y?"已连接":"未连接"})]})]}),o.jsx(qt,{className:"p-3 sm:p-4",children:o.jsxs("div",{className:"flex flex-col gap-3 sm:gap-4",children:[o.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:gap-4",children:[o.jsxs("div",{className:"flex-1 relative",children:[o.jsx(Ni,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),o.jsx(ze,{placeholder:"搜索日志...",value:n,onChange:F=>r(F.target.value),className:"pl-9 h-9 text-sm"})]}),o.jsxs(Vt,{value:s,onValueChange:i,children:[o.jsxs($t,{className:"w-full sm:w-[140px] lg:w-[180px] h-9 text-sm",children:[o.jsx(sk,{className:"h-4 w-4 mr-2"}),o.jsx(Ut,{placeholder:"级别"})]}),o.jsxs(Ht,{children:[o.jsx(De,{value:"all",children:"全部级别"}),o.jsx(De,{value:"DEBUG",children:"DEBUG"}),o.jsx(De,{value:"INFO",children:"INFO"}),o.jsx(De,{value:"WARNING",children:"WARNING"}),o.jsx(De,{value:"ERROR",children:"ERROR"}),o.jsx(De,{value:"CRITICAL",children:"CRITICAL"})]})]}),o.jsxs(Vt,{value:a,onValueChange:l,children:[o.jsxs($t,{className:"w-full sm:w-[160px] lg:w-[200px] h-9 text-sm",children:[o.jsx(sk,{className:"h-4 w-4 mr-2"}),o.jsx(Ut,{placeholder:"模块"})]}),o.jsxs(Ht,{children:[o.jsx(De,{value:"all",children:"全部模块"}),E.map(F=>o.jsx(De,{value:F,children:F},F))]})]})]}),o.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:gap-4",children:[o.jsxs(zo,{children:[o.jsx(Io,{asChild:!0,children:o.jsxs(de,{variant:"outline",size:"sm",className:xe("w-full sm:w-[200px] lg:w-[240px] justify-start text-left font-normal h-9",!c&&"text-muted-foreground"),children:[o.jsx(w9,{className:"mr-2 h-4 w-4"}),o.jsx("span",{className:"text-xs sm:text-sm",children:c?Ev(c,"PPP",{locale:U1}):"开始日期"})]})}),o.jsx(Xa,{className:"w-auto p-0",align:"start",children:o.jsx(_z,{mode:"single",selected:c,onSelect:d,initialFocus:!0,locale:U1})})]}),o.jsxs(zo,{children:[o.jsx(Io,{asChild:!0,children:o.jsxs(de,{variant:"outline",size:"sm",className:xe("w-full sm:w-[200px] lg:w-[240px] justify-start text-left font-normal h-9",!h&&"text-muted-foreground"),children:[o.jsx(w9,{className:"mr-2 h-4 w-4"}),o.jsx("span",{className:"text-xs sm:text-sm",children:h?Ev(h,"PPP",{locale:U1}):"结束日期"})]})}),o.jsx(Xa,{className:"w-auto p-0",align:"start",children:o.jsx(_z,{mode:"single",selected:h,onSelect:m,initialFocus:!0,locale:U1})})]}),(c||h)&&o.jsxs(de,{variant:"outline",size:"sm",onClick:U,className:"w-full sm:w-auto h-9",children:[o.jsx(_p,{className:"h-4 w-4 sm:mr-2"}),o.jsx("span",{className:"hidden sm:inline text-sm",children:"清除时间筛选"}),o.jsx("span",{className:"sm:hidden text-sm",children:"清除"})]})]}),o.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:flex-wrap sm:items-center",children:[o.jsxs("div",{className:"flex gap-2 flex-wrap",children:[o.jsxs(de,{variant:g?"default":"outline",size:"sm",onClick:$,className:"flex-1 sm:flex-none h-9",children:[g?o.jsx(tte,{className:"h-4 w-4"}):o.jsx(nte,{className:"h-4 w-4"}),o.jsx("span",{className:"ml-2 text-sm",children:g?"自动滚动":"已暂停"})]}),o.jsxs(de,{variant:"outline",size:"sm",onClick:L,className:"flex-1 sm:flex-none h-9",children:[o.jsx(Ps,{className:"h-4 w-4"}),o.jsx("span",{className:"ml-2 text-sm",children:"刷新"})]}),o.jsxs(de,{variant:"outline",size:"sm",onClick:P,className:"flex-1 sm:flex-none h-9",children:[o.jsx(Sn,{className:"h-4 w-4"}),o.jsx("span",{className:"ml-2 text-sm",children:"清空"})]}),o.jsxs(de,{variant:"outline",size:"sm",onClick:B,className:"flex-1 sm:flex-none h-9",children:[o.jsx(Ku,{className:"h-4 w-4"}),o.jsx("span",{className:"ml-2 text-sm",children:"导出"})]})]}),o.jsx("div",{className:"flex-1 hidden sm:block"}),o.jsxs("div",{className:"text-xs sm:text-sm text-muted-foreground flex items-center justify-center sm:justify-end",children:[o.jsxs("span",{className:"font-mono",children:[te.length," / ",t.length]}),o.jsx("span",{className:"ml-1",children:"条日志"})]})]}),o.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:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[o.jsx(rte,{className:"h-4 w-4"}),o.jsx("span",{children:"字号"})]}),o.jsx("div",{className:"flex gap-1",children:Object.keys(W1).map(F=>o.jsx(de,{variant:S===F?"default":"outline",size:"sm",onClick:()=>k(F),className:"h-7 px-3 text-xs",children:W1[F].label},F))})]}),o.jsxs("div",{className:"flex items-center gap-3 flex-1 max-w-xs",children:[o.jsx("span",{className:"text-sm text-muted-foreground whitespace-nowrap",children:"行距"}),o.jsx(Bp,{value:[j],onValueChange:([F])=>N(F),min:0,max:12,step:2,className:"flex-1"}),o.jsxs("span",{className:"text-xs text-muted-foreground w-8",children:[j,"px"]})]})]})]})})]}),o.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:o.jsx(qt,{className:"bg-black dark:bg-gray-950 border-gray-800 dark:border-gray-900 h-full",children:o.jsx(gn,{viewportRef:T,className:"h-full",children:o.jsx("div",{className:xe("p-2 sm:p-3 font-mono relative",W1[S].class),style:{height:`${Q.getTotalSize()}px`},children:te.length===0?o.jsx("div",{className:"text-gray-500 dark:text-gray-600 text-center py-8 text-sm",children:"暂无日志数据"}):Q.getVirtualItems().map(F=>{const Y=te[F.index];return o.jsxs("div",{"data-index":F.index,ref:Q.measureElement,className:xe("absolute top-0 left-0 w-full px-2 sm:px-3 rounded hover:bg-white/5 transition-colors group",A(Y.level)),style:{transform:`translateY(${F.start}px)`,paddingTop:`${j/2}px`,paddingBottom:`${j/2}px`},children:[o.jsxs("div",{className:"flex flex-col gap-0.5 sm:hidden",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-gray-500 dark:text-gray-600",children:Y.timestamp}),o.jsxs("span",{className:xe("font-semibold",_(Y.level)),children:["[",Y.level,"]"]})]}),o.jsx("div",{className:"text-cyan-400 dark:text-cyan-500 truncate",children:Y.module}),o.jsx("div",{className:"text-gray-300 dark:text-gray-400 whitespace-pre-wrap break-words",children:Y.message})]}),o.jsxs("div",{className:"hidden sm:flex gap-2 items-start",children:[o.jsx("span",{className:"text-gray-500 dark:text-gray-600 flex-shrink-0 w-[130px] lg:w-[160px]",children:Y.timestamp}),o.jsxs("span",{className:xe("flex-shrink-0 w-[65px] lg:w-[75px] font-semibold",_(Y.level)),children:["[",Y.level,"]"]}),o.jsx("span",{className:"text-cyan-400 dark:text-cyan-500 flex-shrink-0 w-[100px] lg:w-[130px] truncate",children:Y.module}),o.jsx("span",{className:"text-gray-300 dark:text-gray-400 flex-1 whitespace-pre-wrap break-words",children:Y.message})]})]},F.key)})})})})})]})}const yAe="Mai-with-u",bAe="plugin-repo",wAe="main",SAe="plugin_details.json";async function kAe(){try{const t=await St("/api/webui/plugins/fetch-raw",{method:"POST",headers:Dt(),body:JSON.stringify({owner:yAe,repo:bAe,branch:wAe,file_path:SAe})});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 OAe(){try{const t=await St("/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 jAe(){try{const t=await St("/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 NAe(t,e,n){const r=t.split(".").map(l=>parseInt(l)||0),s=r[0]||0,i=r[1]||0,a=r[2]||0;if(n.version_major<s||n.version_major===s&&n.version_minor<i||n.version_major===s&&n.version_minor===i&&n.version_patch<a)return!1;if(e){const l=e.split(".").map(m=>parseInt(m)||0),c=l[0]||0,d=l[1]||0,h=l[2]||0;if(n.version_major>c||n.version_major===c&&n.version_minor>d||n.version_major===c&&n.version_minor===d&&n.version_patch>h)return!1}return!0}function CAe(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 G1(){try{const t=await St("/api/webui/plugins/installed",{headers:Dt()});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 X1(t,e){return e.some(n=>n.id===t)}function Y1(t,e){const n=e.find(r=>r.id===t);if(n)return n.manifest?.version||n.version}async function TAe(t,e,n="main"){const r=await St("/api/webui/plugins/install",{method:"POST",headers:Dt(),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 EAe(t){const e=await St("/api/webui/plugins/uninstall",{method:"POST",headers:Dt(),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 _Ae(t,e,n="main"){const r=await St("/api/webui/plugins/update",{method:"POST",headers:Dt(),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 Sg="https://maibot-plugin-stats.maibot-webui.workers.dev";async function dX(t){try{const e=await fetch(`${Sg}/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 AAe(t,e){try{const n=e||h7(),r=await fetch(`${Sg}/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 MAe(t,e){try{const n=e||h7(),r=await fetch(`${Sg}/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 RAe(t,e,n,r){if(e<1||e>5)return{success:!1,error:"评分必须在 1-5 之间"};try{const s=r||h7(),i=await fetch(`${Sg}/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 DAe(t){try{const e=await fetch(`${Sg}/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 PAe(){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<e.length;r++){const s=e.charCodeAt(r);n=(n<<5)-n+s,n=n&n}return`fp_${Math.abs(n).toString(36)}`}function h7(){const t="maibot_user_id";let e=localStorage.getItem(t);if(!e){const n=PAe(),r=Date.now().toString(36),s=Math.random().toString(36).substring(2,15);e=`${n}_${r}_${s}`,localStorage.setItem(t,e)}return e}function zAe({pluginId:t,compact:e=!1}){const[n,r]=b.useState(null),[s,i]=b.useState(!0),[a,l]=b.useState(0),[c,d]=b.useState(""),[h,m]=b.useState(!1),{toast:g}=as(),x=async()=>{i(!0);const k=await dX(t);k&&r(k),i(!1)};b.useEffect(()=>{x()},[t]);const y=async()=>{const k=await AAe(t);k.success?(g({title:"已点赞",description:"感谢你的支持!"}),x()):g({title:"点赞失败",description:k.error||"未知错误",variant:"destructive"})},w=async()=>{const k=await MAe(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 RAe(t,a,c||void 0);k.success?(g({title:"评分成功",description:"感谢你的评价!"}),m(!1),l(0),d(""),x()):g({title:"评分失败",description:k.error||"未知错误",variant:"destructive"})};return s?o.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx(Ku,{className:"h-4 w-4"}),o.jsx("span",{children:"-"})]}),o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx(Ac,{className:"h-4 w-4"}),o.jsx("span",{children:"-"})]})]}):n?e?o.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[o.jsxs("div",{className:"flex items-center gap-1",title:`下载量: ${n.downloads.toLocaleString()}`,children:[o.jsx(Ku,{className:"h-4 w-4"}),o.jsx("span",{children:n.downloads.toLocaleString()})]}),o.jsxs("div",{className:"flex items-center gap-1",title:`评分: ${n.rating.toFixed(1)} (${n.rating_count} 条评价)`,children:[o.jsx(Ac,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),o.jsx("span",{children:n.rating.toFixed(1)})]}),o.jsxs("div",{className:"flex items-center gap-1",title:`点赞数: ${n.likes}`,children:[o.jsx(y4,{className:"h-4 w-4"}),o.jsx("span",{children:n.likes})]})]}):o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4",children:[o.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[o.jsx(Ku,{className:"h-5 w-5 text-muted-foreground mb-1"}),o.jsx("span",{className:"text-2xl font-bold",children:n.downloads.toLocaleString()}),o.jsx("span",{className:"text-xs text-muted-foreground",children:"下载量"})]}),o.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[o.jsx(Ac,{className:"h-5 w-5 text-yellow-400 mb-1 fill-yellow-400"}),o.jsx("span",{className:"text-2xl font-bold",children:n.rating.toFixed(1)}),o.jsxs("span",{className:"text-xs text-muted-foreground",children:[n.rating_count," 条评价"]})]}),o.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[o.jsx(y4,{className:"h-5 w-5 text-green-500 mb-1"}),o.jsx("span",{className:"text-2xl font-bold",children:n.likes}),o.jsx("span",{className:"text-xs text-muted-foreground",children:"点赞"})]}),o.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[o.jsx(S9,{className:"h-5 w-5 text-red-500 mb-1"}),o.jsx("span",{className:"text-2xl font-bold",children:n.dislikes}),o.jsx("span",{className:"text-xs text-muted-foreground",children:"点踩"})]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs(de,{variant:"outline",size:"sm",onClick:y,children:[o.jsx(y4,{className:"h-4 w-4 mr-1"}),"点赞"]}),o.jsxs(de,{variant:"outline",size:"sm",onClick:w,children:[o.jsx(S9,{className:"h-4 w-4 mr-1"}),"点踩"]}),o.jsxs(Dr,{open:h,onOpenChange:m,children:[o.jsx(Of,{asChild:!0,children:o.jsxs(de,{variant:"default",size:"sm",children:[o.jsx(Ac,{className:"h-4 w-4 mr-1"}),"评分"]})}),o.jsxs(Sr,{children:[o.jsxs(kr,{children:[o.jsx(Or,{children:"为插件评分"}),o.jsx(ss,{children:"分享你的使用体验,帮助其他用户"})]}),o.jsxs("div",{className:"space-y-4 py-4",children:[o.jsxs("div",{className:"flex flex-col items-center gap-2",children:[o.jsx("div",{className:"flex gap-2",children:[1,2,3,4,5].map(k=>o.jsx("button",{onClick:()=>l(k),className:"focus:outline-none",children:o.jsx(Ac,{className:`h-8 w-8 transition-colors ${k<=a?"fill-yellow-400 text-yellow-400":"text-muted-foreground hover:text-yellow-300"}`})},k))}),o.jsxs("span",{className:"text-sm text-muted-foreground",children:[a===0&&"点击星星进行评分",a===1&&"很差",a===2&&"一般",a===3&&"还行",a===4&&"不错",a===5&&"非常好"]})]}),o.jsxs("div",{children:[o.jsx("label",{className:"text-sm font-medium mb-2 block",children:"评论(可选)"}),o.jsx(Mr,{value:c,onChange:k=>d(k.target.value),placeholder:"分享你的使用体验...",rows:4,maxLength:500}),o.jsxs("div",{className:"text-xs text-muted-foreground mt-1 text-right",children:[c.length," / 500"]})]})]}),o.jsxs(ws,{children:[o.jsx(de,{variant:"outline",onClick:()=>m(!1),children:"取消"}),o.jsx(de,{onClick:S,disabled:a===0,children:"提交评分"})]})]})]})]}),n.recent_ratings&&n.recent_ratings.length>0&&o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"text-sm font-semibold",children:"最近评价"}),o.jsx("div",{className:"space-y-3",children:n.recent_ratings.map((k,j)=>o.jsxs("div",{className:"p-3 rounded-lg border bg-muted/50",children:[o.jsxs("div",{className:"flex items-center justify-between mb-2",children:[o.jsx("div",{className:"flex gap-1",children:[1,2,3,4,5].map(N=>o.jsx(Ac,{className:`h-3 w-3 ${N<=k.rating?"fill-yellow-400 text-yellow-400":"text-muted-foreground"}`},N))}),o.jsx("span",{className:"text-xs text-muted-foreground",children:new Date(k.created_at).toLocaleDateString()})]}),k.comment&&o.jsx("p",{className:"text-sm text-muted-foreground",children:k.comment})]},j))})]})]}):null}const Mz={"Group Management":"群组管理","Entertainment & Interaction":"娱乐互动","Utility Tools":"实用工具","Content Generation":"内容生成",Multimedia:"多媒体","External Integration":"外部集成","Data Analysis & Insights":"数据分析与洞察",Other:"其他"};function IAe(){const t=Zi(),[e,n]=b.useState(null),[r,s]=b.useState(""),[i,a]=b.useState("all"),[l,c]=b.useState("all"),[d,h]=b.useState(!0),[m,g]=b.useState([]),[x,y]=b.useState(!0),[w,S]=b.useState(null),[k,j]=b.useState(null),[N,T]=b.useState(null),[E,_]=b.useState(null),[,A]=b.useState([]),[L,P]=b.useState({}),{toast:B}=as(),$=async R=>{const ie=R.map(async V=>{try{const ee=await dX(V.id);return{id:V.id,stats:ee}}catch(ee){return console.warn(`Failed to load stats for ${V.id}:`,ee),{id:V.id,stats:null}}}),G=await Promise.all(ie),I={};G.forEach(({id:V,stats:ee})=>{ee&&(I[V]=ee)}),P(I)};b.useEffect(()=>{let R=null,ie=!1;return(async()=>{if(R=CAe(I=>{ie||(T(I),I.stage==="success"?setTimeout(()=>{ie||T(null)},2e3):I.stage==="error"&&(y(!1),S(I.error||"加载失败")))},I=>{console.error("WebSocket error:",I),ie||B({title:"WebSocket 连接失败",description:"无法实时显示加载进度",variant:"destructive"})}),await new Promise(I=>{if(!R){I();return}const V=()=>{R&&R.readyState===WebSocket.OPEN?(console.log("WebSocket connected, starting to load plugins"),I()):R&&R.readyState===WebSocket.CLOSED?(console.warn("WebSocket closed before loading plugins"),I()):setTimeout(V,100)};V()}),!ie){const I=await OAe();j(I),I.installed||B({title:"Git 未安装",description:I.error||"请先安装 Git 才能使用插件安装功能",variant:"destructive"})}if(!ie){const I=await jAe();_(I)}if(!ie)try{y(!0),S(null);const I=await kAe();if(!ie){const V=await G1();A(V);const ee=I.map(ne=>{const W=X1(ne.id,V),se=Y1(ne.id,V);return{...ne,installed:W,installed_version:se}});for(const ne of V)!ee.some(se=>se.id===ne.id)&&ne.manifest&&ee.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(ee),$(ee)}}catch(I){if(!ie){const V=I instanceof Error?I.message:"加载插件列表失败";S(V),B({title:"加载失败",description:V,variant:"destructive"})}}finally{ie||y(!1)}})(),()=>{ie=!0,R&&R.close()}},[B]);const U=R=>{if(!R.installed&&E&&!te(R))return o.jsxs(Xn,{variant:"destructive",className:"gap-1",children:[o.jsx(Uc,{className:"h-3 w-3"}),"不兼容"]});if(R.installed){const ie=R.installed_version?.trim(),G=R.manifest.version?.trim();if(ie!==G){const I=ie?.split(".").map(Number)||[0,0,0],V=G?.split(".").map(Number)||[0,0,0];for(let ee=0;ee<3;ee++){if((V[ee]||0)>(I[ee]||0))return o.jsxs(Xn,{variant:"outline",className:"gap-1 text-orange-600 border-orange-600",children:[o.jsx(Uc,{className:"h-3 w-3"}),"可更新"]});if((V[ee]||0)<(I[ee]||0))break}}return o.jsxs(Xn,{variant:"default",className:"gap-1",children:[o.jsx(Vc,{className:"h-3 w-3"}),"已安装"]})}return null},te=R=>!E||!R.manifest?.host_application?!0:NAe(R.manifest.host_application.min_version,R.manifest.host_application.max_version,E),z=R=>{if(!R.installed||!R.installed_version||!R.manifest?.version)return!1;const ie=R.installed_version.trim(),G=R.manifest.version.trim();if(ie===G)return!1;const I=ie.split(".").map(Number),V=G.split(".").map(Number);for(let ee=0;ee<3;ee++){if((V[ee]||0)>(I[ee]||0))return!0;if((V[ee]||0)<(I[ee]||0))return!1}return!1},Q=m.filter(R=>{if(!R.manifest)return console.warn("[过滤] 跳过无 manifest 的插件:",R.id),!1;const ie=r===""||R.manifest.name?.toLowerCase().includes(r.toLowerCase())||R.manifest.description?.toLowerCase().includes(r.toLowerCase())||R.manifest.keywords&&R.manifest.keywords.some(ee=>ee.toLowerCase().includes(r.toLowerCase())),G=i==="all"||R.manifest.categories&&R.manifest.categories.includes(i);let I=!0;l==="installed"?I=R.installed===!0:l==="updates"&&(I=R.installed===!0&&z(R));const V=!d||!E||te(R);return ie&&G&&I&&V}),F=()=>{n(null)},Y=async R=>{if(!k?.installed){B({title:"无法安装",description:"Git 未安装",variant:"destructive"});return}if(E&&!te(R)){B({title:"无法安装",description:"插件与当前麦麦版本不兼容",variant:"destructive"});return}try{await TAe(R.id,R.manifest.repository_url||"","main"),DAe(R.id).catch(G=>{console.warn("Failed to record download:",G)}),B({title:"安装成功",description:`${R.manifest.name} 已成功安装`});const ie=await G1();A(ie),g(G=>G.map(I=>{if(I.id===R.id){const V=X1(I.id,ie),ee=Y1(I.id,ie);return{...I,installed:V,installed_version:ee}}return I}))}catch(ie){B({title:"安装失败",description:ie instanceof Error?ie.message:"未知错误",variant:"destructive"})}},J=async R=>{try{await EAe(R.id),B({title:"卸载成功",description:`${R.manifest.name} 已成功卸载`});const ie=await G1();A(ie),g(G=>G.map(I=>{if(I.id===R.id){const V=X1(I.id,ie),ee=Y1(I.id,ie);return{...I,installed:V,installed_version:ee}}return I}))}catch(ie){B({title:"卸载失败",description:ie instanceof Error?ie.message:"未知错误",variant:"destructive"})}},X=async R=>{if(!k?.installed){B({title:"无法更新",description:"Git 未安装",variant:"destructive"});return}try{const ie=await _Ae(R.id,R.manifest.repository_url||"","main");B({title:"更新成功",description:`${R.manifest.name} 已从 ${ie.old_version} 更新到 ${ie.new_version}`});const G=await G1();A(G),g(I=>I.map(V=>{if(V.id===R.id){const ee=X1(V.id,G),ne=Y1(V.id,G);return{...V,installed:ee,installed_version:ne}}return V}))}catch(ie){B({title:"更新失败",description:ie instanceof Error?ie.message:"未知错误",variant:"destructive"})}};return o.jsx(gn,{className:"h-full",children:o.jsxs("div",{className:"space-y-6 p-4 sm:p-6",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"插件市场"}),o.jsx("p",{className:"text-muted-foreground mt-2",children:"浏览和管理麦麦的插件"})]}),o.jsxs(de,{onClick:()=>t({to:"/plugin-mirrors"}),children:[o.jsx(ste,{className:"h-4 w-4 mr-2"}),"配置镜像源"]})]}),k&&!k.installed&&o.jsxs(qt,{className:"border-orange-600 bg-orange-50 dark:bg-orange-950/20",children:[o.jsx(Fn,{children:o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx(Wa,{className:"h-5 w-5 text-orange-600"}),o.jsxs("div",{children:[o.jsx(qn,{className:"text-lg text-orange-900 dark:text-orange-100",children:"Git 未安装"}),o.jsx(ts,{className:"text-orange-800 dark:text-orange-200",children:k.error||"请先安装 Git 才能使用插件安装功能"})]})]})}),o.jsx(Gn,{children:o.jsxs("p",{className:"text-sm text-orange-800 dark:text-orange-200",children:["您可以从 ",o.jsx("a",{href:"https://git-scm.com/downloads",target:"_blank",rel:"noopener noreferrer",className:"underline font-medium",children:"git-scm.com"})," 下载并安装 Git。 安装完成后,请重启麦麦应用。"]})})]}),o.jsx(qt,{className:"p-4",children:o.jsxs("div",{className:"flex flex-col gap-4",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[o.jsxs("div",{className:"flex-1 relative",children:[o.jsx(Ni,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),o.jsx(ze,{placeholder:"搜索插件...",value:r,onChange:R=>s(R.target.value),className:"pl-9"})]}),o.jsxs(Vt,{value:i,onValueChange:a,children:[o.jsx($t,{className:"w-full sm:w-[200px]",children:o.jsx(Ut,{placeholder:"选择分类"})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"all",children:"全部分类"}),o.jsx(De,{value:"Group Management",children:"群组管理"}),o.jsx(De,{value:"Entertainment & Interaction",children:"娱乐互动"}),o.jsx(De,{value:"Utility Tools",children:"实用工具"}),o.jsx(De,{value:"Content Generation",children:"内容生成"}),o.jsx(De,{value:"Multimedia",children:"多媒体"}),o.jsx(De,{value:"External Integration",children:"外部集成"}),o.jsx(De,{value:"Data Analysis & Insights",children:"数据分析与洞察"}),o.jsx(De,{value:"Other",children:"其他"})]})]})]}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Oi,{id:"compatible-only",checked:d,onCheckedChange:R=>h(R===!0)}),o.jsx("label",{htmlFor:"compatible-only",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer",children:"只显示兼容当前版本的插件"})]})]})}),o.jsx(ja,{value:l,onValueChange:c,className:"w-full",children:o.jsxs(Wi,{className:"grid w-full grid-cols-3",children:[o.jsxs(Lt,{value:"all",children:["全部插件 (",m.filter(R=>{if(!R.manifest)return!1;const ie=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())),G=i==="all"||R.manifest.categories&&R.manifest.categories.includes(i),I=!d||!E||te(R);return ie&&G&&I}).length,")"]}),o.jsxs(Lt,{value:"installed",children:["已安装 (",m.filter(R=>{if(!R.manifest)return!1;const ie=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())),G=i==="all"||R.manifest.categories&&R.manifest.categories.includes(i),I=!d||!E||te(R);return R.installed&&ie&&G&&I}).length,")"]}),o.jsxs(Lt,{value:"updates",children:["可更新 (",m.filter(R=>{if(!R.manifest)return!1;const ie=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())),G=i==="all"||R.manifest.categories&&R.manifest.categories.includes(i),I=!d||!E||te(R);return R.installed&&z(R)&&ie&&G&&I}).length,")"]})]})}),N&&N.stage==="loading"&&o.jsx(qt,{className:"p-4",children:o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Po,{className:"h-4 w-4 animate-spin"}),o.jsxs("span",{className:"text-sm font-medium",children:[N.operation==="fetch"&&"加载插件列表",N.operation==="install"&&`安装插件${N.plugin_id?`: ${N.plugin_id}`:""}`,N.operation==="uninstall"&&`卸载插件${N.plugin_id?`: ${N.plugin_id}`:""}`,N.operation==="update"&&`更新插件${N.plugin_id?`: ${N.plugin_id}`:""}`]})]}),o.jsxs("span",{className:"text-sm font-medium",children:[N.progress,"%"]})]}),o.jsx(Lp,{value:N.progress,className:"h-2"}),o.jsx("div",{className:"text-xs text-muted-foreground",children:N.message}),N.operation==="fetch"&&N.total_plugins>0&&o.jsxs("div",{className:"text-xs text-muted-foreground text-center",children:["已加载 ",N.loaded_plugins," / ",N.total_plugins," 个插件"]})]})}),N&&N.stage==="error"&&N.error&&o.jsx(qt,{className:"border-destructive bg-destructive/10",children:o.jsx(Fn,{children:o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx(Wa,{className:"h-5 w-5 text-destructive"}),o.jsxs("div",{children:[o.jsx(qn,{className:"text-lg text-destructive",children:"加载失败"}),o.jsx(ts,{className:"text-destructive/80",children:N.error})]})]})})}),x?o.jsxs("div",{className:"flex items-center justify-center py-12",children:[o.jsx(Po,{className:"h-8 w-8 animate-spin text-muted-foreground"}),o.jsx("span",{className:"ml-3 text-muted-foreground",children:"加载插件列表中..."})]}):w?o.jsx(qt,{className:"p-6",children:o.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[o.jsx(Wa,{className:"h-12 w-12 text-destructive mb-4"}),o.jsx("h3",{className:"text-lg font-semibold mb-2",children:"加载失败"}),o.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:w}),o.jsx(de,{onClick:()=>window.location.reload(),children:"重新加载"})]})}):Q.length===0?o.jsx(qt,{className:"p-6",children:o.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[o.jsx(Ni,{className:"h-12 w-12 text-muted-foreground mb-4"}),o.jsx("h3",{className:"text-lg font-semibold mb-2",children:"未找到插件"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:r||i!=="all"?"尝试调整搜索条件或筛选器":"暂无可用插件"})]})}):o.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:Q.map(R=>o.jsxs(qt,{className:"flex flex-col hover:shadow-lg transition-shadow h-full",children:[o.jsxs(Fn,{children:[o.jsxs("div",{className:"flex items-start justify-between gap-2",children:[o.jsx(qn,{className:"text-xl",children:R.manifest?.name||R.id}),o.jsxs("div",{className:"flex flex-col gap-1",children:[R.manifest?.categories&&R.manifest.categories[0]&&o.jsx(Xn,{variant:"secondary",className:"text-xs whitespace-nowrap",children:Mz[R.manifest.categories[0]]||R.manifest.categories[0]}),U(R)]})]}),o.jsx(ts,{className:"line-clamp-2",children:R.manifest?.description||"无描述"})]}),o.jsx(Gn,{className:"flex-1",children:o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx(Ku,{className:"h-4 w-4"}),o.jsx("span",{children:(L[R.id]?.downloads??R.downloads??0).toLocaleString()})]}),o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx(Ac,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),o.jsx("span",{children:(L[R.id]?.rating??R.rating??0).toFixed(1)})]})]}),o.jsxs("div",{className:"flex flex-wrap gap-2",children:[R.manifest?.keywords&&R.manifest.keywords.slice(0,3).map(ie=>o.jsx(Xn,{variant:"outline",className:"text-xs",children:ie},ie)),R.manifest?.keywords&&R.manifest.keywords.length>3&&o.jsxs(Xn,{variant:"outline",className:"text-xs",children:["+",R.manifest.keywords.length-3]})]}),o.jsxs("div",{className:"text-xs text-muted-foreground pt-2 border-t space-y-1",children:[o.jsxs("div",{children:["v",R.manifest?.version||"unknown"," · ",R.manifest?.author?.name||"Unknown"]}),R.manifest?.host_application&&o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("span",{children:"支持:"}),o.jsxs("span",{className:"font-medium",children:[R.manifest.host_application.min_version,R.manifest.host_application.max_version?` - ${R.manifest.host_application.max_version}`:" - 最新版本"]})]})]})]})}),o.jsx(lL,{className:"pt-4",children:o.jsxs("div",{className:"flex items-center justify-end gap-2 w-full",children:[o.jsx(de,{variant:"outline",size:"sm",onClick:()=>n(R),children:"查看详情"}),R.installed?z(R)?o.jsxs(de,{size:"sm",disabled:!k?.installed,title:k?.installed?void 0:"Git 未安装",onClick:()=>X(R),children:[o.jsx(Ps,{className:"h-4 w-4 mr-1"}),"更新"]}):o.jsxs(de,{variant:"destructive",size:"sm",disabled:!k?.installed,title:k?.installed?void 0:"Git 未安装",onClick:()=>J(R),children:[o.jsx(Sn,{className:"h-4 w-4 mr-1"}),"卸载"]}):o.jsxs(de,{size:"sm",disabled:!k?.installed||N?.operation==="install"||E!==null&&!te(R),title:k?.installed?E!==null&&!te(R)?`不兼容当前版本 (需要 ${R.manifest?.host_application?.min_version||"未知"}${R.manifest?.host_application?.max_version?` - ${R.manifest.host_application.max_version}`:"+"},当前 ${E?.version})`:void 0:"Git 未安装",onClick:()=>Y(R),children:[o.jsx(Ku,{className:"h-4 w-4 mr-1"}),N?.operation==="install"&&N?.plugin_id===R.id?"安装中...":"安装"]})]})})]},R.id))}),o.jsx(Dr,{open:e!==null,onOpenChange:F,children:e&&e.manifest&&o.jsxs(Sr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[o.jsx(kr,{children:o.jsxs("div",{className:"flex items-start justify-between gap-4",children:[o.jsxs("div",{className:"space-y-2 flex-1",children:[o.jsx(Or,{className:"text-2xl",children:e.manifest.name}),o.jsxs(ss,{children:["作者: ",e.manifest.author?.name||"Unknown",e.manifest.author?.url&&o.jsx("a",{href:e.manifest.author.url,target:"_blank",rel:"noopener noreferrer",className:"ml-2 text-primary hover:underline",children:o.jsx(Ah,{className:"h-3 w-3 inline"})})]})]}),o.jsxs("div",{className:"flex flex-col gap-2",children:[e.manifest.categories&&e.manifest.categories[0]&&o.jsx(Xn,{variant:"secondary",children:Mz[e.manifest.categories[0]]||e.manifest.categories[0]}),U(e)]})]})}),o.jsxs("div",{className:"space-y-6",children:[o.jsx(zAe,{pluginId:e.id}),o.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-4",children:[o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-medium",children:"版本"}),o.jsxs("p",{className:"text-sm text-muted-foreground",children:["v",e.manifest?.version||"unknown"]}),e.installed&&e.installed_version&&o.jsxs("p",{className:"text-xs text-muted-foreground",children:["已安装: v",e.installed_version]})]}),o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-medium",children:"下载量"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:(L[e.id]?.downloads??e.downloads??0).toLocaleString()})]}),o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-medium",children:"评分"}),o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx(Ac,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),o.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,")"]})]})]}),o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-medium",children:"许可证"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:e.manifest.license||"Unknown"})]}),o.jsxs("div",{className:"col-span-2",children:[o.jsx("p",{className:"text-sm font-medium",children:"支持版本"}),o.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}`:" - 最新版本"]})]})]}),o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-medium mb-2",children:"关键词"}),o.jsx("div",{className:"flex flex-wrap gap-2",children:e.manifest.keywords&&e.manifest.keywords.map(R=>o.jsx(Xn,{variant:"outline",children:R},R))})]}),e.detailed_description&&o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-medium mb-2",children:"详细说明"}),o.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-line",children:e.detailed_description})]}),!e.detailed_description&&o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-medium mb-2",children:"说明"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:e.manifest.description||"无描述"})]}),o.jsxs("div",{className:"space-y-2",children:[e.manifest.homepage_url&&o.jsxs("div",{className:"text-sm",children:[o.jsx("span",{className:"font-medium",children:"主页: "}),o.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&&o.jsxs("div",{className:"text-sm",children:[o.jsx("span",{className:"font-medium",children:"仓库: "}),o.jsx("a",{href:e.manifest.repository_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:e.manifest.repository_url})]})]})]}),o.jsxs(ws,{children:[e.manifest.homepage_url&&o.jsxs(de,{onClick:()=>window.open(e.manifest.homepage_url,"_blank"),children:[o.jsx(Ah,{className:"h-4 w-4 mr-2"}),"访问主页"]}),e.manifest.repository_url&&o.jsxs(de,{variant:"outline",onClick:()=>window.open(e.manifest.repository_url,"_blank"),children:[o.jsx(Ah,{className:"h-4 w-4 mr-2"}),"查看仓库"]})]})]})})]})})}function LAe(){return o.jsx(gn,{className:"h-full",children:o.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"插件配置"}),o.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理和配置已安装的插件"})]}),o.jsxs("div",{className:"flex gap-2",children:[o.jsxs(de,{variant:"outline",size:"sm",children:[o.jsx(Ps,{className:"h-4 w-4 mr-2"}),"刷新"]}),o.jsxs(de,{size:"sm",children:[o.jsx(Xu,{className:"h-4 w-4 mr-2"}),"全局设置"]})]})]}),o.jsxs("div",{className:"grid gap-4 grid-cols-1 xs:grid-cols-2 lg:grid-cols-4",children:[o.jsxs(qt,{children:[o.jsxs(Fn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[o.jsx(qn,{className:"text-sm font-medium",children:"已安装插件"}),o.jsx(Gh,{className:"h-4 w-4 text-muted-foreground"})]}),o.jsxs(Gn,{children:[o.jsx("div",{className:"text-2xl font-bold",children:"0"}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"正在加载..."})]})]}),o.jsxs(qt,{children:[o.jsxs(Fn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[o.jsx(qn,{className:"text-sm font-medium",children:"已启用"}),o.jsx(Vc,{className:"h-4 w-4 text-green-600"})]}),o.jsxs(Gn,{children:[o.jsx("div",{className:"text-2xl font-bold",children:"0"}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"运行中的插件"})]})]}),o.jsxs(qt,{children:[o.jsxs(Fn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[o.jsx(qn,{className:"text-sm font-medium",children:"已禁用"}),o.jsx(Uc,{className:"h-4 w-4 text-orange-600"})]}),o.jsxs(Gn,{children:[o.jsx("div",{className:"text-2xl font-bold",children:"0"}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"未激活的插件"})]})]}),o.jsxs(qt,{children:[o.jsxs(Fn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[o.jsx(qn,{className:"text-sm font-medium",children:"可更新"}),o.jsx(Ps,{className:"h-4 w-4 text-blue-600"})]}),o.jsxs(Gn,{children:[o.jsx("div",{className:"text-2xl font-bold",children:"0"}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"有新版本可用"})]})]})]}),o.jsxs(qt,{children:[o.jsxs(Fn,{children:[o.jsx(qn,{children:"已安装的插件"}),o.jsx(ts,{children:"查看和管理已安装插件的配置"})]}),o.jsx(Gn,{children:o.jsxs("div",{className:"flex flex-col items-center justify-center py-12 space-y-4",children:[o.jsx(Gh,{className:"h-16 w-16 text-muted-foreground/50"}),o.jsxs("div",{className:"text-center space-y-2",children:[o.jsx("p",{className:"text-lg font-medium text-muted-foreground",children:"插件配置功能开发中"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"即将支持插件的启用/禁用、参数配置等功能"})]}),o.jsx("div",{className:"flex gap-2",children:o.jsx(de,{variant:"outline",asChild:!0,children:o.jsxs("a",{href:"/plugins",children:[o.jsx(Ah,{className:"h-4 w-4 mr-2"}),"前往插件市场"]})})})]})})]}),o.jsx(qt,{className:"border-blue-200 bg-blue-50 dark:bg-blue-950/20 dark:border-blue-900",children:o.jsx(Gn,{className:"pt-6",children:o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsx(Uc,{className:"h-5 w-5 text-blue-600 mt-0.5 flex-shrink-0"}),o.jsxs("div",{className:"space-y-1",children:[o.jsx("p",{className:"text-sm font-medium text-blue-900 dark:text-blue-100",children:"开发进行中"}),o.jsxs("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:["插件配置功能正在积极开发中。目前您可以通过",o.jsx("strong",{children:"插件市场"}),"安装和卸载插件,完整的配置管理功能即将推出。"]})]})]})})})]})})}function BAe(){const t=Zi(),{toast:e}=as(),[n,r]=b.useState([]),[s,i]=b.useState(!0),[a,l]=b.useState(null),[c,d]=b.useState(null),[h,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),l(null);const A=localStorage.getItem("access-token"),L=await fetch("/api/webui/plugins/mirrors",{headers:{Authorization:`Bearer ${A}`}});if(!L.ok)throw new Error("获取镜像源列表失败");const P=await L.json();r(P.mirrors||[])}catch(A){const L=A instanceof Error?A.message:"加载镜像源失败";l(L),e({title:"加载失败",description:L,variant:"destructive"})}finally{i(!1)}},[e]);b.useEffect(()=>{S()},[S]);const k=async()=>{try{const A=localStorage.getItem("access-token"),L=await fetch("/api/webui/plugins/mirrors",{method:"POST",headers:{Authorization:`Bearer ${A}`,"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(A){e({title:"添加失败",description:A instanceof Error?A.message:"未知错误",variant:"destructive"})}},j=async()=>{if(c)try{const A=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${c.id}`,{method:"PUT",headers:{Authorization:`Bearer ${A}`,"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),d(null),S()}catch(A){e({title:"更新失败",description:A instanceof Error?A.message:"未知错误",variant:"destructive"})}},N=async A=>{if(confirm("确定要删除这个镜像源吗?"))try{const L=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${A}`,{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 A=>{try{const L=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${A.id}`,{method:"PUT",headers:{Authorization:`Bearer ${L}`,"Content-Type":"application/json"},body:JSON.stringify({enabled:!A.enabled})})).ok)throw new Error("更新状态失败");S()}catch(L){e({title:"更新失败",description:L instanceof Error?L.message:"未知错误",variant:"destructive"})}},E=A=>{d(A),w({id:A.id,name:A.name,raw_prefix:A.raw_prefix,clone_prefix:A.clone_prefix,enabled:A.enabled,priority:A.priority}),x(!0)},_=async(A,L)=>{const P=L==="up"?A.priority-1:A.priority+1;if(!(P<1))try{const B=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${A.id}`,{method:"PUT",headers:{Authorization:`Bearer ${B}`,"Content-Type":"application/json"},body:JSON.stringify({priority:P})})).ok)throw new Error("更新优先级失败");S()}catch(B){e({title:"更新失败",description:B instanceof Error?B.message:"未知错误",variant:"destructive"})}};return o.jsx(gn,{className:"h-full",children:o.jsxs("div",{className:"space-y-6 p-4 sm:p-6",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsx(de,{variant:"ghost",size:"icon",onClick:()=>t({to:"/plugins"}),children:o.jsx(wI,{className:"h-5 w-5"})}),o.jsxs("div",{children:[o.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"镜像源配置"}),o.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"管理 Git 克隆和文件下载的镜像源"})]})]}),o.jsxs(de,{onClick:()=>m(!0),children:[o.jsx(Ls,{className:"h-4 w-4 mr-2"}),"添加镜像源"]})]}),s?o.jsx(qt,{className:"p-6",children:o.jsx("div",{className:"flex items-center justify-center py-8",children:o.jsx(Po,{className:"h-8 w-8 animate-spin text-primary"})})}):a?o.jsx(qt,{className:"p-6",children:o.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[o.jsx(Wa,{className:"h-12 w-12 text-destructive mb-4"}),o.jsx("h3",{className:"text-lg font-semibold mb-2",children:"加载失败"}),o.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:a}),o.jsx(de,{onClick:S,children:"重新加载"})]})}):o.jsxs(qt,{children:[o.jsx("div",{className:"hidden md:block",children:o.jsxs(_f,{children:[o.jsx(Af,{children:o.jsxs(Is,{children:[o.jsx(pn,{children:"状态"}),o.jsx(pn,{children:"名称"}),o.jsx(pn,{children:"ID"}),o.jsx(pn,{children:"优先级"}),o.jsx(pn,{className:"text-right",children:"操作"})]})}),o.jsx(Mf,{children:n.map(A=>o.jsxs(Is,{children:[o.jsx(Gt,{children:o.jsx(Bt,{checked:A.enabled,onCheckedChange:()=>T(A)})}),o.jsx(Gt,{children:o.jsxs("div",{children:[o.jsx("div",{className:"font-medium",children:A.name}),o.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:["Raw: ",A.raw_prefix]})]})}),o.jsx(Gt,{children:o.jsx(Xn,{variant:"outline",children:A.id})}),o.jsx(Gt,{children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"font-mono",children:A.priority}),o.jsxs("div",{className:"flex flex-col gap-1",children:[o.jsx(de,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>_(A,"up"),disabled:A.priority===1,children:o.jsx(P0,{className:"h-3 w-3"})}),o.jsx(de,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>_(A,"down"),children:o.jsx(nd,{className:"h-3 w-3"})})]})]})}),o.jsx(Gt,{className:"text-right",children:o.jsxs("div",{className:"flex items-center justify-end gap-2",children:[o.jsx(de,{variant:"ghost",size:"icon",onClick:()=>E(A),children:o.jsx(Yu,{className:"h-4 w-4"})}),o.jsx(de,{variant:"ghost",size:"icon",onClick:()=>N(A.id),children:o.jsx(Sn,{className:"h-4 w-4 text-destructive"})})]})})]},A.id))})]})}),o.jsx("div",{className:"md:hidden p-4 space-y-4",children:n.map(A=>o.jsx(qt,{className:"p-4",children:o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"flex items-start justify-between",children:[o.jsxs("div",{className:"flex-1",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("h3",{className:"font-semibold",children:A.name}),A.enabled&&o.jsx(Xn,{variant:"default",className:"text-xs",children:"启用"})]}),o.jsx(Xn,{variant:"outline",className:"mt-1 text-xs",children:A.id})]}),o.jsx(Bt,{checked:A.enabled,onCheckedChange:()=>T(A)})]}),o.jsxs("div",{className:"text-sm space-y-1",children:[o.jsxs("div",{className:"text-muted-foreground",children:[o.jsx("span",{className:"font-medium",children:"Raw: "}),o.jsx("span",{className:"break-all",children:A.raw_prefix})]}),o.jsxs("div",{className:"text-muted-foreground",children:[o.jsx("span",{className:"font-medium",children:"优先级: "}),o.jsx("span",{className:"font-mono",children:A.priority})]})]}),o.jsxs("div",{className:"flex items-center gap-2 pt-2 border-t",children:[o.jsxs(de,{variant:"outline",size:"sm",className:"flex-1",onClick:()=>E(A),children:[o.jsx(Yu,{className:"h-4 w-4 mr-1"}),"编辑"]}),o.jsx(de,{variant:"outline",size:"sm",onClick:()=>_(A,"up"),disabled:A.priority===1,children:o.jsx(P0,{className:"h-4 w-4"})}),o.jsx(de,{variant:"outline",size:"sm",onClick:()=>_(A,"down"),children:o.jsx(nd,{className:"h-4 w-4"})}),o.jsx(de,{variant:"destructive",size:"sm",onClick:()=>N(A.id),children:o.jsx(Sn,{className:"h-4 w-4"})})]})]})},A.id))})]}),o.jsx(Dr,{open:h,onOpenChange:m,children:o.jsxs(Sr,{className:"max-w-lg",children:[o.jsxs(kr,{children:[o.jsx(Or,{children:"添加镜像源"}),o.jsx(ss,{children:"添加新的 Git 镜像源配置"})]}),o.jsxs("div",{className:"space-y-4 py-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{htmlFor:"add-id",children:"镜像源 ID *"}),o.jsx(ze,{id:"add-id",placeholder:"例如: my-mirror",value:y.id,onChange:A=>w({...y,id:A.target.value})})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{htmlFor:"add-name",children:"名称 *"}),o.jsx(ze,{id:"add-name",placeholder:"例如: 我的镜像源",value:y.name,onChange:A=>w({...y,name:A.target.value})})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{htmlFor:"add-raw",children:"Raw 文件前缀 *"}),o.jsx(ze,{id:"add-raw",placeholder:"https://example.com/raw",value:y.raw_prefix,onChange:A=>w({...y,raw_prefix:A.target.value})})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{htmlFor:"add-clone",children:"克隆前缀 *"}),o.jsx(ze,{id:"add-clone",placeholder:"https://example.com/clone",value:y.clone_prefix,onChange:A=>w({...y,clone_prefix:A.target.value})})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{htmlFor:"add-priority",children:"优先级"}),o.jsx(ze,{id:"add-priority",type:"number",min:"1",value:y.priority,onChange:A=>w({...y,priority:parseInt(A.target.value)||1})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"数字越小优先级越高"})]}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Bt,{id:"add-enabled",checked:y.enabled,onCheckedChange:A=>w({...y,enabled:A})}),o.jsx(he,{htmlFor:"add-enabled",children:"启用此镜像源"})]})]}),o.jsxs(ws,{children:[o.jsx(de,{variant:"outline",onClick:()=>m(!1),children:"取消"}),o.jsx(de,{onClick:k,children:"添加"})]})]})}),o.jsx(Dr,{open:g,onOpenChange:x,children:o.jsxs(Sr,{className:"max-w-lg",children:[o.jsxs(kr,{children:[o.jsx(Or,{children:"编辑镜像源"}),o.jsx(ss,{children:"修改镜像源配置"})]}),o.jsxs("div",{className:"space-y-4 py-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{children:"镜像源 ID"}),o.jsx(ze,{value:y.id,disabled:!0})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{htmlFor:"edit-name",children:"名称 *"}),o.jsx(ze,{id:"edit-name",value:y.name,onChange:A=>w({...y,name:A.target.value})})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{htmlFor:"edit-raw",children:"Raw 文件前缀 *"}),o.jsx(ze,{id:"edit-raw",value:y.raw_prefix,onChange:A=>w({...y,raw_prefix:A.target.value})})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{htmlFor:"edit-clone",children:"克隆前缀 *"}),o.jsx(ze,{id:"edit-clone",value:y.clone_prefix,onChange:A=>w({...y,clone_prefix:A.target.value})})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{htmlFor:"edit-priority",children:"优先级"}),o.jsx(ze,{id:"edit-priority",type:"number",min:"1",value:y.priority,onChange:A=>w({...y,priority:parseInt(A.target.value)||1})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"数字越小优先级越高"})]}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Bt,{id:"edit-enabled",checked:y.enabled,onCheckedChange:A=>w({...y,enabled:A})}),o.jsx(he,{htmlFor:"edit-enabled",children:"启用此镜像源"})]})]}),o.jsxs(ws,{children:[o.jsx(de,{variant:"outline",onClick:()=>x(!1),children:"取消"}),o.jsx(de,{onClick:j,children:"保存"})]})]})})]})})}function FAe(t,e=[]){let n=[];function r(i,a){const l=b.createContext(a);l.displayName=i+"Context";const c=n.length;n=[...n,a];const d=m=>{const{scope:g,children:x,...y}=m,w=g?.[t]?.[c]||l,S=b.useMemo(()=>y,Object.values(y));return o.jsx(w.Provider,{value:S,children:x})};d.displayName=i+"Provider";function h(m,g){const x=g?.[t]?.[c]||l,y=b.useContext(x);if(y)return y;if(a!==void 0)return a;throw new Error(`\`${m}\` must be used within \`${i}\``)}return[d,h]}const s=()=>{const i=n.map(a=>b.createContext(a));return function(l){const c=l?.[t]||i;return b.useMemo(()=>({[`__scope${t}`]:{...l,[t]:c}}),[l,c])}};return s.scopeName=t,[r,qAe(s,...e)]}function qAe(...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((l,{useScope:c,scopeName:d})=>{const m=c(i)[`__scope${d}`];return{...l,...m}},{});return b.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return n.scopeName=e.scopeName,n}var $Ae=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],f7=$Ae.reduce((t,e)=>{const n=Fy(`Primitive.${e}`),r=b.forwardRef((s,i)=>{const{asChild:a,...l}=s,c=a?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(c,{...l,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),HAe=gJ();function QAe(){return HAe.useSyncExternalStore(VAe,()=>!0,()=>!1)}function VAe(){return()=>{}}var m7="Avatar",[UAe]=FAe(m7),[WAe,hX]=UAe(m7),fX=b.forwardRef((t,e)=>{const{__scopeAvatar:n,...r}=t,[s,i]=b.useState("idle");return o.jsx(WAe,{scope:n,imageLoadingStatus:s,onImageLoadingStatusChange:i,children:o.jsx(f7.span,{...r,ref:e})})});fX.displayName=m7;var mX="AvatarImage",pX=b.forwardRef((t,e)=>{const{__scopeAvatar:n,src:r,onLoadingStatusChange:s=()=>{},...i}=t,a=hX(mX,n),l=GAe(r,i),c=Rs(d=>{s(d),a.onImageLoadingStatusChange(d)});return Uh(()=>{l!=="idle"&&c(l)},[l,c]),l==="loaded"?o.jsx(f7.img,{...i,ref:e,src:r}):null});pX.displayName=mX;var gX="AvatarFallback",xX=b.forwardRef((t,e)=>{const{__scopeAvatar:n,delayMs:r,...s}=t,i=hX(gX,n),[a,l]=b.useState(r===void 0);return b.useEffect(()=>{if(r!==void 0){const c=window.setTimeout(()=>l(!0),r);return()=>window.clearTimeout(c)}},[r]),a&&i.imageLoadingStatus!=="loaded"?o.jsx(f7.span,{...s,ref:e}):null});xX.displayName=gX;function Rz(t,e){return t?e?(t.src!==e&&(t.src=e),t.complete&&t.naturalWidth>0?"loaded":"loading"):"error":"idle"}function GAe(t,{referrerPolicy:e,crossOrigin:n}){const r=QAe(),s=b.useRef(null),i=r?(s.current||(s.current=new window.Image),s.current):null,[a,l]=b.useState(()=>Rz(i,t));return Uh(()=>{l(Rz(i,t))},[i,t]),Uh(()=>{const c=m=>()=>{l(m)};if(!i)return;const d=c("loaded"),h=c("error");return i.addEventListener("load",d),i.addEventListener("error",h),e&&(i.referrerPolicy=e),typeof n=="string"&&(i.crossOrigin=n),()=>{i.removeEventListener("load",d),i.removeEventListener("error",h)}},[i,n,e]),a}var vX=fX,yX=pX,bX=xX;const _v=b.forwardRef(({className:t,...e},n)=>o.jsx(vX,{ref:n,className:xe("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",t),...e}));_v.displayName=vX.displayName;const XAe=b.forwardRef(({className:t,...e},n)=>o.jsx(yX,{ref:n,className:xe("aspect-square h-full w-full",t),...e}));XAe.displayName=yX.displayName;const Av=b.forwardRef(({className:t,...e},n)=>o.jsx(bX,{ref:n,className:xe("flex h-full w-full items-center justify-center rounded-full bg-muted",t),...e}));Av.displayName=bX.displayName;function YAe(){return"webui_"+Math.random().toString(36).substr(2,9)+"_"+Date.now().toString(36)}function KAe(){const t="maibot_webui_user_id";let e=localStorage.getItem(t);return e||(e=YAe(),localStorage.setItem(t,e)),e}function ZAe(){return localStorage.getItem("maibot_webui_user_name")||"WebUI用户"}function JAe(t){localStorage.setItem("maibot_webui_user_name",t)}function eMe(){const[t,e]=b.useState([]),[n,r]=b.useState(""),[s,i]=b.useState(!1),[a,l]=b.useState(!1),[c,d]=b.useState(!1),[h,m]=b.useState(!0),[g,x]=b.useState(ZAe()),[y,w]=b.useState(!1),[S,k]=b.useState(""),[j,N]=b.useState({}),T=b.useRef(KAe()),E=b.useRef(null),_=b.useRef(null),A=b.useRef(null),L=b.useRef(0),P=b.useRef(new Set),{toast:B}=as(),$=I=>(L.current+=1,`${I}-${Date.now()}-${L.current}-${Math.random().toString(36).substr(2,9)}`),U=b.useCallback(()=>{_.current?.scrollIntoView({behavior:"smooth"})},[]);b.useEffect(()=>{U()},[t,U]);const te=b.useCallback(async()=>{m(!0);try{const I=`/api/chat/history?user_id=${T.current}&limit=50`;console.log("[Chat] 正在加载历史消息:",I);const V=await fetch(I);if(console.log("[Chat] 历史消息响应状态:",V.status,V.statusText),console.log("[Chat] 响应 Content-Type:",V.headers.get("content-type")),V.ok){const ee=await V.text();console.log("[Chat] 响应内容前100字符:",ee.substring(0,100));try{const ne=JSON.parse(ee);if(console.log("[Chat] 解析后的数据:",ne),ne.messages&&ne.messages.length>0){const W=ne.messages.map(se=>({id:se.id,type:se.type,content:se.content,timestamp:se.timestamp,sender:{name:se.sender_name||(se.is_bot?"麦麦":"WebUI用户"),user_id:se.user_id,is_bot:se.is_bot}}));e(W),console.log("[Chat] 已加载历史消息数量:",W.length),W.forEach(se=>{if(se.type==="bot"){const re=`bot-${se.content}-${Math.floor(se.timestamp*1e3)}`;P.current.add(re)}})}else console.log("[Chat] 没有历史消息")}catch(ne){console.error("[Chat] JSON 解析失败:",ne),console.error("[Chat] 原始响应内容:",ee)}}else{console.error("[Chat] 响应失败:",V.status);const ee=await V.text();console.error("[Chat] 错误响应内容:",ee.substring(0,200))}}catch(I){console.error("[Chat] 加载历史消息失败:",I)}finally{m(!1)}},[]),z=b.useCallback(()=>{if(E.current?.readyState===WebSocket.OPEN||E.current?.readyState===WebSocket.CONNECTING){console.log("WebSocket 已存在,跳过连接");return}l(!0);const V=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/api/chat/ws?user_id=${encodeURIComponent(T.current)}&user_name=${encodeURIComponent(g)}`;console.log("正在连接 WebSocket:",V);try{const ee=new WebSocket(V);E.current=ee,ee.onopen=()=>{i(!0),l(!1),console.log("WebSocket 已连接")},ee.onmessage=ne=>{try{const W=JSON.parse(ne.data);switch(W.type){case"session_info":N({session_id:W.session_id,user_id:W.user_id,user_name:W.user_name,bot_name:W.bot_name});break;case"system":e(se=>[...se,{id:$("sys"),type:"system",content:W.content||"",timestamp:W.timestamp||Date.now()/1e3}]);break;case"user_message":e(se=>[...se,{id:W.message_id||$("user"),type:"user",content:W.content||"",timestamp:W.timestamp||Date.now()/1e3,sender:W.sender}]);break;case"bot_message":{d(!1);const se=`bot-${W.content}-${Math.floor((W.timestamp||0)*1e3)}`;if(P.current.has(se)){console.log("跳过重复的机器人消息");break}if(P.current.add(se),P.current.size>100){const re=P.current.values().next().value;re&&P.current.delete(re)}e(re=>[...re,{id:$("bot"),type:"bot",content:W.content||"",timestamp:W.timestamp||Date.now()/1e3,sender:W.sender}]);break}case"typing":d(W.is_typing||!1);break;case"error":e(se=>[...se,{id:$("error"),type:"error",content:W.content||"发生错误",timestamp:W.timestamp||Date.now()/1e3}]),B({title:"错误",description:W.content,variant:"destructive"});break;case"pong":break;default:console.log("未知消息类型:",W.type)}}catch(W){console.error("解析消息失败:",W)}},ee.onclose=()=>{i(!1),l(!1),E.current=null,console.log("WebSocket 已断开"),A.current&&clearTimeout(A.current),A.current=window.setTimeout(()=>{Q.current||z()},5e3)},ee.onerror=ne=>{console.error("WebSocket 错误:",ne),l(!1)}}catch(ee){console.error("创建 WebSocket 失败:",ee),l(!1)}},[B,g]),Q=b.useRef(!1);b.useEffect(()=>{Q.current=!1,te();const I=setTimeout(()=>{Q.current||z()},100),V=setInterval(()=>{E.current?.readyState===WebSocket.OPEN&&E.current.send(JSON.stringify({type:"ping"}))},3e4);return()=>{Q.current=!0,clearTimeout(I),clearInterval(V),A.current&&(clearTimeout(A.current),A.current=null),E.current&&(E.current.close(),E.current=null)}},[z,te]);const F=b.useCallback(()=>{!n.trim()||!E.current||E.current.readyState!==WebSocket.OPEN||(E.current.send(JSON.stringify({type:"message",content:n.trim(),user_name:g})),r(""))},[n,g]),Y=I=>{I.key==="Enter"&&!I.shiftKey&&(I.preventDefault(),F())},J=()=>{k(g),w(!0)},X=()=>{const I=S.trim()||"WebUI用户";x(I),JAe(I),w(!1),E.current?.readyState===WebSocket.OPEN&&E.current.send(JSON.stringify({type:"update_nickname",user_name:I}))},R=()=>{k(""),w(!1)},ie=I=>new Date(I*1e3).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"}),G=()=>{E.current&&E.current.close(),z()};return o.jsxs("div",{className:"h-full flex flex-col",children:[o.jsx("div",{className:"shrink-0 border-b bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60",children:o.jsxs("div",{className:"p-3 sm:p-4 max-w-4xl mx-auto",children:[o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsxs("div",{className:"flex items-center gap-2 sm:gap-3 min-w-0",children:[o.jsx(_v,{className:"h-8 w-8 sm:h-10 sm:w-10 shrink-0",children:o.jsx(Av,{className:"bg-primary/10 text-primary",children:o.jsx(a0,{className:"h-4 w-4 sm:h-5 sm:w-5"})})}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("h1",{className:"text-base sm:text-lg font-semibold truncate",children:j.bot_name||"麦麦"}),o.jsx("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:s?o.jsxs(o.Fragment,{children:[o.jsx(ite,{className:"h-3 w-3 text-green-500"}),o.jsx("span",{className:"text-green-600 dark:text-green-400",children:"已连接"})]}):a?o.jsxs(o.Fragment,{children:[o.jsx(Po,{className:"h-3 w-3 animate-spin"}),o.jsx("span",{children:"连接中..."})]}):o.jsxs(o.Fragment,{children:[o.jsx(ate,{className:"h-3 w-3 text-red-500"}),o.jsx("span",{className:"text-red-600 dark:text-red-400",children:"未连接"})]})})]})]}),o.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[h&&o.jsx(Po,{className:"h-4 w-4 animate-spin text-muted-foreground"}),o.jsx(de,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:G,disabled:a,title:"重新连接",children:o.jsx(Ps,{className:xe("h-4 w-4",a&&"animate-spin")})})]})]}),o.jsxs("div",{className:"hidden sm:flex items-center gap-2 mt-2 text-sm text-muted-foreground",children:[o.jsx(Dv,{className:"h-3 w-3"}),o.jsx("span",{children:"当前身份:"}),y?o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(ze,{value:S,onChange:I=>k(I.target.value),onKeyDown:I=>{I.key==="Enter"&&X(),I.key==="Escape"&&R()},className:"h-7 w-32",placeholder:"输入昵称",autoFocus:!0}),o.jsx(de,{size:"sm",variant:"ghost",className:"h-7 px-2",onClick:X,children:"保存"}),o.jsx(de,{size:"sm",variant:"ghost",className:"h-7 px-2",onClick:R,children:"取消"})]}):o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("span",{className:"font-medium text-foreground",children:g}),o.jsx(de,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:J,title:"修改昵称",children:o.jsx(ote,{className:"h-3 w-3"})})]})]})]})}),o.jsx("div",{className:"flex-1 overflow-hidden",children:o.jsx(gn,{className:"h-full",children:o.jsxs("div",{className:"p-3 sm:p-4 max-w-4xl mx-auto space-y-3 sm:space-y-4",children:[t.length===0&&!h&&o.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground",children:[o.jsx(a0,{className:"h-12 w-12 mb-4 opacity-50"}),o.jsxs("p",{className:"text-sm",children:["开始与 ",j.bot_name||"麦麦"," 对话吧!"]})]}),t.map(I=>o.jsxs("div",{className:xe("flex gap-2 sm:gap-3",I.type==="user"&&"flex-row-reverse",I.type==="system"&&"justify-center",I.type==="error"&&"justify-center"),children:[I.type==="system"&&o.jsx("div",{className:"text-xs text-muted-foreground bg-muted/50 px-3 py-1 rounded-full max-w-[90%]",children:I.content}),I.type==="error"&&o.jsx("div",{className:"text-xs text-red-600 dark:text-red-400 bg-red-100 dark:bg-red-900/30 px-3 py-1 rounded-full max-w-[90%]",children:I.content}),(I.type==="user"||I.type==="bot")&&o.jsxs(o.Fragment,{children:[o.jsx(_v,{className:"h-7 w-7 sm:h-8 sm:w-8 shrink-0",children:o.jsx(Av,{className:xe("text-xs",I.type==="bot"?"bg-primary/10 text-primary":"bg-secondary text-secondary-foreground"),children:I.type==="bot"?o.jsx(a0,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4"}):o.jsx(Dv,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4"})})}),o.jsxs("div",{className:xe("flex flex-col gap-1 max-w-[75%] sm:max-w-[70%]",I.type==="user"&&"items-end"),children:[o.jsxs("div",{className:"flex items-center gap-2 text-[10px] sm:text-xs text-muted-foreground",children:[o.jsx("span",{className:"hidden sm:inline",children:I.sender?.name||(I.type==="bot"?j.bot_name:g)}),o.jsx("span",{children:ie(I.timestamp)})]}),o.jsx("div",{className:xe("rounded-2xl px-3 py-2 text-sm whitespace-pre-wrap break-words",I.type==="bot"?"bg-muted rounded-tl-sm":"bg-primary text-primary-foreground rounded-tr-sm"),children:I.content})]})]})]},I.id)),c&&o.jsxs("div",{className:"flex gap-2 sm:gap-3",children:[o.jsx(_v,{className:"h-7 w-7 sm:h-8 sm:w-8 shrink-0",children:o.jsx(Av,{className:"bg-primary/10 text-primary",children:o.jsx(a0,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4"})})}),o.jsx("div",{className:"bg-muted rounded-2xl rounded-tl-sm px-4 py-3",children:o.jsxs("div",{className:"flex gap-1",children:[o.jsx("span",{className:"w-2 h-2 bg-muted-foreground/50 rounded-full animate-bounce",style:{animationDelay:"0ms"}}),o.jsx("span",{className:"w-2 h-2 bg-muted-foreground/50 rounded-full animate-bounce",style:{animationDelay:"150ms"}}),o.jsx("span",{className:"w-2 h-2 bg-muted-foreground/50 rounded-full animate-bounce",style:{animationDelay:"300ms"}})]})})]}),o.jsx("div",{ref:_})]})})}),o.jsx("div",{className:"shrink-0 border-t bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60",children:o.jsx("div",{className:"p-3 sm:p-4 max-w-4xl mx-auto",children:o.jsxs("div",{className:"flex gap-2",children:[o.jsx(ze,{value:n,onChange:I=>r(I.target.value),onKeyDown:Y,placeholder:s?"输入消息...":"等待连接...",disabled:!s,className:"flex-1 h-10 sm:h-10"}),o.jsx(de,{onClick:F,disabled:!s||!n.trim(),size:"icon",className:"h-10 w-10 shrink-0",children:o.jsx(lte,{className:"h-4 w-4"})})]})})})]})}const tMe=kf("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"}}),wX=b.forwardRef(({className:t,size:e,abbrTitle:n,children:r,...s},i)=>o.jsx("kbd",{className:xe(tMe({size:e,className:t})),ref:i,...s,children:n?o.jsx("abbr",{title:n,children:r}):r}));wX.displayName="Kbd";const nMe=[{icon:D0,title:"首页",description:"查看仪表板概览",path:"/",category:"概览"},{icon:zl,title:"麦麦主程序配置",description:"配置麦麦的核心设置",path:"/config/bot",category:"配置"},{icon:kI,title:"麦麦模型提供商配置",description:"配置模型提供商",path:"/config/modelProvider",category:"配置"},{icon:OI,title:"麦麦模型配置",description:"配置模型参数",path:"/config/model",category:"配置"},{icon:_j,title:"表情包管理",description:"管理麦麦的表情包",path:"/resource/emoji",category:"资源"},{icon:Wh,title:"表达方式管理",description:"管理麦麦的表达方式",path:"/resource/expression",category:"资源"},{icon:jI,title:"人物信息管理",description:"管理人物信息",path:"/resource/person",category:"资源"},{icon:cte,title:"统计信息",description:"查看使用统计",path:"/statistics",category:"监控"},{icon:Gh,title:"插件市场",description:"浏览和安装插件",path:"/plugins",category:"扩展"},{icon:Pv,title:"日志查看器",description:"查看系统日志",path:"/logs",category:"监控"},{icon:Xu,title:"系统设置",description:"配置系统参数",path:"/settings",category:"系统"}];function rMe({open:t,onOpenChange:e}){const[n,r]=b.useState(""),[s,i]=b.useState(0),a=Zi(),l=nMe.filter(h=>h.title.toLowerCase().includes(n.toLowerCase())||h.description.toLowerCase().includes(n.toLowerCase())||h.category.toLowerCase().includes(n.toLowerCase()));b.useEffect(()=>{t&&(r(""),i(0))},[t]);const c=b.useCallback(h=>{a({to:h}),e(!1)},[a,e]),d=b.useCallback(h=>{h.key==="ArrowDown"?(h.preventDefault(),i(m=>(m+1)%l.length)):h.key==="ArrowUp"?(h.preventDefault(),i(m=>(m-1+l.length)%l.length)):h.key==="Enter"&&l[s]&&(h.preventDefault(),c(l[s].path))},[l,s,c]);return o.jsx(Dr,{open:t,onOpenChange:e,children:o.jsxs(Sr,{className:"max-w-2xl p-0 gap-0",children:[o.jsxs(kr,{className:"px-4 pt-4 pb-0",children:[o.jsx(Or,{className:"sr-only",children:"搜索"}),o.jsxs("div",{className:"relative",children:[o.jsx(Ni,{className:"absolute left-3 top-1/2 h-5 w-5 -translate-y-1/2 text-muted-foreground"}),o.jsx(ze,{value:n,onChange:h=>{r(h.target.value),i(0)},onKeyDown:d,placeholder:"搜索页面...",className:"h-12 pl-11 text-base border-0 focus-visible:ring-0 shadow-none",autoFocus:!0})]})]}),o.jsx("div",{className:"border-t",children:o.jsx(gn,{className:"h-[400px]",children:l.length>0?o.jsx("div",{className:"p-2",children:l.map((h,m)=>{const g=h.icon;return o.jsxs("button",{onClick:()=>c(h.path),onMouseEnter:()=>i(m),className:xe("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:[o.jsx(g,{className:"h-5 w-5 flex-shrink-0"}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:"font-medium text-sm",children:h.title}),o.jsx("div",{className:"text-xs text-muted-foreground truncate",children:h.description})]}),o.jsx("div",{className:"text-xs text-muted-foreground px-2 py-1 bg-muted rounded",children:h.category})]},h.path)})}):o.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[o.jsx(Ni,{className:"h-12 w-12 text-muted-foreground/50 mb-4"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:n?"未找到匹配的页面":"输入关键词开始搜索"})]})})}),o.jsx("div",{className:"border-t px-4 py-3 flex items-center justify-between text-xs text-muted-foreground",children:o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsxs("span",{className:"flex items-center gap-1",children:[o.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"↑"}),o.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"↓"}),"导航"]}),o.jsxs("span",{className:"flex items-center gap-1",children:[o.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"Enter"}),"选择"]}),o.jsxs("span",{className:"flex items-center gap-1",children:[o.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"Esc"}),"关闭"]})]})})]})})}function sMe(t){const e=iMe(t),n=b.forwardRef((r,s)=>{const{children:i,...a}=r,l=b.Children.toArray(i),c=l.find(oMe);if(c){const d=c.props.children,h=l.map(m=>m===c?b.Children.count(d)>1?b.Children.only(null):b.isValidElement(d)?d.props.children:null:m);return o.jsx(e,{...a,ref:s,children:b.isValidElement(d)?b.cloneElement(d,void 0,h):null})}return o.jsx(e,{...a,ref:s,children:i})});return n.displayName=`${t}.Slot`,n}function iMe(t){const e=b.forwardRef((n,r)=>{const{children:s,...i}=n;if(b.isValidElement(s)){const a=cMe(s),l=lMe(i,s.props);return s.type!==b.Fragment&&(l.ref=r?Qc(r,a):a),b.cloneElement(s,l)}return b.Children.count(s)>1?b.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var aMe=Symbol("radix.slottable");function oMe(t){return b.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===aMe}function lMe(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]=(...l)=>{const c=i(...l);return s(...l),c}:s&&(n[r]=s):r==="style"?n[r]={...s,...i}:r==="className"&&(n[r]=[s,i].filter(Boolean).join(" "))}return{...t,...n}}function cMe(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 cj=["Enter"," "],uMe=["ArrowDown","PageUp","Home"],SX=["ArrowUp","PageDown","End"],dMe=[...uMe,...SX],hMe={ltr:[...cj,"ArrowRight"],rtl:[...cj,"ArrowLeft"]},fMe={ltr:["ArrowLeft"],rtl:["ArrowRight"]},kg="Menu",[Np,mMe,pMe]=By(kg),[jd,kX]=Ra(kg,[pMe,vf,eb]),Og=vf(),OX=eb(),[jX,fu]=jd(kg),[gMe,jg]=jd(kg),NX=t=>{const{__scopeMenu:e,open:n=!1,children:r,dir:s,onOpenChange:i,modal:a=!0}=t,l=Og(e),[c,d]=b.useState(null),h=b.useRef(!1),m=Rs(i),g=Ep(s);return b.useEffect(()=>{const x=()=>{h.current=!0,document.addEventListener("pointerdown",y,{capture:!0,once:!0}),document.addEventListener("pointermove",y,{capture:!0,once:!0})},y=()=>h.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})}},[]),o.jsx(Vy,{...l,children:o.jsx(jX,{scope:e,open:n,onOpenChange:m,content:c,onContentChange:d,children:o.jsx(gMe,{scope:e,onClose:b.useCallback(()=>m(!1),[m]),isUsingKeyboardRef:h,dir:g,modal:a,children:r})})})};NX.displayName=kg;var xMe="MenuAnchor",p7=b.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,s=Og(n);return o.jsx(Uy,{...s,...r,ref:e})});p7.displayName=xMe;var g7="MenuPortal",[vMe,CX]=jd(g7,{forceMount:void 0}),TX=t=>{const{__scopeMenu:e,forceMount:n,children:r,container:s}=t,i=fu(g7,e);return o.jsx(vMe,{scope:e,forceMount:n,children:o.jsx(ii,{present:n||i.open,children:o.jsx(Qy,{asChild:!0,container:s,children:r})})})};TX.displayName=g7;var Ta="MenuContent",[yMe,x7]=jd(Ta),EX=b.forwardRef((t,e)=>{const n=CX(Ta,t.__scopeMenu),{forceMount:r=n.forceMount,...s}=t,i=fu(Ta,t.__scopeMenu),a=jg(Ta,t.__scopeMenu);return o.jsx(Np.Provider,{scope:t.__scopeMenu,children:o.jsx(ii,{present:r||i.open,children:o.jsx(Np.Slot,{scope:t.__scopeMenu,children:a.modal?o.jsx(bMe,{...s,ref:e}):o.jsx(wMe,{...s,ref:e})})})})}),bMe=b.forwardRef((t,e)=>{const n=fu(Ta,t.__scopeMenu),r=b.useRef(null),s=Yn(e,r);return b.useEffect(()=>{const i=r.current;if(i)return hI(i)},[]),o.jsx(v7,{...t,ref:s,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:nt(t.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),wMe=b.forwardRef((t,e)=>{const n=fu(Ta,t.__scopeMenu);return o.jsx(v7,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),SMe=sMe("MenuContent.ScrollLock"),v7=b.forwardRef((t,e)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:s,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:l,onEntryFocus:c,onEscapeKeyDown:d,onPointerDownOutside:h,onFocusOutside:m,onInteractOutside:g,onDismiss:x,disableOutsideScroll:y,...w}=t,S=fu(Ta,n),k=jg(Ta,n),j=Og(n),N=OX(n),T=mMe(n),[E,_]=b.useState(null),A=b.useRef(null),L=Yn(e,A,S.onContentChange),P=b.useRef(0),B=b.useRef(""),$=b.useRef(0),U=b.useRef(null),te=b.useRef("right"),z=b.useRef(0),Q=y?fI:b.Fragment,F=y?{as:SMe,allowPinchZoom:!0}:void 0,Y=X=>{const R=B.current+X,ie=T().filter(W=>!W.disabled),G=document.activeElement,I=ie.find(W=>W.ref.current===G)?.textValue,V=ie.map(W=>W.textValue),ee=DMe(V,R,I),ne=ie.find(W=>W.textValue===ee)?.ref.current;(function W(se){B.current=se,window.clearTimeout(P.current),se!==""&&(P.current=window.setTimeout(()=>W(""),1e3))})(R),ne&&setTimeout(()=>ne.focus())};b.useEffect(()=>()=>window.clearTimeout(P.current),[]),mI();const J=b.useCallback(X=>te.current===U.current?.side&&zMe(X,U.current?.area),[]);return o.jsx(yMe,{scope:n,searchRef:B,onItemEnter:b.useCallback(X=>{J(X)&&X.preventDefault()},[J]),onItemLeave:b.useCallback(X=>{J(X)||(A.current?.focus(),_(null))},[J]),onTriggerLeave:b.useCallback(X=>{J(X)&&X.preventDefault()},[J]),pointerGraceTimerRef:$,onPointerGraceIntentChange:b.useCallback(X=>{U.current=X},[]),children:o.jsx(Q,{...F,children:o.jsx(pI,{asChild:!0,trapped:s,onMountAutoFocus:nt(i,X=>{X.preventDefault(),A.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:a,children:o.jsx(Cj,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:d,onPointerDownOutside:h,onFocusOutside:m,onInteractOutside:g,onDismiss:x,children:o.jsx(mL,{asChild:!0,...N,dir:k.dir,orientation:"vertical",loop:r,currentTabStopId:E,onCurrentTabStopIdChange:_,onEntryFocus:nt(c,X=>{k.isUsingKeyboardRef.current||X.preventDefault()}),preventScrollOnEntryFocus:!0,children:o.jsx(Tj,{role:"menu","aria-orientation":"vertical","data-state":UX(S.open),"data-radix-menu-content":"",dir:k.dir,...j,...w,ref:L,style:{outline:"none",...w.style},onKeyDown:nt(w.onKeyDown,X=>{const ie=X.target.closest("[data-radix-menu-content]")===X.currentTarget,G=X.ctrlKey||X.altKey||X.metaKey,I=X.key.length===1;ie&&(X.key==="Tab"&&X.preventDefault(),!G&&I&&Y(X.key));const V=A.current;if(X.target!==V||!dMe.includes(X.key))return;X.preventDefault();const ne=T().filter(W=>!W.disabled).map(W=>W.ref.current);SX.includes(X.key)&&ne.reverse(),MMe(ne)}),onBlur:nt(t.onBlur,X=>{X.currentTarget.contains(X.target)||(window.clearTimeout(P.current),B.current="")}),onPointerMove:nt(t.onPointerMove,Cp(X=>{const R=X.target,ie=z.current!==X.clientX;if(X.currentTarget.contains(R)&&ie){const G=X.clientX>z.current?"right":"left";te.current=G,z.current=X.clientX}}))})})})})})})});EX.displayName=Ta;var kMe="MenuGroup",y7=b.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return o.jsx(xn.div,{role:"group",...r,ref:e})});y7.displayName=kMe;var OMe="MenuLabel",_X=b.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return o.jsx(xn.div,{...r,ref:e})});_X.displayName=OMe;var Py="MenuItem",Dz="menu.itemSelect",rw=b.forwardRef((t,e)=>{const{disabled:n=!1,onSelect:r,...s}=t,i=b.useRef(null),a=jg(Py,t.__scopeMenu),l=x7(Py,t.__scopeMenu),c=Yn(e,i),d=b.useRef(!1),h=()=>{const m=i.current;if(!n&&m){const g=new CustomEvent(Dz,{bubbles:!0,cancelable:!0});m.addEventListener(Dz,x=>r?.(x),{once:!0}),xI(m,g),g.defaultPrevented?d.current=!1:a.onClose()}};return o.jsx(AX,{...s,ref:c,disabled:n,onClick:nt(t.onClick,h),onPointerDown:m=>{t.onPointerDown?.(m),d.current=!0},onPointerUp:nt(t.onPointerUp,m=>{d.current||m.currentTarget?.click()}),onKeyDown:nt(t.onKeyDown,m=>{const g=l.searchRef.current!=="";n||g&&m.key===" "||cj.includes(m.key)&&(m.currentTarget.click(),m.preventDefault())})})});rw.displayName=Py;var AX=b.forwardRef((t,e)=>{const{__scopeMenu:n,disabled:r=!1,textValue:s,...i}=t,a=x7(Py,n),l=OX(n),c=b.useRef(null),d=Yn(e,c),[h,m]=b.useState(!1),[g,x]=b.useState("");return b.useEffect(()=>{const y=c.current;y&&x((y.textContent??"").trim())},[i.children]),o.jsx(Np.ItemSlot,{scope:n,disabled:r,textValue:s??g,children:o.jsx(pL,{asChild:!0,...l,focusable:!r,children:o.jsx(xn.div,{role:"menuitem","data-highlighted":h?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...i,ref:d,onPointerMove:nt(t.onPointerMove,Cp(y=>{r?a.onItemLeave(y):(a.onItemEnter(y),y.defaultPrevented||y.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:nt(t.onPointerLeave,Cp(y=>a.onItemLeave(y))),onFocus:nt(t.onFocus,()=>m(!0)),onBlur:nt(t.onBlur,()=>m(!1))})})})}),jMe="MenuCheckboxItem",MX=b.forwardRef((t,e)=>{const{checked:n=!1,onCheckedChange:r,...s}=t;return o.jsx(IX,{scope:t.__scopeMenu,checked:n,children:o.jsx(rw,{role:"menuitemcheckbox","aria-checked":zy(n)?"mixed":n,...s,ref:e,"data-state":S7(n),onSelect:nt(s.onSelect,()=>r?.(zy(n)?!0:!n),{checkForDefaultPrevented:!1})})})});MX.displayName=jMe;var RX="MenuRadioGroup",[NMe,CMe]=jd(RX,{value:void 0,onValueChange:()=>{}}),DX=b.forwardRef((t,e)=>{const{value:n,onValueChange:r,...s}=t,i=Rs(r);return o.jsx(NMe,{scope:t.__scopeMenu,value:n,onValueChange:i,children:o.jsx(y7,{...s,ref:e})})});DX.displayName=RX;var PX="MenuRadioItem",zX=b.forwardRef((t,e)=>{const{value:n,...r}=t,s=CMe(PX,t.__scopeMenu),i=n===s.value;return o.jsx(IX,{scope:t.__scopeMenu,checked:i,children:o.jsx(rw,{role:"menuitemradio","aria-checked":i,...r,ref:e,"data-state":S7(i),onSelect:nt(r.onSelect,()=>s.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});zX.displayName=PX;var b7="MenuItemIndicator",[IX,TMe]=jd(b7,{checked:!1}),LX=b.forwardRef((t,e)=>{const{__scopeMenu:n,forceMount:r,...s}=t,i=TMe(b7,n);return o.jsx(ii,{present:r||zy(i.checked)||i.checked===!0,children:o.jsx(xn.span,{...s,ref:e,"data-state":S7(i.checked)})})});LX.displayName=b7;var EMe="MenuSeparator",BX=b.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return o.jsx(xn.div,{role:"separator","aria-orientation":"horizontal",...r,ref:e})});BX.displayName=EMe;var _Me="MenuArrow",FX=b.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,s=Og(n);return o.jsx(Ej,{...s,...r,ref:e})});FX.displayName=_Me;var w7="MenuSub",[AMe,qX]=jd(w7),$X=t=>{const{__scopeMenu:e,children:n,open:r=!1,onOpenChange:s}=t,i=fu(w7,e),a=Og(e),[l,c]=b.useState(null),[d,h]=b.useState(null),m=Rs(s);return b.useEffect(()=>(i.open===!1&&m(!1),()=>m(!1)),[i.open,m]),o.jsx(Vy,{...a,children:o.jsx(jX,{scope:e,open:r,onOpenChange:m,content:d,onContentChange:h,children:o.jsx(AMe,{scope:e,contentId:Ui(),triggerId:Ui(),trigger:l,onTriggerChange:c,children:n})})})};$X.displayName=w7;var x0="MenuSubTrigger",HX=b.forwardRef((t,e)=>{const n=fu(x0,t.__scopeMenu),r=jg(x0,t.__scopeMenu),s=qX(x0,t.__scopeMenu),i=x7(x0,t.__scopeMenu),a=b.useRef(null),{pointerGraceTimerRef:l,onPointerGraceIntentChange:c}=i,d={__scopeMenu:t.__scopeMenu},h=b.useCallback(()=>{a.current&&window.clearTimeout(a.current),a.current=null},[]);return b.useEffect(()=>h,[h]),b.useEffect(()=>{const m=l.current;return()=>{window.clearTimeout(m),c(null)}},[l,c]),o.jsx(p7,{asChild:!0,...d,children:o.jsx(AX,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":s.contentId,"data-state":UX(n.open),...t,ref:Qc(e,s.onTriggerChange),onClick:m=>{t.onClick?.(m),!(t.disabled||m.defaultPrevented)&&(m.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:nt(t.onPointerMove,Cp(m=>{i.onItemEnter(m),!m.defaultPrevented&&!t.disabled&&!n.open&&!a.current&&(i.onPointerGraceIntentChange(null),a.current=window.setTimeout(()=>{n.onOpenChange(!0),h()},100))})),onPointerLeave:nt(t.onPointerLeave,Cp(m=>{h();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(l.current),l.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(m),m.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:nt(t.onKeyDown,m=>{const g=i.searchRef.current!=="";t.disabled||g&&m.key===" "||hMe[r.dir].includes(m.key)&&(n.onOpenChange(!0),n.content?.focus(),m.preventDefault())})})})});HX.displayName=x0;var QX="MenuSubContent",VX=b.forwardRef((t,e)=>{const n=CX(Ta,t.__scopeMenu),{forceMount:r=n.forceMount,...s}=t,i=fu(Ta,t.__scopeMenu),a=jg(Ta,t.__scopeMenu),l=qX(QX,t.__scopeMenu),c=b.useRef(null),d=Yn(e,c);return o.jsx(Np.Provider,{scope:t.__scopeMenu,children:o.jsx(ii,{present:r||i.open,children:o.jsx(Np.Slot,{scope:t.__scopeMenu,children:o.jsx(v7,{id:l.contentId,"aria-labelledby":l.triggerId,...s,ref:d,align:"start",side:a.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:h=>{a.isUsingKeyboardRef.current&&c.current?.focus(),h.preventDefault()},onCloseAutoFocus:h=>h.preventDefault(),onFocusOutside:nt(t.onFocusOutside,h=>{h.target!==l.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:nt(t.onEscapeKeyDown,h=>{a.onClose(),h.preventDefault()}),onKeyDown:nt(t.onKeyDown,h=>{const m=h.currentTarget.contains(h.target),g=fMe[a.dir].includes(h.key);m&&g&&(i.onOpenChange(!1),l.trigger?.focus(),h.preventDefault())})})})})})});VX.displayName=QX;function UX(t){return t?"open":"closed"}function zy(t){return t==="indeterminate"}function S7(t){return zy(t)?"indeterminate":t?"checked":"unchecked"}function MMe(t){const e=document.activeElement;for(const n of t)if(n===e||(n.focus(),document.activeElement!==e))return}function RMe(t,e){return t.map((n,r)=>t[(e+r)%t.length])}function DMe(t,e,n){const s=e.length>1&&Array.from(e).every(d=>d===e[0])?e[0]:e,i=n?t.indexOf(n):-1;let a=RMe(t,Math.max(i,0));s.length===1&&(a=a.filter(d=>d!==n));const c=a.find(d=>d.toLowerCase().startsWith(s.toLowerCase()));return c!==n?c:void 0}function PMe(t,e){const{x:n,y:r}=t;let s=!1;for(let i=0,a=e.length-1;i<e.length;a=i++){const l=e[i],c=e[a],d=l.x,h=l.y,m=c.x,g=c.y;h>r!=g>r&&n<(m-d)*(r-h)/(g-h)+d&&(s=!s)}return s}function zMe(t,e){if(!e)return!1;const n={x:t.clientX,y:t.clientY};return PMe(n,e)}function Cp(t){return e=>e.pointerType==="mouse"?t(e):void 0}var IMe=NX,LMe=p7,BMe=TX,FMe=EX,qMe=y7,$Me=_X,HMe=rw,QMe=MX,VMe=DX,UMe=zX,WMe=LX,GMe=BX,XMe=FX,YMe=$X,KMe=HX,ZMe=VX,k7="ContextMenu",[JMe]=Ra(k7,[kX]),Gs=kX(),[eRe,WX]=JMe(k7),GX=t=>{const{__scopeContextMenu:e,children:n,onOpenChange:r,dir:s,modal:i=!0}=t,[a,l]=b.useState(!1),c=Gs(e),d=Rs(r),h=b.useCallback(m=>{l(m),d(m)},[d]);return o.jsx(eRe,{scope:e,open:a,onOpenChange:h,modal:i,children:o.jsx(IMe,{...c,dir:s,open:a,onOpenChange:h,modal:i,children:n})})};GX.displayName=k7;var XX="ContextMenuTrigger",YX=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,disabled:r=!1,...s}=t,i=WX(XX,n),a=Gs(n),l=b.useRef({x:0,y:0}),c=b.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...l.current})}),d=b.useRef(0),h=b.useCallback(()=>window.clearTimeout(d.current),[]),m=g=>{l.current={x:g.clientX,y:g.clientY},i.onOpenChange(!0)};return b.useEffect(()=>h,[h]),b.useEffect(()=>void(r&&h()),[r,h]),o.jsxs(o.Fragment,{children:[o.jsx(LMe,{...a,virtualRef:c}),o.jsx(xn.span,{"data-state":i.open?"open":"closed","data-disabled":r?"":void 0,...s,ref:e,style:{WebkitTouchCallout:"none",...t.style},onContextMenu:r?t.onContextMenu:nt(t.onContextMenu,g=>{h(),m(g),g.preventDefault()}),onPointerDown:r?t.onPointerDown:nt(t.onPointerDown,K1(g=>{h(),d.current=window.setTimeout(()=>m(g),700)})),onPointerMove:r?t.onPointerMove:nt(t.onPointerMove,K1(h)),onPointerCancel:r?t.onPointerCancel:nt(t.onPointerCancel,K1(h)),onPointerUp:r?t.onPointerUp:nt(t.onPointerUp,K1(h))})]})});YX.displayName=XX;var tRe="ContextMenuPortal",KX=t=>{const{__scopeContextMenu:e,...n}=t,r=Gs(e);return o.jsx(BMe,{...r,...n})};KX.displayName=tRe;var ZX="ContextMenuContent",JX=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=WX(ZX,n),i=Gs(n),a=b.useRef(!1);return o.jsx(FMe,{...i,...r,ref:e,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:l=>{t.onCloseAutoFocus?.(l),!l.defaultPrevented&&a.current&&l.preventDefault(),a.current=!1},onInteractOutside:l=>{t.onInteractOutside?.(l),!l.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)"}})});JX.displayName=ZX;var nRe="ContextMenuGroup",rRe=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=Gs(n);return o.jsx(qMe,{...s,...r,ref:e})});rRe.displayName=nRe;var sRe="ContextMenuLabel",eY=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=Gs(n);return o.jsx($Me,{...s,...r,ref:e})});eY.displayName=sRe;var iRe="ContextMenuItem",tY=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=Gs(n);return o.jsx(HMe,{...s,...r,ref:e})});tY.displayName=iRe;var aRe="ContextMenuCheckboxItem",nY=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=Gs(n);return o.jsx(QMe,{...s,...r,ref:e})});nY.displayName=aRe;var oRe="ContextMenuRadioGroup",lRe=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=Gs(n);return o.jsx(VMe,{...s,...r,ref:e})});lRe.displayName=oRe;var cRe="ContextMenuRadioItem",rY=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=Gs(n);return o.jsx(UMe,{...s,...r,ref:e})});rY.displayName=cRe;var uRe="ContextMenuItemIndicator",sY=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=Gs(n);return o.jsx(WMe,{...s,...r,ref:e})});sY.displayName=uRe;var dRe="ContextMenuSeparator",iY=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=Gs(n);return o.jsx(GMe,{...s,...r,ref:e})});iY.displayName=dRe;var hRe="ContextMenuArrow",fRe=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=Gs(n);return o.jsx(XMe,{...s,...r,ref:e})});fRe.displayName=hRe;var aY="ContextMenuSub",oY=t=>{const{__scopeContextMenu:e,children:n,onOpenChange:r,open:s,defaultOpen:i}=t,a=Gs(e),[l,c]=Xl({prop:s,defaultProp:i??!1,onChange:r,caller:aY});return o.jsx(YMe,{...a,open:l,onOpenChange:c,children:n})};oY.displayName=aY;var mRe="ContextMenuSubTrigger",lY=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=Gs(n);return o.jsx(KMe,{...s,...r,ref:e})});lY.displayName=mRe;var pRe="ContextMenuSubContent",cY=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=Gs(n);return o.jsx(ZMe,{...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)"}})});cY.displayName=pRe;function K1(t){return e=>e.pointerType!=="mouse"?t(e):void 0}var gRe=GX,xRe=YX,vRe=KX,uY=JX,dY=eY,hY=tY,fY=nY,mY=rY,pY=sY,gY=iY,yRe=oY,xY=lY,vY=cY;const bRe=gRe,wRe=xRe,SRe=yRe,yY=b.forwardRef(({className:t,inset:e,children:n,...r},s)=>o.jsxs(xY,{ref:s,className:xe("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,o.jsx(yd,{className:"ml-auto h-4 w-4"})]}));yY.displayName=xY.displayName;const bY=b.forwardRef(({className:t,...e},n)=>o.jsx(vY,{ref:n,className:xe("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}));bY.displayName=vY.displayName;const wY=b.forwardRef(({className:t,...e},n)=>o.jsx(vRe,{children:o.jsx(uY,{ref:n,className:xe("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})}));wY.displayName=uY.displayName;const qa=b.forwardRef(({className:t,inset:e,...n},r)=>o.jsx(hY,{ref:r,className:xe("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}));qa.displayName=hY.displayName;const kRe=b.forwardRef(({className:t,children:e,checked:n,...r},s)=>o.jsxs(fY,{ref:s,className:xe("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:[o.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:o.jsx(pY,{children:o.jsx(Ro,{className:"h-4 w-4"})})}),e]}));kRe.displayName=fY.displayName;const ORe=b.forwardRef(({className:t,children:e,...n},r)=>o.jsxs(mY,{ref:r,className:xe("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:[o.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:o.jsx(pY,{children:o.jsx(ute,{className:"h-2 w-2 fill-current"})})}),e]}));ORe.displayName=mY.displayName;const jRe=b.forwardRef(({className:t,inset:e,...n},r)=>o.jsx(dY,{ref:r,className:xe("px-2 py-1.5 text-sm font-semibold text-foreground",e&&"pl-8",t),...n}));jRe.displayName=dY.displayName;const v0=b.forwardRef(({className:t,...e},n)=>o.jsx(gY,{ref:n,className:xe("-mx-1 my-1 h-px bg-border",t),...e}));v0.displayName=gY.displayName;const jh=({className:t,...e})=>o.jsx("span",{className:xe("ml-auto text-xs tracking-widest text-muted-foreground",t),...e});jh.displayName="ContextMenuShortcut";var NRe=Symbol("radix.slottable");function CRe(t){const e=({children:n})=>o.jsx(o.Fragment,{children:n});return e.displayName=`${t}.Slottable`,e.__radixId=NRe,e}var[sw]=Ra("Tooltip",[vf]),iw=vf(),SY="TooltipProvider",TRe=700,uj="tooltip.open",[ERe,O7]=sw(SY),kY=t=>{const{__scopeTooltip:e,delayDuration:n=TRe,skipDelayDuration:r=300,disableHoverableContent:s=!1,children:i}=t,a=b.useRef(!0),l=b.useRef(!1),c=b.useRef(0);return b.useEffect(()=>{const d=c.current;return()=>window.clearTimeout(d)},[]),o.jsx(ERe,{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:l,onPointerInTransitChange:b.useCallback(d=>{l.current=d},[]),disableHoverableContent:s,children:i})};kY.displayName=SY;var Tp="Tooltip",[_Re,Ng]=sw(Tp),OY=t=>{const{__scopeTooltip:e,children:n,open:r,defaultOpen:s,onOpenChange:i,disableHoverableContent:a,delayDuration:l}=t,c=O7(Tp,t.__scopeTooltip),d=iw(e),[h,m]=b.useState(null),g=Ui(),x=b.useRef(0),y=a??c.disableHoverableContent,w=l??c.delayDuration,S=b.useRef(!1),[k,j]=Xl({prop:r,defaultProp:s??!1,onChange:A=>{A?(c.onOpen(),document.dispatchEvent(new CustomEvent(uj))):c.onClose(),i?.(A)},caller:Tp}),N=b.useMemo(()=>k?S.current?"delayed-open":"instant-open":"closed",[k]),T=b.useCallback(()=>{window.clearTimeout(x.current),x.current=0,S.current=!1,j(!0)},[j]),E=b.useCallback(()=>{window.clearTimeout(x.current),x.current=0,j(!1)},[j]),_=b.useCallback(()=>{window.clearTimeout(x.current),x.current=window.setTimeout(()=>{S.current=!0,j(!0),x.current=0},w)},[w,j]);return b.useEffect(()=>()=>{x.current&&(window.clearTimeout(x.current),x.current=0)},[]),o.jsx(Vy,{...d,children:o.jsx(_Re,{scope:e,contentId:g,open:k,stateAttribute:N,trigger:h,onTriggerChange:m,onTriggerEnter:b.useCallback(()=>{c.isOpenDelayedRef.current?_():T()},[c.isOpenDelayedRef,_,T]),onTriggerLeave:b.useCallback(()=>{y?E():(window.clearTimeout(x.current),x.current=0)},[E,y]),onOpen:T,onClose:E,disableHoverableContent:y,children:n})})};OY.displayName=Tp;var dj="TooltipTrigger",jY=b.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,s=Ng(dj,n),i=O7(dj,n),a=iw(n),l=b.useRef(null),c=Yn(e,l,s.onTriggerChange),d=b.useRef(!1),h=b.useRef(!1),m=b.useCallback(()=>d.current=!1,[]);return b.useEffect(()=>()=>document.removeEventListener("pointerup",m),[m]),o.jsx(Uy,{asChild:!0,...a,children:o.jsx(xn.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...r,ref:c,onPointerMove:nt(t.onPointerMove,g=>{g.pointerType!=="touch"&&!h.current&&!i.isPointerInTransitRef.current&&(s.onTriggerEnter(),h.current=!0)}),onPointerLeave:nt(t.onPointerLeave,()=>{s.onTriggerLeave(),h.current=!1}),onPointerDown:nt(t.onPointerDown,()=>{s.open&&s.onClose(),d.current=!0,document.addEventListener("pointerup",m,{once:!0})}),onFocus:nt(t.onFocus,()=>{d.current||s.onOpen()}),onBlur:nt(t.onBlur,s.onClose),onClick:nt(t.onClick,s.onClose)})})});jY.displayName=dj;var j7="TooltipPortal",[ARe,MRe]=sw(j7,{forceMount:void 0}),NY=t=>{const{__scopeTooltip:e,forceMount:n,children:r,container:s}=t,i=Ng(j7,e);return o.jsx(ARe,{scope:e,forceMount:n,children:o.jsx(ii,{present:n||i.open,children:o.jsx(Qy,{asChild:!0,container:s,children:r})})})};NY.displayName=j7;var xf="TooltipContent",CY=b.forwardRef((t,e)=>{const n=MRe(xf,t.__scopeTooltip),{forceMount:r=n.forceMount,side:s="top",...i}=t,a=Ng(xf,t.__scopeTooltip);return o.jsx(ii,{present:r||a.open,children:a.disableHoverableContent?o.jsx(TY,{side:s,...i,ref:e}):o.jsx(RRe,{side:s,...i,ref:e})})}),RRe=b.forwardRef((t,e)=>{const n=Ng(xf,t.__scopeTooltip),r=O7(xf,t.__scopeTooltip),s=b.useRef(null),i=Yn(e,s),[a,l]=b.useState(null),{trigger:c,onClose:d}=n,h=s.current,{onPointerInTransitChange:m}=r,g=b.useCallback(()=>{l(null),m(!1)},[m]),x=b.useCallback((y,w)=>{const S=y.currentTarget,k={x:y.clientX,y:y.clientY},j=LRe(k,S.getBoundingClientRect()),N=BRe(k,j),T=FRe(w.getBoundingClientRect()),E=$Re([...N,...T]);l(E),m(!0)},[m]);return b.useEffect(()=>()=>g(),[g]),b.useEffect(()=>{if(c&&h){const y=S=>x(S,h),w=S=>x(S,c);return c.addEventListener("pointerleave",y),h.addEventListener("pointerleave",w),()=>{c.removeEventListener("pointerleave",y),h.removeEventListener("pointerleave",w)}}},[c,h,x,g]),b.useEffect(()=>{if(a){const y=w=>{const S=w.target,k={x:w.clientX,y:w.clientY},j=c?.contains(S)||h?.contains(S),N=!qRe(k,a);j?g():N&&(g(),d())};return document.addEventListener("pointermove",y),()=>document.removeEventListener("pointermove",y)}},[c,h,a,d,g]),o.jsx(TY,{...t,ref:i})}),[DRe,PRe]=sw(Tp,{isInside:!1}),zRe=CRe("TooltipContent"),TY=b.forwardRef((t,e)=>{const{__scopeTooltip:n,children:r,"aria-label":s,onEscapeKeyDown:i,onPointerDownOutside:a,...l}=t,c=Ng(xf,n),d=iw(n),{onClose:h}=c;return b.useEffect(()=>(document.addEventListener(uj,h),()=>document.removeEventListener(uj,h)),[h]),b.useEffect(()=>{if(c.trigger){const m=g=>{g.target?.contains(c.trigger)&&h()};return window.addEventListener("scroll",m,{capture:!0}),()=>window.removeEventListener("scroll",m,{capture:!0})}},[c.trigger,h]),o.jsx(Cj,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:m=>m.preventDefault(),onDismiss:h,children:o.jsxs(Tj,{"data-state":c.stateAttribute,...d,...l,ref:e,style:{...l.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[o.jsx(zRe,{children:r}),o.jsx(DRe,{scope:n,isInside:!0,children:o.jsx(Dee,{id:c.contentId,role:"tooltip",children:s||r})})]})})});CY.displayName=xf;var EY="TooltipArrow",IRe=b.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,s=iw(n);return PRe(EY,n).isInside?null:o.jsx(Ej,{...s,...r,ref:e})});IRe.displayName=EY;function LRe(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 BRe(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 FRe(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 qRe(t,e){const{x:n,y:r}=t;let s=!1;for(let i=0,a=e.length-1;i<e.length;a=i++){const l=e[i],c=e[a],d=l.x,h=l.y,m=c.x,g=c.y;h>r!=g>r&&n<(m-d)*(r-h)/(g-h)+d&&(s=!s)}return s}function $Re(t){const e=t.slice();return e.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),HRe(e)}function HRe(t){if(t.length<=1)return t.slice();const e=[];for(let r=0;r<t.length;r++){const s=t[r];for(;e.length>=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 QRe=kY,VRe=OY,URe=jY,WRe=NY,_Y=CY;const GRe=QRe,XRe=VRe,YRe=URe,AY=b.forwardRef(({className:t,sideOffset:e=4,...n},r)=>o.jsx(WRe,{children:o.jsx(_Y,{ref:r,sideOffset:e,className:xe("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})}));AY.displayName=_Y.displayName;function KRe({children:t}){uie();const[e,n]=b.useState(!0),[r,s]=b.useState(!1),[i,a]=b.useState(!1),{theme:l,setTheme:c}=Vj(),d=xJ(),h=Zi();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:D0,label:"首页",path:"/"}]},{title:"麦麦配置编辑",items:[{icon:zl,label:"麦麦主程序配置",path:"/config/bot"},{icon:kI,label:"AI模型厂商配置",path:"/config/modelProvider",tourId:"sidebar-model-provider"},{icon:OI,label:"模型管理与分配",path:"/config/model",tourId:"sidebar-model-management"},{icon:k9,label:"麦麦适配器配置",path:"/config/adapter"}]},{title:"麦麦资源管理",items:[{icon:_j,label:"表情包管理",path:"/resource/emoji"},{icon:Wh,label:"表达方式管理",path:"/resource/expression"},{icon:jI,label:"人物信息管理",path:"/resource/person"},{icon:SI,label:"知识库图谱可视化",path:"/resource/knowledge-graph"}]},{title:"扩展与监控",items:[{icon:Gh,label:"插件市场",path:"/plugins"},{icon:k9,label:"插件配置",path:"/plugin-config"},{icon:Pv,label:"日志查看器",path:"/logs"},{icon:Wh,label:"本地聊天室",path:"/chat"}]},{title:"系统",items:[{icon:Xu,label:"系统设置",path:"/settings"}]}],x=l==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":l,y=()=>{localStorage.removeItem("access-token"),h({to:"/auth"})};return o.jsx(GRe,{delayDuration:300,children:o.jsxs("div",{className:"flex h-screen overflow-hidden",children:[o.jsxs("aside",{className:xe("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:[o.jsx("div",{className:"flex h-16 items-center border-b px-4",children:o.jsxs("div",{className:xe("relative flex items-center justify-center flex-1 transition-all overflow-hidden","lg:flex-1",!e&&"lg:flex-none lg:w-8"),children:[o.jsxs("div",{className:xe("flex items-baseline gap-2",!e&&"lg:hidden"),children:[o.jsx("span",{className:"font-bold text-xl text-primary-gradient whitespace-nowrap",children:"MaiBot WebUI"}),o.jsx("span",{className:"text-xs text-primary/60 whitespace-nowrap",children:Fse()})]}),!e&&o.jsx("span",{className:"hidden lg:block font-bold text-primary-gradient text-2xl",children:"M"})]})}),o.jsx(gn,{className:xe("flex-1 overflow-x-hidden",!e&&"lg:w-16"),children:o.jsx("nav",{className:xe("p-4",!e&&"lg:p-2 lg:w-16"),children:o.jsx("ul",{className:xe("space-y-6",!e&&"lg:space-y-3 lg:w-full"),children:m.map((w,S)=>o.jsxs("li",{children:[o.jsx("div",{className:xe("px-3 h-[1.25rem]","mb-2",!e&&"lg:mb-1 lg:invisible"),children:o.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground/60 whitespace-nowrap",children:w.title})}),!e&&S>0&&o.jsx("div",{className:"hidden lg:block mb-2 border-t border-border"}),o.jsx("ul",{className:"space-y-1",children:w.items.map(k=>{const j=d({to:k.path}),N=k.icon,T=o.jsxs(o.Fragment,{children:[j&&o.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"}),o.jsxs("div",{className:xe("flex items-center transition-all duration-300",e?"gap-3":"gap-3 lg:gap-0"),children:[o.jsx(N,{className:xe("h-5 w-5 flex-shrink-0",j&&"text-primary"),strokeWidth:2,fill:"none"}),o.jsx("span",{className:xe("text-sm font-medium whitespace-nowrap transition-all duration-300",j&&"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 o.jsx("li",{className:"relative",children:o.jsxs(XRe,{children:[o.jsx(YRe,{asChild:!0,children:o.jsx(vJ,{to:k.path,"data-tour":k.tourId,className:xe("relative flex items-center rounded-lg py-2 transition-all duration-300","hover:bg-accent hover:text-accent-foreground",j?"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&&o.jsx(AY,{side:"right",className:"hidden lg:block",children:o.jsx("p",{children:k.label})})]})},k.path)})})]},w.title))})})})]}),r&&o.jsx("div",{className:"fixed inset-0 z-40 bg-black/50 lg:hidden",onClick:()=>s(!1)}),o.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[o.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:[o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsx("button",{onClick:()=>s(!r),className:"rounded-lg p-2 hover:bg-accent lg:hidden",children:o.jsx(dte,{className:"h-5 w-5"})}),o.jsx("button",{onClick:()=>n(!e),className:"hidden rounded-lg p-2 hover:bg-accent lg:block",title:e?"收起侧边栏":"展开侧边栏",children:o.jsx(vd,{className:xe("h-5 w-5 transition-transform",!e&&"rotate-180")})})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.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:[o.jsx(Ni,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),o.jsx("span",{className:"text-sm text-muted-foreground",children:"搜索..."}),o.jsxs(wX,{size:"sm",className:"absolute right-2 top-1/2 -translate-y-1/2",children:[o.jsx("span",{className:"text-xs",children:"⌘"}),"K"]})]}),o.jsx(rMe,{open:i,onOpenChange:a}),o.jsxs(de,{variant:"ghost",size:"sm",onClick:()=>window.open("https://docs.mai-mai.org","_blank"),className:"gap-2",title:"查看麦麦文档",children:[o.jsx(hte,{className:"h-4 w-4"}),o.jsx("span",{className:"hidden sm:inline",children:"麦麦文档"})]}),o.jsx("button",{onClick:w=>{jse(x==="dark"?"light":"dark",c,w)},className:"rounded-lg p-2 hover:bg-accent",title:x==="dark"?"切换到浅色模式":"切换到深色模式",children:x==="dark"?o.jsx(nk,{className:"h-5 w-5"}):o.jsx(rk,{className:"h-5 w-5"})}),o.jsx("div",{className:"h-6 w-px bg-border"}),o.jsxs(de,{variant:"ghost",size:"sm",onClick:y,className:"gap-2",title:"登出系统",children:[o.jsx(O9,{className:"h-4 w-4"}),o.jsx("span",{className:"hidden sm:inline",children:"登出"})]})]})]}),o.jsxs(bRe,{children:[o.jsx(wRe,{asChild:!0,children:o.jsx("main",{className:"flex-1 overflow-hidden bg-background",children:t})}),o.jsxs(wY,{className:"w-64",children:[o.jsxs(qa,{onClick:()=>h({to:"/"}),children:[o.jsx(D0,{className:"mr-2 h-4 w-4"}),"首页"]}),o.jsxs(qa,{onClick:()=>h({to:"/settings"}),children:[o.jsx(Xu,{className:"mr-2 h-4 w-4"}),"系统设置"]}),o.jsxs(qa,{onClick:()=>h({to:"/logs"}),children:[o.jsx(Pv,{className:"mr-2 h-4 w-4"}),"日志查看器"]}),o.jsx(v0,{}),o.jsxs(SRe,{children:[o.jsxs(yY,{children:[o.jsx(yI,{className:"mr-2 h-4 w-4"}),"切换主题"]}),o.jsxs(bY,{className:"w-48",children:[o.jsxs(qa,{onClick:()=>c("light"),disabled:l==="light",children:[o.jsx(nk,{className:"mr-2 h-4 w-4"}),"浅色",l==="light"&&o.jsx(jh,{children:"✓"})]}),o.jsxs(qa,{onClick:()=>c("dark"),disabled:l==="dark",children:[o.jsx(rk,{className:"mr-2 h-4 w-4"}),"深色",l==="dark"&&o.jsx(jh,{children:"✓"})]}),o.jsxs(qa,{onClick:()=>c("system"),disabled:l==="system",children:[o.jsx(Xu,{className:"mr-2 h-4 w-4"}),"跟随系统",l==="system"&&o.jsx(jh,{children:"✓"})]})]})]}),o.jsx(v0,{}),o.jsxs(qa,{onClick:()=>window.location.reload(),children:[o.jsx(fte,{className:"mr-2 h-4 w-4"}),"刷新页面",o.jsx(jh,{children:"⌘R"})]}),o.jsxs(qa,{onClick:()=>a(!0),children:[o.jsx(Ni,{className:"mr-2 h-4 w-4"}),"搜索",o.jsx(jh,{children:"⌘K"})]}),o.jsx(v0,{}),o.jsxs(qa,{onClick:()=>window.open("https://docs.mai-mai.org","_blank"),children:[o.jsx(Ah,{className:"mr-2 h-4 w-4"}),"麦麦文档"]}),o.jsx(v0,{}),o.jsxs(qa,{onClick:y,className:"text-destructive focus:text-destructive",children:[o.jsx(O9,{className:"mr-2 h-4 w-4"}),"登出系统"]})]})]})]})]})})}var aw="Collapsible",[ZRe]=Ra(aw),[JRe,N7]=ZRe(aw),MY=b.forwardRef((t,e)=>{const{__scopeCollapsible:n,open:r,defaultOpen:s,disabled:i,onOpenChange:a,...l}=t,[c,d]=Xl({prop:r,defaultProp:s??!1,onChange:a,caller:aw});return o.jsx(JRe,{scope:n,disabled:i,contentId:Ui(),open:c,onOpenToggle:b.useCallback(()=>d(h=>!h),[d]),children:o.jsx(xn.div,{"data-state":T7(c),"data-disabled":i?"":void 0,...l,ref:e})})});MY.displayName=aw;var RY="CollapsibleTrigger",DY=b.forwardRef((t,e)=>{const{__scopeCollapsible:n,...r}=t,s=N7(RY,n);return o.jsx(xn.button,{type:"button","aria-controls":s.contentId,"aria-expanded":s.open||!1,"data-state":T7(s.open),"data-disabled":s.disabled?"":void 0,disabled:s.disabled,...r,ref:e,onClick:nt(t.onClick,s.onOpenToggle)})});DY.displayName=RY;var C7="CollapsibleContent",PY=b.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=N7(C7,t.__scopeCollapsible);return o.jsx(ii,{present:n||s.open,children:({present:i})=>o.jsx(eDe,{...r,ref:e,present:i})})});PY.displayName=C7;var eDe=b.forwardRef((t,e)=>{const{__scopeCollapsible:n,present:r,children:s,...i}=t,a=N7(C7,n),[l,c]=b.useState(r),d=b.useRef(null),h=Yn(e,d),m=b.useRef(0),g=m.current,x=b.useRef(0),y=x.current,w=a.open||l,S=b.useRef(w),k=b.useRef(void 0);return b.useEffect(()=>{const j=requestAnimationFrame(()=>S.current=!1);return()=>cancelAnimationFrame(j)},[]),Uh(()=>{const j=d.current;if(j){k.current=k.current||{transitionDuration:j.style.transitionDuration,animationName:j.style.animationName},j.style.transitionDuration="0s",j.style.animationName="none";const N=j.getBoundingClientRect();m.current=N.height,x.current=N.width,S.current||(j.style.transitionDuration=k.current.transitionDuration,j.style.animationName=k.current.animationName),c(r)}},[a.open,r]),o.jsx(xn.div,{"data-state":T7(a.open),"data-disabled":a.disabled?"":void 0,id:a.contentId,hidden:!w,...i,ref:h,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 T7(t){return t?"open":"closed"}var tDe=MY;const Pz=tDe,zz=DY,Iz=PY;function nDe(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]||"<anonymous>",fileName:i[2],lineNumber:i[3],columnNumber:i[4],raw:s}):n.push({functionName:"<unknown>",fileName:"",lineNumber:"",columnNumber:"",raw:s})}return n}function rDe({error:t,errorInfo:e}){const[n,r]=b.useState(!0),[s,i]=b.useState(!1),[a,l]=b.useState(!1),c=t.stack?nDe(t.stack):[],d=async()=>{const h=`
Error: ${t.name}
Message: ${t.message}
Stack Trace:
${t.stack||"No stack trace available"}
Component Stack:
${e?.componentStack||"No component stack available"}
URL: ${window.location.href}
User Agent: ${navigator.userAgent}
Time: ${new Date().toISOString()}
`.trim();try{await navigator.clipboard.writeText(h),l(!0),setTimeout(()=>l(!1),2e3)}catch(m){console.error("Failed to copy:",m)}};return o.jsxs("div",{className:"space-y-4",children:[o.jsxs(ga,{variant:"destructive",className:"border-red-500/50 bg-red-500/10",children:[o.jsx(Wa,{className:"h-4 w-4"}),o.jsxs(xa,{className:"font-mono text-sm",children:[o.jsxs("span",{className:"font-semibold",children:[t.name,":"]})," ",t.message]})]}),c.length>0&&o.jsxs(Pz,{open:n,onOpenChange:r,children:[o.jsx(zz,{asChild:!0,children:o.jsxs(de,{variant:"ghost",className:"w-full justify-between p-3 h-auto",children:[o.jsxs("span",{className:"font-semibold text-sm flex items-center gap-2",children:[o.jsx(mte,{className:"h-4 w-4"}),"Stack Trace (",c.length," frames)"]}),n?o.jsx(P0,{className:"h-4 w-4"}):o.jsx(nd,{className:"h-4 w-4"})]})}),o.jsx(Iz,{children:o.jsx(gn,{className:"h-[280px] rounded-md border bg-muted/30",children:o.jsx("div",{className:"p-3 space-y-1",children:c.map((h,m)=>o.jsx("div",{className:"font-mono text-xs p-2 rounded hover:bg-muted/50 transition-colors",children:o.jsxs("div",{className:"flex items-start gap-2",children:[o.jsxs("span",{className:"text-muted-foreground w-6 text-right flex-shrink-0",children:[m+1,"."]}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("span",{className:"text-primary font-medium",children:h.functionName}),h.fileName&&o.jsxs("div",{className:"text-muted-foreground mt-0.5 break-all",children:[h.fileName,h.lineNumber&&o.jsxs("span",{className:"text-yellow-600 dark:text-yellow-400",children:[":",h.lineNumber,":",h.columnNumber]})]})]})]})},m))})})})]}),e?.componentStack&&o.jsxs(Pz,{open:s,onOpenChange:i,children:[o.jsx(zz,{asChild:!0,children:o.jsxs(de,{variant:"ghost",className:"w-full justify-between p-3 h-auto",children:[o.jsxs("span",{className:"font-semibold text-sm flex items-center gap-2",children:[o.jsx(Wa,{className:"h-4 w-4"}),"Component Stack"]}),s?o.jsx(P0,{className:"h-4 w-4"}):o.jsx(nd,{className:"h-4 w-4"})]})}),o.jsx(Iz,{children:o.jsx(gn,{className:"h-[200px] rounded-md border bg-muted/30",children:o.jsx("pre",{className:"p-3 font-mono text-xs whitespace-pre-wrap text-muted-foreground",children:e.componentStack})})})]}),o.jsx(de,{variant:"outline",size:"sm",onClick:d,className:"w-full",children:a?o.jsxs(o.Fragment,{children:[o.jsx(Ro,{className:"mr-2 h-4 w-4 text-green-500"}),"已复制到剪贴板"]}):o.jsxs(o.Fragment,{children:[o.jsx(Mv,{className:"mr-2 h-4 w-4"}),"复制错误信息"]})})]})}function zY({error:t,errorInfo:e}){const n=()=>{window.location.href="/"},r=()=>{window.location.reload()};return o.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background p-4",children:o.jsxs(qt,{className:"w-full max-w-2xl shadow-lg",children:[o.jsxs(Fn,{className:"text-center pb-2",children:[o.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:o.jsx(Wa,{className:"h-8 w-8 text-red-600 dark:text-red-400"})}),o.jsx(qn,{className:"text-2xl font-bold",children:"页面出现了问题"}),o.jsx(ts,{className:"text-base mt-2",children:"应用程序遇到了意外错误。您可以尝试刷新页面或返回首页。"})]}),o.jsxs(Gn,{className:"space-y-4",children:[o.jsx(rDe,{error:t,errorInfo:e}),o.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 pt-2",children:[o.jsxs(de,{onClick:r,className:"flex-1",children:[o.jsx(Ps,{className:"mr-2 h-4 w-4"}),"刷新页面"]}),o.jsxs(de,{onClick:n,variant:"outline",className:"flex-1",children:[o.jsx(D0,{className:"mr-2 h-4 w-4"}),"返回首页"]})]}),o.jsx("p",{className:"text-xs text-center text-muted-foreground pt-2",children:"如果问题持续存在,请将错误信息复制并反馈给开发者"})]})]})})}class sDe 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:o.jsx(zY,{error:this.state.error,errorInfo:this.state.errorInfo}):this.props.children}}function IY({error:t}){return o.jsx(zY,{error:t,errorInfo:null})}const Cg=yJ({component:()=>o.jsxs(o.Fragment,{children:[o.jsx(Bz,{}),!1]}),beforeLoad:()=>{if(window.location.pathname==="/"&&!CB())throw wJ({to:"/auth"})}}),iDe=ms({getParentRoute:()=>Cg,path:"/auth",component:die}),aDe=ms({getParentRoute:()=>Cg,path:"/setup",component:Die}),Xs=ms({getParentRoute:()=>Cg,id:"protected",component:()=>o.jsx(KRe,{children:o.jsx(Bz,{})}),errorComponent:({error:t})=>o.jsx(IY,{error:t})}),oDe=ms({getParentRoute:()=>Xs,path:"/",component:kse}),lDe=ms({getParentRoute:()=>Xs,path:"/config/bot",component:M0e}),cDe=ms({getParentRoute:()=>Xs,path:"/config/modelProvider",component:Zxe}),uDe=ms({getParentRoute:()=>Xs,path:"/config/model",component:Hve}),dDe=ms({getParentRoute:()=>Xs,path:"/config/adapter",component:Vve}),hDe=ms({getParentRoute:()=>Xs,path:"/resource/emoji",component:pOe}),fDe=ms({getParentRoute:()=>Xs,path:"/resource/expression",component:NOe}),mDe=ms({getParentRoute:()=>Xs,path:"/resource/person",component:IOe}),pDe=ms({getParentRoute:()=>Xs,path:"/resource/knowledge-graph",component:CTe}),gDe=ms({getParentRoute:()=>Xs,path:"/logs",component:vAe}),xDe=ms({getParentRoute:()=>Xs,path:"/chat",component:eMe}),vDe=ms({getParentRoute:()=>Xs,path:"/plugins",component:IAe}),yDe=ms({getParentRoute:()=>Xs,path:"/plugin-config",component:LAe}),bDe=ms({getParentRoute:()=>Xs,path:"/plugin-mirrors",component:BAe}),wDe=ms({getParentRoute:()=>Xs,path:"/settings",component:rie}),SDe=ms({getParentRoute:()=>Cg,path:"*",component:_B}),kDe=Cg.addChildren([iDe,aDe,Xs.addChildren([oDe,lDe,cDe,uDe,dDe,hDe,fDe,mDe,pDe,vDe,yDe,bDe,gDe,xDe,wDe]),SDe]),ODe=bJ({routeTree:kDe,defaultNotFoundComponent:_B,defaultErrorComponent:({error:t})=>o.jsx(IY,{error:t})});function jDe({children:t,defaultTheme:e="system",storageKey:n="ui-theme",...r}){const[s,i]=b.useState(()=>localStorage.getItem(n)||e);b.useEffect(()=>{const l=window.document.documentElement;if(l.classList.remove("light","dark"),s==="system"){const c=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";l.classList.add(c);return}l.classList.add(s)},[s]),b.useEffect(()=>{const l=localStorage.getItem("accent-color");if(l){const c=document.documentElement,h={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%)"}}[l];h&&(c.style.setProperty("--primary",h.hsl),h.gradient?(c.style.setProperty("--primary-gradient",h.gradient),c.classList.add("has-gradient")):(c.style.removeProperty("--primary-gradient"),c.classList.remove("has-gradient")))}},[]);const a={theme:s,setTheme:l=>{localStorage.setItem(n,l),i(l)}};return o.jsx(KL.Provider,{...r,value:a,children:t})}function NDe({children:t,defaultEnabled:e=!0,defaultWavesEnabled:n=!0,storageKey:r="enable-animations",wavesStorageKey:s="enable-waves-background"}){const[i,a]=b.useState(()=>{const h=localStorage.getItem(r);return h!==null?h==="true":e}),[l,c]=b.useState(()=>{const h=localStorage.getItem(s);return h!==null?h==="true":n});b.useEffect(()=>{const h=document.documentElement;i?h.classList.remove("no-animations"):h.classList.add("no-animations"),localStorage.setItem(r,String(i))},[i,r]),b.useEffect(()=>{localStorage.setItem(s,String(l))},[l,s]);const d={enableAnimations:i,setEnableAnimations:a,enableWavesBackground:l,setEnableWavesBackground:c};return o.jsx(ZL.Provider,{value:d,children:t})}var E7="ToastProvider",[_7,CDe,TDe]=By("Toast"),[LY]=Ra("Toast",[TDe]),[EDe,ow]=LY(E7),BY=t=>{const{__scopeToast:e,label:n="Notification",duration:r=5e3,swipeDirection:s="right",swipeThreshold:i=50,children:a}=t,[l,c]=b.useState(null),[d,h]=b.useState(0),m=b.useRef(!1),g=b.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${E7}\`. Expected non-empty \`string\`.`),o.jsx(_7.Provider,{scope:e,children:o.jsx(EDe,{scope:e,label:n,duration:r,swipeDirection:s,swipeThreshold:i,toastCount:d,viewport:l,onViewportChange:c,onToastAdd:b.useCallback(()=>h(x=>x+1),[]),onToastRemove:b.useCallback(()=>h(x=>x-1),[]),isFocusedToastEscapeKeyDownRef:m,isClosePausedRef:g,children:a})})};BY.displayName=E7;var FY="ToastViewport",_De=["F8"],hj="toast.viewportPause",fj="toast.viewportResume",qY=b.forwardRef((t,e)=>{const{__scopeToast:n,hotkey:r=_De,label:s="Notifications ({hotkey})",...i}=t,a=ow(FY,n),l=CDe(n),c=b.useRef(null),d=b.useRef(null),h=b.useRef(null),m=b.useRef(null),g=Yn(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(N=>k[N]||k.code===N)&&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 j=()=>{if(!a.isClosePausedRef.current){const _=new CustomEvent(hj);k.dispatchEvent(_),a.isClosePausedRef.current=!0}},N=()=>{if(a.isClosePausedRef.current){const _=new CustomEvent(fj);k.dispatchEvent(_),a.isClosePausedRef.current=!1}},T=_=>{!S.contains(_.relatedTarget)&&N()},E=()=>{S.contains(document.activeElement)||N()};return S.addEventListener("focusin",j),S.addEventListener("focusout",T),S.addEventListener("pointermove",j),S.addEventListener("pointerleave",E),window.addEventListener("blur",j),window.addEventListener("focus",N),()=>{S.removeEventListener("focusin",j),S.removeEventListener("focusout",T),S.removeEventListener("pointermove",j),S.removeEventListener("pointerleave",E),window.removeEventListener("blur",j),window.removeEventListener("focus",N)}}},[y,a.isClosePausedRef]);const w=b.useCallback(({tabbingDirection:S})=>{const j=l().map(N=>{const T=N.ref.current,E=[T,...HDe(T)];return S==="forwards"?E:E.reverse()});return(S==="forwards"?j.reverse():j).flat()},[l]);return b.useEffect(()=>{const S=m.current;if(S){const k=j=>{const N=j.altKey||j.ctrlKey||j.metaKey;if(j.key==="Tab"&&!N){const E=document.activeElement,_=j.shiftKey;if(j.target===S&&_){d.current?.focus();return}const P=w({tabbingDirection:_?"backwards":"forwards"}),B=P.findIndex($=>$===E);J3(P.slice(B+1))?j.preventDefault():_?d.current?.focus():h.current?.focus()}};return S.addEventListener("keydown",k),()=>S.removeEventListener("keydown",k)}},[l,w]),o.jsxs(Pee,{ref:c,role:"region","aria-label":s.replace("{hotkey}",x),tabIndex:-1,style:{pointerEvents:y?void 0:"none"},children:[y&&o.jsx(mj,{ref:d,onFocusFromOutsideViewport:()=>{const S=w({tabbingDirection:"forwards"});J3(S)}}),o.jsx(_7.Slot,{scope:n,children:o.jsx(xn.ol,{tabIndex:-1,...i,ref:g})}),y&&o.jsx(mj,{ref:h,onFocusFromOutsideViewport:()=>{const S=w({tabbingDirection:"backwards"});J3(S)}})]})});qY.displayName=FY;var $Y="ToastFocusProxy",mj=b.forwardRef((t,e)=>{const{__scopeToast:n,onFocusFromOutsideViewport:r,...s}=t,i=ow($Y,n);return o.jsx(vI,{tabIndex:0,...s,ref:e,style:{position:"fixed"},onFocus:a=>{const l=a.relatedTarget;!i.viewport?.contains(l)&&r()}})});mj.displayName=$Y;var Tg="Toast",ADe="toast.swipeStart",MDe="toast.swipeMove",RDe="toast.swipeCancel",DDe="toast.swipeEnd",HY=b.forwardRef((t,e)=>{const{forceMount:n,open:r,defaultOpen:s,onOpenChange:i,...a}=t,[l,c]=Xl({prop:r,defaultProp:s??!0,onChange:i,caller:Tg});return o.jsx(ii,{present:n||l,children:o.jsx(IDe,{open:l,...a,ref:e,onClose:()=>c(!1),onPause:Rs(t.onPause),onResume:Rs(t.onResume),onSwipeStart:nt(t.onSwipeStart,d=>{d.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:nt(t.onSwipeMove,d=>{const{x:h,y:m}=d.detail.delta;d.currentTarget.setAttribute("data-swipe","move"),d.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${h}px`),d.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${m}px`)}),onSwipeCancel:nt(t.onSwipeCancel,d=>{d.currentTarget.setAttribute("data-swipe","cancel"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),d.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),d.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:nt(t.onSwipeEnd,d=>{const{x:h,y:m}=d.detail.delta;d.currentTarget.setAttribute("data-swipe","end"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),d.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${h}px`),d.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${m}px`),c(!1)})})})});HY.displayName=Tg;var[PDe,zDe]=LY(Tg,{onClose(){}}),IDe=b.forwardRef((t,e)=>{const{__scopeToast:n,type:r="foreground",duration:s,open:i,onClose:a,onEscapeKeyDown:l,onPause:c,onResume:d,onSwipeStart:h,onSwipeMove:m,onSwipeCancel:g,onSwipeEnd:x,...y}=t,w=ow(Tg,n),[S,k]=b.useState(null),j=Yn(e,z=>k(z)),N=b.useRef(null),T=b.useRef(null),E=s||w.duration,_=b.useRef(0),A=b.useRef(E),L=b.useRef(0),{onToastAdd:P,onToastRemove:B}=w,$=Rs(()=>{S?.contains(document.activeElement)&&w.viewport?.focus(),a()}),U=b.useCallback(z=>{!z||z===1/0||(window.clearTimeout(L.current),_.current=new Date().getTime(),L.current=window.setTimeout($,z))},[$]);b.useEffect(()=>{const z=w.viewport;if(z){const Q=()=>{U(A.current),d?.()},F=()=>{const Y=new Date().getTime()-_.current;A.current=A.current-Y,window.clearTimeout(L.current),c?.()};return z.addEventListener(hj,F),z.addEventListener(fj,Q),()=>{z.removeEventListener(hj,F),z.removeEventListener(fj,Q)}}},[w.viewport,E,c,d,U]),b.useEffect(()=>{i&&!w.isClosePausedRef.current&&U(E)},[i,E,w.isClosePausedRef,U]),b.useEffect(()=>(P(),()=>B()),[P,B]);const te=b.useMemo(()=>S?YY(S):null,[S]);return w.viewport?o.jsxs(o.Fragment,{children:[te&&o.jsx(LDe,{__scopeToast:n,role:"status","aria-live":r==="foreground"?"assertive":"polite",children:te}),o.jsx(PDe,{scope:n,onClose:$,children:pa.createPortal(o.jsx(_7.ItemSlot,{scope:n,children:o.jsx(zee,{asChild:!0,onEscapeKeyDown:nt(l,()=>{w.isFocusedToastEscapeKeyDownRef.current||$(),w.isFocusedToastEscapeKeyDownRef.current=!1}),children:o.jsx(xn.li,{tabIndex:0,"data-state":i?"open":"closed","data-swipe-direction":w.swipeDirection,...y,ref:j,style:{userSelect:"none",touchAction:"none",...t.style},onKeyDown:nt(t.onKeyDown,z=>{z.key==="Escape"&&(l?.(z.nativeEvent),z.nativeEvent.defaultPrevented||(w.isFocusedToastEscapeKeyDownRef.current=!0,$()))}),onPointerDown:nt(t.onPointerDown,z=>{z.button===0&&(N.current={x:z.clientX,y:z.clientY})}),onPointerMove:nt(t.onPointerMove,z=>{if(!N.current)return;const Q=z.clientX-N.current.x,F=z.clientY-N.current.y,Y=!!T.current,J=["left","right"].includes(w.swipeDirection),X=["left","up"].includes(w.swipeDirection)?Math.min:Math.max,R=J?X(0,Q):0,ie=J?0:X(0,F),G=z.pointerType==="touch"?10:2,I={x:R,y:ie},V={originalEvent:z,delta:I};Y?(T.current=I,Z1(MDe,m,V,{discrete:!1})):Lz(I,w.swipeDirection,G)?(T.current=I,Z1(ADe,h,V,{discrete:!1}),z.target.setPointerCapture(z.pointerId)):(Math.abs(Q)>G||Math.abs(F)>G)&&(N.current=null)}),onPointerUp:nt(t.onPointerUp,z=>{const Q=T.current,F=z.target;if(F.hasPointerCapture(z.pointerId)&&F.releasePointerCapture(z.pointerId),T.current=null,N.current=null,Q){const Y=z.currentTarget,J={originalEvent:z,delta:Q};Lz(Q,w.swipeDirection,w.swipeThreshold)?Z1(DDe,x,J,{discrete:!0}):Z1(RDe,g,J,{discrete:!0}),Y.addEventListener("click",X=>X.preventDefault(),{once:!0})}})})})}),w.viewport)})]}):null}),LDe=t=>{const{__scopeToast:e,children:n,...r}=t,s=ow(Tg,e),[i,a]=b.useState(!1),[l,c]=b.useState(!1);return qDe(()=>a(!0)),b.useEffect(()=>{const d=window.setTimeout(()=>c(!0),1e3);return()=>window.clearTimeout(d)},[]),l?null:o.jsx(Qy,{asChild:!0,children:o.jsx(vI,{...r,children:i&&o.jsxs(o.Fragment,{children:[s.label," ",n]})})})},BDe="ToastTitle",QY=b.forwardRef((t,e)=>{const{__scopeToast:n,...r}=t;return o.jsx(xn.div,{...r,ref:e})});QY.displayName=BDe;var FDe="ToastDescription",VY=b.forwardRef((t,e)=>{const{__scopeToast:n,...r}=t;return o.jsx(xn.div,{...r,ref:e})});VY.displayName=FDe;var UY="ToastAction",WY=b.forwardRef((t,e)=>{const{altText:n,...r}=t;return n.trim()?o.jsx(XY,{altText:n,asChild:!0,children:o.jsx(A7,{...r,ref:e})}):(console.error(`Invalid prop \`altText\` supplied to \`${UY}\`. Expected non-empty \`string\`.`),null)});WY.displayName=UY;var GY="ToastClose",A7=b.forwardRef((t,e)=>{const{__scopeToast:n,...r}=t,s=zDe(GY,n);return o.jsx(XY,{asChild:!0,children:o.jsx(xn.button,{type:"button",...r,ref:e,onClick:nt(t.onClick,s.onClose)})})});A7.displayName=GY;var XY=b.forwardRef((t,e)=>{const{__scopeToast:n,altText:r,...s}=t;return o.jsx(xn.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":r||void 0,...s,ref:e})});function YY(t){const e=[];return Array.from(t.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&e.push(r.textContent),$De(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(...YY(r))}}),e}function Z1(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?xI(s,i):s.dispatchEvent(i)}var Lz=(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 qDe(t=()=>{}){const e=Rs(t);Uh(()=>{let n=0,r=0;return n=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(e)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[e])}function $De(t){return t.nodeType===t.ELEMENT_NODE}function HDe(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 QDe=BY,KY=qY,ZY=HY,JY=QY,eK=VY,tK=WY,nK=A7;const VDe=QDe,rK=b.forwardRef(({className:t,...e},n)=>o.jsx(KY,{ref:n,className:xe("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}));rK.displayName=KY.displayName;const UDe=kf("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"}}),sK=b.forwardRef(({className:t,variant:e,...n},r)=>o.jsx(ZY,{ref:r,className:xe(UDe({variant:e}),t),...n}));sK.displayName=ZY.displayName;const WDe=b.forwardRef(({className:t,...e},n)=>o.jsx(tK,{ref:n,className:xe("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}));WDe.displayName=tK.displayName;const iK=b.forwardRef(({className:t,...e},n)=>o.jsx(nK,{ref:n,className:xe("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:o.jsx(_p,{className:"h-4 w-4"})}));iK.displayName=nK.displayName;const aK=b.forwardRef(({className:t,...e},n)=>o.jsx(JY,{ref:n,className:xe("text-sm font-semibold [&+div]:text-xs",t),...e}));aK.displayName=JY.displayName;const oK=b.forwardRef(({className:t,...e},n)=>o.jsx(eK,{ref:n,className:xe("text-sm opacity-90",t),...e}));oK.displayName=eK.displayName;function GDe(){const{toasts:t}=as();return o.jsxs(VDe,{children:[t.map(function({id:e,title:n,description:r,action:s,...i}){return o.jsxs(sK,{...i,children:[o.jsxs("div",{className:"grid gap-1",children:[n&&o.jsx(aK,{children:n}),r&&o.jsx(oK,{children:r})]}),s,o.jsx(iK,{})]},e)}),o.jsx(rK,{})]})}yte.createRoot(document.getElementById("root")).render(o.jsx(b.StrictMode,{children:o.jsx(sDe,{children:o.jsx(jDe,{defaultTheme:"system",children:o.jsx(NDe,{children:o.jsxs(Spe,{children:[o.jsx(SJ,{router:ODe}),o.jsx(Yxe,{}),o.jsx(GDe,{})]})})})})}));