kanna-code 0.11.0 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,518 @@
1
+ var IO=Object.defineProperty;var xw=e=>{throw TypeError(e)};var HO=(e,t,n)=>t in e?IO(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var rn=(e,t,n)=>HO(e,typeof t!="symbol"?t+"":t,n),Sw=(e,t,n)=>t.has(e)||xw("Cannot "+n);var jc=(e,t,n)=>(Sw(e,t,"read from private field"),n?n.call(e):t.get(e)),ww=(e,t,n)=>t.has(e)?xw("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Cw=(e,t,n,r)=>(Sw(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);function FO(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const s in r)if(s!=="default"&&!(s in e)){const l=Object.getOwnPropertyDescriptor(r,s);l&&Object.defineProperty(e,s,l.get?l:{enumerable:!0,get:()=>r[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const l of s)if(l.type==="childList")for(const a of l.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(s){const l={};return s.integrity&&(l.integrity=s.integrity),s.referrerPolicy&&(l.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?l.credentials="include":s.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function r(s){if(s.ep)return;s.ep=!0;const l=n(s);fetch(s.href,l)}})();function ep(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Zg={exports:{}},zc={};/**
2
+ * @license React
3
+ * react-jsx-runtime.production.js
4
+ *
5
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var kw;function UO(){if(kw)return zc;kw=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,s,l){var a=null;if(l!==void 0&&(a=""+l),s.key!==void 0&&(a=""+s.key),"key"in s){l={};for(var u in s)u!=="key"&&(l[u]=s[u])}else l=s;return s=l.ref,{$$typeof:e,type:r,key:a,ref:s!==void 0?s:null,props:l}}return zc.Fragment=t,zc.jsx=n,zc.jsxs=n,zc}var Ew;function $O(){return Ew||(Ew=1,Zg.exports=UO()),Zg.exports}var g=$O(),Qg={exports:{}},He={};/**
10
+ * @license React
11
+ * react.production.js
12
+ *
13
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ */var Rw;function WO(){if(Rw)return He;Rw=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),l=Symbol.for("react.consumer"),a=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),m=Symbol.for("react.activity"),_=Symbol.iterator;function y(I){return I===null||typeof I!="object"?null:(I=_&&I[_]||I["@@iterator"],typeof I=="function"?I:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S=Object.assign,C={};function k(I,X,L){this.props=I,this.context=X,this.refs=C,this.updater=L||w}k.prototype.isReactComponent={},k.prototype.setState=function(I,X){if(typeof I!="object"&&typeof I!="function"&&I!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,I,X,"setState")},k.prototype.forceUpdate=function(I){this.updater.enqueueForceUpdate(this,I,"forceUpdate")};function T(){}T.prototype=k.prototype;function R(I,X,L){this.props=I,this.context=X,this.refs=C,this.updater=L||w}var N=R.prototype=new T;N.constructor=R,S(N,k.prototype),N.isPureReactComponent=!0;var j=Array.isArray;function A(){}var D={H:null,A:null,T:null,S:null},B=Object.prototype.hasOwnProperty;function K(I,X,L){var oe=L.ref;return{$$typeof:e,type:I,key:X,ref:oe!==void 0?oe:null,props:L}}function z(I,X){return K(I.type,X,I.props)}function U(I){return typeof I=="object"&&I!==null&&I.$$typeof===e}function H(I){var X={"=":"=0",":":"=2"};return"$"+I.replace(/[=:]/g,function(L){return X[L]})}var F=/\/+/g;function q(I,X){return typeof I=="object"&&I!==null&&I.key!=null?H(""+I.key):X.toString(36)}function $(I){switch(I.status){case"fulfilled":return I.value;case"rejected":throw I.reason;default:switch(typeof I.status=="string"?I.then(A,A):(I.status="pending",I.then(function(X){I.status==="pending"&&(I.status="fulfilled",I.value=X)},function(X){I.status==="pending"&&(I.status="rejected",I.reason=X)})),I.status){case"fulfilled":return I.value;case"rejected":throw I.reason}}throw I}function P(I,X,L,oe,ae){var se=typeof I;(se==="undefined"||se==="boolean")&&(I=null);var J=!1;if(I===null)J=!0;else switch(se){case"bigint":case"string":case"number":J=!0;break;case"object":switch(I.$$typeof){case e:case t:J=!0;break;case p:return J=I._init,P(J(I._payload),X,L,oe,ae)}}if(J)return ae=ae(I),J=oe===""?"."+q(I,0):oe,j(ae)?(L="",J!=null&&(L=J.replace(F,"$&/")+"/"),P(ae,X,L,"",function(ve){return ve})):ae!=null&&(U(ae)&&(ae=z(ae,L+(ae.key==null||I&&I.key===ae.key?"":(""+ae.key).replace(F,"$&/")+"/")+J)),X.push(ae)),1;J=0;var re=oe===""?".":oe+":";if(j(I))for(var he=0;he<I.length;he++)oe=I[he],se=re+q(oe,he),J+=P(oe,X,L,se,ae);else if(he=y(I),typeof he=="function")for(I=he.call(I),he=0;!(oe=I.next()).done;)oe=oe.value,se=re+q(oe,he++),J+=P(oe,X,L,se,ae);else if(se==="object"){if(typeof I.then=="function")return P($(I),X,L,oe,ae);throw X=String(I),Error("Objects are not valid as a React child (found: "+(X==="[object Object]"?"object with keys {"+Object.keys(I).join(", ")+"}":X)+"). If you meant to render a collection of children, use an array instead.")}return J}function V(I,X,L){if(I==null)return I;var oe=[],ae=0;return P(I,oe,"","",function(se){return X.call(L,se,ae++)}),oe}function W(I){if(I._status===-1){var X=I._result;X=X(),X.then(function(L){(I._status===0||I._status===-1)&&(I._status=1,I._result=L)},function(L){(I._status===0||I._status===-1)&&(I._status=2,I._result=L)}),I._status===-1&&(I._status=0,I._result=X)}if(I._status===1)return I._result.default;throw I._result}var Z=typeof reportError=="function"?reportError:function(I){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var X=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof I=="object"&&I!==null&&typeof I.message=="string"?String(I.message):String(I),error:I});if(!window.dispatchEvent(X))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",I);return}console.error(I)},M={map:V,forEach:function(I,X,L){V(I,function(){X.apply(this,arguments)},L)},count:function(I){var X=0;return V(I,function(){X++}),X},toArray:function(I){return V(I,function(X){return X})||[]},only:function(I){if(!U(I))throw Error("React.Children.only expected to receive a single React element child.");return I}};return He.Activity=m,He.Children=M,He.Component=k,He.Fragment=n,He.Profiler=s,He.PureComponent=R,He.StrictMode=r,He.Suspense=h,He.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=D,He.__COMPILER_RUNTIME={__proto__:null,c:function(I){return D.H.useMemoCache(I)}},He.cache=function(I){return function(){return I.apply(null,arguments)}},He.cacheSignal=function(){return null},He.cloneElement=function(I,X,L){if(I==null)throw Error("The argument must be a React element, but you passed "+I+".");var oe=S({},I.props),ae=I.key;if(X!=null)for(se in X.key!==void 0&&(ae=""+X.key),X)!B.call(X,se)||se==="key"||se==="__self"||se==="__source"||se==="ref"&&X.ref===void 0||(oe[se]=X[se]);var se=arguments.length-2;if(se===1)oe.children=L;else if(1<se){for(var J=Array(se),re=0;re<se;re++)J[re]=arguments[re+2];oe.children=J}return K(I.type,ae,oe)},He.createContext=function(I){return I={$$typeof:a,_currentValue:I,_currentValue2:I,_threadCount:0,Provider:null,Consumer:null},I.Provider=I,I.Consumer={$$typeof:l,_context:I},I},He.createElement=function(I,X,L){var oe,ae={},se=null;if(X!=null)for(oe in X.key!==void 0&&(se=""+X.key),X)B.call(X,oe)&&oe!=="key"&&oe!=="__self"&&oe!=="__source"&&(ae[oe]=X[oe]);var J=arguments.length-2;if(J===1)ae.children=L;else if(1<J){for(var re=Array(J),he=0;he<J;he++)re[he]=arguments[he+2];ae.children=re}if(I&&I.defaultProps)for(oe in J=I.defaultProps,J)ae[oe]===void 0&&(ae[oe]=J[oe]);return K(I,se,ae)},He.createRef=function(){return{current:null}},He.forwardRef=function(I){return{$$typeof:u,render:I}},He.isValidElement=U,He.lazy=function(I){return{$$typeof:p,_payload:{_status:-1,_result:I},_init:W}},He.memo=function(I,X){return{$$typeof:d,type:I,compare:X===void 0?null:X}},He.startTransition=function(I){var X=D.T,L={};D.T=L;try{var oe=I(),ae=D.S;ae!==null&&ae(L,oe),typeof oe=="object"&&oe!==null&&typeof oe.then=="function"&&oe.then(A,Z)}catch(se){Z(se)}finally{X!==null&&L.types!==null&&(X.types=L.types),D.T=X}},He.unstable_useCacheRefresh=function(){return D.H.useCacheRefresh()},He.use=function(I){return D.H.use(I)},He.useActionState=function(I,X,L){return D.H.useActionState(I,X,L)},He.useCallback=function(I,X){return D.H.useCallback(I,X)},He.useContext=function(I){return D.H.useContext(I)},He.useDebugValue=function(){},He.useDeferredValue=function(I,X){return D.H.useDeferredValue(I,X)},He.useEffect=function(I,X){return D.H.useEffect(I,X)},He.useEffectEvent=function(I){return D.H.useEffectEvent(I)},He.useId=function(){return D.H.useId()},He.useImperativeHandle=function(I,X,L){return D.H.useImperativeHandle(I,X,L)},He.useInsertionEffect=function(I,X){return D.H.useInsertionEffect(I,X)},He.useLayoutEffect=function(I,X){return D.H.useLayoutEffect(I,X)},He.useMemo=function(I,X){return D.H.useMemo(I,X)},He.useOptimistic=function(I,X){return D.H.useOptimistic(I,X)},He.useReducer=function(I,X,L){return D.H.useReducer(I,X,L)},He.useRef=function(I){return D.H.useRef(I)},He.useState=function(I){return D.H.useState(I)},He.useSyncExternalStore=function(I,X,L){return D.H.useSyncExternalStore(I,X,L)},He.useTransition=function(){return D.H.useTransition()},He.version="19.2.1",He}var Tw;function Wy(){return Tw||(Tw=1,Qg.exports=WO()),Qg.exports}var b=Wy();const Ct=ep(b),EE=FO({__proto__:null,default:Ct},[b]);var Jg={exports:{}},Pc={},ev={exports:{}},tv={};/**
18
+ * @license React
19
+ * scheduler.production.js
20
+ *
21
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
22
+ *
23
+ * This source code is licensed under the MIT license found in the
24
+ * LICENSE file in the root directory of this source tree.
25
+ */var Mw;function VO(){return Mw||(Mw=1,(function(e){function t(P,V){var W=P.length;P.push(V);e:for(;0<W;){var Z=W-1>>>1,M=P[Z];if(0<s(M,V))P[Z]=V,P[W]=M,W=Z;else break e}}function n(P){return P.length===0?null:P[0]}function r(P){if(P.length===0)return null;var V=P[0],W=P.pop();if(W!==V){P[0]=W;e:for(var Z=0,M=P.length,I=M>>>1;Z<I;){var X=2*(Z+1)-1,L=P[X],oe=X+1,ae=P[oe];if(0>s(L,W))oe<M&&0>s(ae,L)?(P[Z]=ae,P[oe]=W,Z=oe):(P[Z]=L,P[X]=W,Z=X);else if(oe<M&&0>s(ae,W))P[Z]=ae,P[oe]=W,Z=oe;else break e}}return V}function s(P,V){var W=P.sortIndex-V.sortIndex;return W!==0?W:P.id-V.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var l=performance;e.unstable_now=function(){return l.now()}}else{var a=Date,u=a.now();e.unstable_now=function(){return a.now()-u}}var h=[],d=[],p=1,m=null,_=3,y=!1,w=!1,S=!1,C=!1,k=typeof setTimeout=="function"?setTimeout:null,T=typeof clearTimeout=="function"?clearTimeout:null,R=typeof setImmediate<"u"?setImmediate:null;function N(P){for(var V=n(d);V!==null;){if(V.callback===null)r(d);else if(V.startTime<=P)r(d),V.sortIndex=V.expirationTime,t(h,V);else break;V=n(d)}}function j(P){if(S=!1,N(P),!w)if(n(h)!==null)w=!0,A||(A=!0,H());else{var V=n(d);V!==null&&$(j,V.startTime-P)}}var A=!1,D=-1,B=5,K=-1;function z(){return C?!0:!(e.unstable_now()-K<B)}function U(){if(C=!1,A){var P=e.unstable_now();K=P;var V=!0;try{e:{w=!1,S&&(S=!1,T(D),D=-1),y=!0;var W=_;try{t:{for(N(P),m=n(h);m!==null&&!(m.expirationTime>P&&z());){var Z=m.callback;if(typeof Z=="function"){m.callback=null,_=m.priorityLevel;var M=Z(m.expirationTime<=P);if(P=e.unstable_now(),typeof M=="function"){m.callback=M,N(P),V=!0;break t}m===n(h)&&r(h),N(P)}else r(h);m=n(h)}if(m!==null)V=!0;else{var I=n(d);I!==null&&$(j,I.startTime-P),V=!1}}break e}finally{m=null,_=W,y=!1}V=void 0}}finally{V?H():A=!1}}}var H;if(typeof R=="function")H=function(){R(U)};else if(typeof MessageChannel<"u"){var F=new MessageChannel,q=F.port2;F.port1.onmessage=U,H=function(){q.postMessage(null)}}else H=function(){k(U,0)};function $(P,V){D=k(function(){P(e.unstable_now())},V)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(P){P.callback=null},e.unstable_forceFrameRate=function(P){0>P||125<P?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):B=0<P?Math.floor(1e3/P):5},e.unstable_getCurrentPriorityLevel=function(){return _},e.unstable_next=function(P){switch(_){case 1:case 2:case 3:var V=3;break;default:V=_}var W=_;_=V;try{return P()}finally{_=W}},e.unstable_requestPaint=function(){C=!0},e.unstable_runWithPriority=function(P,V){switch(P){case 1:case 2:case 3:case 4:case 5:break;default:P=3}var W=_;_=P;try{return V()}finally{_=W}},e.unstable_scheduleCallback=function(P,V,W){var Z=e.unstable_now();switch(typeof W=="object"&&W!==null?(W=W.delay,W=typeof W=="number"&&0<W?Z+W:Z):W=Z,P){case 1:var M=-1;break;case 2:M=250;break;case 5:M=1073741823;break;case 4:M=1e4;break;default:M=5e3}return M=W+M,P={id:p++,callback:V,priorityLevel:P,startTime:W,expirationTime:M,sortIndex:-1},W>Z?(P.sortIndex=W,t(d,P),n(h)===null&&P===n(d)&&(S?(T(D),D=-1):S=!0,$(j,W-Z))):(P.sortIndex=M,t(h,P),w||y||(w=!0,A||(A=!0,H()))),P},e.unstable_shouldYield=z,e.unstable_wrapCallback=function(P){var V=_;return function(){var W=_;_=V;try{return P.apply(this,arguments)}finally{_=W}}}})(tv)),tv}var Nw;function qO(){return Nw||(Nw=1,ev.exports=VO()),ev.exports}var nv={exports:{}},Dn={};/**
26
+ * @license React
27
+ * react-dom.production.js
28
+ *
29
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
30
+ *
31
+ * This source code is licensed under the MIT license found in the
32
+ * LICENSE file in the root directory of this source tree.
33
+ */var Aw;function KO(){if(Aw)return Dn;Aw=1;var e=Wy();function t(h){var d="https://react.dev/errors/"+h;if(1<arguments.length){d+="?args[]="+encodeURIComponent(arguments[1]);for(var p=2;p<arguments.length;p++)d+="&args[]="+encodeURIComponent(arguments[p])}return"Minified React error #"+h+"; visit "+d+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var r={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},s=Symbol.for("react.portal");function l(h,d,p){var m=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:s,key:m==null?null:""+m,children:h,containerInfo:d,implementation:p}}var a=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function u(h,d){if(h==="font")return"";if(typeof d=="string")return d==="use-credentials"?d:""}return Dn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,Dn.createPortal=function(h,d){var p=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!d||d.nodeType!==1&&d.nodeType!==9&&d.nodeType!==11)throw Error(t(299));return l(h,d,null,p)},Dn.flushSync=function(h){var d=a.T,p=r.p;try{if(a.T=null,r.p=2,h)return h()}finally{a.T=d,r.p=p,r.d.f()}},Dn.preconnect=function(h,d){typeof h=="string"&&(d?(d=d.crossOrigin,d=typeof d=="string"?d==="use-credentials"?d:"":void 0):d=null,r.d.C(h,d))},Dn.prefetchDNS=function(h){typeof h=="string"&&r.d.D(h)},Dn.preinit=function(h,d){if(typeof h=="string"&&d&&typeof d.as=="string"){var p=d.as,m=u(p,d.crossOrigin),_=typeof d.integrity=="string"?d.integrity:void 0,y=typeof d.fetchPriority=="string"?d.fetchPriority:void 0;p==="style"?r.d.S(h,typeof d.precedence=="string"?d.precedence:void 0,{crossOrigin:m,integrity:_,fetchPriority:y}):p==="script"&&r.d.X(h,{crossOrigin:m,integrity:_,fetchPriority:y,nonce:typeof d.nonce=="string"?d.nonce:void 0})}},Dn.preinitModule=function(h,d){if(typeof h=="string")if(typeof d=="object"&&d!==null){if(d.as==null||d.as==="script"){var p=u(d.as,d.crossOrigin);r.d.M(h,{crossOrigin:p,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0})}}else d==null&&r.d.M(h)},Dn.preload=function(h,d){if(typeof h=="string"&&typeof d=="object"&&d!==null&&typeof d.as=="string"){var p=d.as,m=u(p,d.crossOrigin);r.d.L(h,p,{crossOrigin:m,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0,type:typeof d.type=="string"?d.type:void 0,fetchPriority:typeof d.fetchPriority=="string"?d.fetchPriority:void 0,referrerPolicy:typeof d.referrerPolicy=="string"?d.referrerPolicy:void 0,imageSrcSet:typeof d.imageSrcSet=="string"?d.imageSrcSet:void 0,imageSizes:typeof d.imageSizes=="string"?d.imageSizes:void 0,media:typeof d.media=="string"?d.media:void 0})}},Dn.preloadModule=function(h,d){if(typeof h=="string")if(d){var p=u(d.as,d.crossOrigin);r.d.m(h,{as:typeof d.as=="string"&&d.as!=="script"?d.as:void 0,crossOrigin:p,integrity:typeof d.integrity=="string"?d.integrity:void 0})}else r.d.m(h)},Dn.requestFormReset=function(h){r.d.r(h)},Dn.unstable_batchedUpdates=function(h,d){return h(d)},Dn.useFormState=function(h,d,p){return a.H.useFormState(h,d,p)},Dn.useFormStatus=function(){return a.H.useHostTransitionStatus()},Dn.version="19.2.1",Dn}var Dw;function RE(){if(Dw)return nv.exports;Dw=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),nv.exports=KO(),nv.exports}/**
34
+ * @license React
35
+ * react-dom-client.production.js
36
+ *
37
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
38
+ *
39
+ * This source code is licensed under the MIT license found in the
40
+ * LICENSE file in the root directory of this source tree.
41
+ */var Ow;function GO(){if(Ow)return Pc;Ow=1;var e=qO(),t=Wy(),n=RE();function r(i){var o="https://react.dev/errors/"+i;if(1<arguments.length){o+="?args[]="+encodeURIComponent(arguments[1]);for(var c=2;c<arguments.length;c++)o+="&args[]="+encodeURIComponent(arguments[c])}return"Minified React error #"+i+"; visit "+o+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11)}function l(i){var o=i,c=i;if(i.alternate)for(;o.return;)o=o.return;else{i=o;do o=i,(o.flags&4098)!==0&&(c=o.return),i=o.return;while(i)}return o.tag===3?c:null}function a(i){if(i.tag===13){var o=i.memoizedState;if(o===null&&(i=i.alternate,i!==null&&(o=i.memoizedState)),o!==null)return o.dehydrated}return null}function u(i){if(i.tag===31){var o=i.memoizedState;if(o===null&&(i=i.alternate,i!==null&&(o=i.memoizedState)),o!==null)return o.dehydrated}return null}function h(i){if(l(i)!==i)throw Error(r(188))}function d(i){var o=i.alternate;if(!o){if(o=l(i),o===null)throw Error(r(188));return o!==i?null:i}for(var c=i,f=o;;){var v=c.return;if(v===null)break;var x=v.alternate;if(x===null){if(f=v.return,f!==null){c=f;continue}break}if(v.child===x.child){for(x=v.child;x;){if(x===c)return h(v),i;if(x===f)return h(v),o;x=x.sibling}throw Error(r(188))}if(c.return!==f.return)c=v,f=x;else{for(var E=!1,O=v.child;O;){if(O===c){E=!0,c=v,f=x;break}if(O===f){E=!0,f=v,c=x;break}O=O.sibling}if(!E){for(O=x.child;O;){if(O===c){E=!0,c=x,f=v;break}if(O===f){E=!0,f=x,c=v;break}O=O.sibling}if(!E)throw Error(r(189))}}if(c.alternate!==f)throw Error(r(190))}if(c.tag!==3)throw Error(r(188));return c.stateNode.current===c?i:o}function p(i){var o=i.tag;if(o===5||o===26||o===27||o===6)return i;for(i=i.child;i!==null;){if(o=p(i),o!==null)return o;i=i.sibling}return null}var m=Object.assign,_=Symbol.for("react.element"),y=Symbol.for("react.transitional.element"),w=Symbol.for("react.portal"),S=Symbol.for("react.fragment"),C=Symbol.for("react.strict_mode"),k=Symbol.for("react.profiler"),T=Symbol.for("react.consumer"),R=Symbol.for("react.context"),N=Symbol.for("react.forward_ref"),j=Symbol.for("react.suspense"),A=Symbol.for("react.suspense_list"),D=Symbol.for("react.memo"),B=Symbol.for("react.lazy"),K=Symbol.for("react.activity"),z=Symbol.for("react.memo_cache_sentinel"),U=Symbol.iterator;function H(i){return i===null||typeof i!="object"?null:(i=U&&i[U]||i["@@iterator"],typeof i=="function"?i:null)}var F=Symbol.for("react.client.reference");function q(i){if(i==null)return null;if(typeof i=="function")return i.$$typeof===F?null:i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case S:return"Fragment";case k:return"Profiler";case C:return"StrictMode";case j:return"Suspense";case A:return"SuspenseList";case K:return"Activity"}if(typeof i=="object")switch(i.$$typeof){case w:return"Portal";case R:return i.displayName||"Context";case T:return(i._context.displayName||"Context")+".Consumer";case N:var o=i.render;return i=i.displayName,i||(i=o.displayName||o.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case D:return o=i.displayName||null,o!==null?o:q(i.type)||"Memo";case B:o=i._payload,i=i._init;try{return q(i(o))}catch{}}return null}var $=Array.isArray,P=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,V=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,W={pending:!1,data:null,method:null,action:null},Z=[],M=-1;function I(i){return{current:i}}function X(i){0>M||(i.current=Z[M],Z[M]=null,M--)}function L(i,o){M++,Z[M]=i.current,i.current=o}var oe=I(null),ae=I(null),se=I(null),J=I(null);function re(i,o){switch(L(se,o),L(ae,i),L(oe,null),o.nodeType){case 9:case 11:i=(i=o.documentElement)&&(i=i.namespaceURI)?WS(i):0;break;default:if(i=o.tagName,o=o.namespaceURI)o=WS(o),i=VS(o,i);else switch(i){case"svg":i=1;break;case"math":i=2;break;default:i=0}}X(oe),L(oe,i)}function he(){X(oe),X(ae),X(se)}function ve(i){i.memoizedState!==null&&L(J,i);var o=oe.current,c=VS(o,i.type);o!==c&&(L(ae,i),L(oe,c))}function Ce(i){ae.current===i&&(X(oe),X(ae)),J.current===i&&(X(J),Ac._currentValue=W)}var ce,_e;function Le(i){if(ce===void 0)try{throw Error()}catch(c){var o=c.stack.trim().match(/\n( *(at )?)/);ce=o&&o[1]||"",_e=-1<c.stack.indexOf(`
42
+ at`)?" (<anonymous>)":-1<c.stack.indexOf("@")?"@unknown:0:0":""}return`
43
+ `+ce+i+_e}var St=!1;function yt(i,o){if(!i||St)return"";St=!0;var c=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var f={DetermineComponentFrameRoot:function(){try{if(o){var me=function(){throw Error()};if(Object.defineProperty(me.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(me,[])}catch(ie){var ne=ie}Reflect.construct(i,[],me)}else{try{me.call()}catch(ie){ne=ie}i.call(me.prototype)}}else{try{throw Error()}catch(ie){ne=ie}(me=i())&&typeof me.catch=="function"&&me.catch(function(){})}}catch(ie){if(ie&&ne&&typeof ie.stack=="string")return[ie.stack,ne.stack]}return[null,null]}};f.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var v=Object.getOwnPropertyDescriptor(f.DetermineComponentFrameRoot,"name");v&&v.configurable&&Object.defineProperty(f.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var x=f.DetermineComponentFrameRoot(),E=x[0],O=x[1];if(E&&O){var G=E.split(`
44
+ `),te=O.split(`
45
+ `);for(v=f=0;f<G.length&&!G[f].includes("DetermineComponentFrameRoot");)f++;for(;v<te.length&&!te[v].includes("DetermineComponentFrameRoot");)v++;if(f===G.length||v===te.length)for(f=G.length-1,v=te.length-1;1<=f&&0<=v&&G[f]!==te[v];)v--;for(;1<=f&&0<=v;f--,v--)if(G[f]!==te[v]){if(f!==1||v!==1)do if(f--,v--,0>v||G[f]!==te[v]){var de=`
46
+ `+G[f].replace(" at new "," at ");return i.displayName&&de.includes("<anonymous>")&&(de=de.replace("<anonymous>",i.displayName)),de}while(1<=f&&0<=v);break}}}finally{St=!1,Error.prepareStackTrace=c}return(c=i?i.displayName||i.name:"")?Le(c):""}function $t(i,o){switch(i.tag){case 26:case 27:case 5:return Le(i.type);case 16:return Le("Lazy");case 13:return i.child!==o&&o!==null?Le("Suspense Fallback"):Le("Suspense");case 19:return Le("SuspenseList");case 0:case 15:return yt(i.type,!1);case 11:return yt(i.type.render,!1);case 1:return yt(i.type,!0);case 31:return Le("Activity");default:return""}}function Gn(i){try{var o="",c=null;do o+=$t(i,c),c=i,i=i.return;while(i);return o}catch(f){return`
47
+ Error generating stack: `+f.message+`
48
+ `+f.stack}}var Jt=Object.prototype.hasOwnProperty,Wt=e.unstable_scheduleCallback,un=e.unstable_cancelCallback,cr=e.unstable_shouldYield,pe=e.unstable_requestPaint,Ge=e.unstable_now,ur=e.unstable_getCurrentPriorityLevel,ue=e.unstable_ImmediatePriority,ye=e.unstable_UserBlockingPriority,Ae=e.unstable_NormalPriority,Be=e.unstable_LowPriority,Ye=e.unstable_IdlePriority,Mt=e.log,Yn=e.unstable_setDisableYieldValue,en=null,kt=null;function Vt(i){if(typeof Mt=="function"&&Yn(i),kt&&typeof kt.setStrictMode=="function")try{kt.setStrictMode(en,i)}catch{}}var st=Math.clz32?Math.clz32:pl,Er=Math.log,Sn=Math.LN2;function pl(i){return i>>>=0,i===0?32:31-(Er(i)/Sn|0)|0}var ji=256,le=262144,Se=4194304;function Pe(i){var o=i&42;if(o!==0)return o;switch(i&-i){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64: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 i&261888;case 262144:case 524288:case 1048576:case 2097152:return i&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return i&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return i}}function We(i,o,c){var f=i.pendingLanes;if(f===0)return 0;var v=0,x=i.suspendedLanes,E=i.pingedLanes;i=i.warmLanes;var O=f&134217727;return O!==0?(f=O&~x,f!==0?v=Pe(f):(E&=O,E!==0?v=Pe(E):c||(c=O&~i,c!==0&&(v=Pe(c))))):(O=f&~x,O!==0?v=Pe(O):E!==0?v=Pe(E):c||(c=f&~i,c!==0&&(v=Pe(c)))),v===0?0:o!==0&&o!==v&&(o&x)===0&&(x=v&-v,c=o&-o,x>=c||x===32&&(c&4194048)!==0)?o:v}function ot(i,o){return(i.pendingLanes&~(i.suspendedLanes&~i.pingedLanes)&o)===0}function Bn(i,o){switch(i){case 1:case 2:case 4:case 8:case 64:return o+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 o+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 An(){var i=Se;return Se<<=1,(Se&62914560)===0&&(Se=4194304),i}function Xn(i){for(var o=[],c=0;31>c;c++)o.push(i);return o}function Rr(i,o){i.pendingLanes|=o,o!==268435456&&(i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0)}function tn(i,o,c,f,v,x){var E=i.pendingLanes;i.pendingLanes=c,i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0,i.expiredLanes&=c,i.entangledLanes&=c,i.errorRecoveryDisabledLanes&=c,i.shellSuspendCounter=0;var O=i.entanglements,G=i.expirationTimes,te=i.hiddenUpdates;for(c=E&~c;0<c;){var de=31-st(c),me=1<<de;O[de]=0,G[de]=-1;var ne=te[de];if(ne!==null)for(te[de]=null,de=0;de<ne.length;de++){var ie=ne[de];ie!==null&&(ie.lane&=-536870913)}c&=~me}f!==0&&Xr(i,f,0),x!==0&&v===0&&i.tag!==0&&(i.suspendedLanes|=x&~(E&~o))}function Xr(i,o,c){i.pendingLanes|=o,i.suspendedLanes&=~o;var f=31-st(o);i.entangledLanes|=o,i.entanglements[f]=i.entanglements[f]|1073741824|c&261930}function dr(i,o){var c=i.entangledLanes|=o;for(i=i.entanglements;c;){var f=31-st(c),v=1<<f;v&o|i[f]&o&&(i[f]|=o),c&=~v}}function Tr(i,o){var c=o&-o;return c=(c&42)!==0?1:zi(c),(c&(i.suspendedLanes|o))!==0?0:c}function zi(i){switch(i){case 2:i=1;break;case 8:i=4;break;case 32:i=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:i=128;break;case 268435456:i=134217728;break;default:i=0}return i}function Pi(i){return i&=-i,2<i?8<i?(i&134217727)!==0?32:268435456:8:2}function Zr(){var i=V.p;return i!==0?i:(i=window.event,i===void 0?32:pw(i.type))}function bs(i,o){var c=V.p;try{return V.p=i,o()}finally{V.p=c}}var Mr=Math.random().toString(36).slice(2),wn="__reactFiber$"+Mr,Zn="__reactProps$"+Mr,ml="__reactContainer$"+Mr,Up="__reactEvents$"+Mr,TD="__reactListeners$"+Mr,MD="__reactHandles$"+Mr,A0="__reactResources$"+Mr,qa="__reactMarker$"+Mr;function $p(i){delete i[wn],delete i[Zn],delete i[Up],delete i[TD],delete i[MD]}function gl(i){var o=i[wn];if(o)return o;for(var c=i.parentNode;c;){if(o=c[ml]||c[wn]){if(c=o.alternate,o.child!==null||c!==null&&c.child!==null)for(i=QS(i);i!==null;){if(c=i[wn])return c;i=QS(i)}return o}i=c,c=i.parentNode}return null}function vl(i){if(i=i[wn]||i[ml]){var o=i.tag;if(o===5||o===6||o===13||o===31||o===26||o===27||o===3)return i}return null}function Ka(i){var o=i.tag;if(o===5||o===26||o===27||o===6)return i.stateNode;throw Error(r(33))}function _l(i){var o=i[A0];return o||(o=i[A0]={hoistableStyles:new Map,hoistableScripts:new Map}),o}function dn(i){i[qa]=!0}var D0=new Set,O0={};function vo(i,o){yl(i,o),yl(i+"Capture",o)}function yl(i,o){for(O0[i]=o,i=0;i<o.length;i++)D0.add(o[i])}var ND=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]*$"),L0={},j0={};function AD(i){return Jt.call(j0,i)?!0:Jt.call(L0,i)?!1:ND.test(i)?j0[i]=!0:(L0[i]=!0,!1)}function ad(i,o,c){if(AD(o))if(c===null)i.removeAttribute(o);else{switch(typeof c){case"undefined":case"function":case"symbol":i.removeAttribute(o);return;case"boolean":var f=o.toLowerCase().slice(0,5);if(f!=="data-"&&f!=="aria-"){i.removeAttribute(o);return}}i.setAttribute(o,""+c)}}function cd(i,o,c){if(c===null)i.removeAttribute(o);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(o);return}i.setAttribute(o,""+c)}}function Bi(i,o,c,f){if(f===null)i.removeAttribute(c);else{switch(typeof f){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(c);return}i.setAttributeNS(o,c,""+f)}}function Nr(i){switch(typeof i){case"bigint":case"boolean":case"number":case"string":case"undefined":return i;case"object":return i;default:return""}}function z0(i){var o=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(o==="checkbox"||o==="radio")}function DD(i,o,c){var f=Object.getOwnPropertyDescriptor(i.constructor.prototype,o);if(!i.hasOwnProperty(o)&&typeof f<"u"&&typeof f.get=="function"&&typeof f.set=="function"){var v=f.get,x=f.set;return Object.defineProperty(i,o,{configurable:!0,get:function(){return v.call(this)},set:function(E){c=""+E,x.call(this,E)}}),Object.defineProperty(i,o,{enumerable:f.enumerable}),{getValue:function(){return c},setValue:function(E){c=""+E},stopTracking:function(){i._valueTracker=null,delete i[o]}}}}function Wp(i){if(!i._valueTracker){var o=z0(i)?"checked":"value";i._valueTracker=DD(i,o,""+i[o])}}function P0(i){if(!i)return!1;var o=i._valueTracker;if(!o)return!0;var c=o.getValue(),f="";return i&&(f=z0(i)?i.checked?"true":"false":i.value),i=f,i!==c?(o.setValue(i),!0):!1}function ud(i){if(i=i||(typeof document<"u"?document:void 0),typeof i>"u")return null;try{return i.activeElement||i.body}catch{return i.body}}var OD=/[\n"\\]/g;function Ar(i){return i.replace(OD,function(o){return"\\"+o.charCodeAt(0).toString(16)+" "})}function Vp(i,o,c,f,v,x,E,O){i.name="",E!=null&&typeof E!="function"&&typeof E!="symbol"&&typeof E!="boolean"?i.type=E:i.removeAttribute("type"),o!=null?E==="number"?(o===0&&i.value===""||i.value!=o)&&(i.value=""+Nr(o)):i.value!==""+Nr(o)&&(i.value=""+Nr(o)):E!=="submit"&&E!=="reset"||i.removeAttribute("value"),o!=null?qp(i,E,Nr(o)):c!=null?qp(i,E,Nr(c)):f!=null&&i.removeAttribute("value"),v==null&&x!=null&&(i.defaultChecked=!!x),v!=null&&(i.checked=v&&typeof v!="function"&&typeof v!="symbol"),O!=null&&typeof O!="function"&&typeof O!="symbol"&&typeof O!="boolean"?i.name=""+Nr(O):i.removeAttribute("name")}function B0(i,o,c,f,v,x,E,O){if(x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(i.type=x),o!=null||c!=null){if(!(x!=="submit"&&x!=="reset"||o!=null)){Wp(i);return}c=c!=null?""+Nr(c):"",o=o!=null?""+Nr(o):c,O||o===i.value||(i.value=o),i.defaultValue=o}f=f??v,f=typeof f!="function"&&typeof f!="symbol"&&!!f,i.checked=O?i.checked:!!f,i.defaultChecked=!!f,E!=null&&typeof E!="function"&&typeof E!="symbol"&&typeof E!="boolean"&&(i.name=E),Wp(i)}function qp(i,o,c){o==="number"&&ud(i.ownerDocument)===i||i.defaultValue===""+c||(i.defaultValue=""+c)}function bl(i,o,c,f){if(i=i.options,o){o={};for(var v=0;v<c.length;v++)o["$"+c[v]]=!0;for(c=0;c<i.length;c++)v=o.hasOwnProperty("$"+i[c].value),i[c].selected!==v&&(i[c].selected=v),v&&f&&(i[c].defaultSelected=!0)}else{for(c=""+Nr(c),o=null,v=0;v<i.length;v++){if(i[v].value===c){i[v].selected=!0,f&&(i[v].defaultSelected=!0);return}o!==null||i[v].disabled||(o=i[v])}o!==null&&(o.selected=!0)}}function I0(i,o,c){if(o!=null&&(o=""+Nr(o),o!==i.value&&(i.value=o),c==null)){i.defaultValue!==o&&(i.defaultValue=o);return}i.defaultValue=c!=null?""+Nr(c):""}function H0(i,o,c,f){if(o==null){if(f!=null){if(c!=null)throw Error(r(92));if($(f)){if(1<f.length)throw Error(r(93));f=f[0]}c=f}c==null&&(c=""),o=c}c=Nr(o),i.defaultValue=c,f=i.textContent,f===c&&f!==""&&f!==null&&(i.value=f),Wp(i)}function xl(i,o){if(o){var c=i.firstChild;if(c&&c===i.lastChild&&c.nodeType===3){c.nodeValue=o;return}}i.textContent=o}var LD=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 F0(i,o,c){var f=o.indexOf("--")===0;c==null||typeof c=="boolean"||c===""?f?i.setProperty(o,""):o==="float"?i.cssFloat="":i[o]="":f?i.setProperty(o,c):typeof c!="number"||c===0||LD.has(o)?o==="float"?i.cssFloat=c:i[o]=(""+c).trim():i[o]=c+"px"}function U0(i,o,c){if(o!=null&&typeof o!="object")throw Error(r(62));if(i=i.style,c!=null){for(var f in c)!c.hasOwnProperty(f)||o!=null&&o.hasOwnProperty(f)||(f.indexOf("--")===0?i.setProperty(f,""):f==="float"?i.cssFloat="":i[f]="");for(var v in o)f=o[v],o.hasOwnProperty(v)&&c[v]!==f&&F0(i,v,f)}else for(var x in o)o.hasOwnProperty(x)&&F0(i,x,o[x])}function Kp(i){if(i.indexOf("-")===-1)return!1;switch(i){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var jD=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"]]),zD=/^[\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 dd(i){return zD.test(""+i)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":i}function Ii(){}var Gp=null;function Yp(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var Sl=null,wl=null;function $0(i){var o=vl(i);if(o&&(i=o.stateNode)){var c=i[Zn]||null;e:switch(i=o.stateNode,o.type){case"input":if(Vp(i,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name),o=c.name,c.type==="radio"&&o!=null){for(c=i;c.parentNode;)c=c.parentNode;for(c=c.querySelectorAll('input[name="'+Ar(""+o)+'"][type="radio"]'),o=0;o<c.length;o++){var f=c[o];if(f!==i&&f.form===i.form){var v=f[Zn]||null;if(!v)throw Error(r(90));Vp(f,v.value,v.defaultValue,v.defaultValue,v.checked,v.defaultChecked,v.type,v.name)}}for(o=0;o<c.length;o++)f=c[o],f.form===i.form&&P0(f)}break e;case"textarea":I0(i,c.value,c.defaultValue);break e;case"select":o=c.value,o!=null&&bl(i,!!c.multiple,o,!1)}}}var Xp=!1;function W0(i,o,c){if(Xp)return i(o,c);Xp=!0;try{var f=i(o);return f}finally{if(Xp=!1,(Sl!==null||wl!==null)&&(Qd(),Sl&&(o=Sl,i=wl,wl=Sl=null,$0(o),i)))for(o=0;o<i.length;o++)$0(i[o])}}function Ga(i,o){var c=i.stateNode;if(c===null)return null;var f=c[Zn]||null;if(f===null)return null;c=f[o];e:switch(o){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(f=!f.disabled)||(i=i.type,f=!(i==="button"||i==="input"||i==="select"||i==="textarea")),i=!f;break e;default:i=!1}if(i)return null;if(c&&typeof c!="function")throw Error(r(231,o,typeof c));return c}var Hi=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Zp=!1;if(Hi)try{var Ya={};Object.defineProperty(Ya,"passive",{get:function(){Zp=!0}}),window.addEventListener("test",Ya,Ya),window.removeEventListener("test",Ya,Ya)}catch{Zp=!1}var xs=null,Qp=null,hd=null;function V0(){if(hd)return hd;var i,o=Qp,c=o.length,f,v="value"in xs?xs.value:xs.textContent,x=v.length;for(i=0;i<c&&o[i]===v[i];i++);var E=c-i;for(f=1;f<=E&&o[c-f]===v[x-f];f++);return hd=v.slice(i,1<f?1-f:void 0)}function fd(i){var o=i.keyCode;return"charCode"in i?(i=i.charCode,i===0&&o===13&&(i=13)):i=o,i===10&&(i=13),32<=i||i===13?i:0}function pd(){return!0}function q0(){return!1}function Qn(i){function o(c,f,v,x,E){this._reactName=c,this._targetInst=v,this.type=f,this.nativeEvent=x,this.target=E,this.currentTarget=null;for(var O in i)i.hasOwnProperty(O)&&(c=i[O],this[O]=c?c(x):x[O]);return this.isDefaultPrevented=(x.defaultPrevented!=null?x.defaultPrevented:x.returnValue===!1)?pd:q0,this.isPropagationStopped=q0,this}return m(o.prototype,{preventDefault:function(){this.defaultPrevented=!0;var c=this.nativeEvent;c&&(c.preventDefault?c.preventDefault():typeof c.returnValue!="unknown"&&(c.returnValue=!1),this.isDefaultPrevented=pd)},stopPropagation:function(){var c=this.nativeEvent;c&&(c.stopPropagation?c.stopPropagation():typeof c.cancelBubble!="unknown"&&(c.cancelBubble=!0),this.isPropagationStopped=pd)},persist:function(){},isPersistent:pd}),o}var _o={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(i){return i.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},md=Qn(_o),Xa=m({},_o,{view:0,detail:0}),PD=Qn(Xa),Jp,em,Za,gd=m({},Xa,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:nm,button:0,buttons:0,relatedTarget:function(i){return i.relatedTarget===void 0?i.fromElement===i.srcElement?i.toElement:i.fromElement:i.relatedTarget},movementX:function(i){return"movementX"in i?i.movementX:(i!==Za&&(Za&&i.type==="mousemove"?(Jp=i.screenX-Za.screenX,em=i.screenY-Za.screenY):em=Jp=0,Za=i),Jp)},movementY:function(i){return"movementY"in i?i.movementY:em}}),K0=Qn(gd),BD=m({},gd,{dataTransfer:0}),ID=Qn(BD),HD=m({},Xa,{relatedTarget:0}),tm=Qn(HD),FD=m({},_o,{animationName:0,elapsedTime:0,pseudoElement:0}),UD=Qn(FD),$D=m({},_o,{clipboardData:function(i){return"clipboardData"in i?i.clipboardData:window.clipboardData}}),WD=Qn($D),VD=m({},_o,{data:0}),G0=Qn(VD),qD={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},KD={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"},GD={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function YD(i){var o=this.nativeEvent;return o.getModifierState?o.getModifierState(i):(i=GD[i])?!!o[i]:!1}function nm(){return YD}var XD=m({},Xa,{key:function(i){if(i.key){var o=qD[i.key]||i.key;if(o!=="Unidentified")return o}return i.type==="keypress"?(i=fd(i),i===13?"Enter":String.fromCharCode(i)):i.type==="keydown"||i.type==="keyup"?KD[i.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:nm,charCode:function(i){return i.type==="keypress"?fd(i):0},keyCode:function(i){return i.type==="keydown"||i.type==="keyup"?i.keyCode:0},which:function(i){return i.type==="keypress"?fd(i):i.type==="keydown"||i.type==="keyup"?i.keyCode:0}}),ZD=Qn(XD),QD=m({},gd,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Y0=Qn(QD),JD=m({},Xa,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:nm}),e3=Qn(JD),t3=m({},_o,{propertyName:0,elapsedTime:0,pseudoElement:0}),n3=Qn(t3),r3=m({},gd,{deltaX:function(i){return"deltaX"in i?i.deltaX:"wheelDeltaX"in i?-i.wheelDeltaX:0},deltaY:function(i){return"deltaY"in i?i.deltaY:"wheelDeltaY"in i?-i.wheelDeltaY:"wheelDelta"in i?-i.wheelDelta:0},deltaZ:0,deltaMode:0}),i3=Qn(r3),s3=m({},_o,{newState:0,oldState:0}),o3=Qn(s3),l3=[9,13,27,32],rm=Hi&&"CompositionEvent"in window,Qa=null;Hi&&"documentMode"in document&&(Qa=document.documentMode);var a3=Hi&&"TextEvent"in window&&!Qa,X0=Hi&&(!rm||Qa&&8<Qa&&11>=Qa),Z0=" ",Q0=!1;function J0(i,o){switch(i){case"keyup":return l3.indexOf(o.keyCode)!==-1;case"keydown":return o.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ex(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var Cl=!1;function c3(i,o){switch(i){case"compositionend":return ex(o);case"keypress":return o.which!==32?null:(Q0=!0,Z0);case"textInput":return i=o.data,i===Z0&&Q0?null:i;default:return null}}function u3(i,o){if(Cl)return i==="compositionend"||!rm&&J0(i,o)?(i=V0(),hd=Qp=xs=null,Cl=!1,i):null;switch(i){case"paste":return null;case"keypress":if(!(o.ctrlKey||o.altKey||o.metaKey)||o.ctrlKey&&o.altKey){if(o.char&&1<o.char.length)return o.char;if(o.which)return String.fromCharCode(o.which)}return null;case"compositionend":return X0&&o.locale!=="ko"?null:o.data;default:return null}}var d3={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 tx(i){var o=i&&i.nodeName&&i.nodeName.toLowerCase();return o==="input"?!!d3[i.type]:o==="textarea"}function nx(i,o,c,f){Sl?wl?wl.push(f):wl=[f]:Sl=f,o=sh(o,"onChange"),0<o.length&&(c=new md("onChange","change",null,c,f),i.push({event:c,listeners:o}))}var Ja=null,ec=null;function h3(i){BS(i,0)}function vd(i){var o=Ka(i);if(P0(o))return i}function rx(i,o){if(i==="change")return o}var ix=!1;if(Hi){var im;if(Hi){var sm="oninput"in document;if(!sm){var sx=document.createElement("div");sx.setAttribute("oninput","return;"),sm=typeof sx.oninput=="function"}im=sm}else im=!1;ix=im&&(!document.documentMode||9<document.documentMode)}function ox(){Ja&&(Ja.detachEvent("onpropertychange",lx),ec=Ja=null)}function lx(i){if(i.propertyName==="value"&&vd(ec)){var o=[];nx(o,ec,i,Yp(i)),W0(h3,o)}}function f3(i,o,c){i==="focusin"?(ox(),Ja=o,ec=c,Ja.attachEvent("onpropertychange",lx)):i==="focusout"&&ox()}function p3(i){if(i==="selectionchange"||i==="keyup"||i==="keydown")return vd(ec)}function m3(i,o){if(i==="click")return vd(o)}function g3(i,o){if(i==="input"||i==="change")return vd(o)}function v3(i,o){return i===o&&(i!==0||1/i===1/o)||i!==i&&o!==o}var hr=typeof Object.is=="function"?Object.is:v3;function tc(i,o){if(hr(i,o))return!0;if(typeof i!="object"||i===null||typeof o!="object"||o===null)return!1;var c=Object.keys(i),f=Object.keys(o);if(c.length!==f.length)return!1;for(f=0;f<c.length;f++){var v=c[f];if(!Jt.call(o,v)||!hr(i[v],o[v]))return!1}return!0}function ax(i){for(;i&&i.firstChild;)i=i.firstChild;return i}function cx(i,o){var c=ax(i);i=0;for(var f;c;){if(c.nodeType===3){if(f=i+c.textContent.length,i<=o&&f>=o)return{node:c,offset:o-i};i=f}e:{for(;c;){if(c.nextSibling){c=c.nextSibling;break e}c=c.parentNode}c=void 0}c=ax(c)}}function ux(i,o){return i&&o?i===o?!0:i&&i.nodeType===3?!1:o&&o.nodeType===3?ux(i,o.parentNode):"contains"in i?i.contains(o):i.compareDocumentPosition?!!(i.compareDocumentPosition(o)&16):!1:!1}function dx(i){i=i!=null&&i.ownerDocument!=null&&i.ownerDocument.defaultView!=null?i.ownerDocument.defaultView:window;for(var o=ud(i.document);o instanceof i.HTMLIFrameElement;){try{var c=typeof o.contentWindow.location.href=="string"}catch{c=!1}if(c)i=o.contentWindow;else break;o=ud(i.document)}return o}function om(i){var o=i&&i.nodeName&&i.nodeName.toLowerCase();return o&&(o==="input"&&(i.type==="text"||i.type==="search"||i.type==="tel"||i.type==="url"||i.type==="password")||o==="textarea"||i.contentEditable==="true")}var _3=Hi&&"documentMode"in document&&11>=document.documentMode,kl=null,lm=null,nc=null,am=!1;function hx(i,o,c){var f=c.window===c?c.document:c.nodeType===9?c:c.ownerDocument;am||kl==null||kl!==ud(f)||(f=kl,"selectionStart"in f&&om(f)?f={start:f.selectionStart,end:f.selectionEnd}:(f=(f.ownerDocument&&f.ownerDocument.defaultView||window).getSelection(),f={anchorNode:f.anchorNode,anchorOffset:f.anchorOffset,focusNode:f.focusNode,focusOffset:f.focusOffset}),nc&&tc(nc,f)||(nc=f,f=sh(lm,"onSelect"),0<f.length&&(o=new md("onSelect","select",null,o,c),i.push({event:o,listeners:f}),o.target=kl)))}function yo(i,o){var c={};return c[i.toLowerCase()]=o.toLowerCase(),c["Webkit"+i]="webkit"+o,c["Moz"+i]="moz"+o,c}var El={animationend:yo("Animation","AnimationEnd"),animationiteration:yo("Animation","AnimationIteration"),animationstart:yo("Animation","AnimationStart"),transitionrun:yo("Transition","TransitionRun"),transitionstart:yo("Transition","TransitionStart"),transitioncancel:yo("Transition","TransitionCancel"),transitionend:yo("Transition","TransitionEnd")},cm={},fx={};Hi&&(fx=document.createElement("div").style,"AnimationEvent"in window||(delete El.animationend.animation,delete El.animationiteration.animation,delete El.animationstart.animation),"TransitionEvent"in window||delete El.transitionend.transition);function bo(i){if(cm[i])return cm[i];if(!El[i])return i;var o=El[i],c;for(c in o)if(o.hasOwnProperty(c)&&c in fx)return cm[i]=o[c];return i}var px=bo("animationend"),mx=bo("animationiteration"),gx=bo("animationstart"),y3=bo("transitionrun"),b3=bo("transitionstart"),x3=bo("transitioncancel"),vx=bo("transitionend"),_x=new Map,um="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(" ");um.push("scrollEnd");function Qr(i,o){_x.set(i,o),vo(o,[i])}var _d=typeof reportError=="function"?reportError:function(i){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var o=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof i=="object"&&i!==null&&typeof i.message=="string"?String(i.message):String(i),error:i});if(!window.dispatchEvent(o))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",i);return}console.error(i)},Dr=[],Rl=0,dm=0;function yd(){for(var i=Rl,o=dm=Rl=0;o<i;){var c=Dr[o];Dr[o++]=null;var f=Dr[o];Dr[o++]=null;var v=Dr[o];Dr[o++]=null;var x=Dr[o];if(Dr[o++]=null,f!==null&&v!==null){var E=f.pending;E===null?v.next=v:(v.next=E.next,E.next=v),f.pending=v}x!==0&&yx(c,v,x)}}function bd(i,o,c,f){Dr[Rl++]=i,Dr[Rl++]=o,Dr[Rl++]=c,Dr[Rl++]=f,dm|=f,i.lanes|=f,i=i.alternate,i!==null&&(i.lanes|=f)}function hm(i,o,c,f){return bd(i,o,c,f),xd(i)}function xo(i,o){return bd(i,null,null,o),xd(i)}function yx(i,o,c){i.lanes|=c;var f=i.alternate;f!==null&&(f.lanes|=c);for(var v=!1,x=i.return;x!==null;)x.childLanes|=c,f=x.alternate,f!==null&&(f.childLanes|=c),x.tag===22&&(i=x.stateNode,i===null||i._visibility&1||(v=!0)),i=x,x=x.return;return i.tag===3?(x=i.stateNode,v&&o!==null&&(v=31-st(c),i=x.hiddenUpdates,f=i[v],f===null?i[v]=[o]:f.push(o),o.lane=c|536870912),x):null}function xd(i){if(50<Cc)throw Cc=0,xg=null,Error(r(185));for(var o=i.return;o!==null;)i=o,o=i.return;return i.tag===3?i.stateNode:null}var Tl={};function S3(i,o,c,f){this.tag=i,this.key=c,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=o,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=f,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function fr(i,o,c,f){return new S3(i,o,c,f)}function fm(i){return i=i.prototype,!(!i||!i.isReactComponent)}function Fi(i,o){var c=i.alternate;return c===null?(c=fr(i.tag,o,i.key,i.mode),c.elementType=i.elementType,c.type=i.type,c.stateNode=i.stateNode,c.alternate=i,i.alternate=c):(c.pendingProps=o,c.type=i.type,c.flags=0,c.subtreeFlags=0,c.deletions=null),c.flags=i.flags&65011712,c.childLanes=i.childLanes,c.lanes=i.lanes,c.child=i.child,c.memoizedProps=i.memoizedProps,c.memoizedState=i.memoizedState,c.updateQueue=i.updateQueue,o=i.dependencies,c.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext},c.sibling=i.sibling,c.index=i.index,c.ref=i.ref,c.refCleanup=i.refCleanup,c}function bx(i,o){i.flags&=65011714;var c=i.alternate;return c===null?(i.childLanes=0,i.lanes=o,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=c.childLanes,i.lanes=c.lanes,i.child=c.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=c.memoizedProps,i.memoizedState=c.memoizedState,i.updateQueue=c.updateQueue,i.type=c.type,o=c.dependencies,i.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext}),i}function Sd(i,o,c,f,v,x){var E=0;if(f=i,typeof i=="function")fm(i)&&(E=1);else if(typeof i=="string")E=RO(i,c,oe.current)?26:i==="html"||i==="head"||i==="body"?27:5;else e:switch(i){case K:return i=fr(31,c,o,v),i.elementType=K,i.lanes=x,i;case S:return So(c.children,v,x,o);case C:E=8,v|=24;break;case k:return i=fr(12,c,o,v|2),i.elementType=k,i.lanes=x,i;case j:return i=fr(13,c,o,v),i.elementType=j,i.lanes=x,i;case A:return i=fr(19,c,o,v),i.elementType=A,i.lanes=x,i;default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case R:E=10;break e;case T:E=9;break e;case N:E=11;break e;case D:E=14;break e;case B:E=16,f=null;break e}E=29,c=Error(r(130,i===null?"null":typeof i,"")),f=null}return o=fr(E,c,o,v),o.elementType=i,o.type=f,o.lanes=x,o}function So(i,o,c,f){return i=fr(7,i,f,o),i.lanes=c,i}function pm(i,o,c){return i=fr(6,i,null,o),i.lanes=c,i}function xx(i){var o=fr(18,null,null,0);return o.stateNode=i,o}function mm(i,o,c){return o=fr(4,i.children!==null?i.children:[],i.key,o),o.lanes=c,o.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},o}var Sx=new WeakMap;function Or(i,o){if(typeof i=="object"&&i!==null){var c=Sx.get(i);return c!==void 0?c:(o={value:i,source:o,stack:Gn(o)},Sx.set(i,o),o)}return{value:i,source:o,stack:Gn(o)}}var Ml=[],Nl=0,wd=null,rc=0,Lr=[],jr=0,Ss=null,fi=1,pi="";function Ui(i,o){Ml[Nl++]=rc,Ml[Nl++]=wd,wd=i,rc=o}function wx(i,o,c){Lr[jr++]=fi,Lr[jr++]=pi,Lr[jr++]=Ss,Ss=i;var f=fi;i=pi;var v=32-st(f)-1;f&=~(1<<v),c+=1;var x=32-st(o)+v;if(30<x){var E=v-v%5;x=(f&(1<<E)-1).toString(32),f>>=E,v-=E,fi=1<<32-st(o)+v|c<<v|f,pi=x+i}else fi=1<<x|c<<v|f,pi=i}function gm(i){i.return!==null&&(Ui(i,1),wx(i,1,0))}function vm(i){for(;i===wd;)wd=Ml[--Nl],Ml[Nl]=null,rc=Ml[--Nl],Ml[Nl]=null;for(;i===Ss;)Ss=Lr[--jr],Lr[jr]=null,pi=Lr[--jr],Lr[jr]=null,fi=Lr[--jr],Lr[jr]=null}function Cx(i,o){Lr[jr++]=fi,Lr[jr++]=pi,Lr[jr++]=Ss,fi=o.id,pi=o.overflow,Ss=i}var Cn=null,Et=null,rt=!1,ws=null,zr=!1,_m=Error(r(519));function Cs(i){var o=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw ic(Or(o,i)),_m}function kx(i){var o=i.stateNode,c=i.type,f=i.memoizedProps;switch(o[wn]=i,o[Zn]=f,c){case"dialog":Ze("cancel",o),Ze("close",o);break;case"iframe":case"object":case"embed":Ze("load",o);break;case"video":case"audio":for(c=0;c<Ec.length;c++)Ze(Ec[c],o);break;case"source":Ze("error",o);break;case"img":case"image":case"link":Ze("error",o),Ze("load",o);break;case"details":Ze("toggle",o);break;case"input":Ze("invalid",o),B0(o,f.value,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name,!0);break;case"select":Ze("invalid",o);break;case"textarea":Ze("invalid",o),H0(o,f.value,f.defaultValue,f.children)}c=f.children,typeof c!="string"&&typeof c!="number"&&typeof c!="bigint"||o.textContent===""+c||f.suppressHydrationWarning===!0||US(o.textContent,c)?(f.popover!=null&&(Ze("beforetoggle",o),Ze("toggle",o)),f.onScroll!=null&&Ze("scroll",o),f.onScrollEnd!=null&&Ze("scrollend",o),f.onClick!=null&&(o.onclick=Ii),o=!0):o=!1,o||Cs(i,!0)}function Ex(i){for(Cn=i.return;Cn;)switch(Cn.tag){case 5:case 31:case 13:zr=!1;return;case 27:case 3:zr=!0;return;default:Cn=Cn.return}}function Al(i){if(i!==Cn)return!1;if(!rt)return Ex(i),rt=!0,!1;var o=i.tag,c;if((c=o!==3&&o!==27)&&((c=o===5)&&(c=i.type,c=!(c!=="form"&&c!=="button")||zg(i.type,i.memoizedProps)),c=!c),c&&Et&&Cs(i),Ex(i),o===13){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(r(317));Et=ZS(i)}else if(o===31){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(r(317));Et=ZS(i)}else o===27?(o=Et,Bs(i.type)?(i=Fg,Fg=null,Et=i):Et=o):Et=Cn?Br(i.stateNode.nextSibling):null;return!0}function wo(){Et=Cn=null,rt=!1}function ym(){var i=ws;return i!==null&&(nr===null?nr=i:nr.push.apply(nr,i),ws=null),i}function ic(i){ws===null?ws=[i]:ws.push(i)}var bm=I(null),Co=null,$i=null;function ks(i,o,c){L(bm,o._currentValue),o._currentValue=c}function Wi(i){i._currentValue=bm.current,X(bm)}function xm(i,o,c){for(;i!==null;){var f=i.alternate;if((i.childLanes&o)!==o?(i.childLanes|=o,f!==null&&(f.childLanes|=o)):f!==null&&(f.childLanes&o)!==o&&(f.childLanes|=o),i===c)break;i=i.return}}function Sm(i,o,c,f){var v=i.child;for(v!==null&&(v.return=i);v!==null;){var x=v.dependencies;if(x!==null){var E=v.child;x=x.firstContext;e:for(;x!==null;){var O=x;x=v;for(var G=0;G<o.length;G++)if(O.context===o[G]){x.lanes|=c,O=x.alternate,O!==null&&(O.lanes|=c),xm(x.return,c,i),f||(E=null);break e}x=O.next}}else if(v.tag===18){if(E=v.return,E===null)throw Error(r(341));E.lanes|=c,x=E.alternate,x!==null&&(x.lanes|=c),xm(E,c,i),E=null}else E=v.child;if(E!==null)E.return=v;else for(E=v;E!==null;){if(E===i){E=null;break}if(v=E.sibling,v!==null){v.return=E.return,E=v;break}E=E.return}v=E}}function Dl(i,o,c,f){i=null;for(var v=o,x=!1;v!==null;){if(!x){if((v.flags&524288)!==0)x=!0;else if((v.flags&262144)!==0)break}if(v.tag===10){var E=v.alternate;if(E===null)throw Error(r(387));if(E=E.memoizedProps,E!==null){var O=v.type;hr(v.pendingProps.value,E.value)||(i!==null?i.push(O):i=[O])}}else if(v===J.current){if(E=v.alternate,E===null)throw Error(r(387));E.memoizedState.memoizedState!==v.memoizedState.memoizedState&&(i!==null?i.push(Ac):i=[Ac])}v=v.return}i!==null&&Sm(o,i,c,f),o.flags|=262144}function Cd(i){for(i=i.firstContext;i!==null;){if(!hr(i.context._currentValue,i.memoizedValue))return!0;i=i.next}return!1}function ko(i){Co=i,$i=null,i=i.dependencies,i!==null&&(i.firstContext=null)}function kn(i){return Rx(Co,i)}function kd(i,o){return Co===null&&ko(i),Rx(i,o)}function Rx(i,o){var c=o._currentValue;if(o={context:o,memoizedValue:c,next:null},$i===null){if(i===null)throw Error(r(308));$i=o,i.dependencies={lanes:0,firstContext:o},i.flags|=524288}else $i=$i.next=o;return c}var w3=typeof AbortController<"u"?AbortController:function(){var i=[],o=this.signal={aborted:!1,addEventListener:function(c,f){i.push(f)}};this.abort=function(){o.aborted=!0,i.forEach(function(c){return c()})}},C3=e.unstable_scheduleCallback,k3=e.unstable_NormalPriority,qt={$$typeof:R,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function wm(){return{controller:new w3,data:new Map,refCount:0}}function sc(i){i.refCount--,i.refCount===0&&C3(k3,function(){i.controller.abort()})}var oc=null,Cm=0,Ol=0,Ll=null;function E3(i,o){if(oc===null){var c=oc=[];Cm=0,Ol=Rg(),Ll={status:"pending",value:void 0,then:function(f){c.push(f)}}}return Cm++,o.then(Tx,Tx),o}function Tx(){if(--Cm===0&&oc!==null){Ll!==null&&(Ll.status="fulfilled");var i=oc;oc=null,Ol=0,Ll=null;for(var o=0;o<i.length;o++)(0,i[o])()}}function R3(i,o){var c=[],f={status:"pending",value:null,reason:null,then:function(v){c.push(v)}};return i.then(function(){f.status="fulfilled",f.value=o;for(var v=0;v<c.length;v++)(0,c[v])(o)},function(v){for(f.status="rejected",f.reason=v,v=0;v<c.length;v++)(0,c[v])(void 0)}),f}var Mx=P.S;P.S=function(i,o){hS=Ge(),typeof o=="object"&&o!==null&&typeof o.then=="function"&&E3(i,o),Mx!==null&&Mx(i,o)};var Eo=I(null);function km(){var i=Eo.current;return i!==null?i:bt.pooledCache}function Ed(i,o){o===null?L(Eo,Eo.current):L(Eo,o.pool)}function Nx(){var i=km();return i===null?null:{parent:qt._currentValue,pool:i}}var jl=Error(r(460)),Em=Error(r(474)),Rd=Error(r(542)),Td={then:function(){}};function Ax(i){return i=i.status,i==="fulfilled"||i==="rejected"}function Dx(i,o,c){switch(c=i[c],c===void 0?i.push(o):c!==o&&(o.then(Ii,Ii),o=c),o.status){case"fulfilled":return o.value;case"rejected":throw i=o.reason,Lx(i),i;default:if(typeof o.status=="string")o.then(Ii,Ii);else{if(i=bt,i!==null&&100<i.shellSuspendCounter)throw Error(r(482));i=o,i.status="pending",i.then(function(f){if(o.status==="pending"){var v=o;v.status="fulfilled",v.value=f}},function(f){if(o.status==="pending"){var v=o;v.status="rejected",v.reason=f}})}switch(o.status){case"fulfilled":return o.value;case"rejected":throw i=o.reason,Lx(i),i}throw To=o,jl}}function Ro(i){try{var o=i._init;return o(i._payload)}catch(c){throw c!==null&&typeof c=="object"&&typeof c.then=="function"?(To=c,jl):c}}var To=null;function Ox(){if(To===null)throw Error(r(459));var i=To;return To=null,i}function Lx(i){if(i===jl||i===Rd)throw Error(r(483))}var zl=null,lc=0;function Md(i){var o=lc;return lc+=1,zl===null&&(zl=[]),Dx(zl,i,o)}function ac(i,o){o=o.props.ref,i.ref=o!==void 0?o:null}function Nd(i,o){throw o.$$typeof===_?Error(r(525)):(i=Object.prototype.toString.call(o),Error(r(31,i==="[object Object]"?"object with keys {"+Object.keys(o).join(", ")+"}":i)))}function jx(i){function o(Q,Y){if(i){var ee=Q.deletions;ee===null?(Q.deletions=[Y],Q.flags|=16):ee.push(Y)}}function c(Q,Y){if(!i)return null;for(;Y!==null;)o(Q,Y),Y=Y.sibling;return null}function f(Q){for(var Y=new Map;Q!==null;)Q.key!==null?Y.set(Q.key,Q):Y.set(Q.index,Q),Q=Q.sibling;return Y}function v(Q,Y){return Q=Fi(Q,Y),Q.index=0,Q.sibling=null,Q}function x(Q,Y,ee){return Q.index=ee,i?(ee=Q.alternate,ee!==null?(ee=ee.index,ee<Y?(Q.flags|=67108866,Y):ee):(Q.flags|=67108866,Y)):(Q.flags|=1048576,Y)}function E(Q){return i&&Q.alternate===null&&(Q.flags|=67108866),Q}function O(Q,Y,ee,fe){return Y===null||Y.tag!==6?(Y=pm(ee,Q.mode,fe),Y.return=Q,Y):(Y=v(Y,ee),Y.return=Q,Y)}function G(Q,Y,ee,fe){var Oe=ee.type;return Oe===S?de(Q,Y,ee.props.children,fe,ee.key):Y!==null&&(Y.elementType===Oe||typeof Oe=="object"&&Oe!==null&&Oe.$$typeof===B&&Ro(Oe)===Y.type)?(Y=v(Y,ee.props),ac(Y,ee),Y.return=Q,Y):(Y=Sd(ee.type,ee.key,ee.props,null,Q.mode,fe),ac(Y,ee),Y.return=Q,Y)}function te(Q,Y,ee,fe){return Y===null||Y.tag!==4||Y.stateNode.containerInfo!==ee.containerInfo||Y.stateNode.implementation!==ee.implementation?(Y=mm(ee,Q.mode,fe),Y.return=Q,Y):(Y=v(Y,ee.children||[]),Y.return=Q,Y)}function de(Q,Y,ee,fe,Oe){return Y===null||Y.tag!==7?(Y=So(ee,Q.mode,fe,Oe),Y.return=Q,Y):(Y=v(Y,ee),Y.return=Q,Y)}function me(Q,Y,ee){if(typeof Y=="string"&&Y!==""||typeof Y=="number"||typeof Y=="bigint")return Y=pm(""+Y,Q.mode,ee),Y.return=Q,Y;if(typeof Y=="object"&&Y!==null){switch(Y.$$typeof){case y:return ee=Sd(Y.type,Y.key,Y.props,null,Q.mode,ee),ac(ee,Y),ee.return=Q,ee;case w:return Y=mm(Y,Q.mode,ee),Y.return=Q,Y;case B:return Y=Ro(Y),me(Q,Y,ee)}if($(Y)||H(Y))return Y=So(Y,Q.mode,ee,null),Y.return=Q,Y;if(typeof Y.then=="function")return me(Q,Md(Y),ee);if(Y.$$typeof===R)return me(Q,kd(Q,Y),ee);Nd(Q,Y)}return null}function ne(Q,Y,ee,fe){var Oe=Y!==null?Y.key:null;if(typeof ee=="string"&&ee!==""||typeof ee=="number"||typeof ee=="bigint")return Oe!==null?null:O(Q,Y,""+ee,fe);if(typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case y:return ee.key===Oe?G(Q,Y,ee,fe):null;case w:return ee.key===Oe?te(Q,Y,ee,fe):null;case B:return ee=Ro(ee),ne(Q,Y,ee,fe)}if($(ee)||H(ee))return Oe!==null?null:de(Q,Y,ee,fe,null);if(typeof ee.then=="function")return ne(Q,Y,Md(ee),fe);if(ee.$$typeof===R)return ne(Q,Y,kd(Q,ee),fe);Nd(Q,ee)}return null}function ie(Q,Y,ee,fe,Oe){if(typeof fe=="string"&&fe!==""||typeof fe=="number"||typeof fe=="bigint")return Q=Q.get(ee)||null,O(Y,Q,""+fe,Oe);if(typeof fe=="object"&&fe!==null){switch(fe.$$typeof){case y:return Q=Q.get(fe.key===null?ee:fe.key)||null,G(Y,Q,fe,Oe);case w:return Q=Q.get(fe.key===null?ee:fe.key)||null,te(Y,Q,fe,Oe);case B:return fe=Ro(fe),ie(Q,Y,ee,fe,Oe)}if($(fe)||H(fe))return Q=Q.get(ee)||null,de(Y,Q,fe,Oe,null);if(typeof fe.then=="function")return ie(Q,Y,ee,Md(fe),Oe);if(fe.$$typeof===R)return ie(Q,Y,ee,kd(Y,fe),Oe);Nd(Y,fe)}return null}function Re(Q,Y,ee,fe){for(var Oe=null,lt=null,De=Y,Ue=Y=0,tt=null;De!==null&&Ue<ee.length;Ue++){De.index>Ue?(tt=De,De=null):tt=De.sibling;var at=ne(Q,De,ee[Ue],fe);if(at===null){De===null&&(De=tt);break}i&&De&&at.alternate===null&&o(Q,De),Y=x(at,Y,Ue),lt===null?Oe=at:lt.sibling=at,lt=at,De=tt}if(Ue===ee.length)return c(Q,De),rt&&Ui(Q,Ue),Oe;if(De===null){for(;Ue<ee.length;Ue++)De=me(Q,ee[Ue],fe),De!==null&&(Y=x(De,Y,Ue),lt===null?Oe=De:lt.sibling=De,lt=De);return rt&&Ui(Q,Ue),Oe}for(De=f(De);Ue<ee.length;Ue++)tt=ie(De,Q,Ue,ee[Ue],fe),tt!==null&&(i&&tt.alternate!==null&&De.delete(tt.key===null?Ue:tt.key),Y=x(tt,Y,Ue),lt===null?Oe=tt:lt.sibling=tt,lt=tt);return i&&De.forEach(function($s){return o(Q,$s)}),rt&&Ui(Q,Ue),Oe}function ze(Q,Y,ee,fe){if(ee==null)throw Error(r(151));for(var Oe=null,lt=null,De=Y,Ue=Y=0,tt=null,at=ee.next();De!==null&&!at.done;Ue++,at=ee.next()){De.index>Ue?(tt=De,De=null):tt=De.sibling;var $s=ne(Q,De,at.value,fe);if($s===null){De===null&&(De=tt);break}i&&De&&$s.alternate===null&&o(Q,De),Y=x($s,Y,Ue),lt===null?Oe=$s:lt.sibling=$s,lt=$s,De=tt}if(at.done)return c(Q,De),rt&&Ui(Q,Ue),Oe;if(De===null){for(;!at.done;Ue++,at=ee.next())at=me(Q,at.value,fe),at!==null&&(Y=x(at,Y,Ue),lt===null?Oe=at:lt.sibling=at,lt=at);return rt&&Ui(Q,Ue),Oe}for(De=f(De);!at.done;Ue++,at=ee.next())at=ie(De,Q,Ue,at.value,fe),at!==null&&(i&&at.alternate!==null&&De.delete(at.key===null?Ue:at.key),Y=x(at,Y,Ue),lt===null?Oe=at:lt.sibling=at,lt=at);return i&&De.forEach(function(BO){return o(Q,BO)}),rt&&Ui(Q,Ue),Oe}function gt(Q,Y,ee,fe){if(typeof ee=="object"&&ee!==null&&ee.type===S&&ee.key===null&&(ee=ee.props.children),typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case y:e:{for(var Oe=ee.key;Y!==null;){if(Y.key===Oe){if(Oe=ee.type,Oe===S){if(Y.tag===7){c(Q,Y.sibling),fe=v(Y,ee.props.children),fe.return=Q,Q=fe;break e}}else if(Y.elementType===Oe||typeof Oe=="object"&&Oe!==null&&Oe.$$typeof===B&&Ro(Oe)===Y.type){c(Q,Y.sibling),fe=v(Y,ee.props),ac(fe,ee),fe.return=Q,Q=fe;break e}c(Q,Y);break}else o(Q,Y);Y=Y.sibling}ee.type===S?(fe=So(ee.props.children,Q.mode,fe,ee.key),fe.return=Q,Q=fe):(fe=Sd(ee.type,ee.key,ee.props,null,Q.mode,fe),ac(fe,ee),fe.return=Q,Q=fe)}return E(Q);case w:e:{for(Oe=ee.key;Y!==null;){if(Y.key===Oe)if(Y.tag===4&&Y.stateNode.containerInfo===ee.containerInfo&&Y.stateNode.implementation===ee.implementation){c(Q,Y.sibling),fe=v(Y,ee.children||[]),fe.return=Q,Q=fe;break e}else{c(Q,Y);break}else o(Q,Y);Y=Y.sibling}fe=mm(ee,Q.mode,fe),fe.return=Q,Q=fe}return E(Q);case B:return ee=Ro(ee),gt(Q,Y,ee,fe)}if($(ee))return Re(Q,Y,ee,fe);if(H(ee)){if(Oe=H(ee),typeof Oe!="function")throw Error(r(150));return ee=Oe.call(ee),ze(Q,Y,ee,fe)}if(typeof ee.then=="function")return gt(Q,Y,Md(ee),fe);if(ee.$$typeof===R)return gt(Q,Y,kd(Q,ee),fe);Nd(Q,ee)}return typeof ee=="string"&&ee!==""||typeof ee=="number"||typeof ee=="bigint"?(ee=""+ee,Y!==null&&Y.tag===6?(c(Q,Y.sibling),fe=v(Y,ee),fe.return=Q,Q=fe):(c(Q,Y),fe=pm(ee,Q.mode,fe),fe.return=Q,Q=fe),E(Q)):c(Q,Y)}return function(Q,Y,ee,fe){try{lc=0;var Oe=gt(Q,Y,ee,fe);return zl=null,Oe}catch(De){if(De===jl||De===Rd)throw De;var lt=fr(29,De,null,Q.mode);return lt.lanes=fe,lt.return=Q,lt}finally{}}}var Mo=jx(!0),zx=jx(!1),Es=!1;function Rm(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Tm(i,o){i=i.updateQueue,o.updateQueue===i&&(o.updateQueue={baseState:i.baseState,firstBaseUpdate:i.firstBaseUpdate,lastBaseUpdate:i.lastBaseUpdate,shared:i.shared,callbacks:null})}function Rs(i){return{lane:i,tag:0,payload:null,callback:null,next:null}}function Ts(i,o,c){var f=i.updateQueue;if(f===null)return null;if(f=f.shared,(ct&2)!==0){var v=f.pending;return v===null?o.next=o:(o.next=v.next,v.next=o),f.pending=o,o=xd(i),yx(i,null,c),o}return bd(i,f,o,c),xd(i)}function cc(i,o,c){if(o=o.updateQueue,o!==null&&(o=o.shared,(c&4194048)!==0)){var f=o.lanes;f&=i.pendingLanes,c|=f,o.lanes=c,dr(i,c)}}function Mm(i,o){var c=i.updateQueue,f=i.alternate;if(f!==null&&(f=f.updateQueue,c===f)){var v=null,x=null;if(c=c.firstBaseUpdate,c!==null){do{var E={lane:c.lane,tag:c.tag,payload:c.payload,callback:null,next:null};x===null?v=x=E:x=x.next=E,c=c.next}while(c!==null);x===null?v=x=o:x=x.next=o}else v=x=o;c={baseState:f.baseState,firstBaseUpdate:v,lastBaseUpdate:x,shared:f.shared,callbacks:f.callbacks},i.updateQueue=c;return}i=c.lastBaseUpdate,i===null?c.firstBaseUpdate=o:i.next=o,c.lastBaseUpdate=o}var Nm=!1;function uc(){if(Nm){var i=Ll;if(i!==null)throw i}}function dc(i,o,c,f){Nm=!1;var v=i.updateQueue;Es=!1;var x=v.firstBaseUpdate,E=v.lastBaseUpdate,O=v.shared.pending;if(O!==null){v.shared.pending=null;var G=O,te=G.next;G.next=null,E===null?x=te:E.next=te,E=G;var de=i.alternate;de!==null&&(de=de.updateQueue,O=de.lastBaseUpdate,O!==E&&(O===null?de.firstBaseUpdate=te:O.next=te,de.lastBaseUpdate=G))}if(x!==null){var me=v.baseState;E=0,de=te=G=null,O=x;do{var ne=O.lane&-536870913,ie=ne!==O.lane;if(ie?(et&ne)===ne:(f&ne)===ne){ne!==0&&ne===Ol&&(Nm=!0),de!==null&&(de=de.next={lane:0,tag:O.tag,payload:O.payload,callback:null,next:null});e:{var Re=i,ze=O;ne=o;var gt=c;switch(ze.tag){case 1:if(Re=ze.payload,typeof Re=="function"){me=Re.call(gt,me,ne);break e}me=Re;break e;case 3:Re.flags=Re.flags&-65537|128;case 0:if(Re=ze.payload,ne=typeof Re=="function"?Re.call(gt,me,ne):Re,ne==null)break e;me=m({},me,ne);break e;case 2:Es=!0}}ne=O.callback,ne!==null&&(i.flags|=64,ie&&(i.flags|=8192),ie=v.callbacks,ie===null?v.callbacks=[ne]:ie.push(ne))}else ie={lane:ne,tag:O.tag,payload:O.payload,callback:O.callback,next:null},de===null?(te=de=ie,G=me):de=de.next=ie,E|=ne;if(O=O.next,O===null){if(O=v.shared.pending,O===null)break;ie=O,O=ie.next,ie.next=null,v.lastBaseUpdate=ie,v.shared.pending=null}}while(!0);de===null&&(G=me),v.baseState=G,v.firstBaseUpdate=te,v.lastBaseUpdate=de,x===null&&(v.shared.lanes=0),Os|=E,i.lanes=E,i.memoizedState=me}}function Px(i,o){if(typeof i!="function")throw Error(r(191,i));i.call(o)}function Bx(i,o){var c=i.callbacks;if(c!==null)for(i.callbacks=null,i=0;i<c.length;i++)Px(c[i],o)}var Pl=I(null),Ad=I(0);function Ix(i,o){i=Ji,L(Ad,i),L(Pl,o),Ji=i|o.baseLanes}function Am(){L(Ad,Ji),L(Pl,Pl.current)}function Dm(){Ji=Ad.current,X(Pl),X(Ad)}var pr=I(null),Pr=null;function Ms(i){var o=i.alternate;L(Ht,Ht.current&1),L(pr,i),Pr===null&&(o===null||Pl.current!==null||o.memoizedState!==null)&&(Pr=i)}function Om(i){L(Ht,Ht.current),L(pr,i),Pr===null&&(Pr=i)}function Hx(i){i.tag===22?(L(Ht,Ht.current),L(pr,i),Pr===null&&(Pr=i)):Ns()}function Ns(){L(Ht,Ht.current),L(pr,pr.current)}function mr(i){X(pr),Pr===i&&(Pr=null),X(Ht)}var Ht=I(0);function Dd(i){for(var o=i;o!==null;){if(o.tag===13){var c=o.memoizedState;if(c!==null&&(c=c.dehydrated,c===null||Ig(c)||Hg(c)))return o}else if(o.tag===19&&(o.memoizedProps.revealOrder==="forwards"||o.memoizedProps.revealOrder==="backwards"||o.memoizedProps.revealOrder==="unstable_legacy-backwards"||o.memoizedProps.revealOrder==="together")){if((o.flags&128)!==0)return o}else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===i)break;for(;o.sibling===null;){if(o.return===null||o.return===i)return null;o=o.return}o.sibling.return=o.return,o=o.sibling}return null}var Vi=0,Fe=null,pt=null,Kt=null,Od=!1,Bl=!1,No=!1,Ld=0,hc=0,Il=null,T3=0;function jt(){throw Error(r(321))}function Lm(i,o){if(o===null)return!1;for(var c=0;c<o.length&&c<i.length;c++)if(!hr(i[c],o[c]))return!1;return!0}function jm(i,o,c,f,v,x){return Vi=x,Fe=o,o.memoizedState=null,o.updateQueue=null,o.lanes=0,P.H=i===null||i.memoizedState===null?w1:Xm,No=!1,x=c(f,v),No=!1,Bl&&(x=Ux(o,c,f,v)),Fx(i),x}function Fx(i){P.H=mc;var o=pt!==null&&pt.next!==null;if(Vi=0,Kt=pt=Fe=null,Od=!1,hc=0,Il=null,o)throw Error(r(300));i===null||Gt||(i=i.dependencies,i!==null&&Cd(i)&&(Gt=!0))}function Ux(i,o,c,f){Fe=i;var v=0;do{if(Bl&&(Il=null),hc=0,Bl=!1,25<=v)throw Error(r(301));if(v+=1,Kt=pt=null,i.updateQueue!=null){var x=i.updateQueue;x.lastEffect=null,x.events=null,x.stores=null,x.memoCache!=null&&(x.memoCache.index=0)}P.H=C1,x=o(c,f)}while(Bl);return x}function M3(){var i=P.H,o=i.useState()[0];return o=typeof o.then=="function"?fc(o):o,i=i.useState()[0],(pt!==null?pt.memoizedState:null)!==i&&(Fe.flags|=1024),o}function zm(){var i=Ld!==0;return Ld=0,i}function Pm(i,o,c){o.updateQueue=i.updateQueue,o.flags&=-2053,i.lanes&=~c}function Bm(i){if(Od){for(i=i.memoizedState;i!==null;){var o=i.queue;o!==null&&(o.pending=null),i=i.next}Od=!1}Vi=0,Kt=pt=Fe=null,Bl=!1,hc=Ld=0,Il=null}function In(){var i={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Kt===null?Fe.memoizedState=Kt=i:Kt=Kt.next=i,Kt}function Ft(){if(pt===null){var i=Fe.alternate;i=i!==null?i.memoizedState:null}else i=pt.next;var o=Kt===null?Fe.memoizedState:Kt.next;if(o!==null)Kt=o,pt=i;else{if(i===null)throw Fe.alternate===null?Error(r(467)):Error(r(310));pt=i,i={memoizedState:pt.memoizedState,baseState:pt.baseState,baseQueue:pt.baseQueue,queue:pt.queue,next:null},Kt===null?Fe.memoizedState=Kt=i:Kt=Kt.next=i}return Kt}function jd(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function fc(i){var o=hc;return hc+=1,Il===null&&(Il=[]),i=Dx(Il,i,o),o=Fe,(Kt===null?o.memoizedState:Kt.next)===null&&(o=o.alternate,P.H=o===null||o.memoizedState===null?w1:Xm),i}function zd(i){if(i!==null&&typeof i=="object"){if(typeof i.then=="function")return fc(i);if(i.$$typeof===R)return kn(i)}throw Error(r(438,String(i)))}function Im(i){var o=null,c=Fe.updateQueue;if(c!==null&&(o=c.memoCache),o==null){var f=Fe.alternate;f!==null&&(f=f.updateQueue,f!==null&&(f=f.memoCache,f!=null&&(o={data:f.data.map(function(v){return v.slice()}),index:0})))}if(o==null&&(o={data:[],index:0}),c===null&&(c=jd(),Fe.updateQueue=c),c.memoCache=o,c=o.data[o.index],c===void 0)for(c=o.data[o.index]=Array(i),f=0;f<i;f++)c[f]=z;return o.index++,c}function qi(i,o){return typeof o=="function"?o(i):o}function Pd(i){var o=Ft();return Hm(o,pt,i)}function Hm(i,o,c){var f=i.queue;if(f===null)throw Error(r(311));f.lastRenderedReducer=c;var v=i.baseQueue,x=f.pending;if(x!==null){if(v!==null){var E=v.next;v.next=x.next,x.next=E}o.baseQueue=v=x,f.pending=null}if(x=i.baseState,v===null)i.memoizedState=x;else{o=v.next;var O=E=null,G=null,te=o,de=!1;do{var me=te.lane&-536870913;if(me!==te.lane?(et&me)===me:(Vi&me)===me){var ne=te.revertLane;if(ne===0)G!==null&&(G=G.next={lane:0,revertLane:0,gesture:null,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null}),me===Ol&&(de=!0);else if((Vi&ne)===ne){te=te.next,ne===Ol&&(de=!0);continue}else me={lane:0,revertLane:te.revertLane,gesture:null,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null},G===null?(O=G=me,E=x):G=G.next=me,Fe.lanes|=ne,Os|=ne;me=te.action,No&&c(x,me),x=te.hasEagerState?te.eagerState:c(x,me)}else ne={lane:me,revertLane:te.revertLane,gesture:te.gesture,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null},G===null?(O=G=ne,E=x):G=G.next=ne,Fe.lanes|=me,Os|=me;te=te.next}while(te!==null&&te!==o);if(G===null?E=x:G.next=O,!hr(x,i.memoizedState)&&(Gt=!0,de&&(c=Ll,c!==null)))throw c;i.memoizedState=x,i.baseState=E,i.baseQueue=G,f.lastRenderedState=x}return v===null&&(f.lanes=0),[i.memoizedState,f.dispatch]}function Fm(i){var o=Ft(),c=o.queue;if(c===null)throw Error(r(311));c.lastRenderedReducer=i;var f=c.dispatch,v=c.pending,x=o.memoizedState;if(v!==null){c.pending=null;var E=v=v.next;do x=i(x,E.action),E=E.next;while(E!==v);hr(x,o.memoizedState)||(Gt=!0),o.memoizedState=x,o.baseQueue===null&&(o.baseState=x),c.lastRenderedState=x}return[x,f]}function $x(i,o,c){var f=Fe,v=Ft(),x=rt;if(x){if(c===void 0)throw Error(r(407));c=c()}else c=o();var E=!hr((pt||v).memoizedState,c);if(E&&(v.memoizedState=c,Gt=!0),v=v.queue,Wm(qx.bind(null,f,v,i),[i]),v.getSnapshot!==o||E||Kt!==null&&Kt.memoizedState.tag&1){if(f.flags|=2048,Hl(9,{destroy:void 0},Vx.bind(null,f,v,c,o),null),bt===null)throw Error(r(349));x||(Vi&127)!==0||Wx(f,o,c)}return c}function Wx(i,o,c){i.flags|=16384,i={getSnapshot:o,value:c},o=Fe.updateQueue,o===null?(o=jd(),Fe.updateQueue=o,o.stores=[i]):(c=o.stores,c===null?o.stores=[i]:c.push(i))}function Vx(i,o,c,f){o.value=c,o.getSnapshot=f,Kx(o)&&Gx(i)}function qx(i,o,c){return c(function(){Kx(o)&&Gx(i)})}function Kx(i){var o=i.getSnapshot;i=i.value;try{var c=o();return!hr(i,c)}catch{return!0}}function Gx(i){var o=xo(i,2);o!==null&&rr(o,i,2)}function Um(i){var o=In();if(typeof i=="function"){var c=i;if(i=c(),No){Vt(!0);try{c()}finally{Vt(!1)}}}return o.memoizedState=o.baseState=i,o.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:qi,lastRenderedState:i},o}function Yx(i,o,c,f){return i.baseState=c,Hm(i,pt,typeof f=="function"?f:qi)}function N3(i,o,c,f,v){if(Hd(i))throw Error(r(485));if(i=o.action,i!==null){var x={payload:v,action:i,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(E){x.listeners.push(E)}};P.T!==null?c(!0):x.isTransition=!1,f(x),c=o.pending,c===null?(x.next=o.pending=x,Xx(o,x)):(x.next=c.next,o.pending=c.next=x)}}function Xx(i,o){var c=o.action,f=o.payload,v=i.state;if(o.isTransition){var x=P.T,E={};P.T=E;try{var O=c(v,f),G=P.S;G!==null&&G(E,O),Zx(i,o,O)}catch(te){$m(i,o,te)}finally{x!==null&&E.types!==null&&(x.types=E.types),P.T=x}}else try{x=c(v,f),Zx(i,o,x)}catch(te){$m(i,o,te)}}function Zx(i,o,c){c!==null&&typeof c=="object"&&typeof c.then=="function"?c.then(function(f){Qx(i,o,f)},function(f){return $m(i,o,f)}):Qx(i,o,c)}function Qx(i,o,c){o.status="fulfilled",o.value=c,Jx(o),i.state=c,o=i.pending,o!==null&&(c=o.next,c===o?i.pending=null:(c=c.next,o.next=c,Xx(i,c)))}function $m(i,o,c){var f=i.pending;if(i.pending=null,f!==null){f=f.next;do o.status="rejected",o.reason=c,Jx(o),o=o.next;while(o!==f)}i.action=null}function Jx(i){i=i.listeners;for(var o=0;o<i.length;o++)(0,i[o])()}function e1(i,o){return o}function t1(i,o){if(rt){var c=bt.formState;if(c!==null){e:{var f=Fe;if(rt){if(Et){t:{for(var v=Et,x=zr;v.nodeType!==8;){if(!x){v=null;break t}if(v=Br(v.nextSibling),v===null){v=null;break t}}x=v.data,v=x==="F!"||x==="F"?v:null}if(v){Et=Br(v.nextSibling),f=v.data==="F!";break e}}Cs(f)}f=!1}f&&(o=c[0])}}return c=In(),c.memoizedState=c.baseState=o,f={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e1,lastRenderedState:o},c.queue=f,c=b1.bind(null,Fe,f),f.dispatch=c,f=Um(!1),x=Ym.bind(null,Fe,!1,f.queue),f=In(),v={state:o,dispatch:null,action:i,pending:null},f.queue=v,c=N3.bind(null,Fe,v,x,c),v.dispatch=c,f.memoizedState=i,[o,c,!1]}function n1(i){var o=Ft();return r1(o,pt,i)}function r1(i,o,c){if(o=Hm(i,o,e1)[0],i=Pd(qi)[0],typeof o=="object"&&o!==null&&typeof o.then=="function")try{var f=fc(o)}catch(E){throw E===jl?Rd:E}else f=o;o=Ft();var v=o.queue,x=v.dispatch;return c!==o.memoizedState&&(Fe.flags|=2048,Hl(9,{destroy:void 0},A3.bind(null,v,c),null)),[f,x,i]}function A3(i,o){i.action=o}function i1(i){var o=Ft(),c=pt;if(c!==null)return r1(o,c,i);Ft(),o=o.memoizedState,c=Ft();var f=c.queue.dispatch;return c.memoizedState=i,[o,f,!1]}function Hl(i,o,c,f){return i={tag:i,create:c,deps:f,inst:o,next:null},o=Fe.updateQueue,o===null&&(o=jd(),Fe.updateQueue=o),c=o.lastEffect,c===null?o.lastEffect=i.next=i:(f=c.next,c.next=i,i.next=f,o.lastEffect=i),i}function s1(){return Ft().memoizedState}function Bd(i,o,c,f){var v=In();Fe.flags|=i,v.memoizedState=Hl(1|o,{destroy:void 0},c,f===void 0?null:f)}function Id(i,o,c,f){var v=Ft();f=f===void 0?null:f;var x=v.memoizedState.inst;pt!==null&&f!==null&&Lm(f,pt.memoizedState.deps)?v.memoizedState=Hl(o,x,c,f):(Fe.flags|=i,v.memoizedState=Hl(1|o,x,c,f))}function o1(i,o){Bd(8390656,8,i,o)}function Wm(i,o){Id(2048,8,i,o)}function D3(i){Fe.flags|=4;var o=Fe.updateQueue;if(o===null)o=jd(),Fe.updateQueue=o,o.events=[i];else{var c=o.events;c===null?o.events=[i]:c.push(i)}}function l1(i){var o=Ft().memoizedState;return D3({ref:o,nextImpl:i}),function(){if((ct&2)!==0)throw Error(r(440));return o.impl.apply(void 0,arguments)}}function a1(i,o){return Id(4,2,i,o)}function c1(i,o){return Id(4,4,i,o)}function u1(i,o){if(typeof o=="function"){i=i();var c=o(i);return function(){typeof c=="function"?c():o(null)}}if(o!=null)return i=i(),o.current=i,function(){o.current=null}}function d1(i,o,c){c=c!=null?c.concat([i]):null,Id(4,4,u1.bind(null,o,i),c)}function Vm(){}function h1(i,o){var c=Ft();o=o===void 0?null:o;var f=c.memoizedState;return o!==null&&Lm(o,f[1])?f[0]:(c.memoizedState=[i,o],i)}function f1(i,o){var c=Ft();o=o===void 0?null:o;var f=c.memoizedState;if(o!==null&&Lm(o,f[1]))return f[0];if(f=i(),No){Vt(!0);try{i()}finally{Vt(!1)}}return c.memoizedState=[f,o],f}function qm(i,o,c){return c===void 0||(Vi&1073741824)!==0&&(et&261930)===0?i.memoizedState=o:(i.memoizedState=c,i=pS(),Fe.lanes|=i,Os|=i,c)}function p1(i,o,c,f){return hr(c,o)?c:Pl.current!==null?(i=qm(i,c,f),hr(i,o)||(Gt=!0),i):(Vi&42)===0||(Vi&1073741824)!==0&&(et&261930)===0?(Gt=!0,i.memoizedState=c):(i=pS(),Fe.lanes|=i,Os|=i,o)}function m1(i,o,c,f,v){var x=V.p;V.p=x!==0&&8>x?x:8;var E=P.T,O={};P.T=O,Ym(i,!1,o,c);try{var G=v(),te=P.S;if(te!==null&&te(O,G),G!==null&&typeof G=="object"&&typeof G.then=="function"){var de=R3(G,f);pc(i,o,de,_r(i))}else pc(i,o,f,_r(i))}catch(me){pc(i,o,{then:function(){},status:"rejected",reason:me},_r())}finally{V.p=x,E!==null&&O.types!==null&&(E.types=O.types),P.T=E}}function O3(){}function Km(i,o,c,f){if(i.tag!==5)throw Error(r(476));var v=g1(i).queue;m1(i,v,o,W,c===null?O3:function(){return v1(i),c(f)})}function g1(i){var o=i.memoizedState;if(o!==null)return o;o={memoizedState:W,baseState:W,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:qi,lastRenderedState:W},next:null};var c={};return o.next={memoizedState:c,baseState:c,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:qi,lastRenderedState:c},next:null},i.memoizedState=o,i=i.alternate,i!==null&&(i.memoizedState=o),o}function v1(i){var o=g1(i);o.next===null&&(o=i.alternate.memoizedState),pc(i,o.next.queue,{},_r())}function Gm(){return kn(Ac)}function _1(){return Ft().memoizedState}function y1(){return Ft().memoizedState}function L3(i){for(var o=i.return;o!==null;){switch(o.tag){case 24:case 3:var c=_r();i=Rs(c);var f=Ts(o,i,c);f!==null&&(rr(f,o,c),cc(f,o,c)),o={cache:wm()},i.payload=o;return}o=o.return}}function j3(i,o,c){var f=_r();c={lane:f,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},Hd(i)?x1(o,c):(c=hm(i,o,c,f),c!==null&&(rr(c,i,f),S1(c,o,f)))}function b1(i,o,c){var f=_r();pc(i,o,c,f)}function pc(i,o,c,f){var v={lane:f,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null};if(Hd(i))x1(o,v);else{var x=i.alternate;if(i.lanes===0&&(x===null||x.lanes===0)&&(x=o.lastRenderedReducer,x!==null))try{var E=o.lastRenderedState,O=x(E,c);if(v.hasEagerState=!0,v.eagerState=O,hr(O,E))return bd(i,o,v,0),bt===null&&yd(),!1}catch{}finally{}if(c=hm(i,o,v,f),c!==null)return rr(c,i,f),S1(c,o,f),!0}return!1}function Ym(i,o,c,f){if(f={lane:2,revertLane:Rg(),gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null},Hd(i)){if(o)throw Error(r(479))}else o=hm(i,c,f,2),o!==null&&rr(o,i,2)}function Hd(i){var o=i.alternate;return i===Fe||o!==null&&o===Fe}function x1(i,o){Bl=Od=!0;var c=i.pending;c===null?o.next=o:(o.next=c.next,c.next=o),i.pending=o}function S1(i,o,c){if((c&4194048)!==0){var f=o.lanes;f&=i.pendingLanes,c|=f,o.lanes=c,dr(i,c)}}var mc={readContext:kn,use:zd,useCallback:jt,useContext:jt,useEffect:jt,useImperativeHandle:jt,useLayoutEffect:jt,useInsertionEffect:jt,useMemo:jt,useReducer:jt,useRef:jt,useState:jt,useDebugValue:jt,useDeferredValue:jt,useTransition:jt,useSyncExternalStore:jt,useId:jt,useHostTransitionStatus:jt,useFormState:jt,useActionState:jt,useOptimistic:jt,useMemoCache:jt,useCacheRefresh:jt};mc.useEffectEvent=jt;var w1={readContext:kn,use:zd,useCallback:function(i,o){return In().memoizedState=[i,o===void 0?null:o],i},useContext:kn,useEffect:o1,useImperativeHandle:function(i,o,c){c=c!=null?c.concat([i]):null,Bd(4194308,4,u1.bind(null,o,i),c)},useLayoutEffect:function(i,o){return Bd(4194308,4,i,o)},useInsertionEffect:function(i,o){Bd(4,2,i,o)},useMemo:function(i,o){var c=In();o=o===void 0?null:o;var f=i();if(No){Vt(!0);try{i()}finally{Vt(!1)}}return c.memoizedState=[f,o],f},useReducer:function(i,o,c){var f=In();if(c!==void 0){var v=c(o);if(No){Vt(!0);try{c(o)}finally{Vt(!1)}}}else v=o;return f.memoizedState=f.baseState=v,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:v},f.queue=i,i=i.dispatch=j3.bind(null,Fe,i),[f.memoizedState,i]},useRef:function(i){var o=In();return i={current:i},o.memoizedState=i},useState:function(i){i=Um(i);var o=i.queue,c=b1.bind(null,Fe,o);return o.dispatch=c,[i.memoizedState,c]},useDebugValue:Vm,useDeferredValue:function(i,o){var c=In();return qm(c,i,o)},useTransition:function(){var i=Um(!1);return i=m1.bind(null,Fe,i.queue,!0,!1),In().memoizedState=i,[!1,i]},useSyncExternalStore:function(i,o,c){var f=Fe,v=In();if(rt){if(c===void 0)throw Error(r(407));c=c()}else{if(c=o(),bt===null)throw Error(r(349));(et&127)!==0||Wx(f,o,c)}v.memoizedState=c;var x={value:c,getSnapshot:o};return v.queue=x,o1(qx.bind(null,f,x,i),[i]),f.flags|=2048,Hl(9,{destroy:void 0},Vx.bind(null,f,x,c,o),null),c},useId:function(){var i=In(),o=bt.identifierPrefix;if(rt){var c=pi,f=fi;c=(f&~(1<<32-st(f)-1)).toString(32)+c,o="_"+o+"R_"+c,c=Ld++,0<c&&(o+="H"+c.toString(32)),o+="_"}else c=T3++,o="_"+o+"r_"+c.toString(32)+"_";return i.memoizedState=o},useHostTransitionStatus:Gm,useFormState:t1,useActionState:t1,useOptimistic:function(i){var o=In();o.memoizedState=o.baseState=i;var c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return o.queue=c,o=Ym.bind(null,Fe,!0,c),c.dispatch=o,[i,o]},useMemoCache:Im,useCacheRefresh:function(){return In().memoizedState=L3.bind(null,Fe)},useEffectEvent:function(i){var o=In(),c={impl:i};return o.memoizedState=c,function(){if((ct&2)!==0)throw Error(r(440));return c.impl.apply(void 0,arguments)}}},Xm={readContext:kn,use:zd,useCallback:h1,useContext:kn,useEffect:Wm,useImperativeHandle:d1,useInsertionEffect:a1,useLayoutEffect:c1,useMemo:f1,useReducer:Pd,useRef:s1,useState:function(){return Pd(qi)},useDebugValue:Vm,useDeferredValue:function(i,o){var c=Ft();return p1(c,pt.memoizedState,i,o)},useTransition:function(){var i=Pd(qi)[0],o=Ft().memoizedState;return[typeof i=="boolean"?i:fc(i),o]},useSyncExternalStore:$x,useId:_1,useHostTransitionStatus:Gm,useFormState:n1,useActionState:n1,useOptimistic:function(i,o){var c=Ft();return Yx(c,pt,i,o)},useMemoCache:Im,useCacheRefresh:y1};Xm.useEffectEvent=l1;var C1={readContext:kn,use:zd,useCallback:h1,useContext:kn,useEffect:Wm,useImperativeHandle:d1,useInsertionEffect:a1,useLayoutEffect:c1,useMemo:f1,useReducer:Fm,useRef:s1,useState:function(){return Fm(qi)},useDebugValue:Vm,useDeferredValue:function(i,o){var c=Ft();return pt===null?qm(c,i,o):p1(c,pt.memoizedState,i,o)},useTransition:function(){var i=Fm(qi)[0],o=Ft().memoizedState;return[typeof i=="boolean"?i:fc(i),o]},useSyncExternalStore:$x,useId:_1,useHostTransitionStatus:Gm,useFormState:i1,useActionState:i1,useOptimistic:function(i,o){var c=Ft();return pt!==null?Yx(c,pt,i,o):(c.baseState=i,[i,c.queue.dispatch])},useMemoCache:Im,useCacheRefresh:y1};C1.useEffectEvent=l1;function Zm(i,o,c,f){o=i.memoizedState,c=c(f,o),c=c==null?o:m({},o,c),i.memoizedState=c,i.lanes===0&&(i.updateQueue.baseState=c)}var Qm={enqueueSetState:function(i,o,c){i=i._reactInternals;var f=_r(),v=Rs(f);v.payload=o,c!=null&&(v.callback=c),o=Ts(i,v,f),o!==null&&(rr(o,i,f),cc(o,i,f))},enqueueReplaceState:function(i,o,c){i=i._reactInternals;var f=_r(),v=Rs(f);v.tag=1,v.payload=o,c!=null&&(v.callback=c),o=Ts(i,v,f),o!==null&&(rr(o,i,f),cc(o,i,f))},enqueueForceUpdate:function(i,o){i=i._reactInternals;var c=_r(),f=Rs(c);f.tag=2,o!=null&&(f.callback=o),o=Ts(i,f,c),o!==null&&(rr(o,i,c),cc(o,i,c))}};function k1(i,o,c,f,v,x,E){return i=i.stateNode,typeof i.shouldComponentUpdate=="function"?i.shouldComponentUpdate(f,x,E):o.prototype&&o.prototype.isPureReactComponent?!tc(c,f)||!tc(v,x):!0}function E1(i,o,c,f){i=o.state,typeof o.componentWillReceiveProps=="function"&&o.componentWillReceiveProps(c,f),typeof o.UNSAFE_componentWillReceiveProps=="function"&&o.UNSAFE_componentWillReceiveProps(c,f),o.state!==i&&Qm.enqueueReplaceState(o,o.state,null)}function Ao(i,o){var c=o;if("ref"in o){c={};for(var f in o)f!=="ref"&&(c[f]=o[f])}if(i=i.defaultProps){c===o&&(c=m({},c));for(var v in i)c[v]===void 0&&(c[v]=i[v])}return c}function R1(i){_d(i)}function T1(i){console.error(i)}function M1(i){_d(i)}function Fd(i,o){try{var c=i.onUncaughtError;c(o.value,{componentStack:o.stack})}catch(f){setTimeout(function(){throw f})}}function N1(i,o,c){try{var f=i.onCaughtError;f(c.value,{componentStack:c.stack,errorBoundary:o.tag===1?o.stateNode:null})}catch(v){setTimeout(function(){throw v})}}function Jm(i,o,c){return c=Rs(c),c.tag=3,c.payload={element:null},c.callback=function(){Fd(i,o)},c}function A1(i){return i=Rs(i),i.tag=3,i}function D1(i,o,c,f){var v=c.type.getDerivedStateFromError;if(typeof v=="function"){var x=f.value;i.payload=function(){return v(x)},i.callback=function(){N1(o,c,f)}}var E=c.stateNode;E!==null&&typeof E.componentDidCatch=="function"&&(i.callback=function(){N1(o,c,f),typeof v!="function"&&(Ls===null?Ls=new Set([this]):Ls.add(this));var O=f.stack;this.componentDidCatch(f.value,{componentStack:O!==null?O:""})})}function z3(i,o,c,f,v){if(c.flags|=32768,f!==null&&typeof f=="object"&&typeof f.then=="function"){if(o=c.alternate,o!==null&&Dl(o,c,v,!0),c=pr.current,c!==null){switch(c.tag){case 31:case 13:return Pr===null?Jd():c.alternate===null&&zt===0&&(zt=3),c.flags&=-257,c.flags|=65536,c.lanes=v,f===Td?c.flags|=16384:(o=c.updateQueue,o===null?c.updateQueue=new Set([f]):o.add(f),Cg(i,f,v)),!1;case 22:return c.flags|=65536,f===Td?c.flags|=16384:(o=c.updateQueue,o===null?(o={transitions:null,markerInstances:null,retryQueue:new Set([f])},c.updateQueue=o):(c=o.retryQueue,c===null?o.retryQueue=new Set([f]):c.add(f)),Cg(i,f,v)),!1}throw Error(r(435,c.tag))}return Cg(i,f,v),Jd(),!1}if(rt)return o=pr.current,o!==null?((o.flags&65536)===0&&(o.flags|=256),o.flags|=65536,o.lanes=v,f!==_m&&(i=Error(r(422),{cause:f}),ic(Or(i,c)))):(f!==_m&&(o=Error(r(423),{cause:f}),ic(Or(o,c))),i=i.current.alternate,i.flags|=65536,v&=-v,i.lanes|=v,f=Or(f,c),v=Jm(i.stateNode,f,v),Mm(i,v),zt!==4&&(zt=2)),!1;var x=Error(r(520),{cause:f});if(x=Or(x,c),wc===null?wc=[x]:wc.push(x),zt!==4&&(zt=2),o===null)return!0;f=Or(f,c),c=o;do{switch(c.tag){case 3:return c.flags|=65536,i=v&-v,c.lanes|=i,i=Jm(c.stateNode,f,i),Mm(c,i),!1;case 1:if(o=c.type,x=c.stateNode,(c.flags&128)===0&&(typeof o.getDerivedStateFromError=="function"||x!==null&&typeof x.componentDidCatch=="function"&&(Ls===null||!Ls.has(x))))return c.flags|=65536,v&=-v,c.lanes|=v,v=A1(v),D1(v,i,c,f),Mm(c,v),!1}c=c.return}while(c!==null);return!1}var eg=Error(r(461)),Gt=!1;function En(i,o,c,f){o.child=i===null?zx(o,null,c,f):Mo(o,i.child,c,f)}function O1(i,o,c,f,v){c=c.render;var x=o.ref;if("ref"in f){var E={};for(var O in f)O!=="ref"&&(E[O]=f[O])}else E=f;return ko(o),f=jm(i,o,c,E,x,v),O=zm(),i!==null&&!Gt?(Pm(i,o,v),Ki(i,o,v)):(rt&&O&&gm(o),o.flags|=1,En(i,o,f,v),o.child)}function L1(i,o,c,f,v){if(i===null){var x=c.type;return typeof x=="function"&&!fm(x)&&x.defaultProps===void 0&&c.compare===null?(o.tag=15,o.type=x,j1(i,o,x,f,v)):(i=Sd(c.type,null,f,o,o.mode,v),i.ref=o.ref,i.return=o,o.child=i)}if(x=i.child,!ag(i,v)){var E=x.memoizedProps;if(c=c.compare,c=c!==null?c:tc,c(E,f)&&i.ref===o.ref)return Ki(i,o,v)}return o.flags|=1,i=Fi(x,f),i.ref=o.ref,i.return=o,o.child=i}function j1(i,o,c,f,v){if(i!==null){var x=i.memoizedProps;if(tc(x,f)&&i.ref===o.ref)if(Gt=!1,o.pendingProps=f=x,ag(i,v))(i.flags&131072)!==0&&(Gt=!0);else return o.lanes=i.lanes,Ki(i,o,v)}return tg(i,o,c,f,v)}function z1(i,o,c,f){var v=f.children,x=i!==null?i.memoizedState:null;if(i===null&&o.stateNode===null&&(o.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),f.mode==="hidden"){if((o.flags&128)!==0){if(x=x!==null?x.baseLanes|c:c,i!==null){for(f=o.child=i.child,v=0;f!==null;)v=v|f.lanes|f.childLanes,f=f.sibling;f=v&~x}else f=0,o.child=null;return P1(i,o,x,c,f)}if((c&536870912)!==0)o.memoizedState={baseLanes:0,cachePool:null},i!==null&&Ed(o,x!==null?x.cachePool:null),x!==null?Ix(o,x):Am(),Hx(o);else return f=o.lanes=536870912,P1(i,o,x!==null?x.baseLanes|c:c,c,f)}else x!==null?(Ed(o,x.cachePool),Ix(o,x),Ns(),o.memoizedState=null):(i!==null&&Ed(o,null),Am(),Ns());return En(i,o,v,c),o.child}function gc(i,o){return i!==null&&i.tag===22||o.stateNode!==null||(o.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),o.sibling}function P1(i,o,c,f,v){var x=km();return x=x===null?null:{parent:qt._currentValue,pool:x},o.memoizedState={baseLanes:c,cachePool:x},i!==null&&Ed(o,null),Am(),Hx(o),i!==null&&Dl(i,o,f,!0),o.childLanes=v,null}function Ud(i,o){return o=Wd({mode:o.mode,children:o.children},i.mode),o.ref=i.ref,i.child=o,o.return=i,o}function B1(i,o,c){return Mo(o,i.child,null,c),i=Ud(o,o.pendingProps),i.flags|=2,mr(o),o.memoizedState=null,i}function P3(i,o,c){var f=o.pendingProps,v=(o.flags&128)!==0;if(o.flags&=-129,i===null){if(rt){if(f.mode==="hidden")return i=Ud(o,f),o.lanes=536870912,gc(null,i);if(Om(o),(i=Et)?(i=XS(i,zr),i=i!==null&&i.data==="&"?i:null,i!==null&&(o.memoizedState={dehydrated:i,treeContext:Ss!==null?{id:fi,overflow:pi}:null,retryLane:536870912,hydrationErrors:null},c=xx(i),c.return=o,o.child=c,Cn=o,Et=null)):i=null,i===null)throw Cs(o);return o.lanes=536870912,null}return Ud(o,f)}var x=i.memoizedState;if(x!==null){var E=x.dehydrated;if(Om(o),v)if(o.flags&256)o.flags&=-257,o=B1(i,o,c);else if(o.memoizedState!==null)o.child=i.child,o.flags|=128,o=null;else throw Error(r(558));else if(Gt||Dl(i,o,c,!1),v=(c&i.childLanes)!==0,Gt||v){if(f=bt,f!==null&&(E=Tr(f,c),E!==0&&E!==x.retryLane))throw x.retryLane=E,xo(i,E),rr(f,i,E),eg;Jd(),o=B1(i,o,c)}else i=x.treeContext,Et=Br(E.nextSibling),Cn=o,rt=!0,ws=null,zr=!1,i!==null&&Cx(o,i),o=Ud(o,f),o.flags|=4096;return o}return i=Fi(i.child,{mode:f.mode,children:f.children}),i.ref=o.ref,o.child=i,i.return=o,i}function $d(i,o){var c=o.ref;if(c===null)i!==null&&i.ref!==null&&(o.flags|=4194816);else{if(typeof c!="function"&&typeof c!="object")throw Error(r(284));(i===null||i.ref!==c)&&(o.flags|=4194816)}}function tg(i,o,c,f,v){return ko(o),c=jm(i,o,c,f,void 0,v),f=zm(),i!==null&&!Gt?(Pm(i,o,v),Ki(i,o,v)):(rt&&f&&gm(o),o.flags|=1,En(i,o,c,v),o.child)}function I1(i,o,c,f,v,x){return ko(o),o.updateQueue=null,c=Ux(o,f,c,v),Fx(i),f=zm(),i!==null&&!Gt?(Pm(i,o,x),Ki(i,o,x)):(rt&&f&&gm(o),o.flags|=1,En(i,o,c,x),o.child)}function H1(i,o,c,f,v){if(ko(o),o.stateNode===null){var x=Tl,E=c.contextType;typeof E=="object"&&E!==null&&(x=kn(E)),x=new c(f,x),o.memoizedState=x.state!==null&&x.state!==void 0?x.state:null,x.updater=Qm,o.stateNode=x,x._reactInternals=o,x=o.stateNode,x.props=f,x.state=o.memoizedState,x.refs={},Rm(o),E=c.contextType,x.context=typeof E=="object"&&E!==null?kn(E):Tl,x.state=o.memoizedState,E=c.getDerivedStateFromProps,typeof E=="function"&&(Zm(o,c,E,f),x.state=o.memoizedState),typeof c.getDerivedStateFromProps=="function"||typeof x.getSnapshotBeforeUpdate=="function"||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(E=x.state,typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount(),E!==x.state&&Qm.enqueueReplaceState(x,x.state,null),dc(o,f,x,v),uc(),x.state=o.memoizedState),typeof x.componentDidMount=="function"&&(o.flags|=4194308),f=!0}else if(i===null){x=o.stateNode;var O=o.memoizedProps,G=Ao(c,O);x.props=G;var te=x.context,de=c.contextType;E=Tl,typeof de=="object"&&de!==null&&(E=kn(de));var me=c.getDerivedStateFromProps;de=typeof me=="function"||typeof x.getSnapshotBeforeUpdate=="function",O=o.pendingProps!==O,de||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(O||te!==E)&&E1(o,x,f,E),Es=!1;var ne=o.memoizedState;x.state=ne,dc(o,f,x,v),uc(),te=o.memoizedState,O||ne!==te||Es?(typeof me=="function"&&(Zm(o,c,me,f),te=o.memoizedState),(G=Es||k1(o,c,G,f,ne,te,E))?(de||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount()),typeof x.componentDidMount=="function"&&(o.flags|=4194308)):(typeof x.componentDidMount=="function"&&(o.flags|=4194308),o.memoizedProps=f,o.memoizedState=te),x.props=f,x.state=te,x.context=E,f=G):(typeof x.componentDidMount=="function"&&(o.flags|=4194308),f=!1)}else{x=o.stateNode,Tm(i,o),E=o.memoizedProps,de=Ao(c,E),x.props=de,me=o.pendingProps,ne=x.context,te=c.contextType,G=Tl,typeof te=="object"&&te!==null&&(G=kn(te)),O=c.getDerivedStateFromProps,(te=typeof O=="function"||typeof x.getSnapshotBeforeUpdate=="function")||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(E!==me||ne!==G)&&E1(o,x,f,G),Es=!1,ne=o.memoizedState,x.state=ne,dc(o,f,x,v),uc();var ie=o.memoizedState;E!==me||ne!==ie||Es||i!==null&&i.dependencies!==null&&Cd(i.dependencies)?(typeof O=="function"&&(Zm(o,c,O,f),ie=o.memoizedState),(de=Es||k1(o,c,de,f,ne,ie,G)||i!==null&&i.dependencies!==null&&Cd(i.dependencies))?(te||typeof x.UNSAFE_componentWillUpdate!="function"&&typeof x.componentWillUpdate!="function"||(typeof x.componentWillUpdate=="function"&&x.componentWillUpdate(f,ie,G),typeof x.UNSAFE_componentWillUpdate=="function"&&x.UNSAFE_componentWillUpdate(f,ie,G)),typeof x.componentDidUpdate=="function"&&(o.flags|=4),typeof x.getSnapshotBeforeUpdate=="function"&&(o.flags|=1024)):(typeof x.componentDidUpdate!="function"||E===i.memoizedProps&&ne===i.memoizedState||(o.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||E===i.memoizedProps&&ne===i.memoizedState||(o.flags|=1024),o.memoizedProps=f,o.memoizedState=ie),x.props=f,x.state=ie,x.context=G,f=de):(typeof x.componentDidUpdate!="function"||E===i.memoizedProps&&ne===i.memoizedState||(o.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||E===i.memoizedProps&&ne===i.memoizedState||(o.flags|=1024),f=!1)}return x=f,$d(i,o),f=(o.flags&128)!==0,x||f?(x=o.stateNode,c=f&&typeof c.getDerivedStateFromError!="function"?null:x.render(),o.flags|=1,i!==null&&f?(o.child=Mo(o,i.child,null,v),o.child=Mo(o,null,c,v)):En(i,o,c,v),o.memoizedState=x.state,i=o.child):i=Ki(i,o,v),i}function F1(i,o,c,f){return wo(),o.flags|=256,En(i,o,c,f),o.child}var ng={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function rg(i){return{baseLanes:i,cachePool:Nx()}}function ig(i,o,c){return i=i!==null?i.childLanes&~c:0,o&&(i|=vr),i}function U1(i,o,c){var f=o.pendingProps,v=!1,x=(o.flags&128)!==0,E;if((E=x)||(E=i!==null&&i.memoizedState===null?!1:(Ht.current&2)!==0),E&&(v=!0,o.flags&=-129),E=(o.flags&32)!==0,o.flags&=-33,i===null){if(rt){if(v?Ms(o):Ns(),(i=Et)?(i=XS(i,zr),i=i!==null&&i.data!=="&"?i:null,i!==null&&(o.memoizedState={dehydrated:i,treeContext:Ss!==null?{id:fi,overflow:pi}:null,retryLane:536870912,hydrationErrors:null},c=xx(i),c.return=o,o.child=c,Cn=o,Et=null)):i=null,i===null)throw Cs(o);return Hg(i)?o.lanes=32:o.lanes=536870912,null}var O=f.children;return f=f.fallback,v?(Ns(),v=o.mode,O=Wd({mode:"hidden",children:O},v),f=So(f,v,c,null),O.return=o,f.return=o,O.sibling=f,o.child=O,f=o.child,f.memoizedState=rg(c),f.childLanes=ig(i,E,c),o.memoizedState=ng,gc(null,f)):(Ms(o),sg(o,O))}var G=i.memoizedState;if(G!==null&&(O=G.dehydrated,O!==null)){if(x)o.flags&256?(Ms(o),o.flags&=-257,o=og(i,o,c)):o.memoizedState!==null?(Ns(),o.child=i.child,o.flags|=128,o=null):(Ns(),O=f.fallback,v=o.mode,f=Wd({mode:"visible",children:f.children},v),O=So(O,v,c,null),O.flags|=2,f.return=o,O.return=o,f.sibling=O,o.child=f,Mo(o,i.child,null,c),f=o.child,f.memoizedState=rg(c),f.childLanes=ig(i,E,c),o.memoizedState=ng,o=gc(null,f));else if(Ms(o),Hg(O)){if(E=O.nextSibling&&O.nextSibling.dataset,E)var te=E.dgst;E=te,f=Error(r(419)),f.stack="",f.digest=E,ic({value:f,source:null,stack:null}),o=og(i,o,c)}else if(Gt||Dl(i,o,c,!1),E=(c&i.childLanes)!==0,Gt||E){if(E=bt,E!==null&&(f=Tr(E,c),f!==0&&f!==G.retryLane))throw G.retryLane=f,xo(i,f),rr(E,i,f),eg;Ig(O)||Jd(),o=og(i,o,c)}else Ig(O)?(o.flags|=192,o.child=i.child,o=null):(i=G.treeContext,Et=Br(O.nextSibling),Cn=o,rt=!0,ws=null,zr=!1,i!==null&&Cx(o,i),o=sg(o,f.children),o.flags|=4096);return o}return v?(Ns(),O=f.fallback,v=o.mode,G=i.child,te=G.sibling,f=Fi(G,{mode:"hidden",children:f.children}),f.subtreeFlags=G.subtreeFlags&65011712,te!==null?O=Fi(te,O):(O=So(O,v,c,null),O.flags|=2),O.return=o,f.return=o,f.sibling=O,o.child=f,gc(null,f),f=o.child,O=i.child.memoizedState,O===null?O=rg(c):(v=O.cachePool,v!==null?(G=qt._currentValue,v=v.parent!==G?{parent:G,pool:G}:v):v=Nx(),O={baseLanes:O.baseLanes|c,cachePool:v}),f.memoizedState=O,f.childLanes=ig(i,E,c),o.memoizedState=ng,gc(i.child,f)):(Ms(o),c=i.child,i=c.sibling,c=Fi(c,{mode:"visible",children:f.children}),c.return=o,c.sibling=null,i!==null&&(E=o.deletions,E===null?(o.deletions=[i],o.flags|=16):E.push(i)),o.child=c,o.memoizedState=null,c)}function sg(i,o){return o=Wd({mode:"visible",children:o},i.mode),o.return=i,i.child=o}function Wd(i,o){return i=fr(22,i,null,o),i.lanes=0,i}function og(i,o,c){return Mo(o,i.child,null,c),i=sg(o,o.pendingProps.children),i.flags|=2,o.memoizedState=null,i}function $1(i,o,c){i.lanes|=o;var f=i.alternate;f!==null&&(f.lanes|=o),xm(i.return,o,c)}function lg(i,o,c,f,v,x){var E=i.memoizedState;E===null?i.memoizedState={isBackwards:o,rendering:null,renderingStartTime:0,last:f,tail:c,tailMode:v,treeForkCount:x}:(E.isBackwards=o,E.rendering=null,E.renderingStartTime=0,E.last=f,E.tail=c,E.tailMode=v,E.treeForkCount=x)}function W1(i,o,c){var f=o.pendingProps,v=f.revealOrder,x=f.tail;f=f.children;var E=Ht.current,O=(E&2)!==0;if(O?(E=E&1|2,o.flags|=128):E&=1,L(Ht,E),En(i,o,f,c),f=rt?rc:0,!O&&i!==null&&(i.flags&128)!==0)e:for(i=o.child;i!==null;){if(i.tag===13)i.memoizedState!==null&&$1(i,c,o);else if(i.tag===19)$1(i,c,o);else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===o)break e;for(;i.sibling===null;){if(i.return===null||i.return===o)break e;i=i.return}i.sibling.return=i.return,i=i.sibling}switch(v){case"forwards":for(c=o.child,v=null;c!==null;)i=c.alternate,i!==null&&Dd(i)===null&&(v=c),c=c.sibling;c=v,c===null?(v=o.child,o.child=null):(v=c.sibling,c.sibling=null),lg(o,!1,v,c,x,f);break;case"backwards":case"unstable_legacy-backwards":for(c=null,v=o.child,o.child=null;v!==null;){if(i=v.alternate,i!==null&&Dd(i)===null){o.child=v;break}i=v.sibling,v.sibling=c,c=v,v=i}lg(o,!0,c,null,x,f);break;case"together":lg(o,!1,null,null,void 0,f);break;default:o.memoizedState=null}return o.child}function Ki(i,o,c){if(i!==null&&(o.dependencies=i.dependencies),Os|=o.lanes,(c&o.childLanes)===0)if(i!==null){if(Dl(i,o,c,!1),(c&o.childLanes)===0)return null}else return null;if(i!==null&&o.child!==i.child)throw Error(r(153));if(o.child!==null){for(i=o.child,c=Fi(i,i.pendingProps),o.child=c,c.return=o;i.sibling!==null;)i=i.sibling,c=c.sibling=Fi(i,i.pendingProps),c.return=o;c.sibling=null}return o.child}function ag(i,o){return(i.lanes&o)!==0?!0:(i=i.dependencies,!!(i!==null&&Cd(i)))}function B3(i,o,c){switch(o.tag){case 3:re(o,o.stateNode.containerInfo),ks(o,qt,i.memoizedState.cache),wo();break;case 27:case 5:ve(o);break;case 4:re(o,o.stateNode.containerInfo);break;case 10:ks(o,o.type,o.memoizedProps.value);break;case 31:if(o.memoizedState!==null)return o.flags|=128,Om(o),null;break;case 13:var f=o.memoizedState;if(f!==null)return f.dehydrated!==null?(Ms(o),o.flags|=128,null):(c&o.child.childLanes)!==0?U1(i,o,c):(Ms(o),i=Ki(i,o,c),i!==null?i.sibling:null);Ms(o);break;case 19:var v=(i.flags&128)!==0;if(f=(c&o.childLanes)!==0,f||(Dl(i,o,c,!1),f=(c&o.childLanes)!==0),v){if(f)return W1(i,o,c);o.flags|=128}if(v=o.memoizedState,v!==null&&(v.rendering=null,v.tail=null,v.lastEffect=null),L(Ht,Ht.current),f)break;return null;case 22:return o.lanes=0,z1(i,o,c,o.pendingProps);case 24:ks(o,qt,i.memoizedState.cache)}return Ki(i,o,c)}function V1(i,o,c){if(i!==null)if(i.memoizedProps!==o.pendingProps)Gt=!0;else{if(!ag(i,c)&&(o.flags&128)===0)return Gt=!1,B3(i,o,c);Gt=(i.flags&131072)!==0}else Gt=!1,rt&&(o.flags&1048576)!==0&&wx(o,rc,o.index);switch(o.lanes=0,o.tag){case 16:e:{var f=o.pendingProps;if(i=Ro(o.elementType),o.type=i,typeof i=="function")fm(i)?(f=Ao(i,f),o.tag=1,o=H1(null,o,i,f,c)):(o.tag=0,o=tg(null,o,i,f,c));else{if(i!=null){var v=i.$$typeof;if(v===N){o.tag=11,o=O1(null,o,i,f,c);break e}else if(v===D){o.tag=14,o=L1(null,o,i,f,c);break e}}throw o=q(i)||i,Error(r(306,o,""))}}return o;case 0:return tg(i,o,o.type,o.pendingProps,c);case 1:return f=o.type,v=Ao(f,o.pendingProps),H1(i,o,f,v,c);case 3:e:{if(re(o,o.stateNode.containerInfo),i===null)throw Error(r(387));f=o.pendingProps;var x=o.memoizedState;v=x.element,Tm(i,o),dc(o,f,null,c);var E=o.memoizedState;if(f=E.cache,ks(o,qt,f),f!==x.cache&&Sm(o,[qt],c,!0),uc(),f=E.element,x.isDehydrated)if(x={element:f,isDehydrated:!1,cache:E.cache},o.updateQueue.baseState=x,o.memoizedState=x,o.flags&256){o=F1(i,o,f,c);break e}else if(f!==v){v=Or(Error(r(424)),o),ic(v),o=F1(i,o,f,c);break e}else{switch(i=o.stateNode.containerInfo,i.nodeType){case 9:i=i.body;break;default:i=i.nodeName==="HTML"?i.ownerDocument.body:i}for(Et=Br(i.firstChild),Cn=o,rt=!0,ws=null,zr=!0,c=zx(o,null,f,c),o.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling}else{if(wo(),f===v){o=Ki(i,o,c);break e}En(i,o,f,c)}o=o.child}return o;case 26:return $d(i,o),i===null?(c=nw(o.type,null,o.pendingProps,null))?o.memoizedState=c:rt||(c=o.type,i=o.pendingProps,f=oh(se.current).createElement(c),f[wn]=o,f[Zn]=i,Rn(f,c,i),dn(f),o.stateNode=f):o.memoizedState=nw(o.type,i.memoizedProps,o.pendingProps,i.memoizedState),null;case 27:return ve(o),i===null&&rt&&(f=o.stateNode=JS(o.type,o.pendingProps,se.current),Cn=o,zr=!0,v=Et,Bs(o.type)?(Fg=v,Et=Br(f.firstChild)):Et=v),En(i,o,o.pendingProps.children,c),$d(i,o),i===null&&(o.flags|=4194304),o.child;case 5:return i===null&&rt&&((v=f=Et)&&(f=pO(f,o.type,o.pendingProps,zr),f!==null?(o.stateNode=f,Cn=o,Et=Br(f.firstChild),zr=!1,v=!0):v=!1),v||Cs(o)),ve(o),v=o.type,x=o.pendingProps,E=i!==null?i.memoizedProps:null,f=x.children,zg(v,x)?f=null:E!==null&&zg(v,E)&&(o.flags|=32),o.memoizedState!==null&&(v=jm(i,o,M3,null,null,c),Ac._currentValue=v),$d(i,o),En(i,o,f,c),o.child;case 6:return i===null&&rt&&((i=c=Et)&&(c=mO(c,o.pendingProps,zr),c!==null?(o.stateNode=c,Cn=o,Et=null,i=!0):i=!1),i||Cs(o)),null;case 13:return U1(i,o,c);case 4:return re(o,o.stateNode.containerInfo),f=o.pendingProps,i===null?o.child=Mo(o,null,f,c):En(i,o,f,c),o.child;case 11:return O1(i,o,o.type,o.pendingProps,c);case 7:return En(i,o,o.pendingProps,c),o.child;case 8:return En(i,o,o.pendingProps.children,c),o.child;case 12:return En(i,o,o.pendingProps.children,c),o.child;case 10:return f=o.pendingProps,ks(o,o.type,f.value),En(i,o,f.children,c),o.child;case 9:return v=o.type._context,f=o.pendingProps.children,ko(o),v=kn(v),f=f(v),o.flags|=1,En(i,o,f,c),o.child;case 14:return L1(i,o,o.type,o.pendingProps,c);case 15:return j1(i,o,o.type,o.pendingProps,c);case 19:return W1(i,o,c);case 31:return P3(i,o,c);case 22:return z1(i,o,c,o.pendingProps);case 24:return ko(o),f=kn(qt),i===null?(v=km(),v===null&&(v=bt,x=wm(),v.pooledCache=x,x.refCount++,x!==null&&(v.pooledCacheLanes|=c),v=x),o.memoizedState={parent:f,cache:v},Rm(o),ks(o,qt,v)):((i.lanes&c)!==0&&(Tm(i,o),dc(o,null,null,c),uc()),v=i.memoizedState,x=o.memoizedState,v.parent!==f?(v={parent:f,cache:f},o.memoizedState=v,o.lanes===0&&(o.memoizedState=o.updateQueue.baseState=v),ks(o,qt,f)):(f=x.cache,ks(o,qt,f),f!==v.cache&&Sm(o,[qt],c,!0))),En(i,o,o.pendingProps.children,c),o.child;case 29:throw o.pendingProps}throw Error(r(156,o.tag))}function Gi(i){i.flags|=4}function cg(i,o,c,f,v){if((o=(i.mode&32)!==0)&&(o=!1),o){if(i.flags|=16777216,(v&335544128)===v)if(i.stateNode.complete)i.flags|=8192;else if(_S())i.flags|=8192;else throw To=Td,Em}else i.flags&=-16777217}function q1(i,o){if(o.type!=="stylesheet"||(o.state.loading&4)!==0)i.flags&=-16777217;else if(i.flags|=16777216,!lw(o))if(_S())i.flags|=8192;else throw To=Td,Em}function Vd(i,o){o!==null&&(i.flags|=4),i.flags&16384&&(o=i.tag!==22?An():536870912,i.lanes|=o,Wl|=o)}function vc(i,o){if(!rt)switch(i.tailMode){case"hidden":o=i.tail;for(var c=null;o!==null;)o.alternate!==null&&(c=o),o=o.sibling;c===null?i.tail=null:c.sibling=null;break;case"collapsed":c=i.tail;for(var f=null;c!==null;)c.alternate!==null&&(f=c),c=c.sibling;f===null?o||i.tail===null?i.tail=null:i.tail.sibling=null:f.sibling=null}}function Rt(i){var o=i.alternate!==null&&i.alternate.child===i.child,c=0,f=0;if(o)for(var v=i.child;v!==null;)c|=v.lanes|v.childLanes,f|=v.subtreeFlags&65011712,f|=v.flags&65011712,v.return=i,v=v.sibling;else for(v=i.child;v!==null;)c|=v.lanes|v.childLanes,f|=v.subtreeFlags,f|=v.flags,v.return=i,v=v.sibling;return i.subtreeFlags|=f,i.childLanes=c,o}function I3(i,o,c){var f=o.pendingProps;switch(vm(o),o.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Rt(o),null;case 1:return Rt(o),null;case 3:return c=o.stateNode,f=null,i!==null&&(f=i.memoizedState.cache),o.memoizedState.cache!==f&&(o.flags|=2048),Wi(qt),he(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(i===null||i.child===null)&&(Al(o)?Gi(o):i===null||i.memoizedState.isDehydrated&&(o.flags&256)===0||(o.flags|=1024,ym())),Rt(o),null;case 26:var v=o.type,x=o.memoizedState;return i===null?(Gi(o),x!==null?(Rt(o),q1(o,x)):(Rt(o),cg(o,v,null,f,c))):x?x!==i.memoizedState?(Gi(o),Rt(o),q1(o,x)):(Rt(o),o.flags&=-16777217):(i=i.memoizedProps,i!==f&&Gi(o),Rt(o),cg(o,v,i,f,c)),null;case 27:if(Ce(o),c=se.current,v=o.type,i!==null&&o.stateNode!=null)i.memoizedProps!==f&&Gi(o);else{if(!f){if(o.stateNode===null)throw Error(r(166));return Rt(o),null}i=oe.current,Al(o)?kx(o):(i=JS(v,f,c),o.stateNode=i,Gi(o))}return Rt(o),null;case 5:if(Ce(o),v=o.type,i!==null&&o.stateNode!=null)i.memoizedProps!==f&&Gi(o);else{if(!f){if(o.stateNode===null)throw Error(r(166));return Rt(o),null}if(x=oe.current,Al(o))kx(o);else{var E=oh(se.current);switch(x){case 1:x=E.createElementNS("http://www.w3.org/2000/svg",v);break;case 2:x=E.createElementNS("http://www.w3.org/1998/Math/MathML",v);break;default:switch(v){case"svg":x=E.createElementNS("http://www.w3.org/2000/svg",v);break;case"math":x=E.createElementNS("http://www.w3.org/1998/Math/MathML",v);break;case"script":x=E.createElement("div"),x.innerHTML="<script><\/script>",x=x.removeChild(x.firstChild);break;case"select":x=typeof f.is=="string"?E.createElement("select",{is:f.is}):E.createElement("select"),f.multiple?x.multiple=!0:f.size&&(x.size=f.size);break;default:x=typeof f.is=="string"?E.createElement(v,{is:f.is}):E.createElement(v)}}x[wn]=o,x[Zn]=f;e:for(E=o.child;E!==null;){if(E.tag===5||E.tag===6)x.appendChild(E.stateNode);else if(E.tag!==4&&E.tag!==27&&E.child!==null){E.child.return=E,E=E.child;continue}if(E===o)break e;for(;E.sibling===null;){if(E.return===null||E.return===o)break e;E=E.return}E.sibling.return=E.return,E=E.sibling}o.stateNode=x;e:switch(Rn(x,v,f),v){case"button":case"input":case"select":case"textarea":f=!!f.autoFocus;break e;case"img":f=!0;break e;default:f=!1}f&&Gi(o)}}return Rt(o),cg(o,o.type,i===null?null:i.memoizedProps,o.pendingProps,c),null;case 6:if(i&&o.stateNode!=null)i.memoizedProps!==f&&Gi(o);else{if(typeof f!="string"&&o.stateNode===null)throw Error(r(166));if(i=se.current,Al(o)){if(i=o.stateNode,c=o.memoizedProps,f=null,v=Cn,v!==null)switch(v.tag){case 27:case 5:f=v.memoizedProps}i[wn]=o,i=!!(i.nodeValue===c||f!==null&&f.suppressHydrationWarning===!0||US(i.nodeValue,c)),i||Cs(o,!0)}else i=oh(i).createTextNode(f),i[wn]=o,o.stateNode=i}return Rt(o),null;case 31:if(c=o.memoizedState,i===null||i.memoizedState!==null){if(f=Al(o),c!==null){if(i===null){if(!f)throw Error(r(318));if(i=o.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(r(557));i[wn]=o}else wo(),(o.flags&128)===0&&(o.memoizedState=null),o.flags|=4;Rt(o),i=!1}else c=ym(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=c),i=!0;if(!i)return o.flags&256?(mr(o),o):(mr(o),null);if((o.flags&128)!==0)throw Error(r(558))}return Rt(o),null;case 13:if(f=o.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(v=Al(o),f!==null&&f.dehydrated!==null){if(i===null){if(!v)throw Error(r(318));if(v=o.memoizedState,v=v!==null?v.dehydrated:null,!v)throw Error(r(317));v[wn]=o}else wo(),(o.flags&128)===0&&(o.memoizedState=null),o.flags|=4;Rt(o),v=!1}else v=ym(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=v),v=!0;if(!v)return o.flags&256?(mr(o),o):(mr(o),null)}return mr(o),(o.flags&128)!==0?(o.lanes=c,o):(c=f!==null,i=i!==null&&i.memoizedState!==null,c&&(f=o.child,v=null,f.alternate!==null&&f.alternate.memoizedState!==null&&f.alternate.memoizedState.cachePool!==null&&(v=f.alternate.memoizedState.cachePool.pool),x=null,f.memoizedState!==null&&f.memoizedState.cachePool!==null&&(x=f.memoizedState.cachePool.pool),x!==v&&(f.flags|=2048)),c!==i&&c&&(o.child.flags|=8192),Vd(o,o.updateQueue),Rt(o),null);case 4:return he(),i===null&&Ag(o.stateNode.containerInfo),Rt(o),null;case 10:return Wi(o.type),Rt(o),null;case 19:if(X(Ht),f=o.memoizedState,f===null)return Rt(o),null;if(v=(o.flags&128)!==0,x=f.rendering,x===null)if(v)vc(f,!1);else{if(zt!==0||i!==null&&(i.flags&128)!==0)for(i=o.child;i!==null;){if(x=Dd(i),x!==null){for(o.flags|=128,vc(f,!1),i=x.updateQueue,o.updateQueue=i,Vd(o,i),o.subtreeFlags=0,i=c,c=o.child;c!==null;)bx(c,i),c=c.sibling;return L(Ht,Ht.current&1|2),rt&&Ui(o,f.treeForkCount),o.child}i=i.sibling}f.tail!==null&&Ge()>Xd&&(o.flags|=128,v=!0,vc(f,!1),o.lanes=4194304)}else{if(!v)if(i=Dd(x),i!==null){if(o.flags|=128,v=!0,i=i.updateQueue,o.updateQueue=i,Vd(o,i),vc(f,!0),f.tail===null&&f.tailMode==="hidden"&&!x.alternate&&!rt)return Rt(o),null}else 2*Ge()-f.renderingStartTime>Xd&&c!==536870912&&(o.flags|=128,v=!0,vc(f,!1),o.lanes=4194304);f.isBackwards?(x.sibling=o.child,o.child=x):(i=f.last,i!==null?i.sibling=x:o.child=x,f.last=x)}return f.tail!==null?(i=f.tail,f.rendering=i,f.tail=i.sibling,f.renderingStartTime=Ge(),i.sibling=null,c=Ht.current,L(Ht,v?c&1|2:c&1),rt&&Ui(o,f.treeForkCount),i):(Rt(o),null);case 22:case 23:return mr(o),Dm(),f=o.memoizedState!==null,i!==null?i.memoizedState!==null!==f&&(o.flags|=8192):f&&(o.flags|=8192),f?(c&536870912)!==0&&(o.flags&128)===0&&(Rt(o),o.subtreeFlags&6&&(o.flags|=8192)):Rt(o),c=o.updateQueue,c!==null&&Vd(o,c.retryQueue),c=null,i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(c=i.memoizedState.cachePool.pool),f=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(f=o.memoizedState.cachePool.pool),f!==c&&(o.flags|=2048),i!==null&&X(Eo),null;case 24:return c=null,i!==null&&(c=i.memoizedState.cache),o.memoizedState.cache!==c&&(o.flags|=2048),Wi(qt),Rt(o),null;case 25:return null;case 30:return null}throw Error(r(156,o.tag))}function H3(i,o){switch(vm(o),o.tag){case 1:return i=o.flags,i&65536?(o.flags=i&-65537|128,o):null;case 3:return Wi(qt),he(),i=o.flags,(i&65536)!==0&&(i&128)===0?(o.flags=i&-65537|128,o):null;case 26:case 27:case 5:return Ce(o),null;case 31:if(o.memoizedState!==null){if(mr(o),o.alternate===null)throw Error(r(340));wo()}return i=o.flags,i&65536?(o.flags=i&-65537|128,o):null;case 13:if(mr(o),i=o.memoizedState,i!==null&&i.dehydrated!==null){if(o.alternate===null)throw Error(r(340));wo()}return i=o.flags,i&65536?(o.flags=i&-65537|128,o):null;case 19:return X(Ht),null;case 4:return he(),null;case 10:return Wi(o.type),null;case 22:case 23:return mr(o),Dm(),i!==null&&X(Eo),i=o.flags,i&65536?(o.flags=i&-65537|128,o):null;case 24:return Wi(qt),null;case 25:return null;default:return null}}function K1(i,o){switch(vm(o),o.tag){case 3:Wi(qt),he();break;case 26:case 27:case 5:Ce(o);break;case 4:he();break;case 31:o.memoizedState!==null&&mr(o);break;case 13:mr(o);break;case 19:X(Ht);break;case 10:Wi(o.type);break;case 22:case 23:mr(o),Dm(),i!==null&&X(Eo);break;case 24:Wi(qt)}}function _c(i,o){try{var c=o.updateQueue,f=c!==null?c.lastEffect:null;if(f!==null){var v=f.next;c=v;do{if((c.tag&i)===i){f=void 0;var x=c.create,E=c.inst;f=x(),E.destroy=f}c=c.next}while(c!==v)}}catch(O){ft(o,o.return,O)}}function As(i,o,c){try{var f=o.updateQueue,v=f!==null?f.lastEffect:null;if(v!==null){var x=v.next;f=x;do{if((f.tag&i)===i){var E=f.inst,O=E.destroy;if(O!==void 0){E.destroy=void 0,v=o;var G=c,te=O;try{te()}catch(de){ft(v,G,de)}}}f=f.next}while(f!==x)}}catch(de){ft(o,o.return,de)}}function G1(i){var o=i.updateQueue;if(o!==null){var c=i.stateNode;try{Bx(o,c)}catch(f){ft(i,i.return,f)}}}function Y1(i,o,c){c.props=Ao(i.type,i.memoizedProps),c.state=i.memoizedState;try{c.componentWillUnmount()}catch(f){ft(i,o,f)}}function yc(i,o){try{var c=i.ref;if(c!==null){switch(i.tag){case 26:case 27:case 5:var f=i.stateNode;break;case 30:f=i.stateNode;break;default:f=i.stateNode}typeof c=="function"?i.refCleanup=c(f):c.current=f}}catch(v){ft(i,o,v)}}function mi(i,o){var c=i.ref,f=i.refCleanup;if(c!==null)if(typeof f=="function")try{f()}catch(v){ft(i,o,v)}finally{i.refCleanup=null,i=i.alternate,i!=null&&(i.refCleanup=null)}else if(typeof c=="function")try{c(null)}catch(v){ft(i,o,v)}else c.current=null}function X1(i){var o=i.type,c=i.memoizedProps,f=i.stateNode;try{e:switch(o){case"button":case"input":case"select":case"textarea":c.autoFocus&&f.focus();break e;case"img":c.src?f.src=c.src:c.srcSet&&(f.srcset=c.srcSet)}}catch(v){ft(i,i.return,v)}}function ug(i,o,c){try{var f=i.stateNode;aO(f,i.type,c,o),f[Zn]=o}catch(v){ft(i,i.return,v)}}function Z1(i){return i.tag===5||i.tag===3||i.tag===26||i.tag===27&&Bs(i.type)||i.tag===4}function dg(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||Z1(i.return))return null;i=i.return}for(i.sibling.return=i.return,i=i.sibling;i.tag!==5&&i.tag!==6&&i.tag!==18;){if(i.tag===27&&Bs(i.type)||i.flags&2||i.child===null||i.tag===4)continue e;i.child.return=i,i=i.child}if(!(i.flags&2))return i.stateNode}}function hg(i,o,c){var f=i.tag;if(f===5||f===6)i=i.stateNode,o?(c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c).insertBefore(i,o):(o=c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c,o.appendChild(i),c=c._reactRootContainer,c!=null||o.onclick!==null||(o.onclick=Ii));else if(f!==4&&(f===27&&Bs(i.type)&&(c=i.stateNode,o=null),i=i.child,i!==null))for(hg(i,o,c),i=i.sibling;i!==null;)hg(i,o,c),i=i.sibling}function qd(i,o,c){var f=i.tag;if(f===5||f===6)i=i.stateNode,o?c.insertBefore(i,o):c.appendChild(i);else if(f!==4&&(f===27&&Bs(i.type)&&(c=i.stateNode),i=i.child,i!==null))for(qd(i,o,c),i=i.sibling;i!==null;)qd(i,o,c),i=i.sibling}function Q1(i){var o=i.stateNode,c=i.memoizedProps;try{for(var f=i.type,v=o.attributes;v.length;)o.removeAttributeNode(v[0]);Rn(o,f,c),o[wn]=i,o[Zn]=c}catch(x){ft(i,i.return,x)}}var Yi=!1,Yt=!1,fg=!1,J1=typeof WeakSet=="function"?WeakSet:Set,hn=null;function F3(i,o){if(i=i.containerInfo,Lg=fh,i=dx(i),om(i)){if("selectionStart"in i)var c={start:i.selectionStart,end:i.selectionEnd};else e:{c=(c=i.ownerDocument)&&c.defaultView||window;var f=c.getSelection&&c.getSelection();if(f&&f.rangeCount!==0){c=f.anchorNode;var v=f.anchorOffset,x=f.focusNode;f=f.focusOffset;try{c.nodeType,x.nodeType}catch{c=null;break e}var E=0,O=-1,G=-1,te=0,de=0,me=i,ne=null;t:for(;;){for(var ie;me!==c||v!==0&&me.nodeType!==3||(O=E+v),me!==x||f!==0&&me.nodeType!==3||(G=E+f),me.nodeType===3&&(E+=me.nodeValue.length),(ie=me.firstChild)!==null;)ne=me,me=ie;for(;;){if(me===i)break t;if(ne===c&&++te===v&&(O=E),ne===x&&++de===f&&(G=E),(ie=me.nextSibling)!==null)break;me=ne,ne=me.parentNode}me=ie}c=O===-1||G===-1?null:{start:O,end:G}}else c=null}c=c||{start:0,end:0}}else c=null;for(jg={focusedElem:i,selectionRange:c},fh=!1,hn=o;hn!==null;)if(o=hn,i=o.child,(o.subtreeFlags&1028)!==0&&i!==null)i.return=o,hn=i;else for(;hn!==null;){switch(o=hn,x=o.alternate,i=o.flags,o.tag){case 0:if((i&4)!==0&&(i=o.updateQueue,i=i!==null?i.events:null,i!==null))for(c=0;c<i.length;c++)v=i[c],v.ref.impl=v.nextImpl;break;case 11:case 15:break;case 1:if((i&1024)!==0&&x!==null){i=void 0,c=o,v=x.memoizedProps,x=x.memoizedState,f=c.stateNode;try{var Re=Ao(c.type,v);i=f.getSnapshotBeforeUpdate(Re,x),f.__reactInternalSnapshotBeforeUpdate=i}catch(ze){ft(c,c.return,ze)}}break;case 3:if((i&1024)!==0){if(i=o.stateNode.containerInfo,c=i.nodeType,c===9)Bg(i);else if(c===1)switch(i.nodeName){case"HEAD":case"HTML":case"BODY":Bg(i);break;default:i.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((i&1024)!==0)throw Error(r(163))}if(i=o.sibling,i!==null){i.return=o.return,hn=i;break}hn=o.return}}function eS(i,o,c){var f=c.flags;switch(c.tag){case 0:case 11:case 15:Zi(i,c),f&4&&_c(5,c);break;case 1:if(Zi(i,c),f&4)if(i=c.stateNode,o===null)try{i.componentDidMount()}catch(E){ft(c,c.return,E)}else{var v=Ao(c.type,o.memoizedProps);o=o.memoizedState;try{i.componentDidUpdate(v,o,i.__reactInternalSnapshotBeforeUpdate)}catch(E){ft(c,c.return,E)}}f&64&&G1(c),f&512&&yc(c,c.return);break;case 3:if(Zi(i,c),f&64&&(i=c.updateQueue,i!==null)){if(o=null,c.child!==null)switch(c.child.tag){case 27:case 5:o=c.child.stateNode;break;case 1:o=c.child.stateNode}try{Bx(i,o)}catch(E){ft(c,c.return,E)}}break;case 27:o===null&&f&4&&Q1(c);case 26:case 5:Zi(i,c),o===null&&f&4&&X1(c),f&512&&yc(c,c.return);break;case 12:Zi(i,c);break;case 31:Zi(i,c),f&4&&rS(i,c);break;case 13:Zi(i,c),f&4&&iS(i,c),f&64&&(i=c.memoizedState,i!==null&&(i=i.dehydrated,i!==null&&(c=X3.bind(null,c),gO(i,c))));break;case 22:if(f=c.memoizedState!==null||Yi,!f){o=o!==null&&o.memoizedState!==null||Yt,v=Yi;var x=Yt;Yi=f,(Yt=o)&&!x?Qi(i,c,(c.subtreeFlags&8772)!==0):Zi(i,c),Yi=v,Yt=x}break;case 30:break;default:Zi(i,c)}}function tS(i){var o=i.alternate;o!==null&&(i.alternate=null,tS(o)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(o=i.stateNode,o!==null&&$p(o)),i.stateNode=null,i.return=null,i.dependencies=null,i.memoizedProps=null,i.memoizedState=null,i.pendingProps=null,i.stateNode=null,i.updateQueue=null}var Nt=null,Jn=!1;function Xi(i,o,c){for(c=c.child;c!==null;)nS(i,o,c),c=c.sibling}function nS(i,o,c){if(kt&&typeof kt.onCommitFiberUnmount=="function")try{kt.onCommitFiberUnmount(en,c)}catch{}switch(c.tag){case 26:Yt||mi(c,o),Xi(i,o,c),c.memoizedState?c.memoizedState.count--:c.stateNode&&(c=c.stateNode,c.parentNode.removeChild(c));break;case 27:Yt||mi(c,o);var f=Nt,v=Jn;Bs(c.type)&&(Nt=c.stateNode,Jn=!1),Xi(i,o,c),Tc(c.stateNode),Nt=f,Jn=v;break;case 5:Yt||mi(c,o);case 6:if(f=Nt,v=Jn,Nt=null,Xi(i,o,c),Nt=f,Jn=v,Nt!==null)if(Jn)try{(Nt.nodeType===9?Nt.body:Nt.nodeName==="HTML"?Nt.ownerDocument.body:Nt).removeChild(c.stateNode)}catch(x){ft(c,o,x)}else try{Nt.removeChild(c.stateNode)}catch(x){ft(c,o,x)}break;case 18:Nt!==null&&(Jn?(i=Nt,GS(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,c.stateNode),Ql(i)):GS(Nt,c.stateNode));break;case 4:f=Nt,v=Jn,Nt=c.stateNode.containerInfo,Jn=!0,Xi(i,o,c),Nt=f,Jn=v;break;case 0:case 11:case 14:case 15:As(2,c,o),Yt||As(4,c,o),Xi(i,o,c);break;case 1:Yt||(mi(c,o),f=c.stateNode,typeof f.componentWillUnmount=="function"&&Y1(c,o,f)),Xi(i,o,c);break;case 21:Xi(i,o,c);break;case 22:Yt=(f=Yt)||c.memoizedState!==null,Xi(i,o,c),Yt=f;break;default:Xi(i,o,c)}}function rS(i,o){if(o.memoizedState===null&&(i=o.alternate,i!==null&&(i=i.memoizedState,i!==null))){i=i.dehydrated;try{Ql(i)}catch(c){ft(o,o.return,c)}}}function iS(i,o){if(o.memoizedState===null&&(i=o.alternate,i!==null&&(i=i.memoizedState,i!==null&&(i=i.dehydrated,i!==null))))try{Ql(i)}catch(c){ft(o,o.return,c)}}function U3(i){switch(i.tag){case 31:case 13:case 19:var o=i.stateNode;return o===null&&(o=i.stateNode=new J1),o;case 22:return i=i.stateNode,o=i._retryCache,o===null&&(o=i._retryCache=new J1),o;default:throw Error(r(435,i.tag))}}function Kd(i,o){var c=U3(i);o.forEach(function(f){if(!c.has(f)){c.add(f);var v=Z3.bind(null,i,f);f.then(v,v)}})}function er(i,o){var c=o.deletions;if(c!==null)for(var f=0;f<c.length;f++){var v=c[f],x=i,E=o,O=E;e:for(;O!==null;){switch(O.tag){case 27:if(Bs(O.type)){Nt=O.stateNode,Jn=!1;break e}break;case 5:Nt=O.stateNode,Jn=!1;break e;case 3:case 4:Nt=O.stateNode.containerInfo,Jn=!0;break e}O=O.return}if(Nt===null)throw Error(r(160));nS(x,E,v),Nt=null,Jn=!1,x=v.alternate,x!==null&&(x.return=null),v.return=null}if(o.subtreeFlags&13886)for(o=o.child;o!==null;)sS(o,i),o=o.sibling}var Jr=null;function sS(i,o){var c=i.alternate,f=i.flags;switch(i.tag){case 0:case 11:case 14:case 15:er(o,i),tr(i),f&4&&(As(3,i,i.return),_c(3,i),As(5,i,i.return));break;case 1:er(o,i),tr(i),f&512&&(Yt||c===null||mi(c,c.return)),f&64&&Yi&&(i=i.updateQueue,i!==null&&(f=i.callbacks,f!==null&&(c=i.shared.hiddenCallbacks,i.shared.hiddenCallbacks=c===null?f:c.concat(f))));break;case 26:var v=Jr;if(er(o,i),tr(i),f&512&&(Yt||c===null||mi(c,c.return)),f&4){var x=c!==null?c.memoizedState:null;if(f=i.memoizedState,c===null)if(f===null)if(i.stateNode===null){e:{f=i.type,c=i.memoizedProps,v=v.ownerDocument||v;t:switch(f){case"title":x=v.getElementsByTagName("title")[0],(!x||x[qa]||x[wn]||x.namespaceURI==="http://www.w3.org/2000/svg"||x.hasAttribute("itemprop"))&&(x=v.createElement(f),v.head.insertBefore(x,v.querySelector("head > title"))),Rn(x,f,c),x[wn]=i,dn(x),f=x;break e;case"link":var E=sw("link","href",v).get(f+(c.href||""));if(E){for(var O=0;O<E.length;O++)if(x=E[O],x.getAttribute("href")===(c.href==null||c.href===""?null:c.href)&&x.getAttribute("rel")===(c.rel==null?null:c.rel)&&x.getAttribute("title")===(c.title==null?null:c.title)&&x.getAttribute("crossorigin")===(c.crossOrigin==null?null:c.crossOrigin)){E.splice(O,1);break t}}x=v.createElement(f),Rn(x,f,c),v.head.appendChild(x);break;case"meta":if(E=sw("meta","content",v).get(f+(c.content||""))){for(O=0;O<E.length;O++)if(x=E[O],x.getAttribute("content")===(c.content==null?null:""+c.content)&&x.getAttribute("name")===(c.name==null?null:c.name)&&x.getAttribute("property")===(c.property==null?null:c.property)&&x.getAttribute("http-equiv")===(c.httpEquiv==null?null:c.httpEquiv)&&x.getAttribute("charset")===(c.charSet==null?null:c.charSet)){E.splice(O,1);break t}}x=v.createElement(f),Rn(x,f,c),v.head.appendChild(x);break;default:throw Error(r(468,f))}x[wn]=i,dn(x),f=x}i.stateNode=f}else ow(v,i.type,i.stateNode);else i.stateNode=iw(v,f,i.memoizedProps);else x!==f?(x===null?c.stateNode!==null&&(c=c.stateNode,c.parentNode.removeChild(c)):x.count--,f===null?ow(v,i.type,i.stateNode):iw(v,f,i.memoizedProps)):f===null&&i.stateNode!==null&&ug(i,i.memoizedProps,c.memoizedProps)}break;case 27:er(o,i),tr(i),f&512&&(Yt||c===null||mi(c,c.return)),c!==null&&f&4&&ug(i,i.memoizedProps,c.memoizedProps);break;case 5:if(er(o,i),tr(i),f&512&&(Yt||c===null||mi(c,c.return)),i.flags&32){v=i.stateNode;try{xl(v,"")}catch(Re){ft(i,i.return,Re)}}f&4&&i.stateNode!=null&&(v=i.memoizedProps,ug(i,v,c!==null?c.memoizedProps:v)),f&1024&&(fg=!0);break;case 6:if(er(o,i),tr(i),f&4){if(i.stateNode===null)throw Error(r(162));f=i.memoizedProps,c=i.stateNode;try{c.nodeValue=f}catch(Re){ft(i,i.return,Re)}}break;case 3:if(ch=null,v=Jr,Jr=lh(o.containerInfo),er(o,i),Jr=v,tr(i),f&4&&c!==null&&c.memoizedState.isDehydrated)try{Ql(o.containerInfo)}catch(Re){ft(i,i.return,Re)}fg&&(fg=!1,oS(i));break;case 4:f=Jr,Jr=lh(i.stateNode.containerInfo),er(o,i),tr(i),Jr=f;break;case 12:er(o,i),tr(i);break;case 31:er(o,i),tr(i),f&4&&(f=i.updateQueue,f!==null&&(i.updateQueue=null,Kd(i,f)));break;case 13:er(o,i),tr(i),i.child.flags&8192&&i.memoizedState!==null!=(c!==null&&c.memoizedState!==null)&&(Yd=Ge()),f&4&&(f=i.updateQueue,f!==null&&(i.updateQueue=null,Kd(i,f)));break;case 22:v=i.memoizedState!==null;var G=c!==null&&c.memoizedState!==null,te=Yi,de=Yt;if(Yi=te||v,Yt=de||G,er(o,i),Yt=de,Yi=te,tr(i),f&8192)e:for(o=i.stateNode,o._visibility=v?o._visibility&-2:o._visibility|1,v&&(c===null||G||Yi||Yt||Do(i)),c=null,o=i;;){if(o.tag===5||o.tag===26){if(c===null){G=c=o;try{if(x=G.stateNode,v)E=x.style,typeof E.setProperty=="function"?E.setProperty("display","none","important"):E.display="none";else{O=G.stateNode;var me=G.memoizedProps.style,ne=me!=null&&me.hasOwnProperty("display")?me.display:null;O.style.display=ne==null||typeof ne=="boolean"?"":(""+ne).trim()}}catch(Re){ft(G,G.return,Re)}}}else if(o.tag===6){if(c===null){G=o;try{G.stateNode.nodeValue=v?"":G.memoizedProps}catch(Re){ft(G,G.return,Re)}}}else if(o.tag===18){if(c===null){G=o;try{var ie=G.stateNode;v?YS(ie,!0):YS(G.stateNode,!1)}catch(Re){ft(G,G.return,Re)}}}else if((o.tag!==22&&o.tag!==23||o.memoizedState===null||o===i)&&o.child!==null){o.child.return=o,o=o.child;continue}if(o===i)break e;for(;o.sibling===null;){if(o.return===null||o.return===i)break e;c===o&&(c=null),o=o.return}c===o&&(c=null),o.sibling.return=o.return,o=o.sibling}f&4&&(f=i.updateQueue,f!==null&&(c=f.retryQueue,c!==null&&(f.retryQueue=null,Kd(i,c))));break;case 19:er(o,i),tr(i),f&4&&(f=i.updateQueue,f!==null&&(i.updateQueue=null,Kd(i,f)));break;case 30:break;case 21:break;default:er(o,i),tr(i)}}function tr(i){var o=i.flags;if(o&2){try{for(var c,f=i.return;f!==null;){if(Z1(f)){c=f;break}f=f.return}if(c==null)throw Error(r(160));switch(c.tag){case 27:var v=c.stateNode,x=dg(i);qd(i,x,v);break;case 5:var E=c.stateNode;c.flags&32&&(xl(E,""),c.flags&=-33);var O=dg(i);qd(i,O,E);break;case 3:case 4:var G=c.stateNode.containerInfo,te=dg(i);hg(i,te,G);break;default:throw Error(r(161))}}catch(de){ft(i,i.return,de)}i.flags&=-3}o&4096&&(i.flags&=-4097)}function oS(i){if(i.subtreeFlags&1024)for(i=i.child;i!==null;){var o=i;oS(o),o.tag===5&&o.flags&1024&&o.stateNode.reset(),i=i.sibling}}function Zi(i,o){if(o.subtreeFlags&8772)for(o=o.child;o!==null;)eS(i,o.alternate,o),o=o.sibling}function Do(i){for(i=i.child;i!==null;){var o=i;switch(o.tag){case 0:case 11:case 14:case 15:As(4,o,o.return),Do(o);break;case 1:mi(o,o.return);var c=o.stateNode;typeof c.componentWillUnmount=="function"&&Y1(o,o.return,c),Do(o);break;case 27:Tc(o.stateNode);case 26:case 5:mi(o,o.return),Do(o);break;case 22:o.memoizedState===null&&Do(o);break;case 30:Do(o);break;default:Do(o)}i=i.sibling}}function Qi(i,o,c){for(c=c&&(o.subtreeFlags&8772)!==0,o=o.child;o!==null;){var f=o.alternate,v=i,x=o,E=x.flags;switch(x.tag){case 0:case 11:case 15:Qi(v,x,c),_c(4,x);break;case 1:if(Qi(v,x,c),f=x,v=f.stateNode,typeof v.componentDidMount=="function")try{v.componentDidMount()}catch(te){ft(f,f.return,te)}if(f=x,v=f.updateQueue,v!==null){var O=f.stateNode;try{var G=v.shared.hiddenCallbacks;if(G!==null)for(v.shared.hiddenCallbacks=null,v=0;v<G.length;v++)Px(G[v],O)}catch(te){ft(f,f.return,te)}}c&&E&64&&G1(x),yc(x,x.return);break;case 27:Q1(x);case 26:case 5:Qi(v,x,c),c&&f===null&&E&4&&X1(x),yc(x,x.return);break;case 12:Qi(v,x,c);break;case 31:Qi(v,x,c),c&&E&4&&rS(v,x);break;case 13:Qi(v,x,c),c&&E&4&&iS(v,x);break;case 22:x.memoizedState===null&&Qi(v,x,c),yc(x,x.return);break;case 30:break;default:Qi(v,x,c)}o=o.sibling}}function pg(i,o){var c=null;i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(c=i.memoizedState.cachePool.pool),i=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(i=o.memoizedState.cachePool.pool),i!==c&&(i!=null&&i.refCount++,c!=null&&sc(c))}function mg(i,o){i=null,o.alternate!==null&&(i=o.alternate.memoizedState.cache),o=o.memoizedState.cache,o!==i&&(o.refCount++,i!=null&&sc(i))}function ei(i,o,c,f){if(o.subtreeFlags&10256)for(o=o.child;o!==null;)lS(i,o,c,f),o=o.sibling}function lS(i,o,c,f){var v=o.flags;switch(o.tag){case 0:case 11:case 15:ei(i,o,c,f),v&2048&&_c(9,o);break;case 1:ei(i,o,c,f);break;case 3:ei(i,o,c,f),v&2048&&(i=null,o.alternate!==null&&(i=o.alternate.memoizedState.cache),o=o.memoizedState.cache,o!==i&&(o.refCount++,i!=null&&sc(i)));break;case 12:if(v&2048){ei(i,o,c,f),i=o.stateNode;try{var x=o.memoizedProps,E=x.id,O=x.onPostCommit;typeof O=="function"&&O(E,o.alternate===null?"mount":"update",i.passiveEffectDuration,-0)}catch(G){ft(o,o.return,G)}}else ei(i,o,c,f);break;case 31:ei(i,o,c,f);break;case 13:ei(i,o,c,f);break;case 23:break;case 22:x=o.stateNode,E=o.alternate,o.memoizedState!==null?x._visibility&2?ei(i,o,c,f):bc(i,o):x._visibility&2?ei(i,o,c,f):(x._visibility|=2,Fl(i,o,c,f,(o.subtreeFlags&10256)!==0||!1)),v&2048&&pg(E,o);break;case 24:ei(i,o,c,f),v&2048&&mg(o.alternate,o);break;default:ei(i,o,c,f)}}function Fl(i,o,c,f,v){for(v=v&&((o.subtreeFlags&10256)!==0||!1),o=o.child;o!==null;){var x=i,E=o,O=c,G=f,te=E.flags;switch(E.tag){case 0:case 11:case 15:Fl(x,E,O,G,v),_c(8,E);break;case 23:break;case 22:var de=E.stateNode;E.memoizedState!==null?de._visibility&2?Fl(x,E,O,G,v):bc(x,E):(de._visibility|=2,Fl(x,E,O,G,v)),v&&te&2048&&pg(E.alternate,E);break;case 24:Fl(x,E,O,G,v),v&&te&2048&&mg(E.alternate,E);break;default:Fl(x,E,O,G,v)}o=o.sibling}}function bc(i,o){if(o.subtreeFlags&10256)for(o=o.child;o!==null;){var c=i,f=o,v=f.flags;switch(f.tag){case 22:bc(c,f),v&2048&&pg(f.alternate,f);break;case 24:bc(c,f),v&2048&&mg(f.alternate,f);break;default:bc(c,f)}o=o.sibling}}var xc=8192;function Ul(i,o,c){if(i.subtreeFlags&xc)for(i=i.child;i!==null;)aS(i,o,c),i=i.sibling}function aS(i,o,c){switch(i.tag){case 26:Ul(i,o,c),i.flags&xc&&i.memoizedState!==null&&TO(c,Jr,i.memoizedState,i.memoizedProps);break;case 5:Ul(i,o,c);break;case 3:case 4:var f=Jr;Jr=lh(i.stateNode.containerInfo),Ul(i,o,c),Jr=f;break;case 22:i.memoizedState===null&&(f=i.alternate,f!==null&&f.memoizedState!==null?(f=xc,xc=16777216,Ul(i,o,c),xc=f):Ul(i,o,c));break;default:Ul(i,o,c)}}function cS(i){var o=i.alternate;if(o!==null&&(i=o.child,i!==null)){o.child=null;do o=i.sibling,i.sibling=null,i=o;while(i!==null)}}function Sc(i){var o=i.deletions;if((i.flags&16)!==0){if(o!==null)for(var c=0;c<o.length;c++){var f=o[c];hn=f,dS(f,i)}cS(i)}if(i.subtreeFlags&10256)for(i=i.child;i!==null;)uS(i),i=i.sibling}function uS(i){switch(i.tag){case 0:case 11:case 15:Sc(i),i.flags&2048&&As(9,i,i.return);break;case 3:Sc(i);break;case 12:Sc(i);break;case 22:var o=i.stateNode;i.memoizedState!==null&&o._visibility&2&&(i.return===null||i.return.tag!==13)?(o._visibility&=-3,Gd(i)):Sc(i);break;default:Sc(i)}}function Gd(i){var o=i.deletions;if((i.flags&16)!==0){if(o!==null)for(var c=0;c<o.length;c++){var f=o[c];hn=f,dS(f,i)}cS(i)}for(i=i.child;i!==null;){switch(o=i,o.tag){case 0:case 11:case 15:As(8,o,o.return),Gd(o);break;case 22:c=o.stateNode,c._visibility&2&&(c._visibility&=-3,Gd(o));break;default:Gd(o)}i=i.sibling}}function dS(i,o){for(;hn!==null;){var c=hn;switch(c.tag){case 0:case 11:case 15:As(8,c,o);break;case 23:case 22:if(c.memoizedState!==null&&c.memoizedState.cachePool!==null){var f=c.memoizedState.cachePool.pool;f!=null&&f.refCount++}break;case 24:sc(c.memoizedState.cache)}if(f=c.child,f!==null)f.return=c,hn=f;else e:for(c=i;hn!==null;){f=hn;var v=f.sibling,x=f.return;if(tS(f),f===c){hn=null;break e}if(v!==null){v.return=x,hn=v;break e}hn=x}}}var $3={getCacheForType:function(i){var o=kn(qt),c=o.data.get(i);return c===void 0&&(c=i(),o.data.set(i,c)),c},cacheSignal:function(){return kn(qt).controller.signal}},W3=typeof WeakMap=="function"?WeakMap:Map,ct=0,bt=null,Xe=null,et=0,ht=0,gr=null,Ds=!1,$l=!1,gg=!1,Ji=0,zt=0,Os=0,Oo=0,vg=0,vr=0,Wl=0,wc=null,nr=null,_g=!1,Yd=0,hS=0,Xd=1/0,Zd=null,Ls=null,nn=0,js=null,Vl=null,es=0,yg=0,bg=null,fS=null,Cc=0,xg=null;function _r(){return(ct&2)!==0&&et!==0?et&-et:P.T!==null?Rg():Zr()}function pS(){if(vr===0)if((et&536870912)===0||rt){var i=le;le<<=1,(le&3932160)===0&&(le=262144),vr=i}else vr=536870912;return i=pr.current,i!==null&&(i.flags|=32),vr}function rr(i,o,c){(i===bt&&(ht===2||ht===9)||i.cancelPendingCommit!==null)&&(ql(i,0),zs(i,et,vr,!1)),Rr(i,c),((ct&2)===0||i!==bt)&&(i===bt&&((ct&2)===0&&(Oo|=c),zt===4&&zs(i,et,vr,!1)),gi(i))}function mS(i,o,c){if((ct&6)!==0)throw Error(r(327));var f=!c&&(o&127)===0&&(o&i.expiredLanes)===0||ot(i,o),v=f?K3(i,o):wg(i,o,!0),x=f;do{if(v===0){$l&&!f&&zs(i,o,0,!1);break}else{if(c=i.current.alternate,x&&!V3(c)){v=wg(i,o,!1),x=!1;continue}if(v===2){if(x=o,i.errorRecoveryDisabledLanes&x)var E=0;else E=i.pendingLanes&-536870913,E=E!==0?E:E&536870912?536870912:0;if(E!==0){o=E;e:{var O=i;v=wc;var G=O.current.memoizedState.isDehydrated;if(G&&(ql(O,E).flags|=256),E=wg(O,E,!1),E!==2){if(gg&&!G){O.errorRecoveryDisabledLanes|=x,Oo|=x,v=4;break e}x=nr,nr=v,x!==null&&(nr===null?nr=x:nr.push.apply(nr,x))}v=E}if(x=!1,v!==2)continue}}if(v===1){ql(i,0),zs(i,o,0,!0);break}e:{switch(f=i,x=v,x){case 0:case 1:throw Error(r(345));case 4:if((o&4194048)!==o)break;case 6:zs(f,o,vr,!Ds);break e;case 2:nr=null;break;case 3:case 5:break;default:throw Error(r(329))}if((o&62914560)===o&&(v=Yd+300-Ge(),10<v)){if(zs(f,o,vr,!Ds),We(f,0,!0)!==0)break e;es=o,f.timeoutHandle=qS(gS.bind(null,f,c,nr,Zd,_g,o,vr,Oo,Wl,Ds,x,"Throttled",-0,0),v);break e}gS(f,c,nr,Zd,_g,o,vr,Oo,Wl,Ds,x,null,-0,0)}}break}while(!0);gi(i)}function gS(i,o,c,f,v,x,E,O,G,te,de,me,ne,ie){if(i.timeoutHandle=-1,me=o.subtreeFlags,me&8192||(me&16785408)===16785408){me={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Ii},aS(o,x,me);var Re=(x&62914560)===x?Yd-Ge():(x&4194048)===x?hS-Ge():0;if(Re=MO(me,Re),Re!==null){es=x,i.cancelPendingCommit=Re(CS.bind(null,i,o,x,c,f,v,E,O,G,de,me,null,ne,ie)),zs(i,x,E,!te);return}}CS(i,o,x,c,f,v,E,O,G)}function V3(i){for(var o=i;;){var c=o.tag;if((c===0||c===11||c===15)&&o.flags&16384&&(c=o.updateQueue,c!==null&&(c=c.stores,c!==null)))for(var f=0;f<c.length;f++){var v=c[f],x=v.getSnapshot;v=v.value;try{if(!hr(x(),v))return!1}catch{return!1}}if(c=o.child,o.subtreeFlags&16384&&c!==null)c.return=o,o=c;else{if(o===i)break;for(;o.sibling===null;){if(o.return===null||o.return===i)return!0;o=o.return}o.sibling.return=o.return,o=o.sibling}}return!0}function zs(i,o,c,f){o&=~vg,o&=~Oo,i.suspendedLanes|=o,i.pingedLanes&=~o,f&&(i.warmLanes|=o),f=i.expirationTimes;for(var v=o;0<v;){var x=31-st(v),E=1<<x;f[x]=-1,v&=~E}c!==0&&Xr(i,c,o)}function Qd(){return(ct&6)===0?(kc(0),!1):!0}function Sg(){if(Xe!==null){if(ht===0)var i=Xe.return;else i=Xe,$i=Co=null,Bm(i),zl=null,lc=0,i=Xe;for(;i!==null;)K1(i.alternate,i),i=i.return;Xe=null}}function ql(i,o){var c=i.timeoutHandle;c!==-1&&(i.timeoutHandle=-1,dO(c)),c=i.cancelPendingCommit,c!==null&&(i.cancelPendingCommit=null,c()),es=0,Sg(),bt=i,Xe=c=Fi(i.current,null),et=o,ht=0,gr=null,Ds=!1,$l=ot(i,o),gg=!1,Wl=vr=vg=Oo=Os=zt=0,nr=wc=null,_g=!1,(o&8)!==0&&(o|=o&32);var f=i.entangledLanes;if(f!==0)for(i=i.entanglements,f&=o;0<f;){var v=31-st(f),x=1<<v;o|=i[v],f&=~x}return Ji=o,yd(),c}function vS(i,o){Fe=null,P.H=mc,o===jl||o===Rd?(o=Ox(),ht=3):o===Em?(o=Ox(),ht=4):ht=o===eg?8:o!==null&&typeof o=="object"&&typeof o.then=="function"?6:1,gr=o,Xe===null&&(zt=1,Fd(i,Or(o,i.current)))}function _S(){var i=pr.current;return i===null?!0:(et&4194048)===et?Pr===null:(et&62914560)===et||(et&536870912)!==0?i===Pr:!1}function yS(){var i=P.H;return P.H=mc,i===null?mc:i}function bS(){var i=P.A;return P.A=$3,i}function Jd(){zt=4,Ds||(et&4194048)!==et&&pr.current!==null||($l=!0),(Os&134217727)===0&&(Oo&134217727)===0||bt===null||zs(bt,et,vr,!1)}function wg(i,o,c){var f=ct;ct|=2;var v=yS(),x=bS();(bt!==i||et!==o)&&(Zd=null,ql(i,o)),o=!1;var E=zt;e:do try{if(ht!==0&&Xe!==null){var O=Xe,G=gr;switch(ht){case 8:Sg(),E=6;break e;case 3:case 2:case 9:case 6:pr.current===null&&(o=!0);var te=ht;if(ht=0,gr=null,Kl(i,O,G,te),c&&$l){E=0;break e}break;default:te=ht,ht=0,gr=null,Kl(i,O,G,te)}}q3(),E=zt;break}catch(de){vS(i,de)}while(!0);return o&&i.shellSuspendCounter++,$i=Co=null,ct=f,P.H=v,P.A=x,Xe===null&&(bt=null,et=0,yd()),E}function q3(){for(;Xe!==null;)xS(Xe)}function K3(i,o){var c=ct;ct|=2;var f=yS(),v=bS();bt!==i||et!==o?(Zd=null,Xd=Ge()+500,ql(i,o)):$l=ot(i,o);e:do try{if(ht!==0&&Xe!==null){o=Xe;var x=gr;t:switch(ht){case 1:ht=0,gr=null,Kl(i,o,x,1);break;case 2:case 9:if(Ax(x)){ht=0,gr=null,SS(o);break}o=function(){ht!==2&&ht!==9||bt!==i||(ht=7),gi(i)},x.then(o,o);break e;case 3:ht=7;break e;case 4:ht=5;break e;case 7:Ax(x)?(ht=0,gr=null,SS(o)):(ht=0,gr=null,Kl(i,o,x,7));break;case 5:var E=null;switch(Xe.tag){case 26:E=Xe.memoizedState;case 5:case 27:var O=Xe;if(E?lw(E):O.stateNode.complete){ht=0,gr=null;var G=O.sibling;if(G!==null)Xe=G;else{var te=O.return;te!==null?(Xe=te,eh(te)):Xe=null}break t}}ht=0,gr=null,Kl(i,o,x,5);break;case 6:ht=0,gr=null,Kl(i,o,x,6);break;case 8:Sg(),zt=6;break e;default:throw Error(r(462))}}G3();break}catch(de){vS(i,de)}while(!0);return $i=Co=null,P.H=f,P.A=v,ct=c,Xe!==null?0:(bt=null,et=0,yd(),zt)}function G3(){for(;Xe!==null&&!cr();)xS(Xe)}function xS(i){var o=V1(i.alternate,i,Ji);i.memoizedProps=i.pendingProps,o===null?eh(i):Xe=o}function SS(i){var o=i,c=o.alternate;switch(o.tag){case 15:case 0:o=I1(c,o,o.pendingProps,o.type,void 0,et);break;case 11:o=I1(c,o,o.pendingProps,o.type.render,o.ref,et);break;case 5:Bm(o);default:K1(c,o),o=Xe=bx(o,Ji),o=V1(c,o,Ji)}i.memoizedProps=i.pendingProps,o===null?eh(i):Xe=o}function Kl(i,o,c,f){$i=Co=null,Bm(o),zl=null,lc=0;var v=o.return;try{if(z3(i,v,o,c,et)){zt=1,Fd(i,Or(c,i.current)),Xe=null;return}}catch(x){if(v!==null)throw Xe=v,x;zt=1,Fd(i,Or(c,i.current)),Xe=null;return}o.flags&32768?(rt||f===1?i=!0:$l||(et&536870912)!==0?i=!1:(Ds=i=!0,(f===2||f===9||f===3||f===6)&&(f=pr.current,f!==null&&f.tag===13&&(f.flags|=16384))),wS(o,i)):eh(o)}function eh(i){var o=i;do{if((o.flags&32768)!==0){wS(o,Ds);return}i=o.return;var c=I3(o.alternate,o,Ji);if(c!==null){Xe=c;return}if(o=o.sibling,o!==null){Xe=o;return}Xe=o=i}while(o!==null);zt===0&&(zt=5)}function wS(i,o){do{var c=H3(i.alternate,i);if(c!==null){c.flags&=32767,Xe=c;return}if(c=i.return,c!==null&&(c.flags|=32768,c.subtreeFlags=0,c.deletions=null),!o&&(i=i.sibling,i!==null)){Xe=i;return}Xe=i=c}while(i!==null);zt=6,Xe=null}function CS(i,o,c,f,v,x,E,O,G){i.cancelPendingCommit=null;do th();while(nn!==0);if((ct&6)!==0)throw Error(r(327));if(o!==null){if(o===i.current)throw Error(r(177));if(x=o.lanes|o.childLanes,x|=dm,tn(i,c,x,E,O,G),i===bt&&(Xe=bt=null,et=0),Vl=o,js=i,es=c,yg=x,bg=v,fS=f,(o.subtreeFlags&10256)!==0||(o.flags&10256)!==0?(i.callbackNode=null,i.callbackPriority=0,Q3(Ae,function(){return MS(),null})):(i.callbackNode=null,i.callbackPriority=0),f=(o.flags&13878)!==0,(o.subtreeFlags&13878)!==0||f){f=P.T,P.T=null,v=V.p,V.p=2,E=ct,ct|=4;try{F3(i,o,c)}finally{ct=E,V.p=v,P.T=f}}nn=1,kS(),ES(),RS()}}function kS(){if(nn===1){nn=0;var i=js,o=Vl,c=(o.flags&13878)!==0;if((o.subtreeFlags&13878)!==0||c){c=P.T,P.T=null;var f=V.p;V.p=2;var v=ct;ct|=4;try{sS(o,i);var x=jg,E=dx(i.containerInfo),O=x.focusedElem,G=x.selectionRange;if(E!==O&&O&&O.ownerDocument&&ux(O.ownerDocument.documentElement,O)){if(G!==null&&om(O)){var te=G.start,de=G.end;if(de===void 0&&(de=te),"selectionStart"in O)O.selectionStart=te,O.selectionEnd=Math.min(de,O.value.length);else{var me=O.ownerDocument||document,ne=me&&me.defaultView||window;if(ne.getSelection){var ie=ne.getSelection(),Re=O.textContent.length,ze=Math.min(G.start,Re),gt=G.end===void 0?ze:Math.min(G.end,Re);!ie.extend&&ze>gt&&(E=gt,gt=ze,ze=E);var Q=cx(O,ze),Y=cx(O,gt);if(Q&&Y&&(ie.rangeCount!==1||ie.anchorNode!==Q.node||ie.anchorOffset!==Q.offset||ie.focusNode!==Y.node||ie.focusOffset!==Y.offset)){var ee=me.createRange();ee.setStart(Q.node,Q.offset),ie.removeAllRanges(),ze>gt?(ie.addRange(ee),ie.extend(Y.node,Y.offset)):(ee.setEnd(Y.node,Y.offset),ie.addRange(ee))}}}}for(me=[],ie=O;ie=ie.parentNode;)ie.nodeType===1&&me.push({element:ie,left:ie.scrollLeft,top:ie.scrollTop});for(typeof O.focus=="function"&&O.focus(),O=0;O<me.length;O++){var fe=me[O];fe.element.scrollLeft=fe.left,fe.element.scrollTop=fe.top}}fh=!!Lg,jg=Lg=null}finally{ct=v,V.p=f,P.T=c}}i.current=o,nn=2}}function ES(){if(nn===2){nn=0;var i=js,o=Vl,c=(o.flags&8772)!==0;if((o.subtreeFlags&8772)!==0||c){c=P.T,P.T=null;var f=V.p;V.p=2;var v=ct;ct|=4;try{eS(i,o.alternate,o)}finally{ct=v,V.p=f,P.T=c}}nn=3}}function RS(){if(nn===4||nn===3){nn=0,pe();var i=js,o=Vl,c=es,f=fS;(o.subtreeFlags&10256)!==0||(o.flags&10256)!==0?nn=5:(nn=0,Vl=js=null,TS(i,i.pendingLanes));var v=i.pendingLanes;if(v===0&&(Ls=null),Pi(c),o=o.stateNode,kt&&typeof kt.onCommitFiberRoot=="function")try{kt.onCommitFiberRoot(en,o,void 0,(o.current.flags&128)===128)}catch{}if(f!==null){o=P.T,v=V.p,V.p=2,P.T=null;try{for(var x=i.onRecoverableError,E=0;E<f.length;E++){var O=f[E];x(O.value,{componentStack:O.stack})}}finally{P.T=o,V.p=v}}(es&3)!==0&&th(),gi(i),v=i.pendingLanes,(c&261930)!==0&&(v&42)!==0?i===xg?Cc++:(Cc=0,xg=i):Cc=0,kc(0)}}function TS(i,o){(i.pooledCacheLanes&=o)===0&&(o=i.pooledCache,o!=null&&(i.pooledCache=null,sc(o)))}function th(){return kS(),ES(),RS(),MS()}function MS(){if(nn!==5)return!1;var i=js,o=yg;yg=0;var c=Pi(es),f=P.T,v=V.p;try{V.p=32>c?32:c,P.T=null,c=bg,bg=null;var x=js,E=es;if(nn=0,Vl=js=null,es=0,(ct&6)!==0)throw Error(r(331));var O=ct;if(ct|=4,uS(x.current),lS(x,x.current,E,c),ct=O,kc(0,!1),kt&&typeof kt.onPostCommitFiberRoot=="function")try{kt.onPostCommitFiberRoot(en,x)}catch{}return!0}finally{V.p=v,P.T=f,TS(i,o)}}function NS(i,o,c){o=Or(c,o),o=Jm(i.stateNode,o,2),i=Ts(i,o,2),i!==null&&(Rr(i,2),gi(i))}function ft(i,o,c){if(i.tag===3)NS(i,i,c);else for(;o!==null;){if(o.tag===3){NS(o,i,c);break}else if(o.tag===1){var f=o.stateNode;if(typeof o.type.getDerivedStateFromError=="function"||typeof f.componentDidCatch=="function"&&(Ls===null||!Ls.has(f))){i=Or(c,i),c=A1(2),f=Ts(o,c,2),f!==null&&(D1(c,f,o,i),Rr(f,2),gi(f));break}}o=o.return}}function Cg(i,o,c){var f=i.pingCache;if(f===null){f=i.pingCache=new W3;var v=new Set;f.set(o,v)}else v=f.get(o),v===void 0&&(v=new Set,f.set(o,v));v.has(c)||(gg=!0,v.add(c),i=Y3.bind(null,i,o,c),o.then(i,i))}function Y3(i,o,c){var f=i.pingCache;f!==null&&f.delete(o),i.pingedLanes|=i.suspendedLanes&c,i.warmLanes&=~c,bt===i&&(et&c)===c&&(zt===4||zt===3&&(et&62914560)===et&&300>Ge()-Yd?(ct&2)===0&&ql(i,0):vg|=c,Wl===et&&(Wl=0)),gi(i)}function AS(i,o){o===0&&(o=An()),i=xo(i,o),i!==null&&(Rr(i,o),gi(i))}function X3(i){var o=i.memoizedState,c=0;o!==null&&(c=o.retryLane),AS(i,c)}function Z3(i,o){var c=0;switch(i.tag){case 31:case 13:var f=i.stateNode,v=i.memoizedState;v!==null&&(c=v.retryLane);break;case 19:f=i.stateNode;break;case 22:f=i.stateNode._retryCache;break;default:throw Error(r(314))}f!==null&&f.delete(o),AS(i,c)}function Q3(i,o){return Wt(i,o)}var nh=null,Gl=null,kg=!1,rh=!1,Eg=!1,Ps=0;function gi(i){i!==Gl&&i.next===null&&(Gl===null?nh=Gl=i:Gl=Gl.next=i),rh=!0,kg||(kg=!0,eO())}function kc(i,o){if(!Eg&&rh){Eg=!0;do for(var c=!1,f=nh;f!==null;){if(i!==0){var v=f.pendingLanes;if(v===0)var x=0;else{var E=f.suspendedLanes,O=f.pingedLanes;x=(1<<31-st(42|i)+1)-1,x&=v&~(E&~O),x=x&201326741?x&201326741|1:x?x|2:0}x!==0&&(c=!0,jS(f,x))}else x=et,x=We(f,f===bt?x:0,f.cancelPendingCommit!==null||f.timeoutHandle!==-1),(x&3)===0||ot(f,x)||(c=!0,jS(f,x));f=f.next}while(c);Eg=!1}}function J3(){DS()}function DS(){rh=kg=!1;var i=0;Ps!==0&&uO()&&(i=Ps);for(var o=Ge(),c=null,f=nh;f!==null;){var v=f.next,x=OS(f,o);x===0?(f.next=null,c===null?nh=v:c.next=v,v===null&&(Gl=c)):(c=f,(i!==0||(x&3)!==0)&&(rh=!0)),f=v}nn!==0&&nn!==5||kc(i),Ps!==0&&(Ps=0)}function OS(i,o){for(var c=i.suspendedLanes,f=i.pingedLanes,v=i.expirationTimes,x=i.pendingLanes&-62914561;0<x;){var E=31-st(x),O=1<<E,G=v[E];G===-1?((O&c)===0||(O&f)!==0)&&(v[E]=Bn(O,o)):G<=o&&(i.expiredLanes|=O),x&=~O}if(o=bt,c=et,c=We(i,i===o?c:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),f=i.callbackNode,c===0||i===o&&(ht===2||ht===9)||i.cancelPendingCommit!==null)return f!==null&&f!==null&&un(f),i.callbackNode=null,i.callbackPriority=0;if((c&3)===0||ot(i,c)){if(o=c&-c,o===i.callbackPriority)return o;switch(f!==null&&un(f),Pi(c)){case 2:case 8:c=ye;break;case 32:c=Ae;break;case 268435456:c=Ye;break;default:c=Ae}return f=LS.bind(null,i),c=Wt(c,f),i.callbackPriority=o,i.callbackNode=c,o}return f!==null&&f!==null&&un(f),i.callbackPriority=2,i.callbackNode=null,2}function LS(i,o){if(nn!==0&&nn!==5)return i.callbackNode=null,i.callbackPriority=0,null;var c=i.callbackNode;if(th()&&i.callbackNode!==c)return null;var f=et;return f=We(i,i===bt?f:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),f===0?null:(mS(i,f,o),OS(i,Ge()),i.callbackNode!=null&&i.callbackNode===c?LS.bind(null,i):null)}function jS(i,o){if(th())return null;mS(i,o,!0)}function eO(){hO(function(){(ct&6)!==0?Wt(ue,J3):DS()})}function Rg(){if(Ps===0){var i=Ol;i===0&&(i=ji,ji<<=1,(ji&261888)===0&&(ji=256)),Ps=i}return Ps}function zS(i){return i==null||typeof i=="symbol"||typeof i=="boolean"?null:typeof i=="function"?i:dd(""+i)}function PS(i,o){var c=o.ownerDocument.createElement("input");return c.name=o.name,c.value=o.value,i.id&&c.setAttribute("form",i.id),o.parentNode.insertBefore(c,o),i=new FormData(i),c.parentNode.removeChild(c),i}function tO(i,o,c,f,v){if(o==="submit"&&c&&c.stateNode===v){var x=zS((v[Zn]||null).action),E=f.submitter;E&&(o=(o=E[Zn]||null)?zS(o.formAction):E.getAttribute("formAction"),o!==null&&(x=o,E=null));var O=new md("action","action",null,f,v);i.push({event:O,listeners:[{instance:null,listener:function(){if(f.defaultPrevented){if(Ps!==0){var G=E?PS(v,E):new FormData(v);Km(c,{pending:!0,data:G,method:v.method,action:x},null,G)}}else typeof x=="function"&&(O.preventDefault(),G=E?PS(v,E):new FormData(v),Km(c,{pending:!0,data:G,method:v.method,action:x},x,G))},currentTarget:v}]})}}for(var Tg=0;Tg<um.length;Tg++){var Mg=um[Tg],nO=Mg.toLowerCase(),rO=Mg[0].toUpperCase()+Mg.slice(1);Qr(nO,"on"+rO)}Qr(px,"onAnimationEnd"),Qr(mx,"onAnimationIteration"),Qr(gx,"onAnimationStart"),Qr("dblclick","onDoubleClick"),Qr("focusin","onFocus"),Qr("focusout","onBlur"),Qr(y3,"onTransitionRun"),Qr(b3,"onTransitionStart"),Qr(x3,"onTransitionCancel"),Qr(vx,"onTransitionEnd"),yl("onMouseEnter",["mouseout","mouseover"]),yl("onMouseLeave",["mouseout","mouseover"]),yl("onPointerEnter",["pointerout","pointerover"]),yl("onPointerLeave",["pointerout","pointerover"]),vo("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),vo("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),vo("onBeforeInput",["compositionend","keypress","textInput","paste"]),vo("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),vo("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),vo("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ec="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(" "),iO=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Ec));function BS(i,o){o=(o&4)!==0;for(var c=0;c<i.length;c++){var f=i[c],v=f.event;f=f.listeners;e:{var x=void 0;if(o)for(var E=f.length-1;0<=E;E--){var O=f[E],G=O.instance,te=O.currentTarget;if(O=O.listener,G!==x&&v.isPropagationStopped())break e;x=O,v.currentTarget=te;try{x(v)}catch(de){_d(de)}v.currentTarget=null,x=G}else for(E=0;E<f.length;E++){if(O=f[E],G=O.instance,te=O.currentTarget,O=O.listener,G!==x&&v.isPropagationStopped())break e;x=O,v.currentTarget=te;try{x(v)}catch(de){_d(de)}v.currentTarget=null,x=G}}}}function Ze(i,o){var c=o[Up];c===void 0&&(c=o[Up]=new Set);var f=i+"__bubble";c.has(f)||(IS(o,i,2,!1),c.add(f))}function Ng(i,o,c){var f=0;o&&(f|=4),IS(c,i,f,o)}var ih="_reactListening"+Math.random().toString(36).slice(2);function Ag(i){if(!i[ih]){i[ih]=!0,D0.forEach(function(c){c!=="selectionchange"&&(iO.has(c)||Ng(c,!1,i),Ng(c,!0,i))});var o=i.nodeType===9?i:i.ownerDocument;o===null||o[ih]||(o[ih]=!0,Ng("selectionchange",!1,o))}}function IS(i,o,c,f){switch(pw(o)){case 2:var v=DO;break;case 8:v=OO;break;default:v=qg}c=v.bind(null,o,c,i),v=void 0,!Zp||o!=="touchstart"&&o!=="touchmove"&&o!=="wheel"||(v=!0),f?v!==void 0?i.addEventListener(o,c,{capture:!0,passive:v}):i.addEventListener(o,c,!0):v!==void 0?i.addEventListener(o,c,{passive:v}):i.addEventListener(o,c,!1)}function Dg(i,o,c,f,v){var x=f;if((o&1)===0&&(o&2)===0&&f!==null)e:for(;;){if(f===null)return;var E=f.tag;if(E===3||E===4){var O=f.stateNode.containerInfo;if(O===v)break;if(E===4)for(E=f.return;E!==null;){var G=E.tag;if((G===3||G===4)&&E.stateNode.containerInfo===v)return;E=E.return}for(;O!==null;){if(E=gl(O),E===null)return;if(G=E.tag,G===5||G===6||G===26||G===27){f=x=E;continue e}O=O.parentNode}}f=f.return}W0(function(){var te=x,de=Yp(c),me=[];e:{var ne=_x.get(i);if(ne!==void 0){var ie=md,Re=i;switch(i){case"keypress":if(fd(c)===0)break e;case"keydown":case"keyup":ie=ZD;break;case"focusin":Re="focus",ie=tm;break;case"focusout":Re="blur",ie=tm;break;case"beforeblur":case"afterblur":ie=tm;break;case"click":if(c.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ie=K0;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ie=ID;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ie=e3;break;case px:case mx:case gx:ie=UD;break;case vx:ie=n3;break;case"scroll":case"scrollend":ie=PD;break;case"wheel":ie=i3;break;case"copy":case"cut":case"paste":ie=WD;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ie=Y0;break;case"toggle":case"beforetoggle":ie=o3}var ze=(o&4)!==0,gt=!ze&&(i==="scroll"||i==="scrollend"),Q=ze?ne!==null?ne+"Capture":null:ne;ze=[];for(var Y=te,ee;Y!==null;){var fe=Y;if(ee=fe.stateNode,fe=fe.tag,fe!==5&&fe!==26&&fe!==27||ee===null||Q===null||(fe=Ga(Y,Q),fe!=null&&ze.push(Rc(Y,fe,ee))),gt)break;Y=Y.return}0<ze.length&&(ne=new ie(ne,Re,null,c,de),me.push({event:ne,listeners:ze}))}}if((o&7)===0){e:{if(ne=i==="mouseover"||i==="pointerover",ie=i==="mouseout"||i==="pointerout",ne&&c!==Gp&&(Re=c.relatedTarget||c.fromElement)&&(gl(Re)||Re[ml]))break e;if((ie||ne)&&(ne=de.window===de?de:(ne=de.ownerDocument)?ne.defaultView||ne.parentWindow:window,ie?(Re=c.relatedTarget||c.toElement,ie=te,Re=Re?gl(Re):null,Re!==null&&(gt=l(Re),ze=Re.tag,Re!==gt||ze!==5&&ze!==27&&ze!==6)&&(Re=null)):(ie=null,Re=te),ie!==Re)){if(ze=K0,fe="onMouseLeave",Q="onMouseEnter",Y="mouse",(i==="pointerout"||i==="pointerover")&&(ze=Y0,fe="onPointerLeave",Q="onPointerEnter",Y="pointer"),gt=ie==null?ne:Ka(ie),ee=Re==null?ne:Ka(Re),ne=new ze(fe,Y+"leave",ie,c,de),ne.target=gt,ne.relatedTarget=ee,fe=null,gl(de)===te&&(ze=new ze(Q,Y+"enter",Re,c,de),ze.target=ee,ze.relatedTarget=gt,fe=ze),gt=fe,ie&&Re)t:{for(ze=sO,Q=ie,Y=Re,ee=0,fe=Q;fe;fe=ze(fe))ee++;fe=0;for(var Oe=Y;Oe;Oe=ze(Oe))fe++;for(;0<ee-fe;)Q=ze(Q),ee--;for(;0<fe-ee;)Y=ze(Y),fe--;for(;ee--;){if(Q===Y||Y!==null&&Q===Y.alternate){ze=Q;break t}Q=ze(Q),Y=ze(Y)}ze=null}else ze=null;ie!==null&&HS(me,ne,ie,ze,!1),Re!==null&&gt!==null&&HS(me,gt,Re,ze,!0)}}e:{if(ne=te?Ka(te):window,ie=ne.nodeName&&ne.nodeName.toLowerCase(),ie==="select"||ie==="input"&&ne.type==="file")var lt=rx;else if(tx(ne))if(ix)lt=g3;else{lt=p3;var De=f3}else ie=ne.nodeName,!ie||ie.toLowerCase()!=="input"||ne.type!=="checkbox"&&ne.type!=="radio"?te&&Kp(te.elementType)&&(lt=rx):lt=m3;if(lt&&(lt=lt(i,te))){nx(me,lt,c,de);break e}De&&De(i,ne,te),i==="focusout"&&te&&ne.type==="number"&&te.memoizedProps.value!=null&&qp(ne,"number",ne.value)}switch(De=te?Ka(te):window,i){case"focusin":(tx(De)||De.contentEditable==="true")&&(kl=De,lm=te,nc=null);break;case"focusout":nc=lm=kl=null;break;case"mousedown":am=!0;break;case"contextmenu":case"mouseup":case"dragend":am=!1,hx(me,c,de);break;case"selectionchange":if(_3)break;case"keydown":case"keyup":hx(me,c,de)}var Ue;if(rm)e:{switch(i){case"compositionstart":var tt="onCompositionStart";break e;case"compositionend":tt="onCompositionEnd";break e;case"compositionupdate":tt="onCompositionUpdate";break e}tt=void 0}else Cl?J0(i,c)&&(tt="onCompositionEnd"):i==="keydown"&&c.keyCode===229&&(tt="onCompositionStart");tt&&(X0&&c.locale!=="ko"&&(Cl||tt!=="onCompositionStart"?tt==="onCompositionEnd"&&Cl&&(Ue=V0()):(xs=de,Qp="value"in xs?xs.value:xs.textContent,Cl=!0)),De=sh(te,tt),0<De.length&&(tt=new G0(tt,i,null,c,de),me.push({event:tt,listeners:De}),Ue?tt.data=Ue:(Ue=ex(c),Ue!==null&&(tt.data=Ue)))),(Ue=a3?c3(i,c):u3(i,c))&&(tt=sh(te,"onBeforeInput"),0<tt.length&&(De=new G0("onBeforeInput","beforeinput",null,c,de),me.push({event:De,listeners:tt}),De.data=Ue)),tO(me,i,te,c,de)}BS(me,o)})}function Rc(i,o,c){return{instance:i,listener:o,currentTarget:c}}function sh(i,o){for(var c=o+"Capture",f=[];i!==null;){var v=i,x=v.stateNode;if(v=v.tag,v!==5&&v!==26&&v!==27||x===null||(v=Ga(i,c),v!=null&&f.unshift(Rc(i,v,x)),v=Ga(i,o),v!=null&&f.push(Rc(i,v,x))),i.tag===3)return f;i=i.return}return[]}function sO(i){if(i===null)return null;do i=i.return;while(i&&i.tag!==5&&i.tag!==27);return i||null}function HS(i,o,c,f,v){for(var x=o._reactName,E=[];c!==null&&c!==f;){var O=c,G=O.alternate,te=O.stateNode;if(O=O.tag,G!==null&&G===f)break;O!==5&&O!==26&&O!==27||te===null||(G=te,v?(te=Ga(c,x),te!=null&&E.unshift(Rc(c,te,G))):v||(te=Ga(c,x),te!=null&&E.push(Rc(c,te,G)))),c=c.return}E.length!==0&&i.push({event:o,listeners:E})}var oO=/\r\n?/g,lO=/\u0000|\uFFFD/g;function FS(i){return(typeof i=="string"?i:""+i).replace(oO,`
49
+ `).replace(lO,"")}function US(i,o){return o=FS(o),FS(i)===o}function mt(i,o,c,f,v,x){switch(c){case"children":typeof f=="string"?o==="body"||o==="textarea"&&f===""||xl(i,f):(typeof f=="number"||typeof f=="bigint")&&o!=="body"&&xl(i,""+f);break;case"className":cd(i,"class",f);break;case"tabIndex":cd(i,"tabindex",f);break;case"dir":case"role":case"viewBox":case"width":case"height":cd(i,c,f);break;case"style":U0(i,f,x);break;case"data":if(o!=="object"){cd(i,"data",f);break}case"src":case"href":if(f===""&&(o!=="a"||c!=="href")){i.removeAttribute(c);break}if(f==null||typeof f=="function"||typeof f=="symbol"||typeof f=="boolean"){i.removeAttribute(c);break}f=dd(""+f),i.setAttribute(c,f);break;case"action":case"formAction":if(typeof f=="function"){i.setAttribute(c,"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 x=="function"&&(c==="formAction"?(o!=="input"&&mt(i,o,"name",v.name,v,null),mt(i,o,"formEncType",v.formEncType,v,null),mt(i,o,"formMethod",v.formMethod,v,null),mt(i,o,"formTarget",v.formTarget,v,null)):(mt(i,o,"encType",v.encType,v,null),mt(i,o,"method",v.method,v,null),mt(i,o,"target",v.target,v,null)));if(f==null||typeof f=="symbol"||typeof f=="boolean"){i.removeAttribute(c);break}f=dd(""+f),i.setAttribute(c,f);break;case"onClick":f!=null&&(i.onclick=Ii);break;case"onScroll":f!=null&&Ze("scroll",i);break;case"onScrollEnd":f!=null&&Ze("scrollend",i);break;case"dangerouslySetInnerHTML":if(f!=null){if(typeof f!="object"||!("__html"in f))throw Error(r(61));if(c=f.__html,c!=null){if(v.children!=null)throw Error(r(60));i.innerHTML=c}}break;case"multiple":i.multiple=f&&typeof f!="function"&&typeof f!="symbol";break;case"muted":i.muted=f&&typeof f!="function"&&typeof f!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(f==null||typeof f=="function"||typeof f=="boolean"||typeof f=="symbol"){i.removeAttribute("xlink:href");break}c=dd(""+f),i.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",c);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":f!=null&&typeof f!="function"&&typeof f!="symbol"?i.setAttribute(c,""+f):i.removeAttribute(c);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":f&&typeof f!="function"&&typeof f!="symbol"?i.setAttribute(c,""):i.removeAttribute(c);break;case"capture":case"download":f===!0?i.setAttribute(c,""):f!==!1&&f!=null&&typeof f!="function"&&typeof f!="symbol"?i.setAttribute(c,f):i.removeAttribute(c);break;case"cols":case"rows":case"size":case"span":f!=null&&typeof f!="function"&&typeof f!="symbol"&&!isNaN(f)&&1<=f?i.setAttribute(c,f):i.removeAttribute(c);break;case"rowSpan":case"start":f==null||typeof f=="function"||typeof f=="symbol"||isNaN(f)?i.removeAttribute(c):i.setAttribute(c,f);break;case"popover":Ze("beforetoggle",i),Ze("toggle",i),ad(i,"popover",f);break;case"xlinkActuate":Bi(i,"http://www.w3.org/1999/xlink","xlink:actuate",f);break;case"xlinkArcrole":Bi(i,"http://www.w3.org/1999/xlink","xlink:arcrole",f);break;case"xlinkRole":Bi(i,"http://www.w3.org/1999/xlink","xlink:role",f);break;case"xlinkShow":Bi(i,"http://www.w3.org/1999/xlink","xlink:show",f);break;case"xlinkTitle":Bi(i,"http://www.w3.org/1999/xlink","xlink:title",f);break;case"xlinkType":Bi(i,"http://www.w3.org/1999/xlink","xlink:type",f);break;case"xmlBase":Bi(i,"http://www.w3.org/XML/1998/namespace","xml:base",f);break;case"xmlLang":Bi(i,"http://www.w3.org/XML/1998/namespace","xml:lang",f);break;case"xmlSpace":Bi(i,"http://www.w3.org/XML/1998/namespace","xml:space",f);break;case"is":ad(i,"is",f);break;case"innerText":case"textContent":break;default:(!(2<c.length)||c[0]!=="o"&&c[0]!=="O"||c[1]!=="n"&&c[1]!=="N")&&(c=jD.get(c)||c,ad(i,c,f))}}function Og(i,o,c,f,v,x){switch(c){case"style":U0(i,f,x);break;case"dangerouslySetInnerHTML":if(f!=null){if(typeof f!="object"||!("__html"in f))throw Error(r(61));if(c=f.__html,c!=null){if(v.children!=null)throw Error(r(60));i.innerHTML=c}}break;case"children":typeof f=="string"?xl(i,f):(typeof f=="number"||typeof f=="bigint")&&xl(i,""+f);break;case"onScroll":f!=null&&Ze("scroll",i);break;case"onScrollEnd":f!=null&&Ze("scrollend",i);break;case"onClick":f!=null&&(i.onclick=Ii);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!O0.hasOwnProperty(c))e:{if(c[0]==="o"&&c[1]==="n"&&(v=c.endsWith("Capture"),o=c.slice(2,v?c.length-7:void 0),x=i[Zn]||null,x=x!=null?x[c]:null,typeof x=="function"&&i.removeEventListener(o,x,v),typeof f=="function")){typeof x!="function"&&x!==null&&(c in i?i[c]=null:i.hasAttribute(c)&&i.removeAttribute(c)),i.addEventListener(o,f,v);break e}c in i?i[c]=f:f===!0?i.setAttribute(c,""):ad(i,c,f)}}}function Rn(i,o,c){switch(o){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ze("error",i),Ze("load",i);var f=!1,v=!1,x;for(x in c)if(c.hasOwnProperty(x)){var E=c[x];if(E!=null)switch(x){case"src":f=!0;break;case"srcSet":v=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,o));default:mt(i,o,x,E,c,null)}}v&&mt(i,o,"srcSet",c.srcSet,c,null),f&&mt(i,o,"src",c.src,c,null);return;case"input":Ze("invalid",i);var O=x=E=v=null,G=null,te=null;for(f in c)if(c.hasOwnProperty(f)){var de=c[f];if(de!=null)switch(f){case"name":v=de;break;case"type":E=de;break;case"checked":G=de;break;case"defaultChecked":te=de;break;case"value":x=de;break;case"defaultValue":O=de;break;case"children":case"dangerouslySetInnerHTML":if(de!=null)throw Error(r(137,o));break;default:mt(i,o,f,de,c,null)}}B0(i,x,O,G,te,E,v,!1);return;case"select":Ze("invalid",i),f=E=x=null;for(v in c)if(c.hasOwnProperty(v)&&(O=c[v],O!=null))switch(v){case"value":x=O;break;case"defaultValue":E=O;break;case"multiple":f=O;default:mt(i,o,v,O,c,null)}o=x,c=E,i.multiple=!!f,o!=null?bl(i,!!f,o,!1):c!=null&&bl(i,!!f,c,!0);return;case"textarea":Ze("invalid",i),x=v=f=null;for(E in c)if(c.hasOwnProperty(E)&&(O=c[E],O!=null))switch(E){case"value":f=O;break;case"defaultValue":v=O;break;case"children":x=O;break;case"dangerouslySetInnerHTML":if(O!=null)throw Error(r(91));break;default:mt(i,o,E,O,c,null)}H0(i,f,v,x);return;case"option":for(G in c)if(c.hasOwnProperty(G)&&(f=c[G],f!=null))switch(G){case"selected":i.selected=f&&typeof f!="function"&&typeof f!="symbol";break;default:mt(i,o,G,f,c,null)}return;case"dialog":Ze("beforetoggle",i),Ze("toggle",i),Ze("cancel",i),Ze("close",i);break;case"iframe":case"object":Ze("load",i);break;case"video":case"audio":for(f=0;f<Ec.length;f++)Ze(Ec[f],i);break;case"image":Ze("error",i),Ze("load",i);break;case"details":Ze("toggle",i);break;case"embed":case"source":case"link":Ze("error",i),Ze("load",i);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(te in c)if(c.hasOwnProperty(te)&&(f=c[te],f!=null))switch(te){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,o));default:mt(i,o,te,f,c,null)}return;default:if(Kp(o)){for(de in c)c.hasOwnProperty(de)&&(f=c[de],f!==void 0&&Og(i,o,de,f,c,void 0));return}}for(O in c)c.hasOwnProperty(O)&&(f=c[O],f!=null&&mt(i,o,O,f,c,null))}function aO(i,o,c,f){switch(o){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var v=null,x=null,E=null,O=null,G=null,te=null,de=null;for(ie in c){var me=c[ie];if(c.hasOwnProperty(ie)&&me!=null)switch(ie){case"checked":break;case"value":break;case"defaultValue":G=me;default:f.hasOwnProperty(ie)||mt(i,o,ie,null,f,me)}}for(var ne in f){var ie=f[ne];if(me=c[ne],f.hasOwnProperty(ne)&&(ie!=null||me!=null))switch(ne){case"type":x=ie;break;case"name":v=ie;break;case"checked":te=ie;break;case"defaultChecked":de=ie;break;case"value":E=ie;break;case"defaultValue":O=ie;break;case"children":case"dangerouslySetInnerHTML":if(ie!=null)throw Error(r(137,o));break;default:ie!==me&&mt(i,o,ne,ie,f,me)}}Vp(i,E,O,G,te,de,x,v);return;case"select":ie=E=O=ne=null;for(x in c)if(G=c[x],c.hasOwnProperty(x)&&G!=null)switch(x){case"value":break;case"multiple":ie=G;default:f.hasOwnProperty(x)||mt(i,o,x,null,f,G)}for(v in f)if(x=f[v],G=c[v],f.hasOwnProperty(v)&&(x!=null||G!=null))switch(v){case"value":ne=x;break;case"defaultValue":O=x;break;case"multiple":E=x;default:x!==G&&mt(i,o,v,x,f,G)}o=O,c=E,f=ie,ne!=null?bl(i,!!c,ne,!1):!!f!=!!c&&(o!=null?bl(i,!!c,o,!0):bl(i,!!c,c?[]:"",!1));return;case"textarea":ie=ne=null;for(O in c)if(v=c[O],c.hasOwnProperty(O)&&v!=null&&!f.hasOwnProperty(O))switch(O){case"value":break;case"children":break;default:mt(i,o,O,null,f,v)}for(E in f)if(v=f[E],x=c[E],f.hasOwnProperty(E)&&(v!=null||x!=null))switch(E){case"value":ne=v;break;case"defaultValue":ie=v;break;case"children":break;case"dangerouslySetInnerHTML":if(v!=null)throw Error(r(91));break;default:v!==x&&mt(i,o,E,v,f,x)}I0(i,ne,ie);return;case"option":for(var Re in c)if(ne=c[Re],c.hasOwnProperty(Re)&&ne!=null&&!f.hasOwnProperty(Re))switch(Re){case"selected":i.selected=!1;break;default:mt(i,o,Re,null,f,ne)}for(G in f)if(ne=f[G],ie=c[G],f.hasOwnProperty(G)&&ne!==ie&&(ne!=null||ie!=null))switch(G){case"selected":i.selected=ne&&typeof ne!="function"&&typeof ne!="symbol";break;default:mt(i,o,G,ne,f,ie)}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 ze in c)ne=c[ze],c.hasOwnProperty(ze)&&ne!=null&&!f.hasOwnProperty(ze)&&mt(i,o,ze,null,f,ne);for(te in f)if(ne=f[te],ie=c[te],f.hasOwnProperty(te)&&ne!==ie&&(ne!=null||ie!=null))switch(te){case"children":case"dangerouslySetInnerHTML":if(ne!=null)throw Error(r(137,o));break;default:mt(i,o,te,ne,f,ie)}return;default:if(Kp(o)){for(var gt in c)ne=c[gt],c.hasOwnProperty(gt)&&ne!==void 0&&!f.hasOwnProperty(gt)&&Og(i,o,gt,void 0,f,ne);for(de in f)ne=f[de],ie=c[de],!f.hasOwnProperty(de)||ne===ie||ne===void 0&&ie===void 0||Og(i,o,de,ne,f,ie);return}}for(var Q in c)ne=c[Q],c.hasOwnProperty(Q)&&ne!=null&&!f.hasOwnProperty(Q)&&mt(i,o,Q,null,f,ne);for(me in f)ne=f[me],ie=c[me],!f.hasOwnProperty(me)||ne===ie||ne==null&&ie==null||mt(i,o,me,ne,f,ie)}function $S(i){switch(i){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function cO(){if(typeof performance.getEntriesByType=="function"){for(var i=0,o=0,c=performance.getEntriesByType("resource"),f=0;f<c.length;f++){var v=c[f],x=v.transferSize,E=v.initiatorType,O=v.duration;if(x&&O&&$S(E)){for(E=0,O=v.responseEnd,f+=1;f<c.length;f++){var G=c[f],te=G.startTime;if(te>O)break;var de=G.transferSize,me=G.initiatorType;de&&$S(me)&&(G=G.responseEnd,E+=de*(G<O?1:(O-te)/(G-te)))}if(--f,o+=8*(x+E)/(v.duration/1e3),i++,10<i)break}}if(0<i)return o/i/1e6}return navigator.connection&&(i=navigator.connection.downlink,typeof i=="number")?i:5}var Lg=null,jg=null;function oh(i){return i.nodeType===9?i:i.ownerDocument}function WS(i){switch(i){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function VS(i,o){if(i===0)switch(o){case"svg":return 1;case"math":return 2;default:return 0}return i===1&&o==="foreignObject"?0:i}function zg(i,o){return i==="textarea"||i==="noscript"||typeof o.children=="string"||typeof o.children=="number"||typeof o.children=="bigint"||typeof o.dangerouslySetInnerHTML=="object"&&o.dangerouslySetInnerHTML!==null&&o.dangerouslySetInnerHTML.__html!=null}var Pg=null;function uO(){var i=window.event;return i&&i.type==="popstate"?i===Pg?!1:(Pg=i,!0):(Pg=null,!1)}var qS=typeof setTimeout=="function"?setTimeout:void 0,dO=typeof clearTimeout=="function"?clearTimeout:void 0,KS=typeof Promise=="function"?Promise:void 0,hO=typeof queueMicrotask=="function"?queueMicrotask:typeof KS<"u"?function(i){return KS.resolve(null).then(i).catch(fO)}:qS;function fO(i){setTimeout(function(){throw i})}function Bs(i){return i==="head"}function GS(i,o){var c=o,f=0;do{var v=c.nextSibling;if(i.removeChild(c),v&&v.nodeType===8)if(c=v.data,c==="/$"||c==="/&"){if(f===0){i.removeChild(v),Ql(o);return}f--}else if(c==="$"||c==="$?"||c==="$~"||c==="$!"||c==="&")f++;else if(c==="html")Tc(i.ownerDocument.documentElement);else if(c==="head"){c=i.ownerDocument.head,Tc(c);for(var x=c.firstChild;x;){var E=x.nextSibling,O=x.nodeName;x[qa]||O==="SCRIPT"||O==="STYLE"||O==="LINK"&&x.rel.toLowerCase()==="stylesheet"||c.removeChild(x),x=E}}else c==="body"&&Tc(i.ownerDocument.body);c=v}while(c);Ql(o)}function YS(i,o){var c=i;i=0;do{var f=c.nextSibling;if(c.nodeType===1?o?(c._stashedDisplay=c.style.display,c.style.display="none"):(c.style.display=c._stashedDisplay||"",c.getAttribute("style")===""&&c.removeAttribute("style")):c.nodeType===3&&(o?(c._stashedText=c.nodeValue,c.nodeValue=""):c.nodeValue=c._stashedText||""),f&&f.nodeType===8)if(c=f.data,c==="/$"){if(i===0)break;i--}else c!=="$"&&c!=="$?"&&c!=="$~"&&c!=="$!"||i++;c=f}while(c)}function Bg(i){var o=i.firstChild;for(o&&o.nodeType===10&&(o=o.nextSibling);o;){var c=o;switch(o=o.nextSibling,c.nodeName){case"HTML":case"HEAD":case"BODY":Bg(c),$p(c);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(c.rel.toLowerCase()==="stylesheet")continue}i.removeChild(c)}}function pO(i,o,c,f){for(;i.nodeType===1;){var v=c;if(i.nodeName.toLowerCase()!==o.toLowerCase()){if(!f&&(i.nodeName!=="INPUT"||i.type!=="hidden"))break}else if(f){if(!i[qa])switch(o){case"meta":if(!i.hasAttribute("itemprop"))break;return i;case"link":if(x=i.getAttribute("rel"),x==="stylesheet"&&i.hasAttribute("data-precedence"))break;if(x!==v.rel||i.getAttribute("href")!==(v.href==null||v.href===""?null:v.href)||i.getAttribute("crossorigin")!==(v.crossOrigin==null?null:v.crossOrigin)||i.getAttribute("title")!==(v.title==null?null:v.title))break;return i;case"style":if(i.hasAttribute("data-precedence"))break;return i;case"script":if(x=i.getAttribute("src"),(x!==(v.src==null?null:v.src)||i.getAttribute("type")!==(v.type==null?null:v.type)||i.getAttribute("crossorigin")!==(v.crossOrigin==null?null:v.crossOrigin))&&x&&i.hasAttribute("async")&&!i.hasAttribute("itemprop"))break;return i;default:return i}}else if(o==="input"&&i.type==="hidden"){var x=v.name==null?null:""+v.name;if(v.type==="hidden"&&i.getAttribute("name")===x)return i}else return i;if(i=Br(i.nextSibling),i===null)break}return null}function mO(i,o,c){if(o==="")return null;for(;i.nodeType!==3;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!c||(i=Br(i.nextSibling),i===null))return null;return i}function XS(i,o){for(;i.nodeType!==8;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!o||(i=Br(i.nextSibling),i===null))return null;return i}function Ig(i){return i.data==="$?"||i.data==="$~"}function Hg(i){return i.data==="$!"||i.data==="$?"&&i.ownerDocument.readyState!=="loading"}function gO(i,o){var c=i.ownerDocument;if(i.data==="$~")i._reactRetry=o;else if(i.data!=="$?"||c.readyState!=="loading")o();else{var f=function(){o(),c.removeEventListener("DOMContentLoaded",f)};c.addEventListener("DOMContentLoaded",f),i._reactRetry=f}}function Br(i){for(;i!=null;i=i.nextSibling){var o=i.nodeType;if(o===1||o===3)break;if(o===8){if(o=i.data,o==="$"||o==="$!"||o==="$?"||o==="$~"||o==="&"||o==="F!"||o==="F")break;if(o==="/$"||o==="/&")return null}}return i}var Fg=null;function ZS(i){i=i.nextSibling;for(var o=0;i;){if(i.nodeType===8){var c=i.data;if(c==="/$"||c==="/&"){if(o===0)return Br(i.nextSibling);o--}else c!=="$"&&c!=="$!"&&c!=="$?"&&c!=="$~"&&c!=="&"||o++}i=i.nextSibling}return null}function QS(i){i=i.previousSibling;for(var o=0;i;){if(i.nodeType===8){var c=i.data;if(c==="$"||c==="$!"||c==="$?"||c==="$~"||c==="&"){if(o===0)return i;o--}else c!=="/$"&&c!=="/&"||o++}i=i.previousSibling}return null}function JS(i,o,c){switch(o=oh(c),i){case"html":if(i=o.documentElement,!i)throw Error(r(452));return i;case"head":if(i=o.head,!i)throw Error(r(453));return i;case"body":if(i=o.body,!i)throw Error(r(454));return i;default:throw Error(r(451))}}function Tc(i){for(var o=i.attributes;o.length;)i.removeAttributeNode(o[0]);$p(i)}var Ir=new Map,ew=new Set;function lh(i){return typeof i.getRootNode=="function"?i.getRootNode():i.nodeType===9?i:i.ownerDocument}var ts=V.d;V.d={f:vO,r:_O,D:yO,C:bO,L:xO,m:SO,X:CO,S:wO,M:kO};function vO(){var i=ts.f(),o=Qd();return i||o}function _O(i){var o=vl(i);o!==null&&o.tag===5&&o.type==="form"?v1(o):ts.r(i)}var Yl=typeof document>"u"?null:document;function tw(i,o,c){var f=Yl;if(f&&typeof o=="string"&&o){var v=Ar(o);v='link[rel="'+i+'"][href="'+v+'"]',typeof c=="string"&&(v+='[crossorigin="'+c+'"]'),ew.has(v)||(ew.add(v),i={rel:i,crossOrigin:c,href:o},f.querySelector(v)===null&&(o=f.createElement("link"),Rn(o,"link",i),dn(o),f.head.appendChild(o)))}}function yO(i){ts.D(i),tw("dns-prefetch",i,null)}function bO(i,o){ts.C(i,o),tw("preconnect",i,o)}function xO(i,o,c){ts.L(i,o,c);var f=Yl;if(f&&i&&o){var v='link[rel="preload"][as="'+Ar(o)+'"]';o==="image"&&c&&c.imageSrcSet?(v+='[imagesrcset="'+Ar(c.imageSrcSet)+'"]',typeof c.imageSizes=="string"&&(v+='[imagesizes="'+Ar(c.imageSizes)+'"]')):v+='[href="'+Ar(i)+'"]';var x=v;switch(o){case"style":x=Xl(i);break;case"script":x=Zl(i)}Ir.has(x)||(i=m({rel:"preload",href:o==="image"&&c&&c.imageSrcSet?void 0:i,as:o},c),Ir.set(x,i),f.querySelector(v)!==null||o==="style"&&f.querySelector(Mc(x))||o==="script"&&f.querySelector(Nc(x))||(o=f.createElement("link"),Rn(o,"link",i),dn(o),f.head.appendChild(o)))}}function SO(i,o){ts.m(i,o);var c=Yl;if(c&&i){var f=o&&typeof o.as=="string"?o.as:"script",v='link[rel="modulepreload"][as="'+Ar(f)+'"][href="'+Ar(i)+'"]',x=v;switch(f){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":x=Zl(i)}if(!Ir.has(x)&&(i=m({rel:"modulepreload",href:i},o),Ir.set(x,i),c.querySelector(v)===null)){switch(f){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(c.querySelector(Nc(x)))return}f=c.createElement("link"),Rn(f,"link",i),dn(f),c.head.appendChild(f)}}}function wO(i,o,c){ts.S(i,o,c);var f=Yl;if(f&&i){var v=_l(f).hoistableStyles,x=Xl(i);o=o||"default";var E=v.get(x);if(!E){var O={loading:0,preload:null};if(E=f.querySelector(Mc(x)))O.loading=5;else{i=m({rel:"stylesheet",href:i,"data-precedence":o},c),(c=Ir.get(x))&&Ug(i,c);var G=E=f.createElement("link");dn(G),Rn(G,"link",i),G._p=new Promise(function(te,de){G.onload=te,G.onerror=de}),G.addEventListener("load",function(){O.loading|=1}),G.addEventListener("error",function(){O.loading|=2}),O.loading|=4,ah(E,o,f)}E={type:"stylesheet",instance:E,count:1,state:O},v.set(x,E)}}}function CO(i,o){ts.X(i,o);var c=Yl;if(c&&i){var f=_l(c).hoistableScripts,v=Zl(i),x=f.get(v);x||(x=c.querySelector(Nc(v)),x||(i=m({src:i,async:!0},o),(o=Ir.get(v))&&$g(i,o),x=c.createElement("script"),dn(x),Rn(x,"link",i),c.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},f.set(v,x))}}function kO(i,o){ts.M(i,o);var c=Yl;if(c&&i){var f=_l(c).hoistableScripts,v=Zl(i),x=f.get(v);x||(x=c.querySelector(Nc(v)),x||(i=m({src:i,async:!0,type:"module"},o),(o=Ir.get(v))&&$g(i,o),x=c.createElement("script"),dn(x),Rn(x,"link",i),c.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},f.set(v,x))}}function nw(i,o,c,f){var v=(v=se.current)?lh(v):null;if(!v)throw Error(r(446));switch(i){case"meta":case"title":return null;case"style":return typeof c.precedence=="string"&&typeof c.href=="string"?(o=Xl(c.href),c=_l(v).hoistableStyles,f=c.get(o),f||(f={type:"style",instance:null,count:0,state:null},c.set(o,f)),f):{type:"void",instance:null,count:0,state:null};case"link":if(c.rel==="stylesheet"&&typeof c.href=="string"&&typeof c.precedence=="string"){i=Xl(c.href);var x=_l(v).hoistableStyles,E=x.get(i);if(E||(v=v.ownerDocument||v,E={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},x.set(i,E),(x=v.querySelector(Mc(i)))&&!x._p&&(E.instance=x,E.state.loading=5),Ir.has(i)||(c={rel:"preload",as:"style",href:c.href,crossOrigin:c.crossOrigin,integrity:c.integrity,media:c.media,hrefLang:c.hrefLang,referrerPolicy:c.referrerPolicy},Ir.set(i,c),x||EO(v,i,c,E.state))),o&&f===null)throw Error(r(528,""));return E}if(o&&f!==null)throw Error(r(529,""));return null;case"script":return o=c.async,c=c.src,typeof c=="string"&&o&&typeof o!="function"&&typeof o!="symbol"?(o=Zl(c),c=_l(v).hoistableScripts,f=c.get(o),f||(f={type:"script",instance:null,count:0,state:null},c.set(o,f)),f):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,i))}}function Xl(i){return'href="'+Ar(i)+'"'}function Mc(i){return'link[rel="stylesheet"]['+i+"]"}function rw(i){return m({},i,{"data-precedence":i.precedence,precedence:null})}function EO(i,o,c,f){i.querySelector('link[rel="preload"][as="style"]['+o+"]")?f.loading=1:(o=i.createElement("link"),f.preload=o,o.addEventListener("load",function(){return f.loading|=1}),o.addEventListener("error",function(){return f.loading|=2}),Rn(o,"link",c),dn(o),i.head.appendChild(o))}function Zl(i){return'[src="'+Ar(i)+'"]'}function Nc(i){return"script[async]"+i}function iw(i,o,c){if(o.count++,o.instance===null)switch(o.type){case"style":var f=i.querySelector('style[data-href~="'+Ar(c.href)+'"]');if(f)return o.instance=f,dn(f),f;var v=m({},c,{"data-href":c.href,"data-precedence":c.precedence,href:null,precedence:null});return f=(i.ownerDocument||i).createElement("style"),dn(f),Rn(f,"style",v),ah(f,c.precedence,i),o.instance=f;case"stylesheet":v=Xl(c.href);var x=i.querySelector(Mc(v));if(x)return o.state.loading|=4,o.instance=x,dn(x),x;f=rw(c),(v=Ir.get(v))&&Ug(f,v),x=(i.ownerDocument||i).createElement("link"),dn(x);var E=x;return E._p=new Promise(function(O,G){E.onload=O,E.onerror=G}),Rn(x,"link",f),o.state.loading|=4,ah(x,c.precedence,i),o.instance=x;case"script":return x=Zl(c.src),(v=i.querySelector(Nc(x)))?(o.instance=v,dn(v),v):(f=c,(v=Ir.get(x))&&(f=m({},c),$g(f,v)),i=i.ownerDocument||i,v=i.createElement("script"),dn(v),Rn(v,"link",f),i.head.appendChild(v),o.instance=v);case"void":return null;default:throw Error(r(443,o.type))}else o.type==="stylesheet"&&(o.state.loading&4)===0&&(f=o.instance,o.state.loading|=4,ah(f,c.precedence,i));return o.instance}function ah(i,o,c){for(var f=c.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),v=f.length?f[f.length-1]:null,x=v,E=0;E<f.length;E++){var O=f[E];if(O.dataset.precedence===o)x=O;else if(x!==v)break}x?x.parentNode.insertBefore(i,x.nextSibling):(o=c.nodeType===9?c.head:c,o.insertBefore(i,o.firstChild))}function Ug(i,o){i.crossOrigin==null&&(i.crossOrigin=o.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=o.referrerPolicy),i.title==null&&(i.title=o.title)}function $g(i,o){i.crossOrigin==null&&(i.crossOrigin=o.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=o.referrerPolicy),i.integrity==null&&(i.integrity=o.integrity)}var ch=null;function sw(i,o,c){if(ch===null){var f=new Map,v=ch=new Map;v.set(c,f)}else v=ch,f=v.get(c),f||(f=new Map,v.set(c,f));if(f.has(i))return f;for(f.set(i,null),c=c.getElementsByTagName(i),v=0;v<c.length;v++){var x=c[v];if(!(x[qa]||x[wn]||i==="link"&&x.getAttribute("rel")==="stylesheet")&&x.namespaceURI!=="http://www.w3.org/2000/svg"){var E=x.getAttribute(o)||"";E=i+E;var O=f.get(E);O?O.push(x):f.set(E,[x])}}return f}function ow(i,o,c){i=i.ownerDocument||i,i.head.insertBefore(c,o==="title"?i.querySelector("head > title"):null)}function RO(i,o,c){if(c===1||o.itemProp!=null)return!1;switch(i){case"meta":case"title":return!0;case"style":if(typeof o.precedence!="string"||typeof o.href!="string"||o.href==="")break;return!0;case"link":if(typeof o.rel!="string"||typeof o.href!="string"||o.href===""||o.onLoad||o.onError)break;switch(o.rel){case"stylesheet":return i=o.disabled,typeof o.precedence=="string"&&i==null;default:return!0}case"script":if(o.async&&typeof o.async!="function"&&typeof o.async!="symbol"&&!o.onLoad&&!o.onError&&o.src&&typeof o.src=="string")return!0}return!1}function lw(i){return!(i.type==="stylesheet"&&(i.state.loading&3)===0)}function TO(i,o,c,f){if(c.type==="stylesheet"&&(typeof f.media!="string"||matchMedia(f.media).matches!==!1)&&(c.state.loading&4)===0){if(c.instance===null){var v=Xl(f.href),x=o.querySelector(Mc(v));if(x){o=x._p,o!==null&&typeof o=="object"&&typeof o.then=="function"&&(i.count++,i=uh.bind(i),o.then(i,i)),c.state.loading|=4,c.instance=x,dn(x);return}x=o.ownerDocument||o,f=rw(f),(v=Ir.get(v))&&Ug(f,v),x=x.createElement("link"),dn(x);var E=x;E._p=new Promise(function(O,G){E.onload=O,E.onerror=G}),Rn(x,"link",f),c.instance=x}i.stylesheets===null&&(i.stylesheets=new Map),i.stylesheets.set(c,o),(o=c.state.preload)&&(c.state.loading&3)===0&&(i.count++,c=uh.bind(i),o.addEventListener("load",c),o.addEventListener("error",c))}}var Wg=0;function MO(i,o){return i.stylesheets&&i.count===0&&hh(i,i.stylesheets),0<i.count||0<i.imgCount?function(c){var f=setTimeout(function(){if(i.stylesheets&&hh(i,i.stylesheets),i.unsuspend){var x=i.unsuspend;i.unsuspend=null,x()}},6e4+o);0<i.imgBytes&&Wg===0&&(Wg=62500*cO());var v=setTimeout(function(){if(i.waitingForImages=!1,i.count===0&&(i.stylesheets&&hh(i,i.stylesheets),i.unsuspend)){var x=i.unsuspend;i.unsuspend=null,x()}},(i.imgBytes>Wg?50:800)+o);return i.unsuspend=c,function(){i.unsuspend=null,clearTimeout(f),clearTimeout(v)}}:null}function uh(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)hh(this,this.stylesheets);else if(this.unsuspend){var i=this.unsuspend;this.unsuspend=null,i()}}}var dh=null;function hh(i,o){i.stylesheets=null,i.unsuspend!==null&&(i.count++,dh=new Map,o.forEach(NO,i),dh=null,uh.call(i))}function NO(i,o){if(!(o.state.loading&4)){var c=dh.get(i);if(c)var f=c.get(null);else{c=new Map,dh.set(i,c);for(var v=i.querySelectorAll("link[data-precedence],style[data-precedence]"),x=0;x<v.length;x++){var E=v[x];(E.nodeName==="LINK"||E.getAttribute("media")!=="not all")&&(c.set(E.dataset.precedence,E),f=E)}f&&c.set(null,f)}v=o.instance,E=v.getAttribute("data-precedence"),x=c.get(E)||f,x===f&&c.set(null,v),c.set(E,v),this.count++,f=uh.bind(this),v.addEventListener("load",f),v.addEventListener("error",f),x?x.parentNode.insertBefore(v,x.nextSibling):(i=i.nodeType===9?i.head:i,i.insertBefore(v,i.firstChild)),o.state.loading|=4}}var Ac={$$typeof:R,Provider:null,Consumer:null,_currentValue:W,_currentValue2:W,_threadCount:0};function AO(i,o,c,f,v,x,E,O,G){this.tag=1,this.containerInfo=i,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=Xn(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Xn(0),this.hiddenUpdates=Xn(null),this.identifierPrefix=f,this.onUncaughtError=v,this.onCaughtError=x,this.onRecoverableError=E,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=G,this.incompleteTransitions=new Map}function aw(i,o,c,f,v,x,E,O,G,te,de,me){return i=new AO(i,o,c,E,G,te,de,me,O),o=1,x===!0&&(o|=24),x=fr(3,null,null,o),i.current=x,x.stateNode=i,o=wm(),o.refCount++,i.pooledCache=o,o.refCount++,x.memoizedState={element:f,isDehydrated:c,cache:o},Rm(x),i}function cw(i){return i?(i=Tl,i):Tl}function uw(i,o,c,f,v,x){v=cw(v),f.context===null?f.context=v:f.pendingContext=v,f=Rs(o),f.payload={element:c},x=x===void 0?null:x,x!==null&&(f.callback=x),c=Ts(i,f,o),c!==null&&(rr(c,i,o),cc(c,i,o))}function dw(i,o){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var c=i.retryLane;i.retryLane=c!==0&&c<o?c:o}}function Vg(i,o){dw(i,o),(i=i.alternate)&&dw(i,o)}function hw(i){if(i.tag===13||i.tag===31){var o=xo(i,67108864);o!==null&&rr(o,i,67108864),Vg(i,67108864)}}function fw(i){if(i.tag===13||i.tag===31){var o=_r();o=zi(o);var c=xo(i,o);c!==null&&rr(c,i,o),Vg(i,o)}}var fh=!0;function DO(i,o,c,f){var v=P.T;P.T=null;var x=V.p;try{V.p=2,qg(i,o,c,f)}finally{V.p=x,P.T=v}}function OO(i,o,c,f){var v=P.T;P.T=null;var x=V.p;try{V.p=8,qg(i,o,c,f)}finally{V.p=x,P.T=v}}function qg(i,o,c,f){if(fh){var v=Kg(f);if(v===null)Dg(i,o,f,ph,c),mw(i,f);else if(jO(v,i,o,c,f))f.stopPropagation();else if(mw(i,f),o&4&&-1<LO.indexOf(i)){for(;v!==null;){var x=vl(v);if(x!==null)switch(x.tag){case 3:if(x=x.stateNode,x.current.memoizedState.isDehydrated){var E=Pe(x.pendingLanes);if(E!==0){var O=x;for(O.pendingLanes|=2,O.entangledLanes|=2;E;){var G=1<<31-st(E);O.entanglements[1]|=G,E&=~G}gi(x),(ct&6)===0&&(Xd=Ge()+500,kc(0))}}break;case 31:case 13:O=xo(x,2),O!==null&&rr(O,x,2),Qd(),Vg(x,2)}if(x=Kg(f),x===null&&Dg(i,o,f,ph,c),x===v)break;v=x}v!==null&&f.stopPropagation()}else Dg(i,o,f,null,c)}}function Kg(i){return i=Yp(i),Gg(i)}var ph=null;function Gg(i){if(ph=null,i=gl(i),i!==null){var o=l(i);if(o===null)i=null;else{var c=o.tag;if(c===13){if(i=a(o),i!==null)return i;i=null}else if(c===31){if(i=u(o),i!==null)return i;i=null}else if(c===3){if(o.stateNode.current.memoizedState.isDehydrated)return o.tag===3?o.stateNode.containerInfo:null;i=null}else o!==i&&(i=null)}}return ph=i,null}function pw(i){switch(i){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(ur()){case ue:return 2;case ye:return 8;case Ae:case Be:return 32;case Ye:return 268435456;default:return 32}default:return 32}}var Yg=!1,Is=null,Hs=null,Fs=null,Dc=new Map,Oc=new Map,Us=[],LO="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 mw(i,o){switch(i){case"focusin":case"focusout":Is=null;break;case"dragenter":case"dragleave":Hs=null;break;case"mouseover":case"mouseout":Fs=null;break;case"pointerover":case"pointerout":Dc.delete(o.pointerId);break;case"gotpointercapture":case"lostpointercapture":Oc.delete(o.pointerId)}}function Lc(i,o,c,f,v,x){return i===null||i.nativeEvent!==x?(i={blockedOn:o,domEventName:c,eventSystemFlags:f,nativeEvent:x,targetContainers:[v]},o!==null&&(o=vl(o),o!==null&&hw(o)),i):(i.eventSystemFlags|=f,o=i.targetContainers,v!==null&&o.indexOf(v)===-1&&o.push(v),i)}function jO(i,o,c,f,v){switch(o){case"focusin":return Is=Lc(Is,i,o,c,f,v),!0;case"dragenter":return Hs=Lc(Hs,i,o,c,f,v),!0;case"mouseover":return Fs=Lc(Fs,i,o,c,f,v),!0;case"pointerover":var x=v.pointerId;return Dc.set(x,Lc(Dc.get(x)||null,i,o,c,f,v)),!0;case"gotpointercapture":return x=v.pointerId,Oc.set(x,Lc(Oc.get(x)||null,i,o,c,f,v)),!0}return!1}function gw(i){var o=gl(i.target);if(o!==null){var c=l(o);if(c!==null){if(o=c.tag,o===13){if(o=a(c),o!==null){i.blockedOn=o,bs(i.priority,function(){fw(c)});return}}else if(o===31){if(o=u(c),o!==null){i.blockedOn=o,bs(i.priority,function(){fw(c)});return}}else if(o===3&&c.stateNode.current.memoizedState.isDehydrated){i.blockedOn=c.tag===3?c.stateNode.containerInfo:null;return}}}i.blockedOn=null}function mh(i){if(i.blockedOn!==null)return!1;for(var o=i.targetContainers;0<o.length;){var c=Kg(i.nativeEvent);if(c===null){c=i.nativeEvent;var f=new c.constructor(c.type,c);Gp=f,c.target.dispatchEvent(f),Gp=null}else return o=vl(c),o!==null&&hw(o),i.blockedOn=c,!1;o.shift()}return!0}function vw(i,o,c){mh(i)&&c.delete(o)}function zO(){Yg=!1,Is!==null&&mh(Is)&&(Is=null),Hs!==null&&mh(Hs)&&(Hs=null),Fs!==null&&mh(Fs)&&(Fs=null),Dc.forEach(vw),Oc.forEach(vw)}function gh(i,o){i.blockedOn===o&&(i.blockedOn=null,Yg||(Yg=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,zO)))}var vh=null;function _w(i){vh!==i&&(vh=i,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){vh===i&&(vh=null);for(var o=0;o<i.length;o+=3){var c=i[o],f=i[o+1],v=i[o+2];if(typeof f!="function"){if(Gg(f||c)===null)continue;break}var x=vl(c);x!==null&&(i.splice(o,3),o-=3,Km(x,{pending:!0,data:v,method:c.method,action:f},f,v))}}))}function Ql(i){function o(G){return gh(G,i)}Is!==null&&gh(Is,i),Hs!==null&&gh(Hs,i),Fs!==null&&gh(Fs,i),Dc.forEach(o),Oc.forEach(o);for(var c=0;c<Us.length;c++){var f=Us[c];f.blockedOn===i&&(f.blockedOn=null)}for(;0<Us.length&&(c=Us[0],c.blockedOn===null);)gw(c),c.blockedOn===null&&Us.shift();if(c=(i.ownerDocument||i).$$reactFormReplay,c!=null)for(f=0;f<c.length;f+=3){var v=c[f],x=c[f+1],E=v[Zn]||null;if(typeof x=="function")E||_w(c);else if(E){var O=null;if(x&&x.hasAttribute("formAction")){if(v=x,E=x[Zn]||null)O=E.formAction;else if(Gg(v)!==null)continue}else O=E.action;typeof O=="function"?c[f+1]=O:(c.splice(f,3),f-=3),_w(c)}}}function yw(){function i(x){x.canIntercept&&x.info==="react-transition"&&x.intercept({handler:function(){return new Promise(function(E){return v=E})},focusReset:"manual",scroll:"manual"})}function o(){v!==null&&(v(),v=null),f||setTimeout(c,20)}function c(){if(!f&&!navigation.transition){var x=navigation.currentEntry;x&&x.url!=null&&navigation.navigate(x.url,{state:x.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var f=!1,v=null;return navigation.addEventListener("navigate",i),navigation.addEventListener("navigatesuccess",o),navigation.addEventListener("navigateerror",o),setTimeout(c,100),function(){f=!0,navigation.removeEventListener("navigate",i),navigation.removeEventListener("navigatesuccess",o),navigation.removeEventListener("navigateerror",o),v!==null&&(v(),v=null)}}}function Xg(i){this._internalRoot=i}_h.prototype.render=Xg.prototype.render=function(i){var o=this._internalRoot;if(o===null)throw Error(r(409));var c=o.current,f=_r();uw(c,f,i,o,null,null)},_h.prototype.unmount=Xg.prototype.unmount=function(){var i=this._internalRoot;if(i!==null){this._internalRoot=null;var o=i.containerInfo;uw(i.current,2,null,i,null,null),Qd(),o[ml]=null}};function _h(i){this._internalRoot=i}_h.prototype.unstable_scheduleHydration=function(i){if(i){var o=Zr();i={blockedOn:null,target:i,priority:o};for(var c=0;c<Us.length&&o!==0&&o<Us[c].priority;c++);Us.splice(c,0,i),c===0&&gw(i)}};var bw=t.version;if(bw!=="19.2.1")throw Error(r(527,bw,"19.2.1"));V.findDOMNode=function(i){var o=i._reactInternals;if(o===void 0)throw typeof i.render=="function"?Error(r(188)):(i=Object.keys(i).join(","),Error(r(268,i)));return i=d(o),i=i!==null?p(i):null,i=i===null?null:i.stateNode,i};var PO={bundleType:0,version:"19.2.1",rendererPackageName:"react-dom",currentDispatcherRef:P,reconcilerVersion:"19.2.1"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var yh=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!yh.isDisabled&&yh.supportsFiber)try{en=yh.inject(PO),kt=yh}catch{}}return Pc.createRoot=function(i,o){if(!s(i))throw Error(r(299));var c=!1,f="",v=R1,x=T1,E=M1;return o!=null&&(o.unstable_strictMode===!0&&(c=!0),o.identifierPrefix!==void 0&&(f=o.identifierPrefix),o.onUncaughtError!==void 0&&(v=o.onUncaughtError),o.onCaughtError!==void 0&&(x=o.onCaughtError),o.onRecoverableError!==void 0&&(E=o.onRecoverableError)),o=aw(i,1,!1,null,null,c,f,null,v,x,E,yw),i[ml]=o.current,Ag(i),new Xg(o)},Pc.hydrateRoot=function(i,o,c){if(!s(i))throw Error(r(299));var f=!1,v="",x=R1,E=T1,O=M1,G=null;return c!=null&&(c.unstable_strictMode===!0&&(f=!0),c.identifierPrefix!==void 0&&(v=c.identifierPrefix),c.onUncaughtError!==void 0&&(x=c.onUncaughtError),c.onCaughtError!==void 0&&(E=c.onCaughtError),c.onRecoverableError!==void 0&&(O=c.onRecoverableError),c.formState!==void 0&&(G=c.formState)),o=aw(i,1,!0,o,c??null,f,v,G,x,E,O,yw),o.context=cw(null),c=o.current,f=_r(),f=zi(f),v=Rs(f),v.callback=null,Ts(c,v,f),c=f,o.current.lanes=c,Rr(o,c),gi(o),i[ml]=o.current,Ag(i),new _h(o)},Pc.version="19.2.1",Pc}var Lw;function YO(){if(Lw)return Jg.exports;Lw=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Jg.exports=GO(),Jg.exports}var XO=YO();/**
50
+ * react-router v7.13.1
51
+ *
52
+ * Copyright (c) Remix Software Inc.
53
+ *
54
+ * This source code is licensed under the MIT license found in the
55
+ * LICENSE.md file in the root directory of this source tree.
56
+ *
57
+ * @license MIT
58
+ */var jw="popstate";function zw(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function ZO(e={}){function t(r,s){var d;let l=(d=s.state)==null?void 0:d.masked,{pathname:a,search:u,hash:h}=l||r.location;return c_("",{pathname:a,search:u,hash:h},s.state&&s.state.usr||null,s.state&&s.state.key||"default",l?{pathname:r.location.pathname,search:r.location.search,hash:r.location.hash}:void 0)}function n(r,s){return typeof s=="string"?s:Su(s)}return JO(t,n,null,e)}function At(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function oi(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function QO(){return Math.random().toString(36).substring(2,10)}function Pw(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.unstable_mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function c_(e,t,n=null,r,s){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Ra(t):t,state:n,key:t&&t.key||r||QO(),unstable_mask:s}}function Su({pathname:e="/",search:t="",hash:n=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function Ra(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function JO(e,t,n,r={}){let{window:s=document.defaultView,v5Compat:l=!1}=r,a=s.history,u="POP",h=null,d=p();d==null&&(d=0,a.replaceState({...a.state,idx:d},""));function p(){return(a.state||{idx:null}).idx}function m(){u="POP";let C=p(),k=C==null?null:C-d;d=C,h&&h({action:u,location:S.location,delta:k})}function _(C,k){u="PUSH";let T=zw(C)?C:c_(S.location,C,k);d=p()+1;let R=Pw(T,d),N=S.createHref(T.unstable_mask||T);try{a.pushState(R,"",N)}catch(j){if(j instanceof DOMException&&j.name==="DataCloneError")throw j;s.location.assign(N)}l&&h&&h({action:u,location:S.location,delta:1})}function y(C,k){u="REPLACE";let T=zw(C)?C:c_(S.location,C,k);d=p();let R=Pw(T,d),N=S.createHref(T.unstable_mask||T);a.replaceState(R,"",N),l&&h&&h({action:u,location:S.location,delta:0})}function w(C){return e4(C)}let S={get action(){return u},get location(){return e(s,a)},listen(C){if(h)throw new Error("A history only accepts one active listener");return s.addEventListener(jw,m),h=C,()=>{s.removeEventListener(jw,m),h=null}},createHref(C){return t(s,C)},createURL:w,encodeLocation(C){let k=w(C);return{pathname:k.pathname,search:k.search,hash:k.hash}},push:_,replace:y,go(C){return a.go(C)}};return S}function e4(e,t=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),At(n,"No window.location.(origin|href) available to create URL");let r=typeof e=="string"?e:Su(e);return r=r.replace(/ $/,"%20"),!t&&r.startsWith("//")&&(r=n+r),new URL(r,n)}function TE(e,t,n="/"){return t4(e,t,n,!1)}function t4(e,t,n,r){let s=typeof t=="string"?Ra(t):t,l=us(s.pathname||"/",n);if(l==null)return null;let a=ME(e);n4(a);let u=null;for(let h=0;u==null&&h<a.length;++h){let d=f4(l);u=d4(a[h],d,r)}return u}function ME(e,t=[],n=[],r="",s=!1){let l=(a,u,h=s,d)=>{let p={relativePath:d===void 0?a.path||"":d,caseSensitive:a.caseSensitive===!0,childrenIndex:u,route:a};if(p.relativePath.startsWith("/")){if(!p.relativePath.startsWith(r)&&h)return;At(p.relativePath.startsWith(r),`Absolute route path "${p.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),p.relativePath=p.relativePath.slice(r.length)}let m=Ri([r,p.relativePath]),_=n.concat(p);a.children&&a.children.length>0&&(At(a.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${m}".`),ME(a.children,t,_,m,h)),!(a.path==null&&!a.index)&&t.push({path:m,score:c4(m,a.index),routesMeta:_})};return e.forEach((a,u)=>{var h;if(a.path===""||!((h=a.path)!=null&&h.includes("?")))l(a,u);else for(let d of NE(a.path))l(a,u,!0,d)}),t}function NE(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,s=n.endsWith("?"),l=n.replace(/\?$/,"");if(r.length===0)return s?[l,""]:[l];let a=NE(r.join("/")),u=[];return u.push(...a.map(h=>h===""?l:[l,h].join("/"))),s&&u.push(...a),u.map(h=>e.startsWith("/")&&h===""?"/":h)}function n4(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:u4(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var r4=/^:[\w-]+$/,i4=3,s4=2,o4=1,l4=10,a4=-2,Bw=e=>e==="*";function c4(e,t){let n=e.split("/"),r=n.length;return n.some(Bw)&&(r+=a4),t&&(r+=s4),n.filter(s=>!Bw(s)).reduce((s,l)=>s+(r4.test(l)?i4:l===""?o4:l4),r)}function u4(e,t){return e.length===t.length&&e.slice(0,-1).every((r,s)=>r===t[s])?e[e.length-1]-t[t.length-1]:0}function d4(e,t,n=!1){let{routesMeta:r}=e,s={},l="/",a=[];for(let u=0;u<r.length;++u){let h=r[u],d=u===r.length-1,p=l==="/"?t:t.slice(l.length)||"/",m=yf({path:h.relativePath,caseSensitive:h.caseSensitive,end:d},p),_=h.route;if(!m&&d&&n&&!r[r.length-1].route.index&&(m=yf({path:h.relativePath,caseSensitive:h.caseSensitive,end:!1},p)),!m)return null;Object.assign(s,m.params),a.push({params:s,pathname:Ri([l,m.pathname]),pathnameBase:v4(Ri([l,m.pathnameBase])),route:_}),m.pathnameBase!=="/"&&(l=Ri([l,m.pathnameBase]))}return a}function yf(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=h4(e.path,e.caseSensitive,e.end),s=t.match(n);if(!s)return null;let l=s[0],a=l.replace(/(.)\/+$/,"$1"),u=s.slice(1);return{params:r.reduce((d,{paramName:p,isOptional:m},_)=>{if(p==="*"){let w=u[_]||"";a=l.slice(0,l.length-w.length).replace(/(.)\/+$/,"$1")}const y=u[_];return m&&!y?d[p]=void 0:d[p]=(y||"").replace(/%2F/g,"/"),d},{}),pathname:l,pathnameBase:a,pattern:e}}function h4(e,t=!1,n=!0){oi(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let r=[],s="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(a,u,h,d,p)=>{if(r.push({paramName:u,isOptional:h!=null}),h){let m=p.charAt(d+a.length);return m&&m!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(r.push({paramName:"*"}),s+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?s+="\\/*$":e!==""&&e!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,t?void 0:"i"),r]}function f4(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return oi(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function us(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}var p4=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function m4(e,t="/"){let{pathname:n,search:r="",hash:s=""}=typeof e=="string"?Ra(e):e,l;return n?(n=n.replace(/\/\/+/g,"/"),n.startsWith("/")?l=Iw(n.substring(1),"/"):l=Iw(n,t)):l=t,{pathname:l,search:_4(r),hash:y4(s)}}function Iw(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(s=>{s===".."?n.length>1&&n.pop():s!=="."&&n.push(s)}),n.length>1?n.join("/"):"/"}function rv(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function g4(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function Vy(e){let t=g4(e);return t.map((n,r)=>r===t.length-1?n.pathname:n.pathnameBase)}function tp(e,t,n,r=!1){let s;typeof e=="string"?s=Ra(e):(s={...e},At(!s.pathname||!s.pathname.includes("?"),rv("?","pathname","search",s)),At(!s.pathname||!s.pathname.includes("#"),rv("#","pathname","hash",s)),At(!s.search||!s.search.includes("#"),rv("#","search","hash",s)));let l=e===""||s.pathname==="",a=l?"/":s.pathname,u;if(a==null)u=n;else{let m=t.length-1;if(!r&&a.startsWith("..")){let _=a.split("/");for(;_[0]==="..";)_.shift(),m-=1;s.pathname=_.join("/")}u=m>=0?t[m]:"/"}let h=m4(s,u),d=a&&a!=="/"&&a.endsWith("/"),p=(l||a===".")&&n.endsWith("/");return!h.pathname.endsWith("/")&&(d||p)&&(h.pathname+="/"),h}var Ri=e=>e.join("/").replace(/\/\/+/g,"/"),v4=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),_4=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,y4=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,b4=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||"",this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function x4(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function S4(e){return e.map(t=>t.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var AE=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function DE(e,t){let n=e;if(typeof n!="string"||!p4.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,s=!1;if(AE)try{let l=new URL(window.location.href),a=n.startsWith("//")?new URL(l.protocol+n):new URL(n),u=us(a.pathname,t);a.origin===l.origin&&u!=null?n=u+a.search+a.hash:s=!0}catch{oi(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:s,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var OE=["POST","PUT","PATCH","DELETE"];new Set(OE);var w4=["GET",...OE];new Set(w4);var Ta=b.createContext(null);Ta.displayName="DataRouter";var np=b.createContext(null);np.displayName="DataRouterState";var C4=b.createContext(!1),LE=b.createContext({isTransitioning:!1});LE.displayName="ViewTransition";var k4=b.createContext(new Map);k4.displayName="Fetchers";var E4=b.createContext(null);E4.displayName="Await";var kr=b.createContext(null);kr.displayName="Navigation";var Iu=b.createContext(null);Iu.displayName="Location";var Gr=b.createContext({outlet:null,matches:[],isDataRoute:!1});Gr.displayName="Route";var qy=b.createContext(null);qy.displayName="RouteError";var jE="REACT_ROUTER_ERROR",R4="REDIRECT",T4="ROUTE_ERROR_RESPONSE";function M4(e){if(e.startsWith(`${jE}:${R4}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.location=="string"&&typeof t.reloadDocument=="boolean"&&typeof t.replace=="boolean")return t}catch{}}function N4(e){if(e.startsWith(`${jE}:${T4}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new b4(t.status,t.statusText,t.data)}catch{}}function A4(e,{relative:t}={}){At(Ma(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=b.useContext(kr),{hash:s,pathname:l,search:a}=Hu(e,{relative:t}),u=l;return n!=="/"&&(u=l==="/"?n:Ri([n,l])),r.createHref({pathname:u,search:a,hash:s})}function Ma(){return b.useContext(Iu)!=null}function di(){return At(Ma(),"useLocation() may be used only in the context of a <Router> component."),b.useContext(Iu).location}var zE="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function PE(e){b.useContext(kr).static||b.useLayoutEffect(e)}function Na(){let{isDataRoute:e}=b.useContext(Gr);return e?V4():D4()}function D4(){At(Ma(),"useNavigate() may be used only in the context of a <Router> component.");let e=b.useContext(Ta),{basename:t,navigator:n}=b.useContext(kr),{matches:r}=b.useContext(Gr),{pathname:s}=di(),l=JSON.stringify(Vy(r)),a=b.useRef(!1);return PE(()=>{a.current=!0}),b.useCallback((h,d={})=>{if(oi(a.current,zE),!a.current)return;if(typeof h=="number"){n.go(h);return}let p=tp(h,JSON.parse(l),s,d.relative==="path");e==null&&t!=="/"&&(p.pathname=p.pathname==="/"?t:Ri([t,p.pathname])),(d.replace?n.replace:n.push)(p,d.state,d)},[t,n,l,s,e])}var BE=b.createContext(null);function Ky(){return b.useContext(BE)}function O4(e){let t=b.useContext(Gr).outlet;return b.useMemo(()=>t&&b.createElement(BE.Provider,{value:e},t),[t,e])}function IE(){let{matches:e}=b.useContext(Gr),t=e[e.length-1];return t?t.params:{}}function Hu(e,{relative:t}={}){let{matches:n}=b.useContext(Gr),{pathname:r}=di(),s=JSON.stringify(Vy(n));return b.useMemo(()=>tp(e,JSON.parse(s),r,t==="path"),[e,s,r,t])}function L4(e,t){return HE(e,t)}function HE(e,t,n){var C;At(Ma(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:r}=b.useContext(kr),{matches:s}=b.useContext(Gr),l=s[s.length-1],a=l?l.params:{},u=l?l.pathname:"/",h=l?l.pathnameBase:"/",d=l&&l.route;{let k=d&&d.path||"";UE(u,!d||k.endsWith("*")||k.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${u}" (under <Route path="${k}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
59
+
60
+ Please change the parent <Route path="${k}"> to <Route path="${k==="/"?"*":`${k}/*`}">.`)}let p=di(),m;if(t){let k=typeof t=="string"?Ra(t):t;At(h==="/"||((C=k.pathname)==null?void 0:C.startsWith(h)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${h}" but pathname "${k.pathname}" was given in the \`location\` prop.`),m=k}else m=p;let _=m.pathname||"/",y=_;if(h!=="/"){let k=h.replace(/^\//,"").split("/");y="/"+_.replace(/^\//,"").split("/").slice(k.length).join("/")}let w=TE(e,{pathname:y});oi(d||w!=null,`No routes matched location "${m.pathname}${m.search}${m.hash}" `),oi(w==null||w[w.length-1].route.element!==void 0||w[w.length-1].route.Component!==void 0||w[w.length-1].route.lazy!==void 0,`Matched leaf route at location "${m.pathname}${m.search}${m.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let S=I4(w&&w.map(k=>Object.assign({},k,{params:Object.assign({},a,k.params),pathname:Ri([h,r.encodeLocation?r.encodeLocation(k.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:k.pathname]),pathnameBase:k.pathnameBase==="/"?h:Ri([h,r.encodeLocation?r.encodeLocation(k.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:k.pathnameBase])})),s,n);return t&&S?b.createElement(Iu.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...m},navigationType:"POP"}},S):S}function j4(){let e=W4(),t=x4(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r="rgba(200,200,200, 0.5)",s={padding:"0.5rem",backgroundColor:r},l={padding:"2px 4px",backgroundColor:r},a=null;return console.error("Error handled by React Router default ErrorBoundary:",e),a=b.createElement(b.Fragment,null,b.createElement("p",null,"💿 Hey developer 👋"),b.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",b.createElement("code",{style:l},"ErrorBoundary")," or"," ",b.createElement("code",{style:l},"errorElement")," prop on your route.")),b.createElement(b.Fragment,null,b.createElement("h2",null,"Unexpected Application Error!"),b.createElement("h3",{style:{fontStyle:"italic"}},t),n?b.createElement("pre",{style:s},n):null,a)}var z4=b.createElement(j4,null),FE=class extends b.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const n=N4(e.digest);n&&(e=n)}let t=e!==void 0?b.createElement(Gr.Provider,{value:this.props.routeContext},b.createElement(qy.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?b.createElement(P4,{error:e},t):t}};FE.contextType=C4;var iv=new WeakMap;function P4({children:e,error:t}){let{basename:n}=b.useContext(kr);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let r=M4(t.digest);if(r){let s=iv.get(t);if(s)throw s;let l=DE(r.location,n);if(AE&&!iv.get(t))if(l.isExternal||r.reloadDocument)window.location.href=l.absoluteURL||l.to;else{const a=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(l.to,{replace:r.replace}));throw iv.set(t,a),a}return b.createElement("meta",{httpEquiv:"refresh",content:`0;url=${l.absoluteURL||l.to}`})}}return e}function B4({routeContext:e,match:t,children:n}){let r=b.useContext(Ta);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),b.createElement(Gr.Provider,{value:e},n)}function I4(e,t=[],n){let r=n==null?void 0:n.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let s=e,l=r==null?void 0:r.errors;if(l!=null){let p=s.findIndex(m=>m.route.id&&(l==null?void 0:l[m.route.id])!==void 0);At(p>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(l).join(",")}`),s=s.slice(0,Math.min(s.length,p+1))}let a=!1,u=-1;if(n&&r){a=r.renderFallback;for(let p=0;p<s.length;p++){let m=s[p];if((m.route.HydrateFallback||m.route.hydrateFallbackElement)&&(u=p),m.route.id){let{loaderData:_,errors:y}=r,w=m.route.loader&&!_.hasOwnProperty(m.route.id)&&(!y||y[m.route.id]===void 0);if(m.route.lazy||w){n.isStatic&&(a=!0),u>=0?s=s.slice(0,u+1):s=[s[0]];break}}}}let h=n==null?void 0:n.onError,d=r&&h?(p,m)=>{var _,y;h(p,{location:r.location,params:((y=(_=r.matches)==null?void 0:_[0])==null?void 0:y.params)??{},unstable_pattern:S4(r.matches),errorInfo:m})}:void 0;return s.reduceRight((p,m,_)=>{let y,w=!1,S=null,C=null;r&&(y=l&&m.route.id?l[m.route.id]:void 0,S=m.route.errorElement||z4,a&&(u<0&&_===0?(UE("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),w=!0,C=null):u===_&&(w=!0,C=m.route.hydrateFallbackElement||null)));let k=t.concat(s.slice(0,_+1)),T=()=>{let R;return y?R=S:w?R=C:m.route.Component?R=b.createElement(m.route.Component,null):m.route.element?R=m.route.element:R=p,b.createElement(B4,{match:m,routeContext:{outlet:p,matches:k,isDataRoute:r!=null},children:R})};return r&&(m.route.ErrorBoundary||m.route.errorElement||_===0)?b.createElement(FE,{location:r.location,revalidation:r.revalidation,component:S,error:y,children:T(),routeContext:{outlet:null,matches:k,isDataRoute:!0},onError:d}):T()},null)}function Gy(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function H4(e){let t=b.useContext(Ta);return At(t,Gy(e)),t}function F4(e){let t=b.useContext(np);return At(t,Gy(e)),t}function U4(e){let t=b.useContext(Gr);return At(t,Gy(e)),t}function Yy(e){let t=U4(e),n=t.matches[t.matches.length-1];return At(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function $4(){return Yy("useRouteId")}function W4(){var r;let e=b.useContext(qy),t=F4("useRouteError"),n=Yy("useRouteError");return e!==void 0?e:(r=t.errors)==null?void 0:r[n]}function V4(){let{router:e}=H4("useNavigate"),t=Yy("useNavigate"),n=b.useRef(!1);return PE(()=>{n.current=!0}),b.useCallback(async(s,l={})=>{oi(n.current,zE),n.current&&(typeof s=="number"?await e.navigate(s):await e.navigate(s,{fromRouteId:t,...l}))},[e,t])}var Hw={};function UE(e,t,n){!t&&!Hw[e]&&(Hw[e]=!0,oi(!1,n))}b.memo(q4);function q4({routes:e,future:t,state:n,isStatic:r,onError:s}){return HE(e,void 0,{state:n,isStatic:r,onError:s})}function K4({to:e,replace:t,state:n,relative:r}){At(Ma(),"<Navigate> may be used only in the context of a <Router> component.");let{static:s}=b.useContext(kr);oi(!s,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:l}=b.useContext(Gr),{pathname:a}=di(),u=Na(),h=tp(e,Vy(l),a,r==="path"),d=JSON.stringify(h);return b.useEffect(()=>{u(JSON.parse(d),{replace:t,state:n,relative:r})},[u,d,r,t,n]),null}function G4(e){return O4(e.context)}function la(e){At(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function Y4({basename:e="/",children:t=null,location:n,navigationType:r="POP",navigator:s,static:l=!1,unstable_useTransitions:a}){At(!Ma(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let u=e.replace(/^\/*/,"/"),h=b.useMemo(()=>({basename:u,navigator:s,static:l,unstable_useTransitions:a,future:{}}),[u,s,l,a]);typeof n=="string"&&(n=Ra(n));let{pathname:d="/",search:p="",hash:m="",state:_=null,key:y="default",unstable_mask:w}=n,S=b.useMemo(()=>{let C=us(d,u);return C==null?null:{location:{pathname:C,search:p,hash:m,state:_,key:y,unstable_mask:w},navigationType:r}},[u,d,p,m,_,y,r,w]);return oi(S!=null,`<Router basename="${u}"> is not able to match the URL "${d}${p}${m}" because it does not start with the basename, so the <Router> won't render anything.`),S==null?null:b.createElement(kr.Provider,{value:h},b.createElement(Iu.Provider,{children:t,value:S}))}function X4({children:e,location:t}){return L4(u_(e),t)}function u_(e,t=[]){let n=[];return b.Children.forEach(e,(r,s)=>{if(!b.isValidElement(r))return;let l=[...t,s];if(r.type===b.Fragment){n.push.apply(n,u_(r.props.children,l));return}At(r.type===la,`[${typeof r.type=="string"?r.type:r.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),At(!r.props.index||!r.props.children,"An index route cannot have child routes.");let a={id:r.props.id||l.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,middleware:r.props.middleware,loader:r.props.loader,action:r.props.action,hydrateFallbackElement:r.props.hydrateFallbackElement,HydrateFallback:r.props.HydrateFallback,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.hasErrorBoundary===!0||r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(a.children=u_(r.props.children,l)),n.push(a)}),n}var Xh="get",Zh="application/x-www-form-urlencoded";function rp(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function Z4(e){return rp(e)&&e.tagName.toLowerCase()==="button"}function Q4(e){return rp(e)&&e.tagName.toLowerCase()==="form"}function J4(e){return rp(e)&&e.tagName.toLowerCase()==="input"}function eL(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function tL(e,t){return e.button===0&&(!t||t==="_self")&&!eL(e)}var bh=null;function nL(){if(bh===null)try{new FormData(document.createElement("form"),0),bh=!1}catch{bh=!0}return bh}var rL=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function sv(e){return e!=null&&!rL.has(e)?(oi(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Zh}"`),null):e}function iL(e,t){let n,r,s,l,a;if(Q4(e)){let u=e.getAttribute("action");r=u?us(u,t):null,n=e.getAttribute("method")||Xh,s=sv(e.getAttribute("enctype"))||Zh,l=new FormData(e)}else if(Z4(e)||J4(e)&&(e.type==="submit"||e.type==="image")){let u=e.form;if(u==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let h=e.getAttribute("formaction")||u.getAttribute("action");if(r=h?us(h,t):null,n=e.getAttribute("formmethod")||u.getAttribute("method")||Xh,s=sv(e.getAttribute("formenctype"))||sv(u.getAttribute("enctype"))||Zh,l=new FormData(u,e),!nL()){let{name:d,type:p,value:m}=e;if(p==="image"){let _=d?`${d}.`:"";l.append(`${_}x`,"0"),l.append(`${_}y`,"0")}else d&&l.append(d,m)}}else{if(rp(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=Xh,r=null,s=Zh,a=e}return l&&s==="text/plain"&&(a=l,l=void 0),{action:r,method:n.toLowerCase(),encType:s,formData:l,body:a}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Xy(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function sL(e,t,n,r){let s=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return n?s.pathname.endsWith("/")?s.pathname=`${s.pathname}_.${r}`:s.pathname=`${s.pathname}.${r}`:s.pathname==="/"?s.pathname=`_root.${r}`:t&&us(s.pathname,t)==="/"?s.pathname=`${t.replace(/\/$/,"")}/_root.${r}`:s.pathname=`${s.pathname.replace(/\/$/,"")}.${r}`,s}async function oL(e,t){if(e.id in t)return t[e.id];try{let n=await import(e.module);return t[e.id]=n,n}catch(n){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(n),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function lL(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function aL(e,t,n){let r=await Promise.all(e.map(async s=>{let l=t.routes[s.route.id];if(l){let a=await oL(l,n);return a.links?a.links():[]}return[]}));return hL(r.flat(1).filter(lL).filter(s=>s.rel==="stylesheet"||s.rel==="preload").map(s=>s.rel==="stylesheet"?{...s,rel:"prefetch",as:"style"}:{...s,rel:"prefetch"}))}function Fw(e,t,n,r,s,l){let a=(h,d)=>n[d]?h.route.id!==n[d].route.id:!0,u=(h,d)=>{var p;return n[d].pathname!==h.pathname||((p=n[d].route.path)==null?void 0:p.endsWith("*"))&&n[d].params["*"]!==h.params["*"]};return l==="assets"?t.filter((h,d)=>a(h,d)||u(h,d)):l==="data"?t.filter((h,d)=>{var m;let p=r.routes[h.route.id];if(!p||!p.hasLoader)return!1;if(a(h,d)||u(h,d))return!0;if(h.route.shouldRevalidate){let _=h.route.shouldRevalidate({currentUrl:new URL(s.pathname+s.search+s.hash,window.origin),currentParams:((m=n[0])==null?void 0:m.params)||{},nextUrl:new URL(e,window.origin),nextParams:h.params,defaultShouldRevalidate:!0});if(typeof _=="boolean")return _}return!0}):[]}function cL(e,t,{includeHydrateFallback:n}={}){return uL(e.map(r=>{let s=t.routes[r.route.id];if(!s)return[];let l=[s.module];return s.clientActionModule&&(l=l.concat(s.clientActionModule)),s.clientLoaderModule&&(l=l.concat(s.clientLoaderModule)),n&&s.hydrateFallbackModule&&(l=l.concat(s.hydrateFallbackModule)),s.imports&&(l=l.concat(s.imports)),l}).flat(1))}function uL(e){return[...new Set(e)]}function dL(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function hL(e,t){let n=new Set;return new Set(t),e.reduce((r,s)=>{let l=JSON.stringify(dL(s));return n.has(l)||(n.add(l),r.push({key:l,link:s})),r},[])}function $E(){let e=b.useContext(Ta);return Xy(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function fL(){let e=b.useContext(np);return Xy(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Zy=b.createContext(void 0);Zy.displayName="FrameworkContext";function WE(){let e=b.useContext(Zy);return Xy(e,"You must render this element inside a <HydratedRouter> element"),e}function pL(e,t){let n=b.useContext(Zy),[r,s]=b.useState(!1),[l,a]=b.useState(!1),{onFocus:u,onBlur:h,onMouseEnter:d,onMouseLeave:p,onTouchStart:m}=t,_=b.useRef(null);b.useEffect(()=>{if(e==="render"&&a(!0),e==="viewport"){let S=k=>{k.forEach(T=>{a(T.isIntersecting)})},C=new IntersectionObserver(S,{threshold:.5});return _.current&&C.observe(_.current),()=>{C.disconnect()}}},[e]),b.useEffect(()=>{if(r){let S=setTimeout(()=>{a(!0)},100);return()=>{clearTimeout(S)}}},[r]);let y=()=>{s(!0)},w=()=>{s(!1),a(!1)};return n?e!=="intent"?[l,_,{}]:[l,_,{onFocus:Bc(u,y),onBlur:Bc(h,w),onMouseEnter:Bc(d,y),onMouseLeave:Bc(p,w),onTouchStart:Bc(m,y)}]:[!1,_,{}]}function Bc(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function mL({page:e,...t}){let{router:n}=$E(),r=b.useMemo(()=>TE(n.routes,e,n.basename),[n.routes,e,n.basename]);return r?b.createElement(vL,{page:e,matches:r,...t}):null}function gL(e){let{manifest:t,routeModules:n}=WE(),[r,s]=b.useState([]);return b.useEffect(()=>{let l=!1;return aL(e,t,n).then(a=>{l||s(a)}),()=>{l=!0}},[e,t,n]),r}function vL({page:e,matches:t,...n}){let r=di(),{future:s,manifest:l,routeModules:a}=WE(),{basename:u}=$E(),{loaderData:h,matches:d}=fL(),p=b.useMemo(()=>Fw(e,t,d,l,r,"data"),[e,t,d,l,r]),m=b.useMemo(()=>Fw(e,t,d,l,r,"assets"),[e,t,d,l,r]),_=b.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let S=new Set,C=!1;if(t.forEach(T=>{var N;let R=l.routes[T.route.id];!R||!R.hasLoader||(!p.some(j=>j.route.id===T.route.id)&&T.route.id in h&&((N=a[T.route.id])!=null&&N.shouldRevalidate)||R.hasClientLoader?C=!0:S.add(T.route.id))}),S.size===0)return[];let k=sL(e,u,s.unstable_trailingSlashAwareDataRequests,"data");return C&&S.size>0&&k.searchParams.set("_routes",t.filter(T=>S.has(T.route.id)).map(T=>T.route.id).join(",")),[k.pathname+k.search]},[u,s.unstable_trailingSlashAwareDataRequests,h,r,l,p,t,e,a]),y=b.useMemo(()=>cL(m,l),[m,l]),w=gL(m);return b.createElement(b.Fragment,null,_.map(S=>b.createElement("link",{key:S,rel:"prefetch",as:"fetch",href:S,...n})),y.map(S=>b.createElement("link",{key:S,rel:"modulepreload",href:S,...n})),w.map(({key:S,link:C})=>b.createElement("link",{key:S,nonce:n.nonce,...C,crossOrigin:C.crossOrigin??n.crossOrigin})))}function _L(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var yL=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{yL&&(window.__reactRouterVersion="7.13.1")}catch{}function bL({basename:e,children:t,unstable_useTransitions:n,window:r}){let s=b.useRef();s.current==null&&(s.current=ZO({window:r,v5Compat:!0}));let l=s.current,[a,u]=b.useState({action:l.action,location:l.location}),h=b.useCallback(d=>{n===!1?u(d):b.startTransition(()=>u(d))},[n]);return b.useLayoutEffect(()=>l.listen(h),[l,h]),b.createElement(Y4,{basename:e,children:t,location:a.location,navigationType:a.action,navigator:l,unstable_useTransitions:n})}var VE=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,qE=b.forwardRef(function({onClick:t,discover:n="render",prefetch:r="none",relative:s,reloadDocument:l,replace:a,unstable_mask:u,state:h,target:d,to:p,preventScrollReset:m,viewTransition:_,unstable_defaultShouldRevalidate:y,...w},S){let{basename:C,navigator:k,unstable_useTransitions:T}=b.useContext(kr),R=typeof p=="string"&&VE.test(p),N=DE(p,C);p=N.to;let j=A4(p,{relative:s}),A=di(),D=null;if(u){let $=tp(u,[],A.unstable_mask?A.unstable_mask.pathname:"/",!0);C!=="/"&&($.pathname=$.pathname==="/"?C:Ri([C,$.pathname])),D=k.createHref($)}let[B,K,z]=pL(r,w),U=CL(p,{replace:a,unstable_mask:u,state:h,target:d,preventScrollReset:m,relative:s,viewTransition:_,unstable_defaultShouldRevalidate:y,unstable_useTransitions:T});function H($){t&&t($),$.defaultPrevented||U($)}let F=!(N.isExternal||l),q=b.createElement("a",{...w,...z,href:(F?D:void 0)||N.absoluteURL||j,onClick:F?H:t,ref:_L(S,K),target:d,"data-discover":!R&&n==="render"?"true":void 0});return B&&!R?b.createElement(b.Fragment,null,q,b.createElement(mL,{page:j})):q});qE.displayName="Link";var xL=b.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:r="",end:s=!1,style:l,to:a,viewTransition:u,children:h,...d},p){let m=Hu(a,{relative:d.relative}),_=di(),y=b.useContext(np),{navigator:w,basename:S}=b.useContext(kr),C=y!=null&&ML(m)&&u===!0,k=w.encodeLocation?w.encodeLocation(m).pathname:m.pathname,T=_.pathname,R=y&&y.navigation&&y.navigation.location?y.navigation.location.pathname:null;n||(T=T.toLowerCase(),R=R?R.toLowerCase():null,k=k.toLowerCase()),R&&S&&(R=us(R,S)||R);const N=k!=="/"&&k.endsWith("/")?k.length-1:k.length;let j=T===k||!s&&T.startsWith(k)&&T.charAt(N)==="/",A=R!=null&&(R===k||!s&&R.startsWith(k)&&R.charAt(k.length)==="/"),D={isActive:j,isPending:A,isTransitioning:C},B=j?t:void 0,K;typeof r=="function"?K=r(D):K=[r,j?"active":null,A?"pending":null,C?"transitioning":null].filter(Boolean).join(" ");let z=typeof l=="function"?l(D):l;return b.createElement(qE,{...d,"aria-current":B,className:K,ref:p,style:z,to:a,viewTransition:u},typeof h=="function"?h(D):h)});xL.displayName="NavLink";var SL=b.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:r,replace:s,state:l,method:a=Xh,action:u,onSubmit:h,relative:d,preventScrollReset:p,viewTransition:m,unstable_defaultShouldRevalidate:_,...y},w)=>{let{unstable_useTransitions:S}=b.useContext(kr),C=RL(),k=TL(u,{relative:d}),T=a.toLowerCase()==="get"?"get":"post",R=typeof u=="string"&&VE.test(u),N=j=>{if(h&&h(j),j.defaultPrevented)return;j.preventDefault();let A=j.nativeEvent.submitter,D=(A==null?void 0:A.getAttribute("formmethod"))||a,B=()=>C(A||j.currentTarget,{fetcherKey:t,method:D,navigate:n,replace:s,state:l,relative:d,preventScrollReset:p,viewTransition:m,unstable_defaultShouldRevalidate:_});S&&n!==!1?b.startTransition(()=>B()):B()};return b.createElement("form",{ref:w,method:T,action:k,onSubmit:r?h:N,...y,"data-discover":!R&&e==="render"?"true":void 0})});SL.displayName="Form";function wL(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function KE(e){let t=b.useContext(Ta);return At(t,wL(e)),t}function CL(e,{target:t,replace:n,unstable_mask:r,state:s,preventScrollReset:l,relative:a,viewTransition:u,unstable_defaultShouldRevalidate:h,unstable_useTransitions:d}={}){let p=Na(),m=di(),_=Hu(e,{relative:a});return b.useCallback(y=>{if(tL(y,t)){y.preventDefault();let w=n!==void 0?n:Su(m)===Su(_),S=()=>p(e,{replace:w,unstable_mask:r,state:s,preventScrollReset:l,relative:a,viewTransition:u,unstable_defaultShouldRevalidate:h});d?b.startTransition(()=>S()):S()}},[m,p,_,n,r,s,t,e,l,a,u,h,d])}var kL=0,EL=()=>`__${String(++kL)}__`;function RL(){let{router:e}=KE("useSubmit"),{basename:t}=b.useContext(kr),n=$4(),r=e.fetch,s=e.navigate;return b.useCallback(async(l,a={})=>{let{action:u,method:h,encType:d,formData:p,body:m}=iL(l,t);if(a.navigate===!1){let _=a.fetcherKey||EL();await r(_,n,a.action||u,{unstable_defaultShouldRevalidate:a.unstable_defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:p,body:m,formMethod:a.method||h,formEncType:a.encType||d,flushSync:a.flushSync})}else await s(a.action||u,{unstable_defaultShouldRevalidate:a.unstable_defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:p,body:m,formMethod:a.method||h,formEncType:a.encType||d,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[r,s,t,n])}function TL(e,{relative:t}={}){let{basename:n}=b.useContext(kr),r=b.useContext(Gr);At(r,"useFormAction must be used inside a RouteContext");let[s]=r.matches.slice(-1),l={...Hu(e||".",{relative:t})},a=di();if(e==null){l.search=a.search;let u=new URLSearchParams(l.search),h=u.getAll("index");if(h.some(p=>p==="")){u.delete("index"),h.filter(m=>m).forEach(m=>u.append("index",m));let p=u.toString();l.search=p?`?${p}`:""}}return(!e||e===".")&&s.route.index&&(l.search=l.search?l.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(l.pathname=l.pathname==="/"?n:Ri([n,l.pathname])),Su(l)}function ML(e,{relative:t}={}){let n=b.useContext(LE);At(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=KE("useViewTransitionState"),s=Hu(e,{relative:t});if(!n.isTransitioning)return!1;let l=us(n.currentLocation.pathname,r)||n.currentLocation.pathname,a=us(n.nextLocation.pathname,r)||n.nextLocation.pathname;return yf(s.pathname,a)!=null||yf(s.pathname,l)!=null}var wi=RE();const NL=ep(wi);function GE(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(n=GE(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function YE(){for(var e,t,n=0,r="",s=arguments.length;n<s;n++)(e=arguments[n])&&(t=GE(e))&&(r&&(r+=" "),r+=t);return r}const Uw=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,$w=YE,AL=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return $w(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:s,defaultVariants:l}=t,a=Object.keys(s).map(d=>{const p=n==null?void 0:n[d],m=l==null?void 0:l[d];if(p===null)return null;const _=Uw(p)||Uw(m);return s[d][_]}),u=n&&Object.entries(n).reduce((d,p)=>{let[m,_]=p;return _===void 0||(d[m]=_),d},{}),h=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((d,p)=>{let{class:m,className:_,...y}=p;return Object.entries(y).every(w=>{let[S,C]=w;return Array.isArray(C)?C.includes({...l,...u}[S]):{...l,...u}[S]===C})?[...d,m,_]:d},[]);return $w(e,a,h,n==null?void 0:n.class,n==null?void 0:n.className)},DL=(e,t)=>{const n=new Array(e.length+t.length);for(let r=0;r<e.length;r++)n[r]=e[r];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},OL=(e,t)=>({classGroupId:e,validator:t}),XE=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),bf="-",Ww=[],LL="arbitrary..",jL=e=>{const t=PL(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:a=>{if(a.startsWith("[")&&a.endsWith("]"))return zL(a);const u=a.split(bf),h=u[0]===""&&u.length>1?1:0;return ZE(u,h,t)},getConflictingClassGroupIds:(a,u)=>{if(u){const h=r[a],d=n[a];return h?d?DL(d,h):h:d||Ww}return n[a]||Ww}}},ZE=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const s=e[t],l=n.nextPart.get(s);if(l){const d=ZE(e,t+1,l);if(d)return d}const a=n.validators;if(a===null)return;const u=t===0?e.join(bf):e.slice(t).join(bf),h=a.length;for(let d=0;d<h;d++){const p=a[d];if(p.validator(u))return p.classGroupId}},zL=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),r=t.slice(0,n);return r?LL+r:void 0})(),PL=e=>{const{theme:t,classGroups:n}=e;return BL(n,t)},BL=(e,t)=>{const n=XE();for(const r in e){const s=e[r];Qy(s,n,r,t)}return n},Qy=(e,t,n,r)=>{const s=e.length;for(let l=0;l<s;l++){const a=e[l];IL(a,t,n,r)}},IL=(e,t,n,r)=>{if(typeof e=="string"){HL(e,t,n);return}if(typeof e=="function"){FL(e,t,n,r);return}UL(e,t,n,r)},HL=(e,t,n)=>{const r=e===""?t:QE(t,e);r.classGroupId=n},FL=(e,t,n,r)=>{if($L(e)){Qy(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(OL(n,e))},UL=(e,t,n,r)=>{const s=Object.entries(e),l=s.length;for(let a=0;a<l;a++){const[u,h]=s[a];Qy(h,QE(t,u),n,r)}},QE=(e,t)=>{let n=e;const r=t.split(bf),s=r.length;for(let l=0;l<s;l++){const a=r[l];let u=n.nextPart.get(a);u||(u=XE(),n.nextPart.set(a,u)),n=u}return n},$L=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,WL=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null);const s=(l,a)=>{n[l]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(l){let a=n[l];if(a!==void 0)return a;if((a=r[l])!==void 0)return s(l,a),a},set(l,a){l in n?n[l]=a:s(l,a)}}},d_="!",Vw=":",VL=[],qw=(e,t,n,r,s)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:s}),qL=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=s=>{const l=[];let a=0,u=0,h=0,d;const p=s.length;for(let S=0;S<p;S++){const C=s[S];if(a===0&&u===0){if(C===Vw){l.push(s.slice(h,S)),h=S+1;continue}if(C==="/"){d=S;continue}}C==="["?a++:C==="]"?a--:C==="("?u++:C===")"&&u--}const m=l.length===0?s:s.slice(h);let _=m,y=!1;m.endsWith(d_)?(_=m.slice(0,-1),y=!0):m.startsWith(d_)&&(_=m.slice(1),y=!0);const w=d&&d>h?d-h:void 0;return qw(l,y,_,w)};if(t){const s=t+Vw,l=r;r=a=>a.startsWith(s)?l(a.slice(s.length)):qw(VL,!1,a,void 0,!0)}if(n){const s=r;r=l=>n({className:l,parseClassName:s})}return r},KL=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,r)=>{t.set(n,1e6+r)}),n=>{const r=[];let s=[];for(let l=0;l<n.length;l++){const a=n[l],u=a[0]==="[",h=t.has(a);u||h?(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}},GL=e=>({cache:WL(e.cacheSize),parseClassName:qL(e),sortModifiers:KL(e),...jL(e)}),YL=/\s+/,XL=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s,sortModifiers:l}=t,a=[],u=e.trim().split(YL);let h="";for(let d=u.length-1;d>=0;d-=1){const p=u[d],{isExternal:m,modifiers:_,hasImportantModifier:y,baseClassName:w,maybePostfixModifierPosition:S}=n(p);if(m){h=p+(h.length>0?" "+h:h);continue}let C=!!S,k=r(C?w.substring(0,S):w);if(!k){if(!C){h=p+(h.length>0?" "+h:h);continue}if(k=r(w),!k){h=p+(h.length>0?" "+h:h);continue}C=!1}const T=_.length===0?"":_.length===1?_[0]:l(_).join(":"),R=y?T+d_:T,N=R+k;if(a.indexOf(N)>-1)continue;a.push(N);const j=s(k,C);for(let A=0;A<j.length;++A){const D=j[A];a.push(R+D)}h=p+(h.length>0?" "+h:h)}return h},ZL=(...e)=>{let t=0,n,r,s="";for(;t<e.length;)(n=e[t++])&&(r=JE(n))&&(s&&(s+=" "),s+=r);return s},JE=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=JE(e[r]))&&(n&&(n+=" "),n+=t);return n},QL=(e,...t)=>{let n,r,s,l;const a=h=>{const d=t.reduce((p,m)=>m(p),e());return n=GL(d),r=n.cache.get,s=n.cache.set,l=u,u(h)},u=h=>{const d=r(h);if(d)return d;const p=XL(h,n);return s(h,p),p};return l=a,(...h)=>l(ZL(...h))},JL=[],sn=e=>{const t=n=>n[e]||JL;return t.isThemeGetter=!0,t},eR=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,tR=/^\((?:(\w[\w-]*):)?(.+)\)$/i,ej=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,tj=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,nj=/\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$/,rj=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,ij=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,sj=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ws=e=>ej.test(e),qe=e=>!!e&&!Number.isNaN(Number(e)),Vs=e=>!!e&&Number.isInteger(Number(e)),ov=e=>e.endsWith("%")&&qe(e.slice(0,-1)),ns=e=>tj.test(e),nR=()=>!0,oj=e=>nj.test(e)&&!rj.test(e),Jy=()=>!1,lj=e=>ij.test(e),aj=e=>sj.test(e),cj=e=>!Te(e)&&!Me(e),uj=e=>co(e,sR,Jy),Te=e=>eR.test(e),Lo=e=>co(e,oR,oj),Kw=e=>co(e,_j,qe),dj=e=>co(e,aR,nR),hj=e=>co(e,lR,Jy),Gw=e=>co(e,rR,Jy),fj=e=>co(e,iR,aj),xh=e=>co(e,cR,lj),Me=e=>tR.test(e),Ic=e=>ll(e,oR),pj=e=>ll(e,lR),Yw=e=>ll(e,rR),mj=e=>ll(e,sR),gj=e=>ll(e,iR),Sh=e=>ll(e,cR,!0),vj=e=>ll(e,aR,!0),co=(e,t,n)=>{const r=eR.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},ll=(e,t,n=!1)=>{const r=tR.exec(e);return r?r[1]?t(r[1]):n:!1},rR=e=>e==="position"||e==="percentage",iR=e=>e==="image"||e==="url",sR=e=>e==="length"||e==="size"||e==="bg-size",oR=e=>e==="length",_j=e=>e==="number",lR=e=>e==="family-name",aR=e=>e==="number"||e==="weight",cR=e=>e==="shadow",yj=()=>{const e=sn("color"),t=sn("font"),n=sn("text"),r=sn("font-weight"),s=sn("tracking"),l=sn("leading"),a=sn("breakpoint"),u=sn("container"),h=sn("spacing"),d=sn("radius"),p=sn("shadow"),m=sn("inset-shadow"),_=sn("text-shadow"),y=sn("drop-shadow"),w=sn("blur"),S=sn("perspective"),C=sn("aspect"),k=sn("ease"),T=sn("animate"),R=()=>["auto","avoid","all","avoid-page","page","left","right","column"],N=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],j=()=>[...N(),Me,Te],A=()=>["auto","hidden","clip","visible","scroll"],D=()=>["auto","contain","none"],B=()=>[Me,Te,h],K=()=>[Ws,"full","auto",...B()],z=()=>[Vs,"none","subgrid",Me,Te],U=()=>["auto",{span:["full",Vs,Me,Te]},Vs,Me,Te],H=()=>[Vs,"auto",Me,Te],F=()=>["auto","min","max","fr",Me,Te],q=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],$=()=>["start","end","center","stretch","center-safe","end-safe"],P=()=>["auto",...B()],V=()=>[Ws,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...B()],W=()=>[Ws,"screen","full","dvw","lvw","svw","min","max","fit",...B()],Z=()=>[Ws,"screen","full","lh","dvh","lvh","svh","min","max","fit",...B()],M=()=>[e,Me,Te],I=()=>[...N(),Yw,Gw,{position:[Me,Te]}],X=()=>["no-repeat",{repeat:["","x","y","space","round"]}],L=()=>["auto","cover","contain",mj,uj,{size:[Me,Te]}],oe=()=>[ov,Ic,Lo],ae=()=>["","none","full",d,Me,Te],se=()=>["",qe,Ic,Lo],J=()=>["solid","dashed","dotted","double"],re=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],he=()=>[qe,ov,Yw,Gw],ve=()=>["","none",w,Me,Te],Ce=()=>["none",qe,Me,Te],ce=()=>["none",qe,Me,Te],_e=()=>[qe,Me,Te],Le=()=>[Ws,"full",...B()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[ns],breakpoint:[ns],color:[nR],container:[ns],"drop-shadow":[ns],ease:["in","out","in-out"],font:[cj],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[ns],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[ns],shadow:[ns],spacing:["px",qe],text:[ns],"text-shadow":[ns],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Ws,Te,Me,C]}],container:["container"],columns:[{columns:[qe,Te,Me,u]}],"break-after":[{"break-after":R()}],"break-before":[{"break-before":R()}],"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:j()}],overflow:[{overflow:A()}],"overflow-x":[{"overflow-x":A()}],"overflow-y":[{"overflow-y":A()}],overscroll:[{overscroll:D()}],"overscroll-x":[{"overscroll-x":D()}],"overscroll-y":[{"overscroll-y":D()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:K()}],"inset-x":[{"inset-x":K()}],"inset-y":[{"inset-y":K()}],start:[{"inset-s":K(),start:K()}],end:[{"inset-e":K(),end:K()}],"inset-bs":[{"inset-bs":K()}],"inset-be":[{"inset-be":K()}],top:[{top:K()}],right:[{right:K()}],bottom:[{bottom:K()}],left:[{left:K()}],visibility:["visible","invisible","collapse"],z:[{z:[Vs,"auto",Me,Te]}],basis:[{basis:[Ws,"full","auto",u,...B()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[qe,Ws,"auto","initial","none",Te]}],grow:[{grow:["",qe,Me,Te]}],shrink:[{shrink:["",qe,Me,Te]}],order:[{order:[Vs,"first","last","none",Me,Te]}],"grid-cols":[{"grid-cols":z()}],"col-start-end":[{col:U()}],"col-start":[{"col-start":H()}],"col-end":[{"col-end":H()}],"grid-rows":[{"grid-rows":z()}],"row-start-end":[{row:U()}],"row-start":[{"row-start":H()}],"row-end":[{"row-end":H()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":F()}],"auto-rows":[{"auto-rows":F()}],gap:[{gap:B()}],"gap-x":[{"gap-x":B()}],"gap-y":[{"gap-y":B()}],"justify-content":[{justify:[...q(),"normal"]}],"justify-items":[{"justify-items":[...$(),"normal"]}],"justify-self":[{"justify-self":["auto",...$()]}],"align-content":[{content:["normal",...q()]}],"align-items":[{items:[...$(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...$(),{baseline:["","last"]}]}],"place-content":[{"place-content":q()}],"place-items":[{"place-items":[...$(),"baseline"]}],"place-self":[{"place-self":["auto",...$()]}],p:[{p:B()}],px:[{px:B()}],py:[{py:B()}],ps:[{ps:B()}],pe:[{pe:B()}],pbs:[{pbs:B()}],pbe:[{pbe:B()}],pt:[{pt:B()}],pr:[{pr:B()}],pb:[{pb:B()}],pl:[{pl:B()}],m:[{m:P()}],mx:[{mx:P()}],my:[{my:P()}],ms:[{ms:P()}],me:[{me:P()}],mbs:[{mbs:P()}],mbe:[{mbe:P()}],mt:[{mt:P()}],mr:[{mr:P()}],mb:[{mb:P()}],ml:[{ml:P()}],"space-x":[{"space-x":B()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":B()}],"space-y-reverse":["space-y-reverse"],size:[{size:V()}],"inline-size":[{inline:["auto",...W()]}],"min-inline-size":[{"min-inline":["auto",...W()]}],"max-inline-size":[{"max-inline":["none",...W()]}],"block-size":[{block:["auto",...Z()]}],"min-block-size":[{"min-block":["auto",...Z()]}],"max-block-size":[{"max-block":["none",...Z()]}],w:[{w:[u,"screen",...V()]}],"min-w":[{"min-w":[u,"screen","none",...V()]}],"max-w":[{"max-w":[u,"screen","none","prose",{screen:[a]},...V()]}],h:[{h:["screen","lh",...V()]}],"min-h":[{"min-h":["screen","lh","none",...V()]}],"max-h":[{"max-h":["screen","lh",...V()]}],"font-size":[{text:["base",n,Ic,Lo]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,vj,dj]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",ov,Te]}],"font-family":[{font:[pj,hj,t]}],"font-features":[{"font-features":[Te]}],"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,Me,Te]}],"line-clamp":[{"line-clamp":[qe,"none",Me,Kw]}],leading:[{leading:[l,...B()]}],"list-image":[{"list-image":["none",Me,Te]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Me,Te]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:M()}],"text-color":[{text:M()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...J(),"wavy"]}],"text-decoration-thickness":[{decoration:[qe,"from-font","auto",Me,Lo]}],"text-decoration-color":[{decoration:M()}],"underline-offset":[{"underline-offset":[qe,"auto",Me,Te]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:B()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Me,Te]}],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",Me,Te]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:I()}],"bg-repeat":[{bg:X()}],"bg-size":[{bg:L()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Vs,Me,Te],radial:["",Me,Te],conic:[Vs,Me,Te]},gj,fj]}],"bg-color":[{bg:M()}],"gradient-from-pos":[{from:oe()}],"gradient-via-pos":[{via:oe()}],"gradient-to-pos":[{to:oe()}],"gradient-from":[{from:M()}],"gradient-via":[{via:M()}],"gradient-to":[{to:M()}],rounded:[{rounded:ae()}],"rounded-s":[{"rounded-s":ae()}],"rounded-e":[{"rounded-e":ae()}],"rounded-t":[{"rounded-t":ae()}],"rounded-r":[{"rounded-r":ae()}],"rounded-b":[{"rounded-b":ae()}],"rounded-l":[{"rounded-l":ae()}],"rounded-ss":[{"rounded-ss":ae()}],"rounded-se":[{"rounded-se":ae()}],"rounded-ee":[{"rounded-ee":ae()}],"rounded-es":[{"rounded-es":ae()}],"rounded-tl":[{"rounded-tl":ae()}],"rounded-tr":[{"rounded-tr":ae()}],"rounded-br":[{"rounded-br":ae()}],"rounded-bl":[{"rounded-bl":ae()}],"border-w":[{border:se()}],"border-w-x":[{"border-x":se()}],"border-w-y":[{"border-y":se()}],"border-w-s":[{"border-s":se()}],"border-w-e":[{"border-e":se()}],"border-w-bs":[{"border-bs":se()}],"border-w-be":[{"border-be":se()}],"border-w-t":[{"border-t":se()}],"border-w-r":[{"border-r":se()}],"border-w-b":[{"border-b":se()}],"border-w-l":[{"border-l":se()}],"divide-x":[{"divide-x":se()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":se()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...J(),"hidden","none"]}],"divide-style":[{divide:[...J(),"hidden","none"]}],"border-color":[{border:M()}],"border-color-x":[{"border-x":M()}],"border-color-y":[{"border-y":M()}],"border-color-s":[{"border-s":M()}],"border-color-e":[{"border-e":M()}],"border-color-bs":[{"border-bs":M()}],"border-color-be":[{"border-be":M()}],"border-color-t":[{"border-t":M()}],"border-color-r":[{"border-r":M()}],"border-color-b":[{"border-b":M()}],"border-color-l":[{"border-l":M()}],"divide-color":[{divide:M()}],"outline-style":[{outline:[...J(),"none","hidden"]}],"outline-offset":[{"outline-offset":[qe,Me,Te]}],"outline-w":[{outline:["",qe,Ic,Lo]}],"outline-color":[{outline:M()}],shadow:[{shadow:["","none",p,Sh,xh]}],"shadow-color":[{shadow:M()}],"inset-shadow":[{"inset-shadow":["none",m,Sh,xh]}],"inset-shadow-color":[{"inset-shadow":M()}],"ring-w":[{ring:se()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:M()}],"ring-offset-w":[{"ring-offset":[qe,Lo]}],"ring-offset-color":[{"ring-offset":M()}],"inset-ring-w":[{"inset-ring":se()}],"inset-ring-color":[{"inset-ring":M()}],"text-shadow":[{"text-shadow":["none",_,Sh,xh]}],"text-shadow-color":[{"text-shadow":M()}],opacity:[{opacity:[qe,Me,Te]}],"mix-blend":[{"mix-blend":[...re(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":re()}],"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":[qe]}],"mask-image-linear-from-pos":[{"mask-linear-from":he()}],"mask-image-linear-to-pos":[{"mask-linear-to":he()}],"mask-image-linear-from-color":[{"mask-linear-from":M()}],"mask-image-linear-to-color":[{"mask-linear-to":M()}],"mask-image-t-from-pos":[{"mask-t-from":he()}],"mask-image-t-to-pos":[{"mask-t-to":he()}],"mask-image-t-from-color":[{"mask-t-from":M()}],"mask-image-t-to-color":[{"mask-t-to":M()}],"mask-image-r-from-pos":[{"mask-r-from":he()}],"mask-image-r-to-pos":[{"mask-r-to":he()}],"mask-image-r-from-color":[{"mask-r-from":M()}],"mask-image-r-to-color":[{"mask-r-to":M()}],"mask-image-b-from-pos":[{"mask-b-from":he()}],"mask-image-b-to-pos":[{"mask-b-to":he()}],"mask-image-b-from-color":[{"mask-b-from":M()}],"mask-image-b-to-color":[{"mask-b-to":M()}],"mask-image-l-from-pos":[{"mask-l-from":he()}],"mask-image-l-to-pos":[{"mask-l-to":he()}],"mask-image-l-from-color":[{"mask-l-from":M()}],"mask-image-l-to-color":[{"mask-l-to":M()}],"mask-image-x-from-pos":[{"mask-x-from":he()}],"mask-image-x-to-pos":[{"mask-x-to":he()}],"mask-image-x-from-color":[{"mask-x-from":M()}],"mask-image-x-to-color":[{"mask-x-to":M()}],"mask-image-y-from-pos":[{"mask-y-from":he()}],"mask-image-y-to-pos":[{"mask-y-to":he()}],"mask-image-y-from-color":[{"mask-y-from":M()}],"mask-image-y-to-color":[{"mask-y-to":M()}],"mask-image-radial":[{"mask-radial":[Me,Te]}],"mask-image-radial-from-pos":[{"mask-radial-from":he()}],"mask-image-radial-to-pos":[{"mask-radial-to":he()}],"mask-image-radial-from-color":[{"mask-radial-from":M()}],"mask-image-radial-to-color":[{"mask-radial-to":M()}],"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":N()}],"mask-image-conic-pos":[{"mask-conic":[qe]}],"mask-image-conic-from-pos":[{"mask-conic-from":he()}],"mask-image-conic-to-pos":[{"mask-conic-to":he()}],"mask-image-conic-from-color":[{"mask-conic-from":M()}],"mask-image-conic-to-color":[{"mask-conic-to":M()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:I()}],"mask-repeat":[{mask:X()}],"mask-size":[{mask:L()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Me,Te]}],filter:[{filter:["","none",Me,Te]}],blur:[{blur:ve()}],brightness:[{brightness:[qe,Me,Te]}],contrast:[{contrast:[qe,Me,Te]}],"drop-shadow":[{"drop-shadow":["","none",y,Sh,xh]}],"drop-shadow-color":[{"drop-shadow":M()}],grayscale:[{grayscale:["",qe,Me,Te]}],"hue-rotate":[{"hue-rotate":[qe,Me,Te]}],invert:[{invert:["",qe,Me,Te]}],saturate:[{saturate:[qe,Me,Te]}],sepia:[{sepia:["",qe,Me,Te]}],"backdrop-filter":[{"backdrop-filter":["","none",Me,Te]}],"backdrop-blur":[{"backdrop-blur":ve()}],"backdrop-brightness":[{"backdrop-brightness":[qe,Me,Te]}],"backdrop-contrast":[{"backdrop-contrast":[qe,Me,Te]}],"backdrop-grayscale":[{"backdrop-grayscale":["",qe,Me,Te]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[qe,Me,Te]}],"backdrop-invert":[{"backdrop-invert":["",qe,Me,Te]}],"backdrop-opacity":[{"backdrop-opacity":[qe,Me,Te]}],"backdrop-saturate":[{"backdrop-saturate":[qe,Me,Te]}],"backdrop-sepia":[{"backdrop-sepia":["",qe,Me,Te]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":B()}],"border-spacing-x":[{"border-spacing-x":B()}],"border-spacing-y":[{"border-spacing-y":B()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Me,Te]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[qe,"initial",Me,Te]}],ease:[{ease:["linear","initial",k,Me,Te]}],delay:[{delay:[qe,Me,Te]}],animate:[{animate:["none",T,Me,Te]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[S,Me,Te]}],"perspective-origin":[{"perspective-origin":j()}],rotate:[{rotate:Ce()}],"rotate-x":[{"rotate-x":Ce()}],"rotate-y":[{"rotate-y":Ce()}],"rotate-z":[{"rotate-z":Ce()}],scale:[{scale:ce()}],"scale-x":[{"scale-x":ce()}],"scale-y":[{"scale-y":ce()}],"scale-z":[{"scale-z":ce()}],"scale-3d":["scale-3d"],skew:[{skew:_e()}],"skew-x":[{"skew-x":_e()}],"skew-y":[{"skew-y":_e()}],transform:[{transform:[Me,Te,"","none","gpu","cpu"]}],"transform-origin":[{origin:j()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Le()}],"translate-x":[{"translate-x":Le()}],"translate-y":[{"translate-y":Le()}],"translate-z":[{"translate-z":Le()}],"translate-none":["translate-none"],accent:[{accent:M()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:M()}],"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",Me,Te]}],"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":B()}],"scroll-mx":[{"scroll-mx":B()}],"scroll-my":[{"scroll-my":B()}],"scroll-ms":[{"scroll-ms":B()}],"scroll-me":[{"scroll-me":B()}],"scroll-mbs":[{"scroll-mbs":B()}],"scroll-mbe":[{"scroll-mbe":B()}],"scroll-mt":[{"scroll-mt":B()}],"scroll-mr":[{"scroll-mr":B()}],"scroll-mb":[{"scroll-mb":B()}],"scroll-ml":[{"scroll-ml":B()}],"scroll-p":[{"scroll-p":B()}],"scroll-px":[{"scroll-px":B()}],"scroll-py":[{"scroll-py":B()}],"scroll-ps":[{"scroll-ps":B()}],"scroll-pe":[{"scroll-pe":B()}],"scroll-pbs":[{"scroll-pbs":B()}],"scroll-pbe":[{"scroll-pbe":B()}],"scroll-pt":[{"scroll-pt":B()}],"scroll-pr":[{"scroll-pr":B()}],"scroll-pb":[{"scroll-pb":B()}],"scroll-pl":[{"scroll-pl":B()}],"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",Me,Te]}],fill:[{fill:["none",...M()]}],"stroke-w":[{stroke:[qe,Ic,Lo,Kw]}],stroke:[{stroke:["none",...M()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},bj=QL(yj);function xe(...e){return bj(YE(e))}function Xw(e){return e.startsWith("chatId:")?e.slice(7):e}const hu=AL("touch-manipulation inline-flex items-center justify-center whitespace-nowrap cursor-pointer rounded-md text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none",{variants:{variant:{default:"bg-primary text-primary-foreground disabled:bg-primary/50 disabled:text-primary-foreground/90 hover:bg-primary/90",juicy:"bg-logo text-primary-foreground disabled:text-primary-foreground/50 hover:bg-logo/90",destructive:"bg-destructive/80 dark:text-white",outline:"border disabled:bg-transparent disabled:text-foreground/50 border-inpu disabled:border-input/90 bg-card hover:bg-muted hover:text-accent-foreground",secondary:"bg-transparent border border-border text-secondary-foreground hover:text-secondary-foreground/60 disabled:text-secondary-foreground/50",ghost:"hover:bg-accent dark:hover:bg-card hover:text-accent-foreground text-muted-foreground disabled:text-muted-foreground/50 border border-border/0 hover:border-border",link:"text-primary disabled:text-primary/50 underline-offset-4 hover:underline",none:""},size:{default:"h-10 px-4 rounded-full py-2",sm:"h-9 rounded-full px-3",lg:"h-11 rounded-full px-8",icon:"h-10 w-10 rounded-lg","icon-sm":"h-5.5 w-5.5 rounded-md"}},defaultVariants:{variant:"default",size:"default"}}),nt=b.forwardRef(({className:e,variant:t,size:n,...r},s)=>g.jsx("button",{className:xe(hu({variant:t,size:n,className:e})),ref:s,...r}));nt.displayName="Button";function Ee(e,t,{checkForDefaultPrevented:n=!0}={}){return function(s){if(e==null||e(s),n===!1||!s.defaultPrevented)return t==null?void 0:t(s)}}function Zw(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function eb(...e){return t=>{let n=!1;const r=e.map(s=>{const l=Zw(s,t);return!n&&typeof l=="function"&&(n=!0),l});if(n)return()=>{for(let s=0;s<r.length;s++){const l=r[s];typeof l=="function"?l():Zw(e[s],null)}}}}function dt(...e){return b.useCallback(eb(...e),e)}function xj(e,t){const n=b.createContext(t),r=l=>{const{children:a,...u}=l,h=b.useMemo(()=>u,Object.values(u));return g.jsx(n.Provider,{value:h,children:a})};r.displayName=e+"Provider";function s(l){const a=b.useContext(n);if(a)return a;if(t!==void 0)return t;throw new Error(`\`${l}\` must be used within \`${e}\``)}return[r,s]}function ms(e,t=[]){let n=[];function r(l,a){const u=b.createContext(a),h=n.length;n=[...n,a];const d=m=>{var k;const{scope:_,children:y,...w}=m,S=((k=_==null?void 0:_[e])==null?void 0:k[h])||u,C=b.useMemo(()=>w,Object.values(w));return g.jsx(S.Provider,{value:C,children:y})};d.displayName=l+"Provider";function p(m,_){var S;const y=((S=_==null?void 0:_[e])==null?void 0:S[h])||u,w=b.useContext(y);if(w)return w;if(a!==void 0)return a;throw new Error(`\`${m}\` must be used within \`${l}\``)}return[d,p]}const s=()=>{const l=n.map(a=>b.createContext(a));return function(u){const h=(u==null?void 0:u[e])||l;return b.useMemo(()=>({[`__scope${e}`]:{...u,[e]:h}}),[u,h])}};return s.scopeName=e,[r,Sj(s,...t)]}function Sj(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(l){const a=r.reduce((u,{useScope:h,scopeName:d})=>{const m=h(l)[`__scope${d}`];return{...u,...m}},{});return b.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])}};return n.scopeName=t.scopeName,n}var zn=globalThis!=null&&globalThis.document?b.useLayoutEffect:()=>{},wj=EE[" useId ".trim().toString()]||(()=>{}),Cj=0;function cs(e){const[t,n]=b.useState(wj());return zn(()=>{n(r=>r??String(Cj++))},[e]),t?`radix-${t}`:""}var kj=EE[" useInsertionEffect ".trim().toString()]||zn;function ba({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[s,l,a]=Ej({defaultProp:t,onChange:n}),u=e!==void 0,h=u?e:s;{const p=b.useRef(e!==void 0);b.useEffect(()=>{const m=p.current;m!==u&&console.warn(`${r} is changing from ${m?"controlled":"uncontrolled"} to ${u?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),p.current=u},[u,r])}const d=b.useCallback(p=>{var m;if(u){const _=Rj(p)?p(e):p;_!==e&&((m=a.current)==null||m.call(a,_))}else l(p)},[u,e,l,a]);return[h,d]}function Ej({defaultProp:e,onChange:t}){const[n,r]=b.useState(e),s=b.useRef(n),l=b.useRef(t);return kj(()=>{l.current=t},[t]),b.useEffect(()=>{var a;s.current!==n&&((a=l.current)==null||a.call(l,n),s.current=n)},[n,s]),[n,r,l]}function Rj(e){return typeof e=="function"}function Xo(e){const t=Tj(e),n=b.forwardRef((r,s)=>{const{children:l,...a}=r,u=b.Children.toArray(l),h=u.find(Nj);if(h){const d=h.props.children,p=u.map(m=>m===h?b.Children.count(d)>1?b.Children.only(null):b.isValidElement(d)?d.props.children:null:m);return g.jsx(t,{...a,ref:s,children:b.isValidElement(d)?b.cloneElement(d,void 0,p):null})}return g.jsx(t,{...a,ref:s,children:l})});return n.displayName=`${e}.Slot`,n}function Tj(e){const t=b.forwardRef((n,r)=>{const{children:s,...l}=n;if(b.isValidElement(s)){const a=Dj(s),u=Aj(l,s.props);return s.type!==b.Fragment&&(u.ref=r?eb(r,a):a),b.cloneElement(s,u)}return b.Children.count(s)>1?b.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var uR=Symbol("radix.slottable");function Mj(e){const t=({children:n})=>g.jsx(g.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=uR,t}function Nj(e){return b.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===uR}function Aj(e,t){const n={...t};for(const r in t){const s=e[r],l=t[r];/^on[A-Z]/.test(r)?s&&l?n[r]=(...u)=>{const h=l(...u);return s(...u),h}:s&&(n[r]=s):r==="style"?n[r]={...s,...l}:r==="className"&&(n[r]=[s,l].filter(Boolean).join(" "))}return{...e,...n}}function Dj(e){var r,s;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Oj=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Je=Oj.reduce((e,t)=>{const n=Xo(`Primitive.${t}`),r=b.forwardRef((s,l)=>{const{asChild:a,...u}=s,h=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),g.jsx(h,{...u,ref:l})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function dR(e,t){e&&wi.flushSync(()=>e.dispatchEvent(t))}function li(e){const t=b.useRef(e);return b.useEffect(()=>{t.current=e}),b.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function Lj(e,t=globalThis==null?void 0:globalThis.document){const n=li(e);b.useEffect(()=>{const r=s=>{s.key==="Escape"&&n(s)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var jj="DismissableLayer",h_="dismissableLayer.update",zj="dismissableLayer.pointerDownOutside",Pj="dismissableLayer.focusOutside",Qw,hR=b.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Aa=b.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:s,onFocusOutside:l,onInteractOutside:a,onDismiss:u,...h}=e,d=b.useContext(hR),[p,m]=b.useState(null),_=(p==null?void 0:p.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,y]=b.useState({}),w=dt(t,D=>m(D)),S=Array.from(d.layers),[C]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),k=S.indexOf(C),T=p?S.indexOf(p):-1,R=d.layersWithOutsidePointerEventsDisabled.size>0,N=T>=k,j=Hj(D=>{const B=D.target,K=[...d.branches].some(z=>z.contains(B));!N||K||(s==null||s(D),a==null||a(D),D.defaultPrevented||u==null||u())},_),A=Fj(D=>{const B=D.target;[...d.branches].some(z=>z.contains(B))||(l==null||l(D),a==null||a(D),D.defaultPrevented||u==null||u())},_);return Lj(D=>{T===d.layers.size-1&&(r==null||r(D),!D.defaultPrevented&&u&&(D.preventDefault(),u()))},_),b.useEffect(()=>{if(p)return n&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(Qw=_.body.style.pointerEvents,_.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(p)),d.layers.add(p),Jw(),()=>{n&&d.layersWithOutsidePointerEventsDisabled.size===1&&(_.body.style.pointerEvents=Qw)}},[p,_,n,d]),b.useEffect(()=>()=>{p&&(d.layers.delete(p),d.layersWithOutsidePointerEventsDisabled.delete(p),Jw())},[p,d]),b.useEffect(()=>{const D=()=>y({});return document.addEventListener(h_,D),()=>document.removeEventListener(h_,D)},[]),g.jsx(Je.div,{...h,ref:w,style:{pointerEvents:R?N?"auto":"none":void 0,...e.style},onFocusCapture:Ee(e.onFocusCapture,A.onFocusCapture),onBlurCapture:Ee(e.onBlurCapture,A.onBlurCapture),onPointerDownCapture:Ee(e.onPointerDownCapture,j.onPointerDownCapture)})});Aa.displayName=jj;var Bj="DismissableLayerBranch",Ij=b.forwardRef((e,t)=>{const n=b.useContext(hR),r=b.useRef(null),s=dt(t,r);return b.useEffect(()=>{const l=r.current;if(l)return n.branches.add(l),()=>{n.branches.delete(l)}},[n.branches]),g.jsx(Je.div,{...e,ref:s})});Ij.displayName=Bj;function Hj(e,t=globalThis==null?void 0:globalThis.document){const n=li(e),r=b.useRef(!1),s=b.useRef(()=>{});return b.useEffect(()=>{const l=u=>{if(u.target&&!r.current){let h=function(){fR(zj,n,d,{discrete:!0})};const d={originalEvent:u};u.pointerType==="touch"?(t.removeEventListener("click",s.current),s.current=h,t.addEventListener("click",s.current,{once:!0})):h()}else t.removeEventListener("click",s.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener("pointerdown",l)},0);return()=>{window.clearTimeout(a),t.removeEventListener("pointerdown",l),t.removeEventListener("click",s.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function Fj(e,t=globalThis==null?void 0:globalThis.document){const n=li(e),r=b.useRef(!1);return b.useEffect(()=>{const s=l=>{l.target&&!r.current&&fR(Pj,n,{originalEvent:l},{discrete:!1})};return t.addEventListener("focusin",s),()=>t.removeEventListener("focusin",s)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Jw(){const e=new CustomEvent(h_);document.dispatchEvent(e)}function fR(e,t,n,{discrete:r}){const s=n.originalEvent.target,l=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&s.addEventListener(e,t,{once:!0}),r?dR(s,l):s.dispatchEvent(l)}var lv="focusScope.autoFocusOnMount",av="focusScope.autoFocusOnUnmount",eC={bubbles:!1,cancelable:!0},Uj="FocusScope",Fu=b.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:s,onUnmountAutoFocus:l,...a}=e,[u,h]=b.useState(null),d=li(s),p=li(l),m=b.useRef(null),_=dt(t,S=>h(S)),y=b.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;b.useEffect(()=>{if(r){let S=function(R){if(y.paused||!u)return;const N=R.target;u.contains(N)?m.current=N:Zs(m.current,{select:!0})},C=function(R){if(y.paused||!u)return;const N=R.relatedTarget;N!==null&&(u.contains(N)||Zs(m.current,{select:!0}))},k=function(R){if(document.activeElement===document.body)for(const j of R)j.removedNodes.length>0&&Zs(u)};document.addEventListener("focusin",S),document.addEventListener("focusout",C);const T=new MutationObserver(k);return u&&T.observe(u,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",S),document.removeEventListener("focusout",C),T.disconnect()}}},[r,u,y.paused]),b.useEffect(()=>{if(u){nC.add(y);const S=document.activeElement;if(!u.contains(S)){const k=new CustomEvent(lv,eC);u.addEventListener(lv,d),u.dispatchEvent(k),k.defaultPrevented||($j(Gj(pR(u)),{select:!0}),document.activeElement===S&&Zs(u))}return()=>{u.removeEventListener(lv,d),setTimeout(()=>{const k=new CustomEvent(av,eC);u.addEventListener(av,p),u.dispatchEvent(k),k.defaultPrevented||Zs(S??document.body,{select:!0}),u.removeEventListener(av,p),nC.remove(y)},0)}}},[u,d,p,y]);const w=b.useCallback(S=>{if(!n&&!r||y.paused)return;const C=S.key==="Tab"&&!S.altKey&&!S.ctrlKey&&!S.metaKey,k=document.activeElement;if(C&&k){const T=S.currentTarget,[R,N]=Wj(T);R&&N?!S.shiftKey&&k===N?(S.preventDefault(),n&&Zs(R,{select:!0})):S.shiftKey&&k===R&&(S.preventDefault(),n&&Zs(N,{select:!0})):k===T&&S.preventDefault()}},[n,r,y.paused]);return g.jsx(Je.div,{tabIndex:-1,...a,ref:_,onKeyDown:w})});Fu.displayName=Uj;function $j(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Zs(r,{select:t}),document.activeElement!==n)return}function Wj(e){const t=pR(e),n=tC(t,e),r=tC(t.reverse(),e);return[n,r]}function pR(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const s=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||s?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function tC(e,t){for(const n of e)if(!Vj(n,{upTo:t}))return n}function Vj(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function qj(e){return e instanceof HTMLInputElement&&"select"in e}function Zs(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&qj(e)&&t&&e.select()}}var nC=Kj();function Kj(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=rC(e,t),e.unshift(t)},remove(t){var n;e=rC(e,t),(n=e[0])==null||n.resume()}}}function rC(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function Gj(e){return e.filter(t=>t.tagName!=="A")}var Yj="Portal",Da=b.forwardRef((e,t)=>{var u;const{container:n,...r}=e,[s,l]=b.useState(!1);zn(()=>l(!0),[]);const a=n||s&&((u=globalThis==null?void 0:globalThis.document)==null?void 0:u.body);return a?NL.createPortal(g.jsx(Je.div,{...r,ref:t}),a):null});Da.displayName=Yj;function Xj(e,t){return b.useReducer((n,r)=>t[n][r]??n,e)}var Yr=e=>{const{present:t,children:n}=e,r=Zj(t),s=typeof n=="function"?n({present:r.isPresent}):b.Children.only(n),l=dt(r.ref,Qj(s));return typeof n=="function"||r.isPresent?b.cloneElement(s,{ref:l}):null};Yr.displayName="Presence";function Zj(e){const[t,n]=b.useState(),r=b.useRef(null),s=b.useRef(e),l=b.useRef("none"),a=e?"mounted":"unmounted",[u,h]=Xj(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return b.useEffect(()=>{const d=wh(r.current);l.current=u==="mounted"?d:"none"},[u]),zn(()=>{const d=r.current,p=s.current;if(p!==e){const _=l.current,y=wh(d);e?h("MOUNT"):y==="none"||(d==null?void 0:d.display)==="none"?h("UNMOUNT"):h(p&&_!==y?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,h]),zn(()=>{if(t){let d;const p=t.ownerDocument.defaultView??window,m=y=>{const S=wh(r.current).includes(CSS.escape(y.animationName));if(y.target===t&&S&&(h("ANIMATION_END"),!s.current)){const C=t.style.animationFillMode;t.style.animationFillMode="forwards",d=p.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=C)})}},_=y=>{y.target===t&&(l.current=wh(r.current))};return t.addEventListener("animationstart",_),t.addEventListener("animationcancel",m),t.addEventListener("animationend",m),()=>{p.clearTimeout(d),t.removeEventListener("animationstart",_),t.removeEventListener("animationcancel",m),t.removeEventListener("animationend",m)}}else h("ANIMATION_END")},[t,h]),{isPresent:["mounted","unmountSuspended"].includes(u),ref:b.useCallback(d=>{r.current=d?getComputedStyle(d):null,n(d)},[])}}function wh(e){return(e==null?void 0:e.animationName)||"none"}function Qj(e){var r,s;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var cv=0;function ip(){b.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??iC()),document.body.insertAdjacentElement("beforeend",e[1]??iC()),cv++,()=>{cv===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),cv--}},[])}function iC(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Si=function(){return Si=Object.assign||function(t){for(var n,r=1,s=arguments.length;r<s;r++){n=arguments[r];for(var l in n)Object.prototype.hasOwnProperty.call(n,l)&&(t[l]=n[l])}return t},Si.apply(this,arguments)};function mR(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(e);s<r.length;s++)t.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(e,r[s])&&(n[r[s]]=e[r[s]]);return n}function Jj(e,t,n){if(n||arguments.length===2)for(var r=0,s=t.length,l;r<s;r++)(l||!(r in t))&&(l||(l=Array.prototype.slice.call(t,0,r)),l[r]=t[r]);return e.concat(l||Array.prototype.slice.call(t))}var Qh="right-scroll-bar-position",Jh="width-before-scroll-bar",ez="with-scroll-bars-hidden",tz="--removed-body-scroll-bar-size";function uv(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function nz(e,t){var n=b.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var s=n.value;s!==r&&(n.value=r,n.callback(r,s))}}}})[0];return n.callback=t,n.facade}var rz=typeof window<"u"?b.useLayoutEffect:b.useEffect,sC=new WeakMap;function iz(e,t){var n=nz(null,function(r){return e.forEach(function(s){return uv(s,r)})});return rz(function(){var r=sC.get(n);if(r){var s=new Set(r),l=new Set(e),a=n.current;s.forEach(function(u){l.has(u)||uv(u,null)}),l.forEach(function(u){s.has(u)||uv(u,a)})}sC.set(n,e)},[e]),n}function sz(e){return e}function oz(e,t){t===void 0&&(t=sz);var n=[],r=!1,s={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(l){var a=t(l,r);return n.push(a),function(){n=n.filter(function(u){return u!==a})}},assignSyncMedium:function(l){for(r=!0;n.length;){var a=n;n=[],a.forEach(l)}n={push:function(u){return l(u)},filter:function(){return n}}},assignMedium:function(l){r=!0;var a=[];if(n.length){var u=n;n=[],u.forEach(l),a=n}var h=function(){var p=a;a=[],p.forEach(l)},d=function(){return Promise.resolve().then(h)};d(),n={push:function(p){a.push(p),d()},filter:function(p){return a=a.filter(p),n}}}};return s}function lz(e){e===void 0&&(e={});var t=oz(null);return t.options=Si({async:!0,ssr:!1},e),t}var gR=function(e){var t=e.sideCar,n=mR(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return b.createElement(r,Si({},n))};gR.isSideCarExport=!0;function az(e,t){return e.useMedium(t),gR}var vR=lz(),dv=function(){},sp=b.forwardRef(function(e,t){var n=b.useRef(null),r=b.useState({onScrollCapture:dv,onWheelCapture:dv,onTouchMoveCapture:dv}),s=r[0],l=r[1],a=e.forwardProps,u=e.children,h=e.className,d=e.removeScrollBar,p=e.enabled,m=e.shards,_=e.sideCar,y=e.noRelative,w=e.noIsolation,S=e.inert,C=e.allowPinchZoom,k=e.as,T=k===void 0?"div":k,R=e.gapMode,N=mR(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),j=_,A=iz([n,t]),D=Si(Si({},N),s);return b.createElement(b.Fragment,null,p&&b.createElement(j,{sideCar:vR,removeScrollBar:d,shards:m,noRelative:y,noIsolation:w,inert:S,setCallbacks:l,allowPinchZoom:!!C,lockRef:n,gapMode:R}),a?b.cloneElement(b.Children.only(u),Si(Si({},D),{ref:A})):b.createElement(T,Si({},D,{className:h,ref:A}),u))});sp.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};sp.classNames={fullWidth:Jh,zeroRight:Qh};var cz=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function uz(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=cz();return t&&e.setAttribute("nonce",t),e}function dz(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function hz(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var fz=function(){var e=0,t=null;return{add:function(n){e==0&&(t=uz())&&(dz(t,n),hz(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},pz=function(){var e=fz();return function(t,n){b.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},_R=function(){var e=pz(),t=function(n){var r=n.styles,s=n.dynamic;return e(r,s),null};return t},mz={left:0,top:0,right:0,gap:0},hv=function(e){return parseInt(e||"",10)||0},gz=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],s=t[e==="padding"?"paddingRight":"marginRight"];return[hv(n),hv(r),hv(s)]},vz=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return mz;var t=gz(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},_z=_R(),pa="data-scroll-locked",yz=function(e,t,n,r){var s=e.left,l=e.top,a=e.right,u=e.gap;return n===void 0&&(n="margin"),`
61
+ .`.concat(ez,` {
62
+ overflow: hidden `).concat(r,`;
63
+ padding-right: `).concat(u,"px ").concat(r,`;
64
+ }
65
+ body[`).concat(pa,`] {
66
+ overflow: hidden `).concat(r,`;
67
+ overscroll-behavior: contain;
68
+ `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
69
+ padding-left: `.concat(s,`px;
70
+ padding-top: `).concat(l,`px;
71
+ padding-right: `).concat(a,`px;
72
+ margin-left:0;
73
+ margin-top:0;
74
+ margin-right: `).concat(u,"px ").concat(r,`;
75
+ `),n==="padding"&&"padding-right: ".concat(u,"px ").concat(r,";")].filter(Boolean).join(""),`
76
+ }
77
+
78
+ .`).concat(Qh,` {
79
+ right: `).concat(u,"px ").concat(r,`;
80
+ }
81
+
82
+ .`).concat(Jh,` {
83
+ margin-right: `).concat(u,"px ").concat(r,`;
84
+ }
85
+
86
+ .`).concat(Qh," .").concat(Qh,` {
87
+ right: 0 `).concat(r,`;
88
+ }
89
+
90
+ .`).concat(Jh," .").concat(Jh,` {
91
+ margin-right: 0 `).concat(r,`;
92
+ }
93
+
94
+ body[`).concat(pa,`] {
95
+ `).concat(tz,": ").concat(u,`px;
96
+ }
97
+ `)},oC=function(){var e=parseInt(document.body.getAttribute(pa)||"0",10);return isFinite(e)?e:0},bz=function(){b.useEffect(function(){return document.body.setAttribute(pa,(oC()+1).toString()),function(){var e=oC()-1;e<=0?document.body.removeAttribute(pa):document.body.setAttribute(pa,e.toString())}},[])},xz=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,s=r===void 0?"margin":r;bz();var l=b.useMemo(function(){return vz(s)},[s]);return b.createElement(_z,{styles:yz(l,!t,s,n?"":"!important")})},f_=!1;if(typeof window<"u")try{var Ch=Object.defineProperty({},"passive",{get:function(){return f_=!0,!0}});window.addEventListener("test",Ch,Ch),window.removeEventListener("test",Ch,Ch)}catch{f_=!1}var Jl=f_?{passive:!1}:!1,Sz=function(e){return e.tagName==="TEXTAREA"},yR=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!Sz(e)&&n[t]==="visible")},wz=function(e){return yR(e,"overflowY")},Cz=function(e){return yR(e,"overflowX")},lC=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var s=bR(e,r);if(s){var l=xR(e,r),a=l[1],u=l[2];if(a>u)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},kz=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},Ez=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},bR=function(e,t){return e==="v"?wz(t):Cz(t)},xR=function(e,t){return e==="v"?kz(t):Ez(t)},Rz=function(e,t){return e==="h"&&t==="rtl"?-1:1},Tz=function(e,t,n,r,s){var l=Rz(e,window.getComputedStyle(t).direction),a=l*r,u=n.target,h=t.contains(u),d=!1,p=a>0,m=0,_=0;do{if(!u)break;var y=xR(e,u),w=y[0],S=y[1],C=y[2],k=S-C-l*w;(w||k)&&bR(e,u)&&(m+=k,_+=w);var T=u.parentNode;u=T&&T.nodeType===Node.DOCUMENT_FRAGMENT_NODE?T.host:T}while(!h&&u!==document.body||h&&(t.contains(u)||t===u));return(p&&Math.abs(m)<1||!p&&Math.abs(_)<1)&&(d=!0),d},kh=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},aC=function(e){return[e.deltaX,e.deltaY]},cC=function(e){return e&&"current"in e?e.current:e},Mz=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Nz=function(e){return`
98
+ .block-interactivity-`.concat(e,` {pointer-events: none;}
99
+ .allow-interactivity-`).concat(e,` {pointer-events: all;}
100
+ `)},Az=0,ea=[];function Dz(e){var t=b.useRef([]),n=b.useRef([0,0]),r=b.useRef(),s=b.useState(Az++)[0],l=b.useState(_R)[0],a=b.useRef(e);b.useEffect(function(){a.current=e},[e]),b.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var S=Jj([e.lockRef.current],(e.shards||[]).map(cC),!0).filter(Boolean);return S.forEach(function(C){return C.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),S.forEach(function(C){return C.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var u=b.useCallback(function(S,C){if("touches"in S&&S.touches.length===2||S.type==="wheel"&&S.ctrlKey)return!a.current.allowPinchZoom;var k=kh(S),T=n.current,R="deltaX"in S?S.deltaX:T[0]-k[0],N="deltaY"in S?S.deltaY:T[1]-k[1],j,A=S.target,D=Math.abs(R)>Math.abs(N)?"h":"v";if("touches"in S&&D==="h"&&A.type==="range")return!1;var B=window.getSelection(),K=B&&B.anchorNode,z=K?K===A||K.contains(A):!1;if(z)return!1;var U=lC(D,A);if(!U)return!0;if(U?j=D:(j=D==="v"?"h":"v",U=lC(D,A)),!U)return!1;if(!r.current&&"changedTouches"in S&&(R||N)&&(r.current=j),!j)return!0;var H=r.current||j;return Tz(H,C,S,H==="h"?R:N)},[]),h=b.useCallback(function(S){var C=S;if(!(!ea.length||ea[ea.length-1]!==l)){var k="deltaY"in C?aC(C):kh(C),T=t.current.filter(function(j){return j.name===C.type&&(j.target===C.target||C.target===j.shadowParent)&&Mz(j.delta,k)})[0];if(T&&T.should){C.cancelable&&C.preventDefault();return}if(!T){var R=(a.current.shards||[]).map(cC).filter(Boolean).filter(function(j){return j.contains(C.target)}),N=R.length>0?u(C,R[0]):!a.current.noIsolation;N&&C.cancelable&&C.preventDefault()}}},[]),d=b.useCallback(function(S,C,k,T){var R={name:S,delta:C,target:k,should:T,shadowParent:Oz(k)};t.current.push(R),setTimeout(function(){t.current=t.current.filter(function(N){return N!==R})},1)},[]),p=b.useCallback(function(S){n.current=kh(S),r.current=void 0},[]),m=b.useCallback(function(S){d(S.type,aC(S),S.target,u(S,e.lockRef.current))},[]),_=b.useCallback(function(S){d(S.type,kh(S),S.target,u(S,e.lockRef.current))},[]);b.useEffect(function(){return ea.push(l),e.setCallbacks({onScrollCapture:m,onWheelCapture:m,onTouchMoveCapture:_}),document.addEventListener("wheel",h,Jl),document.addEventListener("touchmove",h,Jl),document.addEventListener("touchstart",p,Jl),function(){ea=ea.filter(function(S){return S!==l}),document.removeEventListener("wheel",h,Jl),document.removeEventListener("touchmove",h,Jl),document.removeEventListener("touchstart",p,Jl)}},[]);var y=e.removeScrollBar,w=e.inert;return b.createElement(b.Fragment,null,w?b.createElement(l,{styles:Nz(s)}):null,y?b.createElement(xz,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Oz(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const Lz=az(vR,Dz);var Uu=b.forwardRef(function(e,t){return b.createElement(sp,Si({},e,{ref:t,sideCar:Lz}))});Uu.classNames=sp.classNames;var jz=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},ta=new WeakMap,Eh=new WeakMap,Rh={},fv=0,SR=function(e){return e&&(e.host||SR(e.parentNode))},zz=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=SR(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},Pz=function(e,t,n,r){var s=zz(t,Array.isArray(e)?e:[e]);Rh[n]||(Rh[n]=new WeakMap);var l=Rh[n],a=[],u=new Set,h=new Set(s),d=function(m){!m||u.has(m)||(u.add(m),d(m.parentNode))};s.forEach(d);var p=function(m){!m||h.has(m)||Array.prototype.forEach.call(m.children,function(_){if(u.has(_))p(_);else try{var y=_.getAttribute(r),w=y!==null&&y!=="false",S=(ta.get(_)||0)+1,C=(l.get(_)||0)+1;ta.set(_,S),l.set(_,C),a.push(_),S===1&&w&&Eh.set(_,!0),C===1&&_.setAttribute(n,"true"),w||_.setAttribute(r,"true")}catch(k){console.error("aria-hidden: cannot operate on ",_,k)}})};return p(t),u.clear(),fv++,function(){a.forEach(function(m){var _=ta.get(m)-1,y=l.get(m)-1;ta.set(m,_),l.set(m,y),_||(Eh.has(m)||m.removeAttribute(r),Eh.delete(m)),y||m.removeAttribute(n)}),fv--,fv||(ta=new WeakMap,ta=new WeakMap,Eh=new WeakMap,Rh={})}},op=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),s=jz(e);return s?(r.push.apply(r,Array.from(s.querySelectorAll("[aria-live], script"))),Pz(r,s,n,"aria-hidden")):function(){return null}},lp="Dialog",[wR]=ms(lp),[Bz,hi]=wR(lp),CR=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:s,onOpenChange:l,modal:a=!0}=e,u=b.useRef(null),h=b.useRef(null),[d,p]=ba({prop:r,defaultProp:s??!1,onChange:l,caller:lp});return g.jsx(Bz,{scope:t,triggerRef:u,contentRef:h,contentId:cs(),titleId:cs(),descriptionId:cs(),open:d,onOpenChange:p,onOpenToggle:b.useCallback(()=>p(m=>!m),[p]),modal:a,children:n})};CR.displayName=lp;var kR="DialogTrigger",Iz=b.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=hi(kR,n),l=dt(t,s.triggerRef);return g.jsx(Je.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":rb(s.open),...r,ref:l,onClick:Ee(e.onClick,s.onOpenToggle)})});Iz.displayName=kR;var tb="DialogPortal",[Hz,ER]=wR(tb,{forceMount:void 0}),RR=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:s}=e,l=hi(tb,t);return g.jsx(Hz,{scope:t,forceMount:n,children:b.Children.map(r,a=>g.jsx(Yr,{present:n||l.open,children:g.jsx(Da,{asChild:!0,container:s,children:a})}))})};RR.displayName=tb;var xf="DialogOverlay",TR=b.forwardRef((e,t)=>{const n=ER(xf,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,l=hi(xf,e.__scopeDialog);return l.modal?g.jsx(Yr,{present:r||l.open,children:g.jsx(Uz,{...s,ref:t})}):null});TR.displayName=xf;var Fz=Xo("DialogOverlay.RemoveScroll"),Uz=b.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=hi(xf,n);return g.jsx(Uu,{as:Fz,allowPinchZoom:!0,shards:[s.contentRef],children:g.jsx(Je.div,{"data-state":rb(s.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),Zo="DialogContent",MR=b.forwardRef((e,t)=>{const n=ER(Zo,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,l=hi(Zo,e.__scopeDialog);return g.jsx(Yr,{present:r||l.open,children:l.modal?g.jsx($z,{...s,ref:t}):g.jsx(Wz,{...s,ref:t})})});MR.displayName=Zo;var $z=b.forwardRef((e,t)=>{const n=hi(Zo,e.__scopeDialog),r=b.useRef(null),s=dt(t,n.contentRef,r);return b.useEffect(()=>{const l=r.current;if(l)return op(l)},[]),g.jsx(NR,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ee(e.onCloseAutoFocus,l=>{var a;l.preventDefault(),(a=n.triggerRef.current)==null||a.focus()}),onPointerDownOutside:Ee(e.onPointerDownOutside,l=>{const a=l.detail.originalEvent,u=a.button===0&&a.ctrlKey===!0;(a.button===2||u)&&l.preventDefault()}),onFocusOutside:Ee(e.onFocusOutside,l=>l.preventDefault())})}),Wz=b.forwardRef((e,t)=>{const n=hi(Zo,e.__scopeDialog),r=b.useRef(!1),s=b.useRef(!1);return g.jsx(NR,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:l=>{var a,u;(a=e.onCloseAutoFocus)==null||a.call(e,l),l.defaultPrevented||(r.current||(u=n.triggerRef.current)==null||u.focus(),l.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:l=>{var h,d;(h=e.onInteractOutside)==null||h.call(e,l),l.defaultPrevented||(r.current=!0,l.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const a=l.target;((d=n.triggerRef.current)==null?void 0:d.contains(a))&&l.preventDefault(),l.detail.originalEvent.type==="focusin"&&s.current&&l.preventDefault()}})}),NR=b.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:l,...a}=e,u=hi(Zo,n),h=b.useRef(null),d=dt(t,h);return ip(),g.jsxs(g.Fragment,{children:[g.jsx(Fu,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:l,children:g.jsx(Aa,{role:"dialog",id:u.contentId,"aria-describedby":u.descriptionId,"aria-labelledby":u.titleId,"data-state":rb(u.open),...a,ref:d,onDismiss:()=>u.onOpenChange(!1)})}),g.jsxs(g.Fragment,{children:[g.jsx(Vz,{titleId:u.titleId}),g.jsx(Kz,{contentRef:h,descriptionId:u.descriptionId})]})]})}),nb="DialogTitle",AR=b.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=hi(nb,n);return g.jsx(Je.h2,{id:s.titleId,...r,ref:t})});AR.displayName=nb;var DR="DialogDescription",OR=b.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=hi(DR,n);return g.jsx(Je.p,{id:s.descriptionId,...r,ref:t})});OR.displayName=DR;var LR="DialogClose",jR=b.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=hi(LR,n);return g.jsx(Je.button,{type:"button",...r,ref:t,onClick:Ee(e.onClick,()=>s.onOpenChange(!1))})});jR.displayName=LR;function rb(e){return e?"open":"closed"}var zR="DialogTitleWarning",[xee,PR]=xj(zR,{contentName:Zo,titleName:nb,docsSlug:"dialog"}),Vz=({titleId:e})=>{const t=PR(zR),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
101
+
102
+ If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
103
+
104
+ For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return b.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},qz="DialogDescriptionWarning",Kz=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${PR(qz).contentName}}.`;return b.useEffect(()=>{var l;const s=(l=e.current)==null?void 0:l.getAttribute("aria-describedby");t&&s&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},Gz=CR,Yz=RR,BR=TR,IR=MR,Xz=AR,Zz=OR,Qz=jR;/**
105
+ * @license lucide-react v0.562.0 - ISC
106
+ *
107
+ * This source code is licensed under the ISC license.
108
+ * See the LICENSE file in the root directory of this source tree.
109
+ */const Jz=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),e6=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),uC=e=>{const t=e6(e);return t.charAt(0).toUpperCase()+t.slice(1)},HR=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),t6=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};/**
110
+ * @license lucide-react v0.562.0 - ISC
111
+ *
112
+ * This source code is licensed under the ISC license.
113
+ * See the LICENSE file in the root directory of this source tree.
114
+ */var n6={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
115
+ * @license lucide-react v0.562.0 - ISC
116
+ *
117
+ * This source code is licensed under the ISC license.
118
+ * See the LICENSE file in the root directory of this source tree.
119
+ */const r6=b.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:s="",children:l,iconNode:a,...u},h)=>b.createElement("svg",{ref:h,...n6,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:HR("lucide",s),...!l&&!t6(u)&&{"aria-hidden":"true"},...u},[...a.map(([d,p])=>b.createElement(d,p)),...Array.isArray(l)?l:[l]]));/**
120
+ * @license lucide-react v0.562.0 - ISC
121
+ *
122
+ * This source code is licensed under the ISC license.
123
+ * See the LICENSE file in the root directory of this source tree.
124
+ */const Ne=(e,t)=>{const n=b.forwardRef(({className:r,...s},l)=>b.createElement(r6,{ref:l,iconNode:t,className:HR(`lucide-${Jz(uC(e))}`,`lucide-${e}`,r),...s}));return n.displayName=uC(e),n};/**
125
+ * @license lucide-react v0.562.0 - ISC
126
+ *
127
+ * This source code is licensed under the ISC license.
128
+ * See the LICENSE file in the root directory of this source tree.
129
+ */const i6=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]],s6=Ne("archive",i6);/**
130
+ * @license lucide-react v0.562.0 - ISC
131
+ *
132
+ * This source code is licensed under the ISC license.
133
+ * See the LICENSE file in the root directory of this source tree.
134
+ */const o6=[["path",{d:"M12 17V3",key:"1cwfxf"}],["path",{d:"m6 11 6 6 6-6",key:"12ii2o"}],["path",{d:"M19 21H5",key:"150jfl"}]],l6=Ne("arrow-down-to-line",o6);/**
135
+ * @license lucide-react v0.562.0 - ISC
136
+ *
137
+ * This source code is licensed under the ISC license.
138
+ * See the LICENSE file in the root directory of this source tree.
139
+ */const a6=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],c6=Ne("arrow-down",a6);/**
140
+ * @license lucide-react v0.562.0 - ISC
141
+ *
142
+ * This source code is licensed under the ISC license.
143
+ * See the LICENSE file in the root directory of this source tree.
144
+ */const u6=[["path",{d:"M8 3 4 7l4 4",key:"9rb6wj"}],["path",{d:"M4 7h16",key:"6tx8e3"}],["path",{d:"m16 21 4-4-4-4",key:"siv7j2"}],["path",{d:"M20 17H4",key:"h6l3hr"}]],d6=Ne("arrow-left-right",u6);/**
145
+ * @license lucide-react v0.562.0 - ISC
146
+ *
147
+ * This source code is licensed under the ISC license.
148
+ * See the LICENSE file in the root directory of this source tree.
149
+ */const h6=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],f6=Ne("arrow-up",h6);/**
150
+ * @license lucide-react v0.562.0 - ISC
151
+ *
152
+ * This source code is licensed under the ISC license.
153
+ * See the LICENSE file in the root directory of this source tree.
154
+ */const p6=[["path",{d:"M12 6v12",key:"1vza4d"}],["path",{d:"M17.196 9 6.804 15",key:"1ah31z"}],["path",{d:"m6.804 9 10.392 6",key:"1b6pxd"}]],m6=Ne("asterisk",p6);/**
155
+ * @license lucide-react v0.562.0 - ISC
156
+ *
157
+ * This source code is licensed under the ISC license.
158
+ * See the LICENSE file in the root directory of this source tree.
159
+ */const g6=[["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["path",{d:"M8 11h8",key:"vwpz6n"}],["path",{d:"M8 7h6",key:"1f0q6e"}]],v6=Ne("book-text",g6);/**
160
+ * @license lucide-react v0.562.0 - ISC
161
+ *
162
+ * This source code is licensed under the ISC license.
163
+ * See the LICENSE file in the root directory of this source tree.
164
+ */const _6=[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]],dC=Ne("brain",_6);/**
165
+ * @license lucide-react v0.562.0 - ISC
166
+ *
167
+ * This source code is licensed under the ISC license.
168
+ * See the LICENSE file in the root directory of this source tree.
169
+ */const y6=[["path",{d:"M18 6 7 17l-5-5",key:"116fxf"}],["path",{d:"m22 10-7.5 7.5L13 16",key:"ke71qq"}]],b6=Ne("check-check",y6);/**
170
+ * @license lucide-react v0.562.0 - ISC
171
+ *
172
+ * This source code is licensed under the ISC license.
173
+ * See the LICENSE file in the root directory of this source tree.
174
+ */const x6=[["path",{d:"M20 4L9 15",key:"1qkx8z"}],["path",{d:"M21 19L3 19",key:"100sma"}],["path",{d:"M9 15L4 10",key:"9zxff7"}]],S6=Ne("check-line",x6);/**
175
+ * @license lucide-react v0.562.0 - ISC
176
+ *
177
+ * This source code is licensed under the ISC license.
178
+ * See the LICENSE file in the root directory of this source tree.
179
+ */const w6=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],so=Ne("check",w6);/**
180
+ * @license lucide-react v0.562.0 - ISC
181
+ *
182
+ * This source code is licensed under the ISC license.
183
+ * See the LICENSE file in the root directory of this source tree.
184
+ */const C6=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],ib=Ne("chevron-down",C6);/**
185
+ * @license lucide-react v0.562.0 - ISC
186
+ *
187
+ * This source code is licensed under the ISC license.
188
+ * See the LICENSE file in the root directory of this source tree.
189
+ */const k6=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],E6=Ne("chevron-left",k6);/**
190
+ * @license lucide-react v0.562.0 - ISC
191
+ *
192
+ * This source code is licensed under the ISC license.
193
+ * See the LICENSE file in the root directory of this source tree.
194
+ */const R6=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],ds=Ne("chevron-right",R6);/**
195
+ * @license lucide-react v0.562.0 - ISC
196
+ *
197
+ * This source code is licensed under the ISC license.
198
+ * See the LICENSE file in the root directory of this source tree.
199
+ */const T6=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],M6=Ne("chevron-up",T6);/**
200
+ * @license lucide-react v0.562.0 - ISC
201
+ *
202
+ * This source code is licensed under the ISC license.
203
+ * See the LICENSE file in the root directory of this source tree.
204
+ */const N6=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"9",x2:"15",y1:"15",y2:"9",key:"1dfufj"}]],A6=Ne("circle-slash",N6);/**
205
+ * @license lucide-react v0.562.0 - ISC
206
+ *
207
+ * This source code is licensed under the ISC license.
208
+ * See the LICENSE file in the root directory of this source tree.
209
+ */const D6=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],O6=Ne("circle",D6);/**
210
+ * @license lucide-react v0.562.0 - ISC
211
+ *
212
+ * This source code is licensed under the ISC license.
213
+ * See the LICENSE file in the root directory of this source tree.
214
+ */const L6=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],hC=Ne("code-xml",L6);/**
215
+ * @license lucide-react v0.562.0 - ISC
216
+ *
217
+ * This source code is licensed under the ISC license.
218
+ * See the LICENSE file in the root directory of this source tree.
219
+ */const j6=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],FR=Ne("code",j6);/**
220
+ * @license lucide-react v0.562.0 - ISC
221
+ *
222
+ * This source code is licensed under the ISC license.
223
+ * See the LICENSE file in the root directory of this source tree.
224
+ */const z6=[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]],P6=Ne("command",z6);/**
225
+ * @license lucide-react v0.562.0 - ISC
226
+ *
227
+ * This source code is licensed under the ISC license.
228
+ * See the LICENSE file in the root directory of this source tree.
229
+ */const B6=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],ap=Ne("copy",B6);/**
230
+ * @license lucide-react v0.562.0 - ISC
231
+ *
232
+ * This source code is licensed under the ISC license.
233
+ * See the LICENSE file in the root directory of this source tree.
234
+ */const I6=[["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}],["path",{d:"m9 10-5 5 5 5",key:"1kshq7"}]],H6=Ne("corner-down-left",I6);/**
235
+ * @license lucide-react v0.562.0 - ISC
236
+ *
237
+ * This source code is licensed under the ISC license.
238
+ * See the LICENSE file in the root directory of this source tree.
239
+ */const F6=[["path",{d:"M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21",key:"g5wo59"}],["path",{d:"m5.082 11.09 8.828 8.828",key:"1wx5vj"}]],U6=Ne("eraser",F6);/**
240
+ * @license lucide-react v0.562.0 - ISC
241
+ *
242
+ * This source code is licensed under the ISC license.
243
+ * See the LICENSE file in the root directory of this source tree.
244
+ */const $6=[["path",{d:"M12.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v9.34",key:"o6klzx"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10.378 12.622a1 1 0 0 1 3 3.003L8.36 20.637a2 2 0 0 1-.854.506l-2.867.837a.5.5 0 0 1-.62-.62l.836-2.869a2 2 0 0 1 .506-.853z",key:"zhnas1"}]],W6=Ne("file-pen",$6);/**
245
+ * @license lucide-react v0.562.0 - ISC
246
+ *
247
+ * This source code is licensed under the ISC license.
248
+ * See the LICENSE file in the root directory of this source tree.
249
+ */const V6=[["path",{d:"M11.35 22H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v5.35",key:"17jvcc"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M14 19h6",key:"bvotb8"}],["path",{d:"M17 16v6",key:"18yu1i"}]],q6=Ne("file-plus-corner",V6);/**
250
+ * @license lucide-react v0.562.0 - ISC
251
+ *
252
+ * This source code is licensed under the ISC license.
253
+ * See the LICENSE file in the root directory of this source tree.
254
+ */const K6=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]],G6=Ne("file",K6);/**
255
+ * @license lucide-react v0.562.0 - ISC
256
+ *
257
+ * This source code is licensed under the ISC license.
258
+ * See the LICENSE file in the root directory of this source tree.
259
+ */const Y6=[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"M12 16.5A4.5 4.5 0 1 1 7.5 12 4.5 4.5 0 1 1 12 7.5a4.5 4.5 0 1 1 4.5 4.5 4.5 4.5 0 1 1-4.5 4.5",key:"14wa3c"}],["path",{d:"M12 7.5V9",key:"1oy5b0"}],["path",{d:"M7.5 12H9",key:"eltsq1"}],["path",{d:"M16.5 12H15",key:"vk5kw4"}],["path",{d:"M12 16.5V15",key:"k7eayi"}],["path",{d:"m8 8 1.88 1.88",key:"nxy4qf"}],["path",{d:"M14.12 9.88 16 8",key:"1lst6k"}],["path",{d:"m8 16 1.88-1.88",key:"h2eex1"}],["path",{d:"M14.12 14.12 16 16",key:"uqkrx3"}]],fu=Ne("flower",Y6);/**
260
+ * @license lucide-react v0.562.0 - ISC
261
+ *
262
+ * This source code is licensed under the ISC license.
263
+ * See the LICENSE file in the root directory of this source tree.
264
+ */const X6=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],UR=Ne("folder-open",X6);/**
265
+ * @license lucide-react v0.562.0 - ISC
266
+ *
267
+ * This source code is licensed under the ISC license.
268
+ * See the LICENSE file in the root directory of this source tree.
269
+ */const Z6=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],Q6=Ne("folder",Z6);/**
270
+ * @license lucide-react v0.562.0 - ISC
271
+ *
272
+ * This source code is licensed under the ISC license.
273
+ * See the LICENSE file in the root directory of this source tree.
274
+ */const J6=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],Hc=Ne("gauge",J6);/**
275
+ * @license lucide-react v0.562.0 - ISC
276
+ *
277
+ * This source code is licensed under the ISC license.
278
+ * See the LICENSE file in the root directory of this source tree.
279
+ */const eP=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],tP=Ne("info",eP);/**
280
+ * @license lucide-react v0.562.0 - ISC
281
+ *
282
+ * This source code is licensed under the ISC license.
283
+ * See the LICENSE file in the root directory of this source tree.
284
+ */const nP=[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}]],rP=Ne("list-checks",nP);/**
285
+ * @license lucide-react v0.562.0 - ISC
286
+ *
287
+ * This source code is licensed under the ISC license.
288
+ * See the LICENSE file in the root directory of this source tree.
289
+ */const iP=[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["rect",{x:"3",y:"4",width:"6",height:"6",rx:"1",key:"cif1o7"}]],Sf=Ne("list-todo",iP);/**
290
+ * @license lucide-react v0.562.0 - ISC
291
+ *
292
+ * This source code is licensed under the ISC license.
293
+ * See the LICENSE file in the root directory of this source tree.
294
+ */const sP=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Ni=Ne("loader-circle",sP);/**
295
+ * @license lucide-react v0.562.0 - ISC
296
+ *
297
+ * This source code is licensed under the ISC license.
298
+ * See the LICENSE file in the root directory of this source tree.
299
+ */const oP=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 9.9-1",key:"1mm8w8"}]],fC=Ne("lock-open",oP);/**
300
+ * @license lucide-react v0.562.0 - ISC
301
+ *
302
+ * This source code is licensed under the ISC license.
303
+ * See the LICENSE file in the root directory of this source tree.
304
+ */const lP=[["path",{d:"M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z",key:"169xi5"}],["path",{d:"M15 5.764v15",key:"1pn4in"}],["path",{d:"M9 3.236v15",key:"1uimfh"}]],pC=Ne("map",lP);/**
305
+ * @license lucide-react v0.562.0 - ISC
306
+ *
307
+ * This source code is licensed under the ISC license.
308
+ * See the LICENSE file in the root directory of this source tree.
309
+ */const aP=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],$R=Ne("menu",aP);/**
310
+ * @license lucide-react v0.562.0 - ISC
311
+ *
312
+ * This source code is licensed under the ISC license.
313
+ * See the LICENSE file in the root directory of this source tree.
314
+ */const cP=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],WR=Ne("message-circle-question-mark",cP);/**
315
+ * @license lucide-react v0.562.0 - ISC
316
+ *
317
+ * This source code is licensed under the ISC license.
318
+ * See the LICENSE file in the root directory of this source tree.
319
+ */const uP=[["path",{d:"M14 14a2 2 0 0 0 2-2V8h-2",key:"1r06pg"}],["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M8 14a2 2 0 0 0 2-2V8H8",key:"1jzu5j"}]],dP=Ne("message-square-quote",uP);/**
320
+ * @license lucide-react v0.562.0 - ISC
321
+ *
322
+ * This source code is licensed under the ISC license.
323
+ * See the LICENSE file in the root directory of this source tree.
324
+ */const hP=[["path",{d:"M8 3v3a2 2 0 0 1-2 2H3",key:"hohbtr"}],["path",{d:"M21 8h-3a2 2 0 0 1-2-2V3",key:"5jw1f3"}],["path",{d:"M3 16h3a2 2 0 0 1 2 2v3",key:"198tvr"}],["path",{d:"M16 21v-3a2 2 0 0 1 2-2h3",key:"ph8mxp"}]],VR=Ne("minimize",hP);/**
325
+ * @license lucide-react v0.562.0 - ISC
326
+ *
327
+ * This source code is licensed under the ISC license.
328
+ * See the LICENSE file in the root directory of this source tree.
329
+ */const fP=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],sb=Ne("monitor",fP);/**
330
+ * @license lucide-react v0.562.0 - ISC
331
+ *
332
+ * This source code is licensed under the ISC license.
333
+ * See the LICENSE file in the root directory of this source tree.
334
+ */const pP=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],mP=Ne("moon",pP);/**
335
+ * @license lucide-react v0.562.0 - ISC
336
+ *
337
+ * This source code is licensed under the ISC license.
338
+ * See the LICENSE file in the root directory of this source tree.
339
+ */const gP=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],p_=Ne("panel-left",gP);/**
340
+ * @license lucide-react v0.562.0 - ISC
341
+ *
342
+ * This source code is licensed under the ISC license.
343
+ * See the LICENSE file in the root directory of this source tree.
344
+ */const vP=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]],_P=Ne("panel-right",vP);/**
345
+ * @license lucide-react v0.562.0 - ISC
346
+ *
347
+ * This source code is licensed under the ISC license.
348
+ * See the LICENSE file in the root directory of this source tree.
349
+ */const yP=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],qR=Ne("pencil",yP);/**
350
+ * @license lucide-react v0.562.0 - ISC
351
+ *
352
+ * This source code is licensed under the ISC license.
353
+ * See the LICENSE file in the root directory of this source tree.
354
+ */const bP=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],ob=Ne("plus",bP);/**
355
+ * @license lucide-react v0.562.0 - ISC
356
+ *
357
+ * This source code is licensed under the ISC license.
358
+ * See the LICENSE file in the root directory of this source tree.
359
+ */const xP=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],SP=Ne("refresh-cw",xP);/**
360
+ * @license lucide-react v0.562.0 - ISC
361
+ *
362
+ * This source code is licensed under the ISC license.
363
+ * See the LICENSE file in the root directory of this source tree.
364
+ */const wP=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],pv=Ne("search",wP);/**
365
+ * @license lucide-react v0.562.0 - ISC
366
+ *
367
+ * This source code is licensed under the ISC license.
368
+ * See the LICENSE file in the root directory of this source tree.
369
+ */const CP=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],kP=Ne("send",CP);/**
370
+ * @license lucide-react v0.562.0 - ISC
371
+ *
372
+ * This source code is licensed under the ISC license.
373
+ * See the LICENSE file in the root directory of this source tree.
374
+ */const EP=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],RP=Ne("settings",EP);/**
375
+ * @license lucide-react v0.562.0 - ISC
376
+ *
377
+ * This source code is licensed under the ISC license.
378
+ * See the LICENSE file in the root directory of this source tree.
379
+ */const TP=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],MP=Ne("settings-2",TP);/**
380
+ * @license lucide-react v0.562.0 - ISC
381
+ *
382
+ * This source code is licensed under the ISC license.
383
+ * See the LICENSE file in the root directory of this source tree.
384
+ */const NP=[["path",{d:"M22 2 2 22",key:"y4kqgn"}]],AP=Ne("slash",NP);/**
385
+ * @license lucide-react v0.562.0 - ISC
386
+ *
387
+ * This source code is licensed under the ISC license.
388
+ * See the LICENSE file in the root directory of this source tree.
389
+ */const DP=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],wu=Ne("sparkles",DP);/**
390
+ * @license lucide-react v0.562.0 - ISC
391
+ *
392
+ * This source code is licensed under the ISC license.
393
+ * See the LICENSE file in the root directory of this source tree.
394
+ */const OP=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],lb=Ne("square-pen",OP);/**
395
+ * @license lucide-react v0.562.0 - ISC
396
+ *
397
+ * This source code is licensed under the ISC license.
398
+ * See the LICENSE file in the root directory of this source tree.
399
+ */const LP=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],jP=Ne("square-x",LP);/**
400
+ * @license lucide-react v0.562.0 - ISC
401
+ *
402
+ * This source code is licensed under the ISC license.
403
+ * See the LICENSE file in the root directory of this source tree.
404
+ */const zP=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],PP=Ne("sun",zP);/**
405
+ * @license lucide-react v0.562.0 - ISC
406
+ *
407
+ * This source code is licensed under the ISC license.
408
+ * See the LICENSE file in the root directory of this source tree.
409
+ */const BP=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],ab=Ne("terminal",BP);/**
410
+ * @license lucide-react v0.562.0 - ISC
411
+ *
412
+ * This source code is licensed under the ISC license.
413
+ * See the LICENSE file in the root directory of this source tree.
414
+ */const IP=[["rect",{width:"18",height:"12",x:"3",y:"8",rx:"1",key:"158fvp"}],["path",{d:"M10 8V5c0-.6-.4-1-1-1H6a1 1 0 0 0-1 1v3",key:"s0042v"}],["path",{d:"M19 8V5c0-.6-.4-1-1-1h-3a1 1 0 0 0-1 1v3",key:"9wmeh2"}]],HP=Ne("toy-brick",IP);/**
415
+ * @license lucide-react v0.562.0 - ISC
416
+ *
417
+ * This source code is licensed under the ISC license.
418
+ * See the LICENSE file in the root directory of this source tree.
419
+ */const FP=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],UP=Ne("trash-2",FP);/**
420
+ * @license lucide-react v0.562.0 - ISC
421
+ *
422
+ * This source code is licensed under the ISC license.
423
+ * See the LICENSE file in the root directory of this source tree.
424
+ */const $P=[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]],cb=Ne("user-round",$P);/**
425
+ * @license lucide-react v0.562.0 - ISC
426
+ *
427
+ * This source code is licensed under the ISC license.
428
+ * See the LICENSE file in the root directory of this source tree.
429
+ */const WP=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Oa=Ne("x",WP);/**
430
+ * @license lucide-react v0.562.0 - ISC
431
+ *
432
+ * This source code is licensed under the ISC license.
433
+ * See the LICENSE file in the root directory of this source tree.
434
+ */const VP=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],wf=Ne("zap",VP),Cu="data-focus-fallback-ignore",KR="data-allow-focus-retain",Cf="kanna:restore-chat-input-focus",ub="data-chat-input",kf="data-chat-selection-zone";function Vo(e,t){return!!(e!=null&&e.closest(`[${t}]`))}function GR(e){var n;const t=e;return t!=null&&t.matches?t.matches("input:not([type='checkbox']):not([type='radio']):not([type='button']):not([type='submit']):not([type='reset']), textarea, select")||t.isContentEditable||((n=t.getAttribute)==null?void 0:n.call(t,"role"))==="textbox"?!0:Vo(e,KR):!1}function qP(e){const t=e;return t!=null&&t.matches?GR(e)||(t.tabIndex??-1)>=0||t.matches("button, a[href], summary")?!0:Vo(e,KR):!1}function mC(e){return!!e.querySelector(`[${Cu}][data-state='open']`)}function KP(e){return e?!e.isCollapsed&&e.toString().trim().length>0:!1}function GP(e,t){if(!e)return!1;const n=Array.from(t.querySelectorAll(`textarea[${ub}]`)).filter(a=>!a.disabled);if(n.length===0)return!1;const r=n.indexOf(e),s=r>=0?(r+1)%n.length:0,l=n[s];return l?(l.focus({preventScroll:!0}),!0):!1}function gC(e){const{activeElement:t,fallback:n,hasActiveOverlay:r}=e;if(!n||n.disabled||r||t===n)return"none";if(e.trigger==="escape")return e.defaultPrevented||Vo(t,ub)||e.canCancel?"none":"escape-focus";const{pointerStartTarget:s,pointerEndTarget:l,root:a,hasActiveSelection:u}=e,h=l??s;return!a||!h||!a.contains(h)||Vo(h,Cu)||Vo(t,Cu)||u&&(Vo(s,kf)||Vo(h,kf))||GR(t)?"none":t&&t===h?"restore":qP(t)?"none":"restore"}const YR=Gz,YP=Yz,XR=b.forwardRef(({className:e,...t},n)=>g.jsx(BR,{ref:n,className:xe("fixed inset-0 z-50 bg-black/50 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));XR.displayName=BR.displayName;const XP={sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg"},db=b.forwardRef(({className:e,children:t,size:n="md",...r},s)=>g.jsxs(YP,{children:[g.jsx(XR,{}),g.jsxs(IR,{ref:s,[Cu]:"",onCloseAutoFocus:l=>{var a;l.preventDefault(),window.dispatchEvent(new Event(Cf)),(a=r.onCloseAutoFocus)==null||a.call(r,l)},className:xe("fixed left-1/2 top-1/2 z-50 w-full -translate-x-1/2 -translate-y-1/2 rounded-xl border border-border bg-background shadow-xl 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%]","max-h-[85vh] flex flex-col",XP[n],e),...r,children:[t,g.jsxs(Qz,{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:[g.jsx(Oa,{className:"h-4 w-4"}),g.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));db.displayName=IR.displayName;function ZR({className:e,...t}){return g.jsx(Xz,{className:xe("text-lg font-medium leading-none tracking-tight",e),...t})}function ZP({className:e,...t}){return g.jsx(Zz,{className:xe("text-sm text-muted-foreground",e),...t})}function QR({className:e,...t}){return g.jsx("div",{className:xe("flex-1 min-h-0 overflow-y-auto px-4 pb-4 pt-3.5",e),...t})}function JR({className:e,...t}){return g.jsx("div",{className:xe("shrink-0 flex justify-end gap-2 border-t border-border bg-background p-2 rounded-b-xl",e),...t})}const eT=b.createContext(null);function QP({children:e}){const[t,n]=b.useState(null),[r,s]=b.useState(""),l=b.useRef(null);b.useEffect(()=>{(t==null?void 0:t.kind)==="prompt"&&(s(t.options.initialValue??""),setTimeout(()=>{var _,y;(_=l.current)==null||_.focus(),(y=l.current)==null||y.select()},0))},[t]);const a=b.useCallback(()=>{n(null),s("")},[]),u=b.useCallback(()=>{t&&(t.kind==="confirm"?t.resolve(!1):t.resolve(null),a())},[a,t]),h=b.useCallback(()=>{t&&(t.kind==="confirm"?t.resolve(!0):t.resolve(r.trim()||null),a())},[a,t,r]),d=b.useCallback(_=>new Promise(y=>{n({kind:"confirm",options:_,resolve:y})}),[]),p=b.useCallback(_=>new Promise(y=>{n({kind:"prompt",options:_,resolve:y})}),[]),m=b.useMemo(()=>({confirm:d,prompt:p}),[d,p]);return g.jsxs(eT.Provider,{value:m,children:[e,g.jsx(YR,{open:t!==null,onOpenChange:_=>{_||!t||u()},children:g.jsx(db,{size:"sm",onKeyDown:_=>{_.key!=="Enter"||_.shiftKey||!t||t.kind!=="confirm"||(_.preventDefault(),h())},children:t?g.jsxs(g.Fragment,{children:[g.jsxs(QR,{className:"space-y-4",children:[g.jsx(ZR,{children:t.options.title}),t.options.description?g.jsx(ZP,{children:t.options.description}):null,t.kind==="prompt"?g.jsx("input",{ref:l,type:"text",value:r,onChange:_=>s(_.target.value),onKeyDown:_=>{_.key==="Enter"&&(_.preventDefault(),h())},className:"w-full px-3 py-2 text-sm border border-border rounded-md bg-background outline-none",placeholder:t.options.placeholder}):null]}),g.jsxs(JR,{children:[g.jsx(nt,{variant:"ghost",size:"sm",onClick:u,children:t.options.cancelLabel??"Cancel"}),g.jsx(nt,{variant:t.kind==="confirm"?t.options.confirmVariant??"default":"secondary",size:"sm",onClick:h,disabled:t.kind==="prompt"&&!r.trim(),children:t.options.confirmLabel??"Confirm"})]})]}):null})})]})}function JP(){const e=b.useContext(eT);if(!e)throw new Error("useAppDialog must be used within AppDialogProvider");return e}const eB=["top","right","bottom","left"],oo=Math.min,Sr=Math.max,Ef=Math.round,Th=Math.floor,Ti=e=>({x:e,y:e}),tB={left:"right",right:"left",bottom:"top",top:"bottom"};function m_(e,t,n){return Sr(e,oo(t,n))}function hs(e,t){return typeof e=="function"?e(t):e}function fs(e){return e.split("-")[0]}function La(e){return e.split("-")[1]}function hb(e){return e==="x"?"y":"x"}function fb(e){return e==="y"?"height":"width"}function Ci(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function pb(e){return hb(Ci(e))}function nB(e,t,n){n===void 0&&(n=!1);const r=La(e),s=pb(e),l=fb(s);let a=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[l]>t.floating[l]&&(a=Rf(a)),[a,Rf(a)]}function rB(e){const t=Rf(e);return[g_(e),t,g_(t)]}function g_(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const vC=["left","right"],_C=["right","left"],iB=["top","bottom"],sB=["bottom","top"];function oB(e,t,n){switch(e){case"top":case"bottom":return n?t?_C:vC:t?vC:_C;case"left":case"right":return t?iB:sB;default:return[]}}function lB(e,t,n,r){const s=La(e);let l=oB(fs(e),n==="start",r);return s&&(l=l.map(a=>a+"-"+s),t&&(l=l.concat(l.map(g_)))),l}function Rf(e){const t=fs(e);return tB[t]+e.slice(t.length)}function aB(e){return{top:0,right:0,bottom:0,left:0,...e}}function tT(e){return typeof e!="number"?aB(e):{top:e,right:e,bottom:e,left:e}}function Tf(e){const{x:t,y:n,width:r,height:s}=e;return{width:r,height:s,top:n,left:t,right:t+r,bottom:n+s,x:t,y:n}}function yC(e,t,n){let{reference:r,floating:s}=e;const l=Ci(t),a=pb(t),u=fb(a),h=fs(t),d=l==="y",p=r.x+r.width/2-s.width/2,m=r.y+r.height/2-s.height/2,_=r[u]/2-s[u]/2;let y;switch(h){case"top":y={x:p,y:r.y-s.height};break;case"bottom":y={x:p,y:r.y+r.height};break;case"right":y={x:r.x+r.width,y:m};break;case"left":y={x:r.x-s.width,y:m};break;default:y={x:r.x,y:r.y}}switch(La(t)){case"start":y[a]-=_*(n&&d?-1:1);break;case"end":y[a]+=_*(n&&d?-1:1);break}return y}async function cB(e,t){var n;t===void 0&&(t={});const{x:r,y:s,platform:l,rects:a,elements:u,strategy:h}=e,{boundary:d="clippingAncestors",rootBoundary:p="viewport",elementContext:m="floating",altBoundary:_=!1,padding:y=0}=hs(t,e),w=tT(y),C=u[_?m==="floating"?"reference":"floating":m],k=Tf(await l.getClippingRect({element:(n=await(l.isElement==null?void 0:l.isElement(C)))==null||n?C:C.contextElement||await(l.getDocumentElement==null?void 0:l.getDocumentElement(u.floating)),boundary:d,rootBoundary:p,strategy:h})),T=m==="floating"?{x:r,y:s,width:a.floating.width,height:a.floating.height}:a.reference,R=await(l.getOffsetParent==null?void 0:l.getOffsetParent(u.floating)),N=await(l.isElement==null?void 0:l.isElement(R))?await(l.getScale==null?void 0:l.getScale(R))||{x:1,y:1}:{x:1,y:1},j=Tf(l.convertOffsetParentRelativeRectToViewportRelativeRect?await l.convertOffsetParentRelativeRectToViewportRelativeRect({elements:u,rect:T,offsetParent:R,strategy:h}):T);return{top:(k.top-j.top+w.top)/N.y,bottom:(j.bottom-k.bottom+w.bottom)/N.y,left:(k.left-j.left+w.left)/N.x,right:(j.right-k.right+w.right)/N.x}}const uB=50,dB=async(e,t,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:l=[],platform:a}=n,u=a.detectOverflow?a:{...a,detectOverflow:cB},h=await(a.isRTL==null?void 0:a.isRTL(t));let d=await a.getElementRects({reference:e,floating:t,strategy:s}),{x:p,y:m}=yC(d,r,h),_=r,y=0;const w={};for(let S=0;S<l.length;S++){const C=l[S];if(!C)continue;const{name:k,fn:T}=C,{x:R,y:N,data:j,reset:A}=await T({x:p,y:m,initialPlacement:r,placement:_,strategy:s,middlewareData:w,rects:d,platform:u,elements:{reference:e,floating:t}});p=R??p,m=N??m,w[k]={...w[k],...j},A&&y<uB&&(y++,typeof A=="object"&&(A.placement&&(_=A.placement),A.rects&&(d=A.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:s}):A.rects),{x:p,y:m}=yC(d,_,h)),S=-1)}return{x:p,y:m,placement:_,strategy:s,middlewareData:w}},hB=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:s,rects:l,platform:a,elements:u,middlewareData:h}=t,{element:d,padding:p=0}=hs(e,t)||{};if(d==null)return{};const m=tT(p),_={x:n,y:r},y=pb(s),w=fb(y),S=await a.getDimensions(d),C=y==="y",k=C?"top":"left",T=C?"bottom":"right",R=C?"clientHeight":"clientWidth",N=l.reference[w]+l.reference[y]-_[y]-l.floating[w],j=_[y]-l.reference[y],A=await(a.getOffsetParent==null?void 0:a.getOffsetParent(d));let D=A?A[R]:0;(!D||!await(a.isElement==null?void 0:a.isElement(A)))&&(D=u.floating[R]||l.floating[w]);const B=N/2-j/2,K=D/2-S[w]/2-1,z=oo(m[k],K),U=oo(m[T],K),H=z,F=D-S[w]-U,q=D/2-S[w]/2+B,$=m_(H,q,F),P=!h.arrow&&La(s)!=null&&q!==$&&l.reference[w]/2-(q<H?z:U)-S[w]/2<0,V=P?q<H?q-H:q-F:0;return{[y]:_[y]+V,data:{[y]:$,centerOffset:q-$-V,...P&&{alignmentOffset:V}},reset:P}}}),fB=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:s,middlewareData:l,rects:a,initialPlacement:u,platform:h,elements:d}=t,{mainAxis:p=!0,crossAxis:m=!0,fallbackPlacements:_,fallbackStrategy:y="bestFit",fallbackAxisSideDirection:w="none",flipAlignment:S=!0,...C}=hs(e,t);if((n=l.arrow)!=null&&n.alignmentOffset)return{};const k=fs(s),T=Ci(u),R=fs(u)===u,N=await(h.isRTL==null?void 0:h.isRTL(d.floating)),j=_||(R||!S?[Rf(u)]:rB(u)),A=w!=="none";!_&&A&&j.push(...lB(u,S,w,N));const D=[u,...j],B=await h.detectOverflow(t,C),K=[];let z=((r=l.flip)==null?void 0:r.overflows)||[];if(p&&K.push(B[k]),m){const q=nB(s,a,N);K.push(B[q[0]],B[q[1]])}if(z=[...z,{placement:s,overflows:K}],!K.every(q=>q<=0)){var U,H;const q=(((U=l.flip)==null?void 0:U.index)||0)+1,$=D[q];if($&&(!(m==="alignment"?T!==Ci($):!1)||z.every(W=>Ci(W.placement)===T?W.overflows[0]>0:!0)))return{data:{index:q,overflows:z},reset:{placement:$}};let P=(H=z.filter(V=>V.overflows[0]<=0).sort((V,W)=>V.overflows[1]-W.overflows[1])[0])==null?void 0:H.placement;if(!P)switch(y){case"bestFit":{var F;const V=(F=z.filter(W=>{if(A){const Z=Ci(W.placement);return Z===T||Z==="y"}return!0}).map(W=>[W.placement,W.overflows.filter(Z=>Z>0).reduce((Z,M)=>Z+M,0)]).sort((W,Z)=>W[1]-Z[1])[0])==null?void 0:F[0];V&&(P=V);break}case"initialPlacement":P=u;break}if(s!==P)return{reset:{placement:P}}}return{}}}};function bC(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function xC(e){return eB.some(t=>e[t]>=0)}const pB=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:s="referenceHidden",...l}=hs(e,t);switch(s){case"referenceHidden":{const a=await r.detectOverflow(t,{...l,elementContext:"reference"}),u=bC(a,n.reference);return{data:{referenceHiddenOffsets:u,referenceHidden:xC(u)}}}case"escaped":{const a=await r.detectOverflow(t,{...l,altBoundary:!0}),u=bC(a,n.floating);return{data:{escapedOffsets:u,escaped:xC(u)}}}default:return{}}}}},nT=new Set(["left","top"]);async function mB(e,t){const{placement:n,platform:r,elements:s}=e,l=await(r.isRTL==null?void 0:r.isRTL(s.floating)),a=fs(n),u=La(n),h=Ci(n)==="y",d=nT.has(a)?-1:1,p=l&&h?-1:1,m=hs(t,e);let{mainAxis:_,crossAxis:y,alignmentAxis:w}=typeof m=="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:m.mainAxis||0,crossAxis:m.crossAxis||0,alignmentAxis:m.alignmentAxis};return u&&typeof w=="number"&&(y=u==="end"?w*-1:w),h?{x:y*p,y:_*d}:{x:_*d,y:y*p}}const gB=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:s,y:l,placement:a,middlewareData:u}=t,h=await mB(t,e);return a===((n=u.offset)==null?void 0:n.placement)&&(r=u.arrow)!=null&&r.alignmentOffset?{}:{x:s+h.x,y:l+h.y,data:{...h,placement:a}}}}},vB=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:s,platform:l}=t,{mainAxis:a=!0,crossAxis:u=!1,limiter:h={fn:k=>{let{x:T,y:R}=k;return{x:T,y:R}}},...d}=hs(e,t),p={x:n,y:r},m=await l.detectOverflow(t,d),_=Ci(fs(s)),y=hb(_);let w=p[y],S=p[_];if(a){const k=y==="y"?"top":"left",T=y==="y"?"bottom":"right",R=w+m[k],N=w-m[T];w=m_(R,w,N)}if(u){const k=_==="y"?"top":"left",T=_==="y"?"bottom":"right",R=S+m[k],N=S-m[T];S=m_(R,S,N)}const C=h.fn({...t,[y]:w,[_]:S});return{...C,data:{x:C.x-n,y:C.y-r,enabled:{[y]:a,[_]:u}}}}}},_B=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:s,rects:l,middlewareData:a}=t,{offset:u=0,mainAxis:h=!0,crossAxis:d=!0}=hs(e,t),p={x:n,y:r},m=Ci(s),_=hb(m);let y=p[_],w=p[m];const S=hs(u,t),C=typeof S=="number"?{mainAxis:S,crossAxis:0}:{mainAxis:0,crossAxis:0,...S};if(h){const R=_==="y"?"height":"width",N=l.reference[_]-l.floating[R]+C.mainAxis,j=l.reference[_]+l.reference[R]-C.mainAxis;y<N?y=N:y>j&&(y=j)}if(d){var k,T;const R=_==="y"?"width":"height",N=nT.has(fs(s)),j=l.reference[m]-l.floating[R]+(N&&((k=a.offset)==null?void 0:k[m])||0)+(N?0:C.crossAxis),A=l.reference[m]+l.reference[R]+(N?0:((T=a.offset)==null?void 0:T[m])||0)-(N?C.crossAxis:0);w<j?w=j:w>A&&(w=A)}return{[_]:y,[m]:w}}}},yB=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:s,rects:l,platform:a,elements:u}=t,{apply:h=()=>{},...d}=hs(e,t),p=await a.detectOverflow(t,d),m=fs(s),_=La(s),y=Ci(s)==="y",{width:w,height:S}=l.floating;let C,k;m==="top"||m==="bottom"?(C=m,k=_===(await(a.isRTL==null?void 0:a.isRTL(u.floating))?"start":"end")?"left":"right"):(k=m,C=_==="end"?"top":"bottom");const T=S-p.top-p.bottom,R=w-p.left-p.right,N=oo(S-p[C],T),j=oo(w-p[k],R),A=!t.middlewareData.shift;let D=N,B=j;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(B=R),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(D=T),A&&!_){const z=Sr(p.left,0),U=Sr(p.right,0),H=Sr(p.top,0),F=Sr(p.bottom,0);y?B=w-2*(z!==0||U!==0?z+U:Sr(p.left,p.right)):D=S-2*(H!==0||F!==0?H+F:Sr(p.top,p.bottom))}await h({...t,availableWidth:B,availableHeight:D});const K=await a.getDimensions(u.floating);return w!==K.width||S!==K.height?{reset:{rects:!0}}:{}}}};function cp(){return typeof window<"u"}function ja(e){return rT(e)?(e.nodeName||"").toLowerCase():"#document"}function wr(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Oi(e){var t;return(t=(rT(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function rT(e){return cp()?e instanceof Node||e instanceof wr(e).Node:!1}function ai(e){return cp()?e instanceof Element||e instanceof wr(e).Element:!1}function gs(e){return cp()?e instanceof HTMLElement||e instanceof wr(e).HTMLElement:!1}function SC(e){return!cp()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof wr(e).ShadowRoot}function $u(e){const{overflow:t,overflowX:n,overflowY:r,display:s}=ci(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&s!=="inline"&&s!=="contents"}function bB(e){return/^(table|td|th)$/.test(ja(e))}function up(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const xB=/transform|translate|scale|rotate|perspective|filter/,SB=/paint|layout|strict|content/,jo=e=>!!e&&e!=="none";let mv;function mb(e){const t=ai(e)?ci(e):e;return jo(t.transform)||jo(t.translate)||jo(t.scale)||jo(t.rotate)||jo(t.perspective)||!gb()&&(jo(t.backdropFilter)||jo(t.filter))||xB.test(t.willChange||"")||SB.test(t.contain||"")}function wB(e){let t=lo(e);for(;gs(t)&&!xa(t);){if(mb(t))return t;if(up(t))return null;t=lo(t)}return null}function gb(){return mv==null&&(mv=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),mv}function xa(e){return/^(html|body|#document)$/.test(ja(e))}function ci(e){return wr(e).getComputedStyle(e)}function dp(e){return ai(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function lo(e){if(ja(e)==="html")return e;const t=e.assignedSlot||e.parentNode||SC(e)&&e.host||Oi(e);return SC(t)?t.host:t}function iT(e){const t=lo(e);return xa(t)?e.ownerDocument?e.ownerDocument.body:e.body:gs(t)&&$u(t)?t:iT(t)}function ku(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=iT(e),l=s===((r=e.ownerDocument)==null?void 0:r.body),a=wr(s);if(l){const u=v_(a);return t.concat(a,a.visualViewport||[],$u(s)?s:[],u&&n?ku(u):[])}else return t.concat(s,ku(s,[],n))}function v_(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function sT(e){const t=ci(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const s=gs(e),l=s?e.offsetWidth:n,a=s?e.offsetHeight:r,u=Ef(n)!==l||Ef(r)!==a;return u&&(n=l,r=a),{width:n,height:r,$:u}}function vb(e){return ai(e)?e:e.contextElement}function ma(e){const t=vb(e);if(!gs(t))return Ti(1);const n=t.getBoundingClientRect(),{width:r,height:s,$:l}=sT(t);let a=(l?Ef(n.width):n.width)/r,u=(l?Ef(n.height):n.height)/s;return(!a||!Number.isFinite(a))&&(a=1),(!u||!Number.isFinite(u))&&(u=1),{x:a,y:u}}const CB=Ti(0);function oT(e){const t=wr(e);return!gb()||!t.visualViewport?CB:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function kB(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==wr(e)?!1:t}function Qo(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),l=vb(e);let a=Ti(1);t&&(r?ai(r)&&(a=ma(r)):a=ma(e));const u=kB(l,n,r)?oT(l):Ti(0);let h=(s.left+u.x)/a.x,d=(s.top+u.y)/a.y,p=s.width/a.x,m=s.height/a.y;if(l){const _=wr(l),y=r&&ai(r)?wr(r):r;let w=_,S=v_(w);for(;S&&r&&y!==w;){const C=ma(S),k=S.getBoundingClientRect(),T=ci(S),R=k.left+(S.clientLeft+parseFloat(T.paddingLeft))*C.x,N=k.top+(S.clientTop+parseFloat(T.paddingTop))*C.y;h*=C.x,d*=C.y,p*=C.x,m*=C.y,h+=R,d+=N,w=wr(S),S=v_(w)}}return Tf({width:p,height:m,x:h,y:d})}function hp(e,t){const n=dp(e).scrollLeft;return t?t.left+n:Qo(Oi(e)).left+n}function lT(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-hp(e,n),s=n.top+t.scrollTop;return{x:r,y:s}}function EB(e){let{elements:t,rect:n,offsetParent:r,strategy:s}=e;const l=s==="fixed",a=Oi(r),u=t?up(t.floating):!1;if(r===a||u&&l)return n;let h={scrollLeft:0,scrollTop:0},d=Ti(1);const p=Ti(0),m=gs(r);if((m||!m&&!l)&&((ja(r)!=="body"||$u(a))&&(h=dp(r)),m)){const y=Qo(r);d=ma(r),p.x=y.x+r.clientLeft,p.y=y.y+r.clientTop}const _=a&&!m&&!l?lT(a,h):Ti(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-h.scrollLeft*d.x+p.x+_.x,y:n.y*d.y-h.scrollTop*d.y+p.y+_.y}}function RB(e){return Array.from(e.getClientRects())}function TB(e){const t=Oi(e),n=dp(e),r=e.ownerDocument.body,s=Sr(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),l=Sr(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+hp(e);const u=-n.scrollTop;return ci(r).direction==="rtl"&&(a+=Sr(t.clientWidth,r.clientWidth)-s),{width:s,height:l,x:a,y:u}}const wC=25;function MB(e,t){const n=wr(e),r=Oi(e),s=n.visualViewport;let l=r.clientWidth,a=r.clientHeight,u=0,h=0;if(s){l=s.width,a=s.height;const p=gb();(!p||p&&t==="fixed")&&(u=s.offsetLeft,h=s.offsetTop)}const d=hp(r);if(d<=0){const p=r.ownerDocument,m=p.body,_=getComputedStyle(m),y=p.compatMode==="CSS1Compat"&&parseFloat(_.marginLeft)+parseFloat(_.marginRight)||0,w=Math.abs(r.clientWidth-m.clientWidth-y);w<=wC&&(l-=w)}else d<=wC&&(l+=d);return{width:l,height:a,x:u,y:h}}function NB(e,t){const n=Qo(e,!0,t==="fixed"),r=n.top+e.clientTop,s=n.left+e.clientLeft,l=gs(e)?ma(e):Ti(1),a=e.clientWidth*l.x,u=e.clientHeight*l.y,h=s*l.x,d=r*l.y;return{width:a,height:u,x:h,y:d}}function CC(e,t,n){let r;if(t==="viewport")r=MB(e,n);else if(t==="document")r=TB(Oi(e));else if(ai(t))r=NB(t,n);else{const s=oT(e);r={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return Tf(r)}function aT(e,t){const n=lo(e);return n===t||!ai(n)||xa(n)?!1:ci(n).position==="fixed"||aT(n,t)}function AB(e,t){const n=t.get(e);if(n)return n;let r=ku(e,[],!1).filter(u=>ai(u)&&ja(u)!=="body"),s=null;const l=ci(e).position==="fixed";let a=l?lo(e):e;for(;ai(a)&&!xa(a);){const u=ci(a),h=mb(a);!h&&u.position==="fixed"&&(s=null),(l?!h&&!s:!h&&u.position==="static"&&!!s&&(s.position==="absolute"||s.position==="fixed")||$u(a)&&!h&&aT(e,a))?r=r.filter(p=>p!==a):s=u,a=lo(a)}return t.set(e,r),r}function DB(e){let{element:t,boundary:n,rootBoundary:r,strategy:s}=e;const a=[...n==="clippingAncestors"?up(t)?[]:AB(t,this._c):[].concat(n),r],u=CC(t,a[0],s);let h=u.top,d=u.right,p=u.bottom,m=u.left;for(let _=1;_<a.length;_++){const y=CC(t,a[_],s);h=Sr(y.top,h),d=oo(y.right,d),p=oo(y.bottom,p),m=Sr(y.left,m)}return{width:d-m,height:p-h,x:m,y:h}}function OB(e){const{width:t,height:n}=sT(e);return{width:t,height:n}}function LB(e,t,n){const r=gs(t),s=Oi(t),l=n==="fixed",a=Qo(e,!0,l,t);let u={scrollLeft:0,scrollTop:0};const h=Ti(0);function d(){h.x=hp(s)}if(r||!r&&!l)if((ja(t)!=="body"||$u(s))&&(u=dp(t)),r){const y=Qo(t,!0,l,t);h.x=y.x+t.clientLeft,h.y=y.y+t.clientTop}else s&&d();l&&!r&&s&&d();const p=s&&!r&&!l?lT(s,u):Ti(0),m=a.left+u.scrollLeft-h.x-p.x,_=a.top+u.scrollTop-h.y-p.y;return{x:m,y:_,width:a.width,height:a.height}}function gv(e){return ci(e).position==="static"}function kC(e,t){if(!gs(e)||ci(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Oi(e)===n&&(n=n.ownerDocument.body),n}function cT(e,t){const n=wr(e);if(up(e))return n;if(!gs(e)){let s=lo(e);for(;s&&!xa(s);){if(ai(s)&&!gv(s))return s;s=lo(s)}return n}let r=kC(e,t);for(;r&&bB(r)&&gv(r);)r=kC(r,t);return r&&xa(r)&&gv(r)&&!mb(r)?n:r||wB(e)||n}const jB=async function(e){const t=this.getOffsetParent||cT,n=this.getDimensions,r=await n(e.floating);return{reference:LB(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function zB(e){return ci(e).direction==="rtl"}const PB={convertOffsetParentRelativeRectToViewportRelativeRect:EB,getDocumentElement:Oi,getClippingRect:DB,getOffsetParent:cT,getElementRects:jB,getClientRects:RB,getDimensions:OB,getScale:ma,isElement:ai,isRTL:zB};function uT(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function BB(e,t){let n=null,r;const s=Oi(e);function l(){var u;clearTimeout(r),(u=n)==null||u.disconnect(),n=null}function a(u,h){u===void 0&&(u=!1),h===void 0&&(h=1),l();const d=e.getBoundingClientRect(),{left:p,top:m,width:_,height:y}=d;if(u||t(),!_||!y)return;const w=Th(m),S=Th(s.clientWidth-(p+_)),C=Th(s.clientHeight-(m+y)),k=Th(p),R={rootMargin:-w+"px "+-S+"px "+-C+"px "+-k+"px",threshold:Sr(0,oo(1,h))||1};let N=!0;function j(A){const D=A[0].intersectionRatio;if(D!==h){if(!N)return a();D?a(!1,D):r=setTimeout(()=>{a(!1,1e-7)},1e3)}D===1&&!uT(d,e.getBoundingClientRect())&&a(),N=!1}try{n=new IntersectionObserver(j,{...R,root:s.ownerDocument})}catch{n=new IntersectionObserver(j,R)}n.observe(e)}return a(!0),l}function IB(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:l=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:u=typeof IntersectionObserver=="function",animationFrame:h=!1}=r,d=vb(e),p=s||l?[...d?ku(d):[],...t?ku(t):[]]:[];p.forEach(k=>{s&&k.addEventListener("scroll",n,{passive:!0}),l&&k.addEventListener("resize",n)});const m=d&&u?BB(d,n):null;let _=-1,y=null;a&&(y=new ResizeObserver(k=>{let[T]=k;T&&T.target===d&&y&&t&&(y.unobserve(t),cancelAnimationFrame(_),_=requestAnimationFrame(()=>{var R;(R=y)==null||R.observe(t)})),n()}),d&&!h&&y.observe(d),t&&y.observe(t));let w,S=h?Qo(e):null;h&&C();function C(){const k=Qo(e);S&&!uT(S,k)&&n(),S=k,w=requestAnimationFrame(C)}return n(),()=>{var k;p.forEach(T=>{s&&T.removeEventListener("scroll",n),l&&T.removeEventListener("resize",n)}),m==null||m(),(k=y)==null||k.disconnect(),y=null,h&&cancelAnimationFrame(w)}}const HB=gB,FB=vB,UB=fB,$B=yB,WB=pB,EC=hB,VB=_B,qB=(e,t,n)=>{const r=new Map,s={platform:PB,...n},l={...s.platform,_c:r};return dB(e,t,{...s,platform:l})};var KB=typeof document<"u",GB=function(){},ef=KB?b.useLayoutEffect:GB;function Mf(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,s;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Mf(e[r],t[r]))return!1;return!0}if(s=Object.keys(e),n=s.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,s[r]))return!1;for(r=n;r--!==0;){const l=s[r];if(!(l==="_owner"&&e.$$typeof)&&!Mf(e[l],t[l]))return!1}return!0}return e!==e&&t!==t}function dT(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function RC(e,t){const n=dT(e);return Math.round(t*n)/n}function vv(e){const t=b.useRef(e);return ef(()=>{t.current=e}),t}function YB(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:s,elements:{reference:l,floating:a}={},transform:u=!0,whileElementsMounted:h,open:d}=e,[p,m]=b.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[_,y]=b.useState(r);Mf(_,r)||y(r);const[w,S]=b.useState(null),[C,k]=b.useState(null),T=b.useCallback(W=>{W!==A.current&&(A.current=W,S(W))},[]),R=b.useCallback(W=>{W!==D.current&&(D.current=W,k(W))},[]),N=l||w,j=a||C,A=b.useRef(null),D=b.useRef(null),B=b.useRef(p),K=h!=null,z=vv(h),U=vv(s),H=vv(d),F=b.useCallback(()=>{if(!A.current||!D.current)return;const W={placement:t,strategy:n,middleware:_};U.current&&(W.platform=U.current),qB(A.current,D.current,W).then(Z=>{const M={...Z,isPositioned:H.current!==!1};q.current&&!Mf(B.current,M)&&(B.current=M,wi.flushSync(()=>{m(M)}))})},[_,t,n,U,H]);ef(()=>{d===!1&&B.current.isPositioned&&(B.current.isPositioned=!1,m(W=>({...W,isPositioned:!1})))},[d]);const q=b.useRef(!1);ef(()=>(q.current=!0,()=>{q.current=!1}),[]),ef(()=>{if(N&&(A.current=N),j&&(D.current=j),N&&j){if(z.current)return z.current(N,j,F);F()}},[N,j,F,z,K]);const $=b.useMemo(()=>({reference:A,floating:D,setReference:T,setFloating:R}),[T,R]),P=b.useMemo(()=>({reference:N,floating:j}),[N,j]),V=b.useMemo(()=>{const W={position:n,left:0,top:0};if(!P.floating)return W;const Z=RC(P.floating,p.x),M=RC(P.floating,p.y);return u?{...W,transform:"translate("+Z+"px, "+M+"px)",...dT(P.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:Z,top:M}},[n,u,P.floating,p.x,p.y]);return b.useMemo(()=>({...p,update:F,refs:$,elements:P,floatingStyles:V}),[p,F,$,P,V])}const XB=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:s}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?EC({element:r.current,padding:s}).fn(n):{}:r?EC({element:r,padding:s}).fn(n):{}}}},ZB=(e,t)=>{const n=HB(e);return{name:n.name,fn:n.fn,options:[e,t]}},QB=(e,t)=>{const n=FB(e);return{name:n.name,fn:n.fn,options:[e,t]}},JB=(e,t)=>({fn:VB(e).fn,options:[e,t]}),eI=(e,t)=>{const n=UB(e);return{name:n.name,fn:n.fn,options:[e,t]}},tI=(e,t)=>{const n=$B(e);return{name:n.name,fn:n.fn,options:[e,t]}},nI=(e,t)=>{const n=WB(e);return{name:n.name,fn:n.fn,options:[e,t]}},rI=(e,t)=>{const n=XB(e);return{name:n.name,fn:n.fn,options:[e,t]}};var iI="Arrow",hT=b.forwardRef((e,t)=>{const{children:n,width:r=10,height:s=5,...l}=e;return g.jsx(Je.svg,{...l,ref:t,width:r,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:g.jsx("polygon",{points:"0,0 30,0 15,10"})})});hT.displayName=iI;var sI=hT;function oI(e){const[t,n]=b.useState(void 0);return zn(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const l=s[0];let a,u;if("borderBoxSize"in l){const h=l.borderBoxSize,d=Array.isArray(h)?h[0]:h;a=d.inlineSize,u=d.blockSize}else a=e.offsetWidth,u=e.offsetHeight;n({width:a,height:u})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var _b="Popper",[fT,uo]=ms(_b),[lI,pT]=fT(_b),mT=e=>{const{__scopePopper:t,children:n}=e,[r,s]=b.useState(null);return g.jsx(lI,{scope:t,anchor:r,onAnchorChange:s,children:n})};mT.displayName=_b;var gT="PopperAnchor",vT=b.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...s}=e,l=pT(gT,n),a=b.useRef(null),u=dt(t,a),h=b.useRef(null);return b.useEffect(()=>{const d=h.current;h.current=(r==null?void 0:r.current)||a.current,d!==h.current&&l.onAnchorChange(h.current)}),r?null:g.jsx(Je.div,{...s,ref:u})});vT.displayName=gT;var yb="PopperContent",[aI,cI]=fT(yb),_T=b.forwardRef((e,t)=>{var J,re,he,ve,Ce,ce;const{__scopePopper:n,side:r="bottom",sideOffset:s=0,align:l="center",alignOffset:a=0,arrowPadding:u=0,avoidCollisions:h=!0,collisionBoundary:d=[],collisionPadding:p=0,sticky:m="partial",hideWhenDetached:_=!1,updatePositionStrategy:y="optimized",onPlaced:w,...S}=e,C=pT(yb,n),[k,T]=b.useState(null),R=dt(t,_e=>T(_e)),[N,j]=b.useState(null),A=oI(N),D=(A==null?void 0:A.width)??0,B=(A==null?void 0:A.height)??0,K=r+(l!=="center"?"-"+l:""),z=typeof p=="number"?p:{top:0,right:0,bottom:0,left:0,...p},U=Array.isArray(d)?d:[d],H=U.length>0,F={padding:z,boundary:U.filter(dI),altBoundary:H},{refs:q,floatingStyles:$,placement:P,isPositioned:V,middlewareData:W}=YB({strategy:"fixed",placement:K,whileElementsMounted:(..._e)=>IB(..._e,{animationFrame:y==="always"}),elements:{reference:C.anchor},middleware:[ZB({mainAxis:s+B,alignmentAxis:a}),h&&QB({mainAxis:!0,crossAxis:!1,limiter:m==="partial"?JB():void 0,...F}),h&&eI({...F}),tI({...F,apply:({elements:_e,rects:Le,availableWidth:St,availableHeight:yt})=>{const{width:$t,height:Gn}=Le.reference,Jt=_e.floating.style;Jt.setProperty("--radix-popper-available-width",`${St}px`),Jt.setProperty("--radix-popper-available-height",`${yt}px`),Jt.setProperty("--radix-popper-anchor-width",`${$t}px`),Jt.setProperty("--radix-popper-anchor-height",`${Gn}px`)}}),N&&rI({element:N,padding:u}),hI({arrowWidth:D,arrowHeight:B}),_&&nI({strategy:"referenceHidden",...F})]}),[Z,M]=xT(P),I=li(w);zn(()=>{V&&(I==null||I())},[V,I]);const X=(J=W.arrow)==null?void 0:J.x,L=(re=W.arrow)==null?void 0:re.y,oe=((he=W.arrow)==null?void 0:he.centerOffset)!==0,[ae,se]=b.useState();return zn(()=>{k&&se(window.getComputedStyle(k).zIndex)},[k]),g.jsx("div",{ref:q.setFloating,"data-radix-popper-content-wrapper":"",style:{...$,transform:V?$.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ae,"--radix-popper-transform-origin":[(ve=W.transformOrigin)==null?void 0:ve.x,(Ce=W.transformOrigin)==null?void 0:Ce.y].join(" "),...((ce=W.hide)==null?void 0:ce.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:g.jsx(aI,{scope:n,placedSide:Z,onArrowChange:j,arrowX:X,arrowY:L,shouldHideArrow:oe,children:g.jsx(Je.div,{"data-side":Z,"data-align":M,...S,ref:R,style:{...S.style,animation:V?void 0:"none"}})})})});_T.displayName=yb;var yT="PopperArrow",uI={top:"bottom",right:"left",bottom:"top",left:"right"},bT=b.forwardRef(function(t,n){const{__scopePopper:r,...s}=t,l=cI(yT,r),a=uI[l.placedSide];return g.jsx("span",{ref:l.onArrowChange,style:{position:"absolute",left:l.arrowX,top:l.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[l.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[l.placedSide],visibility:l.shouldHideArrow?"hidden":void 0},children:g.jsx(sI,{...s,ref:n,style:{...s.style,display:"block"}})})});bT.displayName=yT;function dI(e){return e!==null}var hI=e=>({name:"transformOrigin",options:e,fn(t){var C,k,T;const{placement:n,rects:r,middlewareData:s}=t,a=((C=s.arrow)==null?void 0:C.centerOffset)!==0,u=a?0:e.arrowWidth,h=a?0:e.arrowHeight,[d,p]=xT(n),m={start:"0%",center:"50%",end:"100%"}[p],_=(((k=s.arrow)==null?void 0:k.x)??0)+u/2,y=(((T=s.arrow)==null?void 0:T.y)??0)+h/2;let w="",S="";return d==="bottom"?(w=a?m:`${_}px`,S=`${-h}px`):d==="top"?(w=a?m:`${_}px`,S=`${r.floating.height+h}px`):d==="right"?(w=`${-h}px`,S=a?m:`${y}px`):d==="left"&&(w=`${r.floating.width+h}px`,S=a?m:`${y}px`),{data:{x:w,y:S}}}});function xT(e){const[t,n="center"]=e.split("-");return[t,n]}var fp=mT,Wu=vT,pp=_T,mp=bT,ST=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),fI="VisuallyHidden",wT=b.forwardRef((e,t)=>g.jsx(Je.span,{...e,ref:t,style:{...ST,...e.style}}));wT.displayName=fI;var pI=wT,[gp]=ms("Tooltip",[uo]),vp=uo(),CT="TooltipProvider",mI=700,__="tooltip.open",[gI,bb]=gp(CT),kT=e=>{const{__scopeTooltip:t,delayDuration:n=mI,skipDelayDuration:r=300,disableHoverableContent:s=!1,children:l}=e,a=b.useRef(!0),u=b.useRef(!1),h=b.useRef(0);return b.useEffect(()=>{const d=h.current;return()=>window.clearTimeout(d)},[]),g.jsx(gI,{scope:t,isOpenDelayedRef:a,delayDuration:n,onOpen:b.useCallback(()=>{window.clearTimeout(h.current),a.current=!1},[]),onClose:b.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>a.current=!0,r)},[r]),isPointerInTransitRef:u,onPointerInTransitChange:b.useCallback(d=>{u.current=d},[]),disableHoverableContent:s,children:l})};kT.displayName=CT;var Eu="Tooltip",[vI,Vu]=gp(Eu),ET=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:s,onOpenChange:l,disableHoverableContent:a,delayDuration:u}=e,h=bb(Eu,e.__scopeTooltip),d=vp(t),[p,m]=b.useState(null),_=cs(),y=b.useRef(0),w=a??h.disableHoverableContent,S=u??h.delayDuration,C=b.useRef(!1),[k,T]=ba({prop:r,defaultProp:s??!1,onChange:D=>{D?(h.onOpen(),document.dispatchEvent(new CustomEvent(__))):h.onClose(),l==null||l(D)},caller:Eu}),R=b.useMemo(()=>k?C.current?"delayed-open":"instant-open":"closed",[k]),N=b.useCallback(()=>{window.clearTimeout(y.current),y.current=0,C.current=!1,T(!0)},[T]),j=b.useCallback(()=>{window.clearTimeout(y.current),y.current=0,T(!1)},[T]),A=b.useCallback(()=>{window.clearTimeout(y.current),y.current=window.setTimeout(()=>{C.current=!0,T(!0),y.current=0},S)},[S,T]);return b.useEffect(()=>()=>{y.current&&(window.clearTimeout(y.current),y.current=0)},[]),g.jsx(fp,{...d,children:g.jsx(vI,{scope:t,contentId:_,open:k,stateAttribute:R,trigger:p,onTriggerChange:m,onTriggerEnter:b.useCallback(()=>{h.isOpenDelayedRef.current?A():N()},[h.isOpenDelayedRef,A,N]),onTriggerLeave:b.useCallback(()=>{w?j():(window.clearTimeout(y.current),y.current=0)},[j,w]),onOpen:N,onClose:j,disableHoverableContent:w,children:n})})};ET.displayName=Eu;var y_="TooltipTrigger",RT=b.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,s=Vu(y_,n),l=bb(y_,n),a=vp(n),u=b.useRef(null),h=dt(t,u,s.onTriggerChange),d=b.useRef(!1),p=b.useRef(!1),m=b.useCallback(()=>d.current=!1,[]);return b.useEffect(()=>()=>document.removeEventListener("pointerup",m),[m]),g.jsx(Wu,{asChild:!0,...a,children:g.jsx(Je.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...r,ref:h,onPointerMove:Ee(e.onPointerMove,_=>{_.pointerType!=="touch"&&!p.current&&!l.isPointerInTransitRef.current&&(s.onTriggerEnter(),p.current=!0)}),onPointerLeave:Ee(e.onPointerLeave,()=>{s.onTriggerLeave(),p.current=!1}),onPointerDown:Ee(e.onPointerDown,()=>{s.open&&s.onClose(),d.current=!0,document.addEventListener("pointerup",m,{once:!0})}),onFocus:Ee(e.onFocus,()=>{d.current||s.onOpen()}),onBlur:Ee(e.onBlur,s.onClose),onClick:Ee(e.onClick,s.onClose)})})});RT.displayName=y_;var xb="TooltipPortal",[_I,yI]=gp(xb,{forceMount:void 0}),TT=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:s}=e,l=Vu(xb,t);return g.jsx(_I,{scope:t,forceMount:n,children:g.jsx(Yr,{present:n||l.open,children:g.jsx(Da,{asChild:!0,container:s,children:r})})})};TT.displayName=xb;var Sa="TooltipContent",MT=b.forwardRef((e,t)=>{const n=yI(Sa,e.__scopeTooltip),{forceMount:r=n.forceMount,side:s="top",...l}=e,a=Vu(Sa,e.__scopeTooltip);return g.jsx(Yr,{present:r||a.open,children:a.disableHoverableContent?g.jsx(NT,{side:s,...l,ref:t}):g.jsx(bI,{side:s,...l,ref:t})})}),bI=b.forwardRef((e,t)=>{const n=Vu(Sa,e.__scopeTooltip),r=bb(Sa,e.__scopeTooltip),s=b.useRef(null),l=dt(t,s),[a,u]=b.useState(null),{trigger:h,onClose:d}=n,p=s.current,{onPointerInTransitChange:m}=r,_=b.useCallback(()=>{u(null),m(!1)},[m]),y=b.useCallback((w,S)=>{const C=w.currentTarget,k={x:w.clientX,y:w.clientY},T=kI(k,C.getBoundingClientRect()),R=EI(k,T),N=RI(S.getBoundingClientRect()),j=MI([...R,...N]);u(j),m(!0)},[m]);return b.useEffect(()=>()=>_(),[_]),b.useEffect(()=>{if(h&&p){const w=C=>y(C,p),S=C=>y(C,h);return h.addEventListener("pointerleave",w),p.addEventListener("pointerleave",S),()=>{h.removeEventListener("pointerleave",w),p.removeEventListener("pointerleave",S)}}},[h,p,y,_]),b.useEffect(()=>{if(a){const w=S=>{const C=S.target,k={x:S.clientX,y:S.clientY},T=(h==null?void 0:h.contains(C))||(p==null?void 0:p.contains(C)),R=!TI(k,a);T?_():R&&(_(),d())};return document.addEventListener("pointermove",w),()=>document.removeEventListener("pointermove",w)}},[h,p,a,d,_]),g.jsx(NT,{...e,ref:l})}),[xI,SI]=gp(Eu,{isInside:!1}),wI=Mj("TooltipContent"),NT=b.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":s,onEscapeKeyDown:l,onPointerDownOutside:a,...u}=e,h=Vu(Sa,n),d=vp(n),{onClose:p}=h;return b.useEffect(()=>(document.addEventListener(__,p),()=>document.removeEventListener(__,p)),[p]),b.useEffect(()=>{if(h.trigger){const m=_=>{const y=_.target;y!=null&&y.contains(h.trigger)&&p()};return window.addEventListener("scroll",m,{capture:!0}),()=>window.removeEventListener("scroll",m,{capture:!0})}},[h.trigger,p]),g.jsx(Aa,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:l,onPointerDownOutside:a,onFocusOutside:m=>m.preventDefault(),onDismiss:p,children:g.jsxs(pp,{"data-state":h.stateAttribute,...d,...u,ref:t,style:{...u.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:[g.jsx(wI,{children:r}),g.jsx(xI,{scope:n,isInside:!0,children:g.jsx(pI,{id:h.contentId,role:"tooltip",children:s||r})})]})})});MT.displayName=Sa;var AT="TooltipArrow",CI=b.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,s=vp(n);return SI(AT,n).isInside?null:g.jsx(mp,{...s,...r,ref:t})});CI.displayName=AT;function kI(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),s=Math.abs(t.right-e.x),l=Math.abs(t.left-e.x);switch(Math.min(n,r,s,l)){case l:return"left";case s:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function EI(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function RI(e){const{top:t,right:n,bottom:r,left:s}=e;return[{x:s,y:t},{x:n,y:t},{x:n,y:r},{x:s,y:r}]}function TI(e,t){const{x:n,y:r}=e;let s=!1;for(let l=0,a=t.length-1;l<t.length;a=l++){const u=t[l],h=t[a],d=u.x,p=u.y,m=h.x,_=h.y;p>r!=_>r&&n<(m-d)*(r-p)/(_-p)+d&&(s=!s)}return s}function MI(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),NI(t)}function NI(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const s=e[r];for(;t.length>=2;){const l=t[t.length-1],a=t[t.length-2];if((l.x-a.x)*(s.y-a.y)>=(l.y-a.y)*(s.x-a.x))t.pop();else break}t.push(s)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const s=e[r];for(;n.length>=2;){const l=n[n.length-1],a=n[n.length-2];if((l.x-a.x)*(s.y-a.y)>=(l.y-a.y)*(s.x-a.x))n.pop();else break}n.push(s)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var AI=kT,DT=ET,OT=RT,LT=TT,Sb=MT;function DI({className:e,...t}){return g.jsx("kbd",{className:xe("pointer-events-none inline-flex h-5 min-w-5 items-center justify-center rounded border border-border/60 bg-muted/50 px-1.5 font-mono text-[11px] font-medium text-current select-none",e),...t})}function OI({className:e,...t}){return g.jsx("span",{className:xe("inline-flex items-center gap-0.5",e),...t})}const LI="z-50 overflow-hidden rounded-md border border-border backdrop-blur-md p-0.5 text-[11px] font-medium text-card-foreground shadow-sm 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",jI=AI,Nf=DT,Af=OT,Ru=b.forwardRef(({className:e,sideOffset:t=4,...n},r)=>g.jsx(LT,{children:g.jsx(Sb,{ref:r,sideOffset:t,className:xe("z-50 overflow-hidden rounded-md bg-card text-card-foreground border border-border px-3 py-1.5 text-xs 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",e),...n})}));Ru.displayName=Sb.displayName;const tu=DT,nu=OT;function jT(e){return e.toUpperCase()}function zI(e){const t=e.split("+");return g.jsx(OI,{children:t.map((n,r)=>g.jsx(DI,{children:jT(n)},`${n}-${r}`))})}const ca=b.forwardRef(({className:e,sideOffset:t=4,children:n,shortcut:r,...s},l)=>{const a=r===void 0?null:Array.isArray(r)?r[0]??null:r;return g.jsx(LT,{children:g.jsx(Sb,{ref:l,sideOffset:t,className:xe(LI,e),...s,children:a?zI(a):g.jsx("span",{children:typeof n=="string"?jT(n):n})})})});ca.displayName="HotkeyTooltipContent";const PI="0.13.0",BI={version:PI},Un="Kanna",TC="kanna",II=".kanna",HI=".kanna-dev",FI="KANNA_RUNTIME_PROFILE",wb=`kanna/${BI.version}`,UI="[kanna]",$I=`~/${Un}`;function _p(){var t;return(t=globalThis.process)==null?void 0:t.env}function WI(e=_p()){var t;return((t=e==null?void 0:e[FI])==null?void 0:t.trim().toLowerCase())==="dev"?"dev":"prod"}function VI(e=_p()){return WI(e)==="dev"?HI:II}function qI(e=_p()){return`~/${VI(e)}`}function KI(e=_p()){return`${qI(e)}/keybindings.json`}function Mh(e){return e?`${TC} ${e}`:TC}const yp=({children:e,className:t,shimmerWidth:n=100,animate:r=!0,...s})=>g.jsx("span",{style:{"--shiny-width":`${Math.min(n,100)}px`},className:xe("mx-auto max-w-md text-foreground/50",r?["animate-shiny-text [background-size:var(--shiny-width)_100%] bg-clip-text [background-position:0_0] bg-no-repeat [transition:background-position_1s_cubic-bezier(.6,.6,0,1)_infinite]","bg-gradient-to-r from-transparent via-black/80 via-50% to-transparent dark:via-white/80"]:["text-neutral"],t),...s,children:e});function b_(e){return e.split(/[\s_-]+/).filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join(" ")}const GI=[/^(?:\/usr\/bin\/env\s+)?(?:\/bin\/)?(?:bash|zsh|sh)\s+(?:-[a-zA-Z]*c|-c)\s+(['"])([\s\S]*)\1$/,/^(?:\/usr\/bin\/env\s+)?(?:\/bin\/)?(?:bash|zsh|sh)\s+(?:-[a-zA-Z]*c|-c)\s+(.+)$/,/^(?:\/usr\/bin\/env\s+)?(?:cmd(?:\.exe)?)\s+\/c\s+(['"])([\s\S]*)\1$/i,/^(?:\/usr\/bin\/env\s+)?(?:cmd(?:\.exe)?)\s+\/c\s+(.+)$/i,/^(?:\/usr\/bin\/env\s+)?(?:powershell(?:\.exe)?|pwsh)\s+(?:-NoProfile\s+)?-Command\s+(['"])([\s\S]*)\1$/i,/^(?:\/usr\/bin\/env\s+)?(?:powershell(?:\.exe)?|pwsh)\s+(?:-NoProfile\s+)?-Command\s+(.+)$/i];function YI(e){const t=e.trim();for(const n of GI){const r=t.match(n);if(!r)continue;const s=(r[2]??r[1]??"").trim();if(s)return s}return t}function zT(e){return e.split("/").pop()||e}function XI(e,t){if(e===void 0)return null;const n=Math.max(0,t-e),r=6e4,s=60*r,l=24*s,a=7*l;return n<r?"now":n<s?`${Math.floor(n/r)}m`:n<l?`${Math.floor(n/s)}h`:n<a?`${Math.floor(n/l)}d`:`${Math.floor(n/a)}w`}const ZI=new Set(["starting","running"]);function QI({chat:e,activeChatId:t,nowMs:n,onSelectChat:r,onDeleteChat:s}){const l=XI(e.lastMessageAt,n);return g.jsxs("div",{"data-chat-id":Xw(e.chatId),className:xe("group flex items-center gap-2 pl-2.5 pr-0.5 py-0.5 rounded-lg cursor-pointer border-border/0 hover:border-border hover:bg-muted/20 active:scale-[0.985] border transition-all",t===Xw(e.chatId)?"bg-muted hover:bg-muted border-border":"border-border/0 dark:hover:border-slate-400/10 "),onClick:()=>r(e.chatId),children:[ZI.has(e.status)?g.jsx(Ni,{className:"size-3.5 flex-shrink-0 animate-spin text-muted-foreground"}):e.status==="waiting_for_user"?g.jsx("div",{className:"relative ",children:g.jsxs("div",{className:" rounded-full z-0 size-3.5 flex items-center justify-center ",children:[g.jsx("div",{className:"absolute rounded-full z-0 size-2.5 bg-blue-400/80 animate-ping"}),g.jsx("div",{className:" rounded-full z-0 size-2.5 bg-blue-400 ring-2 ring-muted/20 dark:ring-muted/50"})]})}):null,g.jsx("span",{className:"text-sm truncate flex-1 translate-y-[-0.5px]",children:e.status!=="idle"&&e.status!=="waiting_for_user"?g.jsx(yp,{animate:e.status==="running",shimmerWidth:Math.max(20,e.title.length*3),children:e.title}):e.title}),g.jsxs("div",{className:"relative h-7 w-7 mr-[2px] shrink-0",children:[l?g.jsx("span",{className:"hidden md:flex absolute inset-0 items-center justify-end pr-1 text-[11px] text-muted-foreground opacity-50 transition-opacity group-hover:opacity-0",children:l}):null,g.jsx(nt,{variant:"ghost",size:"icon",className:xe("absolute inset-0 h-7 w-7 opacity-100 cursor-pointer rounded-sm hover:!bg-transparent !border-0",l?"md:opacity-0 md:group-hover:opacity-100":"opacity-100 md:opacity-0 md:group-hover:opacity-100"),onClick:a=>{a.stopPropagation(),s(e.chatId)},title:"Delete chat",children:g.jsx(s6,{className:"size-3.5"})})]})]},e._id)}function JI(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return b.useMemo(()=>r=>{t.forEach(s=>s(r))},t)}const bp=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function za(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Cb(e){return"nodeType"in e}function lr(e){var t,n;return e?za(e)?e:Cb(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function kb(e){const{Document:t}=lr(e);return e instanceof t}function qu(e){return za(e)?!1:e instanceof lr(e).HTMLElement}function PT(e){return e instanceof lr(e).SVGElement}function Pa(e){return e?za(e)?e.document:Cb(e)?kb(e)?e:qu(e)||PT(e)?e.ownerDocument:document:document:document}const Ai=bp?b.useLayoutEffect:b.useEffect;function Eb(e){const t=b.useRef(e);return Ai(()=>{t.current=e}),b.useCallback(function(){for(var n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];return t.current==null?void 0:t.current(...r)},[])}function e8(){const e=b.useRef(null),t=b.useCallback((r,s)=>{e.current=setInterval(r,s)},[]),n=b.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Tu(e,t){t===void 0&&(t=[e]);const n=b.useRef(e);return Ai(()=>{n.current!==e&&(n.current=e)},t),n}function Ku(e,t){const n=b.useRef();return b.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function Df(e){const t=Eb(e),n=b.useRef(null),r=b.useCallback(s=>{s!==n.current&&(t==null||t(s,n.current)),n.current=s},[]);return[n,r]}function x_(e){const t=b.useRef();return b.useEffect(()=>{t.current=e},[e]),t.current}let _v={};function Gu(e,t){return b.useMemo(()=>{if(t)return t;const n=_v[e]==null?0:_v[e]+1;return _v[e]=n,e+"-"+n},[e,t])}function BT(e){return function(t){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((l,a)=>{const u=Object.entries(a);for(const[h,d]of u){const p=l[h];p!=null&&(l[h]=p+e*d)}return l},{...t})}}const ga=BT(1),Of=BT(-1);function t8(e){return"clientX"in e&&"clientY"in e}function Rb(e){if(!e)return!1;const{KeyboardEvent:t}=lr(e.target);return t&&e instanceof t}function n8(e){if(!e)return!1;const{TouchEvent:t}=lr(e.target);return t&&e instanceof t}function S_(e){if(n8(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return t8(e)?{x:e.clientX,y:e.clientY}:null}const Mu=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[Mu.Translate.toString(e),Mu.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),MC="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function r8(e){return e.matches(MC)?e:e.querySelector(MC)}const i8={display:"none"};function s8(e){let{id:t,value:n}=e;return Ct.createElement("div",{id:t,style:i8},n)}function o8(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;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 Ct.createElement("div",{id:t,style:s,role:"status","aria-live":r,"aria-atomic":!0},n)}function l8(){const[e,t]=b.useState("");return{announce:b.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const IT=b.createContext(null);function a8(e){const t=b.useContext(IT);b.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function c8(){const[e]=b.useState(()=>new Set),t=b.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[b.useCallback(r=>{let{type:s,event:l}=r;e.forEach(a=>{var u;return(u=a[s])==null?void 0:u.call(a,l)})},[e]),t]}const u8={draggable:`
435
+ To pick up a draggable item, press the space bar.
436
+ While dragging, use the arrow keys to move the item.
437
+ Press space again to drop the item in its new position, or press escape to cancel.
438
+ `},d8={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function h8(e){let{announcements:t=d8,container:n,hiddenTextDescribedById:r,screenReaderInstructions:s=u8}=e;const{announce:l,announcement:a}=l8(),u=Gu("DndLiveRegion"),[h,d]=b.useState(!1);if(b.useEffect(()=>{d(!0)},[]),a8(b.useMemo(()=>({onDragStart(m){let{active:_}=m;l(t.onDragStart({active:_}))},onDragMove(m){let{active:_,over:y}=m;t.onDragMove&&l(t.onDragMove({active:_,over:y}))},onDragOver(m){let{active:_,over:y}=m;l(t.onDragOver({active:_,over:y}))},onDragEnd(m){let{active:_,over:y}=m;l(t.onDragEnd({active:_,over:y}))},onDragCancel(m){let{active:_,over:y}=m;l(t.onDragCancel({active:_,over:y}))}}),[l,t])),!h)return null;const p=Ct.createElement(Ct.Fragment,null,Ct.createElement(s8,{id:r,value:s.draggable}),Ct.createElement(o8,{id:u,announcement:a}));return n?wi.createPortal(p,n):p}var an;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(an||(an={}));function Lf(){}function NC(e,t){return b.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function f8(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return b.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const ui=Object.freeze({x:0,y:0});function p8(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function m8(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function g8(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function v8(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function AC(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}const _8=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const s=AC(t,t.left,t.top),l=[];for(const a of r){const{id:u}=a,h=n.get(u);if(h){const d=p8(AC(h),s);l.push({id:u,data:{droppableContainer:a,value:d}})}}return l.sort(m8)};function y8(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),s=Math.min(t.left+t.width,e.left+e.width),l=Math.min(t.top+t.height,e.top+e.height),a=s-r,u=l-n;if(r<s&&n<l){const h=t.width*t.height,d=e.width*e.height,p=a*u,m=p/(h+d-p);return Number(m.toFixed(4))}return 0}const b8=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const s=[];for(const l of r){const{id:a}=l,u=n.get(a);if(u){const h=y8(u,t);h>0&&s.push({id:a,data:{droppableContainer:l,value:h}})}}return s.sort(g8)};function x8(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function HT(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:ui}function S8(e){return function(n){for(var r=arguments.length,s=new Array(r>1?r-1:0),l=1;l<r;l++)s[l-1]=arguments[l];return s.reduce((a,u)=>({...a,top:a.top+e*u.y,bottom:a.bottom+e*u.y,left:a.left+e*u.x,right:a.right+e*u.x}),{...n})}}const w8=S8(1);function C8(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function k8(e,t,n){const r=C8(t);if(!r)return e;const{scaleX:s,scaleY:l,x:a,y:u}=r,h=e.left-a-(1-s)*parseFloat(n),d=e.top-u-(1-l)*parseFloat(n.slice(n.indexOf(" ")+1)),p=s?e.width/s:e.width,m=l?e.height/l:e.height;return{width:p,height:m,top:d,right:h+p,bottom:d+m,left:h}}const E8={ignoreTransform:!1};function Ba(e,t){t===void 0&&(t=E8);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:d,transformOrigin:p}=lr(e).getComputedStyle(e);d&&(n=k8(n,d,p))}const{top:r,left:s,width:l,height:a,bottom:u,right:h}=n;return{top:r,left:s,width:l,height:a,bottom:u,right:h}}function DC(e){return Ba(e,{ignoreTransform:!0})}function R8(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function T8(e,t){return t===void 0&&(t=lr(e).getComputedStyle(e)),t.position==="fixed"}function M8(e,t){t===void 0&&(t=lr(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(s=>{const l=t[s];return typeof l=="string"?n.test(l):!1})}function Tb(e,t){const n=[];function r(s){if(t!=null&&n.length>=t||!s)return n;if(kb(s)&&s.scrollingElement!=null&&!n.includes(s.scrollingElement))return n.push(s.scrollingElement),n;if(!qu(s)||PT(s)||n.includes(s))return n;const l=lr(e).getComputedStyle(s);return s!==e&&M8(s,l)&&n.push(s),T8(s,l)?n:r(s.parentNode)}return e?r(e):n}function FT(e){const[t]=Tb(e,1);return t??null}function yv(e){return!bp||!e?null:za(e)?e:Cb(e)?kb(e)||e===Pa(e).scrollingElement?window:qu(e)?e:null:null}function UT(e){return za(e)?e.scrollX:e.scrollLeft}function $T(e){return za(e)?e.scrollY:e.scrollTop}function w_(e){return{x:UT(e),y:$T(e)}}var pn;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(pn||(pn={}));function WT(e){return!bp||!e?!1:e===document.scrollingElement}function VT(e){const t={x:0,y:0},n=WT(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},s=e.scrollTop<=t.y,l=e.scrollLeft<=t.x,a=e.scrollTop>=r.y,u=e.scrollLeft>=r.x;return{isTop:s,isLeft:l,isBottom:a,isRight:u,maxScroll:r,minScroll:t}}const N8={x:.2,y:.2};function A8(e,t,n,r,s){let{top:l,left:a,right:u,bottom:h}=n;r===void 0&&(r=10),s===void 0&&(s=N8);const{isTop:d,isBottom:p,isLeft:m,isRight:_}=VT(e),y={x:0,y:0},w={x:0,y:0},S={height:t.height*s.y,width:t.width*s.x};return!d&&l<=t.top+S.height?(y.y=pn.Backward,w.y=r*Math.abs((t.top+S.height-l)/S.height)):!p&&h>=t.bottom-S.height&&(y.y=pn.Forward,w.y=r*Math.abs((t.bottom-S.height-h)/S.height)),!_&&u>=t.right-S.width?(y.x=pn.Forward,w.x=r*Math.abs((t.right-S.width-u)/S.width)):!m&&a<=t.left+S.width&&(y.x=pn.Backward,w.x=r*Math.abs((t.left+S.width-a)/S.width)),{direction:y,speed:w}}function D8(e){if(e===document.scrollingElement){const{innerWidth:l,innerHeight:a}=window;return{top:0,left:0,right:l,bottom:a,width:l,height:a}}const{top:t,left:n,right:r,bottom:s}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:s,width:e.clientWidth,height:e.clientHeight}}function qT(e){return e.reduce((t,n)=>ga(t,w_(n)),ui)}function O8(e){return e.reduce((t,n)=>t+UT(n),0)}function L8(e){return e.reduce((t,n)=>t+$T(n),0)}function j8(e,t){if(t===void 0&&(t=Ba),!e)return;const{top:n,left:r,bottom:s,right:l}=t(e);FT(e)&&(s<=0||l<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const z8=[["x",["left","right"],O8],["y",["top","bottom"],L8]];class Mb{constructor(t,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=Tb(n),s=qT(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[l,a,u]of z8)for(const h of a)Object.defineProperty(this,h,{get:()=>{const d=u(r),p=s[l]-d;return this.rect[h]+p},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class pu{constructor(t){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=t}add(t,n,r){var s;(s=this.target)==null||s.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function P8(e){const{EventTarget:t}=lr(e);return e instanceof t?e:Pa(e)}function bv(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var $r;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})($r||($r={}));function OC(e){e.preventDefault()}function B8(e){e.stopPropagation()}var ut;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(ut||(ut={}));const KT={start:[ut.Space,ut.Enter],cancel:[ut.Esc],end:[ut.Space,ut.Enter,ut.Tab]},I8=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case ut.Right:return{...n,x:n.x+25};case ut.Left:return{...n,x:n.x-25};case ut.Down:return{...n,y:n.y+25};case ut.Up:return{...n,y:n.y-25}}};class Nb{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new pu(Pa(n)),this.windowListeners=new pu(lr(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add($r.Resize,this.handleCancel),this.windowListeners.add($r.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add($r.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&j8(r),n(ui)}handleKeyDown(t){if(Rb(t)){const{active:n,context:r,options:s}=this.props,{keyboardCodes:l=KT,coordinateGetter:a=I8,scrollBehavior:u="smooth"}=s,{code:h}=t;if(l.end.includes(h)){this.handleEnd(t);return}if(l.cancel.includes(h)){this.handleCancel(t);return}const{collisionRect:d}=r.current,p=d?{x:d.left,y:d.top}:ui;this.referenceCoordinates||(this.referenceCoordinates=p);const m=a(t,{active:n,context:r.current,currentCoordinates:p});if(m){const _=Of(m,p),y={x:0,y:0},{scrollableAncestors:w}=r.current;for(const S of w){const C=t.code,{isTop:k,isRight:T,isLeft:R,isBottom:N,maxScroll:j,minScroll:A}=VT(S),D=D8(S),B={x:Math.min(C===ut.Right?D.right-D.width/2:D.right,Math.max(C===ut.Right?D.left:D.left+D.width/2,m.x)),y:Math.min(C===ut.Down?D.bottom-D.height/2:D.bottom,Math.max(C===ut.Down?D.top:D.top+D.height/2,m.y))},K=C===ut.Right&&!T||C===ut.Left&&!R,z=C===ut.Down&&!N||C===ut.Up&&!k;if(K&&B.x!==m.x){const U=S.scrollLeft+_.x,H=C===ut.Right&&U<=j.x||C===ut.Left&&U>=A.x;if(H&&!_.y){S.scrollTo({left:U,behavior:u});return}H?y.x=S.scrollLeft-U:y.x=C===ut.Right?S.scrollLeft-j.x:S.scrollLeft-A.x,y.x&&S.scrollBy({left:-y.x,behavior:u});break}else if(z&&B.y!==m.y){const U=S.scrollTop+_.y,H=C===ut.Down&&U<=j.y||C===ut.Up&&U>=A.y;if(H&&!_.x){S.scrollTo({top:U,behavior:u});return}H?y.y=S.scrollTop-U:y.y=C===ut.Down?S.scrollTop-j.y:S.scrollTop-A.y,y.y&&S.scrollBy({top:-y.y,behavior:u});break}}this.handleMove(t,ga(Of(m,this.referenceCoordinates),y))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}Nb.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=KT,onActivation:s}=t,{active:l}=n;const{code:a}=e.nativeEvent;if(r.start.includes(a)){const u=l.activatorNode.current;return u&&e.target!==u?!1:(e.preventDefault(),s==null||s({event:e.nativeEvent}),!0)}return!1}}];function LC(e){return!!(e&&"distance"in e)}function jC(e){return!!(e&&"delay"in e)}class Ab{constructor(t,n,r){var s;r===void 0&&(r=P8(t.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=t,this.events=n;const{event:l}=t,{target:a}=l;this.props=t,this.events=n,this.document=Pa(a),this.documentListeners=new pu(this.document),this.listeners=new pu(r),this.windowListeners=new pu(lr(a)),this.initialCoordinates=(s=S_(l))!=null?s:ui,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:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add($r.Resize,this.handleCancel),this.windowListeners.add($r.DragStart,OC),this.windowListeners.add($r.VisibilityChange,this.handleCancel),this.windowListeners.add($r.ContextMenu,OC),this.documentListeners.add($r.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(jC(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(LC(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(t,n){const{active:r,onPending:s}=this.props;s(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add($r.Click,B8,{capture:!0}),this.removeTextSelection(),this.documentListeners.add($r.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:s,props:l}=this,{onMove:a,options:{activationConstraint:u}}=l;if(!s)return;const h=(n=S_(t))!=null?n:ui,d=Of(s,h);if(!r&&u){if(LC(u)){if(u.tolerance!=null&&bv(d,u.tolerance))return this.handleCancel();if(bv(d,u.distance))return this.handleStart()}if(jC(u)&&bv(d,u.tolerance))return this.handleCancel();this.handlePending(u,d);return}t.cancelable&&t.preventDefault(),a(h)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===ut.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const H8={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Db extends Ab{constructor(t){const{event:n}=t,r=Pa(n.target);super(t,H8,r)}}Db.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r==null||r({event:n}),!0)}}];const F8={move:{name:"mousemove"},end:{name:"mouseup"}};var C_;(function(e){e[e.RightClick=2]="RightClick"})(C_||(C_={}));class U8 extends Ab{constructor(t){super(t,F8,Pa(t.event.target))}}U8.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===C_.RightClick?!1:(r==null||r({event:n}),!0)}}];const xv={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class $8 extends Ab{constructor(t){super(t,xv)}static setup(){return window.addEventListener(xv.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(xv.move.name,t)};function t(){}}}$8.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:s}=n;return s.length>1?!1:(r==null||r({event:n}),!0)}}];var mu;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(mu||(mu={}));var jf;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(jf||(jf={}));function W8(e){let{acceleration:t,activator:n=mu.Pointer,canScroll:r,draggingRect:s,enabled:l,interval:a=5,order:u=jf.TreeOrder,pointerCoordinates:h,scrollableAncestors:d,scrollableAncestorRects:p,delta:m,threshold:_}=e;const y=q8({delta:m,disabled:!l}),[w,S]=e8(),C=b.useRef({x:0,y:0}),k=b.useRef({x:0,y:0}),T=b.useMemo(()=>{switch(n){case mu.Pointer:return h?{top:h.y,bottom:h.y,left:h.x,right:h.x}:null;case mu.DraggableRect:return s}},[n,s,h]),R=b.useRef(null),N=b.useCallback(()=>{const A=R.current;if(!A)return;const D=C.current.x*k.current.x,B=C.current.y*k.current.y;A.scrollBy(D,B)},[]),j=b.useMemo(()=>u===jf.TreeOrder?[...d].reverse():d,[u,d]);b.useEffect(()=>{if(!l||!d.length||!T){S();return}for(const A of j){if((r==null?void 0:r(A))===!1)continue;const D=d.indexOf(A),B=p[D];if(!B)continue;const{direction:K,speed:z}=A8(A,B,T,t,_);for(const U of["x","y"])y[U][K[U]]||(z[U]=0,K[U]=0);if(z.x>0||z.y>0){S(),R.current=A,w(N,a),C.current=z,k.current=K;return}}C.current={x:0,y:0},k.current={x:0,y:0},S()},[t,N,r,S,l,a,JSON.stringify(T),JSON.stringify(y),w,d,j,p,JSON.stringify(_)])}const V8={x:{[pn.Backward]:!1,[pn.Forward]:!1},y:{[pn.Backward]:!1,[pn.Forward]:!1}};function q8(e){let{delta:t,disabled:n}=e;const r=x_(t);return Ku(s=>{if(n||!r||!s)return V8;const l={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[pn.Backward]:s.x[pn.Backward]||l.x===-1,[pn.Forward]:s.x[pn.Forward]||l.x===1},y:{[pn.Backward]:s.y[pn.Backward]||l.y===-1,[pn.Forward]:s.y[pn.Forward]||l.y===1}}},[n,t,r])}function K8(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return Ku(s=>{var l;return t==null?null:(l=r??s)!=null?l:null},[r,t])}function G8(e,t){return b.useMemo(()=>e.reduce((n,r)=>{const{sensor:s}=r,l=s.activators.map(a=>({eventName:a.eventName,handler:t(a.handler,r)}));return[...n,...l]},[]),[e,t])}var Nu;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Nu||(Nu={}));var k_;(function(e){e.Optimized="optimized"})(k_||(k_={}));const zC=new Map;function Y8(e,t){let{dragging:n,dependencies:r,config:s}=t;const[l,a]=b.useState(null),{frequency:u,measure:h,strategy:d}=s,p=b.useRef(e),m=C(),_=Tu(m),y=b.useCallback(function(k){k===void 0&&(k=[]),!_.current&&a(T=>T===null?k:T.concat(k.filter(R=>!T.includes(R))))},[_]),w=b.useRef(null),S=Ku(k=>{if(m&&!n)return zC;if(!k||k===zC||p.current!==e||l!=null){const T=new Map;for(let R of e){if(!R)continue;if(l&&l.length>0&&!l.includes(R.id)&&R.rect.current){T.set(R.id,R.rect.current);continue}const N=R.node.current,j=N?new Mb(h(N),N):null;R.rect.current=j,j&&T.set(R.id,j)}return T}return k},[e,l,n,m,h]);return b.useEffect(()=>{p.current=e},[e]),b.useEffect(()=>{m||y()},[n,m]),b.useEffect(()=>{l&&l.length>0&&a(null)},[JSON.stringify(l)]),b.useEffect(()=>{m||typeof u!="number"||w.current!==null||(w.current=setTimeout(()=>{y(),w.current=null},u))},[u,m,y,...r]),{droppableRects:S,measureDroppableContainers:y,measuringScheduled:l!=null};function C(){switch(d){case Nu.Always:return!1;case Nu.BeforeDragging:return n;default:return!n}}}function GT(e,t){return Ku(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function X8(e,t){return GT(e,t)}function Z8(e){let{callback:t,disabled:n}=e;const r=Eb(t),s=b.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:l}=window;return new l(r)},[r,n]);return b.useEffect(()=>()=>s==null?void 0:s.disconnect(),[s]),s}function xp(e){let{callback:t,disabled:n}=e;const r=Eb(t),s=b.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:l}=window;return new l(r)},[n]);return b.useEffect(()=>()=>s==null?void 0:s.disconnect(),[s]),s}function Q8(e){return new Mb(Ba(e),e)}function PC(e,t,n){t===void 0&&(t=Q8);const[r,s]=b.useState(null);function l(){s(h=>{if(!e)return null;if(e.isConnected===!1){var d;return(d=h??n)!=null?d:null}const p=t(e);return JSON.stringify(h)===JSON.stringify(p)?h:p})}const a=Z8({callback(h){if(e)for(const d of h){const{type:p,target:m}=d;if(p==="childList"&&m instanceof HTMLElement&&m.contains(e)){l();break}}}}),u=xp({callback:l});return Ai(()=>{l(),e?(u==null||u.observe(e),a==null||a.observe(document.body,{childList:!0,subtree:!0})):(u==null||u.disconnect(),a==null||a.disconnect())},[e]),r}function J8(e){const t=GT(e);return HT(e,t)}const BC=[];function e9(e){const t=b.useRef(e),n=Ku(r=>e?r&&r!==BC&&e&&t.current&&e.parentNode===t.current.parentNode?r:Tb(e):BC,[e]);return b.useEffect(()=>{t.current=e},[e]),n}function t9(e){const[t,n]=b.useState(null),r=b.useRef(e),s=b.useCallback(l=>{const a=yv(l.target);a&&n(u=>u?(u.set(a,w_(a)),new Map(u)):null)},[]);return b.useEffect(()=>{const l=r.current;if(e!==l){a(l);const u=e.map(h=>{const d=yv(h);return d?(d.addEventListener("scroll",s,{passive:!0}),[d,w_(d)]):null}).filter(h=>h!=null);n(u.length?new Map(u):null),r.current=e}return()=>{a(e),a(l)};function a(u){u.forEach(h=>{const d=yv(h);d==null||d.removeEventListener("scroll",s)})}},[s,e]),b.useMemo(()=>e.length?t?Array.from(t.values()).reduce((l,a)=>ga(l,a),ui):qT(e):ui,[e,t])}function IC(e,t){t===void 0&&(t=[]);const n=b.useRef(null);return b.useEffect(()=>{n.current=null},t),b.useEffect(()=>{const r=e!==ui;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?Of(e,n.current):ui}function n9(e){b.useEffect(()=>{if(!bp)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n==null||n()}},e.map(t=>{let{sensor:n}=t;return n}))}function r9(e,t){return b.useMemo(()=>e.reduce((n,r)=>{let{eventName:s,handler:l}=r;return n[s]=a=>{l(a,t)},n},{}),[e,t])}function YT(e){return b.useMemo(()=>e?R8(e):null,[e])}const HC=[];function i9(e,t){t===void 0&&(t=Ba);const[n]=e,r=YT(n?lr(n):null),[s,l]=b.useState(HC);function a(){l(()=>e.length?e.map(h=>WT(h)?r:new Mb(t(h),h)):HC)}const u=xp({callback:a});return Ai(()=>{u==null||u.disconnect(),a(),e.forEach(h=>u==null?void 0:u.observe(h))},[e]),s}function s9(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return qu(t)?t:e}function o9(e){let{measure:t}=e;const[n,r]=b.useState(null),s=b.useCallback(d=>{for(const{target:p}of d)if(qu(p)){r(m=>{const _=t(p);return m?{...m,width:_.width,height:_.height}:_});break}},[t]),l=xp({callback:s}),a=b.useCallback(d=>{const p=s9(d);l==null||l.disconnect(),p&&(l==null||l.observe(p)),r(p?t(p):null)},[t,l]),[u,h]=Df(a);return b.useMemo(()=>({nodeRef:u,rect:n,setRef:h}),[n,u,h])}const l9=[{sensor:Db,options:{}},{sensor:Nb,options:{}}],a9={current:{}},tf={draggable:{measure:DC},droppable:{measure:DC,strategy:Nu.WhileDragging,frequency:k_.Optimized},dragOverlay:{measure:Ba}};class gu extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const c9={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new gu,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Lf},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:tf,measureDroppableContainers:Lf,windowRect:null,measuringScheduled:!1},u9={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Lf,draggableNodes:new Map,over:null,measureDroppableContainers:Lf},Sp=b.createContext(u9),XT=b.createContext(c9);function d9(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new gu}}}function h9(e,t){switch(t.type){case an.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case an.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case an.DragEnd:case an.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case an.RegisterDroppable:{const{element:n}=t,{id:r}=n,s=new gu(e.droppable.containers);return s.set(r,n),{...e,droppable:{...e.droppable,containers:s}}}case an.SetDroppableDisabled:{const{id:n,key:r,disabled:s}=t,l=e.droppable.containers.get(n);if(!l||r!==l.key)return e;const a=new gu(e.droppable.containers);return a.set(n,{...l,disabled:s}),{...e,droppable:{...e.droppable,containers:a}}}case an.UnregisterDroppable:{const{id:n,key:r}=t,s=e.droppable.containers.get(n);if(!s||r!==s.key)return e;const l=new gu(e.droppable.containers);return l.delete(n),{...e,droppable:{...e.droppable,containers:l}}}default:return e}}function f9(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:s}=b.useContext(Sp),l=x_(r),a=x_(n==null?void 0:n.id);return b.useEffect(()=>{if(!t&&!r&&l&&a!=null){if(!Rb(l)||document.activeElement===l.target)return;const u=s.get(a);if(!u)return;const{activatorNode:h,node:d}=u;if(!h.current&&!d.current)return;requestAnimationFrame(()=>{for(const p of[h.current,d.current]){if(!p)continue;const m=r8(p);if(m){m.focus();break}}})}},[r,t,s,a,l]),null}function p9(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((s,l)=>l({transform:s,...r}),n):n}function m9(e){return b.useMemo(()=>({draggable:{...tf.draggable,...e==null?void 0:e.draggable},droppable:{...tf.droppable,...e==null?void 0:e.droppable},dragOverlay:{...tf.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function g9(e){let{activeNode:t,measure:n,initialRect:r,config:s=!0}=e;const l=b.useRef(!1),{x:a,y:u}=typeof s=="boolean"?{x:s,y:s}:s;Ai(()=>{if(!a&&!u||!t){l.current=!1;return}if(l.current||!r)return;const d=t==null?void 0:t.node.current;if(!d||d.isConnected===!1)return;const p=n(d),m=HT(p,r);if(a||(m.x=0),u||(m.y=0),l.current=!0,Math.abs(m.x)>0||Math.abs(m.y)>0){const _=FT(d);_&&_.scrollBy({top:m.y,left:m.x})}},[t,a,u,r,n])}const ZT=b.createContext({...ui,scaleX:1,scaleY:1});var Qs;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Qs||(Qs={}));const v9=b.memo(function(t){var n,r,s,l;let{id:a,accessibility:u,autoScroll:h=!0,children:d,sensors:p=l9,collisionDetection:m=b8,measuring:_,modifiers:y,...w}=t;const S=b.useReducer(h9,void 0,d9),[C,k]=S,[T,R]=c8(),[N,j]=b.useState(Qs.Uninitialized),A=N===Qs.Initialized,{draggable:{active:D,nodes:B,translate:K},droppable:{containers:z}}=C,U=D!=null?B.get(D):null,H=b.useRef({initial:null,translated:null}),F=b.useMemo(()=>{var Se;return D!=null?{id:D,data:(Se=U==null?void 0:U.data)!=null?Se:a9,rect:H}:null},[D,U]),q=b.useRef(null),[$,P]=b.useState(null),[V,W]=b.useState(null),Z=Tu(w,Object.values(w)),M=Gu("DndDescribedBy",a),I=b.useMemo(()=>z.getEnabled(),[z]),X=m9(_),{droppableRects:L,measureDroppableContainers:oe,measuringScheduled:ae}=Y8(I,{dragging:A,dependencies:[K.x,K.y],config:X.droppable}),se=K8(B,D),J=b.useMemo(()=>V?S_(V):null,[V]),re=le(),he=X8(se,X.draggable.measure);g9({activeNode:D!=null?B.get(D):null,config:re.layoutShiftCompensation,initialRect:he,measure:X.draggable.measure});const ve=PC(se,X.draggable.measure,he),Ce=PC(se?se.parentElement:null),ce=b.useRef({activatorEvent:null,active:null,activeNode:se,collisionRect:null,collisions:null,droppableRects:L,draggableNodes:B,draggingNode:null,draggingNodeRect:null,droppableContainers:z,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),_e=z.getNodeFor((n=ce.current.over)==null?void 0:n.id),Le=o9({measure:X.dragOverlay.measure}),St=(r=Le.nodeRef.current)!=null?r:se,yt=A?(s=Le.rect)!=null?s:ve:null,$t=!!(Le.nodeRef.current&&Le.rect),Gn=J8($t?null:ve),Jt=YT(St?lr(St):null),Wt=e9(A?_e??se:null),un=i9(Wt),cr=p9(y,{transform:{x:K.x-Gn.x,y:K.y-Gn.y,scaleX:1,scaleY:1},activatorEvent:V,active:F,activeNodeRect:ve,containerNodeRect:Ce,draggingNodeRect:yt,over:ce.current.over,overlayNodeRect:Le.rect,scrollableAncestors:Wt,scrollableAncestorRects:un,windowRect:Jt}),pe=J?ga(J,K):null,Ge=t9(Wt),ur=IC(Ge),ue=IC(Ge,[ve]),ye=ga(cr,ur),Ae=yt?w8(yt,cr):null,Be=F&&Ae?m({active:F,collisionRect:Ae,droppableRects:L,droppableContainers:I,pointerCoordinates:pe}):null,Ye=v8(Be,"id"),[Mt,Yn]=b.useState(null),en=$t?cr:ga(cr,ue),kt=x8(en,(l=Mt==null?void 0:Mt.rect)!=null?l:null,ve),Vt=b.useRef(null),st=b.useCallback((Se,Pe)=>{let{sensor:We,options:ot}=Pe;if(q.current==null)return;const Bn=B.get(q.current);if(!Bn)return;const An=Se.nativeEvent,Xn=new We({active:q.current,activeNode:Bn,event:An,options:ot,context:ce,onAbort(tn){if(!B.get(tn))return;const{onDragAbort:dr}=Z.current,Tr={id:tn};dr==null||dr(Tr),T({type:"onDragAbort",event:Tr})},onPending(tn,Xr,dr,Tr){if(!B.get(tn))return;const{onDragPending:Pi}=Z.current,Zr={id:tn,constraint:Xr,initialCoordinates:dr,offset:Tr};Pi==null||Pi(Zr),T({type:"onDragPending",event:Zr})},onStart(tn){const Xr=q.current;if(Xr==null)return;const dr=B.get(Xr);if(!dr)return;const{onDragStart:Tr}=Z.current,zi={activatorEvent:An,active:{id:Xr,data:dr.data,rect:H}};wi.unstable_batchedUpdates(()=>{Tr==null||Tr(zi),j(Qs.Initializing),k({type:an.DragStart,initialCoordinates:tn,active:Xr}),T({type:"onDragStart",event:zi}),P(Vt.current),W(An)})},onMove(tn){k({type:an.DragMove,coordinates:tn})},onEnd:Rr(an.DragEnd),onCancel:Rr(an.DragCancel)});Vt.current=Xn;function Rr(tn){return async function(){const{active:dr,collisions:Tr,over:zi,scrollAdjustedTranslate:Pi}=ce.current;let Zr=null;if(dr&&Pi){const{cancelDrop:bs}=Z.current;Zr={activatorEvent:An,active:dr,collisions:Tr,delta:Pi,over:zi},tn===an.DragEnd&&typeof bs=="function"&&await Promise.resolve(bs(Zr))&&(tn=an.DragCancel)}q.current=null,wi.unstable_batchedUpdates(()=>{k({type:tn}),j(Qs.Uninitialized),Yn(null),P(null),W(null),Vt.current=null;const bs=tn===an.DragEnd?"onDragEnd":"onDragCancel";if(Zr){const Mr=Z.current[bs];Mr==null||Mr(Zr),T({type:bs,event:Zr})}})}}},[B]),Er=b.useCallback((Se,Pe)=>(We,ot)=>{const Bn=We.nativeEvent,An=B.get(ot);if(q.current!==null||!An||Bn.dndKit||Bn.defaultPrevented)return;const Xn={active:An};Se(We,Pe.options,Xn)===!0&&(Bn.dndKit={capturedBy:Pe.sensor},q.current=ot,st(We,Pe))},[B,st]),Sn=G8(p,Er);n9(p),Ai(()=>{ve&&N===Qs.Initializing&&j(Qs.Initialized)},[ve,N]),b.useEffect(()=>{const{onDragMove:Se}=Z.current,{active:Pe,activatorEvent:We,collisions:ot,over:Bn}=ce.current;if(!Pe||!We)return;const An={active:Pe,activatorEvent:We,collisions:ot,delta:{x:ye.x,y:ye.y},over:Bn};wi.unstable_batchedUpdates(()=>{Se==null||Se(An),T({type:"onDragMove",event:An})})},[ye.x,ye.y]),b.useEffect(()=>{const{active:Se,activatorEvent:Pe,collisions:We,droppableContainers:ot,scrollAdjustedTranslate:Bn}=ce.current;if(!Se||q.current==null||!Pe||!Bn)return;const{onDragOver:An}=Z.current,Xn=ot.get(Ye),Rr=Xn&&Xn.rect.current?{id:Xn.id,rect:Xn.rect.current,data:Xn.data,disabled:Xn.disabled}:null,tn={active:Se,activatorEvent:Pe,collisions:We,delta:{x:Bn.x,y:Bn.y},over:Rr};wi.unstable_batchedUpdates(()=>{Yn(Rr),An==null||An(tn),T({type:"onDragOver",event:tn})})},[Ye]),Ai(()=>{ce.current={activatorEvent:V,active:F,activeNode:se,collisionRect:Ae,collisions:Be,droppableRects:L,draggableNodes:B,draggingNode:St,draggingNodeRect:yt,droppableContainers:z,over:Mt,scrollableAncestors:Wt,scrollAdjustedTranslate:ye},H.current={initial:yt,translated:Ae}},[F,se,Be,Ae,B,St,yt,L,z,Mt,Wt,ye]),W8({...re,delta:K,draggingRect:Ae,pointerCoordinates:pe,scrollableAncestors:Wt,scrollableAncestorRects:un});const pl=b.useMemo(()=>({active:F,activeNode:se,activeNodeRect:ve,activatorEvent:V,collisions:Be,containerNodeRect:Ce,dragOverlay:Le,draggableNodes:B,droppableContainers:z,droppableRects:L,over:Mt,measureDroppableContainers:oe,scrollableAncestors:Wt,scrollableAncestorRects:un,measuringConfiguration:X,measuringScheduled:ae,windowRect:Jt}),[F,se,ve,V,Be,Ce,Le,B,z,L,Mt,oe,Wt,un,X,ae,Jt]),ji=b.useMemo(()=>({activatorEvent:V,activators:Sn,active:F,activeNodeRect:ve,ariaDescribedById:{draggable:M},dispatch:k,draggableNodes:B,over:Mt,measureDroppableContainers:oe}),[V,Sn,F,ve,k,M,B,Mt,oe]);return Ct.createElement(IT.Provider,{value:R},Ct.createElement(Sp.Provider,{value:ji},Ct.createElement(XT.Provider,{value:pl},Ct.createElement(ZT.Provider,{value:kt},d)),Ct.createElement(f9,{disabled:(u==null?void 0:u.restoreFocus)===!1})),Ct.createElement(h8,{...u,hiddenTextDescribedById:M}));function le(){const Se=($==null?void 0:$.autoScrollEnabled)===!1,Pe=typeof h=="object"?h.enabled===!1:h===!1,We=A&&!Se&&!Pe;return typeof h=="object"?{...h,enabled:We}:{enabled:We}}}),_9=b.createContext(null),FC="button",y9="Draggable";function b9(e){let{id:t,data:n,disabled:r=!1,attributes:s}=e;const l=Gu(y9),{activators:a,activatorEvent:u,active:h,activeNodeRect:d,ariaDescribedById:p,draggableNodes:m,over:_}=b.useContext(Sp),{role:y=FC,roleDescription:w="draggable",tabIndex:S=0}=s??{},C=(h==null?void 0:h.id)===t,k=b.useContext(C?ZT:_9),[T,R]=Df(),[N,j]=Df(),A=r9(a,t),D=Tu(n);Ai(()=>(m.set(t,{id:t,key:l,node:T,activatorNode:N,data:D}),()=>{const K=m.get(t);K&&K.key===l&&m.delete(t)}),[m,t]);const B=b.useMemo(()=>({role:y,tabIndex:S,"aria-disabled":r,"aria-pressed":C&&y===FC?!0:void 0,"aria-roledescription":w,"aria-describedby":p.draggable}),[r,y,S,C,w,p.draggable]);return{active:h,activatorEvent:u,activeNodeRect:d,attributes:B,isDragging:C,listeners:r?void 0:A,node:T,over:_,setNodeRef:R,setActivatorNodeRef:j,transform:k}}function x9(){return b.useContext(XT)}const S9="Droppable",w9={timeout:25};function C9(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:s}=e;const l=Gu(S9),{active:a,dispatch:u,over:h,measureDroppableContainers:d}=b.useContext(Sp),p=b.useRef({disabled:n}),m=b.useRef(!1),_=b.useRef(null),y=b.useRef(null),{disabled:w,updateMeasurementsFor:S,timeout:C}={...w9,...s},k=Tu(S??r),T=b.useCallback(()=>{if(!m.current){m.current=!0;return}y.current!=null&&clearTimeout(y.current),y.current=setTimeout(()=>{d(Array.isArray(k.current)?k.current:[k.current]),y.current=null},C)},[C]),R=xp({callback:T,disabled:w||!a}),N=b.useCallback((B,K)=>{R&&(K&&(R.unobserve(K),m.current=!1),B&&R.observe(B))},[R]),[j,A]=Df(N),D=Tu(t);return b.useEffect(()=>{!R||!j.current||(R.disconnect(),m.current=!1,R.observe(j.current))},[j,R]),b.useEffect(()=>(u({type:an.RegisterDroppable,element:{id:r,key:l,disabled:n,node:j,rect:_,data:D}}),()=>u({type:an.UnregisterDroppable,key:l,id:r})),[r]),b.useEffect(()=>{n!==p.current.disabled&&(u({type:an.SetDroppableDisabled,id:r,key:l,disabled:n}),p.current.disabled=n)},[r,l,n,u]),{active:a,rect:_,isOver:(h==null?void 0:h.id)===r,node:j,over:h,setNodeRef:A}}function Ob(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function k9(e,t){return e.reduce((n,r,s)=>{const l=t.get(r);return l&&(n[s]=l),n},Array(e.length))}function Nh(e){return e!==null&&e>=0}function E9(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function R9(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const QT=e=>{let{rects:t,activeIndex:n,overIndex:r,index:s}=e;const l=Ob(t,r,n),a=t[s],u=l[s];return!u||!a?null:{x:u.left-a.left,y:u.top-a.top,scaleX:u.width/a.width,scaleY:u.height/a.height}},Ah={scaleX:1,scaleY:1},T9=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:s,rects:l,overIndex:a}=e;const u=(t=l[n])!=null?t:r;if(!u)return null;if(s===n){const d=l[a];return d?{x:0,y:n<a?d.top+d.height-(u.top+u.height):d.top-u.top,...Ah}:null}const h=M9(l,s,n);return s>n&&s<=a?{x:0,y:-u.height-h,...Ah}:s<n&&s>=a?{x:0,y:u.height+h,...Ah}:{x:0,y:0,...Ah}};function M9(e,t,n){const r=e[t],s=e[t-1],l=e[t+1];return r?n<t?s?r.top-(s.top+s.height):l?l.top-(r.top+r.height):0:l?l.top-(r.top+r.height):s?r.top-(s.top+s.height):0:0}const JT="Sortable",eM=Ct.createContext({activeIndex:-1,containerId:JT,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:QT,disabled:{draggable:!1,droppable:!1}});function N9(e){let{children:t,id:n,items:r,strategy:s=QT,disabled:l=!1}=e;const{active:a,dragOverlay:u,droppableRects:h,over:d,measureDroppableContainers:p}=x9(),m=Gu(JT,n),_=u.rect!==null,y=b.useMemo(()=>r.map(A=>typeof A=="object"&&"id"in A?A.id:A),[r]),w=a!=null,S=a?y.indexOf(a.id):-1,C=d?y.indexOf(d.id):-1,k=b.useRef(y),T=!E9(y,k.current),R=C!==-1&&S===-1||T,N=R9(l);Ai(()=>{T&&w&&p(y)},[T,y,w,p]),b.useEffect(()=>{k.current=y},[y]);const j=b.useMemo(()=>({activeIndex:S,containerId:m,disabled:N,disableTransforms:R,items:y,overIndex:C,useDragOverlay:_,sortedRects:k9(y,h),strategy:s}),[S,m,N.draggable,N.droppable,R,y,C,h,_,s]);return Ct.createElement(eM.Provider,{value:j},t)}const A9=e=>{let{id:t,items:n,activeIndex:r,overIndex:s}=e;return Ob(n,r,s).indexOf(t)},D9=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:s,items:l,newIndex:a,previousItems:u,previousContainerId:h,transition:d}=e;return!d||!r||u!==l&&s===a?!1:n?!0:a!==s&&t===h},O9={duration:200,easing:"ease"},tM="transform",L9=Mu.Transition.toString({property:tM,duration:0,easing:"linear"}),j9={roleDescription:"sortable"};function z9(e){let{disabled:t,index:n,node:r,rect:s}=e;const[l,a]=b.useState(null),u=b.useRef(n);return Ai(()=>{if(!t&&n!==u.current&&r.current){const h=s.current;if(h){const d=Ba(r.current,{ignoreTransform:!0}),p={x:h.left-d.left,y:h.top-d.top,scaleX:h.width/d.width,scaleY:h.height/d.height};(p.x||p.y)&&a(p)}}n!==u.current&&(u.current=n)},[t,n,r,s]),b.useEffect(()=>{l&&a(null)},[l]),l}function P9(e){let{animateLayoutChanges:t=D9,attributes:n,disabled:r,data:s,getNewIndex:l=A9,id:a,strategy:u,resizeObserverConfig:h,transition:d=O9}=e;const{items:p,containerId:m,activeIndex:_,disabled:y,disableTransforms:w,sortedRects:S,overIndex:C,useDragOverlay:k,strategy:T}=b.useContext(eM),R=B9(r,y),N=p.indexOf(a),j=b.useMemo(()=>({sortable:{containerId:m,index:N,items:p},...s}),[m,s,N,p]),A=b.useMemo(()=>p.slice(p.indexOf(a)),[p,a]),{rect:D,node:B,isOver:K,setNodeRef:z}=C9({id:a,data:j,disabled:R.droppable,resizeObserverConfig:{updateMeasurementsFor:A,...h}}),{active:U,activatorEvent:H,activeNodeRect:F,attributes:q,setNodeRef:$,listeners:P,isDragging:V,over:W,setActivatorNodeRef:Z,transform:M}=b9({id:a,data:j,attributes:{...j9,...n},disabled:R.draggable}),I=JI(z,$),X=!!U,L=X&&!w&&Nh(_)&&Nh(C),oe=!k&&V,ae=oe&&L?M:null,J=L?ae??(u??T)({rects:S,activeNodeRect:F,activeIndex:_,overIndex:C,index:N}):null,re=Nh(_)&&Nh(C)?l({id:a,items:p,activeIndex:_,overIndex:C}):N,he=U==null?void 0:U.id,ve=b.useRef({activeId:he,items:p,newIndex:re,containerId:m}),Ce=p!==ve.current.items,ce=t({active:U,containerId:m,isDragging:V,isSorting:X,id:a,index:N,items:p,newIndex:ve.current.newIndex,previousItems:ve.current.items,previousContainerId:ve.current.containerId,transition:d,wasDragging:ve.current.activeId!=null}),_e=z9({disabled:!ce,index:N,node:B,rect:D});return b.useEffect(()=>{X&&ve.current.newIndex!==re&&(ve.current.newIndex=re),m!==ve.current.containerId&&(ve.current.containerId=m),p!==ve.current.items&&(ve.current.items=p)},[X,re,m,p]),b.useEffect(()=>{if(he===ve.current.activeId)return;if(he!=null&&ve.current.activeId==null){ve.current.activeId=he;return}const St=setTimeout(()=>{ve.current.activeId=he},50);return()=>clearTimeout(St)},[he]),{active:U,activeIndex:_,attributes:q,data:j,rect:D,index:N,newIndex:re,items:p,isOver:K,isSorting:X,isDragging:V,listeners:P,node:B,overIndex:C,over:W,setNodeRef:I,setActivatorNodeRef:Z,setDroppableNodeRef:z,setDraggableNodeRef:$,transform:_e??J,transition:Le()};function Le(){if(_e||Ce&&ve.current.newIndex===N)return L9;if(!(oe&&!Rb(H)||!d)&&(X||ce))return Mu.Transition.toString({...d,property:tM})}}function B9(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e==null?void 0:e.draggable)!=null?n:t.draggable,droppable:(r=e==null?void 0:e.droppable)!=null?r:t.droppable}}ut.Down,ut.Right,ut.Up,ut.Left;function Lb(e){const t=e+"CollectionProvider",[n,r]=ms(t),[s,l]=n(t,{collectionRef:{current:null},itemMap:new Map}),a=S=>{const{scope:C,children:k}=S,T=Ct.useRef(null),R=Ct.useRef(new Map).current;return g.jsx(s,{scope:C,itemMap:R,collectionRef:T,children:k})};a.displayName=t;const u=e+"CollectionSlot",h=Xo(u),d=Ct.forwardRef((S,C)=>{const{scope:k,children:T}=S,R=l(u,k),N=dt(C,R.collectionRef);return g.jsx(h,{ref:N,children:T})});d.displayName=u;const p=e+"CollectionItemSlot",m="data-radix-collection-item",_=Xo(p),y=Ct.forwardRef((S,C)=>{const{scope:k,children:T,...R}=S,N=Ct.useRef(null),j=dt(C,N),A=l(p,k);return Ct.useEffect(()=>(A.itemMap.set(N,{ref:N,...R}),()=>void A.itemMap.delete(N))),g.jsx(_,{[m]:"",ref:j,children:T})});y.displayName=p;function w(S){const C=l(e+"CollectionConsumer",S);return Ct.useCallback(()=>{const T=C.collectionRef.current;if(!T)return[];const R=Array.from(T.querySelectorAll(`[${m}]`));return Array.from(C.itemMap.values()).sort((A,D)=>R.indexOf(A.ref.current)-R.indexOf(D.ref.current))},[C.collectionRef,C.itemMap])}return[{Provider:a,Slot:d,ItemSlot:y},w,r]}var I9=b.createContext(void 0);function jb(e){const t=b.useContext(I9);return e||t||"ltr"}var Sv="rovingFocusGroup.onEntryFocus",H9={bubbles:!1,cancelable:!0},Yu="RovingFocusGroup",[E_,nM,F9]=Lb(Yu),[U9,rM]=ms(Yu,[F9]),[$9,W9]=U9(Yu),iM=b.forwardRef((e,t)=>g.jsx(E_.Provider,{scope:e.__scopeRovingFocusGroup,children:g.jsx(E_.Slot,{scope:e.__scopeRovingFocusGroup,children:g.jsx(V9,{...e,ref:t})})}));iM.displayName=Yu;var V9=b.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:s=!1,dir:l,currentTabStopId:a,defaultCurrentTabStopId:u,onCurrentTabStopIdChange:h,onEntryFocus:d,preventScrollOnEntryFocus:p=!1,...m}=e,_=b.useRef(null),y=dt(t,_),w=jb(l),[S,C]=ba({prop:a,defaultProp:u??null,onChange:h,caller:Yu}),[k,T]=b.useState(!1),R=li(d),N=nM(n),j=b.useRef(!1),[A,D]=b.useState(0);return b.useEffect(()=>{const B=_.current;if(B)return B.addEventListener(Sv,R),()=>B.removeEventListener(Sv,R)},[R]),g.jsx($9,{scope:n,orientation:r,dir:w,loop:s,currentTabStopId:S,onItemFocus:b.useCallback(B=>C(B),[C]),onItemShiftTab:b.useCallback(()=>T(!0),[]),onFocusableItemAdd:b.useCallback(()=>D(B=>B+1),[]),onFocusableItemRemove:b.useCallback(()=>D(B=>B-1),[]),children:g.jsx(Je.div,{tabIndex:k||A===0?-1:0,"data-orientation":r,...m,ref:y,style:{outline:"none",...e.style},onMouseDown:Ee(e.onMouseDown,()=>{j.current=!0}),onFocus:Ee(e.onFocus,B=>{const K=!j.current;if(B.target===B.currentTarget&&K&&!k){const z=new CustomEvent(Sv,H9);if(B.currentTarget.dispatchEvent(z),!z.defaultPrevented){const U=N().filter(P=>P.focusable),H=U.find(P=>P.active),F=U.find(P=>P.id===S),$=[H,F,...U].filter(Boolean).map(P=>P.ref.current);lM($,p)}}j.current=!1}),onBlur:Ee(e.onBlur,()=>T(!1))})})}),sM="RovingFocusGroupItem",oM=b.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:s=!1,tabStopId:l,children:a,...u}=e,h=cs(),d=l||h,p=W9(sM,n),m=p.currentTabStopId===d,_=nM(n),{onFocusableItemAdd:y,onFocusableItemRemove:w,currentTabStopId:S}=p;return b.useEffect(()=>{if(r)return y(),()=>w()},[r,y,w]),g.jsx(E_.ItemSlot,{scope:n,id:d,focusable:r,active:s,children:g.jsx(Je.span,{tabIndex:m?0:-1,"data-orientation":p.orientation,...u,ref:t,onMouseDown:Ee(e.onMouseDown,C=>{r?p.onItemFocus(d):C.preventDefault()}),onFocus:Ee(e.onFocus,()=>p.onItemFocus(d)),onKeyDown:Ee(e.onKeyDown,C=>{if(C.key==="Tab"&&C.shiftKey){p.onItemShiftTab();return}if(C.target!==C.currentTarget)return;const k=G9(C,p.orientation,p.dir);if(k!==void 0){if(C.metaKey||C.ctrlKey||C.altKey||C.shiftKey)return;C.preventDefault();let R=_().filter(N=>N.focusable).map(N=>N.ref.current);if(k==="last")R.reverse();else if(k==="prev"||k==="next"){k==="prev"&&R.reverse();const N=R.indexOf(C.currentTarget);R=p.loop?Y9(R,N+1):R.slice(N+1)}setTimeout(()=>lM(R))}}),children:typeof a=="function"?a({isCurrentTabStop:m,hasTabStop:S!=null}):a})})});oM.displayName=sM;var q9={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function K9(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function G9(e,t,n){const r=K9(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return q9[r]}function lM(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function Y9(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var X9=iM,Z9=oM,R_=["Enter"," "],Q9=["ArrowDown","PageUp","Home"],aM=["ArrowUp","PageDown","End"],J9=[...Q9,...aM],e7={ltr:[...R_,"ArrowRight"],rtl:[...R_,"ArrowLeft"]},t7={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Xu="Menu",[Au,n7,r7]=Lb(Xu),[al,cM]=ms(Xu,[r7,uo,rM]),wp=uo(),uM=rM(),[i7,cl]=al(Xu),[s7,Zu]=al(Xu),dM=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:s,onOpenChange:l,modal:a=!0}=e,u=wp(t),[h,d]=b.useState(null),p=b.useRef(!1),m=li(l),_=jb(s);return b.useEffect(()=>{const y=()=>{p.current=!0,document.addEventListener("pointerdown",w,{capture:!0,once:!0}),document.addEventListener("pointermove",w,{capture:!0,once:!0})},w=()=>p.current=!1;return document.addEventListener("keydown",y,{capture:!0}),()=>{document.removeEventListener("keydown",y,{capture:!0}),document.removeEventListener("pointerdown",w,{capture:!0}),document.removeEventListener("pointermove",w,{capture:!0})}},[]),g.jsx(fp,{...u,children:g.jsx(i7,{scope:t,open:n,onOpenChange:m,content:h,onContentChange:d,children:g.jsx(s7,{scope:t,onClose:b.useCallback(()=>m(!1),[m]),isUsingKeyboardRef:p,dir:_,modal:a,children:r})})})};dM.displayName=Xu;var o7="MenuAnchor",zb=b.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,s=wp(n);return g.jsx(Wu,{...s,...r,ref:t})});zb.displayName=o7;var Pb="MenuPortal",[l7,hM]=al(Pb,{forceMount:void 0}),fM=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:s}=e,l=cl(Pb,t);return g.jsx(l7,{scope:t,forceMount:n,children:g.jsx(Yr,{present:n||l.open,children:g.jsx(Da,{asChild:!0,container:s,children:r})})})};fM.displayName=Pb;var qr="MenuContent",[a7,Bb]=al(qr),pM=b.forwardRef((e,t)=>{const n=hM(qr,e.__scopeMenu),{forceMount:r=n.forceMount,...s}=e,l=cl(qr,e.__scopeMenu),a=Zu(qr,e.__scopeMenu);return g.jsx(Au.Provider,{scope:e.__scopeMenu,children:g.jsx(Yr,{present:r||l.open,children:g.jsx(Au.Slot,{scope:e.__scopeMenu,children:a.modal?g.jsx(c7,{...s,ref:t}):g.jsx(u7,{...s,ref:t})})})})}),c7=b.forwardRef((e,t)=>{const n=cl(qr,e.__scopeMenu),r=b.useRef(null),s=dt(t,r);return b.useEffect(()=>{const l=r.current;if(l)return op(l)},[]),g.jsx(Ib,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Ee(e.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),u7=b.forwardRef((e,t)=>{const n=cl(qr,e.__scopeMenu);return g.jsx(Ib,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),d7=Xo("MenuContent.ScrollLock"),Ib=b.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:s,onOpenAutoFocus:l,onCloseAutoFocus:a,disableOutsidePointerEvents:u,onEntryFocus:h,onEscapeKeyDown:d,onPointerDownOutside:p,onFocusOutside:m,onInteractOutside:_,onDismiss:y,disableOutsideScroll:w,...S}=e,C=cl(qr,n),k=Zu(qr,n),T=wp(n),R=uM(n),N=n7(n),[j,A]=b.useState(null),D=b.useRef(null),B=dt(t,D,C.onContentChange),K=b.useRef(0),z=b.useRef(""),U=b.useRef(0),H=b.useRef(null),F=b.useRef("right"),q=b.useRef(0),$=w?Uu:b.Fragment,P=w?{as:d7,allowPinchZoom:!0}:void 0,V=Z=>{var J,re;const M=z.current+Z,I=N().filter(he=>!he.disabled),X=document.activeElement,L=(J=I.find(he=>he.ref.current===X))==null?void 0:J.textValue,oe=I.map(he=>he.textValue),ae=w7(oe,M,L),se=(re=I.find(he=>he.textValue===ae))==null?void 0:re.ref.current;(function he(ve){z.current=ve,window.clearTimeout(K.current),ve!==""&&(K.current=window.setTimeout(()=>he(""),1e3))})(M),se&&setTimeout(()=>se.focus())};b.useEffect(()=>()=>window.clearTimeout(K.current),[]),ip();const W=b.useCallback(Z=>{var I,X;return F.current===((I=H.current)==null?void 0:I.side)&&k7(Z,(X=H.current)==null?void 0:X.area)},[]);return g.jsx(a7,{scope:n,searchRef:z,onItemEnter:b.useCallback(Z=>{W(Z)&&Z.preventDefault()},[W]),onItemLeave:b.useCallback(Z=>{var M;W(Z)||((M=D.current)==null||M.focus(),A(null))},[W]),onTriggerLeave:b.useCallback(Z=>{W(Z)&&Z.preventDefault()},[W]),pointerGraceTimerRef:U,onPointerGraceIntentChange:b.useCallback(Z=>{H.current=Z},[]),children:g.jsx($,{...P,children:g.jsx(Fu,{asChild:!0,trapped:s,onMountAutoFocus:Ee(l,Z=>{var M;Z.preventDefault(),(M=D.current)==null||M.focus({preventScroll:!0})}),onUnmountAutoFocus:a,children:g.jsx(Aa,{asChild:!0,disableOutsidePointerEvents:u,onEscapeKeyDown:d,onPointerDownOutside:p,onFocusOutside:m,onInteractOutside:_,onDismiss:y,children:g.jsx(X9,{asChild:!0,...R,dir:k.dir,orientation:"vertical",loop:r,currentTabStopId:j,onCurrentTabStopIdChange:A,onEntryFocus:Ee(h,Z=>{k.isUsingKeyboardRef.current||Z.preventDefault()}),preventScrollOnEntryFocus:!0,children:g.jsx(pp,{role:"menu","aria-orientation":"vertical","data-state":NM(C.open),"data-radix-menu-content":"",dir:k.dir,...T,...S,ref:B,style:{outline:"none",...S.style},onKeyDown:Ee(S.onKeyDown,Z=>{const I=Z.target.closest("[data-radix-menu-content]")===Z.currentTarget,X=Z.ctrlKey||Z.altKey||Z.metaKey,L=Z.key.length===1;I&&(Z.key==="Tab"&&Z.preventDefault(),!X&&L&&V(Z.key));const oe=D.current;if(Z.target!==oe||!J9.includes(Z.key))return;Z.preventDefault();const se=N().filter(J=>!J.disabled).map(J=>J.ref.current);aM.includes(Z.key)&&se.reverse(),x7(se)}),onBlur:Ee(e.onBlur,Z=>{Z.currentTarget.contains(Z.target)||(window.clearTimeout(K.current),z.current="")}),onPointerMove:Ee(e.onPointerMove,Du(Z=>{const M=Z.target,I=q.current!==Z.clientX;if(Z.currentTarget.contains(M)&&I){const X=Z.clientX>q.current?"right":"left";F.current=X,q.current=Z.clientX}}))})})})})})})});pM.displayName=qr;var h7="MenuGroup",Hb=b.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return g.jsx(Je.div,{role:"group",...r,ref:t})});Hb.displayName=h7;var f7="MenuLabel",mM=b.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return g.jsx(Je.div,{...r,ref:t})});mM.displayName=f7;var zf="MenuItem",UC="menu.itemSelect",Cp=b.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...s}=e,l=b.useRef(null),a=Zu(zf,e.__scopeMenu),u=Bb(zf,e.__scopeMenu),h=dt(t,l),d=b.useRef(!1),p=()=>{const m=l.current;if(!n&&m){const _=new CustomEvent(UC,{bubbles:!0,cancelable:!0});m.addEventListener(UC,y=>r==null?void 0:r(y),{once:!0}),dR(m,_),_.defaultPrevented?d.current=!1:a.onClose()}};return g.jsx(gM,{...s,ref:h,disabled:n,onClick:Ee(e.onClick,p),onPointerDown:m=>{var _;(_=e.onPointerDown)==null||_.call(e,m),d.current=!0},onPointerUp:Ee(e.onPointerUp,m=>{var _;d.current||(_=m.currentTarget)==null||_.click()}),onKeyDown:Ee(e.onKeyDown,m=>{const _=u.searchRef.current!=="";n||_&&m.key===" "||R_.includes(m.key)&&(m.currentTarget.click(),m.preventDefault())})})});Cp.displayName=zf;var gM=b.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:s,...l}=e,a=Bb(zf,n),u=uM(n),h=b.useRef(null),d=dt(t,h),[p,m]=b.useState(!1),[_,y]=b.useState("");return b.useEffect(()=>{const w=h.current;w&&y((w.textContent??"").trim())},[l.children]),g.jsx(Au.ItemSlot,{scope:n,disabled:r,textValue:s??_,children:g.jsx(Z9,{asChild:!0,...u,focusable:!r,children:g.jsx(Je.div,{role:"menuitem","data-highlighted":p?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...l,ref:d,onPointerMove:Ee(e.onPointerMove,Du(w=>{r?a.onItemLeave(w):(a.onItemEnter(w),w.defaultPrevented||w.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Ee(e.onPointerLeave,Du(w=>a.onItemLeave(w))),onFocus:Ee(e.onFocus,()=>m(!0)),onBlur:Ee(e.onBlur,()=>m(!1))})})})}),p7="MenuCheckboxItem",vM=b.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...s}=e;return g.jsx(SM,{scope:e.__scopeMenu,checked:n,children:g.jsx(Cp,{role:"menuitemcheckbox","aria-checked":Pf(n)?"mixed":n,...s,ref:t,"data-state":Ub(n),onSelect:Ee(s.onSelect,()=>r==null?void 0:r(Pf(n)?!0:!n),{checkForDefaultPrevented:!1})})})});vM.displayName=p7;var _M="MenuRadioGroup",[m7,g7]=al(_M,{value:void 0,onValueChange:()=>{}}),yM=b.forwardRef((e,t)=>{const{value:n,onValueChange:r,...s}=e,l=li(r);return g.jsx(m7,{scope:e.__scopeMenu,value:n,onValueChange:l,children:g.jsx(Hb,{...s,ref:t})})});yM.displayName=_M;var bM="MenuRadioItem",xM=b.forwardRef((e,t)=>{const{value:n,...r}=e,s=g7(bM,e.__scopeMenu),l=n===s.value;return g.jsx(SM,{scope:e.__scopeMenu,checked:l,children:g.jsx(Cp,{role:"menuitemradio","aria-checked":l,...r,ref:t,"data-state":Ub(l),onSelect:Ee(r.onSelect,()=>{var a;return(a=s.onValueChange)==null?void 0:a.call(s,n)},{checkForDefaultPrevented:!1})})})});xM.displayName=bM;var Fb="MenuItemIndicator",[SM,v7]=al(Fb,{checked:!1}),wM=b.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...s}=e,l=v7(Fb,n);return g.jsx(Yr,{present:r||Pf(l.checked)||l.checked===!0,children:g.jsx(Je.span,{...s,ref:t,"data-state":Ub(l.checked)})})});wM.displayName=Fb;var _7="MenuSeparator",CM=b.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return g.jsx(Je.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});CM.displayName=_7;var y7="MenuArrow",kM=b.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,s=wp(n);return g.jsx(mp,{...s,...r,ref:t})});kM.displayName=y7;var b7="MenuSub",[See,EM]=al(b7),ru="MenuSubTrigger",RM=b.forwardRef((e,t)=>{const n=cl(ru,e.__scopeMenu),r=Zu(ru,e.__scopeMenu),s=EM(ru,e.__scopeMenu),l=Bb(ru,e.__scopeMenu),a=b.useRef(null),{pointerGraceTimerRef:u,onPointerGraceIntentChange:h}=l,d={__scopeMenu:e.__scopeMenu},p=b.useCallback(()=>{a.current&&window.clearTimeout(a.current),a.current=null},[]);return b.useEffect(()=>p,[p]),b.useEffect(()=>{const m=u.current;return()=>{window.clearTimeout(m),h(null)}},[u,h]),g.jsx(zb,{asChild:!0,...d,children:g.jsx(gM,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":s.contentId,"data-state":NM(n.open),...e,ref:eb(t,s.onTriggerChange),onClick:m=>{var _;(_=e.onClick)==null||_.call(e,m),!(e.disabled||m.defaultPrevented)&&(m.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:Ee(e.onPointerMove,Du(m=>{l.onItemEnter(m),!m.defaultPrevented&&!e.disabled&&!n.open&&!a.current&&(l.onPointerGraceIntentChange(null),a.current=window.setTimeout(()=>{n.onOpenChange(!0),p()},100))})),onPointerLeave:Ee(e.onPointerLeave,Du(m=>{var y,w;p();const _=(y=n.content)==null?void 0:y.getBoundingClientRect();if(_){const S=(w=n.content)==null?void 0:w.dataset.side,C=S==="right",k=C?-5:5,T=_[C?"left":"right"],R=_[C?"right":"left"];l.onPointerGraceIntentChange({area:[{x:m.clientX+k,y:m.clientY},{x:T,y:_.top},{x:R,y:_.top},{x:R,y:_.bottom},{x:T,y:_.bottom}],side:S}),window.clearTimeout(u.current),u.current=window.setTimeout(()=>l.onPointerGraceIntentChange(null),300)}else{if(l.onTriggerLeave(m),m.defaultPrevented)return;l.onPointerGraceIntentChange(null)}})),onKeyDown:Ee(e.onKeyDown,m=>{var y;const _=l.searchRef.current!=="";e.disabled||_&&m.key===" "||e7[r.dir].includes(m.key)&&(n.onOpenChange(!0),(y=n.content)==null||y.focus(),m.preventDefault())})})})});RM.displayName=ru;var TM="MenuSubContent",MM=b.forwardRef((e,t)=>{const n=hM(qr,e.__scopeMenu),{forceMount:r=n.forceMount,...s}=e,l=cl(qr,e.__scopeMenu),a=Zu(qr,e.__scopeMenu),u=EM(TM,e.__scopeMenu),h=b.useRef(null),d=dt(t,h);return g.jsx(Au.Provider,{scope:e.__scopeMenu,children:g.jsx(Yr,{present:r||l.open,children:g.jsx(Au.Slot,{scope:e.__scopeMenu,children:g.jsx(Ib,{id:u.contentId,"aria-labelledby":u.triggerId,...s,ref:d,align:"start",side:a.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:p=>{var m;a.isUsingKeyboardRef.current&&((m=h.current)==null||m.focus()),p.preventDefault()},onCloseAutoFocus:p=>p.preventDefault(),onFocusOutside:Ee(e.onFocusOutside,p=>{p.target!==u.trigger&&l.onOpenChange(!1)}),onEscapeKeyDown:Ee(e.onEscapeKeyDown,p=>{a.onClose(),p.preventDefault()}),onKeyDown:Ee(e.onKeyDown,p=>{var y;const m=p.currentTarget.contains(p.target),_=t7[a.dir].includes(p.key);m&&_&&(l.onOpenChange(!1),(y=u.trigger)==null||y.focus(),p.preventDefault())})})})})})});MM.displayName=TM;function NM(e){return e?"open":"closed"}function Pf(e){return e==="indeterminate"}function Ub(e){return Pf(e)?"indeterminate":e?"checked":"unchecked"}function x7(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function S7(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function w7(e,t,n){const s=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,l=n?e.indexOf(n):-1;let a=S7(e,Math.max(l,0));s.length===1&&(a=a.filter(d=>d!==n));const h=a.find(d=>d.toLowerCase().startsWith(s.toLowerCase()));return h!==n?h:void 0}function C7(e,t){const{x:n,y:r}=e;let s=!1;for(let l=0,a=t.length-1;l<t.length;a=l++){const u=t[l],h=t[a],d=u.x,p=u.y,m=h.x,_=h.y;p>r!=_>r&&n<(m-d)*(r-p)/(_-p)+d&&(s=!s)}return s}function k7(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return C7(n,t)}function Du(e){return t=>t.pointerType==="mouse"?e(t):void 0}var E7=dM,R7=zb,T7=fM,M7=pM,N7=Hb,A7=mM,D7=Cp,O7=vM,L7=yM,j7=xM,z7=wM,P7=CM,B7=kM,I7=RM,H7=MM,$b="ContextMenu",[F7]=ms($b,[cM]),Vn=cM(),[U7,AM]=F7($b),DM=e=>{const{__scopeContextMenu:t,children:n,onOpenChange:r,dir:s,modal:l=!0}=e,[a,u]=b.useState(!1),h=Vn(t),d=li(r),p=b.useCallback(m=>{u(m),d(m)},[d]);return g.jsx(U7,{scope:t,open:a,onOpenChange:p,modal:l,children:g.jsx(E7,{...h,dir:s,open:a,onOpenChange:p,modal:l,children:n})})};DM.displayName=$b;var OM="ContextMenuTrigger",LM=b.forwardRef((e,t)=>{const{__scopeContextMenu:n,disabled:r=!1,...s}=e,l=AM(OM,n),a=Vn(n),u=b.useRef({x:0,y:0}),h=b.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...u.current})}),d=b.useRef(0),p=b.useCallback(()=>window.clearTimeout(d.current),[]),m=_=>{u.current={x:_.clientX,y:_.clientY},l.onOpenChange(!0)};return b.useEffect(()=>p,[p]),b.useEffect(()=>void(r&&p()),[r,p]),g.jsxs(g.Fragment,{children:[g.jsx(R7,{...a,virtualRef:h}),g.jsx(Je.span,{"data-state":l.open?"open":"closed","data-disabled":r?"":void 0,...s,ref:t,style:{WebkitTouchCallout:"none",...e.style},onContextMenu:r?e.onContextMenu:Ee(e.onContextMenu,_=>{p(),m(_),_.preventDefault()}),onPointerDown:r?e.onPointerDown:Ee(e.onPointerDown,Dh(_=>{p(),d.current=window.setTimeout(()=>m(_),700)})),onPointerMove:r?e.onPointerMove:Ee(e.onPointerMove,Dh(p)),onPointerCancel:r?e.onPointerCancel:Ee(e.onPointerCancel,Dh(p)),onPointerUp:r?e.onPointerUp:Ee(e.onPointerUp,Dh(p))})]})});LM.displayName=OM;var $7="ContextMenuPortal",jM=e=>{const{__scopeContextMenu:t,...n}=e,r=Vn(t);return g.jsx(T7,{...r,...n})};jM.displayName=$7;var zM="ContextMenuContent",PM=b.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,s=AM(zM,n),l=Vn(n),a=b.useRef(!1);return g.jsx(M7,{...l,...r,ref:t,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:u=>{var h;(h=e.onCloseAutoFocus)==null||h.call(e,u),!u.defaultPrevented&&a.current&&u.preventDefault(),a.current=!1},onInteractOutside:u=>{var h;(h=e.onInteractOutside)==null||h.call(e,u),!u.defaultPrevented&&!s.modal&&(a.current=!0)},style:{...e.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)"}})});PM.displayName=zM;var W7="ContextMenuGroup",V7=b.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,s=Vn(n);return g.jsx(N7,{...s,...r,ref:t})});V7.displayName=W7;var q7="ContextMenuLabel",K7=b.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,s=Vn(n);return g.jsx(A7,{...s,...r,ref:t})});K7.displayName=q7;var G7="ContextMenuItem",BM=b.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,s=Vn(n);return g.jsx(D7,{...s,...r,ref:t})});BM.displayName=G7;var Y7="ContextMenuCheckboxItem",X7=b.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,s=Vn(n);return g.jsx(O7,{...s,...r,ref:t})});X7.displayName=Y7;var Z7="ContextMenuRadioGroup",Q7=b.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,s=Vn(n);return g.jsx(L7,{...s,...r,ref:t})});Q7.displayName=Z7;var J7="ContextMenuRadioItem",eH=b.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,s=Vn(n);return g.jsx(j7,{...s,...r,ref:t})});eH.displayName=J7;var tH="ContextMenuItemIndicator",nH=b.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,s=Vn(n);return g.jsx(z7,{...s,...r,ref:t})});nH.displayName=tH;var rH="ContextMenuSeparator",iH=b.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,s=Vn(n);return g.jsx(P7,{...s,...r,ref:t})});iH.displayName=rH;var sH="ContextMenuArrow",oH=b.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,s=Vn(n);return g.jsx(B7,{...s,...r,ref:t})});oH.displayName=sH;var lH="ContextMenuSubTrigger",aH=b.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,s=Vn(n);return g.jsx(I7,{...s,...r,ref:t})});aH.displayName=lH;var cH="ContextMenuSubContent",uH=b.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,s=Vn(n);return g.jsx(H7,{...s,...r,ref:t,style:{...e.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)"}})});uH.displayName=cH;function Dh(e){return t=>t.pointerType!=="mouse"?e(t):void 0}var dH=DM,hH=LM,fH=jM,IM=PM,HM=BM;const pH=dH,mH=hH,FM=b.forwardRef(({className:e,...t},n)=>g.jsx(fH,{children:g.jsx(IM,{ref:n,className:xe("z-50 min-w-[170px] overflow-hidden rounded-xl border border-border bg-background p-1 shadow-lg outline-hidden 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",e),...t})}));FM.displayName=IM.displayName;const UM=b.forwardRef(({className:e,...t},n)=>g.jsx(HM,{ref:n,className:xe("relative flex cursor-default select-none items-center gap-2.5 rounded-lg px-3 py-2 text-xs font-medium outline-hidden transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...t}));UM.displayName=HM.displayName;function gH({onRemove:e,children:t}){return g.jsxs(pH,{children:[g.jsx(mH,{asChild:!0,children:t}),g.jsx(FM,{children:g.jsxs(UM,{onSelect:n=>{n.stopPropagation(),e()},className:"text-destructive dark:text-red-400 hover:bg-destructive/10 focus:bg-destructive/10 dark:hover:bg-red-500/20 dark:focus:bg-red-500/20",children:[g.jsx(UP,{className:"h-4 w-4"}),g.jsx("span",{className:"text-xs font-medium",children:"Remove"})]})})]})}function vH({group:e,collapsedSections:t,expandedGroups:n,onToggleSection:r,onToggleExpandedGroup:s,renderChatRow:l,chatsPerProject:a,onNewLocalChat:u,onRemoveProject:h,isConnected:d,startingLocalPath:p}){const{groupKey:m,localPath:_,chats:y}=e,w=n.has(m),S=w?y:y.slice(0,a),C=y.length>a,{attributes:k,listeners:T,setNodeRef:R,setActivatorNodeRef:N,transform:j,transition:A,isDragging:D}=P9({id:m}),B={transform:Mu.Translate.toString(j),transition:A},K=g.jsxs("div",{ref:N,className:xe("sticky top-0 bg-background dark:bg-card z-10 relative p-[10px] flex items-center justify-between","cursor-grab active:cursor-grabbing",D&&"cursor-grabbing"),onClick:()=>r(m),...T,children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("span",{className:"relative size-3.5 shrink-0 cursor-pointer",children:t.has(m)?g.jsx(ds,{className:"translate-y-[1px] size-3.5 shrink-0 text-slate-400 transition-all duration-200"}):g.jsxs(g.Fragment,{children:[g.jsx(UR,{className:"absolute inset-0 translate-y-[1px] size-3.5 shrink-0 text-slate-400 dark:text-slate-500 transition-all duration-200 group-hover/section:opacity-0"}),g.jsx(ds,{className:"absolute inset-0 translate-y-[1px] size-3.5 shrink-0 rotate-90 text-slate-400 opacity-0 transition-all duration-200 group-hover/section:opacity-100"})]})}),g.jsxs(Nf,{children:[g.jsx(Af,{asChild:!0,children:g.jsx("span",{className:"truncate max-w-[150px] whitespace-nowrap text-sm text-slate-500 dark:text-slate-400",children:zT(_)})}),g.jsx(Ru,{side:"right",sideOffset:4,children:_})]})]}),u&&g.jsxs(Nf,{children:[g.jsx(Af,{asChild:!0,children:g.jsx(nt,{variant:"ghost",size:"icon",className:xe("h-5.5 w-5.5 absolute right-2 !rounded opacity-100 md:opacity-0 md:group-hover/section:opacity-100",(!d||p===_)&&"opacity-50 cursor-not-allowed"),disabled:!d||p===_,onClick:z=>{z.stopPropagation(),u(_)},children:p===_?g.jsx(Ni,{className:"size-4 text-slate-500 dark:text-slate-400 animate-spin"}):g.jsx(lb,{className:"size-3.5 text-slate-500 dark:text-slate-400"})})}),g.jsx(Ru,{side:"right",sideOffset:4,children:d?"New chat":`Start ${Un} to connect`})]})]});return g.jsxs("div",{ref:R,style:B,className:xe("group/section",D&&"opacity-50 shadow-lg z-50 relative"),...k,children:[h?g.jsx(gH,{onRemove:()=>h(m),children:K}):K,!t.has(m)&&(S.length>0||C)&&g.jsxs("div",{className:"space-y-[2px] mb-2 ",children:[S.map(l),C&&g.jsx("button",{onClick:()=>s(m),className:"pl-2.5 py-1 text-xs text-muted-foreground hover:text-foreground transition-colors",children:w?"Show less":`Show more (${y.length-a})`})]})]})}function _H({projectGroups:e,collapsedSections:t,expandedGroups:n,onToggleSection:r,onToggleExpandedGroup:s,renderChatRow:l,chatsPerProject:a,onNewLocalChat:u,onRemoveProject:h,onReorderGroups:d,isConnected:p,startingLocalPath:m}){const _=f8(NC(Db,{activationConstraint:{distance:8}}),NC(Nb)),y=b.useMemo(()=>e.map(k=>k.groupKey),[e]),w=b.useRef(null);function S(k){const T=k.active.id;t.has(T)?w.current=null:(w.current=T,r(T))}function C(k){const{active:T,over:R}=k;if(R&&T.id!==R.id&&d){const N=y.indexOf(T.id),j=y.indexOf(R.id);if(N!==-1&&j!==-1){const A=Ob(y,N,j);d(A)}}if(w.current){const N=w.current;w.current=null,requestAnimationFrame(()=>r(N))}}return g.jsx(v9,{sensors:_,collisionDetection:_8,onDragStart:S,onDragEnd:C,children:g.jsx(N9,{items:y,strategy:T9,children:e.map(k=>g.jsx(vH,{group:k,collapsedSections:t,expandedGroups:n,onToggleSection:r,onToggleExpandedGroup:s,renderChatRow:l,chatsPerProject:a,onNewLocalChat:u,onRemoveProject:h,isConnected:p,startingLocalPath:m},k.groupKey))})})}const $C=e=>{let t;const n=new Set,r=(d,p)=>{const m=typeof d=="function"?d(t):d;if(!Object.is(m,t)){const _=t;t=p??(typeof m!="object"||m===null)?m:Object.assign({},t,m),n.forEach(y=>y(t,_))}},s=()=>t,u={setState:r,getState:s,getInitialState:()=>h,subscribe:d=>(n.add(d),()=>n.delete(d))},h=t=e(r,s,u);return u},yH=(e=>e?$C(e):$C),bH=e=>e;function xH(e,t=bH){const n=Ct.useSyncExternalStore(e.subscribe,Ct.useCallback(()=>t(e.getState()),[e,t]),Ct.useCallback(()=>t(e.getInitialState()),[e,t]));return Ct.useDebugValue(n),n}const SH=e=>{const t=yH(e),n=r=>xH(t,r);return Object.assign(n,t),n},Ia=(e=>SH);function wH(e,t){let n;try{n=e()}catch{return}return{getItem:s=>{var l;const a=h=>h===null?null:JSON.parse(h,void 0),u=(l=n.getItem(s))!=null?l:null;return u instanceof Promise?u.then(a):a(u)},setItem:(s,l)=>n.setItem(s,JSON.stringify(l,void 0)),removeItem:s=>n.removeItem(s)}}const T_=e=>t=>{try{const n=e(t);return n instanceof Promise?n:{then(r){return T_(r)(n)},catch(r){return this}}}catch(n){return{then(r){return this},catch(r){return T_(r)(n)}}}},CH=(e,t)=>(n,r,s)=>{let l={storage:wH(()=>window.localStorage),partialize:C=>C,version:0,merge:(C,k)=>({...k,...C}),...t},a=!1,u=0;const h=new Set,d=new Set;let p=l.storage;if(!p)return e((...C)=>{console.warn(`[zustand persist middleware] Unable to update item '${l.name}', the given storage is currently unavailable.`),n(...C)},r,s);const m=()=>{const C=l.partialize({...r()});return p.setItem(l.name,{state:C,version:l.version})},_=s.setState;s.setState=(C,k)=>(_(C,k),m());const y=e((...C)=>(n(...C),m()),r,s);s.getInitialState=()=>y;let w;const S=()=>{var C,k;if(!p)return;const T=++u;a=!1,h.forEach(N=>{var j;return N((j=r())!=null?j:y)});const R=((k=l.onRehydrateStorage)==null?void 0:k.call(l,(C=r())!=null?C:y))||void 0;return T_(p.getItem.bind(p))(l.name).then(N=>{if(N)if(typeof N.version=="number"&&N.version!==l.version){if(l.migrate){const j=l.migrate(N.state,N.version);return j instanceof Promise?j.then(A=>[!0,A]):[!0,j]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,N.state];return[!1,void 0]}).then(N=>{var j;if(T!==u)return;const[A,D]=N;if(w=l.merge(D,(j=r())!=null?j:y),n(w,!0),A)return m()}).then(()=>{T===u&&(R==null||R(w,void 0),w=r(),a=!0,d.forEach(N=>N(w)))}).catch(N=>{T===u&&(R==null||R(void 0,N))})};return s.persist={setOptions:C=>{l={...l,...C},C.storage&&(p=C.storage)},clearStorage:()=>{p==null||p.removeItem(l.name)},getOptions:()=>l,rehydrate:()=>S(),hasHydrated:()=>a,onHydrate:C=>(h.add(C),()=>{h.delete(C)}),onFinishHydration:C=>(d.add(C),()=>{d.delete(C)})},l.skipHydration||S(),w||y},Ha=CH,WC=Ia()(Ha(e=>({order:[],setOrder:t=>e({order:t})}),{name:"project-group-order"}));function kH({data:e,activeChatId:t,connectionStatus:n,ready:r,open:s,collapsed:l,showMobileOpenButton:a,onOpen:u,onClose:h,onCollapse:d,onExpand:p,onCreateChat:m,onDeleteChat:_,onRemoveProject:y,updateSnapshot:w,onInstallUpdate:S}){const C=di(),k=Na(),T=b.useRef(null),[R,N]=b.useState(new Set),[j,A]=b.useState(new Set),[D,B]=b.useState(()=>Date.now()),K=10,z=WC(re=>re.order),U=WC(re=>re.setOrder),H=b.useMemo(()=>{if(z.length===0)return e.projectGroups;const re=new Map(e.projectGroups.map(Ce=>[Ce.groupKey,Ce])),he=z.filter(Ce=>re.has(Ce)).map(Ce=>re.get(Ce)),ve=new Set(z);for(const Ce of e.projectGroups)ve.has(Ce.groupKey)||he.push(Ce);return he},[e.projectGroups,z]),F=b.useCallback(re=>U(re),[U]),q=b.useMemo(()=>new Map(e.projectGroups.map(re=>[re.localPath,re.groupKey])),[e.projectGroups]),$=b.useMemo(()=>e.projectGroups.reduce((re,he)=>re+he.chats.length,0),[e.projectGroups]),P=b.useCallback(re=>{N(he=>{const ve=new Set(he);return ve.has(re)?ve.delete(re):ve.add(re),ve})},[]),V=b.useCallback(re=>{A(he=>{const ve=new Set(he);return ve.has(re)?ve.delete(re):ve.add(re),ve})},[]),W=b.useCallback(re=>g.jsx(QI,{chat:re,activeChatId:t,nowMs:D,onSelectChat:he=>k(`/chat/${he}`),onDeleteChat:()=>_(re)},re._id),[t,k,D,_]);b.useEffect(()=>{const re=window.setInterval(()=>{B(Date.now())},3e4);return()=>window.clearInterval(re)},[]),b.useEffect(()=>{!t||!T.current||requestAnimationFrame(()=>{const re=T.current,he=re==null?void 0:re.querySelector(`[data-chat-id="${t}"]`);if(!he||!re)return;const ve=he.getBoundingClientRect(),Ce=re.getBoundingClientRect();if(ve.top<Ce.top+38){const ce=ve.top-Ce.top+re.scrollTop;re.scrollTo({top:ce-38,behavior:"smooth"})}else if(ve.bottom>Ce.bottom){const ce=ve.top+ve.height/2-Ce.top+re.scrollTop,_e=re.clientHeight/2;re.scrollTo({top:ce-_e,behavior:"smooth"})}})},[t,$]);const Z=$>0,M=C.pathname==="/",I=C.pathname.startsWith("/settings"),X=M||I,L=n==="connecting"||!r,oe=L?"Connecting":n==="connected"?"Connected":"Disconnected",ae=n==="connected"?"bg-emerald-500":"bg-amber-500",se=(w==null?void 0:w.updateAvailable)===!0,J=(w==null?void 0:w.status)==="updating"||(w==null?void 0:w.status)==="restart_pending";return g.jsxs(g.Fragment,{children:[!s&&a&&g.jsx(nt,{variant:"ghost",size:"icon",className:"fixed top-3 left-3 z-50 md:hidden",onClick:u,children:g.jsx($R,{className:"h-5 w-5"})}),l&&X&&g.jsx("div",{className:"hidden md:flex fixed left-0 top-0 h-full z-40 items-start pt-4 pl-5 border-l border-border/0",children:g.jsxs("div",{className:"flex items-center gap-1",children:[g.jsx(fu,{className:"size-6 text-logo"}),g.jsx(nt,{variant:"ghost",size:"icon",onClick:p,title:"Expand sidebar",children:g.jsx(p_,{className:"h-5 w-5"})})]})}),g.jsxs("div",{"data-sidebar":"open",className:xe("fixed inset-0 z-50 bg-background dark:bg-card flex flex-col h-[100dvh] select-none","md:relative md:inset-auto md:w-[275px] md:mr-0 md:h-[calc(100dvh-16px)] md:my-2 md:ml-2 md:border md:border-border md:rounded-2xl",s?"flex":"hidden md:flex",l&&"md:hidden"),children:[g.jsxs("div",{className:" pl-3 pr-[7px] h-[64px] max-h-[64px] md:h-[55px] md:max-h-[55px] border-b flex items-center justify-between",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsxs("button",{type:"button",onClick:d,title:"Collapse sidebar",className:"hidden md:flex group/sidebar-collapse relative items-center justify-center h-5 w-5 sm:h-6 sm:w-6",children:[g.jsx(fu,{className:"absolute inset-0.5 h-4 w-4 sm:h-5 sm:w-5 text-logo transition-all duration-200 ease-out opacity-100 scale-100 group-hover/sidebar-collapse:opacity-0 group-hover/sidebar-collapse:scale-0"}),g.jsx(p_,{className:"absolute inset-0 h-4 w-4 sm:h-6 sm:w-6 text-slate-500 dark:text-slate-400 transition-all duration-200 ease-out opacity-0 scale-0 group-hover/sidebar-collapse:opacity-100 group-hover/sidebar-collapse:scale-80 hover:opacity-50"})]}),g.jsx(fu,{className:"h-5 w-5 sm:h-6 sm:w-6 text-logo md:hidden"}),g.jsx("span",{className:"font-logo text-base uppercase sm:text-md text-slate-600 dark:text-slate-100",children:Un})]}),g.jsxs("div",{className:"flex items-center",children:[se?g.jsxs(nt,{variant:"outline",size:"sm",className:"rounded-full !h-auto mr-1 py-0.5 px-2 bg-logo/20 hover:bg-logo text-logo border-logo/20 hover:text-foreground hover:border-logo/20 text-[11px] font-bold tracking-wider",onClick:S,disabled:J,title:w!=null&&w.latestVersion?`Update to ${w.latestVersion}`:"Update Kanna",children:[J?g.jsx(Ni,{className:"mr-1.5 h-3 w-3 animate-spin"}):null,"UPDATE"]}):null,g.jsx(nt,{variant:"ghost",size:"icon",onClick:()=>{k("/"),h()},title:"New project",children:g.jsx(ob,{className:"size-4"})}),g.jsx(nt,{variant:"ghost",size:"icon",className:"md:hidden",onClick:h,children:g.jsx(Oa,{className:"h-5 w-5"})})]})]}),g.jsx("div",{ref:T,className:"flex-1 min-h-0 overflow-y-auto scrollbar-hide",style:{WebkitOverflowScrolling:"touch"},children:g.jsxs("div",{className:"p-[7px]",children:[!Z&&L?g.jsx("div",{className:"space-y-5 px-1 pt-3",children:[0,1,2].map(re=>g.jsxs("div",{className:"space-y-2 animate-pulse",children:[g.jsx("div",{className:"h-4 w-28 rounded bg-muted"}),g.jsx("div",{className:"space-y-1",children:[0,1,2].map(he=>g.jsxs("div",{className:"flex items-center gap-2 rounded-md px-3 py-2",children:[g.jsx("div",{className:"h-3.5 w-3.5 rounded-full bg-muted"}),g.jsx("div",{className:xe("h-3.5 rounded bg-muted",he===0?"w-32":he===1?"w-40":"w-28")})]},he))})]},re))}):null,!Z&&!L&&e.projectGroups.length===0?g.jsx("p",{className:"text-sm text-slate-400 p-2 mt-6 text-center",children:"No conversations yet"}):null,g.jsx(_H,{projectGroups:H,onReorderGroups:F,collapsedSections:R,expandedGroups:j,onToggleSection:P,onToggleExpandedGroup:V,renderChatRow:W,chatsPerProject:K,onNewLocalChat:re=>{const he=q.get(re);he&&m(he)},onRemoveProject:y,isConnected:n==="connected"})]})}),g.jsx("div",{className:"border-t border-border p-2",children:g.jsx("button",{type:"button",onClick:()=>{k("/settings/general"),h()},className:xe("w-full rounded-xl rounded-t-md border px-3 py-2 text-left transition-colors",I?"bg-muted border-border":"border-border/0 hover:bg-muted hover:border-border active:bg-muted/80"),children:g.jsxs("div",{className:"flex items- justify-between gap-2",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(RP,{className:"h-4 w-4 text-muted-foreground"}),g.jsx("span",{className:"text-sm",children:"Settings"})]}),g.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[g.jsx("span",{children:oe}),L?g.jsx(Ni,{className:"h-2 w-2 animate-spin"}):g.jsx("span",{className:xe("h-2 w-2 rounded-full",ae)})]})]})})})]}),s?g.jsx("div",{className:"fixed inset-0 bg-black/40 z-40 md:hidden",onClick:h}):null]})}const $M=b.forwardRef(({className:e,...t},n)=>g.jsx("textarea",{"data-gramm":"false","data-gramm_editor":"false","data-enable-grammarly":"false","data-1p-ignore":!0,autoComplete:"off",className:xe("flex w-full rounded-lg border border-border bg-background px-2.5 py-2 text-sm placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),ref:n,...t}));$M.displayName="Textarea";function EH(){const[e,t]=b.useState(()=>{if(typeof window>"u")return!1;const n=navigator.standalone===!0,r=window.matchMedia("(display-mode: standalone)").matches;return n||r});return b.useEffect(()=>{const n=window.matchMedia("(display-mode: standalone)"),r=s=>{t(s.matches||navigator.standalone===!0)};return n.addEventListener("change",r),()=>n.removeEventListener("change",r)},[]),e}const RH=Ia()(Ha((e,t)=>({drafts:{},setDraft:(n,r)=>e(s=>{if(!r){const{[n]:l,...a}=s.drafts;return{drafts:a}}return{drafts:{...s.drafts,[n]:r}}}),clearDraft:n=>e(r=>{const{[n]:s,...l}=r.drafts;return{drafts:l}}),getDraft:n=>t().drafts[n]??""}),{name:"chat-input-drafts"})),Bf=[{id:"low",label:"Low"},{id:"medium",label:"Medium"},{id:"high",label:"High"},{id:"max",label:"Max"}],M_=[{id:"minimal",label:"Minimal"},{id:"low",label:"Low"},{id:"medium",label:"Medium"},{id:"high",label:"High"},{id:"xhigh",label:"XHigh"}],Wb={reasoningEffort:"high"},N_={reasoningEffort:"high",fastMode:!1};function VC(e){return Bf.some(t=>t.id===e)}function qC(e){return M_.some(t=>t.id===e)}const nf=[{id:"claude",label:"Claude",defaultModel:"opus",defaultEffort:"high",supportsPlanMode:!0,models:[{id:"opus",label:"Opus",supportsEffort:!0},{id:"sonnet",label:"Sonnet",supportsEffort:!0},{id:"haiku",label:"Haiku",supportsEffort:!0}],efforts:[...Bf]},{id:"codex",label:"Codex",defaultModel:"gpt-5.4",supportsPlanMode:!0,models:[{id:"gpt-5.4",label:"GPT-5.4",supportsEffort:!1},{id:"gpt-5.3-codex",label:"GPT-5.3 Codex",supportsEffort:!1},{id:"gpt-5.3-codex-spark",label:"GPT-5.3 Codex Spark",supportsEffort:!1}],efforts:[]}],eo={toggleEmbeddedTerminal:["cmd+j","ctrl+`"],toggleRightSidebar:["cmd+b","ctrl+b"],openInFinder:["cmd+alt+f","ctrl+alt+f"],openInEditor:["cmd+shift+o","ctrl+shift+o"],addSplitTerminal:["cmd+/","ctrl+/"]};function TH(e){return e==="gpt-5-codex"?"gpt-5.3-codex":e??"gpt-5.4"}function MH(e){return e==="claude"||e==="codex"?e:"last_used"}function qo(e){var s;const t=(s=e==null?void 0:e.modelOptions)==null?void 0:s.reasoningEffort,n=VC(t)?t:VC(e==null?void 0:e.effort)?e.effort:Wb.reasoningEffort,r=(e==null?void 0:e.model)??"opus";return{model:r,modelOptions:{reasoningEffort:r!=="opus"&&n==="max"?"high":n},planMode:!!(e!=null&&e.planMode)}}function Ko(e){var n,r;const t=(n=e==null?void 0:e.modelOptions)==null?void 0:n.reasoningEffort;return{model:TH(e==null?void 0:e.model),modelOptions:{reasoningEffort:qC(t)?t:qC(e==null?void 0:e.effort)?e.effort:N_.reasoningEffort,fastMode:typeof((r=e==null?void 0:e.modelOptions)==null?void 0:r.fastMode)=="boolean"?e.modelOptions.fastMode:N_.fastMode},planMode:!!(e!=null&&e.planMode)}}function NH(){return{claude:{model:"opus",modelOptions:{...Wb},planMode:!1},codex:{model:"gpt-5.4",modelOptions:{...N_},planMode:!1}}}function AH(e){return{claude:qo(e==null?void 0:e.claude),codex:Ko(e==null?void 0:e.codex)}}function KC(e,t){if(t===void 0){console.info(`[chat-preferences] ${e}`);return}console.info(`[chat-preferences] ${e}`,t)}function A_(e,t){if(e==="claude"){const r=t.claude;return{provider:"claude",model:r.model,modelOptions:{...r.modelOptions},planMode:r.planMode}}const n=t.codex;return{provider:"codex",model:n.model,modelOptions:{...n.modelOptions},planMode:n.planMode}}function DH(e,t,n,r){if((e==null?void 0:e.provider)==="claude"){const s=qo(e);return{provider:"claude",model:s.model,modelOptions:s.modelOptions,planMode:s.planMode}}if((e==null?void 0:e.provider)==="codex"){const s=Ko(e);return{provider:"codex",model:s.model,modelOptions:s.modelOptions,planMode:s.planMode}}if(n==="claude"){const s=qo(r==null?void 0:r.claude);return{provider:"claude",model:s.model,modelOptions:s.modelOptions,planMode:s.planMode}}if(n==="codex"){const s=Ko(r==null?void 0:r.codex);return{provider:"codex",model:s.model,modelOptions:s.modelOptions,planMode:s.planMode}}return A_("claude",t)}function OH(e){const t=AH(e==null?void 0:e.providerDefaults);return{defaultProvider:MH(e==null?void 0:e.defaultProvider),providerDefaults:t,composerState:DH(e==null?void 0:e.composerState,t,e==null?void 0:e.liveProvider,e==null?void 0:e.livePreferences)}}const ls=Ia()(Ha(e=>({defaultProvider:"last_used",providerDefaults:NH(),composerState:{provider:"claude",model:"opus",modelOptions:{...Wb},planMode:!1},setDefaultProvider:t=>e({defaultProvider:t}),setProviderDefaultModel:(t,n)=>e(r=>({providerDefaults:{...r.providerDefaults,[t]:t==="claude"?qo({...r.providerDefaults.claude,model:n}):Ko({...r.providerDefaults.codex,model:n})}})),setProviderDefaultModelOptions:(t,n)=>e(r=>({providerDefaults:{...r.providerDefaults,[t]:t==="claude"?qo({...r.providerDefaults.claude,modelOptions:{...r.providerDefaults.claude.modelOptions,...n}}):Ko({...r.providerDefaults.codex,modelOptions:{...r.providerDefaults.codex.modelOptions,...n}})}})),setProviderDefaultPlanMode:(t,n)=>e(r=>({providerDefaults:{...r.providerDefaults,[t]:{...r.providerDefaults[t],planMode:n}}})),setComposerProvider:t=>e(n=>({composerState:{...n.composerState,provider:t}})),setComposerModel:t=>e(n=>n.composerState.provider==="claude"?{composerState:{provider:"claude",model:t,modelOptions:qo({...n.composerState,model:t}).modelOptions,planMode:n.composerState.planMode}}:{composerState:{provider:"codex",model:t,modelOptions:Ko({...n.composerState,model:t}).modelOptions,planMode:n.composerState.planMode}}),setComposerModelOptions:t=>e(n=>n.composerState.provider==="claude"?{composerState:{provider:"claude",model:n.composerState.model,modelOptions:qo({...n.composerState,modelOptions:{...n.composerState.modelOptions,...t}}).modelOptions,planMode:n.composerState.planMode}}:{composerState:{provider:"codex",model:n.composerState.model,modelOptions:Ko({...n.composerState,modelOptions:{...n.composerState.modelOptions,...t}}).modelOptions,planMode:n.composerState.planMode}}),setComposerPlanMode:t=>e(n=>({composerState:{...n.composerState,planMode:t}})),resetComposerFromProvider:t=>e(n=>({composerState:A_(t,n.providerDefaults)})),initializeComposerForNewChat:()=>e(t=>{if(t.defaultProvider==="last_used")return KC("initializeComposerForNewChat:last_used",{defaultProvider:t.defaultProvider,composerState:t.composerState,providerDefaults:t.providerDefaults}),{composerState:{...t.composerState}};const n=A_(t.defaultProvider,t.providerDefaults);return KC("initializeComposerForNewChat:explicit_default",{defaultProvider:t.defaultProvider,composerState:n,providerDefaults:t.providerDefaults}),{composerState:n}})}),{name:"chat-preferences",version:2,migrate:e=>OH(e)}));var kp="Popover",[WM]=ms(kp,[uo]),Qu=uo(),[LH,ho]=WM(kp),VM=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:s,onOpenChange:l,modal:a=!1}=e,u=Qu(t),h=b.useRef(null),[d,p]=b.useState(!1),[m,_]=ba({prop:r,defaultProp:s??!1,onChange:l,caller:kp});return g.jsx(fp,{...u,children:g.jsx(LH,{scope:t,contentId:cs(),triggerRef:h,open:m,onOpenChange:_,onOpenToggle:b.useCallback(()=>_(y=>!y),[_]),hasCustomAnchor:d,onCustomAnchorAdd:b.useCallback(()=>p(!0),[]),onCustomAnchorRemove:b.useCallback(()=>p(!1),[]),modal:a,children:n})})};VM.displayName=kp;var qM="PopoverAnchor",jH=b.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,s=ho(qM,n),l=Qu(n),{onCustomAnchorAdd:a,onCustomAnchorRemove:u}=s;return b.useEffect(()=>(a(),()=>u()),[a,u]),g.jsx(Wu,{...l,...r,ref:t})});jH.displayName=qM;var KM="PopoverTrigger",GM=b.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,s=ho(KM,n),l=Qu(n),a=dt(t,s.triggerRef),u=g.jsx(Je.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":JM(s.open),...r,ref:a,onClick:Ee(e.onClick,s.onOpenToggle)});return s.hasCustomAnchor?u:g.jsx(Wu,{asChild:!0,...l,children:u})});GM.displayName=KM;var Vb="PopoverPortal",[zH,PH]=WM(Vb,{forceMount:void 0}),YM=e=>{const{__scopePopover:t,forceMount:n,children:r,container:s}=e,l=ho(Vb,t);return g.jsx(zH,{scope:t,forceMount:n,children:g.jsx(Yr,{present:n||l.open,children:g.jsx(Da,{asChild:!0,container:s,children:r})})})};YM.displayName=Vb;var wa="PopoverContent",XM=b.forwardRef((e,t)=>{const n=PH(wa,e.__scopePopover),{forceMount:r=n.forceMount,...s}=e,l=ho(wa,e.__scopePopover);return g.jsx(Yr,{present:r||l.open,children:l.modal?g.jsx(IH,{...s,ref:t}):g.jsx(HH,{...s,ref:t})})});XM.displayName=wa;var BH=Xo("PopoverContent.RemoveScroll"),IH=b.forwardRef((e,t)=>{const n=ho(wa,e.__scopePopover),r=b.useRef(null),s=dt(t,r),l=b.useRef(!1);return b.useEffect(()=>{const a=r.current;if(a)return op(a)},[]),g.jsx(Uu,{as:BH,allowPinchZoom:!0,children:g.jsx(ZM,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ee(e.onCloseAutoFocus,a=>{var u;a.preventDefault(),l.current||(u=n.triggerRef.current)==null||u.focus()}),onPointerDownOutside:Ee(e.onPointerDownOutside,a=>{const u=a.detail.originalEvent,h=u.button===0&&u.ctrlKey===!0,d=u.button===2||h;l.current=d},{checkForDefaultPrevented:!1}),onFocusOutside:Ee(e.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1})})})}),HH=b.forwardRef((e,t)=>{const n=ho(wa,e.__scopePopover),r=b.useRef(!1),s=b.useRef(!1);return g.jsx(ZM,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:l=>{var a,u;(a=e.onCloseAutoFocus)==null||a.call(e,l),l.defaultPrevented||(r.current||(u=n.triggerRef.current)==null||u.focus(),l.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:l=>{var h,d;(h=e.onInteractOutside)==null||h.call(e,l),l.defaultPrevented||(r.current=!0,l.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const a=l.target;((d=n.triggerRef.current)==null?void 0:d.contains(a))&&l.preventDefault(),l.detail.originalEvent.type==="focusin"&&s.current&&l.preventDefault()}})}),ZM=b.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:l,disableOutsidePointerEvents:a,onEscapeKeyDown:u,onPointerDownOutside:h,onFocusOutside:d,onInteractOutside:p,...m}=e,_=ho(wa,n),y=Qu(n);return ip(),g.jsx(Fu,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:l,children:g.jsx(Aa,{asChild:!0,disableOutsidePointerEvents:a,onInteractOutside:p,onEscapeKeyDown:u,onPointerDownOutside:h,onFocusOutside:d,onDismiss:()=>_.onOpenChange(!1),children:g.jsx(pp,{"data-state":JM(_.open),role:"dialog",id:_.contentId,...y,...m,ref:t,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)"}})})})}),QM="PopoverClose",FH=b.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,s=ho(QM,n);return g.jsx(Je.button,{type:"button",...r,ref:t,onClick:Ee(e.onClick,()=>s.onOpenChange(!1))})});FH.displayName=QM;var UH="PopoverArrow",$H=b.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,s=Qu(n);return g.jsx(mp,{...s,...r,ref:t})});$H.displayName=UH;function JM(e){return e?"open":"closed"}var WH=VM,VH=GM,qH=YM,eN=XM;const KH=WH,GH=VH,tN=b.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},s)=>g.jsx(qH,{children:g.jsx(eN,{ref:s,align:t,sideOffset:n,[Cu]:"",onCloseAutoFocus:l=>{var a;l.preventDefault(),window.dispatchEvent(new Event(Cf)),(a=r.onCloseAutoFocus)==null||a.call(r,l)},className:xe("z-50 w-72 rounded-xl border border-border bg-background p-4 shadow-lg outline-hidden 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",e),...r})}));tN.displayName=eN.displayName;function YH({className:e,...t}){return g.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",className:xe("shrink-0",e),...t,children:g.jsx("path",{d:"M17.3041 3.541h-3.6718l6.696 16.918H24Zm-10.6082 0L0 20.459h3.7442l1.3693-3.5527h7.0052l1.3693 3.5528h3.7442L10.5363 3.5409Zm-.3712 10.2232 2.2914-5.9456 2.2914 5.9456Z"})})}function XH({className:e,...t}){return g.jsx("svg",{viewBox:"0 0 158.7128 157.296",fill:"currentColor","aria-hidden":"true",className:xe("shrink-0",e),...t,children:g.jsx("path",{d:"M60.8734 57.2556V42.3124c0-1.2586.4722-2.2029 1.5728-2.8314l30.0443-17.3023c4.0899-2.3593 8.9662-3.4599 13.9988-3.4599 18.8759 0 30.8307 14.6289 30.8307 30.2006 0 1.1007 0 2.3593-.158 3.6178l-31.1446-18.2467c-1.8872-1.1006-3.7754-1.1006-5.6629 0L60.8734 57.2556Zm70.1542 58.2005V79.7487c0-2.2028-.9446-3.7756-2.8318-4.8763l-39.481-22.9651 12.8982-7.3934c1.1007-.6285 2.0453-.6285 3.1458 0l30.0441 17.3024c8.6523 5.0341 14.4708 15.7296 14.4708 26.1107 0 11.9539-7.0769 22.965-18.2461 27.527ZM51.593 83.9964l-12.8982-7.5497c-1.1007-.6285-1.5728-1.5728-1.5728-2.8314V39.0105c0-16.8303 12.8982-29.5722 30.3585-29.5722 6.607 0 12.7403 2.2029 17.9324 6.1349l-30.987 17.9324c-1.8871 1.1007-2.8314 2.6735-2.8314 4.8764v45.6159ZM79.3562 100.0403 60.8733 89.6592V67.6383l18.4829-10.3811 18.4812 10.3811v22.0209l-18.4812 10.3811Zm11.8757 47.8188c-6.607 0-12.7403-2.2031-17.9324-6.1344l30.9866-17.9333c1.8872-1.1005 2.8318-2.6728 2.8318-4.8759v-45.616l13.0564 7.5498c1.1005.6285 1.5723 1.5728 1.5723 2.8314v34.6051c0 16.8297-13.0564 29.5723-30.5147 29.5723ZM53.9522 112.7822 23.9079 95.4798c-8.652-5.0343-14.471-15.7296-14.471-26.1107 0-12.1119 7.2356-22.9652 18.403-27.5272v35.8634c0 2.2028.9443 3.7756 2.8314 4.8763l39.3248 22.8068-12.8982 7.3938c-1.1007.6287-2.045.6287-3.1456 0ZM52.2229 138.5791c-17.7745 0-30.8306-13.3713-30.8306-29.8871 0-1.2585.1578-2.5169.3143-3.7754l30.987 17.9323c1.8871 1.1005 3.7757 1.1005 5.6628 0l39.4811-22.807v14.9435c0 1.2585-.4721 2.2021-1.5728 2.8308l-30.0443 17.3025c-4.0898 2.359-8.9662 3.4605-13.9989 3.4605h.0014ZM91.2319 157.296c19.0327 0 34.9188-13.5272 38.5383-31.4594 17.6164-4.562 28.9425-21.0779 28.9425-37.908 0-11.0112-4.719-21.7066-13.2133-29.4143.7867-3.3035 1.2595-6.607 1.2595-9.909 0-22.4929-18.2471-39.3247-39.3251-39.3247-4.2461 0-8.3363.6285-12.4262 2.045-7.0792-6.9213-16.8318-11.3254-27.5271-11.3254-19.0331 0-34.9191 13.5268-38.5384 31.4591C11.3255 36.0212 0 52.5373 0 69.3675c0 11.0112 4.7184 21.7065 13.2125 29.4142-.7865 3.3035-1.2586 6.6067-1.2586 9.9092 0 22.4923 18.2466 39.3241 39.3248 39.3241 4.2462 0 8.3362-.6277 12.426-2.0441 7.0776 6.921 16.8302 11.3251 27.5271 11.3251Z"})})}const GC={claude:YH,codex:XH},YC={opus:dC,sonnet:wu,haiku:wf,"gpt-5.4":dC,"gpt-5.3-codex":wu,"gpt-5.3-codex-spark":wf};function qs({onClick:e,selected:t,icon:n,label:r,description:s,disabled:l}){return g.jsxs("button",{onClick:e,disabled:l,className:xe("w-full flex items-center gap-2 p-2 border border-border/0 rounded-lg text-left transition-opacity",t?"bg-muted border-border":"hover:opacity-60",l&&"opacity-40 cursor-not-allowed"),children:[n,g.jsxs("div",{children:[g.jsx("div",{className:"text-sm font-medium",children:r}),s?g.jsx("div",{className:"text-xs text-muted-foreground",children:s}):null]})]})}function Fc({trigger:e,triggerClassName:t,disabled:n=!1,children:r}){const[s,l]=b.useState(!1);return n?g.jsx("button",{disabled:!0,className:xe("flex items-center gap-1.5 px-2 py-1 text-sm rounded-md text-muted-foreground [&>svg]:shrink-0 opacity-70 cursor-default",t),children:e}):g.jsxs(KH,{open:s,onOpenChange:l,children:[g.jsx(GH,{asChild:!0,children:g.jsx("button",{className:xe("flex items-center gap-1.5 px-2 py-1 text-sm rounded-md transition-colors text-muted-foreground [&>svg]:shrink-0","hover:bg-muted/50",t),children:e})}),g.jsx(tN,{align:"center",className:"w-64 p-1",children:g.jsx("div",{className:"space-y-1",children:typeof r=="function"?r(()=>l(!1)):r})})]})}function D_({availableProviders:e,selectedProvider:t,showProviderPicker:n=!0,providerLocked:r=!1,model:s,modelOptions:l,onProviderChange:a,onModelChange:u,onClaudeReasoningEffortChange:h,onCodexReasoningEffortChange:d,onCodexFastModeChange:p,planMode:m=!1,onPlanModeChange:_,includePlanMode:y=!0,className:w}){var N,j,A;const S=e.find(D=>D.id===t)??e[0],C=GC[t],k=YC[s]??wu,T=y&&(S==null?void 0:S.supportsPlanMode)&&_,R=t==="codex"?l:null;return g.jsxs("div",{className:xe("flex justify-center items-center gap-0.5",w),children:[n?g.jsx(Fc,{disabled:r||!a,trigger:g.jsxs(g.Fragment,{children:[g.jsx(C,{className:"h-3.5 w-3.5"}),g.jsx("span",{children:(S==null?void 0:S.label)??t})]}),children:D=>e.map(B=>{const K=GC[B.id];return g.jsx(qs,{onClick:()=>{a==null||a(B.id),D()},selected:t===B.id,icon:g.jsx(K,{className:"h-4 w-4 text-muted-foreground"}),label:B.label},B.id)})}):null,g.jsx(Fc,{trigger:g.jsxs(g.Fragment,{children:[g.jsx(k,{className:"h-3.5 w-3.5"}),g.jsx("span",{children:((N=S.models.find(D=>D.id===s))==null?void 0:N.label)??s})]}),children:D=>S.models.map(B=>{const K=YC[B.id]??wu;return g.jsx(qs,{onClick:()=>{u(t,B.id),D()},selected:s===B.id,icon:g.jsx(K,{className:"h-4 w-4 text-muted-foreground"}),label:B.label},B.id)})}),g.jsx(Fc,{trigger:g.jsxs(g.Fragment,{children:[g.jsx(Hc,{className:"h-3.5 w-3.5"}),g.jsx("span",{children:t==="claude"?((j=Bf.find(D=>D.id===l.reasoningEffort))==null?void 0:j.label)??l.reasoningEffort:((A=M_.find(D=>D.id===l.reasoningEffort))==null?void 0:A.label)??l.reasoningEffort})]}),children:D=>t==="claude"?Bf.map(B=>g.jsx(qs,{onClick:()=>{h(B.id),D()},selected:l.reasoningEffort===B.id,icon:g.jsx(Hc,{className:"h-4 w-4 text-muted-foreground"}),label:B.label,disabled:B.id==="max"&&s!=="opus"},B.id)):M_.map(B=>g.jsx(qs,{onClick:()=>{d(B.id),D()},selected:l.reasoningEffort===B.id,icon:g.jsx(Hc,{className:"h-4 w-4 text-muted-foreground"}),label:B.label},B.id))}),t==="codex"?g.jsx(Fc,{trigger:g.jsxs(g.Fragment,{children:[R!=null&&R.fastMode?g.jsx(wf,{className:"h-3.5 w-3.5"}):g.jsx(Hc,{className:"h-3.5 w-3.5"}),g.jsx("span",{children:R!=null&&R.fastMode?"Fast Mode":"Standard"})]}),triggerClassName:R!=null&&R.fastMode?"text-emerald-500 dark:text-emerald-400":void 0,children:D=>g.jsxs(g.Fragment,{children:[g.jsx(qs,{onClick:()=>{p(!1),D()},selected:!(R!=null&&R.fastMode),icon:g.jsx(Hc,{className:"h-4 w-4 text-muted-foreground"}),label:"Standard"}),g.jsx(qs,{onClick:()=>{p(!0),D()},selected:!!(R!=null&&R.fastMode),icon:g.jsx(wf,{className:"h-4 w-4 text-muted-foreground"}),label:"Fast Mode"})]})}):null,T?g.jsx(Fc,{trigger:g.jsxs(g.Fragment,{children:[m?g.jsx(Sf,{className:"h-3.5 w-3.5"}):g.jsx(fC,{className:"h-3.5 w-3.5"}),g.jsx("span",{children:m?"Plan Mode":"Full Access"})]}),triggerClassName:m?"text-blue-400 dark:text-blue-300":void 0,children:D=>g.jsxs(g.Fragment,{children:[g.jsx(qs,{onClick:()=>{_(!1),D()},selected:!m,icon:g.jsx(fC,{className:"h-4 w-4 text-muted-foreground"}),label:"Full Access",description:"Execution without approval"}),g.jsx(qs,{onClick:()=>{_(!0),D()},selected:m,icon:g.jsx(Sf,{className:"h-4 w-4 text-muted-foreground"}),label:"Plan Mode",description:"Review a plan before execution"})]})}):null]})}function XC(e,t){if(t===void 0){console.info(`[ChatInput] ${e}`);return}console.info(`[ChatInput] ${e}`,t)}function Ho(e,t,n){return e==="claude"?t.provider==="claude"?{provider:"claude",model:t.model,modelOptions:{...t.modelOptions},planMode:t.planMode}:{provider:"claude",model:n.claude.model,modelOptions:{...n.claude.modelOptions},planMode:n.claude.planMode}:t.provider==="codex"?{provider:"codex",model:t.model,modelOptions:{...t.modelOptions},planMode:t.planMode}:{provider:"codex",model:n.codex.model,modelOptions:{...n.codex.modelOptions},planMode:n.codex.planMode}}function ZH(e){if(!e.providerLocked)return{composerPlanMode:e.planMode,lockedComposerState:e.lockedComposerState};const t=e.lockedComposerState??Ho(e.selectedProvider,e.composerState,e.providerDefaults);return{composerPlanMode:e.composerState.planMode,lockedComposerState:{...t,planMode:e.planMode}}}const QH=b.forwardRef(function({onSubmit:t,onCancel:n,disabled:r,canCancel:s,chatId:l,activeProvider:a,availableProviders:u},h){const{getDraft:d,setDraft:p,clearDraft:m}=RH(),{composerState:_,providerDefaults:y,setComposerModel:w,setComposerModelOptions:S,setComposerPlanMode:C,resetComposerFromProvider:k}=ls(),[T,R]=b.useState(()=>l?d(l):""),N=b.useRef(null),j=EH(),[A,D]=b.useState(()=>a?Ho(a,_,y):null),B=a!==null,K=B?A??Ho(a,_,y):_,z=B?a:_.provider,U=u.find(M=>M.id===z)??u[0],H=(U==null?void 0:U.supportsPlanMode)??!1,F=b.useCallback(()=>{const M=N.current;M&&(M.style.height="auto",M.style.height=`${M.scrollHeight}px`)},[]),q=b.useCallback(M=>{if(N.current=M,!!h){if(typeof h=="function"){h(M);return}h.current=M}},[h]);b.useEffect(()=>{F()},[T,F]),b.useEffect(()=>(window.addEventListener("resize",F),()=>window.removeEventListener("resize",F)),[F]),b.useEffect(()=>{var M;(M=N.current)==null||M.focus()},[l]),b.useEffect(()=>{if(a===null){D(null);return}D(Ho(a,_,y))},[a,l]),b.useEffect(()=>{XC("resolved provider state",{chatId:l??null,activeProvider:a,composerProvider:_.provider,composerModel:_.model,effectiveProvider:K.provider,effectiveModel:K.model,selectedProvider:z,providerLocked:B,lockedComposerProvider:(A==null?void 0:A.provider)??null})},[a,l,_.model,_.provider,A==null?void 0:A.provider,B,K.model,K.provider,z]);function $(M){if(B){D(I=>{const X=I??Ho(z,_,y);return X.provider==="claude"?{...X,modelOptions:{...X.modelOptions,reasoningEffort:M}}:{...X,modelOptions:{...X.modelOptions,reasoningEffort:M}}});return}if(z==="claude"){S({reasoningEffort:M});return}S({reasoningEffort:M})}function P(M){const I=ZH({providerLocked:B,planMode:M,selectedProvider:z,composerState:_,providerDefaults:y,lockedComposerState:A});I.lockedComposerState!==A&&D(I.lockedComposerState),I.composerPlanMode!==_.planMode&&C(I.composerPlanMode)}function V(){P(!K.planMode)}async function W(){if(!T.trim())return;const M=T;let I;K.provider==="claude"?I={claude:{...K.modelOptions}}:I={codex:{...K.modelOptions}};const X={provider:z,model:K.model,modelOptions:I,planMode:H?K.planMode:!1};XC("submit settings",{chatId:l??null,activeProvider:a,composerProvider:K.provider,submitOptions:X}),R(""),l&&m(l),N.current&&(N.current.style.height="auto");try{await t(M,X)}catch(L){console.error("[ChatInput] Submit failed:",L),R(M),l&&p(l,M)}}function Z(M){if(M.key==="Tab"&&!M.shiftKey){M.preventDefault(),GP(N.current,document);return}if(M.key==="Tab"&&M.shiftKey&&H){M.preventDefault(),V();return}if(M.key==="Escape"&&s){M.preventDefault(),n==null||n();return}const I="ontouchstart"in window||navigator.maxTouchPoints>0;M.key==="Enter"&&!M.shiftKey&&!s&&!I&&(M.preventDefault(),W())}return g.jsxs("div",{className:xe("p-3 pt-0 md:pb-2",j&&"px-5 pb-5"),children:[g.jsxs("div",{className:"flex items-end gap-2 max-w-[840px] mx-auto border dark:bg-card/40 backdrop-blur-lg border-border rounded-[29px] pr-1.5",children:[g.jsx($M,{ref:q,placeholder:"Build something...",value:T,autoFocus:!0,[ub]:"",rows:1,onChange:M=>{R(M.target.value),l&&p(l,M.target.value),F()},onKeyDown:Z,disabled:r,className:"flex-1 text-base p-3 md:p-4 pl-4.5 md:pl-6 resize-none max-h-[200px] outline-none bg-transparent border-0 shadow-none"}),g.jsx(nt,{type:"button",onPointerDown:M=>{M.preventDefault(),s?n==null||n():!r&&T.trim()&&W()},disabled:!s&&(r||!T.trim()),size:"icon",className:"flex-shrink-0 bg-slate-600 text-white dark:bg-white dark:text-slate-900 rounded-full cursor-pointer h-10 w-10 md:h-11 md:w-11 mb-1 -mr-0.5 md:mr-0 md:mb-1.5 touch-manipulation disabled:bg-white/60 disabled:text-slate-700",children:s?g.jsx("div",{className:"w-3 h-3 md:w-4 md:h-4 rounded-xs bg-current"}):g.jsx(f6,{className:"h-5 w-5 md:h-6 md:w-6"})})]}),g.jsx(D_,{availableProviders:u,selectedProvider:z,providerLocked:B,model:K.model,modelOptions:K.modelOptions,onProviderChange:M=>{B||k(M)},onModelChange:(M,I)=>{if(B){D(X=>({...X??Ho(z,_,y),model:I}));return}w(I)},onClaudeReasoningEffortChange:M=>$(M),onCodexReasoningEffortChange:M=>$(M),onCodexFastModeChange:M=>{if(B){D(I=>{const X=I??Ho(z,_,y);return X.provider==="claude"?X:{...X,modelOptions:{...X.modelOptions,fastMode:M}}});return}S({fastMode:M})},planMode:K.planMode,onPlanModeChange:P,includePlanMode:H,className:"max-w-[840px] mx-auto mt-2"})]})}),JH=b.memo(QH),nN=b.forwardRef(({className:e,...t},n)=>g.jsx("div",{ref:n,className:xe("bg-card text-card-foreground",e),...t}));nN.displayName="Card";const rN=b.forwardRef(({className:e,...t},n)=>g.jsx("div",{ref:n,className:xe("flex flex-col space-y-1.5 p-2",e),...t}));rN.displayName="CardHeader";const eF=b.forwardRef(({className:e,...t},n)=>g.jsx("h3",{ref:n,className:xe("text-2xl font-semibold leading-none tracking-tight",e),...t}));eF.displayName="CardTitle";const tF=b.forwardRef(({className:e,...t},n)=>g.jsx("p",{ref:n,className:xe("text-sm text-muted-foreground",e),...t}));tF.displayName="CardDescription";const iN=b.forwardRef(({className:e,...t},n)=>g.jsx("div",{ref:n,className:xe("p-6 pt-0",e),...t}));iN.displayName="CardContent";const nF=b.forwardRef(({className:e,...t},n)=>g.jsx("div",{ref:n,className:xe("flex items-center p-6 pt-0",e),...t}));nF.displayName="CardFooter";function rF({sidebarCollapsed:e,onOpenSidebar:t,onExpandSidebar:n,onNewChat:r,localPath:s,embeddedTerminalVisible:l=!1,onToggleEmbeddedTerminal:a,rightSidebarVisible:u=!1,onToggleRightSidebar:h,onOpenExternal:d,editorLabel:p="Editor",finderShortcut:m,editorShortcut:_,terminalShortcut:y,rightSidebarShortcut:w}){return g.jsx(rN,{className:xe("absolute top-0 md:top-2 left-0 right-0 z-10 px-2.5 pr-4 border-border/0 md:pb-0 flex items-center justify-center",e?"md:px-2.5 md:pr-4":"md:px-4 md:pr-4","backdrop-blur-lg md:backdrop-blur-none bg-gradient-to-b from-background md:from-transparent border-b border-x-0 md:border-x border-border md:border-none"),children:g.jsxs("div",{className:"relative flex items-center gap-2 w-full",children:[g.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0 border-l border-border/0",children:[g.jsx(nt,{variant:"ghost",size:"icon",className:"md:hidden",onClick:t,children:g.jsx($R,{className:"h-5 w-5"})}),e&&g.jsxs(g.Fragment,{children:[g.jsx("div",{className:"flex items-center justify-center w-[40px] h-[40px]",children:g.jsx(fu,{className:"h-4 w-4 sm:h-5 sm:w-5 text-logo ml-1 hidden md:block"})}),g.jsx(nt,{variant:"ghost",size:"icon",className:"hidden md:flex",onClick:n,title:"Expand sidebar",children:g.jsx(p_,{className:"h-5 w-5"})})]}),g.jsx(nt,{variant:"ghost",size:"icon",onClick:r,title:"Compose",children:g.jsx(lb,{className:"h-5 w-5"})})]}),g.jsx("div",{className:"flex-1 min-w-0"}),g.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[s&&(d||a)&&g.jsxs(g.Fragment,{children:[d?g.jsxs(tu,{children:[g.jsx(nu,{asChild:!0,children:g.jsx(nt,{variant:"ghost",size:"icon",onClick:()=>d("open_finder"),title:"Open in Finder",className:"border border-border/0",children:g.jsx(UR,{className:"h-4.5 w-4.5"})})}),g.jsx(ca,{side:"bottom",shortcut:m})]}):null,a?g.jsxs(tu,{children:[g.jsx(nu,{asChild:!0,children:g.jsx(nt,{variant:"ghost",size:"icon",onClick:a,className:xe("border border-border/0",l&&"text-white"),children:g.jsx(ab,{className:"h-4.5 w-4.5"})})}),g.jsx(ca,{side:"bottom",shortcut:y})]}):null,d?g.jsxs(tu,{children:[g.jsx(nu,{asChild:!0,children:g.jsx(nt,{variant:"ghost",size:"icon",onClick:()=>d("open_editor"),title:`Open in ${p}`,className:"border border-border/0",children:g.jsx(FR,{className:"h-4.5 w-4.5"})})}),g.jsx(ca,{side:"bottom",shortcut:_})]}):null]}),h?g.jsxs(tu,{children:[g.jsx(nu,{asChild:!0,children:g.jsx(nt,{variant:"ghost",size:"icon",onClick:h,className:xe("border border-border/0",u&&"text-white"),children:g.jsx(_P,{className:"h-4.5 w-4.5"})})}),g.jsx(ca,{side:"bottom",shortcut:w})]}):null]})]})})}function iF({onClose:e}){return g.jsx("div",{className:"h-full min-h-0 border-l border-border bg-background md:min-w-[300px]",children:g.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[g.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border px-3 py-2",children:[g.jsx("div",{className:"min-w-0 flex-1 truncate text-xs text-muted-foreground",children:"Diffs"}),g.jsx("button",{type:"button","aria-label":"Close right sidebar",onClick:e,className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",children:g.jsx(Oa,{className:"h-4 w-4"})})]}),g.jsx("div",{className:"flex flex-1 items-center justify-center px-6 text-center",children:g.jsx("p",{className:"text-sm text-muted-foreground",children:"diffs coming soon"})})]})})}function sF(e,t){const n=getComputedStyle(e),r=parseFloat(n.fontSize);return t*r}function oF(e,t){const n=getComputedStyle(e.ownerDocument.body),r=parseFloat(n.fontSize);return t*r}function lF(e){return e/100*window.innerHeight}function aF(e){return e/100*window.innerWidth}function cF(e){switch(typeof e){case"number":return[e,"px"];case"string":{const t=parseFloat(e);return e.endsWith("%")?[t,"%"]:e.endsWith("px")?[t,"px"]:e.endsWith("rem")?[t,"rem"]:e.endsWith("em")?[t,"em"]:e.endsWith("vh")?[t,"vh"]:e.endsWith("vw")?[t,"vw"]:[t,"%"]}}}function iu({groupSize:e,panelElement:t,styleProp:n}){let r;const[s,l]=cF(n);switch(l){case"%":{r=s/100*e;break}case"px":{r=s;break}case"rem":{r=oF(t,s);break}case"em":{r=sF(t,s);break}case"vh":{r=lF(s);break}case"vw":{r=aF(s);break}}return r}function or(e){return parseFloat(e.toFixed(3))}function Ca({group:e}){const{orientation:t,panels:n}=e;return n.reduce((r,s)=>(r+=t==="horizontal"?s.element.offsetWidth:s.element.offsetHeight,r),0)}function O_(e){const{panels:t}=e,n=Ca({group:e});return n===0?t.map(r=>({groupResizeBehavior:r.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:r.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:r.panelConstraints.disabled,minSize:0,maxSize:100,panelId:r.id})):t.map(r=>{const{element:s,panelConstraints:l}=r;let a=0;if(l.collapsedSize!==void 0){const p=iu({groupSize:n,panelElement:s,styleProp:l.collapsedSize});a=or(p/n*100)}let u;if(l.defaultSize!==void 0){const p=iu({groupSize:n,panelElement:s,styleProp:l.defaultSize});u=or(p/n*100)}let h=0;if(l.minSize!==void 0){const p=iu({groupSize:n,panelElement:s,styleProp:l.minSize});h=or(p/n*100)}let d=100;if(l.maxSize!==void 0){const p=iu({groupSize:n,panelElement:s,styleProp:l.maxSize});d=or(p/n*100)}return{groupResizeBehavior:l.groupResizeBehavior,collapsedSize:a,collapsible:l.collapsible===!0,defaultSize:u,disabled:l.disabled,minSize:h,maxSize:d,panelId:r.id}})}function _t(e,t="Assertion error"){if(!e)throw Error(t)}function L_(e,t){return Array.from(t).sort(e==="horizontal"?uF:dF)}function uF(e,t){const n=e.element.offsetLeft-t.element.offsetLeft;return n!==0?n:e.element.offsetWidth-t.element.offsetWidth}function dF(e,t){const n=e.element.offsetTop-t.element.offsetTop;return n!==0?n:e.element.offsetHeight-t.element.offsetHeight}function sN(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function oN(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function hF({orientation:e,rects:t,targetRect:n}){const r={x:n.x+n.width/2,y:n.y+n.height/2};let s,l=Number.MAX_VALUE;for(const a of t){const{x:u,y:h}=oN(r,a),d=e==="horizontal"?u:h;d<l&&(l=d,s=a)}return _t(s,"No rect found"),s}let Oh;function fF(){return Oh===void 0&&(typeof matchMedia=="function"?Oh=!!matchMedia("(pointer:coarse)").matches:Oh=!1),Oh}function lN(e){const{element:t,orientation:n,panels:r,separators:s}=e,l=L_(n,Array.from(t.children).filter(sN).map(w=>({element:w}))).map(({element:w})=>w),a=[];let u=!1,h=!1,d=-1,p=-1,m=0,_,y=[];{let w=-1;for(const S of l)S.hasAttribute("data-panel")&&(w++,S.ariaDisabled===null&&(m++,d===-1&&(d=w),p=w))}if(m>1){let w=-1;for(const S of l)if(S.hasAttribute("data-panel")){w++;const C=r.find(k=>k.element===S);if(C){if(_){const k=_.element.getBoundingClientRect(),T=S.getBoundingClientRect();let R;if(h){const N=n==="horizontal"?new DOMRect(k.right,k.top,0,k.height):new DOMRect(k.left,k.bottom,k.width,0),j=n==="horizontal"?new DOMRect(T.left,T.top,0,T.height):new DOMRect(T.left,T.top,T.width,0);switch(y.length){case 0:{R=[N,j];break}case 1:{const A=y[0],D=hF({orientation:n,rects:[k,T],targetRect:A.element.getBoundingClientRect()});R=[A,D===k?j:N];break}default:{R=y;break}}}else y.length?R=y:R=[n==="horizontal"?new DOMRect(k.right,T.top,T.left-k.right,T.height):new DOMRect(T.left,k.bottom,T.width,T.top-k.bottom)];for(const N of R){let j="width"in N?N:N.element.getBoundingClientRect();const A=fF()?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(j.width<A){const B=A-j.width;j=new DOMRect(j.x-B/2,j.y,j.width+B,j.height)}if(j.height<A){const B=A-j.height;j=new DOMRect(j.x,j.y-B/2,j.width,j.height+B)}const D=w<=d||w>p;!u&&!D&&a.push({group:e,groupSize:Ca({group:e}),panels:[_,C],separator:"width"in N?void 0:N,rect:j}),u=!1}}h=!1,_=C,y=[]}}else if(S.hasAttribute("data-separator")){S.ariaDisabled!==null&&(u=!0);const C=s.find(k=>k.element===S);C?y.push(C):(_=void 0,y=[])}else h=!0}return a}var to,SE;let aN=(SE=class{constructor(){ww(this,to,{})}addListener(t,n){const r=jc(this,to)[t];return r===void 0?jc(this,to)[t]=[n]:r.includes(n)||r.push(n),()=>{this.removeListener(t,n)}}emit(t,n){const r=jc(this,to)[t];if(r!==void 0)if(r.length===1)r[0].call(null,n);else{let s=!1,l=null;const a=Array.from(r);for(let u=0;u<a.length;u++){const h=a[u];try{h.call(null,n)}catch(d){l===null&&(s=!0,l=d)}}if(s)throw l}}removeAllListeners(){Cw(this,to,{})}removeListener(t,n){const r=jc(this,to)[t];if(r!==void 0){const s=r.indexOf(n);s>=0&&r.splice(s,1)}}},to=new WeakMap,SE),ki=new Map;const cN=new aN;function pF(e){ki=new Map(ki),ki.delete(e)}function ZC(e,t){for(const[n]of ki)if(n.id===e)return n}function ro(e,t){for(const[n,r]of ki)if(n.id===e)return r;if(t)throw Error(`Could not find data for Group with id ${e}`)}function ul(){return ki}function qb(e,t){return cN.addListener("groupChange",n=>{n.group.id===e&&t(n)})}function ps(e,t){const n=ki.get(e);ki=new Map(ki),ki.set(e,t),cN.emit("groupChange",{group:e,prev:n,next:t})}function mF(e,t,n){let r,s={x:1/0,y:1/0};for(const l of t){const a=oN(n,l.rect);switch(e){case"horizontal":{a.x<=s.x&&(r=l,s=a);break}case"vertical":{a.y<=s.y&&(r=l,s=a);break}}}return r?{distance:s,hitRegion:r}:void 0}function gF(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function vF(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:e2(e),b:e2(t)};let r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();_t(r,"Stacking order can only be calculated for elements with a common ancestor");const s={a:JC(QC(n.a)),b:JC(QC(n.b))};if(s.a===s.b){const l=r.childNodes,a={a:n.a.at(-1),b:n.b.at(-1)};let u=l.length;for(;u--;){const h=l[u];if(h===a.a)return 1;if(h===a.b)return-1}}return Math.sign(s.a-s.b)}const _F=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function yF(e){const t=getComputedStyle(uN(e)??e).display;return t==="flex"||t==="inline-flex"}function bF(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||yF(e))||+t.opacity<1||"transform"in t&&t.transform!=="none"||"webkitTransform"in t&&t.webkitTransform!=="none"||"mixBlendMode"in t&&t.mixBlendMode!=="normal"||"filter"in t&&t.filter!=="none"||"webkitFilter"in t&&t.webkitFilter!=="none"||"isolation"in t&&t.isolation==="isolate"||_F.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function QC(e){let t=e.length;for(;t--;){const n=e[t];if(_t(n,"Missing node"),bF(n))return n}return null}function JC(e){return e&&Number(getComputedStyle(e).zIndex)||0}function e2(e){const t=[];for(;e;)t.push(e),e=uN(e);return t}function uN(e){const{parentNode:t}=e;return gF(t)?t.host:t}function xF(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function SF({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!sN(n)||n.contains(e)||e.contains(n))return!0;if(vF(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(xF(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function Kb(e,t){const n=[];return t.forEach((r,s)=>{if(s.disabled)return;const l=lN(s),a=mF(s.orientation,l,{x:e.clientX,y:e.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&SF({groupElement:s.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&n.push(a.hitRegion)}),n}function wF(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function $n(e,t,n=0){return Math.abs(or(e)-or(t))<=n}function xi(e,t){return $n(e,t)?0:e>t?1:-1}function ua({overrideDisabledPanels:e,panelConstraints:t,prevSize:n,size:r}){const{collapsedSize:s=0,collapsible:l,disabled:a,maxSize:u=100,minSize:h=0}=t;if(a&&!e)return n;if(xi(r,h)<0)if(l){const d=(s+h)/2;xi(r,d)<0?r=s:r=h}else r=h;return r=Math.min(u,r),r=or(r),r}function Ou({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:s,trigger:l}){if($n(e,0))return t;const a=l==="imperative-api",u=Object.values(t),h=Object.values(s),d=[...u],[p,m]=r;_t(p!=null,"Invalid first pivot index"),_t(m!=null,"Invalid second pivot index");let _=0;switch(l){case"keyboard":{{const S=e<0?m:p,C=n[S];_t(C,`Panel constraints not found for index ${S}`);const{collapsedSize:k=0,collapsible:T,minSize:R=0}=C;if(T){const N=u[S];if(_t(N!=null,`Previous layout not found for panel index ${S}`),$n(N,k)){const j=R-N;xi(j,Math.abs(e))>0&&(e=e<0?0-j:j)}}}{const S=e<0?p:m,C=n[S];_t(C,`No panel constraints found for index ${S}`);const{collapsedSize:k=0,collapsible:T,minSize:R=0}=C;if(T){const N=u[S];if(_t(N!=null,`Previous layout not found for panel index ${S}`),$n(N,R)){const j=N-k;xi(j,Math.abs(e))>0&&(e=e<0?0-j:j)}}}break}default:{const S=e<0?m:p,C=n[S];_t(C,`Panel constraints not found for index ${S}`);const k=u[S],{collapsible:T,collapsedSize:R,minSize:N}=C;if(T&&xi(k,N)<0)if(e>0){const j=N-R,A=j/2,D=k+e;xi(D,N)<0&&(e=xi(e,A)<=0?0:j)}else{const j=N-R,A=100-j/2,D=k-e;xi(D,N)<0&&(e=xi(100+e,A)>0?0:-j)}break}}{const S=e<0?1:-1;let C=e<0?m:p,k=0;for(;;){const R=u[C];_t(R!=null,`Previous layout not found for panel index ${C}`);const N=ua({overrideDisabledPanels:a,panelConstraints:n[C],prevSize:R,size:100})-R;if(k+=N,C+=S,C<0||C>=n.length)break}const T=Math.min(Math.abs(e),Math.abs(k));e=e<0?0-T:T}{let S=e<0?p:m;for(;S>=0&&S<n.length;){const C=Math.abs(e)-Math.abs(_),k=u[S];_t(k!=null,`Previous layout not found for panel index ${S}`);const T=k-C,R=ua({overrideDisabledPanels:a,panelConstraints:n[S],prevSize:k,size:T});if(!$n(k,R)&&(_+=k-R,d[S]=R,_.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?S--:S++}}if(wF(h,d))return s;{const S=e<0?m:p,C=u[S];_t(C!=null,`Previous layout not found for panel index ${S}`);const k=C+_,T=ua({overrideDisabledPanels:a,panelConstraints:n[S],prevSize:C,size:k});if(d[S]=T,!$n(T,k)){let R=k-T,N=e<0?m:p;for(;N>=0&&N<n.length;){const j=d[N];_t(j!=null,`Previous layout not found for panel index ${N}`);const A=j+R,D=ua({overrideDisabledPanels:a,panelConstraints:n[N],prevSize:j,size:A});if($n(j,D)||(R-=D-j,d[N]=D),$n(R,0))break;e>0?N--:N++}}}const y=Object.values(d).reduce((S,C)=>C+S,0);if(!$n(y,100,.1))return s;const w=Object.keys(s);return d.reduce((S,C,k)=>(S[w[k]]=C,S),{})}function Jo(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(t[n]===void 0||xi(e[n],t[n])!==0)return!1;return!0}function el({layout:e,panelConstraints:t}){const n=Object.values(e),r=[...n],s=r.reduce((u,h)=>u+h,0);if(r.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${r.map(u=>`${u}%`).join(", ")}`);if(!$n(s,100)&&r.length>0)for(let u=0;u<t.length;u++){const h=r[u];_t(h!=null,`No layout data found for index ${u}`);const d=100/s*h;r[u]=d}let l=0;for(let u=0;u<t.length;u++){const h=n[u];_t(h!=null,`No layout data found for index ${u}`);const d=r[u];_t(d!=null,`No layout data found for index ${u}`);const p=ua({overrideDisabledPanels:!0,panelConstraints:t[u],prevSize:h,size:d});d!=p&&(l+=d-p,r[u]=p)}if(!$n(l,0))for(let u=0;u<t.length;u++){const h=r[u];_t(h!=null,`No layout data found for index ${u}`);const d=h+l,p=ua({overrideDisabledPanels:!0,panelConstraints:t[u],prevSize:h,size:d});if(h!==p&&(l-=p-h,r[u]=p,$n(l,0)))break}const a=Object.keys(e);return r.reduce((u,h,d)=>(u[a[d]]=h,u),{})}function dN({groupId:e,panelId:t}){const n=()=>{const u=ul();for(const[h,{defaultLayoutDeferred:d,derivedPanelConstraints:p,layout:m,groupSize:_,separatorToPanels:y}]of u)if(h.id===e)return{defaultLayoutDeferred:d,derivedPanelConstraints:p,group:h,groupSize:_,layout:m,separatorToPanels:y};throw Error(`Group ${e} not found`)},r=()=>{const u=n().derivedPanelConstraints.find(h=>h.panelId===t);if(u!==void 0)return u;throw Error(`Panel constraints not found for Panel ${t}`)},s=()=>{const u=n().group.panels.find(h=>h.id===t);if(u!==void 0)return u;throw Error(`Layout not found for Panel ${t}`)},l=()=>{const u=n().layout[t];if(u!==void 0)return u;throw Error(`Layout not found for Panel ${t}`)},a=u=>{const h=l();if(u===h)return;const{defaultLayoutDeferred:d,derivedPanelConstraints:p,group:m,groupSize:_,layout:y,separatorToPanels:w}=n(),S=m.panels.findIndex(R=>R.id===t),C=S===m.panels.length-1,k=Ou({delta:C?h-u:u-h,initialLayout:y,panelConstraints:p,pivotIndices:C?[S-1,S]:[S,S+1],prevLayout:y,trigger:"imperative-api"}),T=el({layout:k,panelConstraints:p});Jo(y,T)||ps(m,{defaultLayoutDeferred:d,derivedPanelConstraints:p,groupSize:_,layout:T,separatorToPanels:w})};return{collapse:()=>{const{collapsible:u,collapsedSize:h}=r(),{mutableValues:d}=s(),p=l();u&&p!==h&&(d.expandToSize=p,a(h))},expand:()=>{const{collapsible:u,collapsedSize:h,minSize:d}=r(),{mutableValues:p}=s(),m=l();if(u&&m===h){let _=p.expandToSize??d;_===0&&(_=1),a(_)}},getSize:()=>{const{group:u}=n(),h=l(),{element:d}=s(),p=u.orientation==="horizontal"?d.offsetWidth:d.offsetHeight;return{asPercentage:h,inPixels:p}},isCollapsed:()=>{const{collapsible:u,collapsedSize:h}=r(),d=l();return u&&$n(h,d)},resize:u=>{const{group:h}=n(),{element:d}=s(),p=Ca({group:h}),m=iu({groupSize:p,panelElement:d,styleProp:u}),_=or(m/p*100);a(_)}}}function t2(e){if(e.defaultPrevented)return;const t=ul();Kb(e,t).forEach(n=>{if(n.separator){const r=n.panels.find(s=>s.panelConstraints.defaultSize!==void 0);if(r){const s=r.panelConstraints.defaultSize,l=dN({groupId:n.group.id,panelId:r.id});l&&s!==void 0&&(l.resize(s),e.preventDefault())}}})}function rf(e){const t=ul();for(const[n]of t)if(n.separators.some(r=>r.element===e))return n;throw Error("Could not find parent Group for separator element")}function hN({groupId:e}){const t=()=>{const n=ul();for(const[r,s]of n)if(r.id===e)return{group:r,...s};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){const{defaultLayoutDeferred:n,layout:r}=t();return n?{}:r},setLayout(n){const{defaultLayoutDeferred:r,derivedPanelConstraints:s,group:l,groupSize:a,layout:u,separatorToPanels:h}=t(),d=el({layout:n,panelConstraints:s});return r?u:(Jo(u,d)||ps(l,{defaultLayoutDeferred:r,derivedPanelConstraints:s,groupSize:a,layout:d,separatorToPanels:h}),d)}}}function zo(e,t){const n=rf(e),r=ro(n.id,!0),s=n.separators.find(p=>p.element===e);_t(s,"Matching separator not found");const l=r.separatorToPanels.get(s);_t(l,"Matching panels not found");const a=l.map(p=>n.panels.indexOf(p)),u=hN({groupId:n.id}).getLayout(),h=Ou({delta:t,initialLayout:u,panelConstraints:r.derivedPanelConstraints,pivotIndices:a,prevLayout:u,trigger:"keyboard"}),d=el({layout:h,panelConstraints:r.derivedPanelConstraints});Jo(u,d)||ps(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:d,separatorToPanels:r.separatorToPanels})}function n2(e){if(e.defaultPrevented)return;const t=e.currentTarget,n=rf(t);if(!n.disabled)switch(e.key){case"ArrowDown":{e.preventDefault(),n.orientation==="vertical"&&zo(t,5);break}case"ArrowLeft":{e.preventDefault(),n.orientation==="horizontal"&&zo(t,-5);break}case"ArrowRight":{e.preventDefault(),n.orientation==="horizontal"&&zo(t,5);break}case"ArrowUp":{e.preventDefault(),n.orientation==="vertical"&&zo(t,-5);break}case"End":{e.preventDefault(),zo(t,100);break}case"Enter":{e.preventDefault();const r=rf(t),s=ro(r.id,!0),{derivedPanelConstraints:l,layout:a,separatorToPanels:u}=s,h=r.separators.find(_=>_.element===t);_t(h,"Matching separator not found");const d=u.get(h);_t(d,"Matching panels not found");const p=d[0],m=l.find(_=>_.panelId===p.id);if(_t(m,"Panel metadata not found"),m.collapsible){const _=a[p.id],y=m.collapsedSize===_?r.mutableState.expandedPanelSizes[p.id]??m.minSize:m.collapsedSize;zo(t,y-_)}break}case"F6":{e.preventDefault();const r=rf(t).separators.map(a=>a.element),s=Array.from(r).findIndex(a=>a===e.currentTarget);_t(s!==null,"Index not found");const l=e.shiftKey?s>0?s-1:r.length-1:s+1<r.length?s+1:0;r[l].focus({preventScroll:!0});break}case"Home":{e.preventDefault(),zo(t,-100);break}}}let va={cursorFlags:0,state:"inactive"};const Gb=new aN;function tl(){return va}function CF(e){return Gb.addListener("change",e)}function kF(e){const t=va,n={...va};n.cursorFlags=e,va=n,Gb.emit("change",{prev:t,next:n})}function _a(e){const t=va;va=e,Gb.emit("change",{prev:t,next:e})}function r2(e){if(e.defaultPrevented||e.pointerType==="mouse"&&e.button>0)return;const t=ul(),n=Kb(e,t),r=new Map;let s=!1;n.forEach(l=>{l.separator&&(s||(s=!0,l.separator.element.focus({preventScroll:!0})));const a=t.get(l.group);a&&r.set(l.group,a.layout)}),_a({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:"active"}),n.length&&e.preventDefault()}const EF=e=>e,wv=()=>{},fN=1,pN=2,mN=4,gN=8,i2=3,s2=12;let Lh;function o2(){return Lh===void 0&&(Lh=!1,typeof window<"u"&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(Lh=!0)),Lh}function RF({cursorFlags:e,groups:t,state:n}){let r=0,s=0;switch(n){case"active":case"hover":t.forEach(l=>{if(!l.mutableState.disableCursor)switch(l.orientation){case"horizontal":{r++;break}case"vertical":{s++;break}}})}if(!(r===0&&s===0)){switch(n){case"active":{if(e&&o2()){const l=(e&fN)!==0,a=(e&pN)!==0,u=(e&mN)!==0,h=(e&gN)!==0;if(l)return u?"se-resize":h?"ne-resize":"e-resize";if(a)return u?"sw-resize":h?"nw-resize":"w-resize";if(u)return"s-resize";if(h)return"n-resize"}break}}return o2()?r>0&&s>0?"move":r>0?"ew-resize":"ns-resize":r>0&&s>0?"grab":r>0?"col-resize":"row-resize"}}const l2=new WeakMap;function Yb(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=l2.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&e.adoptedStyleSheets.push(n));const r=tl();switch(r.state){case"active":case"hover":{const s=RF({cursorFlags:r.cursorFlags,groups:r.hitRegions.map(a=>a.group),state:r.state}),l=`*, *:hover {cursor: ${s} !important; }`;if(t===l)return;t=l,s?n.cssRules.length===0?n.insertRule(l):n.replaceSync(l):n.cssRules.length===1&&n.deleteRule(0);break}case"inactive":{t=void 0,n.cssRules.length===1&&n.deleteRule(0);break}}l2.set(e,{prevStyle:t,styleSheet:n})}function vN({document:e,event:t,hitRegions:n,initialLayoutMap:r,mountedGroups:s,pointerDownAtPoint:l,prevCursorFlags:a}){let u=0;n.forEach(d=>{const{group:p,groupSize:m}=d,{orientation:_,panels:y}=p,{disableCursor:w}=p.mutableState;let S=0;l?_==="horizontal"?S=(t.clientX-l.x)/m*100:S=(t.clientY-l.y)/m*100:_==="horizontal"?S=t.clientX<0?-100:100:S=t.clientY<0?-100:100;const C=r.get(p),k=s.get(p);if(!C||!k)return;const{defaultLayoutDeferred:T,derivedPanelConstraints:R,groupSize:N,layout:j,separatorToPanels:A}=k;if(R&&j&&A){const D=Ou({delta:S,initialLayout:C,panelConstraints:R,pivotIndices:d.panels.map(B=>y.indexOf(B)),prevLayout:j,trigger:"mouse-or-touch"});if(Jo(D,j)){if(S!==0&&!w)switch(_){case"horizontal":{u|=S<0?fN:pN;break}case"vertical":{u|=S<0?mN:gN;break}}}else ps(d.group,{defaultLayoutDeferred:T,derivedPanelConstraints:R,groupSize:N,layout:D,separatorToPanels:A})}});let h=0;t.movementX===0?h|=a&i2:h|=u&i2,t.movementY===0?h|=a&s2:h|=u&s2,kF(h),Yb(e)}function a2(e){const t=ul(),n=tl();switch(n.state){case"active":vN({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function c2(e){if(e.defaultPrevented)return;const t=tl(),n=ul();switch(t.state){case"active":{if(e.buttons===0){_a({cursorFlags:0,state:"inactive"}),t.hitRegions.forEach(r=>{const s=ro(r.group.id,!0);ps(r.group,s)});return}vN({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break}default:{const r=Kb(e,n);r.length===0?t.state!=="inactive"&&_a({cursorFlags:0,state:"inactive"}):_a({cursorFlags:0,hitRegions:r,state:"hover"}),Yb(e.currentTarget);break}}}function u2(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(tl().state){case"hover":_a({cursorFlags:0,state:"inactive"})}}function d2(e){if(e.defaultPrevented||e.pointerType==="mouse"&&e.button>0)return;const t=tl();switch(t.state){case"active":_a({cursorFlags:0,state:"inactive"}),t.hitRegions.length>0&&(Yb(e.currentTarget),t.hitRegions.forEach(n=>{const r=ro(n.group.id,!0);ps(n.group,r)}),e.preventDefault())}}function h2(e){let t=0,n=0;const r={};for(const l of e)if(l.defaultSize!==void 0){t++;const a=or(l.defaultSize);n+=a,r[l.panelId]=a}else r[l.panelId]=void 0;const s=e.length-t;if(s!==0){const l=or((100-n)/s);for(const a of e)a.defaultSize===void 0&&(r[a.panelId]=l)}return r}function TF(e,t,n){if(!n[0])return;const r=e.panels.find(h=>h.element===t);if(!r||!r.onResize)return;const s=Ca({group:e}),l=e.orientation==="horizontal"?r.element.offsetWidth:r.element.offsetHeight,a=r.mutableValues.prevSize,u={asPercentage:or(l/s*100),inPixels:l};r.mutableValues.prevSize=u,r.onResize(u,r.id,a)}function MF(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function NF({group:e,nextGroupSize:t,prevGroupSize:n,prevLayout:r}){if(n<=0||t<=0||n===t)return r;let s=0,l=0,a=!1;const u=new Map,h=[];for(const m of e.panels){const _=r[m.id]??0;switch(m.panelConstraints.groupResizeBehavior){case"preserve-pixel-size":{a=!0;const y=_/100*n,w=or(y/t*100);u.set(m.id,w),s+=w;break}case"preserve-relative-size":default:{h.push(m.id),l+=_;break}}}if(!a||h.length===0)return r;const d=100-s,p={...r};if(u.forEach((m,_)=>{p[_]=m}),l>0)for(const m of h){const _=r[m]??0;p[m]=or(_/l*d)}else{const m=or(d/h.length);for(const _ of h)p[_]=m}return p}function AF(e,t){const n=e.map(s=>s.id),r=Object.keys(t);if(n.length!==r.length)return!1;for(const s of n)if(!r.includes(s))return!1;return!0}const na=new Map;function DF(e){let t=!0;_t(e.element.ownerDocument.defaultView,"Cannot register an unmounted Group");const n=e.element.ownerDocument.defaultView.ResizeObserver,r=new Set,s=new Set,l=new n(w=>{for(const S of w){const{borderBoxSize:C,target:k}=S;if(k===e.element){if(t){const T=Ca({group:e});if(T===0)return;const R=ro(e.id);if(!R)return;const N=O_(e),j=R.defaultLayoutDeferred?h2(N):R.layout,A=NF({group:e,nextGroupSize:T,prevGroupSize:R.groupSize,prevLayout:j}),D=el({layout:A,panelConstraints:N});if(!R.defaultLayoutDeferred&&Jo(R.layout,D)&&MF(R.derivedPanelConstraints,N)&&R.groupSize===T)return;ps(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:N,groupSize:T,layout:D,separatorToPanels:R.separatorToPanels})}}else TF(e,k,C)}});l.observe(e.element),e.panels.forEach(w=>{_t(!r.has(w.id),`Panel ids must be unique; id "${w.id}" was used more than once`),r.add(w.id),w.onResize&&l.observe(w.element)});const a=Ca({group:e}),u=O_(e),h=e.panels.map(({id:w})=>w).join(",");let d=e.mutableState.defaultLayout;d&&(AF(e.panels,d)||(d=void 0));const p=e.mutableState.layouts[h]??d??h2(u),m=el({layout:p,panelConstraints:u}),_=e.element.ownerDocument;na.set(_,(na.get(_)??0)+1);const y=new Map;return lN(e).forEach(w=>{w.separator&&y.set(w.separator,w.panels)}),ps(e,{defaultLayoutDeferred:a===0,derivedPanelConstraints:u,groupSize:a,layout:m,separatorToPanels:y}),e.separators.forEach(w=>{_t(!s.has(w.id),`Separator ids must be unique; id "${w.id}" was used more than once`),s.add(w.id),w.element.addEventListener("keydown",n2)}),na.get(_)===1&&(_.addEventListener("dblclick",t2,!0),_.addEventListener("pointerdown",r2,!0),_.addEventListener("pointerleave",a2),_.addEventListener("pointermove",c2),_.addEventListener("pointerout",u2),_.addEventListener("pointerup",d2,!0)),function(){t=!1,na.set(_,Math.max(0,(na.get(_)??0)-1)),pF(e),e.separators.forEach(w=>{w.element.removeEventListener("keydown",n2)}),na.get(_)||(_.removeEventListener("dblclick",t2,!0),_.removeEventListener("pointerdown",r2,!0),_.removeEventListener("pointerleave",a2),_.removeEventListener("pointermove",c2),_.removeEventListener("pointerout",u2),_.removeEventListener("pointerup",d2,!0)),l.disconnect()}}function OF(){const[e,t]=b.useState({}),n=b.useCallback(()=>t({}),[]);return[e,n]}function Xb(e){const t=b.useId();return`${e??t}`}const dl=typeof window<"u"?b.useLayoutEffect:b.useEffect;function vu(e){const t=b.useRef(e);return dl(()=>{t.current=e},[e]),b.useCallback((...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[t])}function Zb(...e){return vu(t=>{e.forEach(n=>{if(n)switch(typeof n){case"function":{n(t);break}case"object":{n.current=t;break}}})})}function Qb(e){const t=b.useRef({...e});return dl(()=>{for(const n in e)t.current[n]=e[n]},[e]),t.current}const _N=b.createContext(null);function LF(e,t){const n=b.useRef({getLayout:()=>({}),setLayout:EF});b.useImperativeHandle(t,()=>n.current,[]),dl(()=>{Object.assign(n.current,hN({groupId:e}))})}function yN({children:e,className:t,defaultLayout:n,disableCursor:r,disabled:s,elementRef:l,groupRef:a,id:u,onLayoutChange:h,onLayoutChanged:d,orientation:p="horizontal",resizeTargetMinimumSize:m={coarse:20,fine:10},style:_,...y}){const w=b.useRef({onLayoutChange:{},onLayoutChanged:{}}),S=vu(U=>{Jo(w.current.onLayoutChange,U)||(w.current.onLayoutChange=U,h==null||h(U))}),C=vu(U=>{Jo(w.current.onLayoutChanged,U)||(w.current.onLayoutChanged=U,d==null||d(U))}),k=Xb(u),T=b.useRef(null),[R,N]=OF(),j=b.useRef({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:m,separators:[]}),A=Zb(T,l);LF(k,a);const D=vu((U,H)=>{const F=tl(),q=ZC(U),$=ro(U);if($){let P=!1;switch(F.state){case"active":{P=F.hitRegions.some(V=>V.group===q);break}}return{flexGrow:$.layout[H]??1,pointerEvents:P?"none":void 0}}return{flexGrow:(n==null?void 0:n[H])??1}}),B=Qb({defaultLayout:n,disableCursor:r}),K=b.useMemo(()=>({get disableCursor(){return!!B.disableCursor},getPanelStyles:D,id:k,orientation:p,registerPanel:U=>{const H=j.current;return H.panels=L_(p,[...H.panels,U]),N(),()=>{H.panels=H.panels.filter(F=>F!==U),N()}},registerSeparator:U=>{const H=j.current;return H.separators=L_(p,[...H.separators,U]),N(),()=>{H.separators=H.separators.filter(F=>F!==U),N()}},togglePanelDisabled:(U,H)=>{const F=j.current.panels.find(P=>P.id===U);F&&(F.panelConstraints.disabled=H);const q=ZC(k),$=ro(k);q&&$&&ps(q,{...$,derivedPanelConstraints:O_(q)})},toggleSeparatorDisabled:(U,H)=>{const F=j.current.separators.find(q=>q.id===U);F&&(F.disabled=H)}}),[D,k,N,p,B]),z=b.useRef(null);return dl(()=>{const U=T.current;if(U===null)return;const H=j.current;let F;if(B.defaultLayout!==void 0&&Object.keys(B.defaultLayout).length===H.panels.length){F={};for(const M of H.panels){const I=B.defaultLayout[M.id];I!==void 0&&(F[M.id]=I)}}const q={disabled:!!s,element:U,id:k,mutableState:{defaultLayout:F,disableCursor:!!B.disableCursor,expandedPanelSizes:j.current.lastExpandedPanelSizes,layouts:j.current.layouts},orientation:p,panels:H.panels,resizeTargetMinimumSize:H.resizeTargetMinimumSize,separators:H.separators};z.current=q;const $=DF(q),{defaultLayoutDeferred:P,derivedPanelConstraints:V,layout:W}=ro(q.id,!0);!P&&V.length>0&&(S(W),C(W));const Z=qb(k,M=>{const{defaultLayoutDeferred:I,derivedPanelConstraints:X,layout:L}=M.next;if(I||X.length===0)return;const oe=q.panels.map(({id:se})=>se).join(",");q.mutableState.layouts[oe]=L,X.forEach(se=>{if(se.collapsible){const{layout:J}=M.prev??{};if(J){const re=$n(se.collapsedSize,L[se.panelId]),he=$n(se.collapsedSize,J[se.panelId]);re&&!he&&(q.mutableState.expandedPanelSizes[se.panelId]=J[se.panelId])}}});const ae=tl().state!=="active";S(L),ae&&C(L)});return()=>{z.current=null,$(),Z()}},[s,k,C,S,p,R,B]),b.useEffect(()=>{const U=z.current;U&&(U.mutableState.defaultLayout=n,U.mutableState.disableCursor=!!r)}),g.jsx(_N.Provider,{value:K,children:g.jsx("div",{...y,className:t,"data-group":!0,"data-testid":k,id:k,ref:A,style:{height:"100%",width:"100%",overflow:"hidden",..._,display:"flex",flexDirection:p==="horizontal"?"row":"column",flexWrap:"nowrap",touchAction:p==="horizontal"?"pan-y":"pan-x"},children:e})})}yN.displayName="Group";function Jb(){const e=b.useContext(_N);return _t(e,"Group Context not found; did you render a Panel or Separator outside of a Group?"),e}function jF(e,t){const{id:n}=Jb(),r=b.useRef({collapse:wv,expand:wv,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:wv});b.useImperativeHandle(t,()=>r.current,[]),dl(()=>{Object.assign(r.current,dN({groupId:n,panelId:e}))})}function bN({children:e,className:t,collapsedSize:n="0%",collapsible:r=!1,defaultSize:s,disabled:l,elementRef:a,groupResizeBehavior:u="preserve-relative-size",id:h,maxSize:d="100%",minSize:p="0%",onResize:m,panelRef:_,style:y,...w}){const S=!!h,C=Xb(h),k=Qb({disabled:l}),T=b.useRef(null),R=Zb(T,a),{getPanelStyles:N,id:j,orientation:A,registerPanel:D,togglePanelDisabled:B}=Jb(),K=m!==null,z=vu((H,F,q)=>{m==null||m(H,h,q)});dl(()=>{const H=T.current;if(H!==null){const F={element:H,id:C,idIsStable:S,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:K?z:void 0,panelConstraints:{groupResizeBehavior:u,collapsedSize:n,collapsible:r,defaultSize:s,disabled:k.disabled,maxSize:d,minSize:p}};return D(F)}},[u,n,r,s,K,C,S,d,p,z,D,k]),b.useEffect(()=>{B(C,!!l)},[l,C,B]),jF(C,_);const U=b.useSyncExternalStore(H=>qb(j,H),()=>JSON.stringify(N(j,C)),()=>JSON.stringify(N(j,C)));return g.jsx("div",{...w,"aria-disabled":l||void 0,"data-panel":!0,"data-testid":C,id:C,ref:R,style:{...zF,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...JSON.parse(U)},children:g.jsx("div",{className:t,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...y,touchAction:A==="horizontal"?"pan-y":"pan-x"},children:e})})}bN.displayName="Panel";const zF={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function PF({layout:e,panelConstraints:t,panelId:n,panelIndex:r}){let s,l;const a=e[n],u=t.find(h=>h.panelId===n);if(u){const h=u.maxSize,d=u.collapsible?u.collapsedSize:u.minSize,p=[r,r+1];l=el({layout:Ou({delta:d-a,initialLayout:e,panelConstraints:t,pivotIndices:p,prevLayout:e}),panelConstraints:t})[n],s=el({layout:Ou({delta:h-a,initialLayout:e,panelConstraints:t,pivotIndices:p,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:s,valueMin:l,valueNow:a}}function xN({children:e,className:t,disabled:n,elementRef:r,id:s,style:l,...a}){const u=Xb(s),h=Qb({disabled:n}),[d,p]=b.useState({}),[m,_]=b.useState("inactive"),y=b.useRef(null),w=Zb(y,r),{disableCursor:S,id:C,orientation:k,registerSeparator:T,toggleSeparatorDisabled:R}=Jb(),N=k==="horizontal"?"vertical":"horizontal";dl(()=>{const A=y.current;if(A!==null){const D={disabled:h.disabled,element:A,id:u},B=T(D),K=CF(U=>{_(U.next.state!=="inactive"&&U.next.hitRegions.some(H=>H.separator===D)?U.next.state:"inactive")}),z=qb(C,U=>{const{derivedPanelConstraints:H,layout:F,separatorToPanels:q}=U.next,$=q.get(D);if($){const P=$[0],V=$.indexOf(P);p(PF({layout:F,panelConstraints:H,panelId:P.id,panelIndex:V}))}});return()=>{K(),z(),B()}}},[C,u,T,h]),b.useEffect(()=>{R(u,!!n)},[n,u,R]);let j;return n&&!S&&(j="not-allowed"),g.jsx("div",{...a,"aria-controls":d.valueControls,"aria-disabled":n||void 0,"aria-orientation":N,"aria-valuemax":d.valueMax,"aria-valuemin":d.valueMin,"aria-valuenow":d.valueNow,children:e,className:t,"data-separator":n?"disabled":m,"data-testid":u,id:u,ref:w,role:"separator",style:{flexBasis:"auto",cursor:j,...l,flexGrow:0,flexShrink:0,touchAction:"none"},tabIndex:n?void 0:0})}xN.displayName="Separator";const sf=({className:e,...t})=>g.jsx(yN,{className:xe("flex h-full w-full",e),...t}),Fo=e=>g.jsx(bN,{...e}),of=({withHandle:e,orientation:t,disabled:n,className:r,...s})=>g.jsx(xN,{disabled:n,className:xe("relative flex items-center justify-center bg-transparent focus-visible:outline-none",t==="vertical"?"h-2 w-full -my-1 cursor-row-resize before:absolute before:inset-x-0 before:top-1/2 before:h-0.5 before:-translate-y-1/2 before:bg-border":"h-full w-2 -mx-1 cursor-col-resize before:absolute before:inset-y-0 before:left-1/2 before:w-px before:-translate-x-1/2 before:bg-border",r),...s,children:g.jsx("span",{className:"sr-only",children:t==="vertical"?"Resize rows":"Resize columns"})});/**
439
+ * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
440
+ * @license MIT
441
+ *
442
+ * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
443
+ * @license MIT
444
+ *
445
+ * Originally forked from (with the author's permission):
446
+ * Fabrice Bellard's javascript vt100 for jslinux:
447
+ * http://bellard.org/jslinux/
448
+ * Copyright (c) 2011 Fabrice Bellard
449
+ */var mn=0,gn=0,vn=0,Pt=0,Ln;(e=>{function t(s,l,a,u){return u!==void 0?`#${Po(s)}${Po(l)}${Po(a)}${Po(u)}`:`#${Po(s)}${Po(l)}${Po(a)}`}e.toCss=t;function n(s,l,a,u=255){return(s<<24|l<<16|a<<8|u)>>>0}e.toRgba=n;function r(s,l,a,u){return{css:e.toCss(s,l,a,u),rgba:e.toRgba(s,l,a,u)}}e.toColor=r})(Ln||(Ln={}));var BF;(e=>{function t(h,d){if(Pt=(d.rgba&255)/255,Pt===1)return{css:d.css,rgba:d.rgba};let p=d.rgba>>24&255,m=d.rgba>>16&255,_=d.rgba>>8&255,y=h.rgba>>24&255,w=h.rgba>>16&255,S=h.rgba>>8&255;mn=y+Math.round((p-y)*Pt),gn=w+Math.round((m-w)*Pt),vn=S+Math.round((_-S)*Pt);let C=Ln.toCss(mn,gn,vn),k=Ln.toRgba(mn,gn,vn);return{css:C,rgba:k}}e.blend=t;function n(h){return(h.rgba&255)===255}e.isOpaque=n;function r(h,d,p){let m=lf.ensureContrastRatio(h.rgba,d.rgba,p);if(m)return Ln.toColor(m>>24&255,m>>16&255,m>>8&255)}e.ensureContrastRatio=r;function s(h){let d=(h.rgba|255)>>>0;return[mn,gn,vn]=lf.toChannels(d),{css:Ln.toCss(mn,gn,vn),rgba:d}}e.opaque=s;function l(h,d){return Pt=Math.round(d*255),[mn,gn,vn]=lf.toChannels(h.rgba),{css:Ln.toCss(mn,gn,vn,Pt),rgba:Ln.toRgba(mn,gn,vn,Pt)}}e.opacity=l;function a(h,d){return Pt=h.rgba&255,l(h,Pt*d/255)}e.multiplyOpacity=a;function u(h){return[h.rgba>>24&255,h.rgba>>16&255,h.rgba>>8&255]}e.toColorRGB=u})(BF||(BF={}));var Tn;(e=>{let t,n;try{let s=document.createElement("canvas");s.width=1,s.height=1;let l=s.getContext("2d",{willReadFrequently:!0});l&&(t=l,t.globalCompositeOperation="copy",n=t.createLinearGradient(0,0,1,1))}catch{}function r(s){if(s.match(/#[\da-f]{3,8}/i))switch(s.length){case 4:return mn=parseInt(s.slice(1,2).repeat(2),16),gn=parseInt(s.slice(2,3).repeat(2),16),vn=parseInt(s.slice(3,4).repeat(2),16),Ln.toColor(mn,gn,vn);case 5:return mn=parseInt(s.slice(1,2).repeat(2),16),gn=parseInt(s.slice(2,3).repeat(2),16),vn=parseInt(s.slice(3,4).repeat(2),16),Pt=parseInt(s.slice(4,5).repeat(2),16),Ln.toColor(mn,gn,vn,Pt);case 7:return{css:s,rgba:(parseInt(s.slice(1),16)<<8|255)>>>0};case 9:return{css:s,rgba:parseInt(s.slice(1),16)>>>0}}let l=s.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(l)return mn=parseInt(l[1]),gn=parseInt(l[2]),vn=parseInt(l[3]),Pt=Math.round((l[5]===void 0?1:parseFloat(l[5]))*255),Ln.toColor(mn,gn,vn,Pt);if(!t||!n)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=n,t.fillStyle=s,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[mn,gn,vn,Pt]=t.getImageData(0,0,1,1).data,Pt!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Ln.toRgba(mn,gn,vn,Pt),css:s}}e.toColor=r})(Tn||(Tn={}));var Hn;(e=>{function t(r){return n(r>>16&255,r>>8&255,r&255)}e.relativeLuminance=t;function n(r,s,l){let a=r/255,u=s/255,h=l/255,d=a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4),p=u<=.03928?u/12.92:Math.pow((u+.055)/1.055,2.4),m=h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4);return d*.2126+p*.7152+m*.0722}e.relativeLuminance2=n})(Hn||(Hn={}));var lf;(e=>{function t(a,u){if(Pt=(u&255)/255,Pt===1)return u;let h=u>>24&255,d=u>>16&255,p=u>>8&255,m=a>>24&255,_=a>>16&255,y=a>>8&255;return mn=m+Math.round((h-m)*Pt),gn=_+Math.round((d-_)*Pt),vn=y+Math.round((p-y)*Pt),Ln.toRgba(mn,gn,vn)}e.blend=t;function n(a,u,h){let d=Hn.relativeLuminance(a>>8),p=Hn.relativeLuminance(u>>8);if(rs(d,p)<h){if(p<d){let y=r(a,u,h),w=rs(d,Hn.relativeLuminance(y>>8));if(w<h){let S=s(a,u,h),C=rs(d,Hn.relativeLuminance(S>>8));return w>C?y:S}return y}let m=s(a,u,h),_=rs(d,Hn.relativeLuminance(m>>8));if(_<h){let y=r(a,u,h),w=rs(d,Hn.relativeLuminance(y>>8));return _>w?m:y}return m}}e.ensureContrastRatio=n;function r(a,u,h){let d=a>>24&255,p=a>>16&255,m=a>>8&255,_=u>>24&255,y=u>>16&255,w=u>>8&255,S=rs(Hn.relativeLuminance2(_,y,w),Hn.relativeLuminance2(d,p,m));for(;S<h&&(_>0||y>0||w>0);)_-=Math.max(0,Math.ceil(_*.1)),y-=Math.max(0,Math.ceil(y*.1)),w-=Math.max(0,Math.ceil(w*.1)),S=rs(Hn.relativeLuminance2(_,y,w),Hn.relativeLuminance2(d,p,m));return(_<<24|y<<16|w<<8|255)>>>0}e.reduceLuminance=r;function s(a,u,h){let d=a>>24&255,p=a>>16&255,m=a>>8&255,_=u>>24&255,y=u>>16&255,w=u>>8&255,S=rs(Hn.relativeLuminance2(_,y,w),Hn.relativeLuminance2(d,p,m));for(;S<h&&(_<255||y<255||w<255);)_=Math.min(255,_+Math.ceil((255-_)*.1)),y=Math.min(255,y+Math.ceil((255-y)*.1)),w=Math.min(255,w+Math.ceil((255-w)*.1)),S=rs(Hn.relativeLuminance2(_,y,w),Hn.relativeLuminance2(d,p,m));return(_<<24|y<<16|w<<8|255)>>>0}e.increaseLuminance=s;function l(a){return[a>>24&255,a>>16&255,a>>8&255,a&255]}e.toChannels=l})(lf||(lf={}));function Po(e){let t=e.toString(16);return t.length<2?"0"+t:t}function rs(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var IF=Object.freeze((()=>{let e=[Tn.toColor("#2e3436"),Tn.toColor("#cc0000"),Tn.toColor("#4e9a06"),Tn.toColor("#c4a000"),Tn.toColor("#3465a4"),Tn.toColor("#75507b"),Tn.toColor("#06989a"),Tn.toColor("#d3d7cf"),Tn.toColor("#555753"),Tn.toColor("#ef2929"),Tn.toColor("#8ae234"),Tn.toColor("#fce94f"),Tn.toColor("#729fcf"),Tn.toColor("#ad7fa8"),Tn.toColor("#34e2e2"),Tn.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let r=t[n/36%6|0],s=t[n/6%6|0],l=t[n%6];e.push({css:Ln.toCss(r,s,l),rgba:Ln.toRgba(r,s,l)})}for(let n=0;n<24;n++){let r=8+n*10;e.push({css:Ln.toCss(r,r,r),rgba:Ln.toRgba(r,r,r)})}return e})());function f2(e,t,n){return Math.max(t,Math.min(e,n))}function HF(e){switch(e){case"&":return"&amp;";case"<":return"&lt;"}return e}var SN=class{constructor(t){this._buffer=t}serialize(t,n){let r=this._buffer.getNullCell(),s=this._buffer.getNullCell(),l=r,a=t.start.y,u=t.end.y,h=t.start.x,d=t.end.x;this._beforeSerialize(u-a,a,u);for(let p=a;p<=u;p++){let m=this._buffer.getLine(p);if(m){let _=p===t.start.y?h:0,y=p===t.end.y?d:m.length;for(let w=_;w<y;w++){let S=m.getCell(w,l===r?s:r);if(!S){console.warn(`Can't get cell at row=${p}, col=${w}`);continue}this._nextCell(S,l,p,w),l=S}}this._rowEnd(p,p===u)}return this._afterSerialize(),this._serializeString(n)}_nextCell(t,n,r,s){}_rowEnd(t,n){}_beforeSerialize(t,n,r){}_afterSerialize(){}_serializeString(t){return""}};function wN(e,t){return e.getFgColorMode()===t.getFgColorMode()&&e.getFgColor()===t.getFgColor()}function os(e,t){return e.getBgColorMode()===t.getBgColorMode()&&e.getBgColor()===t.getBgColor()}function CN(e,t){return e.isInverse()===t.isInverse()&&e.isBold()===t.isBold()&&e.isUnderline()===t.isUnderline()&&e.isOverline()===t.isOverline()&&e.isBlink()===t.isBlink()&&e.isInvisible()===t.isInvisible()&&e.isItalic()===t.isItalic()&&e.isDim()===t.isDim()&&e.isStrikethrough()===t.isStrikethrough()}var FF=class extends SN{constructor(t,n){super(t),this._terminal=n,this._rowIndex=0,this._allRows=new Array,this._allRowSeparators=new Array,this._currentRow="",this._nullCellCount=0,this._cursorStyle=this._buffer.getNullCell(),this._cursorStyleRow=0,this._cursorStyleCol=0,this._backgroundCell=this._buffer.getNullCell(),this._firstRow=0,this._lastCursorRow=0,this._lastCursorCol=0,this._lastContentCursorRow=0,this._lastContentCursorCol=0,this._thisRowLastChar=this._buffer.getNullCell(),this._thisRowLastSecondChar=this._buffer.getNullCell(),this._nextRowFirstChar=this._buffer.getNullCell()}_beforeSerialize(t,n,r){this._allRows=new Array(t),this._lastContentCursorRow=n,this._lastCursorRow=n,this._firstRow=n}_rowEnd(t,n){var s;this._nullCellCount>0&&!os(this._cursorStyle,this._backgroundCell)&&(this._currentRow+=`\x1B[${this._nullCellCount}X`);let r="";if(!n){t-this._firstRow>=this._terminal.rows&&((s=this._buffer.getLine(this._cursorStyleRow))==null||s.getCell(this._cursorStyleCol,this._backgroundCell));let l=this._buffer.getLine(t),a=this._buffer.getLine(t+1);if(!a.isWrapped)r=`\r
450
+ `,this._lastCursorRow=t+1,this._lastCursorCol=0;else{r="";let u=l.getCell(l.length-1,this._thisRowLastChar),h=l.getCell(l.length-2,this._thisRowLastSecondChar),d=a.getCell(0,this._nextRowFirstChar),p=d.getWidth()>1,m=!1;(d.getChars()&&p?this._nullCellCount<=1:this._nullCellCount<=0)&&((u.getChars()||u.getWidth()===0)&&os(u,d)&&(m=!0),p&&(h.getChars()||h.getWidth()===0)&&os(u,d)&&os(h,d)&&(m=!0)),m||(r="-".repeat(this._nullCellCount+1),r+="\x1B[1D\x1B[1X",this._nullCellCount>0&&(r+="\x1B[A",r+=`\x1B[${l.length-this._nullCellCount}C`,r+=`\x1B[${this._nullCellCount}X`,r+=`\x1B[${l.length-this._nullCellCount}D`,r+="\x1B[B"),this._lastContentCursorRow=t+1,this._lastContentCursorCol=0,this._lastCursorRow=t+1,this._lastCursorCol=0)}}this._allRows[this._rowIndex]=this._currentRow,this._allRowSeparators[this._rowIndex++]=r,this._currentRow="",this._nullCellCount=0}_diffStyle(t,n){let r=[],s=!wN(t,n),l=!os(t,n),a=!CN(t,n);if(s||l||a)if(t.isAttributeDefault())n.isAttributeDefault()||r.push(0);else{if(s){let u=t.getFgColor();t.isFgRGB()?r.push(38,2,u>>>16&255,u>>>8&255,u&255):t.isFgPalette()?u>=16?r.push(38,5,u):r.push(u&8?90+(u&7):30+(u&7)):r.push(39)}if(l){let u=t.getBgColor();t.isBgRGB()?r.push(48,2,u>>>16&255,u>>>8&255,u&255):t.isBgPalette()?u>=16?r.push(48,5,u):r.push(u&8?100+(u&7):40+(u&7)):r.push(49)}a&&(t.isInverse()!==n.isInverse()&&r.push(t.isInverse()?7:27),t.isBold()!==n.isBold()&&r.push(t.isBold()?1:22),t.isUnderline()!==n.isUnderline()&&r.push(t.isUnderline()?4:24),t.isOverline()!==n.isOverline()&&r.push(t.isOverline()?53:55),t.isBlink()!==n.isBlink()&&r.push(t.isBlink()?5:25),t.isInvisible()!==n.isInvisible()&&r.push(t.isInvisible()?8:28),t.isItalic()!==n.isItalic()&&r.push(t.isItalic()?3:23),t.isDim()!==n.isDim()&&r.push(t.isDim()?2:22),t.isStrikethrough()!==n.isStrikethrough()&&r.push(t.isStrikethrough()?9:29))}return r}_nextCell(t,n,r,s){if(t.getWidth()===0)return;let l=t.getChars()==="",a=this._diffStyle(t,this._cursorStyle);if(l?!os(this._cursorStyle,t):a.length>0){this._nullCellCount>0&&(os(this._cursorStyle,this._backgroundCell)||(this._currentRow+=`\x1B[${this._nullCellCount}X`),this._currentRow+=`\x1B[${this._nullCellCount}C`,this._nullCellCount=0),this._lastContentCursorRow=this._lastCursorRow=r,this._lastContentCursorCol=this._lastCursorCol=s,this._currentRow+=`\x1B[${a.join(";")}m`;let u=this._buffer.getLine(r);u!==void 0&&(u.getCell(s,this._cursorStyle),this._cursorStyleRow=r,this._cursorStyleCol=s)}l?this._nullCellCount+=t.getWidth():(this._nullCellCount>0&&(os(this._cursorStyle,this._backgroundCell)?this._currentRow+=`\x1B[${this._nullCellCount}C`:(this._currentRow+=`\x1B[${this._nullCellCount}X`,this._currentRow+=`\x1B[${this._nullCellCount}C`),this._nullCellCount=0),this._currentRow+=t.getChars(),this._lastContentCursorRow=this._lastCursorRow=r,this._lastContentCursorCol=this._lastCursorCol=s+t.getWidth())}_serializeString(t){let n=this._allRows.length;this._buffer.length-this._firstRow<=this._terminal.rows&&(n=this._lastContentCursorRow+1-this._firstRow,this._lastCursorCol=this._lastContentCursorCol,this._lastCursorRow=this._lastContentCursorRow);let r="";for(let a=0;a<n;a++)r+=this._allRows[a],a+1<n&&(r+=this._allRowSeparators[a]);if(!t){let a=this._buffer.baseY+this._buffer.cursorY,u=this._buffer.cursorX,h=a!==this._lastCursorRow||u!==this._lastCursorCol,d=p=>{p>0?r+=`\x1B[${p}C`:p<0&&(r+=`\x1B[${-p}D`)};h&&((p=>{p>0?r+=`\x1B[${p}B`:p<0&&(r+=`\x1B[${-p}A`)})(a-this._lastCursorRow),d(u-this._lastCursorCol))}let s=this._terminal._core._inputHandler._curAttrData,l=this._diffStyle(s,this._cursorStyle);return l.length>0&&(r+=`\x1B[${l.join(";")}m`),r}},UF=class{activate(t){this._terminal=t}_serializeBufferByScrollback(t,n,r){let s=n.length,l=r===void 0?s:f2(r+t.rows,0,s);return this._serializeBufferByRange(t,n,{start:s-l,end:s-1},!1)}_serializeBufferByRange(t,n,r,s){return new FF(n,t).serialize({start:{x:0,y:typeof r.start=="number"?r.start:r.start.line},end:{x:t.cols,y:typeof r.end=="number"?r.end:r.end.line}},s)}_serializeBufferAsHTML(t,n){var h;let r=t.buffer.active,s=new $F(r,t,n),l=n.onlySelection??!1,a=n.range;if(a)return s.serialize({start:{x:a.startCol,y:(a.startLine,a.startLine)},end:{x:t.cols,y:(a.endLine,a.endLine)}});if(!l){let d=r.length,p=n.scrollback,m=p===void 0?d:f2(p+t.rows,0,d);return s.serialize({start:{x:0,y:d-m},end:{x:t.cols,y:d-1}})}let u=(h=this._terminal)==null?void 0:h.getSelectionPosition();return u!==void 0?s.serialize({start:{x:u.start.x,y:u.start.y},end:{x:u.end.x,y:u.end.y}}):""}_serializeModes(t){let n="",r=t.modes;if(r.applicationCursorKeysMode&&(n+="\x1B[?1h"),r.applicationKeypadMode&&(n+="\x1B[?66h"),r.bracketedPasteMode&&(n+="\x1B[?2004h"),r.insertMode&&(n+="\x1B[4h"),r.originMode&&(n+="\x1B[?6h"),r.reverseWraparoundMode&&(n+="\x1B[?45h"),r.sendFocusMode&&(n+="\x1B[?1004h"),r.wraparoundMode===!1&&(n+="\x1B[?7l"),r.mouseTrackingMode!=="none")switch(r.mouseTrackingMode){case"x10":n+="\x1B[?9h";break;case"vt200":n+="\x1B[?1000h";break;case"drag":n+="\x1B[?1002h";break;case"any":n+="\x1B[?1003h";break}return n}serialize(t){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");let n=t!=null&&t.range?this._serializeBufferByRange(this._terminal,this._terminal.buffer.normal,t.range,!0):this._serializeBufferByScrollback(this._terminal,this._terminal.buffer.normal,t==null?void 0:t.scrollback);if(!(t!=null&&t.excludeAltBuffer)&&this._terminal.buffer.active.type==="alternate"){let r=this._serializeBufferByScrollback(this._terminal,this._terminal.buffer.alternate,void 0);n+=`\x1B[?1049h\x1B[H${r}`}return t!=null&&t.excludeModes||(n+=this._serializeModes(this._terminal)),n}serializeAsHTML(t){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");return this._serializeBufferAsHTML(this._terminal,t||{})}dispose(){}},$F=class extends SN{constructor(t,n,r){super(t),this._terminal=n,this._options=r,this._currentRow="",this._htmlContent="",n._core._themeService?this._ansiColors=n._core._themeService.colors.ansi:this._ansiColors=IF}_padStart(t,n,r){return n=n>>0,r=r??" ",t.length>n?t:(n-=t.length,n>r.length&&(r+=r.repeat(n/r.length)),r.slice(0,n)+t)}_beforeSerialize(t,n,r){var u,h;this._htmlContent+="<html><body><!--StartFragment--><pre>";let s="#000000",l="#ffffff";(this._options.includeGlobalBackground??!1)&&(s=((u=this._terminal.options.theme)==null?void 0:u.foreground)??"#ffffff",l=((h=this._terminal.options.theme)==null?void 0:h.background)??"#000000");let a=[];a.push("color: "+s+";"),a.push("background-color: "+l+";"),a.push("font-family: "+this._terminal.options.fontFamily+";"),a.push("font-size: "+this._terminal.options.fontSize+"px;"),this._htmlContent+="<div style='"+a.join(" ")+"'>"}_afterSerialize(){this._htmlContent+="</div>",this._htmlContent+="</pre><!--EndFragment--></body></html>"}_rowEnd(t,n){this._htmlContent+="<div><span>"+this._currentRow+"</span></div>",this._currentRow=""}_getHexColor(t,n){let r=n?t.getFgColor():t.getBgColor();if(n?t.isFgRGB():t.isBgRGB())return"#"+[r>>16&255,r>>8&255,r&255].map(s=>this._padStart(s.toString(16),2,"0")).join("");if(n?t.isFgPalette():t.isBgPalette())return this._ansiColors[r].css}_diffStyle(t,n){let r=[],s=!wN(t,n),l=!os(t,n),a=!CN(t,n);if(s||l||a){let u=this._getHexColor(t,!0);u&&r.push("color: "+u+";");let h=this._getHexColor(t,!1);return h&&r.push("background-color: "+h+";"),t.isInverse()&&r.push("color: #000000; background-color: #BFBFBF;"),t.isBold()&&r.push("font-weight: bold;"),t.isUnderline()&&t.isOverline()?r.push("text-decoration: overline underline;"):t.isUnderline()?r.push("text-decoration: underline;"):t.isOverline()&&r.push("text-decoration: overline;"),t.isBlink()&&r.push("text-decoration: blink;"),t.isInvisible()&&r.push("visibility: hidden;"),t.isItalic()&&r.push("font-style: italic;"),t.isDim()&&r.push("opacity: 0.5;"),t.isStrikethrough()&&r.push("text-decoration: line-through;"),r}}_nextCell(t,n,r,s){if(t.getWidth()===0)return;let l=t.getChars()==="",a=this._diffStyle(t,n);a&&(this._currentRow+=a.length===0?"</span><span>":"</span><span style='"+a.join(" ")+"'>"),l?this._currentRow+=" ":this._currentRow+=HF(t.getChars())}_serializeString(){return this._htmlContent}};/**
451
+ * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
452
+ * @license MIT
453
+ *
454
+ * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
455
+ * @license MIT
456
+ *
457
+ * Originally forked from (with the author's permission):
458
+ * Fabrice Bellard's javascript vt100 for jslinux:
459
+ * http://bellard.org/jslinux/
460
+ * Copyright (c) 2011 Fabrice Bellard
461
+ */var WF=class{constructor(t,n,r,s={}){this._terminal=t,this._regex=n,this._handler=r,this._options=s}provideLinks(t,n){let r=qF.computeLink(t,this._regex,this._terminal,this._handler);n(this._addCallbacks(r))}_addCallbacks(t){return t.map(n=>(n.leave=this._options.leave,n.hover=(r,s)=>{if(this._options.hover){let{range:l}=n;this._options.hover(r,s,l)}},n))}};function VF(e){try{let t=new URL(e),n=t.password&&t.username?`${t.protocol}//${t.username}:${t.password}@${t.host}`:t.username?`${t.protocol}//${t.username}@${t.host}`:`${t.protocol}//${t.host}`;return e.toLocaleLowerCase().startsWith(n.toLocaleLowerCase())}catch{return!1}}var qF=class af{static computeLink(t,n,r,s){let l=new RegExp(n.source,(n.flags||"")+"g"),[a,u]=af._getWindowedLineStrings(t-1,r),h=a.join(""),d,p=[];for(;d=l.exec(h);){let m=d[0];if(!VF(m))continue;let[_,y]=af._mapStrIdx(r,u,0,d.index),[w,S]=af._mapStrIdx(r,_,y,m.length);if(_===-1||y===-1||w===-1||S===-1)continue;let C={start:{x:y+1,y:_+1},end:{x:S,y:w+1}};p.push({range:C,text:m,activate:s})}return p}static _getWindowedLineStrings(t,n){let r,s=t,l=t,a=0,u="",h=[];if(r=n.buffer.active.getLine(t)){let d=r.translateToString(!0);if(r.isWrapped&&d[0]!==" "){for(a=0;(r=n.buffer.active.getLine(--s))&&a<2048&&(u=r.translateToString(!0),a+=u.length,h.push(u),!(!r.isWrapped||u.indexOf(" ")!==-1)););h.reverse()}for(h.push(d),a=0;(r=n.buffer.active.getLine(++l))&&r.isWrapped&&a<2048&&(u=r.translateToString(!0),a+=u.length,h.push(u),u.indexOf(" ")===-1););}return[h,s]}static _mapStrIdx(t,n,r,s){let l=t.buffer.active,a=l.getNullCell(),u=r;for(;s;){let h=l.getLine(n);if(!h)return[-1,-1];for(let d=u;d<h.length;++d){h.getCell(d,a);let p=a.getChars();if(a.getWidth()&&(s-=p.length||1,d===h.length-1&&p==="")){let m=l.getLine(n+1);m&&m.isWrapped&&(m.getCell(0,a),a.getWidth()===2&&(s+=1))}if(s<0)return[n,d]}n++,u=0}return[n,u]}},KF=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function GF(e,t){let n=window.open();if(n){try{n.opener=null}catch{}n.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}var YF=class{constructor(t=GF,n={}){this._handler=t,this._options=n}activate(t){this._terminal=t;let n=this._options,r=n.urlRegex||KF;this._linkProvider=this._terminal.registerLinkProvider(new WF(this._terminal,r,this._handler,n))}dispose(){var t;(t=this._linkProvider)==null||t.dispose()}};/**
462
+ * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
463
+ * @license MIT
464
+ *
465
+ * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
466
+ * @license MIT
467
+ *
468
+ * Originally forked from (with the author's permission):
469
+ * Fabrice Bellard's javascript vt100 for jslinux:
470
+ * http://bellard.org/jslinux/
471
+ * Copyright (c) 2011 Fabrice Bellard
472
+ */var kN=Object.defineProperty,XF=Object.getOwnPropertyDescriptor,ZF=(e,t)=>{for(var n in t)kN(e,n,{get:t[n],enumerable:!0})},It=(e,t,n,r)=>{for(var s=r>1?void 0:r?XF(t,n):t,l=e.length-1,a;l>=0;l--)(a=e[l])&&(s=(r?a(t,n,s):a(s))||s);return r&&s&&kN(t,n,s),s},ke=(e,t)=>(n,r)=>t(n,r,e),p2="Terminal input",j_={get:()=>p2,set:e=>p2=e},m2="Too much output to announce, navigate to rows manually to read",z_={get:()=>m2,set:e=>m2=e};function QF(e){return e.replace(/\r?\n/g,"\r")}function JF(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function eU(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function tU(e,t,n,r){if(e.stopPropagation(),e.clipboardData){let s=e.clipboardData.getData("text/plain");EN(s,t,n,r)}}function EN(e,t,n,r){e=QF(e),e=JF(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=""}function RN(e,t,n){let r=n.getBoundingClientRect(),s=e.clientX-r.left-10,l=e.clientY-r.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${s}px`,t.style.top=`${l}px`,t.style.zIndex="1000",t.focus()}function g2(e,t,n,r,s){RN(e,t,n),s&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function Js(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function Ep(e,t=0,n=e.length){let r="";for(let s=t;s<n;++s){let l=e[s];l>65535?(l-=65536,r+=String.fromCharCode((l>>10)+55296)+String.fromCharCode(l%1024+56320)):r+=String.fromCharCode(l)}return r}var nU=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,s=0;if(this._interim){let l=e.charCodeAt(s++);56320<=l&&l<=57343?t[r++]=(this._interim-55296)*1024+l-56320+65536:(t[r++]=this._interim,t[r++]=l),this._interim=0}for(let l=s;l<n;++l){let a=e.charCodeAt(l);if(55296<=a&&a<=56319){if(++l>=n)return this._interim=a,r;let u=e.charCodeAt(l);56320<=u&&u<=57343?t[r++]=(a-55296)*1024+u-56320+65536:(t[r++]=a,t[r++]=u);continue}a!==65279&&(t[r++]=a)}return r}},rU=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r=0,s,l,a,u,h=0,d=0;if(this.interim[0]){let _=!1,y=this.interim[0];y&=(y&224)===192?31:(y&240)===224?15:7;let w=0,S;for(;(S=this.interim[++w]&63)&&w<4;)y<<=6,y|=S;let C=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,k=C-w;for(;d<k;){if(d>=n)return 0;if(S=e[d++],(S&192)!==128){d--,_=!0;break}else this.interim[w++]=S,y<<=6,y|=S&63}_||(C===2?y<128?d--:t[r++]=y:C===3?y<2048||y>=55296&&y<=57343||y===65279||(t[r++]=y):y<65536||y>1114111||(t[r++]=y)),this.interim.fill(0)}let p=n-4,m=d;for(;m<n;){for(;m<p&&!((s=e[m])&128)&&!((l=e[m+1])&128)&&!((a=e[m+2])&128)&&!((u=e[m+3])&128);)t[r++]=s,t[r++]=l,t[r++]=a,t[r++]=u,m+=4;if(s=e[m++],s<128)t[r++]=s;else if((s&224)===192){if(m>=n)return this.interim[0]=s,r;if(l=e[m++],(l&192)!==128){m--;continue}if(h=(s&31)<<6|l&63,h<128){m--;continue}t[r++]=h}else if((s&240)===224){if(m>=n)return this.interim[0]=s,r;if(l=e[m++],(l&192)!==128){m--;continue}if(m>=n)return this.interim[0]=s,this.interim[1]=l,r;if(a=e[m++],(a&192)!==128){m--;continue}if(h=(s&15)<<12|(l&63)<<6|a&63,h<2048||h>=55296&&h<=57343||h===65279)continue;t[r++]=h}else if((s&248)===240){if(m>=n)return this.interim[0]=s,r;if(l=e[m++],(l&192)!==128){m--;continue}if(m>=n)return this.interim[0]=s,this.interim[1]=l,r;if(a=e[m++],(a&192)!==128){m--;continue}if(m>=n)return this.interim[0]=s,this.interim[1]=l,this.interim[2]=a,r;if(u=e[m++],(u&192)!==128){m--;continue}if(h=(s&7)<<18|(l&63)<<12|(a&63)<<6|u&63,h<65536||h>1114111)continue;t[r++]=h}}return r}},TN="",no=" ",Ju=class MN{constructor(){this.fg=0,this.bg=0,this.extended=new If}static toColorRGB(t){return[t>>>16&255,t>>>8&255,t&255]}static fromColorRGB(t){return(t[0]&255)<<16|(t[1]&255)<<8|t[2]&255}clone(){let t=new MN;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},If=class NN{constructor(t=0,n=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=n}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new NN(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Kr=class AN extends Ju{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new If,this.combinedData=""}static fromCharData(t){let n=new AN;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?Js(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let n=!1;if(t[1].length>2)n=!0;else if(t[1].length===2){let r=t[1].charCodeAt(0);if(55296<=r&&r<=56319){let s=t[1].charCodeAt(1);56320<=s&&s<=57343?this.content=(r-55296)*1024+s-56320+65536|t[2]<<22:n=!0}else n=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;n&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},v2="di$target",P_="di$dependencies",Cv=new Map;function iU(e){return e[P_]||[]}function xn(e){if(Cv.has(e))return Cv.get(e);let t=function(n,r,s){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");sU(t,n,s)};return t._id=e,Cv.set(e,t),t}function sU(e,t,n){t[v2]===t?t[P_].push({id:e,index:n}):(t[P_]=[{id:e,index:n}],t[v2]=t)}var qn=xn("BufferService"),DN=xn("CoreMouseService"),hl=xn("CoreService"),oU=xn("CharsetService"),e0=xn("InstantiationService"),ON=xn("LogService"),Kn=xn("OptionsService"),LN=xn("OscLinkService"),lU=xn("UnicodeService"),ed=xn("DecorationService"),B_=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){var p;let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let r=[],s=this._optionsService.rawOptions.linkHandler,l=new Kr,a=n.getTrimmedLength(),u=-1,h=-1,d=!1;for(let m=0;m<a;m++)if(!(h===-1&&!n.hasContent(m))){if(n.loadCell(m,l),l.hasExtendedAttrs()&&l.extended.urlId)if(h===-1){h=m,u=l.extended.urlId;continue}else d=l.extended.urlId!==u;else h!==-1&&(d=!0);if(d||h!==-1&&m===a-1){let _=(p=this._oscLinkService.getLinkData(u))==null?void 0:p.uri;if(_){let y={start:{x:h+1,y:e},end:{x:m+(!d&&m===a-1?1:0),y:e}},w=!1;if(!(s!=null&&s.allowNonHttpProtocols))try{let S=new URL(_);["http:","https:"].includes(S.protocol)||(w=!0)}catch{w=!0}w||r.push({text:_,range:y,activate:(S,C)=>s?s.activate(S,C,y):aU(S,C),hover:(S,C)=>{var k;return(k=s==null?void 0:s.hover)==null?void 0:k.call(s,S,C,y)},leave:(S,C)=>{var k;return(k=s==null?void 0:s.leave)==null?void 0:k.call(s,S,C,y)}})}d=!1,l.hasExtendedAttrs()&&l.extended.urlId?(h=m,u=l.extended.urlId):(h=-1,u=-1)}}t(r)}};B_=It([ke(0,qn),ke(1,Kn),ke(2,LN)],B_);function aU(e,t){if(confirm(`Do you want to navigate to ${t}?
473
+
474
+ WARNING: This link could potentially be dangerous`)){let n=window.open();if(n){try{n.opener=null}catch{}n.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}var Rp=xn("CharSizeService"),vs=xn("CoreBrowserService"),t0=xn("MouseService"),_s=xn("RenderService"),cU=xn("SelectionService"),jN=xn("CharacterJoinerService"),Fa=xn("ThemeService"),zN=xn("LinkProviderService"),uU=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?_2.isErrorNoTelemetry(e)?new _2(e.message+`
475
+
476
+ `+e.stack):new Error(e.message+`
477
+
478
+ `+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}},dU=new uU;function cf(e){hU(e)||dU.onUnexpectedError(e)}var I_="Canceled";function hU(e){return e instanceof fU?!0:e instanceof Error&&e.name===I_&&e.message===I_}var fU=class extends Error{constructor(){super(I_),this.name=this.message}};function pU(e){return new Error(`Illegal argument: ${e}`)}var _2=class H_ extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof H_)return t;let n=new H_;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},F_=class PN extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,PN.prototype)}};function yr(e,t=0){return e[e.length-(1+t)]}var mU;(e=>{function t(l){return l<0}e.isLessThan=t;function n(l){return l<=0}e.isLessThanOrEqual=n;function r(l){return l>0}e.isGreaterThan=r;function s(l){return l===0}e.isNeitherLessOrGreaterThan=s,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(mU||(mU={}));function gU(e,t){let n=this,r=!1,s;return function(){return r||(r=!0,t||(s=e.apply(n,arguments))),s}}var BN;(e=>{function t(N){return N&&typeof N=="object"&&typeof N[Symbol.iterator]=="function"}e.is=t;let n=Object.freeze([]);function r(){return n}e.empty=r;function*s(N){yield N}e.single=s;function l(N){return t(N)?N:s(N)}e.wrap=l;function a(N){return N||n}e.from=a;function*u(N){for(let j=N.length-1;j>=0;j--)yield N[j]}e.reverse=u;function h(N){return!N||N[Symbol.iterator]().next().done===!0}e.isEmpty=h;function d(N){return N[Symbol.iterator]().next().value}e.first=d;function p(N,j){let A=0;for(let D of N)if(j(D,A++))return!0;return!1}e.some=p;function m(N,j){for(let A of N)if(j(A))return A}e.find=m;function*_(N,j){for(let A of N)j(A)&&(yield A)}e.filter=_;function*y(N,j){let A=0;for(let D of N)yield j(D,A++)}e.map=y;function*w(N,j){let A=0;for(let D of N)yield*j(D,A++)}e.flatMap=w;function*S(...N){for(let j of N)yield*j}e.concat=S;function C(N,j,A){let D=A;for(let B of N)D=j(D,B);return D}e.reduce=C;function*k(N,j,A=N.length){for(j<0&&(j+=N.length),A<0?A+=N.length:A>N.length&&(A=N.length);j<A;j++)yield N[j]}e.slice=k;function T(N,j=Number.POSITIVE_INFINITY){let A=[];if(j===0)return[A,N];let D=N[Symbol.iterator]();for(let B=0;B<j;B++){let K=D.next();if(K.done)return[A,e.empty()];A.push(K.value)}return[A,{[Symbol.iterator](){return D}}]}e.consume=T;async function R(N){let j=[];for await(let A of N)j.push(A);return Promise.resolve(j)}e.asyncToArray=R})(BN||(BN={}));function nl(e){if(BN.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(r){t.push(r)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function vU(...e){return Dt(()=>nl(e))}function Dt(e){return{dispose:gU(()=>{e()})}}var IN=class HN{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{nl(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?HN.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(t),t}delete(t){if(t){if(t===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(t),t.dispose()}}deleteAndLeak(t){t&&this._toDispose.has(t)&&(this._toDispose.delete(t),void 0)}};IN.DISABLE_DISPOSED_WARNING=!1;var io=IN,Ke=class{constructor(){this._store=new io,this._store}dispose(){this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};Ke.None=Object.freeze({dispose(){}});var ka=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){var t;this._isDisposed||e===this._value||((t=this._value)==null||t.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){var e;this._isDisposed=!0,(e=this._value)==null||e.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e}},as=typeof window=="object"?window:globalThis,U_=class $_{constructor(t){this.element=t,this.next=$_.Undefined,this.prev=$_.Undefined}};U_.Undefined=new U_(void 0);var Ot=U_,y2=class{constructor(){this._first=Ot.Undefined,this._last=Ot.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===Ot.Undefined}clear(){let e=this._first;for(;e!==Ot.Undefined;){let t=e.next;e.prev=Ot.Undefined,e.next=Ot.Undefined,e=t}this._first=Ot.Undefined,this._last=Ot.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let n=new Ot(e);if(this._first===Ot.Undefined)this._first=n,this._last=n;else if(t){let s=this._last;this._last=n,n.prev=s,s.next=n}else{let s=this._first;this._first=n,n.next=s,s.prev=n}this._size+=1;let r=!1;return()=>{r||(r=!0,this._remove(n))}}shift(){if(this._first!==Ot.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==Ot.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==Ot.Undefined&&e.next!==Ot.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===Ot.Undefined&&e.next===Ot.Undefined?(this._first=Ot.Undefined,this._last=Ot.Undefined):e.next===Ot.Undefined?(this._last=this._last.prev,this._last.next=Ot.Undefined):e.prev===Ot.Undefined&&(this._first=this._first.next,this._first.prev=Ot.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==Ot.Undefined;)yield e.element,e=e.next}},_U=globalThis.performance&&typeof globalThis.performance.now=="function",yU=class FN{static create(t){return new FN(t)}constructor(t){this._now=_U&&t===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},Nn;(e=>{e.None=()=>Ke.None;function t(H,F){return m(H,()=>{},0,void 0,!0,void 0,F)}e.defer=t;function n(H){return(F,q=null,$)=>{let P=!1,V;return V=H(W=>{if(!P)return V?V.dispose():P=!0,F.call(q,W)},null,$),P&&V.dispose(),V}}e.once=n;function r(H,F,q){return d(($,P=null,V)=>H(W=>$.call(P,F(W)),null,V),q)}e.map=r;function s(H,F,q){return d(($,P=null,V)=>H(W=>{F(W),$.call(P,W)},null,V),q)}e.forEach=s;function l(H,F,q){return d(($,P=null,V)=>H(W=>F(W)&&$.call(P,W),null,V),q)}e.filter=l;function a(H){return H}e.signal=a;function u(...H){return(F,q=null,$)=>{let P=vU(...H.map(V=>V(W=>F.call(q,W))));return p(P,$)}}e.any=u;function h(H,F,q,$){let P=q;return r(H,V=>(P=F(P,V),P),$)}e.reduce=h;function d(H,F){let q,$={onWillAddFirstListener(){q=H(P.fire,P)},onDidRemoveLastListener(){q==null||q.dispose()}},P=new we($);return F==null||F.add(P),P.event}function p(H,F){return F instanceof Array?F.push(H):F&&F.add(H),H}function m(H,F,q=100,$=!1,P=!1,V,W){let Z,M,I,X=0,L,oe={leakWarningThreshold:V,onWillAddFirstListener(){Z=H(se=>{X++,M=F(M,se),$&&!I&&(ae.fire(M),M=void 0),L=()=>{let J=M;M=void 0,I=void 0,(!$||X>1)&&ae.fire(J),X=0},typeof q=="number"?(clearTimeout(I),I=setTimeout(L,q)):I===void 0&&(I=0,queueMicrotask(L))})},onWillRemoveListener(){P&&X>0&&(L==null||L())},onDidRemoveLastListener(){L=void 0,Z.dispose()}},ae=new we(oe);return W==null||W.add(ae),ae.event}e.debounce=m;function _(H,F=0,q){return e.debounce(H,($,P)=>$?($.push(P),$):[P],F,void 0,!0,void 0,q)}e.accumulate=_;function y(H,F=($,P)=>$===P,q){let $=!0,P;return l(H,V=>{let W=$||!F(V,P);return $=!1,P=V,W},q)}e.latch=y;function w(H,F,q){return[e.filter(H,F,q),e.filter(H,$=>!F($),q)]}e.split=w;function S(H,F=!1,q=[],$){let P=q.slice(),V=H(M=>{P?P.push(M):Z.fire(M)});$&&$.add(V);let W=()=>{P==null||P.forEach(M=>Z.fire(M)),P=null},Z=new we({onWillAddFirstListener(){V||(V=H(M=>Z.fire(M)),$&&$.add(V))},onDidAddFirstListener(){P&&(F?setTimeout(W):W())},onDidRemoveLastListener(){V&&V.dispose(),V=null}});return $&&$.add(Z),Z.event}e.buffer=S;function C(H,F){return(q,$,P)=>{let V=F(new T);return H(function(W){let Z=V.evaluate(W);Z!==k&&q.call($,Z)},void 0,P)}}e.chain=C;let k=Symbol("HaltChainable");class T{constructor(){this.steps=[]}map(F){return this.steps.push(F),this}forEach(F){return this.steps.push(q=>(F(q),q)),this}filter(F){return this.steps.push(q=>F(q)?q:k),this}reduce(F,q){let $=q;return this.steps.push(P=>($=F($,P),$)),this}latch(F=(q,$)=>q===$){let q=!0,$;return this.steps.push(P=>{let V=q||!F(P,$);return q=!1,$=P,V?P:k}),this}evaluate(F){for(let q of this.steps)if(F=q(F),F===k)break;return F}}function R(H,F,q=$=>$){let $=(...Z)=>W.fire(q(...Z)),P=()=>H.on(F,$),V=()=>H.removeListener(F,$),W=new we({onWillAddFirstListener:P,onDidRemoveLastListener:V});return W.event}e.fromNodeEventEmitter=R;function N(H,F,q=$=>$){let $=(...Z)=>W.fire(q(...Z)),P=()=>H.addEventListener(F,$),V=()=>H.removeEventListener(F,$),W=new we({onWillAddFirstListener:P,onDidRemoveLastListener:V});return W.event}e.fromDOMEventEmitter=N;function j(H){return new Promise(F=>n(H)(F))}e.toPromise=j;function A(H){let F=new we;return H.then(q=>{F.fire(q)},()=>{F.fire(void 0)}).finally(()=>{F.dispose()}),F.event}e.fromPromise=A;function D(H,F){return H(q=>F.fire(q))}e.forward=D;function B(H,F,q){return F(q),H($=>F($))}e.runAndSubscribe=B;class K{constructor(F,q){this._observable=F,this._counter=0,this._hasChanged=!1;let $={onWillAddFirstListener:()=>{F.addObserver(this)},onDidRemoveLastListener:()=>{F.removeObserver(this)}};this.emitter=new we($),q&&q.add(this.emitter)}beginUpdate(F){this._counter++}handlePossibleChange(F){}handleChange(F,q){this._hasChanged=!0}endUpdate(F){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function z(H,F){return new K(H,F).emitter.event}e.fromObservable=z;function U(H){return(F,q,$)=>{let P=0,V=!1,W={beginUpdate(){P++},endUpdate(){P--,P===0&&(H.reportChanges(),V&&(V=!1,F.call(q)))},handlePossibleChange(){},handleChange(){V=!0}};H.addObserver(W),H.reportChanges();let Z={dispose(){H.removeObserver(W)}};return $ instanceof io?$.add(Z):Array.isArray($)&&$.push(Z),Z}}e.fromObservableLight=U})(Nn||(Nn={}));var W_=class V_{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${V_._idPool++}`,V_.all.add(this)}start(t){this._stopWatch=new yU,this.listenerCount=t}stop(){if(this._stopWatch){let t=this._stopWatch.elapsed();this.durations.push(t),this.elapsedOverall+=t,this.invocationCount+=1,this._stopWatch=void 0}}};W_.all=new Set,W_._idPool=0;var bU=W_,xU=-1,UN=class $N{constructor(t,n,r=($N._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=n,this.name=r,this._warnCountdown=0}dispose(){var t;(t=this._stacks)==null||t.clear()}check(t,n){let r=this.threshold;if(r<=0||n<r)return;this._stacks||(this._stacks=new Map);let s=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,s+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=r*.5;let[l,a]=this.getMostFrequentStack(),u=`[${this.name}] potential listener LEAK detected, having ${n} listeners already. MOST frequent listener (${a}):`;console.warn(u),console.warn(l);let h=new CU(u,l);this._errorHandler(h)}return()=>{let l=this._stacks.get(t.value)||0;this._stacks.set(t.value,l-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,n=0;for(let[r,s]of this._stacks)(!t||n<s)&&(t=[r,s],n=s);return t}};UN._idPool=1;var SU=UN,wU=class WN{constructor(t){this.value=t}static create(){let t=new Error;return new WN(t.stack??"")}print(){console.warn(this.value.split(`
479
+ `).slice(2).join(`
480
+ `))}},CU=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},kU=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},EU=0,kv=class{constructor(e){this.value=e,this.id=EU++}},RU=2,TU,we=class{constructor(e){var t,n,r,s;this._size=0,this._options=e,this._leakageMon=(t=this._options)!=null&&t.leakWarningThreshold?new SU((e==null?void 0:e.onListenerError)??cf,((n=this._options)==null?void 0:n.leakWarningThreshold)??xU):void 0,this._perfMon=(r=this._options)!=null&&r._profName?new bU(this._options._profName):void 0,this._deliveryQueue=(s=this._options)==null?void 0:s.deliveryQueue}dispose(){var e,t,n,r;this._disposed||(this._disposed=!0,((e=this._deliveryQueue)==null?void 0:e.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),(n=(t=this._options)==null?void 0:t.onDidRemoveLastListener)==null||n.call(t),(r=this._leakageMon)==null||r.dispose())}get event(){return this._event??(this._event=(e,t,n)=>{var a,u,h,d,p;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let m=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(m);let _=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],y=new kU(`${m}. HINT: Stack shows most frequent listener (${_[1]}-times)`,_[0]);return(((a=this._options)==null?void 0:a.onListenerError)||cf)(y),Ke.None}if(this._disposed)return Ke.None;t&&(e=e.bind(t));let r=new kv(e),s;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=wU.create(),s=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof kv?(this._deliveryQueue??(this._deliveryQueue=new MU),this._listeners=[this._listeners,r]):this._listeners.push(r):((h=(u=this._options)==null?void 0:u.onWillAddFirstListener)==null||h.call(u,this),this._listeners=r,(p=(d=this._options)==null?void 0:d.onDidAddFirstListener)==null||p.call(d,this)),this._size++;let l=Dt(()=>{s==null||s(),this._removeListener(r)});return n instanceof io?n.add(l):Array.isArray(n)&&n.push(l),l}),this._event}_removeListener(e){var s,l,a,u;if((l=(s=this._options)==null?void 0:s.onWillRemoveListener)==null||l.call(s,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(u=(a=this._options)==null?void 0:a.onDidRemoveLastListener)==null||u.call(a,this),this._size=0;return}let t=this._listeners,n=t.indexOf(e);if(n===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,t[n]=void 0;let r=this._deliveryQueue.current===this;if(this._size*RU<=t.length){let h=0;for(let d=0;d<t.length;d++)t[d]?t[h++]=t[d]:r&&(this._deliveryQueue.end--,h<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=h}}_deliver(e,t){var r;if(!e)return;let n=((r=this._options)==null?void 0:r.onListenerError)||cf;if(!n){e.value(t);return}try{e.value(t)}catch(s){n(s)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){var t,n,r,s;if((t=this._deliveryQueue)!=null&&t.current&&(this._deliverQueue(this._deliveryQueue),(n=this._perfMon)==null||n.stop()),(r=this._perfMon)==null||r.start(this._size),this._listeners)if(this._listeners instanceof kv)this._deliver(this._listeners,e);else{let l=this._deliveryQueue;l.enqueue(this,e,this._listeners.length),this._deliverQueue(l)}(s=this._perfMon)==null||s.stop()}hasListeners(){return this._size>0}},MU=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},q_=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new we,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new we,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,n){if(this.getZoomLevel(n)===t)return;let r=this.getWindowId(n);this.mapWindowIdToZoomLevel.set(r,t),this._onDidChangeZoomLevel.fire(r)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,n){this.mapWindowIdToZoomFactor.set(this.getWindowId(n),t)}setFullscreen(t,n){if(this.isFullscreen(n)===t)return;let r=this.getWindowId(n);this.mapWindowIdToFullScreen.set(r,t),this._onDidChangeFullscreen.fire(r)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};q_.INSTANCE=new q_;var n0=q_;function NU(e,t,n){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",n)}n0.INSTANCE.onDidChangeZoomLevel;function AU(e){return n0.INSTANCE.getZoomFactor(e)}n0.INSTANCE.onDidChangeFullscreen;var Ua=typeof navigator=="object"?navigator.userAgent:"",K_=Ua.indexOf("Firefox")>=0,DU=Ua.indexOf("AppleWebKit")>=0,r0=Ua.indexOf("Chrome")>=0,OU=!r0&&Ua.indexOf("Safari")>=0;Ua.indexOf("Electron/")>=0;Ua.indexOf("Android")>=0;var Ev=!1;if(typeof as.matchMedia=="function"){let e=as.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=as.matchMedia("(display-mode: fullscreen)");Ev=e.matches,NU(as,e,({matches:n})=>{Ev&&t.matches||(Ev=n)})}var da="en",G_=!1,Y_=!1,uf=!1,VN=!1,jh,df=da,b2=da,LU,ri,Yo=globalThis,Mn,wE;typeof Yo.vscode<"u"&&typeof Yo.vscode.process<"u"?Mn=Yo.vscode.process:typeof process<"u"&&typeof((wE=process==null?void 0:process.versions)==null?void 0:wE.node)=="string"&&(Mn=process);var CE,jU=typeof((CE=Mn==null?void 0:Mn.versions)==null?void 0:CE.electron)=="string",zU=jU&&(Mn==null?void 0:Mn.type)==="renderer",kE;if(typeof Mn=="object"){G_=Mn.platform==="win32",Y_=Mn.platform==="darwin",uf=Mn.platform==="linux",uf&&Mn.env.SNAP&&Mn.env.SNAP_REVISION,Mn.env.CI||Mn.env.BUILD_ARTIFACTSTAGINGDIRECTORY,jh=da,df=da;let e=Mn.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);jh=t.userLocale,b2=t.osLocale,df=t.resolvedLanguage||da,LU=(kE=t.languagePack)==null?void 0:kE.translationsConfigFile}catch{}VN=!0}else typeof navigator=="object"&&!zU?(ri=navigator.userAgent,G_=ri.indexOf("Windows")>=0,Y_=ri.indexOf("Macintosh")>=0,(ri.indexOf("Macintosh")>=0||ri.indexOf("iPad")>=0||ri.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,uf=ri.indexOf("Linux")>=0,(ri==null?void 0:ri.indexOf("Mobi"))>=0,df=globalThis._VSCODE_NLS_LANGUAGE||da,jh=navigator.language.toLowerCase(),b2=jh):console.error("Unable to resolve platform.");var qN=G_,Mi=Y_,PU=uf,x2=VN,Di=ri,Ks=df,BU;(e=>{function t(){return Ks}e.value=t;function n(){return Ks.length===2?Ks==="en":Ks.length>=3?Ks[0]==="e"&&Ks[1]==="n"&&Ks[2]==="-":!1}e.isDefaultVariant=n;function r(){return Ks==="en"}e.isDefault=r})(BU||(BU={}));var IU=typeof Yo.postMessage=="function"&&!Yo.importScripts;(()=>{if(IU){let e=[];Yo.addEventListener("message",n=>{if(n.data&&n.data.vscodeScheduleAsyncWork)for(let r=0,s=e.length;r<s;r++){let l=e[r];if(l.id===n.data.vscodeScheduleAsyncWork){e.splice(r,1),l.callback();return}}});let t=0;return n=>{let r=++t;e.push({id:r,callback:n}),Yo.postMessage({vscodeScheduleAsyncWork:r},"*")}}return e=>setTimeout(e)})();var HU=!!(Di&&Di.indexOf("Chrome")>=0);Di&&Di.indexOf("Firefox")>=0;!HU&&Di&&Di.indexOf("Safari")>=0;Di&&Di.indexOf("Edg/")>=0;Di&&Di.indexOf("Android")>=0;var ra=typeof navigator=="object"?navigator:{};x2||document.queryCommandSupported&&document.queryCommandSupported("copy")||ra&&ra.clipboard&&ra.clipboard.writeText,x2||ra&&ra.clipboard&&ra.clipboard.readText;var i0=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},Rv=new i0,S2=new i0,w2=new i0,FU=new Array(230),KN;(e=>{function t(u){return Rv.keyCodeToStr(u)}e.toString=t;function n(u){return Rv.strToKeyCode(u)}e.fromString=n;function r(u){return S2.keyCodeToStr(u)}e.toUserSettingsUS=r;function s(u){return w2.keyCodeToStr(u)}e.toUserSettingsGeneral=s;function l(u){return S2.strToKeyCode(u)||w2.strToKeyCode(u)}e.fromUserSettings=l;function a(u){if(u>=98&&u<=113)return null;switch(u){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return Rv.keyCodeToStr(u)}e.toElectronAccelerator=a})(KN||(KN={}));var UU=class GN{constructor(t,n,r,s,l){this.ctrlKey=t,this.shiftKey=n,this.altKey=r,this.metaKey=s,this.keyCode=l}equals(t){return t instanceof GN&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){let t=this.ctrlKey?"1":"0",n=this.shiftKey?"1":"0",r=this.altKey?"1":"0",s=this.metaKey?"1":"0";return`K${t}${n}${r}${s}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new $U([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},$U=class{constructor(e){if(e.length===0)throw pU("chords");this.chords=e}getHashCode(){let e="";for(let t=0,n=this.chords.length;t<n;t++)t!==0&&(e+=";"),e+=this.chords[t].getHashCode();return e}equals(e){if(e===null||this.chords.length!==e.chords.length)return!1;for(let t=0;t<this.chords.length;t++)if(!this.chords[t].equals(e.chords[t]))return!1;return!0}};function WU(e){if(e.charCode){let n=String.fromCharCode(e.charCode).toUpperCase();return KN.fromString(n)}let t=e.keyCode;if(t===3)return 7;if(K_)switch(t){case 59:return 85;case 60:if(PU)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(Mi)return 57;break}else if(DU&&(Mi&&t===93||!Mi&&t===92))return 57;return FU[t]||0}var VU=Mi?256:2048,qU=512,KU=1024,GU=Mi?2048:256,C2=class{constructor(e){var n;this._standardKeyboardEventBrand=!0;let t=e;this.browserEvent=t,this.target=t.target,this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,this.altGraphKey=(n=t.getModifierState)==null?void 0:n.call(t,"AltGraph"),this.keyCode=WU(t),this.code=t.code,this.ctrlKey=this.ctrlKey||this.keyCode===5,this.altKey=this.altKey||this.keyCode===6,this.shiftKey=this.shiftKey||this.keyCode===4,this.metaKey=this.metaKey||this.keyCode===57,this._asKeybinding=this._computeKeybinding(),this._asKeyCodeChord=this._computeKeyCodeChord()}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation&&this.browserEvent.stopPropagation()}toKeyCodeChord(){return this._asKeyCodeChord}equals(e){return this._asKeybinding===e}_computeKeybinding(){let e=0;this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode);let t=0;return this.ctrlKey&&(t|=VU),this.altKey&&(t|=qU),this.shiftKey&&(t|=KU),this.metaKey&&(t|=GU),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new UU(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},k2=new WeakMap;function YU(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,n=e.parent.location;if(t.origin!=="null"&&n.origin!=="null"&&t.origin!==n.origin)return null}catch{return null}return e.parent}var XU=class{static getSameOriginWindowChain(e){let t=k2.get(e);if(!t){t=[],k2.set(e,t);let n=e,r;do r=YU(n),r?t.push({window:new WeakRef(n),iframeElement:n.frameElement||null}):t.push({window:new WeakRef(n),iframeElement:null}),n=r;while(n)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let n=0,r=0,s=this.getSameOriginWindowChain(e);for(let l of s){let a=l.window.deref();if(n+=(a==null?void 0:a.scrollY)??0,r+=(a==null?void 0:a.scrollX)??0,a===t||!l.iframeElement)break;let u=l.iframeElement.getBoundingClientRect();n+=u.top,r+=u.left}return{top:n,left:r}}},zh=class{constructor(e,t){this.timestamp=Date.now(),this.browserEvent=t,this.leftButton=t.button===0,this.middleButton=t.button===1,this.rightButton=t.button===2,this.buttons=t.buttons,this.target=t.target,this.detail=t.detail||1,t.type==="dblclick"&&(this.detail=2),this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,typeof t.pageX=="number"?(this.posx=t.pageX,this.posy=t.pageY):(this.posx=t.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=t.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let n=XU.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=n.left,this.posy-=n.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},E2=class{constructor(e,t=0,n=0){var s;this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=n,this.deltaX=t;let r=!1;if(r0){let l=navigator.userAgent.match(/Chrome\/(\d+)/);r=(l?parseInt(l[1]):123)<=122}if(e){let l=e,a=e,u=((s=e.view)==null?void 0:s.devicePixelRatio)||1;if(typeof l.wheelDeltaY<"u")r?this.deltaY=l.wheelDeltaY/(120*u):this.deltaY=l.wheelDeltaY/120;else if(typeof a.VERTICAL_AXIS<"u"&&a.axis===a.VERTICAL_AXIS)this.deltaY=-a.detail/3;else if(e.type==="wheel"){let h=e;h.deltaMode===h.DOM_DELTA_LINE?K_&&!Mi?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof l.wheelDeltaX<"u")OU&&qN?this.deltaX=-(l.wheelDeltaX/120):r?this.deltaX=l.wheelDeltaX/(120*u):this.deltaX=l.wheelDeltaX/120;else if(typeof a.HORIZONTAL_AXIS<"u"&&a.axis===a.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let h=e;h.deltaMode===h.DOM_DELTA_LINE?K_&&!Mi?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(r?this.deltaY=e.wheelDelta/(120*u):this.deltaY=e.wheelDelta/120)}}preventDefault(){var e;(e=this.browserEvent)==null||e.preventDefault()}stopPropagation(){var e;(e=this.browserEvent)==null||e.stopPropagation()}},YN=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),ZU;(e=>{function t(n){return n===e.None||n===e.Cancelled||n instanceof QU?!0:!n||typeof n!="object"?!1:typeof n.isCancellationRequested=="boolean"&&typeof n.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Nn.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:YN})})(ZU||(ZU={}));var QU=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?YN:(this._emitter||(this._emitter=new we),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},s0=class{constructor(e,t){this._isDisposed=!1,this._token=-1,typeof e=="function"&&typeof t=="number"&&this.setIfNotSet(e,t)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,t){if(this._isDisposed)throw new F_("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new F_("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},JU=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){var e;(e=this.disposable)==null||e.dispose(),this.disposable=void 0}cancelAndSet(e,t,n=globalThis){if(this.isDisposed)throw new F_("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let r=n.setInterval(()=>{e()},t);this.disposable=Dt(()=>{n.clearInterval(r),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},e$;(e=>{async function t(r){let s,l=await Promise.all(r.map(a=>a.then(u=>u,u=>{s||(s=u)})));if(typeof s<"u")throw s;return l}e.settled=t;function n(r){return new Promise(async(s,l)=>{try{await r(s,l)}catch(a){l(a)}})}e.withAsyncBody=n})(e$||(e$={}));var R2=class Fr{static fromArray(t){return new Fr(n=>{n.emitMany(t)})}static fromPromise(t){return new Fr(async n=>{n.emitMany(await t)})}static fromPromises(t){return new Fr(async n=>{await Promise.all(t.map(async r=>n.emitOne(await r)))})}static merge(t){return new Fr(async n=>{await Promise.all(t.map(async r=>{for await(let s of r)n.emitOne(s)}))})}constructor(t,n){this._state=0,this._results=[],this._error=null,this._onReturn=n,this._onStateChanged=new we,queueMicrotask(async()=>{let r={emitOne:s=>this.emitOne(s),emitMany:s=>this.emitMany(s),reject:s=>this.reject(s)};try{await Promise.resolve(t(r)),this.resolve()}catch(s){this.reject(s)}finally{r.emitOne=void 0,r.emitMany=void 0,r.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await Nn.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>{var n;return(n=this._onReturn)==null||n.call(this),{done:!0,value:void 0}}}}static map(t,n){return new Fr(async r=>{for await(let s of t)r.emitOne(n(s))})}map(t){return Fr.map(this,t)}static filter(t,n){return new Fr(async r=>{for await(let s of t)n(s)&&r.emitOne(s)})}filter(t){return Fr.filter(this,t)}static coalesce(t){return Fr.filter(t,n=>!!n)}coalesce(){return Fr.coalesce(this)}static async toPromise(t){let n=[];for await(let r of t)n.push(r);return n}toPromise(){return Fr.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};R2.EMPTY=R2.fromArray([]);var{getWindow:Ei,getWindowId:t$,onDidRegisterWindow:n$}=(function(){let e=new Map,t={window:as,disposables:new io};e.set(as.vscodeWindowId,t);let n=new we,r=new we,s=new we;function l(a,u){return(typeof a=="number"?e.get(a):void 0)??(u?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:s.event,onDidUnregisterWindow:r.event,registerWindow(a){if(e.has(a.vscodeWindowId))return Ke.None;let u=new io,h={window:a,disposables:u.add(new io)};return e.set(a.vscodeWindowId,h),u.add(Dt(()=>{e.delete(a.vscodeWindowId),r.fire(a)})),u.add(Ie(a,fn.BEFORE_UNLOAD,()=>{s.fire(a)})),n.fire(h),u},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(a){return a.vscodeWindowId},hasWindow(a){return e.has(a)},getWindowById:l,getWindow(a){var d;let u=a;if((d=u==null?void 0:u.ownerDocument)!=null&&d.defaultView)return u.ownerDocument.defaultView.window;let h=a;return h!=null&&h.view?h.view.window:as},getDocument(a){return Ei(a).document}}})(),r$=class{constructor(e,t,n,r){this._node=e,this._type=t,this._handler=n,this._options=r||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function Ie(e,t,n,r){return new r$(e,t,n,r)}var T2=function(e,t,n,r){return Ie(e,t,n,r)},o0,i$=class extends JU{constructor(e){super(),this.defaultTarget=e&&Ei(e)}cancelAndSet(e,t,n){return super.cancelAndSet(e,t,n??this.defaultTarget)}},M2=class{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){cf(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,n=new Map,r=new Map,s=l=>{n.set(l,!1);let a=e.get(l)??[];for(t.set(l,a),e.set(l,[]),r.set(l,!0);a.length>0;)a.sort(M2.sort),a.shift().execute();r.set(l,!1)};o0=(l,a,u=0)=>{let h=t$(l),d=new M2(a,u),p=e.get(h);return p||(p=[],e.set(h,p)),p.push(d),n.get(h)||(n.set(h,!0),l.requestAnimationFrame(()=>s(h))),d}})();function s$(e){let t=e.getBoundingClientRect(),n=Ei(e);return{left:t.left+n.scrollX,top:t.top+n.scrollY,width:t.width,height:t.height}}var fn={CLICK:"click",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",KEY_DOWN:"keydown",KEY_UP:"keyup",BEFORE_UNLOAD:"beforeunload",CHANGE:"change",FOCUS:"focus",BLUR:"blur",INPUT:"input"},o$=class{constructor(e){this.domNode=e,this._maxWidth="",this._width="",this._height="",this._top="",this._left="",this._bottom="",this._right="",this._paddingTop="",this._paddingLeft="",this._paddingBottom="",this._paddingRight="",this._fontFamily="",this._fontWeight="",this._fontSize="",this._fontStyle="",this._fontFeatureSettings="",this._fontVariationSettings="",this._textDecoration="",this._lineHeight="",this._letterSpacing="",this._className="",this._display="",this._position="",this._visibility="",this._color="",this._backgroundColor="",this._layerHint=!1,this._contain="none",this._boxShadow=""}setMaxWidth(e){let t=ir(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=ir(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=ir(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=ir(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=ir(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=ir(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=ir(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=ir(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=ir(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=ir(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=ir(e);this._paddingRight!==t&&(this._paddingRight=t,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(e){let t=ir(e);this._fontSize!==t&&(this._fontSize=t,this.domNode.style.fontSize=this._fontSize)}setFontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(e){this._fontFeatureSettings!==e&&(this._fontFeatureSettings=e,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(e){this._fontVariationSettings!==e&&(this._fontVariationSettings=e,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(e){this._textDecoration!==e&&(this._textDecoration=e,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(e){let t=ir(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=ir(e);this._letterSpacing!==t&&(this._letterSpacing=t,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,t){this.domNode.classList.toggle(e,t),this._className=this.domNode.className}setDisplay(e){this._display!==e&&(this._display=e,this.domNode.style.display=this._display)}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this.domNode.style.visibility=this._visibility)}setColor(e){this._color!==e&&(this._color=e,this.domNode.style.color=this._color)}setBackgroundColor(e){this._backgroundColor!==e&&(this._backgroundColor=e,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(e){this._boxShadow!==e&&(this._boxShadow=e,this.domNode.style.boxShadow=e)}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,t){this.domNode.setAttribute(e,t)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}};function ir(e){return typeof e=="number"?`${e}px`:e}function _u(e){return new o$(e)}var XN=class{constructor(){this._hooks=new io,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let n=this._onStopCallback;this._onStopCallback=null,e&&n&&n(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,n,r,s){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=r,this._onStopCallback=s;let l=e;try{e.setPointerCapture(t),this._hooks.add(Dt(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{l=Ei(e)}this._hooks.add(Ie(l,fn.POINTER_MOVE,a=>{if(a.buttons!==n){this.stopMonitoring(!0);return}a.preventDefault(),this._pointerMoveCallback(a)})),this._hooks.add(Ie(l,fn.POINTER_UP,a=>this.stopMonitoring(!0)))}};function l$(e,t,n){let r=null,s=null;if(typeof n.value=="function"?(r="value",s=n.value,s.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof n.get=="function"&&(r="get",s=n.get),!s)throw new Error("not supported");let l=`$memoize$${t}`;n[r]=function(...a){return this.hasOwnProperty(l)||Object.defineProperty(this,l,{configurable:!1,enumerable:!1,writable:!1,value:s.apply(this,a)}),this[l]}}var yi;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(yi||(yi={}));var su=class On extends Ke{constructor(){super(),this.dispatched=!1,this.targets=new y2,this.ignoreTargets=new y2,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(Nn.runAndSubscribe(n$,({window:t,disposables:n})=>{n.add(Ie(t.document,"touchstart",r=>this.onTouchStart(r),{passive:!1})),n.add(Ie(t.document,"touchend",r=>this.onTouchEnd(t,r))),n.add(Ie(t.document,"touchmove",r=>this.onTouchMove(r),{passive:!1}))},{window:as,disposables:this._store}))}static addTarget(t){if(!On.isTouchDevice())return Ke.None;On.INSTANCE||(On.INSTANCE=new On);let n=On.INSTANCE.targets.push(t);return Dt(n)}static ignoreTarget(t){if(!On.isTouchDevice())return Ke.None;On.INSTANCE||(On.INSTANCE=new On);let n=On.INSTANCE.ignoreTargets.push(t);return Dt(n)}static isTouchDevice(){return"ontouchstart"in as||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(t){let n=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let r=0,s=t.targetTouches.length;r<s;r++){let l=t.targetTouches.item(r);this.activeTouches[l.identifier]={id:l.identifier,initialTarget:l.target,initialTimeStamp:n,initialPageX:l.pageX,initialPageY:l.pageY,rollingTimestamps:[n],rollingPageX:[l.pageX],rollingPageY:[l.pageY]};let a=this.newGestureEvent(yi.Start,l.target);a.pageX=l.pageX,a.pageY=l.pageY,this.dispatchEvent(a)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}onTouchEnd(t,n){let r=Date.now(),s=Object.keys(this.activeTouches).length;for(let l=0,a=n.changedTouches.length;l<a;l++){let u=n.changedTouches.item(l);if(!this.activeTouches.hasOwnProperty(String(u.identifier))){console.warn("move of an UNKNOWN touch",u);continue}let h=this.activeTouches[u.identifier],d=Date.now()-h.initialTimeStamp;if(d<On.HOLD_DELAY&&Math.abs(h.initialPageX-yr(h.rollingPageX))<30&&Math.abs(h.initialPageY-yr(h.rollingPageY))<30){let p=this.newGestureEvent(yi.Tap,h.initialTarget);p.pageX=yr(h.rollingPageX),p.pageY=yr(h.rollingPageY),this.dispatchEvent(p)}else if(d>=On.HOLD_DELAY&&Math.abs(h.initialPageX-yr(h.rollingPageX))<30&&Math.abs(h.initialPageY-yr(h.rollingPageY))<30){let p=this.newGestureEvent(yi.Contextmenu,h.initialTarget);p.pageX=yr(h.rollingPageX),p.pageY=yr(h.rollingPageY),this.dispatchEvent(p)}else if(s===1){let p=yr(h.rollingPageX),m=yr(h.rollingPageY),_=yr(h.rollingTimestamps)-h.rollingTimestamps[0],y=p-h.rollingPageX[0],w=m-h.rollingPageY[0],S=[...this.targets].filter(C=>h.initialTarget instanceof Node&&C.contains(h.initialTarget));this.inertia(t,S,r,Math.abs(y)/_,y>0?1:-1,p,Math.abs(w)/_,w>0?1:-1,m)}this.dispatchEvent(this.newGestureEvent(yi.End,h.initialTarget)),delete this.activeTouches[u.identifier]}this.dispatched&&(n.preventDefault(),n.stopPropagation(),this.dispatched=!1)}newGestureEvent(t,n){let r=document.createEvent("CustomEvent");return r.initEvent(t,!1,!0),r.initialTarget=n,r.tapCount=0,r}dispatchEvent(t){if(t.type===yi.Tap){let n=new Date().getTime(),r=0;n-this._lastSetTapCountTime>On.CLEAR_TAP_COUNT_TIME?r=1:r=2,this._lastSetTapCountTime=n,t.tapCount=r}else(t.type===yi.Change||t.type===yi.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let r of this.ignoreTargets)if(r.contains(t.initialTarget))return;let n=[];for(let r of this.targets)if(r.contains(t.initialTarget)){let s=0,l=t.initialTarget;for(;l&&l!==r;)s++,l=l.parentElement;n.push([s,r])}n.sort((r,s)=>r[0]-s[0]);for(let[r,s]of n)s.dispatchEvent(t),this.dispatched=!0}}inertia(t,n,r,s,l,a,u,h,d){this.handle=o0(t,()=>{let p=Date.now(),m=p-r,_=0,y=0,w=!0;s+=On.SCROLL_FRICTION*m,u+=On.SCROLL_FRICTION*m,s>0&&(w=!1,_=l*s*m),u>0&&(w=!1,y=h*u*m);let S=this.newGestureEvent(yi.Change);S.translationX=_,S.translationY=y,n.forEach(C=>C.dispatchEvent(S)),w||this.inertia(t,n,p,s,l,a+_,u,h,d+y)})}onTouchMove(t){let n=Date.now();for(let r=0,s=t.changedTouches.length;r<s;r++){let l=t.changedTouches.item(r);if(!this.activeTouches.hasOwnProperty(String(l.identifier))){console.warn("end of an UNKNOWN touch",l);continue}let a=this.activeTouches[l.identifier],u=this.newGestureEvent(yi.Change,a.initialTarget);u.translationX=l.pageX-yr(a.rollingPageX),u.translationY=l.pageY-yr(a.rollingPageY),u.pageX=l.pageX,u.pageY=l.pageY,this.dispatchEvent(u),a.rollingPageX.length>3&&(a.rollingPageX.shift(),a.rollingPageY.shift(),a.rollingTimestamps.shift()),a.rollingPageX.push(l.pageX),a.rollingPageY.push(l.pageY),a.rollingTimestamps.push(n)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};su.SCROLL_FRICTION=-.005,su.HOLD_DELAY=700,su.CLEAR_TAP_COUNT_TIME=400,It([l$],su,"isTouchDevice",1);var a$=su,l0=class extends Ke{onclick(e,t){this._register(Ie(e,fn.CLICK,n=>t(new zh(Ei(e),n))))}onmousedown(e,t){this._register(Ie(e,fn.MOUSE_DOWN,n=>t(new zh(Ei(e),n))))}onmouseover(e,t){this._register(Ie(e,fn.MOUSE_OVER,n=>t(new zh(Ei(e),n))))}onmouseleave(e,t){this._register(Ie(e,fn.MOUSE_LEAVE,n=>t(new zh(Ei(e),n))))}onkeydown(e,t){this._register(Ie(e,fn.KEY_DOWN,n=>t(new C2(n))))}onkeyup(e,t){this._register(Ie(e,fn.KEY_UP,n=>t(new C2(n))))}oninput(e,t){this._register(Ie(e,fn.INPUT,t))}onblur(e,t){this._register(Ie(e,fn.BLUR,t))}onfocus(e,t){this._register(Ie(e,fn.FOCUS,t))}onchange(e,t){this._register(Ie(e,fn.CHANGE,t))}ignoreGesture(e){return a$.ignoreTarget(e)}},N2=11,c$=class extends l0{constructor(e){super(),this._onActivate=e.onActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="arrow-background",this.bgDomNode.style.position="absolute",this.bgDomNode.style.width=e.bgWidth+"px",this.bgDomNode.style.height=e.bgHeight+"px",typeof e.top<"u"&&(this.bgDomNode.style.top="0px"),typeof e.left<"u"&&(this.bgDomNode.style.left="0px"),typeof e.bottom<"u"&&(this.bgDomNode.style.bottom="0px"),typeof e.right<"u"&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=e.className,this.domNode.style.position="absolute",this.domNode.style.width=N2+"px",this.domNode.style.height=N2+"px",typeof e.top<"u"&&(this.domNode.style.top=e.top+"px"),typeof e.left<"u"&&(this.domNode.style.left=e.left+"px"),typeof e.bottom<"u"&&(this.domNode.style.bottom=e.bottom+"px"),typeof e.right<"u"&&(this.domNode.style.right=e.right+"px"),this._pointerMoveMonitor=this._register(new XN),this._register(T2(this.bgDomNode,fn.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(T2(this.domNode,fn.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new i$),this._pointerdownScheduleRepeatTimer=this._register(new s0)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,Ei(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(t,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,n=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},u$=class X_{constructor(t,n,r,s,l,a,u){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(n=n|0,r=r|0,s=s|0,l=l|0,a=a|0,u=u|0),this.rawScrollLeft=s,this.rawScrollTop=u,n<0&&(n=0),s+n>r&&(s=r-n),s<0&&(s=0),l<0&&(l=0),u+l>a&&(u=a-l),u<0&&(u=0),this.width=n,this.scrollWidth=r,this.scrollLeft=s,this.height=l,this.scrollHeight=a,this.scrollTop=u}equals(t){return this.rawScrollLeft===t.rawScrollLeft&&this.rawScrollTop===t.rawScrollTop&&this.width===t.width&&this.scrollWidth===t.scrollWidth&&this.scrollLeft===t.scrollLeft&&this.height===t.height&&this.scrollHeight===t.scrollHeight&&this.scrollTop===t.scrollTop}withScrollDimensions(t,n){return new X_(this._forceIntegerValues,typeof t.width<"u"?t.width:this.width,typeof t.scrollWidth<"u"?t.scrollWidth:this.scrollWidth,n?this.rawScrollLeft:this.scrollLeft,typeof t.height<"u"?t.height:this.height,typeof t.scrollHeight<"u"?t.scrollHeight:this.scrollHeight,n?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new X_(this._forceIntegerValues,this.width,this.scrollWidth,typeof t.scrollLeft<"u"?t.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof t.scrollTop<"u"?t.scrollTop:this.rawScrollTop)}createScrollEvent(t,n){let r=this.width!==t.width,s=this.scrollWidth!==t.scrollWidth,l=this.scrollLeft!==t.scrollLeft,a=this.height!==t.height,u=this.scrollHeight!==t.scrollHeight,h=this.scrollTop!==t.scrollTop;return{inSmoothScrolling:n,oldWidth:t.width,oldScrollWidth:t.scrollWidth,oldScrollLeft:t.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:t.height,oldScrollHeight:t.scrollHeight,oldScrollTop:t.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:r,scrollWidthChanged:s,scrollLeftChanged:l,heightChanged:a,scrollHeightChanged:u,scrollTopChanged:h}}},d$=class extends Ke{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new we),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new u$(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){var r;let n=this._state.withScrollDimensions(e,t);this._setState(n,!!this._smoothScrolling),(r=this._smoothScrolling)==null||r.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let t=this._state.withScrollPosition(e);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>"u"?this._smoothScrolling.to.scrollTop:e.scrollTop};let n=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===n.scrollLeft&&this._smoothScrolling.to.scrollTop===n.scrollTop)return;let r;t?r=new D2(this._smoothScrolling.from,n,this._smoothScrolling.startTime,this._smoothScrolling.duration):r=this._smoothScrolling.combine(this._state,n,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=r}else{let n=this._state.withScrollPosition(e);this._smoothScrolling=D2.start(this._state,n,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);if(this._setState(t,!0),!!this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){let n=this._state;n.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(n,t)))}},A2=class{constructor(e,t,n){this.scrollLeft=e,this.scrollTop=t,this.isDone=n}};function Tv(e,t){let n=t-e;return function(r){return e+n*p$(r)}}function h$(e,t,n){return function(r){return r<n?e(r/n):t((r-n)/(1-n))}}var D2=class Z_{constructor(t,n,r,s){this.from=t,this.to=n,this.duration=s,this.startTime=r,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(t,n,r){if(Math.abs(t-n)>2.5*r){let s,l;return t<n?(s=t+.75*r,l=n-.75*r):(s=t-.75*r,l=n+.75*r),h$(Tv(t,s),Tv(l,n),.33)}return Tv(t,n)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(t){this.to=t.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(t){let n=(t-this.startTime)/this.duration;if(n<1){let r=this.scrollLeft(n),s=this.scrollTop(n);return new A2(r,s,!1)}return new A2(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,n,r){return Z_.start(t,n,r)}static start(t,n,r){r=r+10;let s=Date.now()-10;return new Z_(t,n,s,r)}};function f$(e){return Math.pow(e,3)}function p$(e){return 1-f$(1-e)}var m$=class extends Ke{constructor(e,t,n){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=n,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new s0)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3?!0:this._rawShouldBeVisible}_updateShouldBeVisible(){let e=this._applyVisibilitySetting();this._shouldBeVisible!==e&&(this._shouldBeVisible=e,this.ensureVisibility())}setIsNeeded(e){this._isNeeded!==e&&(this._isNeeded=e,this.ensureVisibility())}setDomNode(e){this._domNode=e,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){if(!this._isNeeded){this._hide(!1);return}this._shouldBeVisible?this._reveal():this._hide(!0)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{var e;(e=this._domNode)==null||e.setClassName(this._visibleClassName)},0))}_hide(e){var t;this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,(t=this._domNode)==null||t.setClassName(this._invisibleClassName+(e?" fade":"")))}},g$=140,ZN=class extends l0{constructor(e){super(),this._lazyRender=e.lazyRender,this._host=e.host,this._scrollable=e.scrollable,this._scrollByPage=e.scrollByPage,this._scrollbarState=e.scrollbarState,this._visibilityController=this._register(new m$(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new XN),this._shouldRender=!0,this.domNode=_u(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition("absolute"),this._register(Ie(this.domNode.domNode,fn.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new c$(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,n,r){this.slider=_u(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof n=="number"&&this.slider.setWidth(n),typeof r=="number"&&this.slider.setHeight(r),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(Ie(this.slider.domNode,fn.POINTER_DOWN,s=>{s.button===0&&(s.preventDefault(),this._sliderPointerDown(s))})),this.onclick(this.slider.domNode,s=>{s.leftButton&&s.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let t=this.domNode.domNode.getClientRects()[0].top,n=t+this._scrollbarState.getSliderPosition(),r=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),s=this._sliderPointerPosition(e);n<=s&&s<=r?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,n;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,n=e.offsetY;else{let s=s$(this.domNode.domNode);t=e.pageX-s.left,n=e.pageY-s.top}let r=this._pointerDownRelativePosition(t,n);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(r):this._scrollbarState.getDesiredScrollPositionFromOffset(r)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),n=this._sliderOrthogonalPointerPosition(e),r=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,s=>{let l=this._sliderOrthogonalPointerPosition(s),a=Math.abs(l-n);if(qN&&a>g$){this._setDesiredScrollPositionNow(r.getScrollPosition());return}let u=this._sliderPointerPosition(s)-t;this._setDesiredScrollPositionNow(r.getDesiredScrollPositionFromDelta(u))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},QN=class Q_{constructor(t,n,r,s,l,a){this._scrollbarSize=Math.round(n),this._oppositeScrollbarSize=Math.round(r),this._arrowSize=Math.round(t),this._visibleSize=s,this._scrollSize=l,this._scrollPosition=a,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new Q_(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(t){let n=Math.round(t);return this._visibleSize!==n?(this._visibleSize=n,this._refreshComputedValues(),!0):!1}setScrollSize(t){let n=Math.round(t);return this._scrollSize!==n?(this._scrollSize=n,this._refreshComputedValues(),!0):!1}setScrollPosition(t){let n=Math.round(t);return this._scrollPosition!==n?(this._scrollPosition=n,this._refreshComputedValues(),!0):!1}setScrollbarSize(t){this._scrollbarSize=Math.round(t)}setOppositeScrollbarSize(t){this._oppositeScrollbarSize=Math.round(t)}static _computeValues(t,n,r,s,l){let a=Math.max(0,r-t),u=Math.max(0,a-2*n),h=s>0&&s>r;if(!h)return{computedAvailableSize:Math.round(a),computedIsNeeded:h,computedSliderSize:Math.round(u),computedSliderRatio:0,computedSliderPosition:0};let d=Math.round(Math.max(20,Math.floor(r*u/s))),p=(u-d)/(s-r),m=l*p;return{computedAvailableSize:Math.round(a),computedIsNeeded:h,computedSliderSize:Math.round(d),computedSliderRatio:p,computedSliderPosition:Math.round(m)}}_refreshComputedValues(){let t=Q_._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=t.computedAvailableSize,this._computedIsNeeded=t.computedIsNeeded,this._computedSliderSize=t.computedSliderSize,this._computedSliderRatio=t.computedSliderRatio,this._computedSliderPosition=t.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(t){if(!this._computedIsNeeded)return 0;let n=t-this._arrowSize-this._computedSliderSize/2;return Math.round(n/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(t){if(!this._computedIsNeeded)return 0;let n=t-this._arrowSize,r=this._scrollPosition;return n<this._computedSliderPosition?r-=this._visibleSize:r+=this._visibleSize,r}getDesiredScrollPositionFromDelta(t){if(!this._computedIsNeeded)return 0;let n=this._computedSliderPosition+t;return Math.round(n/this._computedSliderRatio)}},v$=class extends ZN{constructor(e,t,n){let r=e.getScrollDimensions(),s=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new QN(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,r.width,r.scrollWidth,s.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:"horizontal",scrollable:e,scrollByPage:t.scrollByPage}),t.horizontalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(Math.floor((t.horizontalScrollbarSize-t.horizontalSliderSize)/2),0,void 0,t.horizontalSliderSize)}_updateSlider(e,t){this.slider.setWidth(e),this.slider.setLeft(t)}_renderDomNode(e,t){this.domNode.setWidth(e),this.domNode.setHeight(t),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(e.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,t){e.scrollLeft=t}updateOptions(e){this.updateScrollbarSize(e.horizontal===2?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}},_$=class extends ZN{constructor(e,t,n){let r=e.getScrollDimensions(),s=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new QN(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,r.height,r.scrollHeight,s.scrollTop),visibility:t.vertical,extraScrollbarClassName:"vertical",scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(0,Math.floor((t.verticalScrollbarSize-t.verticalSliderSize)/2),t.verticalSliderSize,void 0)}_updateSlider(e,t){this.slider.setHeight(e),this.slider.setTop(t)}_renderDomNode(e,t){this.domNode.setWidth(t),this.domNode.setHeight(e),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(e.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return t}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,t){e.scrollTop=t}updateOptions(e){this.updateScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}},y$=500,O2=50,b$=class{constructor(e,t,n){this.timestamp=e,this.deltaX=t,this.deltaY=n,this.score=0}},J_=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let t=1,n=0,r=1,s=this._rear;do{let l=s===this._front?t:Math.pow(2,-r);if(t-=l,n+=this._memory[s].score*l,s===this._front)break;s=(this._capacity+s-1)%this._capacity,r++}while(!0);return n<=.5}acceptStandardWheelEvent(t){if(r0){let n=Ei(t.browserEvent),r=AU(n);this.accept(Date.now(),t.deltaX*r,t.deltaY*r)}else this.accept(Date.now(),t.deltaX,t.deltaY)}accept(t,n,r){let s=null,l=new b$(t,n,r);this._front===-1&&this._rear===-1?(this._memory[0]=l,this._front=0,this._rear=0):(s=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=l),l.score=this._computeScore(l,s)}_computeScore(t,n){if(Math.abs(t.deltaX)>0&&Math.abs(t.deltaY)>0)return 1;let r=.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(r+=.25),n){let s=Math.abs(t.deltaX),l=Math.abs(t.deltaY),a=Math.abs(n.deltaX),u=Math.abs(n.deltaY),h=Math.max(Math.min(s,a),1),d=Math.max(Math.min(l,u),1),p=Math.max(s,a),m=Math.max(l,u);p%h===0&&m%d===0&&(r-=.5)}return Math.min(Math.max(r,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};J_.INSTANCE=new J_;var x$=J_,S$=class extends l0{constructor(e,t,n){super(),this._onScroll=this._register(new we),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new we),this.onWillScroll=this._onWillScroll.event,this._options=C$(t),this._scrollable=n,this._register(this._scrollable.onScroll(s=>{this._onWillScroll.fire(s),this._onDidScroll(s),this._onScroll.fire(s)}));let r={onMouseWheel:s=>this._onMouseWheel(s),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new _$(this._scrollable,this._options,r)),this._horizontalScrollbar=this._register(new v$(this._scrollable,this._options,r)),this._domNode=document.createElement("div"),this._domNode.className="xterm-scrollable-element "+this._options.className,this._domNode.setAttribute("role","presentation"),this._domNode.style.position="relative",this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=_u(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=_u(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=_u(document.createElement("div")),this._topLeftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,s=>this._onMouseOver(s)),this.onmouseleave(this._listenOnDomNode,s=>this._onMouseLeave(s)),this._hideTimeout=this._register(new s0),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=nl(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,Mi&&(this._options.className+=" mac"),this._domNode.className="xterm-scrollable-element "+this._options.className}updateOptions(e){typeof e.handleMouseWheel<"u"&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity<"u"&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity<"u"&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis<"u"&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal<"u"&&(this._options.horizontal=e.horizontal),typeof e.vertical<"u"&&(this._options.vertical=e.vertical),typeof e.horizontalScrollbarSize<"u"&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize<"u"&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage<"u"&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new E2(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=nl(this._mouseWheelToDispose),e)){let t=n=>{this._onMouseWheel(new E2(n))};this._mouseWheelToDispose.push(Ie(this._listenOnDomNode,fn.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){var s;if((s=e.browserEvent)!=null&&s.defaultPrevented)return;let t=x$.INSTANCE;t.acceptStandardWheelEvent(e);let n=!1;if(e.deltaY||e.deltaX){let l=e.deltaY*this._options.mouseWheelScrollSensitivity,a=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&a+l===0?a=l=0:Math.abs(l)>=Math.abs(a)?a=0:l=0),this._options.flipAxes&&([l,a]=[a,l]);let u=!Mi&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||u)&&!a&&(a=l,l=0),e.browserEvent&&e.browserEvent.altKey&&(a=a*this._options.fastScrollSensitivity,l=l*this._options.fastScrollSensitivity);let h=this._scrollable.getFutureScrollPosition(),d={};if(l){let p=O2*l,m=h.scrollTop-(p<0?Math.floor(p):Math.ceil(p));this._verticalScrollbar.writeScrollPosition(d,m)}if(a){let p=O2*a,m=h.scrollLeft-(p<0?Math.floor(p):Math.ceil(p));this._horizontalScrollbar.writeScrollPosition(d,m)}d=this._scrollable.validateScrollPosition(d),(h.scrollLeft!==d.scrollLeft||h.scrollTop!==d.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(d):this._scrollable.setScrollPositionNow(d),n=!0)}let r=n;!r&&this._options.alwaysConsumeMouseWheel&&(r=!0),!r&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(r=!0),r&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,n=e.scrollLeft>0,r=n?" left":"",s=t?" top":"",l=n||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${r}`),this._topShadowDomNode.setClassName(`shadow${s}`),this._topLeftShadowDomNode.setClassName(`shadow${l}${s}${r}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),y$)}},w$=class extends S${constructor(e,t,n){super(e,t,n)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function C$(e){let t={lazyRender:typeof e.lazyRender<"u"?e.lazyRender:!1,className:typeof e.className<"u"?e.className:"",useShadows:typeof e.useShadows<"u"?e.useShadows:!0,handleMouseWheel:typeof e.handleMouseWheel<"u"?e.handleMouseWheel:!0,flipAxes:typeof e.flipAxes<"u"?e.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof e.consumeMouseWheelIfScrollbarIsNeeded<"u"?e.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof e.alwaysConsumeMouseWheel<"u"?e.alwaysConsumeMouseWheel:!1,scrollYToX:typeof e.scrollYToX<"u"?e.scrollYToX:!1,mouseWheelScrollSensitivity:typeof e.mouseWheelScrollSensitivity<"u"?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof e.fastScrollSensitivity<"u"?e.fastScrollSensitivity:5,scrollPredominantAxis:typeof e.scrollPredominantAxis<"u"?e.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof e.mouseWheelSmoothScroll<"u"?e.mouseWheelSmoothScroll:!0,arrowSize:typeof e.arrowSize<"u"?e.arrowSize:11,listenOnDomNode:typeof e.listenOnDomNode<"u"?e.listenOnDomNode:null,horizontal:typeof e.horizontal<"u"?e.horizontal:1,horizontalScrollbarSize:typeof e.horizontalScrollbarSize<"u"?e.horizontalScrollbarSize:10,horizontalSliderSize:typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:0,horizontalHasArrows:typeof e.horizontalHasArrows<"u"?e.horizontalHasArrows:!1,vertical:typeof e.vertical<"u"?e.vertical:1,verticalScrollbarSize:typeof e.verticalScrollbarSize<"u"?e.verticalScrollbarSize:10,verticalHasArrows:typeof e.verticalHasArrows<"u"?e.verticalHasArrows:!1,verticalSliderSize:typeof e.verticalSliderSize<"u"?e.verticalSliderSize:0,scrollByPage:typeof e.scrollByPage<"u"?e.scrollByPage:!1};return t.horizontalSliderSize=typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=typeof e.verticalSliderSize<"u"?e.verticalSliderSize:t.verticalScrollbarSize,Mi&&(t.className+=" mac"),t}var ey=class extends Ke{constructor(e,t,n,r,s,l,a,u){super(),this._bufferService=n,this._optionsService=a,this._renderService=u,this._onRequestScrollLines=this._register(new we),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let h=this._register(new d$({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:d=>o0(r.window,d)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{h.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new w$(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},h)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(s.onProtocolChange(d=>{this._scrollableElement.updateOptions({handleMouseWheel:!(d&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(Nn.runAndSubscribe(l.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=l.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(Dt(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=r.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(Dt(()=>this._styleElement.remove())),this._register(Nn.runAndSubscribe(l.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${l.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${l.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${l.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
481
+ `)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(d=>this._handleScroll(d)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){var e;return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:((e=this._optionsService.rawOptions.overviewRuler)==null?void 0:e.width)||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),n=t-this._bufferService.buffer.ydisp;n!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(n)),this._isHandlingScroll=!1}};ey=It([ke(2,qn),ke(3,vs),ke(4,DN),ke(5,Fa),ke(6,Kn),ke(7,_s)],ey);var ty=class extends Ke{constructor(e,t,n,r,s){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=n,this._decorationService=r,this._renderService=s,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(l=>this._removeDecoration(l))),this._register(Dt(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){var r;let t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",((r=e==null?void 0:e.options)==null?void 0:r.layer)==="top"),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let n=e.options.x??0;return n&&n>this._bufferService.cols&&(t.style.display="none"),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let n=this._decorationElements.get(e);n||(n=this._createElement(e),e.element=n,this._decorationElements.set(e,n),this._container.appendChild(n),e.onDispose(()=>{this._decorationElements.delete(e),n.remove()})),n.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(n.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,n.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,n.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,n.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(n)}}_refreshXPosition(e,t=e.element){if(!t)return;let n=e.options.x??0;(e.options.anchor||"left")==="right"?t.style.right=n?`${n*this._renderService.dimensions.css.cell.width}px`:"":t.style.left=n?`${n*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){var t;(t=this._decorationElements.get(e))==null||t.remove(),this._decorationElements.delete(e),e.dispose()}};ty=It([ke(1,qn),ke(2,vs),ke(3,ed),ke(4,_s)],ty);var k$=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(t,e.marker.line);return}}if(this._zonePoolIndex<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,t){return t>=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,n){return t>=e.startBufferLine-this._linePadding[n||"full"]&&t<=e.endBufferLine+this._linePadding[n||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},vi={full:0,left:0,center:0,right:0},Gs={full:0,left:0,center:0,right:0},Uc={full:0,left:0,center:0,right:0},Hf=class extends Ke{constructor(e,t,n,r,s,l,a,u){var d;super(),this._viewportElement=e,this._screenElement=t,this._bufferService=n,this._decorationService=r,this._renderService=s,this._optionsService=l,this._themeService=a,this._coreBrowserService=u,this._colorZoneStore=new k$,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),(d=this._viewportElement.parentElement)==null||d.insertBefore(this._canvas,this._viewportElement),this._register(Dt(()=>{var p;return(p=this._canvas)==null?void 0:p.remove()}));let h=this._canvas.getContext("2d");if(h)this._ctx=h;else throw new Error("Ctx cannot be null");this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),this._register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"})),this._register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange("overviewRuler",()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){var e;return((e=this._optionsService.options.overviewRuler)==null?void 0:e.width)||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);Gs.full=this._canvas.width,Gs.left=e,Gs.center=t,Gs.right=e,this._refreshDrawHeightConstants(),Uc.full=1,Uc.left=1,Uc.center=1+Gs.left,Uc.right=1+Gs.left+Gs.center}_refreshDrawHeightConstants(){vi.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);vi.left=t,vi.center=t,vi.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*vi.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*vi.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*vi.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*vi.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let t of this._decorationService.decorations)this._colorZoneStore.addDecoration(t);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let t of e)t.position!=="full"&&this._renderColorZone(t);for(let t of e)t.position==="full"&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(Uc[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-vi[e.position||"full"]/2),Gs[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+vi[e.position||"full"]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};Hf=It([ke(2,qn),ke(3,ed),ke(4,_s),ke(5,Kn),ke(6,Fa),ke(7,vs)],Hf);var ge;(e=>(e.NUL="\0",e.SOH="",e.STX="",e.ETX="",e.EOT="",e.ENQ="",e.ACK="",e.BEL="\x07",e.BS="\b",e.HT=" ",e.LF=`
482
+ `,e.VT="\v",e.FF="\f",e.CR="\r",e.SO="",e.SI="",e.DLE="",e.DC1="",e.DC2="",e.DC3="",e.DC4="",e.NAK="",e.SYN="",e.ETB="",e.CAN="",e.EM="",e.SUB="",e.ESC="\x1B",e.FS="",e.GS="",e.RS="",e.US="",e.SP=" ",e.DEL=""))(ge||(ge={}));var hf;(e=>(e.PAD="€",e.HOP="",e.BPH="‚",e.NBH="ƒ",e.IND="„",e.NEL="…",e.SSA="†",e.ESA="‡",e.HTS="ˆ",e.HTJ="‰",e.VTS="Š",e.PLD="‹",e.PLU="Œ",e.RI="",e.SS2="Ž",e.SS3="",e.DCS="",e.PU1="‘",e.PU2="’",e.STS="“",e.CCH="”",e.MW="•",e.SPA="–",e.EPA="—",e.SOS="˜",e.SGCI="™",e.SCI="š",e.CSI="›",e.ST="œ",e.OSC="",e.PM="ž",e.APC="Ÿ"))(hf||(hf={}));var JN;(e=>e.ST=`${ge.ESC}\\`)(JN||(JN={}));var ny=class{constructor(e,t,n,r,s,l){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=r,this._coreService=s,this._renderService=l,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){let t={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let n;t.start+=this._dataAlreadySent.length,this._isComposing?n=this._textarea.value.substring(t.start,this._compositionPosition.start):n=this._textarea.value.substring(t.start),n.length>0&&this._coreService.triggerDataEvent(n,!0)}},0)}else{this._isSendingComposition=!1;let t=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(t,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,n=t.replace(e,"");this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.length<e.length?this._coreService.triggerDataEvent(`${ge.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let t=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),n=this._renderService.dimensions.css.cell.height,r=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,s=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=s+"px",this._compositionView.style.top=r+"px",this._compositionView.style.height=n+"px",this._compositionView.style.lineHeight=n+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let l=this._compositionView.getBoundingClientRect();this._textarea.style.left=s+"px",this._textarea.style.top=r+"px",this._textarea.style.width=Math.max(l.width,1)+"px",this._textarea.style.height=Math.max(l.height,1)+"px",this._textarea.style.lineHeight=l.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};ny=It([ke(2,qn),ke(3,Kn),ke(4,hl),ke(5,_s)],ny);var _n=0,yn=0,bn=0,Bt=0,L2={css:"#00000000",rgba:0},Qt;(e=>{function t(s,l,a,u){return u!==void 0?`#${Bo(s)}${Bo(l)}${Bo(a)}${Bo(u)}`:`#${Bo(s)}${Bo(l)}${Bo(a)}`}e.toCss=t;function n(s,l,a,u=255){return(s<<24|l<<16|a<<8|u)>>>0}e.toRgba=n;function r(s,l,a,u){return{css:e.toCss(s,l,a,u),rgba:e.toRgba(s,l,a,u)}}e.toColor=r})(Qt||(Qt={}));var Tt;(e=>{function t(h,d){if(Bt=(d.rgba&255)/255,Bt===1)return{css:d.css,rgba:d.rgba};let p=d.rgba>>24&255,m=d.rgba>>16&255,_=d.rgba>>8&255,y=h.rgba>>24&255,w=h.rgba>>16&255,S=h.rgba>>8&255;_n=y+Math.round((p-y)*Bt),yn=w+Math.round((m-w)*Bt),bn=S+Math.round((_-S)*Bt);let C=Qt.toCss(_n,yn,bn),k=Qt.toRgba(_n,yn,bn);return{css:C,rgba:k}}e.blend=t;function n(h){return(h.rgba&255)===255}e.isOpaque=n;function r(h,d,p){let m=ff.ensureContrastRatio(h.rgba,d.rgba,p);if(m)return Qt.toColor(m>>24&255,m>>16&255,m>>8&255)}e.ensureContrastRatio=r;function s(h){let d=(h.rgba|255)>>>0;return[_n,yn,bn]=ff.toChannels(d),{css:Qt.toCss(_n,yn,bn),rgba:d}}e.opaque=s;function l(h,d){return Bt=Math.round(d*255),[_n,yn,bn]=ff.toChannels(h.rgba),{css:Qt.toCss(_n,yn,bn,Bt),rgba:Qt.toRgba(_n,yn,bn,Bt)}}e.opacity=l;function a(h,d){return Bt=h.rgba&255,l(h,Bt*d/255)}e.multiplyOpacity=a;function u(h){return[h.rgba>>24&255,h.rgba>>16&255,h.rgba>>8&255]}e.toColorRGB=u})(Tt||(Tt={}));var Lt;(e=>{let t,n;try{let s=document.createElement("canvas");s.width=1,s.height=1;let l=s.getContext("2d",{willReadFrequently:!0});l&&(t=l,t.globalCompositeOperation="copy",n=t.createLinearGradient(0,0,1,1))}catch{}function r(s){if(s.match(/#[\da-f]{3,8}/i))switch(s.length){case 4:return _n=parseInt(s.slice(1,2).repeat(2),16),yn=parseInt(s.slice(2,3).repeat(2),16),bn=parseInt(s.slice(3,4).repeat(2),16),Qt.toColor(_n,yn,bn);case 5:return _n=parseInt(s.slice(1,2).repeat(2),16),yn=parseInt(s.slice(2,3).repeat(2),16),bn=parseInt(s.slice(3,4).repeat(2),16),Bt=parseInt(s.slice(4,5).repeat(2),16),Qt.toColor(_n,yn,bn,Bt);case 7:return{css:s,rgba:(parseInt(s.slice(1),16)<<8|255)>>>0};case 9:return{css:s,rgba:parseInt(s.slice(1),16)>>>0}}let l=s.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(l)return _n=parseInt(l[1]),yn=parseInt(l[2]),bn=parseInt(l[3]),Bt=Math.round((l[5]===void 0?1:parseFloat(l[5]))*255),Qt.toColor(_n,yn,bn,Bt);if(!t||!n)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=n,t.fillStyle=s,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[_n,yn,bn,Bt]=t.getImageData(0,0,1,1).data,Bt!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Qt.toRgba(_n,yn,bn,Bt),css:s}}e.toColor=r})(Lt||(Lt={}));var Fn;(e=>{function t(r){return n(r>>16&255,r>>8&255,r&255)}e.relativeLuminance=t;function n(r,s,l){let a=r/255,u=s/255,h=l/255,d=a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4),p=u<=.03928?u/12.92:Math.pow((u+.055)/1.055,2.4),m=h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4);return d*.2126+p*.7152+m*.0722}e.relativeLuminance2=n})(Fn||(Fn={}));var ff;(e=>{function t(a,u){if(Bt=(u&255)/255,Bt===1)return u;let h=u>>24&255,d=u>>16&255,p=u>>8&255,m=a>>24&255,_=a>>16&255,y=a>>8&255;return _n=m+Math.round((h-m)*Bt),yn=_+Math.round((d-_)*Bt),bn=y+Math.round((p-y)*Bt),Qt.toRgba(_n,yn,bn)}e.blend=t;function n(a,u,h){let d=Fn.relativeLuminance(a>>8),p=Fn.relativeLuminance(u>>8);if(is(d,p)<h){if(p<d){let y=r(a,u,h),w=is(d,Fn.relativeLuminance(y>>8));if(w<h){let S=s(a,u,h),C=is(d,Fn.relativeLuminance(S>>8));return w>C?y:S}return y}let m=s(a,u,h),_=is(d,Fn.relativeLuminance(m>>8));if(_<h){let y=r(a,u,h),w=is(d,Fn.relativeLuminance(y>>8));return _>w?m:y}return m}}e.ensureContrastRatio=n;function r(a,u,h){let d=a>>24&255,p=a>>16&255,m=a>>8&255,_=u>>24&255,y=u>>16&255,w=u>>8&255,S=is(Fn.relativeLuminance2(_,y,w),Fn.relativeLuminance2(d,p,m));for(;S<h&&(_>0||y>0||w>0);)_-=Math.max(0,Math.ceil(_*.1)),y-=Math.max(0,Math.ceil(y*.1)),w-=Math.max(0,Math.ceil(w*.1)),S=is(Fn.relativeLuminance2(_,y,w),Fn.relativeLuminance2(d,p,m));return(_<<24|y<<16|w<<8|255)>>>0}e.reduceLuminance=r;function s(a,u,h){let d=a>>24&255,p=a>>16&255,m=a>>8&255,_=u>>24&255,y=u>>16&255,w=u>>8&255,S=is(Fn.relativeLuminance2(_,y,w),Fn.relativeLuminance2(d,p,m));for(;S<h&&(_<255||y<255||w<255);)_=Math.min(255,_+Math.ceil((255-_)*.1)),y=Math.min(255,y+Math.ceil((255-y)*.1)),w=Math.min(255,w+Math.ceil((255-w)*.1)),S=is(Fn.relativeLuminance2(_,y,w),Fn.relativeLuminance2(d,p,m));return(_<<24|y<<16|w<<8|255)>>>0}e.increaseLuminance=s;function l(a){return[a>>24&255,a>>16&255,a>>8&255,a&255]}e.toChannels=l})(ff||(ff={}));function Bo(e){let t=e.toString(16);return t.length<2?"0"+t:t}function is(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var E$=class extends Ju{constructor(e,t,n){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Ff=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new Kr}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let n=[],r=t.translateToString(!0),s=0,l=0,a=0,u=t.getFg(0),h=t.getBg(0);for(let d=0;d<t.getTrimmedLength();d++)if(t.loadCell(d,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==u||this._workCell.bg!==h){if(d-s>1){let p=this._getJoinedRanges(r,a,l,t,s);for(let m=0;m<p.length;m++)n.push(p[m])}s=d,a=l,u=this._workCell.fg,h=this._workCell.bg}l+=this._workCell.getChars().length||no.length}if(this._bufferService.cols-s>1){let d=this._getJoinedRanges(r,a,l,t,s);for(let p=0;p<d.length;p++)n.push(d[p])}return n}_getJoinedRanges(e,t,n,r,s){let l=e.substring(t,n),a=[];try{a=this._characterJoiners[0].handler(l)}catch(u){console.error(u)}for(let u=1;u<this._characterJoiners.length;u++)try{let h=this._characterJoiners[u].handler(l);for(let d=0;d<h.length;d++)Ff._mergeRanges(a,h[d])}catch(h){console.error(h)}return this._stringRangesToCellRanges(a,r,s),a}_stringRangesToCellRanges(e,t,n){let r=0,s=!1,l=0,a=e[r];if(a){for(let u=n;u<this._bufferService.cols;u++){let h=t.getWidth(u),d=t.getString(u).length||no.length;if(h!==0){if(!s&&a[0]<=l&&(a[0]=u,s=!0),a[1]<=l){if(a[1]=u,a=e[++r],!a)break;a[0]<=l?(a[0]=u,s=!0):s=!1}l+=d}}a&&(a[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let n=!1;for(let r=0;r<e.length;r++){let s=e[r];if(n){if(t[1]<=s[0])return e[r-1][1]=t[1],e;if(t[1]<=s[1])return e[r-1][1]=Math.max(t[1],s[1]),e.splice(r,1),e;e.splice(r,1),r--}else{if(t[1]<=s[0])return e.splice(r,0,t),e;if(t[1]<=s[1])return s[0]=Math.min(t[0],s[0]),e;t[0]<s[1]&&(s[0]=Math.min(t[0],s[0]),n=!0);continue}}return n?e[e.length-1][1]=t[1]:e.push(t),e}};Ff=It([ke(0,qn)],Ff);function R$(e){return 57508<=e&&e<=57558}function T$(e){return 9472<=e&&e<=9631}function M$(e){return R$(e)||T$(e)}function N$(){return{css:{canvas:Ph(),cell:Ph()},device:{canvas:Ph(),cell:Ph(),char:{width:0,height:0,left:0,top:0}}}}function Ph(){return{width:0,height:0}}var ry=class{constructor(e,t,n,r,s,l,a){this._document=e,this._characterJoinerService=t,this._optionsService=n,this._coreBrowserService=r,this._coreService=s,this._decorationService=l,this._themeService=a,this._workCell=new Kr,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,n){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=n}createRow(e,t,n,r,s,l,a,u,h,d,p){let m=[],_=this._characterJoinerService.getJoinedCharacters(t),y=this._themeService.colors,w=e.getNoBgTrimmedLength();n&&w<l+1&&(w=l+1);let S,C=0,k="",T=0,R=0,N=0,j=0,A=!1,D=0,B=!1,K=0,z=0,U=[],H=d!==-1&&p!==-1;for(let F=0;F<w;F++){e.loadCell(F,this._workCell);let q=this._workCell.getWidth();if(q===0)continue;let $=!1,P=F>=z,V=F,W=this._workCell;if(_.length>0&&F===_[0][0]&&P){let _e=_.shift(),Le=this._isCellInSelection(_e[0],t);for(T=_e[0]+1;T<_e[1];T++)P&&(P=Le===this._isCellInSelection(T,t));P&&(P=!n||l<_e[0]||l>=_e[1]),P?($=!0,W=new E$(this._workCell,e.translateToString(!0,_e[0],_e[1]),_e[1]-_e[0]),V=_e[1]-1,q=W.getWidth()):z=_e[1]}let Z=this._isCellInSelection(F,t),M=n&&F===l,I=H&&F>=d&&F<=p,X=!1;this._decorationService.forEachDecorationAtCell(F,t,void 0,_e=>{X=!0});let L=W.getChars()||no;if(L===" "&&(W.isUnderline()||W.isOverline())&&(L=" "),K=q*u-h.get(L,W.isBold(),W.isItalic()),!S)S=this._document.createElement("span");else if(C&&(Z&&B||!Z&&!B&&W.bg===R)&&(Z&&B&&y.selectionForeground||W.fg===N)&&W.extended.ext===j&&I===A&&K===D&&!M&&!$&&!X&&P){W.isInvisible()?k+=no:k+=L,C++;continue}else C&&(S.textContent=k),S=this._document.createElement("span"),C=0,k="";if(R=W.bg,N=W.fg,j=W.extended.ext,A=I,D=K,B=Z,$&&l>=F&&l<=V&&(l=F),!this._coreService.isCursorHidden&&M&&this._coreService.isCursorInitialized){if(U.push("xterm-cursor"),this._coreBrowserService.isFocused)a&&U.push("xterm-cursor-blink"),U.push(r==="bar"?"xterm-cursor-bar":r==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(s)switch(s){case"outline":U.push("xterm-cursor-outline");break;case"block":U.push("xterm-cursor-block");break;case"bar":U.push("xterm-cursor-bar");break;case"underline":U.push("xterm-cursor-underline");break}}if(W.isBold()&&U.push("xterm-bold"),W.isItalic()&&U.push("xterm-italic"),W.isDim()&&U.push("xterm-dim"),W.isInvisible()?k=no:k=W.getChars()||no,W.isUnderline()&&(U.push(`xterm-underline-${W.extended.underlineStyle}`),k===" "&&(k=" "),!W.isUnderlineColorDefault()))if(W.isUnderlineColorRGB())S.style.textDecorationColor=`rgb(${Ju.toColorRGB(W.getUnderlineColor()).join(",")})`;else{let _e=W.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&W.isBold()&&_e<8&&(_e+=8),S.style.textDecorationColor=y.ansi[_e].css}W.isOverline()&&(U.push("xterm-overline"),k===" "&&(k=" ")),W.isStrikethrough()&&U.push("xterm-strikethrough"),I&&(S.style.textDecoration="underline");let oe=W.getFgColor(),ae=W.getFgColorMode(),se=W.getBgColor(),J=W.getBgColorMode(),re=!!W.isInverse();if(re){let _e=oe;oe=se,se=_e;let Le=ae;ae=J,J=Le}let he,ve,Ce=!1;this._decorationService.forEachDecorationAtCell(F,t,void 0,_e=>{_e.options.layer!=="top"&&Ce||(_e.backgroundColorRGB&&(J=50331648,se=_e.backgroundColorRGB.rgba>>8&16777215,he=_e.backgroundColorRGB),_e.foregroundColorRGB&&(ae=50331648,oe=_e.foregroundColorRGB.rgba>>8&16777215,ve=_e.foregroundColorRGB),Ce=_e.options.layer==="top")}),!Ce&&Z&&(he=this._coreBrowserService.isFocused?y.selectionBackgroundOpaque:y.selectionInactiveBackgroundOpaque,se=he.rgba>>8&16777215,J=50331648,Ce=!0,y.selectionForeground&&(ae=50331648,oe=y.selectionForeground.rgba>>8&16777215,ve=y.selectionForeground)),Ce&&U.push("xterm-decoration-top");let ce;switch(J){case 16777216:case 33554432:ce=y.ansi[se],U.push(`xterm-bg-${se}`);break;case 50331648:ce=Qt.toColor(se>>16,se>>8&255,se&255),this._addStyle(S,`background-color:#${j2((se>>>0).toString(16),"0",6)}`);break;case 0:default:re?(ce=y.foreground,U.push("xterm-bg-257")):ce=y.background}switch(he||W.isDim()&&(he=Tt.multiplyOpacity(ce,.5)),ae){case 16777216:case 33554432:W.isBold()&&oe<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(oe+=8),this._applyMinimumContrast(S,ce,y.ansi[oe],W,he,void 0)||U.push(`xterm-fg-${oe}`);break;case 50331648:let _e=Qt.toColor(oe>>16&255,oe>>8&255,oe&255);this._applyMinimumContrast(S,ce,_e,W,he,ve)||this._addStyle(S,`color:#${j2(oe.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(S,ce,y.foreground,W,he,ve)||re&&U.push("xterm-fg-257")}U.length&&(S.className=U.join(" "),U.length=0),!M&&!$&&!X&&P?C++:S.textContent=k,K!==this.defaultSpacing&&(S.style.letterSpacing=`${K}px`),m.push(S),F=V}return S&&C&&(S.textContent=k),m}_applyMinimumContrast(e,t,n,r,s,l){if(this._optionsService.rawOptions.minimumContrastRatio===1||M$(r.getCode()))return!1;let a=this._getContrastCache(r),u;if(!s&&!l&&(u=a.getColor(t.rgba,n.rgba)),u===void 0){let h=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);u=Tt.ensureContrastRatio(s||t,l||n,h),a.setColor((s||t).rgba,(l||n).rgba,u??null)}return u?(this._addStyle(e,`color:${u.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute("style",`${e.getAttribute("style")||""}${t};`)}_isCellInSelection(e,t){let n=this._selectionStart,r=this._selectionEnd;return!n||!r?!1:this._columnSelectMode?n[0]<=r[0]?e>=n[0]&&t>=n[1]&&e<r[0]&&t<=r[1]:e<n[0]&&t>=n[1]&&e>=r[0]&&t<=r[1]:t>n[1]&&t<r[1]||n[1]===r[1]&&t===n[1]&&e>=n[0]&&e<r[0]||n[1]<r[1]&&t===r[1]&&e<r[0]||n[1]<r[1]&&t===n[1]&&e>=n[0]}};ry=It([ke(1,jN),ke(2,Kn),ke(3,vs),ke(4,hl),ke(5,ed),ke(6,Fa)],ry);function j2(e,t,n){for(;e.length<n;)e=t+e;return e}var A$=class{constructor(e,t){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=e.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";let n=e.createElement("span");n.classList.add("xterm-char-measure-element");let r=e.createElement("span");r.classList.add("xterm-char-measure-element"),r.style.fontWeight="bold";let s=e.createElement("span");s.classList.add("xterm-char-measure-element"),s.style.fontStyle="italic";let l=e.createElement("span");l.classList.add("xterm-char-measure-element"),l.style.fontWeight="bold",l.style.fontStyle="italic",this._measureElements=[n,r,s,l],this._container.appendChild(n),this._container.appendChild(r),this._container.appendChild(s),this._container.appendChild(l),t.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,t,n,r){e===this._font&&t===this._fontSize&&n===this._weight&&r===this._weightBold||(this._font=e,this._fontSize=t,this._weight=n,this._weightBold=r,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${n}`,this._measureElements[1].style.fontWeight=`${r}`,this._measureElements[2].style.fontWeight=`${n}`,this._measureElements[3].style.fontWeight=`${r}`,this.clear())}get(e,t,n){let r=0;if(!t&&!n&&e.length===1&&(r=e.charCodeAt(0))<256){if(this._flat[r]!==-9999)return this._flat[r];let a=this._measure(e,0);return a>0&&(this._flat[r]=a),a}let s=e;t&&(s+="B"),n&&(s+="I");let l=this._holey.get(s);if(l===void 0){let a=0;t&&(a|=1),n&&(a|=2),l=this._measure(e,a),l>0&&this._holey.set(s,l)}return l}_measure(e,t){let n=this._measureElements[t];return n.textContent=e.repeat(32),n.offsetWidth/32}},D$=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,n,r=!1){if(this.selectionStart=t,this.selectionEnd=n,!t||!n||t[0]===n[0]&&t[1]===n[1]){this.clear();return}let s=e.buffers.active.ydisp,l=t[1]-s,a=n[1]-s,u=Math.max(l,0),h=Math.min(a,e.rows-1);if(u>=e.rows||h<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=l,this.viewportEndRow=a,this.viewportCappedStartRow=u,this.viewportCappedEndRow=h,this.startCol=t[0],this.endCol=n[0]}isCellSelected(e,t,n){return this.hasSelection?(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&n>=this.viewportCappedStartRow&&t<this.endCol&&n<=this.viewportCappedEndRow:t<this.startCol&&n>=this.viewportCappedStartRow&&t>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol):!1}};function O$(){return new D$}var Mv="xterm-dom-renderer-owner-",Hr="xterm-rows",Bh="xterm-fg-",z2="xterm-bg-",$c="xterm-focus",Ih="xterm-selection",L$=1,iy=class extends Ke{constructor(e,t,n,r,s,l,a,u,h,d,p,m,_,y){super(),this._terminal=e,this._document=t,this._element=n,this._screenElement=r,this._viewportElement=s,this._helperContainer=l,this._linkifier2=a,this._charSizeService=h,this._optionsService=d,this._bufferService=p,this._coreService=m,this._coreBrowserService=_,this._themeService=y,this._terminalClass=L$++,this._rowElements=[],this._selectionRenderModel=O$(),this.onRequestRedraw=this._register(new we).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(Hr),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(Ih),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=N$(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(w=>this._injectCss(w))),this._injectCss(this._themeService.colors),this._rowFactory=u.createInstance(ry,document),this._element.classList.add(Mv+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(w=>this._handleLinkHover(w))),this._register(this._linkifier2.onHideLinkUnderline(w=>this._handleLinkLeave(w))),this._register(Dt(()=>{this._element.classList.remove(Mv+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new A$(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let n of this._rowElements)n.style.width=`${this.dimensions.css.canvas.width}px`,n.style.height=`${this.dimensions.css.cell.height}px`,n.style.lineHeight=`${this.dimensions.css.cell.height}px`,n.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${Hr} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .${Hr} { pointer-events: none; color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;t+=`${this._terminalSelector} .${Hr} .xterm-dim { color: ${Tt.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let n=`blink_underline_${this._terminalClass}`,r=`blink_bar_${this._terminalClass}`,s=`blink_block_${this._terminalClass}`;t+=`@keyframes ${n} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${r} { 50% { box-shadow: none; }}`,t+=`@keyframes ${s} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${Hr}.${$c} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${Hr}.${$c} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${Hr}.${$c} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${s} 1s step-end infinite;}${this._terminalSelector} .${Hr} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${Hr} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${Hr} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${Hr} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${Hr} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${Ih} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${Ih} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${Ih} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[l,a]of e.ansi.entries())t+=`${this._terminalSelector} .${Bh}${l} { color: ${a.css}; }${this._terminalSelector} .${Bh}${l}.xterm-dim { color: ${Tt.multiplyOpacity(a,.5).css}; }${this._terminalSelector} .${z2}${l} { background-color: ${a.css}; }`;t+=`${this._terminalSelector} .${Bh}257 { color: ${Tt.opaque(e.background).css}; }${this._terminalSelector} .${Bh}257.xterm-dim { color: ${Tt.multiplyOpacity(Tt.opaque(e.background),.5).css}; }${this._terminalSelector} .${z2}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let n=this._rowElements.length;n<=t;n++){let r=this._document.createElement("div");this._rowContainer.appendChild(r),this._rowElements.push(r)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove($c),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add($c),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,n){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,n),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,n),!this._selectionRenderModel.hasSelection))return;let r=this._selectionRenderModel.viewportStartRow,s=this._selectionRenderModel.viewportEndRow,l=this._selectionRenderModel.viewportCappedStartRow,a=this._selectionRenderModel.viewportCappedEndRow,u=this._document.createDocumentFragment();if(n){let h=e[0]>t[0];u.appendChild(this._createSelectionElement(l,h?t[0]:e[0],h?e[0]:t[0],a-l+1))}else{let h=r===l?e[0]:0,d=l===s?t[0]:this._bufferService.cols;u.appendChild(this._createSelectionElement(l,h,d));let p=a-l-1;if(u.appendChild(this._createSelectionElement(l+1,0,this._bufferService.cols,p)),l!==a){let m=s===a?t[0]:this._bufferService.cols;u.appendChild(this._createSelectionElement(a,0,m))}}this._selectionContainer.appendChild(u)}_createSelectionElement(e,t,n,r=1){let s=this._document.createElement("div"),l=t*this.dimensions.css.cell.width,a=this.dimensions.css.cell.width*(n-t);return l+a>this.dimensions.css.canvas.width&&(a=this.dimensions.css.canvas.width-l),s.style.height=`${r*this.dimensions.css.cell.height}px`,s.style.top=`${e*this.dimensions.css.cell.height}px`,s.style.left=`${l}px`,s.style.width=`${a}px`,s}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let n=this._bufferService.buffer,r=n.ybase+n.y,s=Math.min(n.x,this._bufferService.cols-1),l=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,a=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,u=this._optionsService.rawOptions.cursorInactiveStyle;for(let h=e;h<=t;h++){let d=h+n.ydisp,p=this._rowElements[h],m=n.lines.get(d);if(!p||!m)break;p.replaceChildren(...this._rowFactory.createRow(m,d,d===r,a,u,s,l,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${Mv}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,n,r,s,l){n<0&&(e=0),r<0&&(t=0);let a=this._bufferService.rows-1;n=Math.max(Math.min(n,a),0),r=Math.max(Math.min(r,a),0),s=Math.min(s,this._bufferService.cols);let u=this._bufferService.buffer,h=u.ybase+u.y,d=Math.min(u.x,s-1),p=this._optionsService.rawOptions.cursorBlink,m=this._optionsService.rawOptions.cursorStyle,_=this._optionsService.rawOptions.cursorInactiveStyle;for(let y=n;y<=r;++y){let w=y+u.ydisp,S=this._rowElements[y],C=u.lines.get(w);if(!S||!C)break;S.replaceChildren(...this._rowFactory.createRow(C,w,w===h,m,_,d,p,this.dimensions.css.cell.width,this._widthCache,l?y===n?e:0:-1,l?(y===r?t:s)-1:-1))}}};iy=It([ke(7,e0),ke(8,Rp),ke(9,Kn),ke(10,qn),ke(11,hl),ke(12,vs),ke(13,Fa)],iy);var sy=class extends Ke{constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new we),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new z$(this._optionsService))}catch{this._measureStrategy=this._register(new j$(e,t,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}measure(){let e=this._measureStrategy.measure();(e.width!==this.width||e.height!==this.height)&&(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};sy=It([ke(2,Kn)],sy);var eA=class extends Ke{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){e!==void 0&&e>0&&t!==void 0&&t>0&&(this._result.width=e,this._result.height=t)}},j$=class extends eA{constructor(e,t,n){super(),this._document=e,this._parentElement=t,this._optionsService=n,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}},z$=class extends eA{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let t=this._ctx.measureText("W");if(!("width"in t&&"fontBoundingBoxAscent"in t&&"fontBoundingBoxDescent"in t))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText("W");return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}},P$=class extends Ke{constructor(e,t,n){super(),this._textarea=e,this._window=t,this.mainDocument=n,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new B$(this._window)),this._onDprChange=this._register(new we),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new we),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(r=>this._screenDprMonitor.setWindow(r))),this._register(Nn.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(Ie(this._textarea,"focus",()=>this._isFocused=!0)),this._register(Ie(this._textarea,"blur",()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}},B$=class extends Ke{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new ka),this._onDprChange=this._register(new we),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(Dt(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=Ie(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var e;this._outerListener&&((e=this._resolutionMediaMatchList)==null||e.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){!this._resolutionMediaMatchList||!this._outerListener||(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}},I$=class extends Ke{constructor(){super(),this.linkProviders=[],this._register(Dt(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);t!==-1&&this.linkProviders.splice(t,1)}}}};function a0(e,t,n){let r=n.getBoundingClientRect(),s=e.getComputedStyle(n),l=parseInt(s.getPropertyValue("padding-left")),a=parseInt(s.getPropertyValue("padding-top"));return[t.clientX-r.left-l,t.clientY-r.top-a]}function H$(e,t,n,r,s,l,a,u,h){if(!l)return;let d=a0(e,t,n);if(d)return d[0]=Math.ceil((d[0]+(h?a/2:0))/a),d[1]=Math.ceil(d[1]/u),d[0]=Math.min(Math.max(d[0],1),r+(h?1:0)),d[1]=Math.min(Math.max(d[1],1),s),d}var oy=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,r,s){return H$(window,e,t,n,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,s)}getMouseReportCoords(e,t){let n=a0(window,e,t);if(this._charSizeService.hasValidSize)return n[0]=Math.min(Math.max(n[0],0),this._renderService.dimensions.css.canvas.width-1),n[1]=Math.min(Math.max(n[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(n[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(n[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(n[0]),y:Math.floor(n[1])}}};oy=It([ke(0,_s),ke(1,Rp)],oy);var F$=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(e,t,n){this._rowCount=n,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t,!this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0){this._runRefreshCallbacks();return}let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},tA={};ZF(tA,{getSafariVersion:()=>$$,isChromeOS:()=>sA,isFirefox:()=>nA,isIpad:()=>W$,isIphone:()=>V$,isLegacyEdge:()=>U$,isLinux:()=>c0,isMac:()=>Uf,isNode:()=>Tp,isSafari:()=>rA,isWindows:()=>iA});var Tp=typeof process<"u"&&"title"in process,td=Tp?"node":navigator.userAgent,nd=Tp?"node":navigator.platform,nA=td.includes("Firefox"),U$=td.includes("Edge"),rA=/^((?!chrome|android).)*safari/i.test(td);function $$(){if(!rA)return 0;let e=td.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var Uf=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(nd),W$=nd==="iPad",V$=nd==="iPhone",iA=["Windows","Win16","Win32","WinCE"].includes(nd),c0=nd.indexOf("Linux")>=0,sA=/\bCrOS\b/.test(td),oA=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let t=0,n=0,r=e.timeRemaining(),s=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),n=Math.max(t,n),s=e.timeRemaining(),n*1.5>s){r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),this._start();return}r=s}this.clear()}},q$=class extends oA{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=performance.now()+e;return{timeRemaining:()=>Math.max(0,t-performance.now())}}},K$=class extends oA{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},$f=!Tp&&"requestIdleCallback"in window?K$:q$,G$=class{constructor(){this._queue=new $f}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},ly=class extends Ke{constructor(e,t,n,r,s,l,a,u,h){super(),this._rowCount=e,this._optionsService=n,this._charSizeService=r,this._coreService=s,this._coreBrowserService=u,this._renderer=this._register(new ka),this._pausedResizeTask=new G$,this._observerDisposable=this._register(new ka),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this._register(new we),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new we),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new we),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new we),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new F$((d,p)=>this._renderRows(d,p),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new Y$(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(Dt(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(a.onResize(()=>this._fullRefresh())),this._register(a.buffers.onBufferActivate(()=>{var d;return(d=this._renderer.value)==null?void 0:d.clear()})),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(l.onDecorationRegistered(()=>this._fullRefresh())),this._register(l.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(a.cols,a.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(a.buffer.y,a.buffer.y,!0))),this._register(h.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(d=>this._registerIntersectionObserver(d,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let n=new e.IntersectionObserver(r=>this._handleIntersectionChange(r[r.length-1]),{threshold:0});n.observe(t),this._observerDisposable.value=Dt(()=>n.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,n=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let r=this._syncOutputHandler.flush();r&&(e=Math.min(e,r.start),t=Math.max(t,r.end)),n||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0}}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(t=>this.refreshRows(t.start,t.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var e,t;this._renderer.value&&((t=(e=this._renderer.value).clearTextureAtlas)==null||t.call(e),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>{var n;return(n=this._renderer.value)==null?void 0:n.handleResize(e,t)}):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){var e;(e=this._renderer.value)==null||e.handleCharSizeChanged()}handleBlur(){var e;(e=this._renderer.value)==null||e.handleBlur()}handleFocus(){var e;(e=this._renderer.value)==null||e.handleFocus()}handleSelectionChanged(e,t,n){var r;this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=n,(r=this._renderer.value)==null||r.handleSelectionChanged(e,t,n)}handleCursorMove(){var e;(e=this._renderer.value)==null||e.handleCursorMove()}clear(){var e;(e=this._renderer.value)==null||e.clear()}};ly=It([ke(2,Kn),ke(3,Rp),ke(4,hl),ke(5,ed),ke(6,qn),ke(7,vs),ke(8,Fa)],ly);var Y$=class{constructor(e,t,n){this._coreBrowserService=e,this._coreService=t,this._onTimeout=n,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,t){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,t)):(this._start=e,this._end=t,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let e={start:this._start,end:this._end};return this._isBuffering=!1,e}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function X$(e,t,n,r){let s=n.buffer.x,l=n.buffer.y;if(!n.buffer.hasScrollback)return J$(s,l,e,t,n,r)+Mp(l,t,n,r)+eW(s,l,e,t,n,r);let a;if(l===t)return a=s>e?"D":"C",ju(Math.abs(s-e),Lu(a,r));a=l>t?"D":"C";let u=Math.abs(l-t),h=Q$(l>t?e:s,n)+(u-1)*n.cols+1+Z$(l>t?s:e);return ju(h,Lu(a,r))}function Z$(e,t){return e-1}function Q$(e,t){return t.cols-e}function J$(e,t,n,r,s,l){return Mp(t,r,s,l).length===0?"":ju(aA(e,t,e,t-rl(t,s),!1,s).length,Lu("D",l))}function Mp(e,t,n,r){let s=e-rl(e,n),l=t-rl(t,n),a=Math.abs(s-l)-tW(e,t,n);return ju(a,Lu(lA(e,t),r))}function eW(e,t,n,r,s,l){let a;Mp(t,r,s,l).length>0?a=r-rl(r,s):a=t;let u=r,h=nW(e,t,n,r,s,l);return ju(aA(e,a,n,u,h==="C",s).length,Lu(h,l))}function tW(e,t,n){var a;let r=0,s=e-rl(e,n),l=t-rl(t,n);for(let u=0;u<Math.abs(s-l);u++){let h=lA(e,t)==="A"?-1:1;(a=n.buffer.lines.get(s+h*u))!=null&&a.isWrapped&&r++}return r}function rl(e,t){let n=0,r=t.buffer.lines.get(e),s=r==null?void 0:r.isWrapped;for(;s&&e>=0&&e<t.rows;)n++,r=t.buffer.lines.get(--e),s=r==null?void 0:r.isWrapped;return n}function nW(e,t,n,r,s,l){let a;return Mp(n,r,s,l).length>0?a=r-rl(r,s):a=t,e<n&&a<=r||e>=n&&a<r?"C":"D"}function lA(e,t){return e>t?"A":"B"}function aA(e,t,n,r,s,l){let a=e,u=t,h="";for(;(a!==n||u!==r)&&u>=0&&u<l.buffer.lines.length;)a+=s?1:-1,s&&a>l.cols-1?(h+=l.buffer.translateBufferLineToString(u,!1,e,a),a=0,e=0,u++):!s&&a<0&&(h+=l.buffer.translateBufferLineToString(u,!1,0,e+1),a=l.cols-1,e=a,u--);return h+l.buffer.translateBufferLineToString(u,!1,e,a)}function Lu(e,t){let n=t?"O":"[";return ge.ESC+n+e}function ju(e,t){e=Math.floor(e);let n="";for(let r=0;r<e;r++)n+=t;return n}var rW=class{constructor(e){this._bufferService=e,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:!this.selectionEnd||!this.selectionStart?this.selectionStart:this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?e%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let e=this.selectionStart,t=this.selectionEnd;return!e||!t?!1:e[1]>t[1]||e[1]===t[1]&&e[0]>t[0]}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function P2(e,t){if(e.start.y>e.end.y)throw new Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return t*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}var Nv=50,iW=15,sW=50,oW=500,lW=" ",aW=new RegExp(lW,"g"),ay=class extends Ke{constructor(e,t,n,r,s,l,a,u,h){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=r,this._coreService=s,this._mouseService=l,this._optionsService=a,this._renderService=u,this._coreBrowserService=h,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new Kr,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new we),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new we),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new we),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new we),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=d=>this._handleMouseMove(d),this._mouseUpListener=d=>this._handleMouseUp(d),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(d=>this._handleTrim(d)),this._register(this._bufferService.buffers.onBufferActivate(d=>this._handleBufferActivate(d))),this.enable(),this._model=new rW(this._bufferService),this._activeSelectionMode=0,this._register(Dt(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(d=>{d.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";let n=this._bufferService.buffer,r=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let s=e[0]<t[0]?e[0]:t[0],l=e[0]<t[0]?t[0]:e[0];for(let a=e[1];a<=t[1];a++){let u=n.translateBufferLineToString(a,!0,s,l);r.push(u)}}else{let s=e[1]===t[1]?t[0]:void 0;r.push(n.translateBufferLineToString(e[1],!0,e[0],s));for(let l=e[1]+1;l<=t[1]-1;l++){let a=n.lines.get(l),u=n.translateBufferLineToString(l,!0);a!=null&&a.isWrapped?r[r.length-1]+=u:r.push(u)}if(e[1]!==t[1]){let l=n.lines.get(t[1]),a=n.translateBufferLineToString(t[1],!0,0,t[0]);l&&l.isWrapped?r[r.length-1]+=a:r.push(a)}}return r.map(s=>s.replace(aW," ")).join(iA?`\r
483
+ `:`
484
+ `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),c0&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r||!t?!1:this._areCoordsInSelection(t,n,r)}isCellInSelection(e,t){let n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r?!1:this._areCoordsInSelection([e,t],n,r)}_areCoordsInSelection(e,t,n){return e[1]>t[1]&&e[1]<n[1]||t[1]===n[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<n[0]||t[1]<n[1]&&e[1]===n[1]&&e[0]<n[0]||t[1]<n[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){var s,l;let n=(l=(s=this._linkifier.currentLink)==null?void 0:s.link)==null?void 0:l.range;if(n)return this._model.selectionStart=[n.start.x-1,n.start.y-1],this._model.selectionStartLength=P2(n,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let r=this._getMouseBufferCoords(e);return r?(this._selectWordAt(r,t),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=a0(this._coreBrowserService.window,e,this._screenElement)[1],n=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=n?0:(t>n&&(t-=n),t=Math.min(Math.max(t,-Nv),Nv),t/=Nv,t/Math.abs(t)+Math.round(t*(iW-1)))}shouldForceSelection(e){return Uf?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(e.button===2&&this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),sW)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&t.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(Uf&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let n=this._bufferService.buffer;if(this._model.selectionEnd[1]<n.lines.length){let r=n.lines.get(this._model.selectionEnd[1]);r&&r.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!t||t[0]!==this._model.selectionEnd[0]||t[1]!==this._model.selectionEnd[1])&&this.refresh(!0)}_dragScroll(){if(!(!this._model.selectionEnd||!this._model.selectionStart)&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let e=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<oW&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let n=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(n&&n[0]!==void 0&&n[1]!==void 0){let r=X$(n[0]-1,n[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(r,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,n=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!n){this._oldHasSelection&&this._fireOnSelectionChange(e,t,n);return}!e||!t||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||t[0]!==this._oldSelectionEnd[0]||t[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,t,n)}_fireOnSelectionChange(e,t,n){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=n,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(t=>this._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let n=t;for(let r=0;t>=r;r++){let s=e.loadCell(r,this._workCell).getChars().length;this._workCell.getWidth()===0?n--:s>1&&t!==r&&(n+=s-1)}return n}setSelection(e,t,n){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=n,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,n=!0,r=!0){if(e[0]>=this._bufferService.cols)return;let s=this._bufferService.buffer,l=s.lines.get(e[1]);if(!l)return;let a=s.translateBufferLineToString(e[1],!1),u=this._convertViewportColToCharacterIndex(l,e[0]),h=u,d=e[0]-u,p=0,m=0,_=0,y=0;if(a.charAt(u)===" "){for(;u>0&&a.charAt(u-1)===" ";)u--;for(;h<a.length&&a.charAt(h+1)===" ";)h++}else{let C=e[0],k=e[0];l.getWidth(C)===0&&(p++,C--),l.getWidth(k)===2&&(m++,k++);let T=l.getString(k).length;for(T>1&&(y+=T-1,h+=T-1);C>0&&u>0&&!this._isCharWordSeparator(l.loadCell(C-1,this._workCell));){l.loadCell(C-1,this._workCell);let R=this._workCell.getChars().length;this._workCell.getWidth()===0?(p++,C--):R>1&&(_+=R-1,u-=R-1),u--,C--}for(;k<l.length&&h+1<a.length&&!this._isCharWordSeparator(l.loadCell(k+1,this._workCell));){l.loadCell(k+1,this._workCell);let R=this._workCell.getChars().length;this._workCell.getWidth()===2?(m++,k++):R>1&&(y+=R-1,h+=R-1),h++,k++}}h++;let w=u+d-p+_,S=Math.min(this._bufferService.cols,h-u+p+m-_-y);if(!(!t&&a.slice(u,h).trim()==="")){if(n&&w===0&&l.getCodePoint(0)!==32){let C=s.lines.get(e[1]-1);if(C&&l.isWrapped&&C.getCodePoint(this._bufferService.cols-1)!==32){let k=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(k){let T=this._bufferService.cols-k.start;w-=T,S+=T}}}if(r&&w+S===this._bufferService.cols&&l.getCodePoint(this._bufferService.cols-1)!==32){let C=s.lines.get(e[1]+1);if(C!=null&&C.isWrapped&&C.getCodePoint(0)!==32){let k=this._getWordAt([0,e[1]+1],!1,!1,!0);k&&(S+=k.length)}}return{start:w,length:S}}}_selectWordAt(e,t){let n=this._getWordAt(e,t);if(n){for(;n.start<0;)n.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[n.start,e[1]],this._model.selectionStartLength=n.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let n=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,n--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,n++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,n]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),n={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=P2(n,this._bufferService.cols)}};ay=It([ke(3,qn),ke(4,hl),ke(5,t0),ke(6,Kn),ke(7,_s),ke(8,vs)],ay);var B2=class{constructor(){this._data={}}set(e,t,n){this._data[e]||(this._data[e]={}),this._data[e][t]=n}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},I2=class{constructor(){this._color=new B2,this._css=new B2}setCss(e,t,n){this._css.set(e,t,n)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,n){this._color.set(e,t,n)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},on=Object.freeze((()=>{let e=[Lt.toColor("#2e3436"),Lt.toColor("#cc0000"),Lt.toColor("#4e9a06"),Lt.toColor("#c4a000"),Lt.toColor("#3465a4"),Lt.toColor("#75507b"),Lt.toColor("#06989a"),Lt.toColor("#d3d7cf"),Lt.toColor("#555753"),Lt.toColor("#ef2929"),Lt.toColor("#8ae234"),Lt.toColor("#fce94f"),Lt.toColor("#729fcf"),Lt.toColor("#ad7fa8"),Lt.toColor("#34e2e2"),Lt.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let r=t[n/36%6|0],s=t[n/6%6|0],l=t[n%6];e.push({css:Qt.toCss(r,s,l),rgba:Qt.toRgba(r,s,l)})}for(let n=0;n<24;n++){let r=8+n*10;e.push({css:Qt.toCss(r,r,r),rgba:Qt.toRgba(r,r,r)})}return e})()),Uo=Lt.toColor("#ffffff"),ou=Lt.toColor("#000000"),H2=Lt.toColor("#ffffff"),F2=ou,Wc={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},cW=Uo,cy=class extends Ke{constructor(e){super(),this._optionsService=e,this._contrastCache=new I2,this._halfContrastCache=new I2,this._onChangeColors=this._register(new we),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:Uo,background:ou,cursor:H2,cursorAccent:F2,selectionForeground:void 0,selectionBackgroundTransparent:Wc,selectionBackgroundOpaque:Tt.blend(ou,Wc),selectionInactiveBackgroundTransparent:Wc,selectionInactiveBackgroundOpaque:Tt.blend(ou,Wc),scrollbarSliderBackground:Tt.opacity(Uo,.2),scrollbarSliderHoverBackground:Tt.opacity(Uo,.4),scrollbarSliderActiveBackground:Tt.opacity(Uo,.5),overviewRulerBorder:Uo,ansi:on.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this._register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",()=>this._contrastCache.clear())),this._register(this._optionsService.onSpecificOptionChange("theme",()=>this._setTheme(this._optionsService.rawOptions.theme)))}get colors(){return this._colors}_setTheme(e={}){let t=this._colors;if(t.foreground=vt(e.foreground,Uo),t.background=vt(e.background,ou),t.cursor=Tt.blend(t.background,vt(e.cursor,H2)),t.cursorAccent=Tt.blend(t.background,vt(e.cursorAccent,F2)),t.selectionBackgroundTransparent=vt(e.selectionBackground,Wc),t.selectionBackgroundOpaque=Tt.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=vt(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=Tt.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?vt(e.selectionForeground,L2):void 0,t.selectionForeground===L2&&(t.selectionForeground=void 0),Tt.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=Tt.opacity(t.selectionBackgroundTransparent,.3)),Tt.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=Tt.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=vt(e.scrollbarSliderBackground,Tt.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=vt(e.scrollbarSliderHoverBackground,Tt.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=vt(e.scrollbarSliderActiveBackground,Tt.opacity(t.foreground,.5)),t.overviewRulerBorder=vt(e.overviewRulerBorder,cW),t.ansi=on.slice(),t.ansi[0]=vt(e.black,on[0]),t.ansi[1]=vt(e.red,on[1]),t.ansi[2]=vt(e.green,on[2]),t.ansi[3]=vt(e.yellow,on[3]),t.ansi[4]=vt(e.blue,on[4]),t.ansi[5]=vt(e.magenta,on[5]),t.ansi[6]=vt(e.cyan,on[6]),t.ansi[7]=vt(e.white,on[7]),t.ansi[8]=vt(e.brightBlack,on[8]),t.ansi[9]=vt(e.brightRed,on[9]),t.ansi[10]=vt(e.brightGreen,on[10]),t.ansi[11]=vt(e.brightYellow,on[11]),t.ansi[12]=vt(e.brightBlue,on[12]),t.ansi[13]=vt(e.brightMagenta,on[13]),t.ansi[14]=vt(e.brightCyan,on[14]),t.ansi[15]=vt(e.brightWhite,on[15]),e.extendedAnsi){let n=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let r=0;r<n;r++)t.ansi[r+16]=vt(e.extendedAnsi[r],on[r+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(e===void 0){for(let t=0;t<this._restoreColors.ansi.length;++t)this._colors.ansi[t]=this._restoreColors.ansi[t];return}switch(e){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[e]=this._restoreColors.ansi[e]}}modifyColors(e){e(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};cy=It([ke(0,Kn)],cy);function vt(e,t){if(e!==void 0)try{return Lt.toColor(e)}catch{}return t}var uW=class{constructor(...e){this._entries=new Map;for(let[t,n]of e)this.set(t,n)}set(e,t){let n=this._entries.get(e);return this._entries.set(e,t),n}forEach(e){for(let[t,n]of this._entries.entries())e(t,n)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},dW=class{constructor(){this._services=new uW,this._services.set(e0,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=iU(e).sort((l,a)=>l.index-a.index),r=[];for(let l of n){let a=this._services.get(l.id);if(!a)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${l.id._id}.`);r.push(a)}let s=n.length>0?n[0].index:t.length;if(t.length!==s)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${s+1} conflicts with ${t.length} static arguments`);return new e(...t,...r)}},hW={trace:0,debug:1,info:2,warn:3,error:4,off:5},fW="xterm.js: ",uy=class extends Ke{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=hW[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]=="function"&&(e[t]=e[t]())}_log(e,t,n){this._evalLazyOptionalParams(n),e.call(console,(this._optionsService.options.logger?"":fW)+t,...n)}trace(e,...t){var n;this._logLevel<=0&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.trace.bind(this._optionsService.options.logger))??console.log,e,t)}debug(e,...t){var n;this._logLevel<=1&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.debug.bind(this._optionsService.options.logger))??console.log,e,t)}info(e,...t){var n;this._logLevel<=2&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.info.bind(this._optionsService.options.logger))??console.info,e,t)}warn(e,...t){var n;this._logLevel<=3&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.warn.bind(this._optionsService.options.logger))??console.warn,e,t)}error(e,...t){var n;this._logLevel<=4&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.error.bind(this._optionsService.options.logger))??console.error,e,t)}};uy=It([ke(0,Kn)],uy);var U2=class extends Ke{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new we),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new we),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new we),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=new Array(e);for(let n=0;n<Math.min(e,this.length);n++)t[n]=this._array[this._getCyclicIndex(n)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,t,...n){if(t){for(let r=e;r<this._length-t;r++)this._array[this._getCyclicIndex(r)]=this._array[this._getCyclicIndex(r+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let r=this._length-1;r>=e;r--)this._array[this._getCyclicIndex(r+n.length)]=this._array[this._getCyclicIndex(r)];for(let r=0;r<n.length;r++)this._array[this._getCyclicIndex(e+r)]=n[r];if(n.length&&this.onInsertEmitter.fire({index:e,amount:n.length}),this._length+n.length>this._maxLength){let r=this._length+n.length-this._maxLength;this._startIndex+=r,this._length=this._maxLength,this.onTrimEmitter.fire(r)}else this._length+=n.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,n){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+n<0)throw new Error("Cannot shift elements in list beyond index 0");if(n>0){for(let s=t-1;s>=0;s--)this.set(e+s+n,this.get(e+s));let r=e+t+n-this._length;if(r>0)for(this._length+=r;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let r=0;r<t;r++)this.set(e+r+n,this.get(e+r))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},Ve=3,Zt=Object.freeze(new Ju),Hh=0,Av=2,lu=class cA{constructor(t,n,r=!1){this.isWrapped=r,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*Ve);let s=n||Kr.fromCharData([0,TN,1,0]);for(let l=0;l<t;++l)this.setCell(l,s);this.length=t}get(t){let n=this._data[t*Ve+0],r=n&2097151;return[this._data[t*Ve+1],n&2097152?this._combined[t]:r?Js(r):"",n>>22,n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):r]}set(t,n){this._data[t*Ve+1]=n[0],n[1].length>1?(this._combined[t]=n[1],this._data[t*Ve+0]=t|2097152|n[2]<<22):this._data[t*Ve+0]=n[1].charCodeAt(0)|n[2]<<22}getWidth(t){return this._data[t*Ve+0]>>22}hasWidth(t){return this._data[t*Ve+0]&12582912}getFg(t){return this._data[t*Ve+1]}getBg(t){return this._data[t*Ve+2]}hasContent(t){return this._data[t*Ve+0]&4194303}getCodePoint(t){let n=this._data[t*Ve+0];return n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):n&2097151}isCombined(t){return this._data[t*Ve+0]&2097152}getString(t){let n=this._data[t*Ve+0];return n&2097152?this._combined[t]:n&2097151?Js(n&2097151):""}isProtected(t){return this._data[t*Ve+2]&536870912}loadCell(t,n){return Hh=t*Ve,n.content=this._data[Hh+0],n.fg=this._data[Hh+1],n.bg=this._data[Hh+2],n.content&2097152&&(n.combinedData=this._combined[t]),n.bg&268435456&&(n.extended=this._extendedAttrs[t]),n}setCell(t,n){n.content&2097152&&(this._combined[t]=n.combinedData),n.bg&268435456&&(this._extendedAttrs[t]=n.extended),this._data[t*Ve+0]=n.content,this._data[t*Ve+1]=n.fg,this._data[t*Ve+2]=n.bg}setCellFromCodepoint(t,n,r,s){s.bg&268435456&&(this._extendedAttrs[t]=s.extended),this._data[t*Ve+0]=n|r<<22,this._data[t*Ve+1]=s.fg,this._data[t*Ve+2]=s.bg}addCodepointToCell(t,n,r){let s=this._data[t*Ve+0];s&2097152?this._combined[t]+=Js(n):s&2097151?(this._combined[t]=Js(s&2097151)+Js(n),s&=-2097152,s|=2097152):s=n|1<<22,r&&(s&=-12582913,s|=r<<22),this._data[t*Ve+0]=s}insertCells(t,n,r){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),n<this.length-t){let s=new Kr;for(let l=this.length-t-n-1;l>=0;--l)this.setCell(t+n+l,this.loadCell(t+l,s));for(let l=0;l<n;++l)this.setCell(t+l,r)}else for(let s=t;s<this.length;++s)this.setCell(s,r);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,r)}deleteCells(t,n,r){if(t%=this.length,n<this.length-t){let s=new Kr;for(let l=0;l<this.length-t-n;++l)this.setCell(t+l,this.loadCell(t+n+l,s));for(let l=this.length-n;l<this.length;++l)this.setCell(l,r)}else for(let s=t;s<this.length;++s)this.setCell(s,r);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),this.getWidth(t)===0&&!this.hasContent(t)&&this.setCellFromCodepoint(t,0,1,r)}replaceCells(t,n,r,s=!1){if(s){for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,r),n<this.length&&this.getWidth(n-1)===2&&!this.isProtected(n)&&this.setCellFromCodepoint(n,0,1,r);t<n&&t<this.length;)this.isProtected(t)||this.setCell(t,r),t++;return}for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),n<this.length&&this.getWidth(n-1)===2&&this.setCellFromCodepoint(n,0,1,r);t<n&&t<this.length;)this.setCell(t++,r)}resize(t,n){if(t===this.length)return this._data.length*4*Av<this._data.buffer.byteLength;let r=t*Ve;if(t>this.length){if(this._data.buffer.byteLength>=r*4)this._data=new Uint32Array(this._data.buffer,0,r);else{let s=new Uint32Array(r);s.set(this._data),this._data=s}for(let s=this.length;s<t;++s)this.setCell(s,n)}else{this._data=this._data.subarray(0,r);let s=Object.keys(this._combined);for(let a=0;a<s.length;a++){let u=parseInt(s[a],10);u>=t&&delete this._combined[u]}let l=Object.keys(this._extendedAttrs);for(let a=0;a<l.length;a++){let u=parseInt(l[a],10);u>=t&&delete this._extendedAttrs[u]}}return this.length=t,r*4*Av<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*Av<this._data.buffer.byteLength){let t=new Uint32Array(this._data.length);return t.set(this._data),this._data=t,1}return 0}fill(t,n=!1){if(n){for(let r=0;r<this.length;++r)this.isProtected(r)||this.setCell(r,t);return}this._combined={},this._extendedAttrs={};for(let r=0;r<this.length;++r)this.setCell(r,t)}copyFrom(t){this.length!==t.length?this._data=new Uint32Array(t._data):this._data.set(t._data),this.length=t.length,this._combined={};for(let n in t._combined)this._combined[n]=t._combined[n];this._extendedAttrs={};for(let n in t._extendedAttrs)this._extendedAttrs[n]=t._extendedAttrs[n];this.isWrapped=t.isWrapped}clone(){let t=new cA(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let n in this._combined)t._combined[n]=this._combined[n];for(let n in this._extendedAttrs)t._extendedAttrs[n]=this._extendedAttrs[n];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*Ve+0]&4194303)return t+(this._data[t*Ve+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*Ve+0]&4194303||this._data[t*Ve+2]&50331648)return t+(this._data[t*Ve+0]>>22);return 0}copyCellsFrom(t,n,r,s,l){let a=t._data;if(l)for(let h=s-1;h>=0;h--){for(let d=0;d<Ve;d++)this._data[(r+h)*Ve+d]=a[(n+h)*Ve+d];a[(n+h)*Ve+2]&268435456&&(this._extendedAttrs[r+h]=t._extendedAttrs[n+h])}else for(let h=0;h<s;h++){for(let d=0;d<Ve;d++)this._data[(r+h)*Ve+d]=a[(n+h)*Ve+d];a[(n+h)*Ve+2]&268435456&&(this._extendedAttrs[r+h]=t._extendedAttrs[n+h])}let u=Object.keys(t._combined);for(let h=0;h<u.length;h++){let d=parseInt(u[h],10);d>=n&&(this._combined[d-n+r]=t._combined[d])}}translateToString(t,n,r,s){n=n??0,r=r??this.length,t&&(r=Math.min(r,this.getTrimmedLength())),s&&(s.length=0);let l="";for(;n<r;){let a=this._data[n*Ve+0],u=a&2097151,h=a&2097152?this._combined[n]:u?Js(u):no;if(l+=h,s)for(let d=0;d<h.length;++d)s.push(n);n+=a>>22||1}return s&&s.push(n),l}};function pW(e,t,n,r,s,l){let a=[];for(let u=0;u<e.length-1;u++){let h=u,d=e.get(++h);if(!d.isWrapped)continue;let p=[e.get(u)];for(;h<e.length&&d.isWrapped;)p.push(d),d=e.get(++h);if(!l&&r>=u&&r<h){u+=p.length-1;continue}let m=0,_=zu(p,m,t),y=1,w=0;for(;y<p.length;){let C=zu(p,y,t),k=C-w,T=n-_,R=Math.min(k,T);p[m].copyCellsFrom(p[y],w,_,R,!1),_+=R,_===n&&(m++,_=0),w+=R,w===C&&(y++,w=0),_===0&&m!==0&&p[m-1].getWidth(n-1)===2&&(p[m].copyCellsFrom(p[m-1],n-1,_++,1,!1),p[m-1].setCell(n-1,s))}p[m].replaceCells(_,n,s);let S=0;for(let C=p.length-1;C>0&&(C>m||p[C].getTrimmedLength()===0);C--)S++;S>0&&(a.push(u+p.length-S),a.push(S)),u+=p.length-1}return a}function mW(e,t){let n=[],r=0,s=t[r],l=0;for(let a=0;a<e.length;a++)if(s===a){let u=t[++r];e.onDeleteEmitter.fire({index:a-l,amount:u}),a+=u-1,l+=u,s=t[++r]}else n.push(a);return{layout:n,countRemoved:l}}function gW(e,t){let n=[];for(let r=0;r<t.length;r++)n.push(e.get(t[r]));for(let r=0;r<n.length;r++)e.set(r,n[r]);e.length=t.length}function vW(e,t,n){let r=[],s=e.map((h,d)=>zu(e,d,t)).reduce((h,d)=>h+d),l=0,a=0,u=0;for(;u<s;){if(s-u<n){r.push(s-u);break}l+=n;let h=zu(e,a,t);l>h&&(l-=h,a++);let d=e[a].getWidth(l-1)===2;d&&l--;let p=d?n-1:n;r.push(p),u+=p}return r}function zu(e,t,n){if(t===e.length-1)return e[t].getTrimmedLength();let r=!e[t].hasContent(n-1)&&e[t].getWidth(n-1)===1,s=e[t+1].getWidth(0)===2;return r&&s?n-1:n}var uA=class dA{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=dA._nextId++,this._onDispose=this.register(new we),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),nl(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};uA._nextId=1;var _W=uA,cn={},$o=cn.B;cn[0]={"`":"◆",a:"▒",b:"␉",c:"␌",d:"␍",e:"␊",f:"°",g:"±",h:"␤",i:"␋",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"};cn.A={"#":"£"};cn.B=void 0;cn[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};cn.C=cn[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};cn.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};cn.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};cn.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};cn.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};cn.E=cn[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};cn.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};cn.H=cn[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};cn["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var $2=4294967295,W2=class{constructor(e,t,n){this._hasScrollback=e,this._optionsService=t,this._bufferService=n,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=Zt.clone(),this.savedCharset=$o,this.markers=[],this._nullCell=Kr.fromCharData([0,TN,1,0]),this._whitespaceCell=Kr.fromCharData([0,no,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new $f,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new U2(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new If),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new If),this._whitespaceCell}getBlankLine(e,t){return new lu(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let t=e+this._optionsService.rawOptions.scrollback;return t>$2?$2:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=Zt);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new U2(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(Zt),r=0,s=this._getCorrectBufferLength(t);if(s>this.lines.maxLength&&(this.lines.maxLength=s),this.lines.length>0){if(this._cols<e)for(let a=0;a<this.lines.length;a++)r+=+this.lines.get(a).resize(e,n);let l=0;if(this._rows<t)for(let a=this._rows;a<t;a++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new lu(e,n)):this.ybase>0&&this.lines.length<=this.ybase+this.y+l+1?(this.ybase--,l++,this.ydisp>0&&this.ydisp--):this.lines.push(new lu(e,n)));else for(let a=this._rows;a>t;a--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(s<this.lines.maxLength){let a=this.lines.length-s;a>0&&(this.lines.trimStart(a),this.ybase=Math.max(this.ybase-a,0),this.ydisp=Math.max(this.ydisp-a,0),this.savedY=Math.max(this.savedY-a,0)),this.lines.maxLength=s}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),l&&(this.y+=l),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let l=0;l<this.lines.length;l++)r+=+this.lines.get(l).resize(e,n);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),r>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend==="conpty"&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,r=pW(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(Zt),n);if(r.length>0){let s=mW(this.lines,r);gW(this.lines,s.layout),this._reflowLargerAdjustViewport(e,t,s.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let r=this.getNullCell(Zt),s=n;for(;s-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new lu(e,r))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-n,0)}_reflowSmaller(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,r=this.getNullCell(Zt),s=[],l=0;for(let a=this.lines.length-1;a>=0;a--){let u=this.lines.get(a);if(!u||!u.isWrapped&&u.getTrimmedLength()<=e)continue;let h=[u];for(;u.isWrapped&&a>0;)u=this.lines.get(--a),h.unshift(u);if(!n){let R=this.ybase+this.y;if(R>=a&&R<a+h.length)continue}let d=h[h.length-1].getTrimmedLength(),p=vW(h,this._cols,e),m=p.length-h.length,_;this.ybase===0&&this.y!==this.lines.length-1?_=Math.max(0,this.y-this.lines.maxLength+m):_=Math.max(0,this.lines.length-this.lines.maxLength+m);let y=[];for(let R=0;R<m;R++){let N=this.getBlankLine(Zt,!0);y.push(N)}y.length>0&&(s.push({start:a+h.length+l,newLines:y}),l+=y.length),h.push(...y);let w=p.length-1,S=p[w];S===0&&(w--,S=p[w]);let C=h.length-m-1,k=d;for(;C>=0;){let R=Math.min(k,S);if(h[w]===void 0)break;if(h[w].copyCellsFrom(h[C],k-R,S-R,R,!0),S-=R,S===0&&(w--,S=p[w]),k-=R,k===0){C--;let N=Math.max(C,0);k=zu(h,N,this._cols)}}for(let R=0;R<h.length;R++)p[R]<e&&h[R].setCell(p[R],r);let T=m-_;for(;T-- >0;)this.ybase===0?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+l)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+m,this.ybase+t-1)}if(s.length>0){let a=[],u=[];for(let S=0;S<this.lines.length;S++)u.push(this.lines.get(S));let h=this.lines.length,d=h-1,p=0,m=s[p];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+l);let _=0;for(let S=Math.min(this.lines.maxLength-1,h+l-1);S>=0;S--)if(m&&m.start>d+_){for(let C=m.newLines.length-1;C>=0;C--)this.lines.set(S--,m.newLines[C]);S++,a.push({index:d+1,amount:m.newLines.length}),_+=m.newLines.length,m=s[++p]}else this.lines.set(S,u[d--]);let y=0;for(let S=a.length-1;S>=0;S--)a[S].index+=y,this.lines.onInsertEmitter.fire(a[S]),y+=a[S].amount;let w=Math.max(0,h+l-this.lines.maxLength);w>0&&this.lines.onTrimEmitter.fire(w)}}translateBufferLineToString(e,t,n=0,r){let s=this.lines.get(e);return s?s.translateToString(t,n,r):""}getWrappedRangeForLine(e){let t=e,n=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;n+1<this.lines.length&&this.lines.get(n+1).isWrapped;)n++;return{first:t,last:n}}setupTabStops(e){for(e!=null?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e==null&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e==null&&(e=this.x);!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose();this.markers.length=0,this._isClearing=!1}addMarker(e){let t=new _W(e);return this.markers.push(t),t.register(this.lines.onTrim(n=>{t.line-=n,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(n=>{t.line>=n.index&&(t.line+=n.amount)})),t.register(this.lines.onDelete(n=>{t.line>=n.index&&t.line<n.index+n.amount&&t.dispose(),t.line>n.index&&(t.line-=n.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},yW=class extends Ke{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new we),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this._register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.resize(this._bufferService.cols,this._bufferService.rows))),this._register(this._optionsService.onSpecificOptionChange("tabStopWidth",()=>this.setupTabStops()))}reset(){this._normal=new W2(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new W2(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(e,t){this._normal.resize(e,t),this._alt.resize(e,t),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}},hA=2,fA=1,dy=class extends Ke{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new we),this.onResize=this._onResize.event,this._onScroll=this._register(new we),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,hA),this.rows=Math.max(e.rawOptions.rows||0,fA),this.buffers=this._register(new yW(e,this)),this._register(this.buffers.onBufferActivate(t=>{this._onScroll.fire(t.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let n=this.cols!==e,r=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:n,rowsChanged:r})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let n=this.buffer,r;r=this._cachedBlankLine,(!r||r.length!==this.cols||r.getFg(0)!==e.fg||r.getBg(0)!==e.bg)&&(r=n.getBlankLine(e,t),this._cachedBlankLine=r),r.isWrapped=t;let s=n.ybase+n.scrollTop,l=n.ybase+n.scrollBottom;if(n.scrollTop===0){let a=n.lines.isFull;l===n.lines.length-1?a?n.lines.recycle().copyFrom(r):n.lines.push(r.clone()):n.lines.splice(l+1,0,r.clone()),a?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{let a=l-s+1;n.lines.shiftElements(s+1,a-1,-1),n.lines.set(l,r.clone())}this.isUserScrolling||(n.ydisp=n.ybase),this._onScroll.fire(n.ydisp)}scrollLines(e,t){let n=this.buffer;if(e<0){if(n.ydisp===0)return;this.isUserScrolling=!0}else e+n.ydisp>=n.ybase&&(this.isUserScrolling=!1);let r=n.ydisp;n.ydisp=Math.max(Math.min(n.ydisp+e,n.ybase),0),r!==n.ydisp&&(t||this._onScroll.fire(n.ydisp))}};dy=It([ke(0,Kn)],dy);var ia={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:Uf,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},bW=["normal","bold","100","200","300","400","500","600","700","800","900"],xW=class extends Ke{constructor(e){super(),this._onOptionChange=this._register(new we),this.onOptionChange=this._onOptionChange.event;let t={...ia};for(let n in e)if(n in t)try{let r=e[n];t[n]=this._sanitizeAndValidateOption(n,r)}catch(r){console.error(r)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(Dt(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(n=>{n===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(n=>{e.indexOf(n)!==-1&&t()})}_setupOptions(){let e=n=>{if(!(n in ia))throw new Error(`No option with key "${n}"`);return this.rawOptions[n]},t=(n,r)=>{if(!(n in ia))throw new Error(`No option with key "${n}"`);r=this._sanitizeAndValidateOption(n,r),this.rawOptions[n]!==r&&(this.rawOptions[n]=r,this._onOptionChange.fire(n))};for(let n in this.rawOptions){let r={get:e.bind(this,n),set:t.bind(this,n)};Object.defineProperty(this.options,n,r)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=ia[e]),!SW(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=ia[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=bW.includes(t)?t:ia[e];break;case"cursorWidth":t=Math.floor(t);case"lineHeight":case"tabStopWidth":if(t<1)throw new Error(`${e} cannot be less than 1, value: ${t}`);break;case"minimumContrastRatio":t=Math.max(1,Math.min(21,Math.round(t*10)/10));break;case"scrollback":if(t=Math.min(t,4294967295),t<0)throw new Error(`${e} cannot be less than 0, value: ${t}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(t<=0)throw new Error(`${e} cannot be less than or equal to 0, value: ${t}`);break;case"rows":case"cols":if(!t&&t!==0)throw new Error(`${e} must be numeric, value: ${t}`);break;case"windowsPty":t=t??{};break}return t}};function SW(e){return e==="block"||e==="underline"||e==="bar"}function au(e,t=5){if(typeof e!="object")return e;let n=Array.isArray(e)?[]:{};for(let r in e)n[r]=t<=1?e[r]:e[r]&&au(e[r],t-1);return n}var V2=Object.freeze({insertMode:!1}),q2=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),hy=class extends Ke{constructor(e,t,n){super(),this._bufferService=e,this._logService=t,this._optionsService=n,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new we),this.onData=this._onData.event,this._onUserInput=this._register(new we),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new we),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new we),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=au(V2),this.decPrivateModes=au(q2)}reset(){this.modes=au(V2),this.decPrivateModes=au(q2)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let n=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&n.ybase!==n.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(r=>r.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace("sending binary (codes)",()=>e.split("").map(t=>t.charCodeAt(0))),this._onBinary.fire(e))}};hy=It([ke(0,qn),ke(1,ON),ke(2,Kn)],hy);var K2={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>e.button===4||e.action!==1?!1:(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>e.action!==32},DRAG:{events:23,restrict:e=>!(e.action===32&&e.button===3)},ANY:{events:31,restrict:e=>!0}};function Dv(e,t){let n=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(n|=64,n|=e.action):(n|=e.button&3,e.button&4&&(n|=64),e.button&8&&(n|=128),e.action===32?n|=32:e.action===0&&!t&&(n|=3)),n}var Ov=String.fromCharCode,G2={DEFAULT:e=>{let t=[Dv(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${Ov(t[0])}${Ov(t[1])}${Ov(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Dv(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Dv(e,!0)};${e.x};${e.y}${t}`}},fy=class extends Ke{constructor(e,t,n){super(),this._bufferService=e,this._coreService=t,this._optionsService=n,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new we),this.onProtocolChange=this._onProtocolChange.event;for(let r of Object.keys(K2))this.addProtocol(r,K2[r]);for(let r of Object.keys(G2))this.addEncoding(r,G2[r]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw new Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw new Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,n){if(e.deltaY===0||e.shiftKey||t===void 0||n===void 0)return 0;let r=t/n,s=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(s/=r+0,Math.abs(e.deltaY)<50&&(s*=.3),this._wheelPartialScroll+=s,s=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(s*=this._bufferService.rows),s}_applyScrollModifier(e,t){return t.altKey||t.ctrlKey||t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_equalEvents(e,t,n){if(n){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return!(e.button!==t.button||e.action!==t.action||e.ctrl!==t.ctrl||e.alt!==t.alt||e.shift!==t.shift)}};fy=It([ke(0,qn),ke(1,hl),ke(2,Kn)],fy);var Lv=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],wW=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],ln;function CW(e,t){let n=0,r=t.length-1,s;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=n;)if(s=n+r>>1,e>t[s][1])n=s+1;else if(e<t[s][0])r=s-1;else return!0;return!1}var kW=class{constructor(){if(this.version="6",!ln){ln=new Uint8Array(65536),ln.fill(1),ln[0]=0,ln.fill(0,1,32),ln.fill(0,127,160),ln.fill(2,4352,4448),ln[9001]=2,ln[9002]=2,ln.fill(2,11904,42192),ln[12351]=1,ln.fill(2,44032,55204),ln.fill(2,63744,64256),ln.fill(2,65040,65050),ln.fill(2,65072,65136),ln.fill(2,65280,65377),ln.fill(2,65504,65511);for(let e=0;e<Lv.length;++e)ln.fill(0,Lv[e][0],Lv[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?ln[e]:CW(e,wW)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),r=n===0&&t!==0;if(r){let s=Go.extractWidth(t);s===0?r=!1:s>n&&(n=s)}return Go.createPropertyValue(0,n,r)}},Go=class pf{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new we,this.onChange=this._onChange.event;let t=new kW;this.register(t),this._active=t.version,this._activeProvider=t}static extractShouldJoin(t){return(t&1)!==0}static extractWidth(t){return t>>1&3}static extractCharKind(t){return t>>3}static createPropertyValue(t,n,r=!1){return(t&16777215)<<3|(n&3)<<1|(r?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(t){if(!this._providers[t])throw new Error(`unknown Unicode version "${t}"`);this._active=t,this._activeProvider=this._providers[t],this._onChange.fire(t)}register(t){this._providers[t.version]=t}wcwidth(t){return this._activeProvider.wcwidth(t)}getStringCellWidth(t){let n=0,r=0,s=t.length;for(let l=0;l<s;++l){let a=t.charCodeAt(l);if(55296<=a&&a<=56319){if(++l>=s)return n+this.wcwidth(a);let d=t.charCodeAt(l);56320<=d&&d<=57343?a=(a-55296)*1024+d-56320+65536:n+=this.wcwidth(d)}let u=this.charProperties(a,r),h=pf.extractWidth(u);pf.extractShouldJoin(u)&&(h-=pf.extractWidth(r)),n+=h,r=u}return n}charProperties(t,n){return this._activeProvider.charProperties(t,n)}},EW=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)}};function Y2(e){var r;let t=(r=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1))==null?void 0:r.get(e.cols-1),n=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);n&&t&&(n.isWrapped=t[3]!==0&&t[3]!==32)}var Vc=2147483647,RW=256,pA=class py{constructor(t=32,n=32){if(this.maxLength=t,this.maxSubParamsLength=n,n>RW)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(t),this.length=0,this._subParams=new Int32Array(n),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(t),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let n=new py;if(!t.length)return n;for(let r=Array.isArray(t[0])?1:0;r<t.length;++r){let s=t[r];if(Array.isArray(s))for(let l=0;l<s.length;++l)n.addSubParam(s[l]);else n.addParam(s)}return n}clone(){let t=new py(this.maxLength,this.maxSubParamsLength);return t.params.set(this.params),t.length=this.length,t._subParams.set(this._subParams),t._subParamsLength=this._subParamsLength,t._subParamsIdx.set(this._subParamsIdx),t._rejectDigits=this._rejectDigits,t._rejectSubDigits=this._rejectSubDigits,t._digitIsSub=this._digitIsSub,t}toArray(){let t=[];for(let n=0;n<this.length;++n){t.push(this.params[n]);let r=this._subParamsIdx[n]>>8,s=this._subParamsIdx[n]&255;s-r>0&&t.push(Array.prototype.slice.call(this._subParams,r,s))}return t}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(t){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=t>Vc?Vc:t}addSubParam(t){if(this._digitIsSub=!0,!!this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=t>Vc?Vc:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let n=this._subParamsIdx[t]>>8,r=this._subParamsIdx[t]&255;return r-n>0?this._subParams.subarray(n,r):null}getSubParamsAll(){let t={};for(let n=0;n<this.length;++n){let r=this._subParamsIdx[n]>>8,s=this._subParamsIdx[n]&255;s-r>0&&(t[n]=this._subParams.slice(r,s))}return t}addDigit(t){let n;if(this._rejectDigits||!(n=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let r=this._digitIsSub?this._subParams:this.params,s=r[n-1];r[n-1]=~s?Math.min(s*10+t,Vc):t}},qc=[],TW=class{constructor(){this._state=0,this._active=qc,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let r=n.indexOf(t);r!==-1&&n.splice(r,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=qc}reset(){if(this._state===2)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=qc,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||qc,!this._active.length)this._handlerFb(this._id,"START");else for(let e=this._active.length-1;e>=0;e--)this._active[e].start()}_put(e,t,n){if(!this._active.length)this._handlerFb(this._id,"PUT",Ep(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}start(){this.reset(),this._state=1}put(e,t,n){if(this._state!==3){if(this._state===1)for(;t<n;){let r=e[t++];if(r===59){this._state=2,this._start();break}if(r<48||57<r){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+r-48}this._state===2&&n-t>0&&this._put(e,t,n)}}end(e,t=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,"END",e);else{let n=!1,r=this._active.length-1,s=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,s=this._stack.fallThrough,this._stack.paused=!1),!s&&n===!1){for(;r>=0&&(n=this._active[r].end(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].end(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}this._active=qc,this._id=-1,this._state=0}}},br=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=Ep(e,t,n),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then(n=>(this._data="",this._hitLimit=!1,n));return this._data="",this._hitLimit=!1,t}},Kc=[],MW=class{constructor(){this._handlers=Object.create(null),this._active=Kc,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Kc}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let r=n.indexOf(t);r!==-1&&n.splice(r,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=Kc,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||Kc,!this._active.length)this._handlerFb(this._ident,"HOOK",t);else for(let n=this._active.length-1;n>=0;n--)this._active[n].hook(t)}put(e,t,n){if(!this._active.length)this._handlerFb(this._ident,"PUT",Ep(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let n=!1,r=this._active.length-1,s=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,s=this._stack.fallThrough,this._stack.paused=!1),!s&&n===!1){for(;r>=0&&(n=this._active[r].unhook(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].unhook(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}this._active=Kc,this._ident=0}},cu=new pA;cu.addParam(0);var X2=class{constructor(e){this._handler=e,this._data="",this._params=cu,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():cu,this._data="",this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=Ep(e,t,n),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then(n=>(this._params=cu,this._data="",this._hitLimit=!1,n));return this._params=cu,this._data="",this._hitLimit=!1,t}},NW=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,n,r){this.table[t<<8|e]=n<<4|r}addMany(e,t,n,r){for(let s=0;s<e.length;s++)this.table[t<<8|e[s]]=n<<4|r}},Wr=160,AW=(function(){let e=new NW(4095),t=Array.apply(null,Array(256)).map((u,h)=>h),n=(u,h)=>t.slice(u,h),r=n(32,127),s=n(0,24);s.push(25),s.push.apply(s,n(28,32));let l=n(0,14),a;e.setDefault(1,0),e.addMany(r,0,2,0);for(a in l)e.addMany([24,26,153,154],a,3,0),e.addMany(n(128,144),a,3,0),e.addMany(n(144,152),a,3,0),e.add(156,a,0,0),e.add(27,a,11,1),e.add(157,a,4,8),e.addMany([152,158,159],a,0,7),e.add(155,a,11,3),e.add(144,a,11,9);return e.addMany(s,0,3,0),e.addMany(s,1,3,1),e.add(127,1,0,1),e.addMany(s,8,0,8),e.addMany(s,3,3,3),e.add(127,3,0,3),e.addMany(s,4,3,4),e.add(127,4,0,4),e.addMany(s,6,3,6),e.addMany(s,5,3,5),e.add(127,5,0,5),e.addMany(s,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(r,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(n(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(r,7,0,7),e.addMany(s,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(n(64,127),3,7,0),e.addMany(n(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(n(48,60),4,8,4),e.addMany(n(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(n(32,64),6,0,6),e.add(127,6,0,6),e.addMany(n(64,127),6,0,0),e.addMany(n(32,48),3,9,5),e.addMany(n(32,48),5,9,5),e.addMany(n(48,64),5,0,6),e.addMany(n(64,127),5,7,0),e.addMany(n(32,48),4,9,5),e.addMany(n(32,48),1,9,2),e.addMany(n(32,48),2,9,2),e.addMany(n(48,127),2,10,0),e.addMany(n(48,80),1,10,0),e.addMany(n(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(n(96,127),1,10,0),e.add(80,1,11,9),e.addMany(s,9,0,9),e.add(127,9,0,9),e.addMany(n(28,32),9,0,9),e.addMany(n(32,48),9,9,12),e.addMany(n(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(s,11,0,11),e.addMany(n(32,128),11,0,11),e.addMany(n(28,32),11,0,11),e.addMany(s,10,0,10),e.add(127,10,0,10),e.addMany(n(28,32),10,0,10),e.addMany(n(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(n(32,48),10,9,12),e.addMany(s,12,0,12),e.add(127,12,0,12),e.addMany(n(28,32),12,0,12),e.addMany(n(32,48),12,9,12),e.addMany(n(48,64),12,0,11),e.addMany(n(64,127),12,12,13),e.addMany(n(64,127),10,12,13),e.addMany(n(64,127),9,12,13),e.addMany(s,13,13,13),e.addMany(r,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(Wr,0,2,0),e.add(Wr,8,5,8),e.add(Wr,6,0,6),e.add(Wr,11,0,11),e.add(Wr,13,13,13),e})(),DW=class extends Ke{constructor(e=AW){super(),this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new pA,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,n,r)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,n)=>{},this._escHandlerFb=t=>{},this._errorHandlerFb=t=>t,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(Dt(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new TW),this._dcsParser=this._register(new MW),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let n=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(n=e.prefix.charCodeAt(0),n&&60>n||n>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let s=0;s<e.intermediates.length;++s){let l=e.intermediates.charCodeAt(s);if(32>l||l>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");n<<=8,n|=l}}if(e.final.length!==1)throw new Error("final must be a single byte");let r=e.final.charCodeAt(0);if(t[0]>r||r>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return n<<=8,n|=r,n}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let n=this._identifier(e,[48,126]);this._escHandlers[n]===void 0&&(this._escHandlers[n]=[]);let r=this._escHandlers[n];return r.push(t),{dispose:()=>{let s=r.indexOf(t);s!==-1&&r.splice(s,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let n=this._identifier(e);this._csiHandlers[n]===void 0&&(this._csiHandlers[n]=[]);let r=this._csiHandlers[n];return r.push(t),{dispose:()=>{let s=r.indexOf(t);s!==-1&&r.splice(s,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,n,r,s){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=n,this._parseStack.transition=r,this._parseStack.chunkPos=s}parse(e,t,n){let r=0,s=0,l=0,a;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,l=this._parseStack.chunkPos+1;else{if(n===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let u=this._parseStack.handlers,h=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(n===!1&&h>-1){for(;h>=0&&(a=u[h](this._params),a!==!0);h--)if(a instanceof Promise)return this._parseStack.handlerPos=h,a}this._parseStack.handlers=[];break;case 4:if(n===!1&&h>-1){for(;h>=0&&(a=u[h](),a!==!0);h--)if(a instanceof Promise)return this._parseStack.handlerPos=h,a}this._parseStack.handlers=[];break;case 6:if(r=e[this._parseStack.chunkPos],a=this._dcsParser.unhook(r!==24&&r!==26,n),a)return a;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(r=e[this._parseStack.chunkPos],a=this._oscParser.end(r!==24&&r!==26,n),a)return a;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,l=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let u=l;u<t;++u){switch(r=e[u],s=this._transitions.table[this.currentState<<8|(r<160?r:Wr)],s>>4){case 2:for(let _=u+1;;++_){if(_>=t||(r=e[_])<32||r>126&&r<Wr){this._printHandler(e,u,_),u=_-1;break}if(++_>=t||(r=e[_])<32||r>126&&r<Wr){this._printHandler(e,u,_),u=_-1;break}if(++_>=t||(r=e[_])<32||r>126&&r<Wr){this._printHandler(e,u,_),u=_-1;break}if(++_>=t||(r=e[_])<32||r>126&&r<Wr){this._printHandler(e,u,_),u=_-1;break}}break;case 3:this._executeHandlers[r]?this._executeHandlers[r]():this._executeHandlerFb(r),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:u,code:r,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let h=this._csiHandlers[this._collect<<8|r],d=h?h.length-1:-1;for(;d>=0&&(a=h[d](this._params),a!==!0);d--)if(a instanceof Promise)return this._preserveStack(3,h,d,s,u),a;d<0&&this._csiHandlerFb(this._collect<<8|r,this._params),this.precedingJoinState=0;break;case 8:do switch(r){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(r-48)}while(++u<t&&(r=e[u])>47&&r<60);u--;break;case 9:this._collect<<=8,this._collect|=r;break;case 10:let p=this._escHandlers[this._collect<<8|r],m=p?p.length-1:-1;for(;m>=0&&(a=p[m](),a!==!0);m--)if(a instanceof Promise)return this._preserveStack(4,p,m,s,u),a;m<0&&this._escHandlerFb(this._collect<<8|r),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|r,this._params);break;case 13:for(let _=u+1;;++_)if(_>=t||(r=e[_])===24||r===26||r===27||r>127&&r<Wr){this._dcsParser.put(e,u,_),u=_-1;break}break;case 14:if(a=this._dcsParser.unhook(r!==24&&r!==26),a)return this._preserveStack(6,[],0,s,u),a;r===27&&(s|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let _=u+1;;_++)if(_>=t||(r=e[_])<32||r>127&&r<Wr){this._oscParser.put(e,u,_),u=_-1;break}break;case 6:if(a=this._oscParser.end(r!==24&&r!==26),a)return this._preserveStack(5,[],0,s,u),a;r===27&&(s|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=s&15}}},OW=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,LW=/^[\da-f]+$/;function Z2(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let n=OW.exec(t);if(n){let r=n[1]?15:n[4]?255:n[7]?4095:65535;return[Math.round(parseInt(n[1]||n[4]||n[7]||n[10],16)/r*255),Math.round(parseInt(n[2]||n[5]||n[8]||n[11],16)/r*255),Math.round(parseInt(n[3]||n[6]||n[9]||n[12],16)/r*255)]}}else if(t.indexOf("#")===0&&(t=t.slice(1),LW.exec(t)&&[3,6,9,12].includes(t.length))){let n=t.length/3,r=[0,0,0];for(let s=0;s<3;++s){let l=parseInt(t.slice(n*s,n*s+n),16);r[s]=n===1?l<<4:n===2?l:n===3?l>>4:l>>8}return r}}function jv(e,t){let n=e.toString(16),r=n.length<2?"0"+n:n;switch(t){case 4:return n[0];case 8:return r;case 12:return(r+r).slice(0,3);default:return r+r}}function jW(e,t=16){let[n,r,s]=e;return`rgb:${jv(n,t)}/${jv(r,t)}/${jv(s,t)}`}var zW={"(":0,")":1,"*":2,"+":3,"-":1,".":2},Ys=131072,Q2=10;function J2(e,t){if(e>24)return t.setWinLines||!1;switch(e){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}var ek=5e3,tk=0,PW=class extends Ke{constructor(e,t,n,r,s,l,a,u,h=new DW){super(),this._bufferService=e,this._charsetService=t,this._coreService=n,this._logService=r,this._optionsService=s,this._oscLinkService=l,this._coreMouseService=a,this._unicodeService=u,this._parser=h,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new nU,this._utf8Decoder=new rU,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=Zt.clone(),this._eraseAttrDataInternal=Zt.clone(),this._onRequestBell=this._register(new we),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new we),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new we),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new we),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new we),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new we),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new we),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new we),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new we),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new we),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new we),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new we),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new we),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this._register(this._parser),this._dirtyRowTracker=new my(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(d=>this._activeBuffer=d.activeBuffer)),this._parser.setCsiHandlerFallback((d,p)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(d),params:p.toArray()})}),this._parser.setEscHandlerFallback(d=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(d)})}),this._parser.setExecuteHandlerFallback(d=>{this._logService.debug("Unknown EXECUTE code: ",{code:d})}),this._parser.setOscHandlerFallback((d,p,m)=>{this._logService.debug("Unknown OSC code: ",{identifier:d,action:p,data:m})}),this._parser.setDcsHandlerFallback((d,p,m)=>{p==="HOOK"&&(m=m.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(d),action:p,payload:m})}),this._parser.setPrintHandler((d,p,m)=>this.print(d,p,m)),this._parser.registerCsiHandler({final:"@"},d=>this.insertChars(d)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},d=>this.scrollLeft(d)),this._parser.registerCsiHandler({final:"A"},d=>this.cursorUp(d)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},d=>this.scrollRight(d)),this._parser.registerCsiHandler({final:"B"},d=>this.cursorDown(d)),this._parser.registerCsiHandler({final:"C"},d=>this.cursorForward(d)),this._parser.registerCsiHandler({final:"D"},d=>this.cursorBackward(d)),this._parser.registerCsiHandler({final:"E"},d=>this.cursorNextLine(d)),this._parser.registerCsiHandler({final:"F"},d=>this.cursorPrecedingLine(d)),this._parser.registerCsiHandler({final:"G"},d=>this.cursorCharAbsolute(d)),this._parser.registerCsiHandler({final:"H"},d=>this.cursorPosition(d)),this._parser.registerCsiHandler({final:"I"},d=>this.cursorForwardTab(d)),this._parser.registerCsiHandler({final:"J"},d=>this.eraseInDisplay(d,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},d=>this.eraseInDisplay(d,!0)),this._parser.registerCsiHandler({final:"K"},d=>this.eraseInLine(d,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},d=>this.eraseInLine(d,!0)),this._parser.registerCsiHandler({final:"L"},d=>this.insertLines(d)),this._parser.registerCsiHandler({final:"M"},d=>this.deleteLines(d)),this._parser.registerCsiHandler({final:"P"},d=>this.deleteChars(d)),this._parser.registerCsiHandler({final:"S"},d=>this.scrollUp(d)),this._parser.registerCsiHandler({final:"T"},d=>this.scrollDown(d)),this._parser.registerCsiHandler({final:"X"},d=>this.eraseChars(d)),this._parser.registerCsiHandler({final:"Z"},d=>this.cursorBackwardTab(d)),this._parser.registerCsiHandler({final:"`"},d=>this.charPosAbsolute(d)),this._parser.registerCsiHandler({final:"a"},d=>this.hPositionRelative(d)),this._parser.registerCsiHandler({final:"b"},d=>this.repeatPrecedingCharacter(d)),this._parser.registerCsiHandler({final:"c"},d=>this.sendDeviceAttributesPrimary(d)),this._parser.registerCsiHandler({prefix:">",final:"c"},d=>this.sendDeviceAttributesSecondary(d)),this._parser.registerCsiHandler({final:"d"},d=>this.linePosAbsolute(d)),this._parser.registerCsiHandler({final:"e"},d=>this.vPositionRelative(d)),this._parser.registerCsiHandler({final:"f"},d=>this.hVPosition(d)),this._parser.registerCsiHandler({final:"g"},d=>this.tabClear(d)),this._parser.registerCsiHandler({final:"h"},d=>this.setMode(d)),this._parser.registerCsiHandler({prefix:"?",final:"h"},d=>this.setModePrivate(d)),this._parser.registerCsiHandler({final:"l"},d=>this.resetMode(d)),this._parser.registerCsiHandler({prefix:"?",final:"l"},d=>this.resetModePrivate(d)),this._parser.registerCsiHandler({final:"m"},d=>this.charAttributes(d)),this._parser.registerCsiHandler({final:"n"},d=>this.deviceStatus(d)),this._parser.registerCsiHandler({prefix:"?",final:"n"},d=>this.deviceStatusPrivate(d)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},d=>this.softReset(d)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},d=>this.setCursorStyle(d)),this._parser.registerCsiHandler({final:"r"},d=>this.setScrollRegion(d)),this._parser.registerCsiHandler({final:"s"},d=>this.saveCursor(d)),this._parser.registerCsiHandler({final:"t"},d=>this.windowOptions(d)),this._parser.registerCsiHandler({final:"u"},d=>this.restoreCursor(d)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},d=>this.insertColumns(d)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},d=>this.deleteColumns(d)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},d=>this.selectProtected(d)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},d=>this.requestMode(d,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},d=>this.requestMode(d,!1)),this._parser.setExecuteHandler(ge.BEL,()=>this.bell()),this._parser.setExecuteHandler(ge.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(ge.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(ge.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(ge.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(ge.BS,()=>this.backspace()),this._parser.setExecuteHandler(ge.HT,()=>this.tab()),this._parser.setExecuteHandler(ge.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(ge.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(hf.IND,()=>this.index()),this._parser.setExecuteHandler(hf.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(hf.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new br(d=>(this.setTitle(d),this.setIconName(d),!0))),this._parser.registerOscHandler(1,new br(d=>this.setIconName(d))),this._parser.registerOscHandler(2,new br(d=>this.setTitle(d))),this._parser.registerOscHandler(4,new br(d=>this.setOrReportIndexedColor(d))),this._parser.registerOscHandler(8,new br(d=>this.setHyperlink(d))),this._parser.registerOscHandler(10,new br(d=>this.setOrReportFgColor(d))),this._parser.registerOscHandler(11,new br(d=>this.setOrReportBgColor(d))),this._parser.registerOscHandler(12,new br(d=>this.setOrReportCursorColor(d))),this._parser.registerOscHandler(104,new br(d=>this.restoreIndexedColor(d))),this._parser.registerOscHandler(110,new br(d=>this.restoreFgColor(d))),this._parser.registerOscHandler(111,new br(d=>this.restoreBgColor(d))),this._parser.registerOscHandler(112,new br(d=>this.restoreCursorColor(d))),this._parser.registerEscHandler({final:"7"},()=>this.saveCursor()),this._parser.registerEscHandler({final:"8"},()=>this.restoreCursor()),this._parser.registerEscHandler({final:"D"},()=>this.index()),this._parser.registerEscHandler({final:"E"},()=>this.nextLine()),this._parser.registerEscHandler({final:"H"},()=>this.tabSet()),this._parser.registerEscHandler({final:"M"},()=>this.reverseIndex()),this._parser.registerEscHandler({final:"="},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:">"},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:"c"},()=>this.fullReset()),this._parser.registerEscHandler({final:"n"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"o"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"|"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"}"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"~"},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:"%",final:"@"},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:"%",final:"G"},()=>this.selectDefaultCharset());for(let d in cn)this._parser.registerEscHandler({intermediates:"(",final:d},()=>this.selectCharset("("+d)),this._parser.registerEscHandler({intermediates:")",final:d},()=>this.selectCharset(")"+d)),this._parser.registerEscHandler({intermediates:"*",final:d},()=>this.selectCharset("*"+d)),this._parser.registerEscHandler({intermediates:"+",final:d},()=>this.selectCharset("+"+d)),this._parser.registerEscHandler({intermediates:"-",final:d},()=>this.selectCharset("-"+d)),this._parser.registerEscHandler({intermediates:".",final:d},()=>this.selectCharset("."+d)),this._parser.registerEscHandler({intermediates:"/",final:d},()=>this.selectCharset("/"+d));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(d=>(this._logService.error("Parsing error: ",d),d)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new X2((d,p)=>this.requestStatusString(d,p)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,n,r){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=n,this._parseStack.position=r}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((t,n)=>setTimeout(()=>n("#SLOW_TIMEOUT"),ek))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${ek} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let n,r=this._activeBuffer.x,s=this._activeBuffer.y,l=0,a=this._parseStack.paused;if(a){if(n=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(n),n;r=this._parseStack.cursorStartX,s=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>Ys&&(l=this._parseStack.position+Ys)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,d=>String.fromCharCode(d)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(d=>d.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<Ys&&(this._parseBuffer=new Uint32Array(Math.min(e.length,Ys))),a||this._dirtyRowTracker.clearRange(),e.length>Ys)for(let d=l;d<e.length;d+=Ys){let p=d+Ys<e.length?d+Ys:e.length,m=typeof e=="string"?this._stringDecoder.decode(e.substring(d,p),this._parseBuffer):this._utf8Decoder.decode(e.subarray(d,p),this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,m))return this._preserveStack(r,s,m,d),this._logSlowResolvingAsync(n),n}else if(!a){let d=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,d))return this._preserveStack(r,s,d,0),this._logSlowResolvingAsync(n),n}(this._activeBuffer.x!==r||this._activeBuffer.y!==s)&&this._onCursorMove.fire();let u=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),h=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);h<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(h,this._bufferService.rows-1),end:Math.min(u,this._bufferService.rows-1)})}print(e,t,n){let r,s,l=this._charsetService.charset,a=this._optionsService.rawOptions.screenReaderMode,u=this._bufferService.cols,h=this._coreService.decPrivateModes.wraparound,d=this._coreService.modes.insertMode,p=this._curAttrData,m=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&n-t>0&&m.getWidth(this._activeBuffer.x-1)===2&&m.setCellFromCodepoint(this._activeBuffer.x-1,0,1,p);let _=this._parser.precedingJoinState;for(let y=t;y<n;++y){if(r=e[y],r<127&&l){let k=l[String.fromCharCode(r)];k&&(r=k.charCodeAt(0))}let w=this._unicodeService.charProperties(r,_);s=Go.extractWidth(w);let S=Go.extractShouldJoin(w),C=S?Go.extractWidth(_):0;if(_=w,a&&this._onA11yChar.fire(Js(r)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+s-C>u){if(h){let k=m,T=this._activeBuffer.x-C;for(this._activeBuffer.x=C,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),m=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),C>0&&m instanceof lu&&m.copyCellsFrom(k,T,0,C,!1);T<u;)k.setCellFromCodepoint(T++,0,1,p)}else if(this._activeBuffer.x=u-1,s===2)continue}if(S&&this._activeBuffer.x){let k=m.getWidth(this._activeBuffer.x-1)?1:2;m.addCodepointToCell(this._activeBuffer.x-k,r,s);for(let T=s-C;--T>=0;)m.setCellFromCodepoint(this._activeBuffer.x++,0,0,p);continue}if(d&&(m.insertCells(this._activeBuffer.x,s-C,this._activeBuffer.getNullCell(p)),m.getWidth(u-1)===2&&m.setCellFromCodepoint(u-1,0,1,p)),m.setCellFromCodepoint(this._activeBuffer.x++,r,s,p),s>0)for(;--s;)m.setCellFromCodepoint(this._activeBuffer.x++,0,0,p)}this._parser.precedingJoinState=_,this._activeBuffer.x<u&&n-t>0&&m.getWidth(this._activeBuffer.x)===0&&!m.hasContent(this._activeBuffer.x)&&m.setCellFromCodepoint(this._activeBuffer.x,0,1,p),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,n=>J2(n.params[0],this._optionsService.rawOptions.windowOptions)?t(n):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new X2(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new br(t))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var e;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&((e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&e.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);t.hasWidth(this._activeBuffer.x)&&!t.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),(t===2||t===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,n,r=!1,s=!1){let l=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);l.replaceCells(t,n,this._activeBuffer.getNullCell(this._eraseAttrData()),s),r&&(l.isWrapped=!1)}_resetBufferLine(e,t=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n&&(n.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),n.isWrapped=!1)}eraseInDisplay(e,t=!1){var r;this._restrictCursor(this._bufferService.cols);let n;switch(e.params[0]){case 0:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);n<this._bufferService.rows;n++)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(n);break;case 1:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(n+1).isWrapped=!1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(n=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,n-1);n--&&!((r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n))!=null&&r.getTrimmedLength()););for(;n>=0;n--)this._bufferService.scroll(this._eraseAttrData())}else{for(n=this._bufferService.rows,this._dirtyRowTracker.markDirty(n-1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let s=this._activeBuffer.lines.length-this._bufferService.rows;s>0&&(this._activeBuffer.lines.trimStart(s),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-s,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-s,0),this._onScroll.fire(0));break}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,s=this._bufferService.rows-1+this._activeBuffer.ybase-r+1;for(;t--;)this._activeBuffer.lines.splice(s-1,1),this._activeBuffer.lines.splice(n,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,r;for(r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-r;t--;)this._activeBuffer.lines.splice(n,1),this._activeBuffer.lines.splice(r,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(Zt));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);r.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);r.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);r.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);r.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let t=this._parser.precedingJoinState;if(!t)return!0;let n=e.params[0]||1,r=Go.extractWidth(t),s=this._activeBuffer.x-r,l=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(s),a=new Uint32Array(l.length*n),u=0;for(let d=0;d<l.length;){let p=l.codePointAt(d)||0;a[u++]=p,d+=p>65535?2:1}let h=u;for(let d=1;d<n;++d)a.copyWithin(h,0,u),h+=u;return this.print(a,0,h),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(ge.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(ge.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(ge.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(ge.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(ge.ESC+"[>83;40003;0c")),!0}_is(e){return(this._optionsService.rawOptions.termName+"").indexOf(e)===0}setMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0;break}return!0}setModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,$o),this._charsetService.setgCharset(1,$o),this._charsetService.setgCharset(2,$o),this._charsetService.setgCharset(3,$o);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break}return!0}resetMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),e.params[t]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0);break}return!0}requestMode(e,t){(S=>(S[S.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",S[S.SET=1]="SET",S[S.RESET=2]="RESET",S[S.PERMANENTLY_SET=3]="PERMANENTLY_SET",S[S.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(void 0||(n={}));let r=this._coreService.decPrivateModes,{activeProtocol:s,activeEncoding:l}=this._coreMouseService,a=this._coreService,{buffers:u,cols:h}=this._bufferService,{active:d,alt:p}=u,m=this._optionsService.rawOptions,_=(S,C)=>(a.triggerDataEvent(`${ge.ESC}[${t?"":"?"}${S};${C}$y`),!0),y=S=>S?1:2,w=e.params[0];return t?w===2?_(w,4):w===4?_(w,y(a.modes.insertMode)):w===12?_(w,3):w===20?_(w,y(m.convertEol)):_(w,0):w===1?_(w,y(r.applicationCursorKeys)):w===3?_(w,m.windowOptions.setWinLines?h===80?2:h===132?1:0:0):w===6?_(w,y(r.origin)):w===7?_(w,y(r.wraparound)):w===8?_(w,3):w===9?_(w,y(s==="X10")):w===12?_(w,y(m.cursorBlink)):w===25?_(w,y(!a.isCursorHidden)):w===45?_(w,y(r.reverseWraparound)):w===66?_(w,y(r.applicationKeypad)):w===67?_(w,4):w===1e3?_(w,y(s==="VT200")):w===1002?_(w,y(s==="DRAG")):w===1003?_(w,y(s==="ANY")):w===1004?_(w,y(r.sendFocus)):w===1005?_(w,4):w===1006?_(w,y(l==="SGR")):w===1015?_(w,4):w===1016?_(w,y(l==="SGR_PIXELS")):w===1048?_(w,1):w===47||w===1047||w===1049?_(w,y(d===p)):w===2004?_(w,y(r.bracketedPasteMode)):w===2026?_(w,y(r.synchronizedOutput)):_(w,0)}_updateAttrColor(e,t,n,r,s){return t===2?(e|=50331648,e&=-16777216,e|=Ju.fromColorRGB([n,r,s])):t===5&&(e&=-50331904,e|=33554432|n&255),e}_extractColor(e,t,n){let r=[0,0,-1,0,0,0],s=0,l=0;do{if(r[l+s]=e.params[t+l],e.hasSubParams(t+l)){let a=e.getSubParams(t+l),u=0;do r[1]===5&&(s=1),r[l+u+1+s]=a[u];while(++u<a.length&&u+l+1+s<r.length);break}if(r[1]===5&&l+s>=2||r[1]===2&&l+s>=5)break;r[1]&&(s=1)}while(++l+t<e.length&&l+s<r.length);for(let a=2;a<r.length;++a)r[a]===-1&&(r[a]=0);switch(r[0]){case 38:n.fg=this._updateAttrColor(n.fg,r[1],r[3],r[4],r[5]);break;case 48:n.bg=this._updateAttrColor(n.bg,r[1],r[3],r[4],r[5]);break;case 58:n.extended=n.extended.clone(),n.extended.underlineColor=this._updateAttrColor(n.extended.underlineColor,r[1],r[3],r[4],r[5])}return l}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=Zt.fg,e.bg=Zt.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let t=e.length,n,r=this._curAttrData;for(let s=0;s<t;s++)n=e.params[s],n>=30&&n<=37?(r.fg&=-50331904,r.fg|=16777216|n-30):n>=40&&n<=47?(r.bg&=-50331904,r.bg|=16777216|n-40):n>=90&&n<=97?(r.fg&=-50331904,r.fg|=16777216|n-90|8):n>=100&&n<=107?(r.bg&=-50331904,r.bg|=16777216|n-100|8):n===0?this._processSGR0(r):n===1?r.fg|=134217728:n===3?r.bg|=67108864:n===4?(r.fg|=268435456,this._processUnderline(e.hasSubParams(s)?e.getSubParams(s)[0]:1,r)):n===5?r.fg|=536870912:n===7?r.fg|=67108864:n===8?r.fg|=1073741824:n===9?r.fg|=2147483648:n===2?r.bg|=134217728:n===21?this._processUnderline(2,r):n===22?(r.fg&=-134217729,r.bg&=-134217729):n===23?r.bg&=-67108865:n===24?(r.fg&=-268435457,this._processUnderline(0,r)):n===25?r.fg&=-536870913:n===27?r.fg&=-67108865:n===28?r.fg&=-1073741825:n===29?r.fg&=2147483647:n===39?(r.fg&=-67108864,r.fg|=Zt.fg&16777215):n===49?(r.bg&=-67108864,r.bg|=Zt.bg&16777215):n===38||n===48||n===58?s+=this._extractColor(e,s,r):n===53?r.bg|=1073741824:n===55?r.bg&=-1073741825:n===59?(r.extended=r.extended.clone(),r.extended.underlineColor=-1,r.updateExtended()):n===100?(r.fg&=-67108864,r.fg|=Zt.fg&16777215,r.bg&=-67108864,r.bg|=Zt.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${ge.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${ge.ESC}[${t};${n}R`);break}return!0}deviceStatusPrivate(e){switch(e.params[0]){case 6:let t=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${ge.ESC}[?${t};${n}R`);break}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=Zt.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){let t=e.length===0?1:e.params[0];if(t===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){case 1:case 2:this._coreService.decPrivateModes.cursorStyle="block";break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle="underline";break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle="bar";break}let n=t%2===1;this._coreService.decPrivateModes.cursorBlink=n}return!0}setScrollRegion(e){let t=e.params[0]||1,n;return(e.length<2||(n=e.params[1])>this._bufferService.rows||n===0)&&(n=this._bufferService.rows),n>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=n-1,this._setCursor(0,0)),!0}windowOptions(e){if(!J2(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:t!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${ge.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>Q2&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>Q2&&this._iconNameStack.shift());break;case 23:(t===0||t===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(t===0||t===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],n=e.split(";");for(;n.length>1;){let r=n.shift(),s=n.shift();if(/^\d+$/.exec(r)){let l=parseInt(r);if(nk(l))if(s==="?")t.push({type:0,index:l});else{let a=Z2(s);a&&t.push({type:1,index:l,color:a})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(";");if(t===-1)return!0;let n=e.slice(0,t).trim(),r=e.slice(t+1);return r?this._createHyperlink(n,r):n.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let n=e.split(":"),r,s=n.findIndex(l=>l.startsWith("id="));return s!==-1&&(r=n[s].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:r,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let n=e.split(";");for(let r=0;r<n.length&&!(t>=this._specialColors.length);++r,++t)if(n[r]==="?")this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let s=Z2(n[r]);s&&this._onColor.fire([{type:1,index:this._specialColors[t],color:s}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let t=[],n=e.split(";");for(let r=0;r<n.length;++r)if(/^\d+$/.exec(n[r])){let s=parseInt(n[r]);nk(s)&&t.push({type:2,index:s})}return t.length&&this._onColor.fire(t),!0}restoreFgColor(e){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(e){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(e){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,$o),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(zW[e[0]],cn[e[1]]||$o),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=Zt.clone(),this._eraseAttrDataInternal=Zt.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new Kr;e.content=1<<22|69,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let n=this._activeBuffer.ybase+this._activeBuffer.y+t,r=this._activeBuffer.lines.get(n);r&&(r.fill(e),r.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let n=a=>(this._coreService.triggerDataEvent(`${ge.ESC}${a}${ge.ESC}\\`),!0),r=this._bufferService.buffer,s=this._optionsService.rawOptions;return n(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${r.scrollTop+1};${r.scrollBottom+1}r`:e==="m"?"P1$r0m":e===" q"?`P1$r${{block:2,underline:4,bar:6}[s.cursorStyle]-(s.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},my=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){e<this.start?this.start=e:e>this.end&&(this.end=e)}markRangeDirty(e,t){e>t&&(tk=e,e=t,t=tk),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};my=It([ke(0,qn)],my);function nk(e){return 0<=e&&e<256}var BW=5e7,rk=12,IW=50,HW=class extends Ke{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new we),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let n;for(;n=this._writeBuffer.shift();){this._action(n);let r=this._callbacks.shift();r&&r()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>BW)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let n=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let r=this._writeBuffer[this._bufferOffset],s=this._action(r,t);if(s){let a=u=>performance.now()-n>=rk?setTimeout(()=>this._innerWrite(0,u)):this._innerWrite(n,u);s.catch(u=>(queueMicrotask(()=>{throw u}),Promise.resolve(!1))).then(a);return}let l=this._callbacks[this._bufferOffset];if(l&&l(),this._bufferOffset++,this._pendingData-=r.length,performance.now()-n>=rk)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>IW&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout(()=>this._innerWrite())):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}},gy=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let u=t.addMarker(t.ybase+t.y),h={data:e,id:this._nextId++,lines:[u]};return u.onDispose(()=>this._removeMarkerFromLink(h,u)),this._dataByLinkId.set(h.id,h),h.id}let n=e,r=this._getEntryIdKey(n),s=this._entriesWithId.get(r);if(s)return this.addLineToLink(s.id,t.ybase+t.y),s.id;let l=t.addMarker(t.ybase+t.y),a={id:this._nextId++,key:this._getEntryIdKey(n),data:n,lines:[l]};return l.onDispose(()=>this._removeMarkerFromLink(a,l)),this._entriesWithId.set(a.key,a),this._dataByLinkId.set(a.id,a),a.id}addLineToLink(e,t){let n=this._dataByLinkId.get(e);if(n&&n.lines.every(r=>r.line!==t)){let r=this._bufferService.buffer.addMarker(t);n.lines.push(r),r.onDispose(()=>this._removeMarkerFromLink(n,r))}}getLinkData(e){var t;return(t=this._dataByLinkId.get(e))==null?void 0:t.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let n=e.lines.indexOf(t);n!==-1&&(e.lines.splice(n,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};gy=It([ke(0,qn)],gy);var ik=!1,FW=class extends Ke{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new ka),this._onBinary=this._register(new we),this.onBinary=this._onBinary.event,this._onData=this._register(new we),this.onData=this._onData.event,this._onLineFeed=this._register(new we),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new we),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new we),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new we),this._instantiationService=new dW,this.optionsService=this._register(new xW(e)),this._instantiationService.setService(Kn,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(dy)),this._instantiationService.setService(qn,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(uy)),this._instantiationService.setService(ON,this._logService),this.coreService=this._register(this._instantiationService.createInstance(hy)),this._instantiationService.setService(hl,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(fy)),this._instantiationService.setService(DN,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(Go)),this._instantiationService.setService(lU,this.unicodeService),this._charsetService=this._instantiationService.createInstance(EW),this._instantiationService.setService(oU,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(gy),this._instantiationService.setService(LN,this._oscLinkService),this._inputHandler=this._register(new PW(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(Nn.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(Nn.forward(this._bufferService.onResize,this._onResize)),this._register(Nn.forward(this.coreService.onData,this._onData)),this._register(Nn.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new HW((t,n)=>this._inputHandler.parse(t,n))),this._register(Nn.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new we),this._onScroll.event(e=>{var t;(t=this._onScrollApi)==null||t.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(let t in e)this.optionsService.options[t]=e[t]}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=3&&!ik&&(this._logService.warn("writeSync is unreliable and will be removed soon."),ik=!0),this._writeBuffer.writeSync(e,t)}input(e,t=!0){this.coreService.triggerDataEvent(e,t)}resize(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,hA),t=Math.max(t,fA),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t){this._bufferService.scrollLines(e,t)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}registerEscHandler(e,t){return this._inputHandler.registerEscHandler(e,t)}registerDcsHandler(e,t){return this._inputHandler.registerDcsHandler(e,t)}registerCsiHandler(e,t){return this._inputHandler.registerCsiHandler(e,t)}registerOscHandler(e,t){return this._inputHandler.registerOscHandler(e,t)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,t=this.optionsService.rawOptions.windowsPty;t&&t.buildNumber!==void 0&&t.buildNumber!==void 0?e=t.backend==="conpty"&&t.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(Y2.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(Y2(this._bufferService),!1))),this._windowsWrappingHeuristics.value=Dt(()=>{for(let t of e)t.dispose()})}}},UW={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};function $W(e,t,n,r){var a;let s={type:0,cancel:!1,key:void 0},l=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key==="UIKeyInputUpArrow"?t?s.key=ge.ESC+"OA":s.key=ge.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?s.key=ge.ESC+"OD":s.key=ge.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?s.key=ge.ESC+"OC":s.key=ge.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?s.key=ge.ESC+"OB":s.key=ge.ESC+"[B");break;case 8:s.key=e.ctrlKey?"\b":ge.DEL,e.altKey&&(s.key=ge.ESC+s.key);break;case 9:if(e.shiftKey){s.key=ge.ESC+"[Z";break}s.key=ge.HT,s.cancel=!0;break;case 13:s.key=e.altKey?ge.ESC+ge.CR:ge.CR,s.cancel=!0;break;case 27:s.key=ge.ESC,e.altKey&&(s.key=ge.ESC+ge.ESC),s.cancel=!0;break;case 37:if(e.metaKey)break;l?s.key=ge.ESC+"[1;"+(l+1)+"D":t?s.key=ge.ESC+"OD":s.key=ge.ESC+"[D";break;case 39:if(e.metaKey)break;l?s.key=ge.ESC+"[1;"+(l+1)+"C":t?s.key=ge.ESC+"OC":s.key=ge.ESC+"[C";break;case 38:if(e.metaKey)break;l?s.key=ge.ESC+"[1;"+(l+1)+"A":t?s.key=ge.ESC+"OA":s.key=ge.ESC+"[A";break;case 40:if(e.metaKey)break;l?s.key=ge.ESC+"[1;"+(l+1)+"B":t?s.key=ge.ESC+"OB":s.key=ge.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(s.key=ge.ESC+"[2~");break;case 46:l?s.key=ge.ESC+"[3;"+(l+1)+"~":s.key=ge.ESC+"[3~";break;case 36:l?s.key=ge.ESC+"[1;"+(l+1)+"H":t?s.key=ge.ESC+"OH":s.key=ge.ESC+"[H";break;case 35:l?s.key=ge.ESC+"[1;"+(l+1)+"F":t?s.key=ge.ESC+"OF":s.key=ge.ESC+"[F";break;case 33:e.shiftKey?s.type=2:e.ctrlKey?s.key=ge.ESC+"[5;"+(l+1)+"~":s.key=ge.ESC+"[5~";break;case 34:e.shiftKey?s.type=3:e.ctrlKey?s.key=ge.ESC+"[6;"+(l+1)+"~":s.key=ge.ESC+"[6~";break;case 112:l?s.key=ge.ESC+"[1;"+(l+1)+"P":s.key=ge.ESC+"OP";break;case 113:l?s.key=ge.ESC+"[1;"+(l+1)+"Q":s.key=ge.ESC+"OQ";break;case 114:l?s.key=ge.ESC+"[1;"+(l+1)+"R":s.key=ge.ESC+"OR";break;case 115:l?s.key=ge.ESC+"[1;"+(l+1)+"S":s.key=ge.ESC+"OS";break;case 116:l?s.key=ge.ESC+"[15;"+(l+1)+"~":s.key=ge.ESC+"[15~";break;case 117:l?s.key=ge.ESC+"[17;"+(l+1)+"~":s.key=ge.ESC+"[17~";break;case 118:l?s.key=ge.ESC+"[18;"+(l+1)+"~":s.key=ge.ESC+"[18~";break;case 119:l?s.key=ge.ESC+"[19;"+(l+1)+"~":s.key=ge.ESC+"[19~";break;case 120:l?s.key=ge.ESC+"[20;"+(l+1)+"~":s.key=ge.ESC+"[20~";break;case 121:l?s.key=ge.ESC+"[21;"+(l+1)+"~":s.key=ge.ESC+"[21~";break;case 122:l?s.key=ge.ESC+"[23;"+(l+1)+"~":s.key=ge.ESC+"[23~";break;case 123:l?s.key=ge.ESC+"[24;"+(l+1)+"~":s.key=ge.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?s.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?s.key=ge.NUL:e.keyCode>=51&&e.keyCode<=55?s.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?s.key=ge.DEL:e.keyCode===219?s.key=ge.ESC:e.keyCode===220?s.key=ge.FS:e.keyCode===221&&(s.key=ge.GS);else if((!n||r)&&e.altKey&&!e.metaKey){let u=(a=UW[e.keyCode])==null?void 0:a[e.shiftKey?1:0];if(u)s.key=ge.ESC+u;else if(e.keyCode>=65&&e.keyCode<=90){let h=e.ctrlKey?e.keyCode-64:e.keyCode+32,d=String.fromCharCode(h);e.shiftKey&&(d=d.toUpperCase()),s.key=ge.ESC+d}else if(e.keyCode===32)s.key=ge.ESC+(e.ctrlKey?ge.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let h=e.code.slice(3,4);e.shiftKey||(h=h.toLowerCase()),s.key=ge.ESC+h,s.cancel=!0}}else n&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(s.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?s.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(s.key=ge.US),e.key==="@"&&(s.key=ge.NUL));break}return s}var Ut=0,WW=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new $f,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new $f,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((s,l)=>this._getKey(s)-this._getKey(l)),t=0,n=0,r=new Array(this._array.length+this._insertedValues.length);for(let s=0;s<r.length;s++)n>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[n])?(r[s]=e[t],t++):r[s]=this._array[n++];this._array=r,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(Ut=this._search(t),Ut===-1)||this._getKey(this._array[Ut])!==t)return!1;do if(this._array[Ut]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(Ut),!0;while(++Ut<this._array.length&&this._getKey(this._array[Ut])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((s,l)=>s-l),t=0,n=new Array(this._array.length-e.length),r=0;for(let s=0;s<this._array.length;s++)e[t]===s?t++:n[r++]=this._array[s];this._array=n,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Ut=this._search(e),!(Ut<0||Ut>=this._array.length)&&this._getKey(this._array[Ut])===e))do yield this._array[Ut];while(++Ut<this._array.length&&this._getKey(this._array[Ut])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Ut=this._search(e),!(Ut<0||Ut>=this._array.length)&&this._getKey(this._array[Ut])===e))do t(this._array[Ut]);while(++Ut<this._array.length&&this._getKey(this._array[Ut])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,n=this._array.length-1;for(;n>=t;){let r=t+n>>1,s=this._getKey(this._array[r]);if(s>e)n=r-1;else if(s<e)t=r+1;else{for(;r>0&&this._getKey(this._array[r-1])===e;)r--;return r}}return t}},zv=0,sk=0,VW=class extends Ke{constructor(){super(),this._decorations=new WW(e=>e==null?void 0:e.marker.line),this._onDecorationRegistered=this._register(new we),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new we),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(Dt(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new qW(e);if(t){let n=t.marker.onDispose(()=>t.dispose()),r=t.onDispose(()=>{r.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),n.dispose())});this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,n){let r=0,s=0;for(let l of this._decorations.getKeyIterator(t))r=l.options.x??0,s=r+(l.options.width??1),e>=r&&e<s&&(!n||(l.options.layer??"bottom")===n)&&(yield l)}forEachDecorationAtCell(e,t,n,r){this._decorations.forEachByKey(t,s=>{zv=s.options.x??0,sk=zv+(s.options.width??1),e>=zv&&e<sk&&(!n||(s.options.layer??"bottom")===n)&&r(s)})}},qW=class extends io{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new we),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new we),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=Lt.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=Lt.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},KW=1e3,GW=class{constructor(e,t=KW){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,n){this._rowCount=n,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t;let r=performance.now();if(r-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){let s=r-this._lastRefreshMs,l=this._debounceThresholdMS-s;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},l)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}},ok=20,Wf=class extends Ke{constructor(e,t,n,r){super(),this._terminal=e,this._coreBrowserService=n,this._renderService=r,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let s=this._coreBrowserService.mainDocument;this._accessibilityContainer=s.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=s.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let l=0;l<this._terminal.rows;l++)this._rowElements[l]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[l]);if(this._topBoundaryFocusListener=l=>this._handleBoundaryFocus(l,0),this._bottomBoundaryFocusListener=l=>this._handleBoundaryFocus(l,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=s.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new GW(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this._register(this._terminal.onResize(l=>this._handleResize(l.rows))),this._register(this._terminal.onRender(l=>this._refreshRows(l.start,l.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(l=>this._handleChar(l))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
485
+ `))),this._register(this._terminal.onA11yTab(l=>this._handleTab(l))),this._register(this._terminal.onKey(l=>this._handleKey(l.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(Ie(s,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(Dt(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<ok+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
486
+ `&&(this._liveRegionLineCount++,this._liveRegionLineCount===ok+1&&(this._liveRegion.textContent+=z_.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let n=this._terminal.buffer,r=n.lines.length.toString();for(let s=e;s<=t;s++){let l=n.lines.get(n.ydisp+s),a=[],u=(l==null?void 0:l.translateToString(!0,void 0,void 0,a))||"",h=(n.ydisp+s+1).toString(),d=this._rowElements[s];d&&(u.length===0?(d.textContent=" ",this._rowColumns.set(d,[0,1])):(d.textContent=u,this._rowColumns.set(d,a)),d.setAttribute("aria-posinset",h),d.setAttribute("aria-setsize",r),this._alignRowWidth(d))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let n=e.target,r=this._rowElements[t===0?1:this._rowElements.length-2],s=n.getAttribute("aria-posinset"),l=t===0?"1":`${this._terminal.buffer.lines.length}`;if(s===l||e.relatedTarget!==r)return;let a,u;if(t===0?(a=n,u=this._rowElements.pop(),this._rowContainer.removeChild(u)):(a=this._rowElements.shift(),u=n,this._rowContainer.removeChild(a)),a.removeEventListener("focus",this._topBoundaryFocusListener),u.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let h=this._createAccessibilityTreeNode();this._rowElements.unshift(h),this._rowContainer.insertAdjacentElement("afterbegin",h)}else{let h=this._createAccessibilityTreeNode();this._rowElements.push(h),this._rowContainer.appendChild(h)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){var u;if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error("anchorNode and/or focusNode are null");return}let t={node:e.anchorNode,offset:e.anchorOffset},n={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===n.node&&t.offset>n.offset)&&([t,n]=[n,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let r=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:r,offset:((u=r.textContent)==null?void 0:u.length)??0}),!this._rowContainer.contains(n.node))return;let s=({node:h,offset:d})=>{let p=h instanceof Text?h.parentNode:h,m=parseInt(p==null?void 0:p.getAttribute("aria-posinset"),10)-1;if(isNaN(m))return console.warn("row is invalid. Race condition?"),null;let _=this._rowColumns.get(p);if(!_)return console.warn("columns is null. Race condition?"),null;let y=d<_.length?_[d]:_.slice(-1)[0]+1;return y>=this._terminal.cols&&(++m,y=0),{row:m,column:y}},l=s(t),a=s(n);if(!(!l||!a)){if(l.row>a.row||l.row===a.row&&l.column>=a.column)throw new Error("invalid range");this._terminal.select(l.column,l.row,(a.row-l.row)*this._terminal.cols-l.column+a.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let t=this._rowContainer.children.length;t<this._terminal.rows;t++)this._rowElements[t]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[t]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){var s,l;e.style.transform="";let t=e.getBoundingClientRect().width,n=(l=(s=this._rowColumns.get(e))==null?void 0:s.slice(-1))==null?void 0:l[0];if(!n)return;let r=n*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${r/t})`}};Wf=It([ke(1,e0),ke(2,vs),ke(3,_s)],Wf);var vy=class extends Ke{constructor(e,t,n,r,s){super(),this._element=e,this._mouseService=t,this._renderService=n,this._bufferService=r,this._linkProviderService=s,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new we),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new we),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(Dt(()=>{var l;nl(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,(l=this._activeProviderReplies)==null||l.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(Ie(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(Ie(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(Ie(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(Ie(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let n=e.composedPath();for(let r=0;r<n.length;r++){let s=n[r];if(s.classList.contains("xterm"))break;if(s.classList.contains("xterm-hover"))return}(!this._lastBufferCell||t.x!==this._lastBufferCell.x||t.y!==this._lastBufferCell.y)&&(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){var r,s;(!this._activeProviderReplies||!t)&&((r=this._activeProviderReplies)==null||r.forEach(l=>{l==null||l.forEach(a=>{a.link.dispose&&a.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let n=!1;for(let[l,a]of this._linkProviderService.linkProviders.entries())t?(s=this._activeProviderReplies)!=null&&s.get(l)&&(n=this._checkLinkProviderResult(l,e,n)):a.provideLinks(e.y,u=>{var d,p;if(this._isMouseOut)return;let h=u==null?void 0:u.map(m=>({link:m}));(d=this._activeProviderReplies)==null||d.set(l,h),n=this._checkLinkProviderResult(l,e,n),((p=this._activeProviderReplies)==null?void 0:p.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let n=new Set;for(let r=0;r<t.size;r++){let s=t.get(r);if(s)for(let l=0;l<s.length;l++){let a=s[l],u=a.link.range.start.y<e?0:a.link.range.start.x,h=a.link.range.end.y>e?this._bufferService.cols:a.link.range.end.x;for(let d=u;d<=h;d++){if(n.has(d)){s.splice(l--,1);break}n.add(d)}}}}_checkLinkProviderResult(e,t,n){var l;if(!this._activeProviderReplies)return n;let r=this._activeProviderReplies.get(e),s=!1;for(let a=0;a<e;a++)(!this._activeProviderReplies.has(a)||this._activeProviderReplies.get(a))&&(s=!0);if(!s&&r){let a=r.find(u=>this._linkAtPosition(u.link,t));a&&(n=!0,this._handleNewLink(a))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)for(let a=0;a<this._activeProviderReplies.size;a++){let u=(l=this._activeProviderReplies.get(a))==null?void 0:l.find(h=>this._linkAtPosition(h.link,t));if(u){n=!0,this._handleNewLink(u);break}}return n}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&YW(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){!this._currentLink||!this._lastMouseEvent||(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,nl(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0?!0:e.link.decorations.underline,pointerCursor:e.link.decorations===void 0?!0:e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>{var n,r;return(r=(n=this._currentLink)==null?void 0:n.state)==null?void 0:r.decorations.pointerCursor},set:n=>{var r;(r=this._currentLink)!=null&&r.state&&this._currentLink.state.decorations.pointerCursor!==n&&(this._currentLink.state.decorations.pointerCursor=n,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",n))}},underline:{get:()=>{var n,r;return(r=(n=this._currentLink)==null?void 0:n.state)==null?void 0:r.decorations.underline},set:n=>{var r,s,l;(r=this._currentLink)!=null&&r.state&&((l=(s=this._currentLink)==null?void 0:s.state)==null?void 0:l.decorations.underline)!==n&&(this._currentLink.state.decorations.underline=n,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,n))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(n=>{if(!this._currentLink)return;let r=n.start===0?0:n.start+1+this._bufferService.buffer.ydisp,s=this._bufferService.buffer.ydisp+1+n.end;if(this._currentLink.link.range.start.y>=r&&this._currentLink.link.range.end.y<=s&&(this._clearCurrentLink(r,s),this._lastMouseEvent)){let l=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);l&&this._askForLink(l,!1)}})))}_linkHover(e,t,n){var r;(r=this._currentLink)!=null&&r.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),t.hover&&t.hover(n,t.text)}_fireUnderlineEvent(e,t){let n=e.range,r=this._bufferService.buffer.ydisp,s=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-r-1,n.end.x,n.end.y-r-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(s)}_linkLeave(e,t,n){var r;(r=this._currentLink)!=null&&r.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),t.leave&&t.leave(n,t.text)}_linkAtPosition(e,t){let n=e.range.start.y*this._bufferService.cols+e.range.start.x,r=e.range.end.y*this._bufferService.cols+e.range.end.x,s=t.y*this._bufferService.cols+t.x;return n<=s&&s<=r}_positionFromMouseEvent(e,t,n){let r=n.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(r)return{x:r[0],y:r[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,n,r,s){return{x1:e,y1:t,x2:n,y2:r,cols:this._bufferService.cols,fg:s}}};vy=It([ke(1,t0),ke(2,_s),ke(3,qn),ke(4,zN)],vy);function YW(e,t){return e.text===t.text&&e.range.start.x===t.range.start.x&&e.range.start.y===t.range.start.y&&e.range.end.x===t.range.end.x&&e.range.end.y===t.range.end.y}var XW=class extends FW{constructor(e={}){super(e),this._linkifier=this._register(new ka),this.browser=tA,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new ka),this._onCursorMove=this._register(new we),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new we),this.onKey=this._onKey.event,this._onRender=this._register(new we),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new we),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new we),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new we),this.onBell=this._onBell.event,this._onFocus=this._register(new we),this._onBlur=this._register(new we),this._onA11yCharEmitter=this._register(new we),this._onA11yTabEmitter=this._register(new we),this._onWillOpen=this._register(new we),this._setup(),this._decorationService=this._instantiationService.createInstance(VW),this._instantiationService.setService(ed,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(I$),this._instantiationService.setService(zN,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(B_)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(t=>this.refresh((t==null?void 0:t.start)??0,(t==null?void 0:t.end)??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(t=>this._reportWindowsOptions(t))),this._register(this._inputHandler.onColor(t=>this._handleColorEvent(t))),this._register(Nn.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(Nn.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(Nn.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(Nn.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(Dt(()=>{var t,n;this._customKeyEventHandler=void 0,(n=(t=this.element)==null?void 0:t.parentNode)==null||n.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}_handleColorEvent(e){if(this._themeService)for(let t of e){let n,r="";switch(t.index){case 256:n="foreground",r="10";break;case 257:n="background",r="11";break;case 258:n="cursor",r="12";break;default:n="ansi",r="4;"+t.index}switch(t.type){case 0:let s=Tt.toColorRGB(n==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[n]);this.coreService.triggerDataEvent(`${ge.ESC}]${r};${jW(s)}${JN.ST}`);break;case 1:if(n==="ansi")this._themeService.modifyColors(l=>l.ansi[t.index]=Qt.toColor(...t.color));else{let l=n;this._themeService.modifyColors(a=>a[l]=Qt.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index);break}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(Wf,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(ge.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var e;return(e=this.textarea)==null?void 0:e.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(ge.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let n=Math.min(this.buffer.x,this.cols-1),r=this._renderService.dimensions.css.cell.height,s=t.getWidth(n),l=this._renderService.dimensions.css.cell.width*s,a=this.buffer.y*this._renderService.dimensions.css.cell.height,u=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=u+"px",this.textarea.style.top=a+"px",this.textarea.style.width=l+"px",this.textarea.style.height=r+"px",this.textarea.style.lineHeight=r+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(Ie(this.element,"copy",t=>{this.hasSelection()&&eU(t,this._selectionService)}));let e=t=>tU(t,this.textarea,this.coreService,this.optionsService);this._register(Ie(this.textarea,"paste",e)),this._register(Ie(this.element,"paste",e)),nA?this._register(Ie(this.element,"mousedown",t=>{t.button===2&&g2(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(Ie(this.element,"contextmenu",t=>{g2(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),c0&&this._register(Ie(this.element,"auxclick",t=>{t.button===1&&RN(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(Ie(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(Ie(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(Ie(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(Ie(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(Ie(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(Ie(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(Ie(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){var s;if(!e)throw new Error("Terminal requires a parent element.");if(e.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((s=this.element)==null?void 0:s.ownerDocument.defaultView)&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),e.appendChild(this.element);let t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),t.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(Ie(this.screenElement,"mousemove",l=>this.updateCursorStyle(l))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let n=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",j_.get()),sA||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange("disableStdin",()=>n.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(P$,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(vs,this._coreBrowserService),this._register(Ie(this.textarea,"focus",l=>this._handleTextAreaFocus(l))),this._register(Ie(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(sy,this._document,this._helperContainer),this._instantiationService.setService(Rp,this._charSizeService),this._themeService=this._instantiationService.createInstance(cy),this._instantiationService.setService(Fa,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(Ff),this._instantiationService.setService(jN,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(ly,this.rows,this.screenElement)),this._instantiationService.setService(_s,this._renderService),this._register(this._renderService.onRenderedViewportChange(l=>this._onRender.fire(l))),this.onResize(l=>this._renderService.resize(l.cols,l.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(ny,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(oy),this._instantiationService.setService(t0,this._mouseService);let r=this._linkifier.value=this._register(this._instantiationService.createInstance(vy,this.screenElement));this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this._register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this._register(this.onBlur(()=>this._renderService.handleBlur())),this._register(this.onFocus(()=>this._renderService.handleFocus())),this._viewport=this._register(this._instantiationService.createInstance(ey,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(l=>{super.scrollLines(l,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(ay,this.element,this.screenElement,r)),this._instantiationService.setService(cU,this._selectionService),this._register(this._selectionService.onRequestScrollLines(l=>this.scrollLines(l.amount,l.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(l=>this._renderService.handleSelectionChanged(l.start,l.end,l.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(l=>{this.textarea.value=l,this.textarea.focus(),this.textarea.select()})),this._register(Nn.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var l;this._selectionService.refresh(),(l=this._viewport)==null||l.queueSync()})),this._register(this._instantiationService.createInstance(ty,this.screenElement)),this._register(Ie(this.element,"mousedown",l=>this._selectionService.handleMouseDown(l))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(Wf,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",l=>this._handleScreenReaderModeOptionChange(l))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Hf,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",l=>{!this._overviewRulerRenderer&&l&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Hf,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(iy,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function n(l){var d,p,m,_,y;let a=e._mouseService.getMouseReportCoords(l,e.screenElement);if(!a)return!1;let u,h;switch(l.overrideType||l.type){case"mousemove":h=32,l.buttons===void 0?(u=3,l.button!==void 0&&(u=l.button<3?l.button:3)):u=l.buttons&1?0:l.buttons&4?1:l.buttons&2?2:3;break;case"mouseup":h=0,u=l.button<3?l.button:3;break;case"mousedown":h=1,u=l.button<3?l.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(l)===!1)return!1;let w=l.deltaY;if(w===0||e.coreMouseService.consumeWheelEvent(l,(_=(m=(p=(d=e._renderService)==null?void 0:d.dimensions)==null?void 0:p.device)==null?void 0:m.cell)==null?void 0:_.height,(y=e._coreBrowserService)==null?void 0:y.dpr)===0)return!1;h=w<0?0:1,u=4;break;default:return!1}return h===void 0||u===void 0||u>4?!1:e.coreMouseService.triggerMouseEvent({col:a.col,row:a.row,x:a.x,y:a.y,button:u,action:h,ctrl:l.ctrlKey,alt:l.altKey,shift:l.shiftKey})}let r={mouseup:null,wheel:null,mousedrag:null,mousemove:null},s={mouseup:l=>(n(l),l.buttons||(this._document.removeEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.removeEventListener("mousemove",r.mousedrag)),this.cancel(l)),wheel:l=>(n(l),this.cancel(l,!0)),mousedrag:l=>{l.buttons&&n(l)},mousemove:l=>{l.buttons||n(l)}};this._register(this.coreMouseService.onProtocolChange(l=>{l?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(l)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),l&8?r.mousemove||(t.addEventListener("mousemove",s.mousemove),r.mousemove=s.mousemove):(t.removeEventListener("mousemove",r.mousemove),r.mousemove=null),l&16?r.wheel||(t.addEventListener("wheel",s.wheel,{passive:!1}),r.wheel=s.wheel):(t.removeEventListener("wheel",r.wheel),r.wheel=null),l&2?r.mouseup||(r.mouseup=s.mouseup):(this._document.removeEventListener("mouseup",r.mouseup),r.mouseup=null),l&4?r.mousedrag||(r.mousedrag=s.mousedrag):(this._document.removeEventListener("mousemove",r.mousedrag),r.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(Ie(t,"mousedown",l=>{if(l.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(l)))return n(l),r.mouseup&&this._document.addEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.addEventListener("mousemove",r.mousedrag),this.cancel(l)})),this._register(Ie(t,"wheel",l=>{var a,u,h,d,p;if(!r.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(l)===!1)return!1;if(!this.buffer.hasScrollback){if(l.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(l,(d=(h=(u=(a=e._renderService)==null?void 0:a.dimensions)==null?void 0:u.device)==null?void 0:h.cell)==null?void 0:d.height,(p=e._coreBrowserService)==null?void 0:p.dpr)===0)return this.cancel(l,!0);let m=ge.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(l.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(m,!0),this.cancel(l,!0)}}},{passive:!1}))}refresh(e,t){var n;(n=this._renderService)==null||n.refreshRows(e,t)}updateCursorStyle(e){var t;(t=this._selectionService)!=null&&t.shouldColumnSelect(e)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,t){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,t),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}paste(e){EN(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(e,t,n){this._selectionService.setSelection(e,t,n)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(!(!this._selectionService||!this._selectionService.hasSelection))return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var e;(e=this._selectionService)==null||e.clearSelection()}selectAll(){var e;(e=this._selectionService)==null||e.selectAll()}selectLines(e,t){var n;(n=this._selectionService)==null||n.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!t&&(e.key==="Dead"||e.key==="AltGraph")&&(this._unprocessedDeadKey=!0);let n=$W(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),n.type===3||n.type===2){let r=this.rows-1;return this.scrollLines(n.type===2?-r:r),this.cancel(e,!0)}if(n.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(n.cancel&&this.cancel(e,!0),!n.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((n.key===ge.ETX||n.key===ge.CR)&&(this.textarea.value=""),this._onKey.fire({key:n.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(n.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let n=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState("AltGraph");return t.type==="keypress"?n:n&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(ZW(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else if(e.which!==0&&e.charCode!==0)t=e.which;else return!1;return!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&e.inputType==="insertText"&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){if(e===this.cols&&t===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,t)}_afterResize(e,t){var n;(n=this._charSizeService)==null||n.measure()}clear(){if(!(this.buffer.ybase===0&&this.buffer.y===0)){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(Zt));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){var t;this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),(t=this._selectionService)==null||t.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){var e;(e=this._renderService)==null||e.clearTextureAtlas()}_reportFocus(){var e;(e=this.element)!=null&&e.classList.contains("focus")?this.coreService.triggerDataEvent(ge.ESC+"[I"):this.coreService.triggerDataEvent(ge.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let t=this._renderService.dimensions.css.canvas.width.toFixed(0),n=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${ge.ESC}[4;${n};${t}t`);break;case 1:let r=this._renderService.dimensions.css.cell.width.toFixed(0),s=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${ge.ESC}[6;${s};${r}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function ZW(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var QW=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let n={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(n),t.dispose=()=>this._wrappedAddonDispose(n),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let n=0;n<this._addons.length;n++)if(this._addons[n]===e){t=n;break}if(t===-1)throw new Error("Could not dispose an addon that has not been loaded");e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}},JW=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,t){if(!(e<0||e>=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new Kr)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}},lk=class{constructor(e,t){this._buffer=e,this.type=t}init(e){return this._buffer=e,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(e){let t=this._buffer.lines.get(e);if(t)return new JW(t)}getNullCell(){return new Kr}},eV=class extends Ke{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new we),this.onBufferChange=this._onBufferChange.event,this._normal=new lk(this._core.buffers.normal,"normal"),this._alternate=new lk(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate(()=>this._onBufferChange.fire(this.active))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}},tV=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,n=>t(n.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(n,r)=>t(n,r.toArray()))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}},nV=class{constructor(e){this._core=e}register(e){this._core.unicodeService.register(e)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(e){this._core.unicodeService.activeVersion=e}},rV=["cols","rows"],_i=0,iV=class extends Ke{constructor(e){super(),this._core=this._register(new XW(e)),this._addonManager=this._register(new QW),this._publicOptions={...this._core.options};let t=r=>this._core.options[r],n=(r,s)=>{this._checkReadonlyOptions(r),this._core.options[r]=s};for(let r in this._core.options){let s={get:t.bind(this,r),set:n.bind(this,r)};Object.defineProperty(this._publicOptions,r,s)}}_checkReadonlyOptions(e){if(rV.includes(e))throw new Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new tV(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new nV(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this._register(new eV(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t="none";switch(this._core.coreMouseService.activeProtocol){case"X10":t="x10";break;case"VT200":t="vt200";break;case"DRAG":t="drag";break;case"ANY":t="any";break}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,n){this._verifyIntegers(e,t,n),this._core.select(e,t,n)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r
487
+ `,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return j_.get()},set promptLabel(e){j_.set(e)},get tooMuchOutput(){return z_.get()},set tooMuchOutput(e){z_.set(e)}}}_verifyIntegers(...e){for(_i of e)if(_i===1/0||isNaN(_i)||_i%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(_i of e)if(_i&&(_i===1/0||isNaN(_i)||_i%1!==0||_i<0))throw new Error("This API only accepts positive integers")}};const mA="lever-theme",gA=b.createContext(void 0),sV=e=>e==="light"||e==="dark"||e==="system",vA=()=>typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",ak=e=>{if(typeof document>"u")return;const t=e==="system"?vA():e;document.documentElement.classList.toggle("dark",t==="dark")},oV=()=>{if(typeof window>"u")return"system";const e=window.localStorage.getItem(mA);return sV(e)?e:"system"};function lV({children:e}){const[t,n]=b.useState(oV);b.useEffect(()=>{ak(t),typeof window<"u"&&window.localStorage.setItem(mA,t)},[t]),b.useEffect(()=>{if(t!=="system")return;const s=window.matchMedia("(prefers-color-scheme: dark)"),l=()=>ak("system");return s.addEventListener?(s.addEventListener("change",l),()=>s.removeEventListener("change",l)):(s.addListener(l),()=>s.removeListener(l))},[t]);const r=b.useMemo(()=>{const s=t==="system"?vA():t;return{theme:t,resolvedTheme:s,setTheme:n}},[t]);return g.jsx(gA.Provider,{value:r,children:e})}function _A(){const e=b.useContext(gA);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}const aV={foreground:"#0f172a",background:"transparent",cursor:"#000000",cursorAccent:"#ffffff",selectionBackground:"rgba(221,228,236,0.55)",selectionInactiveBackground:"rgba(221,228,236,0.38)",black:"#0f172a",red:"#dc2626",green:"#16a34a",yellow:"#ca8a04",blue:"#2563eb",magenta:"#9333ea",cyan:"#0891b2",white:"#94a3b8",brightBlack:"#475569",brightRed:"#ef4444",brightGreen:"#22c55e",brightYellow:"#eab308",brightBlue:"#3b82f6",brightMagenta:"#a855f7",brightCyan:"#06b6d4",brightWhite:"#e2e8f0"},cV={foreground:"#f8fafc",background:"transparent",cursor:"#ffffff",cursorAccent:"#000000",selectionBackground:"rgba(248,250,252,0.28)",selectionInactiveBackground:"rgba(248,250,252,0.18)",black:"#0f172a",red:"#f87171",green:"#4ade80",yellow:"#facc15",blue:"#60a5fa",magenta:"#c084fc",cyan:"#22d3ee",white:"#cbd5e1",brightBlack:"#64748b",brightRed:"#fca5a5",brightGreen:"#86efac",brightYellow:"#fde047",brightBlue:"#93c5fd",brightMagenta:"#d8b4fe",brightCyan:"#67e8f9",brightWhite:"#f8fafc"};function yA(e){return{cols:Math.max(1,e.cols||80),rows:Math.max(1,e.rows||24)}}function bA(e,t){var w,S,C,k,T;const n=e.element,r=(k=(C=(S=(w=e._core)==null?void 0:w._renderService)==null?void 0:S.dimensions)==null?void 0:C.css)==null?void 0:k.cell,s=(r==null?void 0:r.width)??0,l=(r==null?void 0:r.height)??0;if(!n||!Number.isFinite(s)||!Number.isFinite(l)||s<=0||l<=0)return null;const a=t.getBoundingClientRect(),u=window.getComputedStyle(t),h=window.getComputedStyle(n),d=e.options.scrollback===0?0:((T=e.options.overviewRuler)==null?void 0:T.width)??14,p=parseFloat(u.paddingLeft)+parseFloat(u.paddingRight)+parseFloat(h.paddingLeft)+parseFloat(h.paddingRight),m=parseFloat(u.paddingTop)+parseFloat(u.paddingBottom)+parseFloat(h.paddingTop)+parseFloat(h.paddingBottom),_=Math.max(0,a.width-p-d-1),y=Math.max(0,a.height-m);return{cols:Math.max(2,Math.floor(_/s)),rows:Math.max(1,Math.floor(y/l))}}function Fh(e){e.refresh(0,Math.max(0,e.rows-1))}function Uh(e,t,n,r,s){const l=bA(e,t)??yA(e);return n.current&&n.current.cols===l.cols&&n.current.rows===l.rows||(e.resize(l.cols,l.rows),n.current=l,r&&s(l.cols,l.rows)),l}function uV({projectId:e,terminalId:t,socket:n,scrollback:r,connectionStatus:s,clearVersion:l=0,focusRequestVersion:a=0,onPathChange:u}){const{resolvedTheme:h}=_A(),d=b.useRef(null),p=b.useRef(null),m=b.useRef(null),_=b.useRef(!1),y=b.useRef(0),w=b.useRef(null),S=b.useRef(null),[C,k]=b.useState(null),[T,R]=b.useState(null),N=h==="dark"?cV:aV,j=(D,B)=>{n.command({type:"terminal.resize",terminalId:t,cols:D,rows:B}).catch(()=>{})},A=()=>{const D=()=>{const B=p.current,K=d.current;!B||!K||!_.current||Uh(B,K,S,!0,j)};requestAnimationFrame(()=>{D(),setTimeout(D,0)})};return b.useEffect(()=>{const D=new iV({scrollback:r,cursorBlink:!0,cursorStyle:"bar",cursorWidth:1,lineHeight:1.1,convertEol:!1,allowTransparency:!0,fontFamily:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace",fontSize:13,theme:N}),B=new UF;D.loadAddon(B),D.loadAddon(new YF),p.current=D;const K=d.current;K&&(D.open(K),m.current&&D.write(m.current),Uh(D,K,S,!1,()=>{}),Fh(D),A());const z=D.onData(F=>{n.command({type:"terminal.input",terminalId:t,data:F}).catch(q=>{R(q instanceof Error?q.message:String(q))})}),U=D.onResize(({cols:F,rows:q})=>{if(!_.current)return;const $={cols:F,rows:q};S.current&&S.current.cols===F&&S.current.rows===q||(S.current=$,j(F,q))}),H=new ResizeObserver(()=>{const F=p.current,q=d.current;!F||!q||Uh(F,q,S,_.current,($,P)=>{n.command({type:"terminal.resize",terminalId:t,cols:$,rows:P}).catch(()=>{})})});return K&&H.observe(K),()=>{H.disconnect(),U.dispose(),z.dispose(),m.current=B.serialize(),D.dispose(),p.current=null}},[r,n,t,N]),b.useEffect(()=>{const D=p.current;D&&(D.options.scrollback=r)},[r]),b.useEffect(()=>{const D=p.current;D&&(D.options.theme=N,Fh(D))},[N]),b.useEffect(()=>{if(a===0)return;const D=p.current;D&&requestAnimationFrame(()=>{D.focus()})},[a]),b.useEffect(()=>{if(l===0)return;const D=p.current;D&&(_.current=!1,y.current+=1,w.current=null,m.current=null,k(null),R(null),D.reset(),Fh(D),n.command({type:"terminal.close",terminalId:t}).catch(B=>{R(B instanceof Error?B.message:String(B))}))},[l,n,t]),b.useEffect(()=>{u==null||u((C==null?void 0:C.cwd)??null)},[C==null?void 0:C.cwd,u]),b.useEffect(()=>{const D=z=>{const U=p.current;if(!U)return;const H=JSON.stringify({cwd:z.cwd,shell:z.shell,cols:z.cols,rows:z.rows,scrollback:z.scrollback,status:z.status,exitCode:z.exitCode,serializedState:z.serializedState});if(w.current===H){k({cwd:z.cwd,shell:z.shell,status:z.status,exitCode:z.exitCode}),m.current=z.serializedState||null;return}w.current=H,k({cwd:z.cwd,shell:z.shell,status:z.status,exitCode:z.exitCode}),m.current=z.serializedState||null,U.options.scrollback=z.scrollback,U.reset(),z.serializedState&&U.write(z.serializedState),Fh(U)},B=()=>{const z=p.current,U=d.current;if(!z||!U)return;const H=bA(z,U)??yA(z);z.resize(H.cols,H.rows),S.current=H,n.command({type:"terminal.create",projectId:e,terminalId:t,cols:H.cols,rows:H.rows,scrollback:r}).then(F=>{_.current=!0,R(null),F&&D(F),A()}).catch(F=>{R(F instanceof Error?F.message:String(F))})},K=()=>{const z=++y.current,U=()=>{if(y.current!==z)return;const H=p.current,F=d.current;if(!H||!F)return;Uh(H,F,S,!1,()=>{});const q=F.getBoundingClientRect();if(q.width<=0||q.height<=0){requestAnimationFrame(U);return}B()};requestAnimationFrame(()=>{requestAnimationFrame(U)})};return K(),n.subscribeTerminal(t,{onSnapshot:z=>{if(!z){_.current=!1,w.current=null,s==="connected"&&K();return}_.current=!0,R(null),D(z),A()},onEvent:z=>{const U=p.current;if(U){if(z.type==="terminal.output"){U.write(z.data);return}z.type==="terminal.exit"&&k(H=>({cwd:(H==null?void 0:H.cwd)??"",shell:(H==null?void 0:H.shell)??"",status:"exited",exitCode:z.exitCode}))}}})},[s,e,r,n,t]),g.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden pb-4",children:[g.jsx("div",{className:"flex min-h-0 min-w-0 flex-1 overflow-hidden px-3 py-1",children:g.jsx("div",{ref:d,className:"kanna-terminal min-h-0 min-w-0 flex-1 overflow-hidden w-full"})}),T?g.jsxs("div",{className:"px-3 py-1 text-xs text-destructive",children:["Terminal error: ",T]}):null]})}const dV=24;function xA(e){return e+dV}function hV(e,t){return Math.max(1,e)*xA(t)}function ck({projectId:e,layout:t,socket:n,connectionStatus:r,scrollback:s,minColumnWidth:l,focusRequestVersion:a=0,splitTerminalShortcut:u,onAddTerminal:h,onRemoveTerminal:d,onTerminalLayout:p}){const m=b.useRef(null),_=b.useRef({}),y=b.useRef([]),[w,S]=b.useState(0),[C,k]=b.useState({}),[T,R]=b.useState({});b.useLayoutEffect(()=>{const K=m.current;if(!K)return;const z=()=>{S(K.getBoundingClientRect().width)},U=new ResizeObserver(z);return U.observe(K),z(),()=>U.disconnect()},[]);const N=t.terminals.length,j=xA(l),A=hV(N,l),D=Math.max(w,A),B=b.useMemo(()=>t.terminals.map(K=>K.id).join(":"),[t.terminals]);return b.useLayoutEffect(()=>{const K=y.current,z=t.terminals.map(F=>F.id),U=z.find(F=>!K.includes(F));if(y.current=z,!U||K.length===0)return;const H=_.current[U];H&&H.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})},[t.terminals]),g.jsx("div",{className:"flex h-full min-h-0 flex-col",children:g.jsx("div",{ref:m,className:"min-h-0 flex-1 overflow-x-auto overflow-y-hidden",children:g.jsx("div",{className:"h-full min-h-0",style:{width:D||"100%"},children:g.jsx(sf,{orientation:"horizontal",className:"h-full min-h-0",onLayoutChanged:K=>p(e,t.terminals.map(z=>K[z.id]??z.size)),children:t.terminals.map((K,z)=>g.jsxs(b.Fragment,{children:[g.jsx(Fo,{id:K.id,defaultSize:`${K.size}%`,minSize:`${j}px`,className:"min-h-0 overflow-hidden",style:{minWidth:j},children:g.jsxs("div",{ref:U=>{_.current[K.id]=U},className:"flex h-full min-h-0 min-w-0 flex-col border-r border-border bg-transparent last:border-r-0",style:{minWidth:j},children:[g.jsxs("div",{className:"flex items-center gap-2 px-3 pr-2 pt-2 pb-1",children:[g.jsx("div",{className:"min-w-0 flex-1 text-left",children:g.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[g.jsx("div",{className:"shrink-0 text-sm font-medium",children:"Terminal"}),g.jsx("div",{className:"min-w-0 truncate text-xs text-muted-foreground",children:C[K.id]??""})]})}),g.jsxs("div",{className:"flex items-center gap-1",children:[g.jsx(nt,{variant:"ghost",size:"icon-sm","aria-label":"Clear terminal",onClick:()=>R(U=>({...U,[K.id]:(U[K.id]??0)+1})),children:g.jsx(U6,{className:"size-3.5"})}),g.jsxs(tu,{children:[g.jsx(nu,{asChild:!0,children:g.jsx(nt,{variant:"ghost",size:"icon-sm","aria-label":"Add terminal to the right",onClick:()=>h(e,K.id),children:g.jsx(ob,{className:"size-3.5"})})}),g.jsx(ca,{side:"bottom",shortcut:u})]}),g.jsx(nt,{variant:"ghost",size:"icon-sm","aria-label":"Archive terminal",onClick:()=>d(e,K.id),children:g.jsx(Oa,{className:"size-3.5"})})]})]}),g.jsx(uV,{projectId:e,terminalId:K.id,socket:n,scrollback:s,connectionStatus:r,clearVersion:T[K.id]??0,focusRequestVersion:z===0?a:0,onPathChange:U=>k(H=>H[K.id]===U?H:{...H,[K.id]:U})})]})}),z<t.terminals.length-1?g.jsx(of,{withHandle:!0,orientation:"horizontal"}):null]},K.id))},B)})})})}function uk(e){if(!e)return;const t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:void 0}function fV(e){var r;if(!e)return null;const t=e.trim();if(!t||/^(https?:|mailto:|ftp:|file:)/i.test(t)||!t.startsWith("/"))return null;const n=/^(?<path>\/.+?)#L(?<line>\d+)(?:C(?<column>\d+))?$/.exec(t);return(r=n==null?void 0:n.groups)!=null&&r.path?{path:n.groups.path,line:uk(n.groups.line),column:uk(n.groups.column)}:{path:t}}function Pv(e,t){if(!e)return"";if(t){const n=t.endsWith("/")?t:`${t}/`;if(e.startsWith(n))return e.slice(n.length);if(e===t)return""}return e.replace(/^\/home\/user\/workspace\//,"")}const u0=()=>{},SA=b.createContext(u0);function pV({children:e,onOpenLocalLink:t}){return g.jsx(SA.Provider,{value:t??u0,children:e})}const _y={Task:Sf,TaskOutput:Sf,Bash:ab,Glob:pv,Grep:pv,ExitPlanMode:pC,Read:G6,Edit:W6,Write:q6,NotebookEdit:qR,WebFetch:l6,TodoWrite:S6,WebSearch:pv,KillShell:jP,AskUserQuestion:WR,Skill:wu,EnterPlanMode:pC},wA=HP;function CA(e){return _y[e]?_y[e]:wA}function fo({children:e,className:t}){return g.jsx("div",{className:xe("flex gap-3 justify-start items-center",t),children:e})}function mV({children:e,className:t}){return g.jsx("div",{className:xe("flex items-center gap-1.5 text-xs",t),children:e})}function ao({children:e,className:t}){return g.jsx("span",{className:xe("font-medium text-foreground/80",t),children:e})}function gV({children:e}){return g.jsx("span",{className:"text-muted-foreground",children:e})}function Np({children:e,expandedContent:t,defaultExpanded:n=!1}){const[r,s]=b.useState(n);return g.jsxs("div",{className:"flex flex-col w-full",children:[g.jsxs("button",{onClick:()=>s(!r),className:`group/expandable-row cursor-pointer grid grid-cols-[auto_1fr] items-center gap-1 text-sm ${r?"":"hover:opacity-60 transition-opacity"}`,children:[g.jsx("div",{className:"grid grid-cols-[auto_1fr] items-center gap-1.5",children:e}),g.jsx(ds,{className:`h-4.5 w-4.5 text-muted-icon translate-y-[0.5px] transition-all duration-200 opacity-0 group-hover/expandable-row:opacity-100 ${r?"rotate-90 opacity-100":""}`})]}),r&&t]})}function dk({label:e,children:t,copyText:n}){const[r,s]=b.useState(!1),l=n??Vf(t),a=b.useCallback(async()=>{await navigator.clipboard.writeText(l),s(!0),setTimeout(()=>s(!1),2e3)},[l]);return g.jsxs("div",{children:[g.jsx("span",{className:"font-medium text-muted-foreground",children:e}),g.jsxs("div",{className:"relative group/codeblock",children:[g.jsx("pre",{className:"my-1 text-xs font-mono whitespace-no-wrap break-all bg-muted border border-border rounded-lg p-2 max-h-64 overflow-auto w-full",children:t}),g.jsx(nt,{variant:"ghost",size:"icon",className:xe("absolute top-[4px] right-[4px] z-10 h-6.5 w-6.5 rounded-sm text-muted-foreground opacity-0 group-hover/codeblock:opacity-100 transition-opacity",!r&&"hover:text-foreground",r&&"hover:!bg-transparent hover:!border-transparent"),onClick:a,children:r?g.jsx(so,{className:"h-3.5 w-3.5 text-green-400"}):g.jsx(ap,{className:"h-4 w-4"})})]})]})}function kA({children:e,icon:t,className:n}){return g.jsxs("span",{className:xe("inline-flex items-center gap-1 px-2 py-1 bg-muted border border-border rounded-full",n),children:[t&&g.jsx(t,{className:"h-3 w-3 text-muted-foreground"}),e]})}function Ap({children:e,className:t}){return g.jsxs("div",{className:xe("grid grid-cols-[auto_1fr] gap-2 min-w-0",t),children:[g.jsx("div",{className:" min-w-5 flex flex-col relative items-center justify-center",children:g.jsx("div",{className:"min-h-full w-[1px] bg-muted-foreground/20"})}),g.jsx("div",{className:"-ml-[1px] min-w-0 overflow-hidden",children:e})]})}function Vf(e){if(typeof e=="string")return e;if(typeof e=="number")return String(e);if(Array.isArray(e))return e.map(Vf).join("");if(e&&typeof e=="object"&&"props"in e){const t=e.props;return Vf(t.children)}return""}function hk(e,t){return b.isValidElement(e)?b.cloneElement(e,{className:xe(e.props.className,t)}):e}const d0={h1:({children:e})=>g.jsx("h1",{className:"text-[20px] font-normal leading-tight mt-5 mb-3 first:mt-0 last:mb-0",children:e}),h2:({children:e})=>g.jsx("h2",{className:"text-[18px] font-normal leading-tight mt-5 mb-3 first:mt-0 last:mb-0",children:e}),h3:({children:e})=>g.jsx("h3",{className:"text-[16px] font-normal leading-tight mt-5 mb-3 first:mt-0 last:mb-0",children:e}),h4:({children:e})=>g.jsx("h4",{className:"text-[16px] font-normal leading-tight mt-5 mb-3 first:mt-0 last:mb-0",children:e}),h5:({children:e})=>g.jsx("h5",{className:"text-[16px] font-normal leading-tight mt-5 mb-3 first:mt-0 last:mb-0",children:e}),h6:({children:e})=>g.jsx("h6",{className:"text-[16px] font-normal leading-tight mt-5 mb-3 first:mt-0 last:mb-0",children:e}),pre:({children:e,...t})=>{const[n,r]=b.useState(!1),s=Vf(e),l=async()=>{await navigator.clipboard.writeText(s),r(!0),setTimeout(()=>r(!1),2e3)};return g.jsxs("div",{className:"relative overflow-x-auto max-w-full min-w-0 no-code-highlight group/pre",children:[g.jsx("pre",{className:"min-w-0 rounded-xl py-2.5 px-3.5 [.no-pre-highlight_&]:bg-background",...t,children:e}),g.jsx(nt,{variant:"ghost",size:"icon",className:xe("absolute top-[35px] -translate-y-[50%] -translate-x-[1px] rounded-md right-1.5 h-8 w-8 text-muted-foreground opacity-0 group-hover/pre:opacity-100 transition-opacity",!n&&"hover:text-foreground",n&&"hover:!bg-transparent hover:!border-transparent"),onClick:l,children:n?g.jsx(so,{className:"h-4 w-4 text-green-400"}):g.jsx(ap,{className:"h-4 w-4"})})]})},code:({children:e,className:t,...n})=>t?g.jsx("code",{className:"block text-xs whitespace-pre",...n,children:e}):g.jsx("code",{className:"break-all px-1 bg-border/60 dark:[.no-pre-highlight_&]:bg-background dark:[.text-pretty_&]:bg-neutral [.no-code-highlight_&]:!bg-transparent py-0.5 rounded text-sm whitespace-wrap",...n,children:e}),table:({children:e,...t})=>g.jsx("div",{className:"border border-border rounded-xl overflow-x-auto",children:g.jsx("table",{className:"table-auto min-w-full divide-y divide-border bg-background",...t,children:e})}),tbody:({children:e,...t})=>g.jsx("tbody",{className:"divide-y divide-border",...t,children:e}),th:({children:e,...t})=>g.jsx("th",{className:"text-left text-xs uppercase text-muted-foreground tracking-wider p-2 pl-0 first:pl-3 bg-muted dark:bg-card [&_*]:font-semibold",...t,children:e}),td:({children:e,...t})=>g.jsx("td",{className:"text-left p-2 pl-0 first:pl-3 [&_*]:font-normal ",...t,children:e}),p:({children:e,...t})=>g.jsx("p",{className:"break-words mt-5 mb-3 first:mt-0 last:mb-0",...t,children:e}),blockquote:({children:e,...t})=>(()=>{const n=b.Children.toArray(e),r=n[0];r!==void 0&&(n[0]=hk(r,"mt-0"));const s=n.length-1,l=n[s];return l!==void 0&&(n[s]=hk(l,"mb-0")),g.jsx("blockquote",{className:"my-2 mt-5 mb-3 first:mt-0 last:mb-0 border-l-2 border-border/80 pl-2 text-muted-foreground",...t,children:n})})(),a:({children:e,...t})=>g.jsx("a",{className:"transition-all underline decoration-2 text-orange-500 decoration-orange-500/50 hover:text-orange-500/70 dark:text-logo dark:decoration-logo/70 dark:hover:text-logo/60 dark:hover:decoration-logo/40 ",target:"_blank",rel:"noopener noreferrer",...t,children:e})};function Dp(e){return{...d0,a:({children:t,href:n,onClick:r,...s})=>{const l=b.useContext(SA),a=fV(n);return g.jsx("a",{className:"transition-all underline decoration-2 text-orange-500 decoration-orange-500/50 hover:text-orange-500/70 dark:text-logo dark:decoration-logo/70 dark:hover:text-logo/60 dark:hover:decoration-logo/40 ",href:n,target:a?void 0:"_blank",rel:a?void 0:"noopener noreferrer",onClick:u=>{r==null||r(u),!(u.defaultPrevented||!a||l===u0)&&(u.preventDefault(),l(a))},...s,children:t})}}}({...d0});const vV={connecting:"Connecting...",acquiring_sandbox:"Booting...",initializing:"Initializing...",starting:"Starting...",running:"Running...",waiting_for_user:"Waiting...",failed:"Failed"};function _V({status:e}){const t=(e?vV[e]:void 0)||"Processing...",n=e==="failed";return g.jsx(fo,{className:"ml-[1px]",children:g.jsxs(mV,{children:[n?g.jsx(Oa,{className:"size-4.5 text-red-500"}):g.jsx(Ni,{className:"size-4.5 animate-spin text-muted-icon"}),g.jsx(yp,{className:"ml-[1px] text-sm",shimmerWidth:44,children:t})]})})}const EA=b.forwardRef(({className:e,children:t,...n},r)=>g.jsx("div",{ref:r,className:xe("relative overflow-y-auto overscroll-contain touch-pan-y scrollbar-hide",e),style:{WebkitOverflowScrolling:"touch"},...n,children:t}));EA.displayName="ScrollArea";const RA={toggleEmbeddedTerminal:"Toggle Embedded Terminal",toggleRightSidebar:"Toggle Right Sidebar",openInFinder:"Open In Finder",openInEditor:"Open In Editor",addSplitTerminal:"Add Split Terminal"};function Bv(e){return(e??[]).join(", ")}function Gc(e){return e.split(",").map(t=>t.trim()).map(t=>t.toLowerCase()).filter(Boolean)}const yV=new Map([["cmd","meta"],["meta","meta"],["ctrl","ctrl"],["control","ctrl"],["alt","alt"],["option","alt"],["shift","shift"]]);function bV(e,t){const n=xV(e);return n?t.key.toLowerCase()===n.key&&t.ctrlKey===n.ctrl&&t.metaKey===n.meta&&t.altKey===n.alt&&t.shiftKey===n.shift:!1}function Yc(e,t,n){return((e==null?void 0:e.bindings[t])??eo[t]).some(s=>bV(s,n))}function TA(e){return{bindings:{toggleEmbeddedTerminal:(e==null?void 0:e.bindings.toggleEmbeddedTerminal)??eo.toggleEmbeddedTerminal,toggleRightSidebar:(e==null?void 0:e.bindings.toggleRightSidebar)??eo.toggleRightSidebar,openInFinder:(e==null?void 0:e.bindings.openInFinder)??eo.openInFinder,openInEditor:(e==null?void 0:e.bindings.openInEditor)??eo.openInEditor,addSplitTerminal:(e==null?void 0:e.bindings.addSplitTerminal)??eo.addSplitTerminal},warning:(e==null?void 0:e.warning)??null,filePathDisplay:(e==null?void 0:e.filePathDisplay)??""}}function xV(e){const t=e.split("+").map(r=>r.trim()).filter(Boolean);if(t.length===0)return null;const n={key:"",ctrl:!1,meta:!1,alt:!1,shift:!1};for(const r of t){const s=r.toLowerCase(),l=yV.get(s);if(l==="ctrl"){n.ctrl=!0;continue}if(l==="meta"){n.meta=!0;continue}if(l==="alt"){n.alt=!0;continue}if(l==="shift"){n.shift=!0;continue}if(n.key)return null;n.key=s}return n.key?n:null}const Op=20,yy=50,MA=30;function NA(e){return Number.isFinite(e)?Math.min(yy,Math.max(Op,e)):MA}function SV(){return{isVisible:!1,size:Op}}function Iv(e,t){return e[t]??SV()}function wV(e){return!e||typeof e!="object"?{projects:{}}:{projects:Object.fromEntries(Object.entries(e.projects??{}).map(([r,s])=>[r,{isVisible:!1,size:NA(s.size??MA)}]))}}const mf=Ia()(Ha(e=>({projects:{},toggleVisibility:t=>e(n=>({projects:{...n.projects,[t]:{...Iv(n.projects,t),isVisible:!Iv(n.projects,t).isVisible}}})),setSize:(t,n)=>e(r=>({projects:{...r.projects,[t]:{...Iv(r.projects,t),size:NA(n)}}})),clearProject:t=>e(n=>{const{[t]:r,...s}=n.projects;return{projects:s}})}),{name:"right-sidebar-layouts",version:2,migrate:wV})),CV={isVisible:!1,size:Op},AA=[68,32];function kV(){return{isVisible:!1,mainSizes:[...AA],terminals:[],nextTerminalIndex:0}}function EV(e,t){return e[t]??kV()}function Hv(e){if(e.length===0)return[];const t=e.reduce((n,r)=>n+Math.max(r,0),0);return!Number.isFinite(t)||t<=0?Array.from({length:e.length},()=>100/e.length):e.map(n=>Math.max(n,0)/t*100)}function RV(e){let t=e,n="";do n=String.fromCharCode(65+t%26)+n,t=Math.floor(t/26)-1;while(t>=0);return`Terminal ${n}`}function TV(e){if(e.length===0)return e;const t=e.length+1;return e.map(n=>({...n,size:n.size*e.length/t}))}function Xc(e,t,n){return{...e,[t]:n(EV(e,t))}}const Wo=Ia()(Ha(e=>({projects:{},addTerminal:(t,n)=>e(r=>({projects:Xc(r.projects,t,s=>{var h,d;const l=TV(s.terminals),a={id:((d=(h=globalThis.crypto)==null?void 0:h.randomUUID)==null?void 0:d.call(h))??`terminal-${Date.now()}-${s.nextTerminalIndex}`,title:RV(s.nextTerminalIndex),size:100/(l.length+1)},u=n?Math.max(l.findIndex(p=>p.id===n)+1,0):l.length;return{...s,isVisible:!0,nextTerminalIndex:s.nextTerminalIndex+1,terminals:[...l.slice(0,u),a,...l.slice(u)]}})})),removeTerminal:(t,n)=>e(r=>({projects:Xc(r.projects,t,s=>{const l=s.terminals.filter(u=>u.id!==n);if(l.length===0)return{...s,isVisible:!1,terminals:[]};const a=Hv(l.map(u=>u.size));return{...s,terminals:l.map((u,h)=>({...u,size:a[h]??100/l.length}))}})})),toggleVisibility:t=>e(n=>({projects:Xc(n.projects,t,r=>({...r,isVisible:r.terminals.length>0?!r.isVisible:!1}))})),setMainSizes:(t,n)=>e(r=>{if(n.length!==2)return r;const s=Hv(n);return{projects:Xc(r.projects,t,l=>({...l,mainSizes:s}))}}),setTerminalSizes:(t,n)=>e(r=>({projects:Xc(r.projects,t,s=>{if(n.length!==s.terminals.length)return s;const l=Hv(n);return{...s,terminals:s.terminals.map((a,u)=>({...a,size:l[u]??a.size}))}})})),clearProject:t=>e(n=>{const{[t]:r,...s}=n.projects;return{projects:s}})}),{name:"terminal-layouts",version:1})),MV={isVisible:!1,mainSizes:[...AA],terminals:[],nextTerminalIndex:0},qf=1e3,by=500,xy=5e3,Kf=450,Sy=250,wy=900,Cy="cursor";function ky(e){switch(e){case"vscode":return"code {path}";case"windsurf":return"windsurf {path}";case"custom":return"cursor {path}";case"cursor":default:return"cursor {path}"}}function NV(e){switch(e){case"vscode":return"VS Code";case"windsurf":return"Windsurf";case"custom":return"Custom";case"cursor":default:return"Cursor"}}function fk(e){return Number.isFinite(e)?Math.min(xy,Math.max(by,Math.round(e))):qf}function pk(e){return Number.isFinite(e)?Math.min(wy,Math.max(Sy,Math.round(e))):Kf}function mk(e){switch(e){case"vscode":case"windsurf":case"custom":case"cursor":return e;default:return Cy}}function Fv(e,t){const n=e==null?void 0:e.trim();return n&&n.length>0?n:ky(t)}const Ur=Ia()(Ha(e=>({scrollbackLines:qf,minColumnWidth:Kf,editorPreset:Cy,editorCommandTemplate:ky(Cy),setScrollbackLines:t=>e({scrollbackLines:fk(t)}),setMinColumnWidth:t=>e({minColumnWidth:pk(t)}),setEditorPreset:t=>e(n=>{const r=mk(t);return{editorPreset:r,editorCommandTemplate:r==="custom"?Fv(n.editorCommandTemplate,r):ky(r)}}),setEditorCommandTemplate:t=>e(n=>({editorCommandTemplate:Fv(t,n.editorPreset)}))}),{name:"terminal-preferences",version:3,migrate:e=>{const t=e,n=mk(t==null?void 0:t.editorPreset);return{scrollbackLines:fk((t==null?void 0:t.scrollbackLines)??qf),minColumnWidth:pk((t==null?void 0:t.minColumnWidth)??Kf),editorPreset:n,editorCommandTemplate:Fv(t==null?void 0:t.editorCommandTemplate,n)}}})),ha=350,AV=[.4,0,.2,1],DV=8,gk=1e-6;function OV(e,t,n){const r=1-e;return 3*r*r*e*t+3*r*e*e*n+e*e*e}function LV(e,t,n){const r=1-e;return 3*r*r*e*t+3*r*e*e*n+e*e*e}function jV(e,t,n){const r=1-e;return 3*r*r*t+6*r*e*(n-t)+3*e*e*(1-n)}function zV(e,t,n){let r=e;for(let s=0;s<DV;s+=1){const l=OV(r,t,n)-e;if(Math.abs(l)<gk)return r;const a=jV(r,t,n);if(Math.abs(a)<gk)break;r-=l/a}return r}function PV(e){if(e<=0)return 0;if(e>=1)return 1;const[t,n,r,s]=AV,l=zV(e,t,r);return LV(l,n,s)}function DA(e,t,n){const r=PV(n);return[e[0]+(t[0]-e[0])*r,e[1]+(t[1]-e[1])*r]}function BV({projectId:e,shouldRenderRightSidebarLayout:t,showRightSidebar:n,rightSidebarSize:r}){const s=b.useRef(null),l=b.useRef(null),a=b.useRef(null),u=b.useRef(null),h=b.useRef(null),d=b.useRef(!1),p=b.useRef(null),m=b.useRef(!1),_=b.useRef(!1);return b.useEffect(()=>()=>{u.current!==null&&window.cancelAnimationFrame(u.current),h.current!==null&&window.clearTimeout(h.current)},[]),b.useLayoutEffect(()=>{var D,B,K,z,U,H;if(!t){u.current!==null&&(window.cancelAnimationFrame(u.current),u.current=null),h.current!==null&&(window.clearTimeout(h.current),h.current=null),d.current=!1;return}const y=s.current;if(!y)return;u.current!==null&&(window.cancelAnimationFrame(u.current),u.current=null),h.current!==null&&(window.clearTimeout(h.current),h.current=null);const w=p.current,S=w!==null&&w!==e,C=n&&!_.current,k=!m.current,T=n?[100-r,r]:[100,0],R=S||k&&n,N=C||k?[100,0]:[y.getLayout().workspace??T[0],y.getLayout().rightSidebar??T[1]];if(p.current=e,m.current=t,_.current=n,R||Math.abs(N[0]-T[0])<.1&&Math.abs(N[1]-T[1])<.1){y.setLayout({workspace:T[0],rightSidebar:T[1]}),(D=l.current)==null||D.setAttribute("data-right-sidebar-open",n?"true":"false"),(B=a.current)==null||B.setAttribute("data-right-sidebar-open",n?"true":"false"),(K=a.current)==null||K.setAttribute("data-right-sidebar-animated","false");return}d.current=!0,(z=l.current)==null||z.setAttribute("data-right-sidebar-open",n?"true":"false"),(U=a.current)==null||U.setAttribute("data-right-sidebar-open",n?"true":"false"),(H=a.current)==null||H.setAttribute("data-right-sidebar-animated","true"),y.setLayout({workspace:N[0],rightSidebar:N[1]});const j=performance.now(),A=F=>{const q=Math.min(1,(F-j)/ha),$=DA(N,T,q);if(y.setLayout({workspace:$[0],rightSidebar:$[1]}),q<1){u.current=window.requestAnimationFrame(A);return}y.setLayout({workspace:T[0],rightSidebar:T[1]}),u.current=null,h.current=window.setTimeout(()=>{d.current=!1,h.current=null},0)};u.current=window.requestAnimationFrame(A)},[e,r,t,n]),b.useEffect(()=>{t||(m.current=!1,_.current=!1)},[t]),{isAnimating:d,panelGroupRef:s,sidebarPanelRef:l,sidebarVisualRef:a}}function IV({previousProjectId:e,projectId:t,previousShouldRenderTerminalLayout:n,previousShowTerminalPane:r,showTerminalPane:s,terminalLayout:l,liveLayout:a}){const u=e!==null&&e!==t,h=s&&!r,d=!n,p=e===null&&t!==null,m=s?l.mainSizes:[100,0];return{currentLayout:h||d?[100,0]:a,shouldSkipAnimation:u||p&&d,targetLayout:m}}function HV({chatInputRef:e,projectId:t,shouldRenderTerminalLayout:n,showTerminalPane:r,terminalLayout:s}){const l=b.useRef(null),a=b.useRef(null),u=b.useRef(null),h=b.useRef(null),d=b.useRef(null),p=b.useRef(!1),m=b.useRef(null),_=b.useRef(!1),y=b.useRef(!1),w=b.useRef(!1),[S,C]=b.useState(0);return b.useEffect(()=>{var N;const k=m.current,T=k!==null&&k!==t,R=w.current;!T&&r&&!R&&C(j=>j+1),!T&&!r&&R&&((N=e.current)==null||N.focus({preventScroll:!0})),w.current=r,m.current=t},[e,t,r]),b.useEffect(()=>()=>{h.current!==null&&window.cancelAnimationFrame(h.current),d.current!==null&&window.clearTimeout(d.current)},[]),b.useLayoutEffect(()=>{var B,K,z,U,H,F;if(!n){h.current!==null&&(window.cancelAnimationFrame(h.current),h.current=null),d.current!==null&&(window.clearTimeout(d.current),d.current=null),p.current=!1;return}const k=l.current;if(!k)return;h.current!==null&&(window.cancelAnimationFrame(h.current),h.current=null),d.current!==null&&(window.clearTimeout(d.current),d.current=null);const T=m.current,{currentLayout:R,shouldSkipAnimation:N,targetLayout:j}=IV({previousProjectId:T,projectId:t,previousShouldRenderTerminalLayout:_.current,previousShowTerminalPane:y.current,showTerminalPane:r,terminalLayout:s,liveLayout:[k.getLayout().chat??s.mainSizes[0],k.getLayout().terminal??s.mainSizes[1]]});if(_.current=n,y.current=r,N||Math.abs(R[0]-j[0])<.1&&Math.abs(R[1]-j[1])<.1){k.setLayout({chat:j[0],terminal:j[1]}),(B=a.current)==null||B.setAttribute("data-terminal-open",r?"true":"false"),(K=u.current)==null||K.setAttribute("data-terminal-open",r?"true":"false"),(z=u.current)==null||z.setAttribute("data-terminal-animated","false");return}p.current=!0,(U=a.current)==null||U.setAttribute("data-terminal-open",r?"true":"false"),(H=u.current)==null||H.setAttribute("data-terminal-open",r?"true":"false"),(F=u.current)==null||F.setAttribute("data-terminal-animated","true"),k.setLayout({chat:R[0],terminal:R[1]});const A=performance.now(),D=q=>{const $=Math.min(1,(q-A)/ha),P=DA(R,j,$);if(k.setLayout({chat:P[0],terminal:P[1]}),$<1){h.current=window.requestAnimationFrame(D);return}k.setLayout({chat:j[0],terminal:j[1]}),h.current=null,d.current=window.setTimeout(()=>{p.current=!1,d.current=null},0)};h.current=window.requestAnimationFrame(D)},[t,n,r,s.mainSizes]),b.useEffect(()=>{n||(_.current=!1,y.current=!1)},[n]),{isAnimating:p,mainPanelGroupRef:l,terminalFocusRequestVersion:S,terminalPanelRef:a,terminalVisualRef:u}}function FV(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const UV=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,$V=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,WV={};function vk(e,t){return(WV.jsx?$V:UV).test(e)}const VV=/[ \t\n\f\r]/g;function qV(e){return typeof e=="object"?e.type==="text"?_k(e.value):!1:_k(e)}function _k(e){return e.replace(VV,"")===""}class rd{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}rd.prototype.normal={};rd.prototype.property={};rd.prototype.space=void 0;function OA(e,t){const n={},r={};for(const s of e)Object.assign(n,s.property),Object.assign(r,s.normal);return new rd(n,r,t)}function Ey(e){return e.toLowerCase()}class ar{constructor(t,n){this.attribute=n,this.property=t}}ar.prototype.attribute="";ar.prototype.booleanish=!1;ar.prototype.boolean=!1;ar.prototype.commaOrSpaceSeparated=!1;ar.prototype.commaSeparated=!1;ar.prototype.defined=!1;ar.prototype.mustUseProperty=!1;ar.prototype.number=!1;ar.prototype.overloadedBoolean=!1;ar.prototype.property="";ar.prototype.spaceSeparated=!1;ar.prototype.space=void 0;let KV=0;const $e=fl(),Xt=fl(),Ry=fl(),be=fl(),wt=fl(),ya=fl(),xr=fl();function fl(){return 2**++KV}const Ty=Object.freeze(Object.defineProperty({__proto__:null,boolean:$e,booleanish:Xt,commaOrSpaceSeparated:xr,commaSeparated:ya,number:be,overloadedBoolean:Ry,spaceSeparated:wt},Symbol.toStringTag,{value:"Module"})),Uv=Object.keys(Ty);class h0 extends ar{constructor(t,n,r,s){let l=-1;if(super(t,n),yk(this,"space",s),typeof r=="number")for(;++l<Uv.length;){const a=Uv[l];yk(this,Uv[l],(r&Ty[a])===Ty[a])}}}h0.prototype.defined=!0;function yk(e,t,n){n&&(e[t]=n)}function $a(e){const t={},n={};for(const[r,s]of Object.entries(e.properties)){const l=new h0(r,e.transform(e.attributes||{},r),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(l.mustUseProperty=!0),t[r]=l,n[Ey(r)]=r,n[Ey(l.attribute)]=r}return new rd(t,n,e.space)}const LA=$a({properties:{ariaActiveDescendant:null,ariaAtomic:Xt,ariaAutoComplete:null,ariaBusy:Xt,ariaChecked:Xt,ariaColCount:be,ariaColIndex:be,ariaColSpan:be,ariaControls:wt,ariaCurrent:null,ariaDescribedBy:wt,ariaDetails:null,ariaDisabled:Xt,ariaDropEffect:wt,ariaErrorMessage:null,ariaExpanded:Xt,ariaFlowTo:wt,ariaGrabbed:Xt,ariaHasPopup:null,ariaHidden:Xt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:wt,ariaLevel:be,ariaLive:null,ariaModal:Xt,ariaMultiLine:Xt,ariaMultiSelectable:Xt,ariaOrientation:null,ariaOwns:wt,ariaPlaceholder:null,ariaPosInSet:be,ariaPressed:Xt,ariaReadOnly:Xt,ariaRelevant:null,ariaRequired:Xt,ariaRoleDescription:wt,ariaRowCount:be,ariaRowIndex:be,ariaRowSpan:be,ariaSelected:Xt,ariaSetSize:be,ariaSort:null,ariaValueMax:be,ariaValueMin:be,ariaValueNow:be,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function jA(e,t){return t in e?e[t]:t}function zA(e,t){return jA(e,t.toLowerCase())}const GV=$a({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:ya,acceptCharset:wt,accessKey:wt,action:null,allow:null,allowFullScreen:$e,allowPaymentRequest:$e,allowUserMedia:$e,alt:null,as:null,async:$e,autoCapitalize:null,autoComplete:wt,autoFocus:$e,autoPlay:$e,blocking:wt,capture:null,charSet:null,checked:$e,cite:null,className:wt,cols:be,colSpan:null,content:null,contentEditable:Xt,controls:$e,controlsList:wt,coords:be|ya,crossOrigin:null,data:null,dateTime:null,decoding:null,default:$e,defer:$e,dir:null,dirName:null,disabled:$e,download:Ry,draggable:Xt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:$e,formTarget:null,headers:wt,height:be,hidden:Ry,high:be,href:null,hrefLang:null,htmlFor:wt,httpEquiv:wt,id:null,imageSizes:null,imageSrcSet:null,inert:$e,inputMode:null,integrity:null,is:null,isMap:$e,itemId:null,itemProp:wt,itemRef:wt,itemScope:$e,itemType:wt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:$e,low:be,manifest:null,max:null,maxLength:be,media:null,method:null,min:null,minLength:be,multiple:$e,muted:$e,name:null,nonce:null,noModule:$e,noValidate:$e,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:$e,optimum:be,pattern:null,ping:wt,placeholder:null,playsInline:$e,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:$e,referrerPolicy:null,rel:wt,required:$e,reversed:$e,rows:be,rowSpan:be,sandbox:wt,scope:null,scoped:$e,seamless:$e,selected:$e,shadowRootClonable:$e,shadowRootDelegatesFocus:$e,shadowRootMode:null,shape:null,size:be,sizes:null,slot:null,span:be,spellCheck:Xt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:be,step:null,style:null,tabIndex:be,target:null,title:null,translate:null,type:null,typeMustMatch:$e,useMap:null,value:Xt,width:be,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:wt,axis:null,background:null,bgColor:null,border:be,borderColor:null,bottomMargin:be,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:$e,declare:$e,event:null,face:null,frame:null,frameBorder:null,hSpace:be,leftMargin:be,link:null,longDesc:null,lowSrc:null,marginHeight:be,marginWidth:be,noResize:$e,noHref:$e,noShade:$e,noWrap:$e,object:null,profile:null,prompt:null,rev:null,rightMargin:be,rules:null,scheme:null,scrolling:Xt,standby:null,summary:null,text:null,topMargin:be,valueType:null,version:null,vAlign:null,vLink:null,vSpace:be,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:$e,disableRemotePlayback:$e,prefix:null,property:null,results:be,security:null,unselectable:null},space:"html",transform:zA}),YV=$a({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:xr,accentHeight:be,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:be,amplitude:be,arabicForm:null,ascent:be,attributeName:null,attributeType:null,azimuth:be,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:be,by:null,calcMode:null,capHeight:be,className:wt,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:be,diffuseConstant:be,direction:null,display:null,dur:null,divisor:be,dominantBaseline:null,download:$e,dx:null,dy:null,edgeMode:null,editable:null,elevation:be,enableBackground:null,end:null,event:null,exponent:be,externalResourcesRequired:null,fill:null,fillOpacity:be,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:ya,g2:ya,glyphName:ya,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:be,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:be,horizOriginX:be,horizOriginY:be,id:null,ideographic:be,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:be,k:be,k1:be,k2:be,k3:be,k4:be,kernelMatrix:xr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:be,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:be,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:be,overlineThickness:be,paintOrder:null,panose1:null,path:null,pathLength:be,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:wt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:be,pointsAtY:be,pointsAtZ:be,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:xr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:xr,rev:xr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:xr,requiredFeatures:xr,requiredFonts:xr,requiredFormats:xr,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:be,specularExponent:be,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:be,strikethroughThickness:be,string:null,stroke:null,strokeDashArray:xr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:be,strokeOpacity:be,strokeWidth:null,style:null,surfaceScale:be,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:xr,tabIndex:be,tableValues:null,target:null,targetX:be,targetY:be,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:xr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:be,underlineThickness:be,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:be,values:null,vAlphabetic:be,vMathematical:be,vectorEffect:null,vHanging:be,vIdeographic:be,version:null,vertAdvY:be,vertOriginX:be,vertOriginY:be,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:be,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:jA}),PA=$a({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),BA=$a({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:zA}),IA=$a({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),XV={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"},ZV=/[A-Z]/g,bk=/-[a-z]/g,QV=/^data[-\w.:]+$/i;function JV(e,t){const n=Ey(t);let r=t,s=ar;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&QV.test(t)){if(t.charAt(4)==="-"){const l=t.slice(5).replace(bk,tq);r="data"+l.charAt(0).toUpperCase()+l.slice(1)}else{const l=t.slice(4);if(!bk.test(l)){let a=l.replace(ZV,eq);a.charAt(0)!=="-"&&(a="-"+a),t="data"+a}}s=h0}return new s(r,t)}function eq(e){return"-"+e.toLowerCase()}function tq(e){return e.charAt(1).toUpperCase()}const nq=OA([LA,GV,PA,BA,IA],"html"),f0=OA([LA,YV,PA,BA,IA],"svg");function rq(e){return e.join(" ").trim()}var sa={},$v,xk;function iq(){if(xk)return $v;xk=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,l=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,a=/^[;\s]*/,u=/^\s+|\s+$/g,h=`
488
+ `,d="/",p="*",m="",_="comment",y="declaration";function w(C,k){if(typeof C!="string")throw new TypeError("First argument must be a string");if(!C)return[];k=k||{};var T=1,R=1;function N(q){var $=q.match(t);$&&(T+=$.length);var P=q.lastIndexOf(h);R=~P?q.length-P:R+q.length}function j(){var q={line:T,column:R};return function($){return $.position=new A(q),K(),$}}function A(q){this.start=q,this.end={line:T,column:R},this.source=k.source}A.prototype.content=C;function D(q){var $=new Error(k.source+":"+T+":"+R+": "+q);if($.reason=q,$.filename=k.source,$.line=T,$.column=R,$.source=C,!k.silent)throw $}function B(q){var $=q.exec(C);if($){var P=$[0];return N(P),C=C.slice(P.length),$}}function K(){B(n)}function z(q){var $;for(q=q||[];$=U();)$!==!1&&q.push($);return q}function U(){var q=j();if(!(d!=C.charAt(0)||p!=C.charAt(1))){for(var $=2;m!=C.charAt($)&&(p!=C.charAt($)||d!=C.charAt($+1));)++$;if($+=2,m===C.charAt($-1))return D("End of comment missing");var P=C.slice(2,$-2);return R+=2,N(P),C=C.slice($),R+=2,q({type:_,comment:P})}}function H(){var q=j(),$=B(r);if($){if(U(),!B(s))return D("property missing ':'");var P=B(l),V=q({type:y,property:S($[0].replace(e,m)),value:P?S(P[0].replace(e,m)):m});return B(a),V}}function F(){var q=[];z(q);for(var $;$=H();)$!==!1&&(q.push($),z(q));return q}return K(),F()}function S(C){return C?C.replace(u,m):m}return $v=w,$v}var Sk;function sq(){if(Sk)return sa;Sk=1;var e=sa&&sa.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(sa,"__esModule",{value:!0}),sa.default=n;const t=e(iq());function n(r,s){let l=null;if(!r||typeof r!="string")return l;const a=(0,t.default)(r),u=typeof s=="function";return a.forEach(h=>{if(h.type!=="declaration")return;const{property:d,value:p}=h;u?s(d,p,h):p&&(l=l||{},l[d]=p)}),l}return sa}var Zc={},wk;function oq(){if(wk)return Zc;wk=1,Object.defineProperty(Zc,"__esModule",{value:!0}),Zc.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,s=/^-(ms)-/,l=function(d){return!d||n.test(d)||e.test(d)},a=function(d,p){return p.toUpperCase()},u=function(d,p){return"".concat(p,"-")},h=function(d,p){return p===void 0&&(p={}),l(d)?d:(d=d.toLowerCase(),p.reactCompat?d=d.replace(s,u):d=d.replace(r,u),d.replace(t,a))};return Zc.camelCase=h,Zc}var Qc,Ck;function lq(){if(Ck)return Qc;Ck=1;var e=Qc&&Qc.__importDefault||function(s){return s&&s.__esModule?s:{default:s}},t=e(sq()),n=oq();function r(s,l){var a={};return!s||typeof s!="string"||(0,t.default)(s,function(u,h){u&&h&&(a[(0,n.camelCase)(u,l)]=h)}),a}return r.default=r,Qc=r,Qc}var aq=lq();const cq=ep(aq),HA=FA("end"),p0=FA("start");function FA(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function uq(e){const t=p0(e),n=HA(e);if(t&&n)return{start:t,end:n}}function yu(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?kk(e.position):"start"in e||"end"in e?kk(e):"line"in e||"column"in e?My(e):""}function My(e){return Ek(e&&e.line)+":"+Ek(e&&e.column)}function kk(e){return My(e&&e.start)+"-"+My(e&&e.end)}function Ek(e){return e&&typeof e=="number"?e:1}class Pn extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let s="",l={},a=!1;if(n&&("line"in n&&"column"in n?l={place:n}:"start"in n&&"end"in n?l={place:n}:"type"in n?l={ancestors:[n],place:n.position}:l={...n}),typeof t=="string"?s=t:!l.cause&&t&&(a=!0,s=t.message,l.cause=t),!l.ruleId&&!l.source&&typeof r=="string"){const h=r.indexOf(":");h===-1?l.ruleId=r:(l.source=r.slice(0,h),l.ruleId=r.slice(h+1))}if(!l.place&&l.ancestors&&l.ancestors){const h=l.ancestors[l.ancestors.length-1];h&&(l.place=h.position)}const u=l.place&&"start"in l.place?l.place.start:l.place;this.ancestors=l.ancestors||void 0,this.cause=l.cause||void 0,this.column=u?u.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=u?u.line:void 0,this.name=yu(l.place)||"1:1",this.place=l.place||void 0,this.reason=this.message,this.ruleId=l.ruleId||void 0,this.source=l.source||void 0,this.stack=a&&l.cause&&typeof l.cause.stack=="string"?l.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Pn.prototype.file="";Pn.prototype.name="";Pn.prototype.reason="";Pn.prototype.message="";Pn.prototype.stack="";Pn.prototype.column=void 0;Pn.prototype.line=void 0;Pn.prototype.ancestors=void 0;Pn.prototype.cause=void 0;Pn.prototype.fatal=void 0;Pn.prototype.place=void 0;Pn.prototype.ruleId=void 0;Pn.prototype.source=void 0;const m0={}.hasOwnProperty,dq=new Map,hq=/[A-Z]/g,fq=new Set(["table","tbody","thead","tfoot","tr"]),pq=new Set(["td","th"]),UA="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function mq(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=wq(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=Sq(n,t.jsx,t.jsxs)}const s={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?f0:nq,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},l=$A(s,e,void 0);return l&&typeof l!="string"?l:s.create(e,s.Fragment,{children:l||void 0},void 0)}function $A(e,t,n){if(t.type==="element")return gq(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return vq(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return yq(e,t,n);if(t.type==="mdxjsEsm")return _q(e,t);if(t.type==="root")return bq(e,t,n);if(t.type==="text")return xq(e,t)}function gq(e,t,n){const r=e.schema;let s=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(s=f0,e.schema=s),e.ancestors.push(t);const l=VA(e,t.tagName,!1),a=Cq(e,t);let u=v0(e,t);return fq.has(t.tagName)&&(u=u.filter(function(h){return typeof h=="string"?!qV(h):!0})),WA(e,a,l,t),g0(a,u),e.ancestors.pop(),e.schema=r,e.create(t,l,a,n)}function vq(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}Pu(e,t.position)}function _q(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Pu(e,t.position)}function yq(e,t,n){const r=e.schema;let s=r;t.name==="svg"&&r.space==="html"&&(s=f0,e.schema=s),e.ancestors.push(t);const l=t.name===null?e.Fragment:VA(e,t.name,!0),a=kq(e,t),u=v0(e,t);return WA(e,a,l,t),g0(a,u),e.ancestors.pop(),e.schema=r,e.create(t,l,a,n)}function bq(e,t,n){const r={};return g0(r,v0(e,t)),e.create(t,e.Fragment,r,n)}function xq(e,t){return t.value}function WA(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function g0(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function Sq(e,t,n){return r;function r(s,l,a,u){const d=Array.isArray(a.children)?n:t;return u?d(l,a,u):d(l,a)}}function wq(e,t){return n;function n(r,s,l,a){const u=Array.isArray(l.children),h=p0(r);return t(s,l,a,u,{columnNumber:h?h.column-1:void 0,fileName:e,lineNumber:h?h.line:void 0},void 0)}}function Cq(e,t){const n={};let r,s;for(s in t.properties)if(s!=="children"&&m0.call(t.properties,s)){const l=Eq(e,s,t.properties[s]);if(l){const[a,u]=l;e.tableCellAlignToStyle&&a==="align"&&typeof u=="string"&&pq.has(t.tagName)?r=u:n[a]=u}}if(r){const l=n.style||(n.style={});l[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function kq(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const l=r.data.estree.body[0];l.type;const a=l.expression;a.type;const u=a.properties[0];u.type,Object.assign(n,e.evaluater.evaluateExpression(u.argument))}else Pu(e,t.position);else{const s=r.name;let l;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const u=r.value.data.estree.body[0];u.type,l=e.evaluater.evaluateExpression(u.expression)}else Pu(e,t.position);else l=r.value===null?!0:r.value;n[s]=l}return n}function v0(e,t){const n=[];let r=-1;const s=e.passKeys?new Map:dq;for(;++r<t.children.length;){const l=t.children[r];let a;if(e.passKeys){const h=l.type==="element"?l.tagName:l.type==="mdxJsxFlowElement"||l.type==="mdxJsxTextElement"?l.name:void 0;if(h){const d=s.get(h)||0;a=h+"-"+d,s.set(h,d+1)}}const u=$A(e,l,a);u!==void 0&&n.push(u)}return n}function Eq(e,t,n){const r=JV(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?FV(n):rq(n)),r.property==="style"){let s=typeof n=="object"?n:Rq(e,String(n));return e.stylePropertyNameCase==="css"&&(s=Tq(s)),["style",s]}return[e.elementAttributeNameCase==="react"&&r.space?XV[r.property]||r.property:r.attribute,n]}}function Rq(e,t){try{return cq(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,s=new Pn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw s.file=e.filePath||void 0,s.url=UA+"#cannot-parse-style-attribute",s}}function VA(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const s=t.split(".");let l=-1,a;for(;++l<s.length;){const u=vk(s[l])?{type:"Identifier",name:s[l]}:{type:"Literal",value:s[l]};a=a?{type:"MemberExpression",object:a,property:u,computed:!!(l&&u.type==="Literal"),optional:!1}:u}r=a}else r=vk(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const s=r.value;return m0.call(e.components,s)?e.components[s]:s}if(e.evaluater)return e.evaluater.evaluateExpression(r);Pu(e)}function Pu(e,t){const n=new Pn("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=UA+"#cannot-handle-mdx-estrees-without-createevaluater",n}function Tq(e){const t={};let n;for(n in e)m0.call(e,n)&&(t[Mq(n)]=e[n]);return t}function Mq(e){let t=e.replace(hq,Nq);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function Nq(e){return"-"+e.toLowerCase()}const Wv={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"]},Aq={};function _0(e,t){const n=Aq,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,s=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return qA(e,r,s)}function qA(e,t,n){if(Dq(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return Rk(e.children,t,n)}return Array.isArray(e)?Rk(e,t,n):""}function Rk(e,t,n){const r=[];let s=-1;for(;++s<e.length;)r[s]=qA(e[s],t,n);return r.join("")}function Dq(e){return!!(e&&typeof e=="object")}const Tk=document.createElement("i");function y0(e){const t="&"+e+";";Tk.innerHTML=t;const n=Tk.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Cr(e,t,n,r){const s=e.length;let l=0,a;if(t<0?t=-t>s?0:s+t:t=t>s?s:t,n=n>0?n:0,r.length<1e4)a=Array.from(r),a.unshift(t,n),e.splice(...a);else for(n&&e.splice(t,n);l<r.length;)a=r.slice(l,l+1e4),a.unshift(t,0),e.splice(...a),l+=1e4,t+=1e4}function Vr(e,t){return e.length>0?(Cr(e,e.length,0,t),e):t}const Mk={}.hasOwnProperty;function KA(e){const t={};let n=-1;for(;++n<e.length;)Oq(t,e[n]);return t}function Oq(e,t){let n;for(n in t){const s=(Mk.call(e,n)?e[n]:void 0)||(e[n]={}),l=t[n];let a;if(l)for(a in l){Mk.call(s,a)||(s[a]=[]);const u=l[a];Lq(s[a],Array.isArray(u)?u:u?[u]:[])}}}function Lq(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Cr(e,0,0,r)}function GA(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function si(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Wn=po(/[A-Za-z]/),jn=po(/[\dA-Za-z]/),jq=po(/[#-'*+\--9=?A-Z^-~]/);function Gf(e){return e!==null&&(e<32||e===127)}const Ny=po(/\d/),zq=po(/[\dA-Fa-f]/),Pq=po(/[!-/:-@[-`{-~]/);function je(e){return e!==null&&e<-2}function xt(e){return e!==null&&(e<0||e===32)}function Qe(e){return e===-2||e===-1||e===32}const Lp=po(new RegExp("\\p{P}|\\p{S}","u")),il=po(/\s/);function po(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Wa(e){const t=[];let n=-1,r=0,s=0;for(;++n<e.length;){const l=e.charCodeAt(n);let a="";if(l===37&&jn(e.charCodeAt(n+1))&&jn(e.charCodeAt(n+2)))s=2;else if(l<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(l))||(a=String.fromCharCode(l));else if(l>55295&&l<57344){const u=e.charCodeAt(n+1);l<56320&&u>56319&&u<57344?(a=String.fromCharCode(l,u),s=1):a="�"}else a=String.fromCharCode(l);a&&(t.push(e.slice(r,n),encodeURIComponent(a)),r=n+s+1,a=""),s&&(n+=s,s=0)}return t.join("")+e.slice(r)}function it(e,t,n,r){const s=r?r-1:Number.POSITIVE_INFINITY;let l=0;return a;function a(h){return Qe(h)?(e.enter(n),u(h)):t(h)}function u(h){return Qe(h)&&l++<s?(e.consume(h),u):(e.exit(n),t(h))}}const Bq={tokenize:Iq};function Iq(e){const t=e.attempt(this.parser.constructs.contentInitial,r,s);let n;return t;function r(u){if(u===null){e.consume(u);return}return e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),it(e,t,"linePrefix")}function s(u){return e.enter("paragraph"),l(u)}function l(u){const h=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=h),n=h,a(u)}function a(u){if(u===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(u);return}return je(u)?(e.consume(u),e.exit("chunkText"),l):(e.consume(u),a)}}const Hq={tokenize:Fq},Nk={tokenize:Uq};function Fq(e){const t=this,n=[];let r=0,s,l,a;return u;function u(R){if(r<n.length){const N=n[r];return t.containerState=N[1],e.attempt(N[0].continuation,h,d)(R)}return d(R)}function h(R){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,s&&T();const N=t.events.length;let j=N,A;for(;j--;)if(t.events[j][0]==="exit"&&t.events[j][1].type==="chunkFlow"){A=t.events[j][1].end;break}k(r);let D=N;for(;D<t.events.length;)t.events[D][1].end={...A},D++;return Cr(t.events,j+1,0,t.events.slice(N)),t.events.length=D,d(R)}return u(R)}function d(R){if(r===n.length){if(!s)return _(R);if(s.currentConstruct&&s.currentConstruct.concrete)return w(R);t.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Nk,p,m)(R)}function p(R){return s&&T(),k(r),_(R)}function m(R){return t.parser.lazy[t.now().line]=r!==n.length,a=t.now().offset,w(R)}function _(R){return t.containerState={},e.attempt(Nk,y,w)(R)}function y(R){return r++,n.push([t.currentConstruct,t.containerState]),_(R)}function w(R){if(R===null){s&&T(),k(0),e.consume(R);return}return s=s||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:s,contentType:"flow",previous:l}),S(R)}function S(R){if(R===null){C(e.exit("chunkFlow"),!0),k(0),e.consume(R);return}return je(R)?(e.consume(R),C(e.exit("chunkFlow")),r=0,t.interrupt=void 0,u):(e.consume(R),S)}function C(R,N){const j=t.sliceStream(R);if(N&&j.push(null),R.previous=l,l&&(l.next=R),l=R,s.defineSkip(R.start),s.write(j),t.parser.lazy[R.start.line]){let A=s.events.length;for(;A--;)if(s.events[A][1].start.offset<a&&(!s.events[A][1].end||s.events[A][1].end.offset>a))return;const D=t.events.length;let B=D,K,z;for(;B--;)if(t.events[B][0]==="exit"&&t.events[B][1].type==="chunkFlow"){if(K){z=t.events[B][1].end;break}K=!0}for(k(r),A=D;A<t.events.length;)t.events[A][1].end={...z},A++;Cr(t.events,B+1,0,t.events.slice(D)),t.events.length=A}}function k(R){let N=n.length;for(;N-- >R;){const j=n[N];t.containerState=j[1],j[0].exit.call(t,e)}n.length=R}function T(){s.write([null]),l=void 0,s=void 0,t.containerState._closeFlow=void 0}}function Uq(e,t,n){return it(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Ea(e){if(e===null||xt(e)||il(e))return 1;if(Lp(e))return 2}function jp(e,t,n){const r=[];let s=-1;for(;++s<e.length;){const l=e[s].resolveAll;l&&!r.includes(l)&&(t=l(t,n),r.push(l))}return t}const Ay={name:"attention",resolveAll:$q,tokenize:Wq};function $q(e,t){let n=-1,r,s,l,a,u,h,d,p;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;h=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const m={...e[r][1].end},_={...e[n][1].start};Ak(m,-h),Ak(_,h),a={type:h>1?"strongSequence":"emphasisSequence",start:m,end:{...e[r][1].end}},u={type:h>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:_},l={type:h>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},s={type:h>1?"strong":"emphasis",start:{...a.start},end:{...u.end}},e[r][1].end={...a.start},e[n][1].start={...u.end},d=[],e[r][1].end.offset-e[r][1].start.offset&&(d=Vr(d,[["enter",e[r][1],t],["exit",e[r][1],t]])),d=Vr(d,[["enter",s,t],["enter",a,t],["exit",a,t],["enter",l,t]]),d=Vr(d,jp(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),d=Vr(d,[["exit",l,t],["enter",u,t],["exit",u,t],["exit",s,t]]),e[n][1].end.offset-e[n][1].start.offset?(p=2,d=Vr(d,[["enter",e[n][1],t],["exit",e[n][1],t]])):p=0,Cr(e,r-1,n-r+3,d),n=r+d.length-p-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function Wq(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,s=Ea(r);let l;return a;function a(h){return l=h,e.enter("attentionSequence"),u(h)}function u(h){if(h===l)return e.consume(h),u;const d=e.exit("attentionSequence"),p=Ea(h),m=!p||p===2&&s||n.includes(h),_=!s||s===2&&p||n.includes(r);return d._open=!!(l===42?m:m&&(s||!_)),d._close=!!(l===42?_:_&&(p||!m)),t(h)}}function Ak(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const Vq={name:"autolink",tokenize:qq};function qq(e,t,n){let r=0;return s;function s(y){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),l}function l(y){return Wn(y)?(e.consume(y),a):y===64?n(y):d(y)}function a(y){return y===43||y===45||y===46||jn(y)?(r=1,u(y)):d(y)}function u(y){return y===58?(e.consume(y),r=0,h):(y===43||y===45||y===46||jn(y))&&r++<32?(e.consume(y),u):(r=0,d(y))}function h(y){return y===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.exit("autolink"),t):y===null||y===32||y===60||Gf(y)?n(y):(e.consume(y),h)}function d(y){return y===64?(e.consume(y),p):jq(y)?(e.consume(y),d):n(y)}function p(y){return jn(y)?m(y):n(y)}function m(y){return y===46?(e.consume(y),r=0,p):y===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.exit("autolink"),t):_(y)}function _(y){if((y===45||jn(y))&&r++<63){const w=y===45?_:m;return e.consume(y),w}return n(y)}}const id={partial:!0,tokenize:Kq};function Kq(e,t,n){return r;function r(l){return Qe(l)?it(e,s,"linePrefix")(l):s(l)}function s(l){return l===null||je(l)?t(l):n(l)}}const YA={continuation:{tokenize:Yq},exit:Xq,name:"blockQuote",tokenize:Gq};function Gq(e,t,n){const r=this;return s;function s(a){if(a===62){const u=r.containerState;return u.open||(e.enter("blockQuote",{_container:!0}),u.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(a),e.exit("blockQuoteMarker"),l}return n(a)}function l(a){return Qe(a)?(e.enter("blockQuotePrefixWhitespace"),e.consume(a),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(a))}}function Yq(e,t,n){const r=this;return s;function s(a){return Qe(a)?it(e,l,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a):l(a)}function l(a){return e.attempt(YA,t,n)(a)}}function Xq(e){e.exit("blockQuote")}const XA={name:"characterEscape",tokenize:Zq};function Zq(e,t,n){return r;function r(l){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(l),e.exit("escapeMarker"),s}function s(l){return Pq(l)?(e.enter("characterEscapeValue"),e.consume(l),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(l)}}const ZA={name:"characterReference",tokenize:Qq};function Qq(e,t,n){const r=this;let s=0,l,a;return u;function u(m){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),h}function h(m){return m===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(m),e.exit("characterReferenceMarkerNumeric"),d):(e.enter("characterReferenceValue"),l=31,a=jn,p(m))}function d(m){return m===88||m===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(m),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),l=6,a=zq,p):(e.enter("characterReferenceValue"),l=7,a=Ny,p(m))}function p(m){if(m===59&&s){const _=e.exit("characterReferenceValue");return a===jn&&!y0(r.sliceSerialize(_))?n(m):(e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return a(m)&&s++<l?(e.consume(m),p):n(m)}}const Dk={partial:!0,tokenize:eK},Ok={concrete:!0,name:"codeFenced",tokenize:Jq};function Jq(e,t,n){const r=this,s={partial:!0,tokenize:j};let l=0,a=0,u;return h;function h(A){return d(A)}function d(A){const D=r.events[r.events.length-1];return l=D&&D[1].type==="linePrefix"?D[2].sliceSerialize(D[1],!0).length:0,u=A,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),p(A)}function p(A){return A===u?(a++,e.consume(A),p):a<3?n(A):(e.exit("codeFencedFenceSequence"),Qe(A)?it(e,m,"whitespace")(A):m(A))}function m(A){return A===null||je(A)?(e.exit("codeFencedFence"),r.interrupt?t(A):e.check(Dk,S,N)(A)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),_(A))}function _(A){return A===null||je(A)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),m(A)):Qe(A)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),it(e,y,"whitespace")(A)):A===96&&A===u?n(A):(e.consume(A),_)}function y(A){return A===null||je(A)?m(A):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),w(A))}function w(A){return A===null||je(A)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),m(A)):A===96&&A===u?n(A):(e.consume(A),w)}function S(A){return e.attempt(s,N,C)(A)}function C(A){return e.enter("lineEnding"),e.consume(A),e.exit("lineEnding"),k}function k(A){return l>0&&Qe(A)?it(e,T,"linePrefix",l+1)(A):T(A)}function T(A){return A===null||je(A)?e.check(Dk,S,N)(A):(e.enter("codeFlowValue"),R(A))}function R(A){return A===null||je(A)?(e.exit("codeFlowValue"),T(A)):(e.consume(A),R)}function N(A){return e.exit("codeFenced"),t(A)}function j(A,D,B){let K=0;return z;function z($){return A.enter("lineEnding"),A.consume($),A.exit("lineEnding"),U}function U($){return A.enter("codeFencedFence"),Qe($)?it(A,H,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)($):H($)}function H($){return $===u?(A.enter("codeFencedFenceSequence"),F($)):B($)}function F($){return $===u?(K++,A.consume($),F):K>=a?(A.exit("codeFencedFenceSequence"),Qe($)?it(A,q,"whitespace")($):q($)):B($)}function q($){return $===null||je($)?(A.exit("codeFencedFence"),D($)):B($)}}}function eK(e,t,n){const r=this;return s;function s(a){return a===null?n(a):(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),l)}function l(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}const Vv={name:"codeIndented",tokenize:nK},tK={partial:!0,tokenize:rK};function nK(e,t,n){const r=this;return s;function s(d){return e.enter("codeIndented"),it(e,l,"linePrefix",5)(d)}function l(d){const p=r.events[r.events.length-1];return p&&p[1].type==="linePrefix"&&p[2].sliceSerialize(p[1],!0).length>=4?a(d):n(d)}function a(d){return d===null?h(d):je(d)?e.attempt(tK,a,h)(d):(e.enter("codeFlowValue"),u(d))}function u(d){return d===null||je(d)?(e.exit("codeFlowValue"),a(d)):(e.consume(d),u)}function h(d){return e.exit("codeIndented"),t(d)}}function rK(e,t,n){const r=this;return s;function s(a){return r.parser.lazy[r.now().line]?n(a):je(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),s):it(e,l,"linePrefix",5)(a)}function l(a){const u=r.events[r.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?t(a):je(a)?s(a):n(a)}}const iK={name:"codeText",previous:oK,resolve:sK,tokenize:lK};function sK(e){let t=e.length-4,n=3,r,s;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)s===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(s=r):(r===t||e[r][1].type==="lineEnding")&&(e[s][1].type="codeTextData",r!==s+2&&(e[s][1].end=e[r-1][1].end,e.splice(s+2,r-s-2),t-=r-s-2,r=s+2),s=void 0);return e}function oK(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function lK(e,t,n){let r=0,s,l;return a;function a(m){return e.enter("codeText"),e.enter("codeTextSequence"),u(m)}function u(m){return m===96?(e.consume(m),r++,u):(e.exit("codeTextSequence"),h(m))}function h(m){return m===null?n(m):m===32?(e.enter("space"),e.consume(m),e.exit("space"),h):m===96?(l=e.enter("codeTextSequence"),s=0,p(m)):je(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),h):(e.enter("codeTextData"),d(m))}function d(m){return m===null||m===32||m===96||je(m)?(e.exit("codeTextData"),h(m)):(e.consume(m),d)}function p(m){return m===96?(e.consume(m),s++,p):s===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(m)):(l.type="codeTextData",d(m))}}class aK{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const s=n||0;this.setCursor(Math.trunc(t));const l=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return r&&Jc(this.left,r),l.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Jc(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Jc(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);Jc(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Jc(this.left,n.reverse())}}}function Jc(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function QA(e){const t={};let n=-1,r,s,l,a,u,h,d;const p=new aK(e);for(;++n<p.length;){for(;n in t;)n=t[n];if(r=p.get(n),n&&r[1].type==="chunkFlow"&&p.get(n-1)[1].type==="listItemPrefix"&&(h=r[1]._tokenizer.events,l=0,l<h.length&&h[l][1].type==="lineEndingBlank"&&(l+=2),l<h.length&&h[l][1].type==="content"))for(;++l<h.length&&h[l][1].type!=="content";)h[l][1].type==="chunkText"&&(h[l][1]._isInFirstContentOfListItem=!0,l++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,cK(p,n)),n=t[n],d=!0);else if(r[1]._container){for(l=n,s=void 0;l--;)if(a=p.get(l),a[1].type==="lineEnding"||a[1].type==="lineEndingBlank")a[0]==="enter"&&(s&&(p.get(s)[1].type="lineEndingBlank"),a[1].type="lineEnding",s=l);else if(!(a[1].type==="linePrefix"||a[1].type==="listItemIndent"))break;s&&(r[1].end={...p.get(s)[1].start},u=p.slice(s,n),u.unshift(r),p.splice(s,n-s+1,u))}}return Cr(e,0,Number.POSITIVE_INFINITY,p.slice(0)),!d}function cK(e,t){const n=e.get(t)[1],r=e.get(t)[2];let s=t-1;const l=[];let a=n._tokenizer;a||(a=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(a._contentTypeTextTrailing=!0));const u=a.events,h=[],d={};let p,m,_=-1,y=n,w=0,S=0;const C=[S];for(;y;){for(;e.get(++s)[1]!==y;);l.push(s),y._tokenizer||(p=r.sliceStream(y),y.next||p.push(null),m&&a.defineSkip(y.start),y._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=!0),a.write(p),y._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=void 0)),m=y,y=y.next}for(y=n;++_<u.length;)u[_][0]==="exit"&&u[_-1][0]==="enter"&&u[_][1].type===u[_-1][1].type&&u[_][1].start.line!==u[_][1].end.line&&(S=_+1,C.push(S),y._tokenizer=void 0,y.previous=void 0,y=y.next);for(a.events=[],y?(y._tokenizer=void 0,y.previous=void 0):C.pop(),_=C.length;_--;){const k=u.slice(C[_],C[_+1]),T=l.pop();h.push([T,T+k.length-1]),e.splice(T,2,k)}for(h.reverse(),_=-1;++_<h.length;)d[w+h[_][0]]=w+h[_][1],w+=h[_][1]-h[_][0]-1;return d}const uK={resolve:hK,tokenize:fK},dK={partial:!0,tokenize:pK};function hK(e){return QA(e),e}function fK(e,t){let n;return r;function r(u){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),s(u)}function s(u){return u===null?l(u):je(u)?e.check(dK,a,l)(u):(e.consume(u),s)}function l(u){return e.exit("chunkContent"),e.exit("content"),t(u)}function a(u){return e.consume(u),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,s}}function pK(e,t,n){const r=this;return s;function s(a){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),it(e,l,"linePrefix")}function l(a){if(a===null||je(a))return n(a);const u=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?t(a):e.interrupt(r.parser.constructs.flow,n,t)(a)}}function JA(e,t,n,r,s,l,a,u,h){const d=h||Number.POSITIVE_INFINITY;let p=0;return m;function m(k){return k===60?(e.enter(r),e.enter(s),e.enter(l),e.consume(k),e.exit(l),_):k===null||k===32||k===41||Gf(k)?n(k):(e.enter(r),e.enter(a),e.enter(u),e.enter("chunkString",{contentType:"string"}),S(k))}function _(k){return k===62?(e.enter(l),e.consume(k),e.exit(l),e.exit(s),e.exit(r),t):(e.enter(u),e.enter("chunkString",{contentType:"string"}),y(k))}function y(k){return k===62?(e.exit("chunkString"),e.exit(u),_(k)):k===null||k===60||je(k)?n(k):(e.consume(k),k===92?w:y)}function w(k){return k===60||k===62||k===92?(e.consume(k),y):y(k)}function S(k){return!p&&(k===null||k===41||xt(k))?(e.exit("chunkString"),e.exit(u),e.exit(a),e.exit(r),t(k)):p<d&&k===40?(e.consume(k),p++,S):k===41?(e.consume(k),p--,S):k===null||k===32||k===40||Gf(k)?n(k):(e.consume(k),k===92?C:S)}function C(k){return k===40||k===41||k===92?(e.consume(k),S):S(k)}}function e5(e,t,n,r,s,l){const a=this;let u=0,h;return d;function d(y){return e.enter(r),e.enter(s),e.consume(y),e.exit(s),e.enter(l),p}function p(y){return u>999||y===null||y===91||y===93&&!h||y===94&&!u&&"_hiddenFootnoteSupport"in a.parser.constructs?n(y):y===93?(e.exit(l),e.enter(s),e.consume(y),e.exit(s),e.exit(r),t):je(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),p):(e.enter("chunkString",{contentType:"string"}),m(y))}function m(y){return y===null||y===91||y===93||je(y)||u++>999?(e.exit("chunkString"),p(y)):(e.consume(y),h||(h=!Qe(y)),y===92?_:m)}function _(y){return y===91||y===92||y===93?(e.consume(y),u++,m):m(y)}}function t5(e,t,n,r,s,l){let a;return u;function u(_){return _===34||_===39||_===40?(e.enter(r),e.enter(s),e.consume(_),e.exit(s),a=_===40?41:_,h):n(_)}function h(_){return _===a?(e.enter(s),e.consume(_),e.exit(s),e.exit(r),t):(e.enter(l),d(_))}function d(_){return _===a?(e.exit(l),h(a)):_===null?n(_):je(_)?(e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),it(e,d,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),p(_))}function p(_){return _===a||_===null||je(_)?(e.exit("chunkString"),d(_)):(e.consume(_),_===92?m:p)}function m(_){return _===a||_===92?(e.consume(_),p):p(_)}}function bu(e,t){let n;return r;function r(s){return je(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),n=!0,r):Qe(s)?it(e,r,n?"linePrefix":"lineSuffix")(s):t(s)}}const mK={name:"definition",tokenize:vK},gK={partial:!0,tokenize:_K};function vK(e,t,n){const r=this;let s;return l;function l(y){return e.enter("definition"),a(y)}function a(y){return e5.call(r,e,u,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(y)}function u(y){return s=si(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),y===58?(e.enter("definitionMarker"),e.consume(y),e.exit("definitionMarker"),h):n(y)}function h(y){return xt(y)?bu(e,d)(y):d(y)}function d(y){return JA(e,p,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(y)}function p(y){return e.attempt(gK,m,m)(y)}function m(y){return Qe(y)?it(e,_,"whitespace")(y):_(y)}function _(y){return y===null||je(y)?(e.exit("definition"),r.parser.defined.push(s),t(y)):n(y)}}function _K(e,t,n){return r;function r(u){return xt(u)?bu(e,s)(u):n(u)}function s(u){return t5(e,l,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(u)}function l(u){return Qe(u)?it(e,a,"whitespace")(u):a(u)}function a(u){return u===null||je(u)?t(u):n(u)}}const yK={name:"hardBreakEscape",tokenize:bK};function bK(e,t,n){return r;function r(l){return e.enter("hardBreakEscape"),e.consume(l),s}function s(l){return je(l)?(e.exit("hardBreakEscape"),t(l)):n(l)}}const xK={name:"headingAtx",resolve:SK,tokenize:wK};function SK(e,t){let n=e.length-2,r=3,s,l;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(s={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},l={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},Cr(e,r,n-r+1,[["enter",s,t],["enter",l,t],["exit",l,t],["exit",s,t]])),e}function wK(e,t,n){let r=0;return s;function s(p){return e.enter("atxHeading"),l(p)}function l(p){return e.enter("atxHeadingSequence"),a(p)}function a(p){return p===35&&r++<6?(e.consume(p),a):p===null||xt(p)?(e.exit("atxHeadingSequence"),u(p)):n(p)}function u(p){return p===35?(e.enter("atxHeadingSequence"),h(p)):p===null||je(p)?(e.exit("atxHeading"),t(p)):Qe(p)?it(e,u,"whitespace")(p):(e.enter("atxHeadingText"),d(p))}function h(p){return p===35?(e.consume(p),h):(e.exit("atxHeadingSequence"),u(p))}function d(p){return p===null||p===35||xt(p)?(e.exit("atxHeadingText"),u(p)):(e.consume(p),d)}}const CK=["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"],Lk=["pre","script","style","textarea"],kK={concrete:!0,name:"htmlFlow",resolveTo:TK,tokenize:MK},EK={partial:!0,tokenize:AK},RK={partial:!0,tokenize:NK};function TK(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function MK(e,t,n){const r=this;let s,l,a,u,h;return d;function d(L){return p(L)}function p(L){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(L),m}function m(L){return L===33?(e.consume(L),_):L===47?(e.consume(L),l=!0,S):L===63?(e.consume(L),s=3,r.interrupt?t:M):Wn(L)?(e.consume(L),a=String.fromCharCode(L),C):n(L)}function _(L){return L===45?(e.consume(L),s=2,y):L===91?(e.consume(L),s=5,u=0,w):Wn(L)?(e.consume(L),s=4,r.interrupt?t:M):n(L)}function y(L){return L===45?(e.consume(L),r.interrupt?t:M):n(L)}function w(L){const oe="CDATA[";return L===oe.charCodeAt(u++)?(e.consume(L),u===oe.length?r.interrupt?t:H:w):n(L)}function S(L){return Wn(L)?(e.consume(L),a=String.fromCharCode(L),C):n(L)}function C(L){if(L===null||L===47||L===62||xt(L)){const oe=L===47,ae=a.toLowerCase();return!oe&&!l&&Lk.includes(ae)?(s=1,r.interrupt?t(L):H(L)):CK.includes(a.toLowerCase())?(s=6,oe?(e.consume(L),k):r.interrupt?t(L):H(L)):(s=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(L):l?T(L):R(L))}return L===45||jn(L)?(e.consume(L),a+=String.fromCharCode(L),C):n(L)}function k(L){return L===62?(e.consume(L),r.interrupt?t:H):n(L)}function T(L){return Qe(L)?(e.consume(L),T):z(L)}function R(L){return L===47?(e.consume(L),z):L===58||L===95||Wn(L)?(e.consume(L),N):Qe(L)?(e.consume(L),R):z(L)}function N(L){return L===45||L===46||L===58||L===95||jn(L)?(e.consume(L),N):j(L)}function j(L){return L===61?(e.consume(L),A):Qe(L)?(e.consume(L),j):R(L)}function A(L){return L===null||L===60||L===61||L===62||L===96?n(L):L===34||L===39?(e.consume(L),h=L,D):Qe(L)?(e.consume(L),A):B(L)}function D(L){return L===h?(e.consume(L),h=null,K):L===null||je(L)?n(L):(e.consume(L),D)}function B(L){return L===null||L===34||L===39||L===47||L===60||L===61||L===62||L===96||xt(L)?j(L):(e.consume(L),B)}function K(L){return L===47||L===62||Qe(L)?R(L):n(L)}function z(L){return L===62?(e.consume(L),U):n(L)}function U(L){return L===null||je(L)?H(L):Qe(L)?(e.consume(L),U):n(L)}function H(L){return L===45&&s===2?(e.consume(L),P):L===60&&s===1?(e.consume(L),V):L===62&&s===4?(e.consume(L),I):L===63&&s===3?(e.consume(L),M):L===93&&s===5?(e.consume(L),Z):je(L)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(EK,X,F)(L)):L===null||je(L)?(e.exit("htmlFlowData"),F(L)):(e.consume(L),H)}function F(L){return e.check(RK,q,X)(L)}function q(L){return e.enter("lineEnding"),e.consume(L),e.exit("lineEnding"),$}function $(L){return L===null||je(L)?F(L):(e.enter("htmlFlowData"),H(L))}function P(L){return L===45?(e.consume(L),M):H(L)}function V(L){return L===47?(e.consume(L),a="",W):H(L)}function W(L){if(L===62){const oe=a.toLowerCase();return Lk.includes(oe)?(e.consume(L),I):H(L)}return Wn(L)&&a.length<8?(e.consume(L),a+=String.fromCharCode(L),W):H(L)}function Z(L){return L===93?(e.consume(L),M):H(L)}function M(L){return L===62?(e.consume(L),I):L===45&&s===2?(e.consume(L),M):H(L)}function I(L){return L===null||je(L)?(e.exit("htmlFlowData"),X(L)):(e.consume(L),I)}function X(L){return e.exit("htmlFlow"),t(L)}}function NK(e,t,n){const r=this;return s;function s(a){return je(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),l):n(a)}function l(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}function AK(e,t,n){return r;function r(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(id,t,n)}}const DK={name:"htmlText",tokenize:OK};function OK(e,t,n){const r=this;let s,l,a;return u;function u(M){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(M),h}function h(M){return M===33?(e.consume(M),d):M===47?(e.consume(M),j):M===63?(e.consume(M),R):Wn(M)?(e.consume(M),B):n(M)}function d(M){return M===45?(e.consume(M),p):M===91?(e.consume(M),l=0,w):Wn(M)?(e.consume(M),T):n(M)}function p(M){return M===45?(e.consume(M),y):n(M)}function m(M){return M===null?n(M):M===45?(e.consume(M),_):je(M)?(a=m,V(M)):(e.consume(M),m)}function _(M){return M===45?(e.consume(M),y):m(M)}function y(M){return M===62?P(M):M===45?_(M):m(M)}function w(M){const I="CDATA[";return M===I.charCodeAt(l++)?(e.consume(M),l===I.length?S:w):n(M)}function S(M){return M===null?n(M):M===93?(e.consume(M),C):je(M)?(a=S,V(M)):(e.consume(M),S)}function C(M){return M===93?(e.consume(M),k):S(M)}function k(M){return M===62?P(M):M===93?(e.consume(M),k):S(M)}function T(M){return M===null||M===62?P(M):je(M)?(a=T,V(M)):(e.consume(M),T)}function R(M){return M===null?n(M):M===63?(e.consume(M),N):je(M)?(a=R,V(M)):(e.consume(M),R)}function N(M){return M===62?P(M):R(M)}function j(M){return Wn(M)?(e.consume(M),A):n(M)}function A(M){return M===45||jn(M)?(e.consume(M),A):D(M)}function D(M){return je(M)?(a=D,V(M)):Qe(M)?(e.consume(M),D):P(M)}function B(M){return M===45||jn(M)?(e.consume(M),B):M===47||M===62||xt(M)?K(M):n(M)}function K(M){return M===47?(e.consume(M),P):M===58||M===95||Wn(M)?(e.consume(M),z):je(M)?(a=K,V(M)):Qe(M)?(e.consume(M),K):P(M)}function z(M){return M===45||M===46||M===58||M===95||jn(M)?(e.consume(M),z):U(M)}function U(M){return M===61?(e.consume(M),H):je(M)?(a=U,V(M)):Qe(M)?(e.consume(M),U):K(M)}function H(M){return M===null||M===60||M===61||M===62||M===96?n(M):M===34||M===39?(e.consume(M),s=M,F):je(M)?(a=H,V(M)):Qe(M)?(e.consume(M),H):(e.consume(M),q)}function F(M){return M===s?(e.consume(M),s=void 0,$):M===null?n(M):je(M)?(a=F,V(M)):(e.consume(M),F)}function q(M){return M===null||M===34||M===39||M===60||M===61||M===96?n(M):M===47||M===62||xt(M)?K(M):(e.consume(M),q)}function $(M){return M===47||M===62||xt(M)?K(M):n(M)}function P(M){return M===62?(e.consume(M),e.exit("htmlTextData"),e.exit("htmlText"),t):n(M)}function V(M){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(M),e.exit("lineEnding"),W}function W(M){return Qe(M)?it(e,Z,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):Z(M)}function Z(M){return e.enter("htmlTextData"),a(M)}}const b0={name:"labelEnd",resolveAll:PK,resolveTo:BK,tokenize:IK},LK={tokenize:HK},jK={tokenize:FK},zK={tokenize:UK};function PK(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const s=r.type==="labelImage"?4:2;r.type="data",t+=s}}return e.length!==n.length&&Cr(e,0,e.length,n),e}function BK(e,t){let n=e.length,r=0,s,l,a,u;for(;n--;)if(s=e[n][1],l){if(s.type==="link"||s.type==="labelLink"&&s._inactive)break;e[n][0]==="enter"&&s.type==="labelLink"&&(s._inactive=!0)}else if(a){if(e[n][0]==="enter"&&(s.type==="labelImage"||s.type==="labelLink")&&!s._balanced&&(l=n,s.type!=="labelLink")){r=2;break}}else s.type==="labelEnd"&&(a=n);const h={type:e[l][1].type==="labelLink"?"link":"image",start:{...e[l][1].start},end:{...e[e.length-1][1].end}},d={type:"label",start:{...e[l][1].start},end:{...e[a][1].end}},p={type:"labelText",start:{...e[l+r+2][1].end},end:{...e[a-2][1].start}};return u=[["enter",h,t],["enter",d,t]],u=Vr(u,e.slice(l+1,l+r+3)),u=Vr(u,[["enter",p,t]]),u=Vr(u,jp(t.parser.constructs.insideSpan.null,e.slice(l+r+4,a-3),t)),u=Vr(u,[["exit",p,t],e[a-2],e[a-1],["exit",d,t]]),u=Vr(u,e.slice(a+1)),u=Vr(u,[["exit",h,t]]),Cr(e,l,e.length,u),e}function IK(e,t,n){const r=this;let s=r.events.length,l,a;for(;s--;)if((r.events[s][1].type==="labelImage"||r.events[s][1].type==="labelLink")&&!r.events[s][1]._balanced){l=r.events[s][1];break}return u;function u(_){return l?l._inactive?m(_):(a=r.parser.defined.includes(si(r.sliceSerialize({start:l.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(_),e.exit("labelMarker"),e.exit("labelEnd"),h):n(_)}function h(_){return _===40?e.attempt(LK,p,a?p:m)(_):_===91?e.attempt(jK,p,a?d:m)(_):a?p(_):m(_)}function d(_){return e.attempt(zK,p,m)(_)}function p(_){return t(_)}function m(_){return l._balanced=!0,n(_)}}function HK(e,t,n){return r;function r(m){return e.enter("resource"),e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),s}function s(m){return xt(m)?bu(e,l)(m):l(m)}function l(m){return m===41?p(m):JA(e,a,u,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(m)}function a(m){return xt(m)?bu(e,h)(m):p(m)}function u(m){return n(m)}function h(m){return m===34||m===39||m===40?t5(e,d,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(m):p(m)}function d(m){return xt(m)?bu(e,p)(m):p(m)}function p(m){return m===41?(e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),e.exit("resource"),t):n(m)}}function FK(e,t,n){const r=this;return s;function s(u){return e5.call(r,e,l,a,"reference","referenceMarker","referenceString")(u)}function l(u){return r.parser.defined.includes(si(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(u):n(u)}function a(u){return n(u)}}function UK(e,t,n){return r;function r(l){return e.enter("reference"),e.enter("referenceMarker"),e.consume(l),e.exit("referenceMarker"),s}function s(l){return l===93?(e.enter("referenceMarker"),e.consume(l),e.exit("referenceMarker"),e.exit("reference"),t):n(l)}}const $K={name:"labelStartImage",resolveAll:b0.resolveAll,tokenize:WK};function WK(e,t,n){const r=this;return s;function s(u){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(u),e.exit("labelImageMarker"),l}function l(u){return u===91?(e.enter("labelMarker"),e.consume(u),e.exit("labelMarker"),e.exit("labelImage"),a):n(u)}function a(u){return u===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(u):t(u)}}const VK={name:"labelStartLink",resolveAll:b0.resolveAll,tokenize:qK};function qK(e,t,n){const r=this;return s;function s(a){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelLink"),l}function l(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):t(a)}}const qv={name:"lineEnding",tokenize:KK};function KK(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),it(e,t,"linePrefix")}}const gf={name:"thematicBreak",tokenize:GK};function GK(e,t,n){let r=0,s;return l;function l(d){return e.enter("thematicBreak"),a(d)}function a(d){return s=d,u(d)}function u(d){return d===s?(e.enter("thematicBreakSequence"),h(d)):r>=3&&(d===null||je(d))?(e.exit("thematicBreak"),t(d)):n(d)}function h(d){return d===s?(e.consume(d),r++,h):(e.exit("thematicBreakSequence"),Qe(d)?it(e,u,"whitespace")(d):u(d))}}const sr={continuation:{tokenize:QK},exit:eG,name:"list",tokenize:ZK},YK={partial:!0,tokenize:tG},XK={partial:!0,tokenize:JK};function ZK(e,t,n){const r=this,s=r.events[r.events.length-1];let l=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,a=0;return u;function u(y){const w=r.containerState.type||(y===42||y===43||y===45?"listUnordered":"listOrdered");if(w==="listUnordered"?!r.containerState.marker||y===r.containerState.marker:Ny(y)){if(r.containerState.type||(r.containerState.type=w,e.enter(w,{_container:!0})),w==="listUnordered")return e.enter("listItemPrefix"),y===42||y===45?e.check(gf,n,d)(y):d(y);if(!r.interrupt||y===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),h(y)}return n(y)}function h(y){return Ny(y)&&++a<10?(e.consume(y),h):(!r.interrupt||a<2)&&(r.containerState.marker?y===r.containerState.marker:y===41||y===46)?(e.exit("listItemValue"),d(y)):n(y)}function d(y){return e.enter("listItemMarker"),e.consume(y),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||y,e.check(id,r.interrupt?n:p,e.attempt(YK,_,m))}function p(y){return r.containerState.initialBlankLine=!0,l++,_(y)}function m(y){return Qe(y)?(e.enter("listItemPrefixWhitespace"),e.consume(y),e.exit("listItemPrefixWhitespace"),_):n(y)}function _(y){return r.containerState.size=l+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(y)}}function QK(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(id,s,l);function s(u){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,it(e,t,"listItemIndent",r.containerState.size+1)(u)}function l(u){return r.containerState.furtherBlankLines||!Qe(u)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,a(u)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(XK,t,a)(u))}function a(u){return r.containerState._closeFlow=!0,r.interrupt=void 0,it(e,e.attempt(sr,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(u)}}function JK(e,t,n){const r=this;return it(e,s,"listItemIndent",r.containerState.size+1);function s(l){const a=r.events[r.events.length-1];return a&&a[1].type==="listItemIndent"&&a[2].sliceSerialize(a[1],!0).length===r.containerState.size?t(l):n(l)}}function eG(e){e.exit(this.containerState.type)}function tG(e,t,n){const r=this;return it(e,s,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(l){const a=r.events[r.events.length-1];return!Qe(l)&&a&&a[1].type==="listItemPrefixWhitespace"?t(l):n(l)}}const jk={name:"setextUnderline",resolveTo:nG,tokenize:rG};function nG(e,t){let n=e.length,r,s,l;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(s=n)}else e[n][1].type==="content"&&e.splice(n,1),!l&&e[n][1].type==="definition"&&(l=n);const a={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[s][1].type="setextHeadingText",l?(e.splice(s,0,["enter",a,t]),e.splice(l+1,0,["exit",e[r][1],t]),e[r][1].end={...e[l][1].end}):e[r][1]=a,e.push(["exit",a,t]),e}function rG(e,t,n){const r=this;let s;return l;function l(d){let p=r.events.length,m;for(;p--;)if(r.events[p][1].type!=="lineEnding"&&r.events[p][1].type!=="linePrefix"&&r.events[p][1].type!=="content"){m=r.events[p][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||m)?(e.enter("setextHeadingLine"),s=d,a(d)):n(d)}function a(d){return e.enter("setextHeadingLineSequence"),u(d)}function u(d){return d===s?(e.consume(d),u):(e.exit("setextHeadingLineSequence"),Qe(d)?it(e,h,"lineSuffix")(d):h(d))}function h(d){return d===null||je(d)?(e.exit("setextHeadingLine"),t(d)):n(d)}}const iG={tokenize:sG};function sG(e){const t=this,n=e.attempt(id,r,e.attempt(this.parser.constructs.flowInitial,s,it(e,e.attempt(this.parser.constructs.flow,s,e.attempt(uK,s)),"linePrefix")));return n;function r(l){if(l===null){e.consume(l);return}return e.enter("lineEndingBlank"),e.consume(l),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function s(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const oG={resolveAll:r5()},lG=n5("string"),aG=n5("text");function n5(e){return{resolveAll:r5(e==="text"?cG:void 0),tokenize:t};function t(n){const r=this,s=this.parser.constructs[e],l=n.attempt(s,a,u);return a;function a(p){return d(p)?l(p):u(p)}function u(p){if(p===null){n.consume(p);return}return n.enter("data"),n.consume(p),h}function h(p){return d(p)?(n.exit("data"),l(p)):(n.consume(p),h)}function d(p){if(p===null)return!0;const m=s[p];let _=-1;if(m)for(;++_<m.length;){const y=m[_];if(!y.previous||y.previous.call(r,r.previous))return!0}return!1}}}function r5(e){return t;function t(n,r){let s=-1,l;for(;++s<=n.length;)l===void 0?n[s]&&n[s][1].type==="data"&&(l=s,s++):(!n[s]||n[s][1].type!=="data")&&(s!==l+2&&(n[l][1].end=n[s-1][1].end,n.splice(l+2,s-l-2),s=l+2),l=void 0);return e?e(n,r):n}}function cG(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],s=t.sliceStream(r);let l=s.length,a=-1,u=0,h;for(;l--;){const d=s[l];if(typeof d=="string"){for(a=d.length;d.charCodeAt(a-1)===32;)u++,a--;if(a)break;a=-1}else if(d===-2)h=!0,u++;else if(d!==-1){l++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(u=0),u){const d={type:n===e.length||h||u<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:l?a:r.start._bufferIndex+a,_index:r.start._index+l,line:r.end.line,column:r.end.column-u,offset:r.end.offset-u},end:{...r.end}};r.end={...d.start},r.start.offset===r.end.offset?Object.assign(r,d):(e.splice(n,0,["enter",d,t],["exit",d,t]),n+=2)}n++}return e}const uG={42:sr,43:sr,45:sr,48:sr,49:sr,50:sr,51:sr,52:sr,53:sr,54:sr,55:sr,56:sr,57:sr,62:YA},dG={91:mK},hG={[-2]:Vv,[-1]:Vv,32:Vv},fG={35:xK,42:gf,45:[jk,gf],60:kK,61:jk,95:gf,96:Ok,126:Ok},pG={38:ZA,92:XA},mG={[-5]:qv,[-4]:qv,[-3]:qv,33:$K,38:ZA,42:Ay,60:[Vq,DK],91:VK,92:[yK,XA],93:b0,95:Ay,96:iK},gG={null:[Ay,oG]},vG={null:[42,95]},_G={null:[]},yG=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:vG,contentInitial:dG,disable:_G,document:uG,flow:fG,flowInitial:hG,insideSpan:gG,string:pG,text:mG},Symbol.toStringTag,{value:"Module"}));function bG(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const s={},l=[];let a=[],u=[];const h={attempt:D(j),check:D(A),consume:T,enter:R,exit:N,interrupt:D(A,{interrupt:!0})},d={code:null,containerState:{},defineSkip:S,events:[],now:w,parser:e,previous:null,sliceSerialize:_,sliceStream:y,write:m};let p=t.tokenize.call(d,h);return t.resolveAll&&l.push(t),d;function m(U){return a=Vr(a,U),C(),a[a.length-1]!==null?[]:(B(t,0),d.events=jp(l,d.events,d),d.events)}function _(U,H){return SG(y(U),H)}function y(U){return xG(a,U)}function w(){const{_bufferIndex:U,_index:H,line:F,column:q,offset:$}=r;return{_bufferIndex:U,_index:H,line:F,column:q,offset:$}}function S(U){s[U.line]=U.column,z()}function C(){let U;for(;r._index<a.length;){const H=a[r._index];if(typeof H=="string")for(U=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===U&&r._bufferIndex<H.length;)k(H.charCodeAt(r._bufferIndex));else k(H)}}function k(U){p=p(U)}function T(U){je(U)?(r.line++,r.column=1,r.offset+=U===-3?2:1,z()):U!==-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=U}function R(U,H){const F=H||{};return F.type=U,F.start=w(),d.events.push(["enter",F,d]),u.push(F),F}function N(U){const H=u.pop();return H.end=w(),d.events.push(["exit",H,d]),H}function j(U,H){B(U,H.from)}function A(U,H){H.restore()}function D(U,H){return F;function F(q,$,P){let V,W,Z,M;return Array.isArray(q)?X(q):"tokenize"in q?X([q]):I(q);function I(se){return J;function J(re){const he=re!==null&&se[re],ve=re!==null&&se.null,Ce=[...Array.isArray(he)?he:he?[he]:[],...Array.isArray(ve)?ve:ve?[ve]:[]];return X(Ce)(re)}}function X(se){return V=se,W=0,se.length===0?P:L(se[W])}function L(se){return J;function J(re){return M=K(),Z=se,se.partial||(d.currentConstruct=se),se.name&&d.parser.constructs.disable.null.includes(se.name)?ae():se.tokenize.call(H?Object.assign(Object.create(d),H):d,h,oe,ae)(re)}}function oe(se){return U(Z,M),$}function ae(se){return M.restore(),++W<V.length?L(V[W]):P}}}function B(U,H){U.resolveAll&&!l.includes(U)&&l.push(U),U.resolve&&Cr(d.events,H,d.events.length-H,U.resolve(d.events.slice(H),d)),U.resolveTo&&(d.events=U.resolveTo(d.events,d))}function K(){const U=w(),H=d.previous,F=d.currentConstruct,q=d.events.length,$=Array.from(u);return{from:q,restore:P};function P(){r=U,d.previous=H,d.currentConstruct=F,d.events.length=q,u=$,z()}}function z(){r.line in s&&r.column<2&&(r.column=s[r.line],r.offset+=s[r.line]-1)}}function xG(e,t){const n=t.start._index,r=t.start._bufferIndex,s=t.end._index,l=t.end._bufferIndex;let a;if(n===s)a=[e[n].slice(r,l)];else{if(a=e.slice(n,s),r>-1){const u=a[0];typeof u=="string"?a[0]=u.slice(r):a.shift()}l>0&&a.push(e[s].slice(0,l))}return a}function SG(e,t){let n=-1;const r=[];let s;for(;++n<e.length;){const l=e[n];let a;if(typeof l=="string")a=l;else switch(l){case-5:{a="\r";break}case-4:{a=`
489
+ `;break}case-3:{a=`\r
490
+ `;break}case-2:{a=t?" ":" ";break}case-1:{if(!t&&s)continue;a=" ";break}default:a=String.fromCharCode(l)}s=l===-2,r.push(a)}return r.join("")}function wG(e){const r={constructs:KA([yG,...(e||{}).extensions||[]]),content:s(Bq),defined:[],document:s(Hq),flow:s(iG),lazy:{},string:s(lG),text:s(aG)};return r;function s(l){return a;function a(u){return bG(r,l,u)}}}function CG(e){for(;!QA(e););return e}const zk=/[\0\t\n\r]/g;function kG(){let e=1,t="",n=!0,r;return s;function s(l,a,u){const h=[];let d,p,m,_,y;for(l=t+(typeof l=="string"?l.toString():new TextDecoder(a||void 0).decode(l)),m=0,t="",n&&(l.charCodeAt(0)===65279&&m++,n=void 0);m<l.length;){if(zk.lastIndex=m,d=zk.exec(l),_=d&&d.index!==void 0?d.index:l.length,y=l.charCodeAt(_),!d){t=l.slice(m);break}if(y===10&&m===_&&r)h.push(-3),r=void 0;else switch(r&&(h.push(-5),r=void 0),m<_&&(h.push(l.slice(m,_)),e+=_-m),y){case 0:{h.push(65533),e++;break}case 9:{for(p=Math.ceil(e/4)*4,h.push(-2);e++<p;)h.push(-1);break}case 10:{h.push(-4),e=1;break}default:r=!0,e=1}m=_+1}return u&&(r&&h.push(-5),t&&h.push(t),h.push(null)),h}}const EG=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function RG(e){return e.replace(EG,TG)}function TG(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const s=n.charCodeAt(1),l=s===120||s===88;return GA(n.slice(l?2:1),l?16:10)}return y0(n)||e}const i5={}.hasOwnProperty;function MG(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),NG(n)(CG(wG(n).document().write(kG()(e,t,!0))))}function NG(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:l(Jt),autolinkProtocol:K,autolinkEmail:K,atxHeading:l(St),blockQuote:l(ve),characterEscape:K,characterReference:K,codeFenced:l(Ce),codeFencedFenceInfo:a,codeFencedFenceMeta:a,codeIndented:l(Ce,a),codeText:l(ce,a),codeTextData:K,data:K,codeFlowValue:K,definition:l(_e),definitionDestinationString:a,definitionLabelString:a,definitionTitleString:a,emphasis:l(Le),hardBreakEscape:l(yt),hardBreakTrailing:l(yt),htmlFlow:l($t,a),htmlFlowData:K,htmlText:l($t,a),htmlTextData:K,image:l(Gn),label:a,link:l(Jt),listItem:l(un),listItemValue:_,listOrdered:l(Wt,m),listUnordered:l(Wt),paragraph:l(cr),reference:L,referenceString:a,resourceDestinationString:a,resourceTitleString:a,setextHeading:l(St),strong:l(pe),thematicBreak:l(ur)},exit:{atxHeading:h(),atxHeadingSequence:j,autolink:h(),autolinkEmail:he,autolinkProtocol:re,blockQuote:h(),characterEscapeValue:z,characterReferenceMarkerHexadecimal:ae,characterReferenceMarkerNumeric:ae,characterReferenceValue:se,characterReference:J,codeFenced:h(C),codeFencedFence:S,codeFencedFenceInfo:y,codeFencedFenceMeta:w,codeFlowValue:z,codeIndented:h(k),codeText:h($),codeTextData:z,data:z,definition:h(),definitionDestinationString:N,definitionLabelString:T,definitionTitleString:R,emphasis:h(),hardBreakEscape:h(H),hardBreakTrailing:h(H),htmlFlow:h(F),htmlFlowData:z,htmlText:h(q),htmlTextData:z,image:h(V),label:Z,labelText:W,lineEnding:U,link:h(P),listItem:h(),listOrdered:h(),listUnordered:h(),paragraph:h(),referenceString:oe,resourceDestinationString:M,resourceTitleString:I,resource:X,setextHeading:h(B),setextHeadingLineSequence:D,setextHeadingText:A,strong:h(),thematicBreak:h()}};s5(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(ue){let ye={type:"root",children:[]};const Ae={stack:[ye],tokenStack:[],config:t,enter:u,exit:d,buffer:a,resume:p,data:n},Be=[];let Ye=-1;for(;++Ye<ue.length;)if(ue[Ye][1].type==="listOrdered"||ue[Ye][1].type==="listUnordered")if(ue[Ye][0]==="enter")Be.push(Ye);else{const Mt=Be.pop();Ye=s(ue,Mt,Ye)}for(Ye=-1;++Ye<ue.length;){const Mt=t[ue[Ye][0]];i5.call(Mt,ue[Ye][1].type)&&Mt[ue[Ye][1].type].call(Object.assign({sliceSerialize:ue[Ye][2].sliceSerialize},Ae),ue[Ye][1])}if(Ae.tokenStack.length>0){const Mt=Ae.tokenStack[Ae.tokenStack.length-1];(Mt[1]||Pk).call(Ae,void 0,Mt[0])}for(ye.position={start:Xs(ue.length>0?ue[0][1].start:{line:1,column:1,offset:0}),end:Xs(ue.length>0?ue[ue.length-2][1].end:{line:1,column:1,offset:0})},Ye=-1;++Ye<t.transforms.length;)ye=t.transforms[Ye](ye)||ye;return ye}function s(ue,ye,Ae){let Be=ye-1,Ye=-1,Mt=!1,Yn,en,kt,Vt;for(;++Be<=Ae;){const st=ue[Be];switch(st[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{st[0]==="enter"?Ye++:Ye--,Vt=void 0;break}case"lineEndingBlank":{st[0]==="enter"&&(Yn&&!Vt&&!Ye&&!kt&&(kt=Be),Vt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Vt=void 0}if(!Ye&&st[0]==="enter"&&st[1].type==="listItemPrefix"||Ye===-1&&st[0]==="exit"&&(st[1].type==="listUnordered"||st[1].type==="listOrdered")){if(Yn){let Er=Be;for(en=void 0;Er--;){const Sn=ue[Er];if(Sn[1].type==="lineEnding"||Sn[1].type==="lineEndingBlank"){if(Sn[0]==="exit")continue;en&&(ue[en][1].type="lineEndingBlank",Mt=!0),Sn[1].type="lineEnding",en=Er}else if(!(Sn[1].type==="linePrefix"||Sn[1].type==="blockQuotePrefix"||Sn[1].type==="blockQuotePrefixWhitespace"||Sn[1].type==="blockQuoteMarker"||Sn[1].type==="listItemIndent"))break}kt&&(!en||kt<en)&&(Yn._spread=!0),Yn.end=Object.assign({},en?ue[en][1].start:st[1].end),ue.splice(en||Be,0,["exit",Yn,st[2]]),Be++,Ae++}if(st[1].type==="listItemPrefix"){const Er={type:"listItem",_spread:!1,start:Object.assign({},st[1].start),end:void 0};Yn=Er,ue.splice(Be,0,["enter",Er,st[2]]),Be++,Ae++,kt=void 0,Vt=!0}}}return ue[ye][1]._spread=Mt,Ae}function l(ue,ye){return Ae;function Ae(Be){u.call(this,ue(Be),Be),ye&&ye.call(this,Be)}}function a(){this.stack.push({type:"fragment",children:[]})}function u(ue,ye,Ae){this.stack[this.stack.length-1].children.push(ue),this.stack.push(ue),this.tokenStack.push([ye,Ae||void 0]),ue.position={start:Xs(ye.start),end:void 0}}function h(ue){return ye;function ye(Ae){ue&&ue.call(this,Ae),d.call(this,Ae)}}function d(ue,ye){const Ae=this.stack.pop(),Be=this.tokenStack.pop();if(Be)Be[0].type!==ue.type&&(ye?ye.call(this,ue,Be[0]):(Be[1]||Pk).call(this,ue,Be[0]));else throw new Error("Cannot close `"+ue.type+"` ("+yu({start:ue.start,end:ue.end})+"): it’s not open");Ae.position.end=Xs(ue.end)}function p(){return _0(this.stack.pop())}function m(){this.data.expectingFirstListItemValue=!0}function _(ue){if(this.data.expectingFirstListItemValue){const ye=this.stack[this.stack.length-2];ye.start=Number.parseInt(this.sliceSerialize(ue),10),this.data.expectingFirstListItemValue=void 0}}function y(){const ue=this.resume(),ye=this.stack[this.stack.length-1];ye.lang=ue}function w(){const ue=this.resume(),ye=this.stack[this.stack.length-1];ye.meta=ue}function S(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function C(){const ue=this.resume(),ye=this.stack[this.stack.length-1];ye.value=ue.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function k(){const ue=this.resume(),ye=this.stack[this.stack.length-1];ye.value=ue.replace(/(\r?\n|\r)$/g,"")}function T(ue){const ye=this.resume(),Ae=this.stack[this.stack.length-1];Ae.label=ye,Ae.identifier=si(this.sliceSerialize(ue)).toLowerCase()}function R(){const ue=this.resume(),ye=this.stack[this.stack.length-1];ye.title=ue}function N(){const ue=this.resume(),ye=this.stack[this.stack.length-1];ye.url=ue}function j(ue){const ye=this.stack[this.stack.length-1];if(!ye.depth){const Ae=this.sliceSerialize(ue).length;ye.depth=Ae}}function A(){this.data.setextHeadingSlurpLineEnding=!0}function D(ue){const ye=this.stack[this.stack.length-1];ye.depth=this.sliceSerialize(ue).codePointAt(0)===61?1:2}function B(){this.data.setextHeadingSlurpLineEnding=void 0}function K(ue){const Ae=this.stack[this.stack.length-1].children;let Be=Ae[Ae.length-1];(!Be||Be.type!=="text")&&(Be=Ge(),Be.position={start:Xs(ue.start),end:void 0},Ae.push(Be)),this.stack.push(Be)}function z(ue){const ye=this.stack.pop();ye.value+=this.sliceSerialize(ue),ye.position.end=Xs(ue.end)}function U(ue){const ye=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Ae=ye.children[ye.children.length-1];Ae.position.end=Xs(ue.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ye.type)&&(K.call(this,ue),z.call(this,ue))}function H(){this.data.atHardBreak=!0}function F(){const ue=this.resume(),ye=this.stack[this.stack.length-1];ye.value=ue}function q(){const ue=this.resume(),ye=this.stack[this.stack.length-1];ye.value=ue}function $(){const ue=this.resume(),ye=this.stack[this.stack.length-1];ye.value=ue}function P(){const ue=this.stack[this.stack.length-1];if(this.data.inReference){const ye=this.data.referenceType||"shortcut";ue.type+="Reference",ue.referenceType=ye,delete ue.url,delete ue.title}else delete ue.identifier,delete ue.label;this.data.referenceType=void 0}function V(){const ue=this.stack[this.stack.length-1];if(this.data.inReference){const ye=this.data.referenceType||"shortcut";ue.type+="Reference",ue.referenceType=ye,delete ue.url,delete ue.title}else delete ue.identifier,delete ue.label;this.data.referenceType=void 0}function W(ue){const ye=this.sliceSerialize(ue),Ae=this.stack[this.stack.length-2];Ae.label=RG(ye),Ae.identifier=si(ye).toLowerCase()}function Z(){const ue=this.stack[this.stack.length-1],ye=this.resume(),Ae=this.stack[this.stack.length-1];if(this.data.inReference=!0,Ae.type==="link"){const Be=ue.children;Ae.children=Be}else Ae.alt=ye}function M(){const ue=this.resume(),ye=this.stack[this.stack.length-1];ye.url=ue}function I(){const ue=this.resume(),ye=this.stack[this.stack.length-1];ye.title=ue}function X(){this.data.inReference=void 0}function L(){this.data.referenceType="collapsed"}function oe(ue){const ye=this.resume(),Ae=this.stack[this.stack.length-1];Ae.label=ye,Ae.identifier=si(this.sliceSerialize(ue)).toLowerCase(),this.data.referenceType="full"}function ae(ue){this.data.characterReferenceType=ue.type}function se(ue){const ye=this.sliceSerialize(ue),Ae=this.data.characterReferenceType;let Be;Ae?(Be=GA(ye,Ae==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Be=y0(ye);const Ye=this.stack[this.stack.length-1];Ye.value+=Be}function J(ue){const ye=this.stack.pop();ye.position.end=Xs(ue.end)}function re(ue){z.call(this,ue);const ye=this.stack[this.stack.length-1];ye.url=this.sliceSerialize(ue)}function he(ue){z.call(this,ue);const ye=this.stack[this.stack.length-1];ye.url="mailto:"+this.sliceSerialize(ue)}function ve(){return{type:"blockquote",children:[]}}function Ce(){return{type:"code",lang:null,meta:null,value:""}}function ce(){return{type:"inlineCode",value:""}}function _e(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Le(){return{type:"emphasis",children:[]}}function St(){return{type:"heading",depth:0,children:[]}}function yt(){return{type:"break"}}function $t(){return{type:"html",value:""}}function Gn(){return{type:"image",title:null,url:"",alt:null}}function Jt(){return{type:"link",title:null,url:"",children:[]}}function Wt(ue){return{type:"list",ordered:ue.type==="listOrdered",start:null,spread:ue._spread,children:[]}}function un(ue){return{type:"listItem",spread:ue._spread,checked:null,children:[]}}function cr(){return{type:"paragraph",children:[]}}function pe(){return{type:"strong",children:[]}}function Ge(){return{type:"text",value:""}}function ur(){return{type:"thematicBreak"}}}function Xs(e){return{line:e.line,column:e.column,offset:e.offset}}function s5(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?s5(e,r):AG(e,r)}}function AG(e,t){let n;for(n in t)if(i5.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function Pk(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+yu({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+yu({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+yu({start:t.start,end:t.end})+") is still open")}function DG(e){const t=this;t.parser=n;function n(r){return MG(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function OG(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function LG(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
491
+ `}]}function jG(e,t){const n=t.value?t.value+`
492
+ `:"",r={},s=t.lang?t.lang.split(/\s+/):[];s.length>0&&(r.className=["language-"+s[0]]);let l={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(l.data={meta:t.meta}),e.patch(t,l),l=e.applyData(t,l),l={type:"element",tagName:"pre",properties:{},children:[l]},e.patch(t,l),l}function zG(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function PG(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function BG(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),s=Wa(r.toLowerCase()),l=e.footnoteOrder.indexOf(r);let a,u=e.footnoteCounts.get(r);u===void 0?(u=0,e.footnoteOrder.push(r),a=e.footnoteOrder.length):a=l+1,u+=1,e.footnoteCounts.set(r,u);const h={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+s,id:n+"fnref-"+s+(u>1?"-"+u:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(a)}]};e.patch(t,h);const d={type:"element",tagName:"sup",properties:{},children:[h]};return e.patch(t,d),e.applyData(t,d)}function IG(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function HG(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function o5(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const s=e.all(t),l=s[0];l&&l.type==="text"?l.value="["+l.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 FG(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return o5(e,t);const s={src:Wa(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(s.title=r.title);const l={type:"element",tagName:"img",properties:s,children:[]};return e.patch(t,l),e.applyData(t,l)}function UG(e,t){const n={src:Wa(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function $G(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function WG(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return o5(e,t);const s={href:Wa(r.url||"")};r.title!==null&&r.title!==void 0&&(s.title=r.title);const l={type:"element",tagName:"a",properties:s,children:e.all(t)};return e.patch(t,l),e.applyData(t,l)}function VG(e,t){const n={href:Wa(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function qG(e,t,n){const r=e.all(t),s=n?KG(n):l5(t),l={},a=[];if(typeof t.checked=="boolean"){const p=r[0];let m;p&&p.type==="element"&&p.tagName==="p"?m=p:(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:t.checked,disabled:!0},children:[]}),l.className=["task-list-item"]}let u=-1;for(;++u<r.length;){const p=r[u];(s||u!==0||p.type!=="element"||p.tagName!=="p")&&a.push({type:"text",value:`
493
+ `}),p.type==="element"&&p.tagName==="p"&&!s?a.push(...p.children):a.push(p)}const h=r[r.length-1];h&&(s||h.type!=="element"||h.tagName!=="p")&&a.push({type:"text",value:`
494
+ `});const d={type:"element",tagName:"li",properties:l,children:a};return e.patch(t,d),e.applyData(t,d)}function KG(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r<n.length;)t=l5(n[r])}return t}function l5(e){const t=e.spread;return t??e.children.length>1}function GG(e,t){const n={},r=e.all(t);let s=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++s<r.length;){const 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 l={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,l),e.applyData(t,l)}function YG(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function XG(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function ZG(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function QG(e,t){const n=e.all(t),r=n.shift(),s=[];if(r){const a={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],a),s.push(a)}if(n.length>0){const a={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},u=p0(t.children[1]),h=HA(t.children[t.children.length-1]);u&&h&&(a.position={start:u,end:h}),s.push(a)}const l={type:"element",tagName:"table",properties:{},children:e.wrap(s,!0)};return e.patch(t,l),e.applyData(t,l)}function JG(e,t,n){const r=n?n.children:void 0,l=(r?r.indexOf(t):1)===0?"th":"td",a=n&&n.type==="table"?n.align:void 0,u=a?a.length:t.children.length;let h=-1;const d=[];for(;++h<u;){const m=t.children[h],_={},y=a?a[h]:void 0;y&&(_.align=y);let w={type:"element",tagName:l,properties:_,children:[]};m&&(w.children=e.all(m),e.patch(m,w),w=e.applyData(m,w)),d.push(w)}const p={type:"element",tagName:"tr",properties:{},children:e.wrap(d,!0)};return e.patch(t,p),e.applyData(t,p)}function eY(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const Bk=9,Ik=32;function tY(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),s=0;const l=[];for(;r;)l.push(Hk(t.slice(s,r.index),s>0,!0),r[0]),s=r.index+r[0].length,r=n.exec(t);return l.push(Hk(t.slice(s),s>0,!1)),l.join("")}function Hk(e,t,n){let r=0,s=e.length;if(t){let l=e.codePointAt(r);for(;l===Bk||l===Ik;)r++,l=e.codePointAt(r)}if(n){let l=e.codePointAt(s-1);for(;l===Bk||l===Ik;)s--,l=e.codePointAt(s-1)}return s>r?e.slice(r,s):""}function nY(e,t){const n={type:"text",value:tY(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function rY(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const iY={blockquote:OG,break:LG,code:jG,delete:zG,emphasis:PG,footnoteReference:BG,heading:IG,html:HG,imageReference:FG,image:UG,inlineCode:$G,linkReference:WG,link:VG,listItem:qG,list:GG,paragraph:YG,root:XG,strong:ZG,table:QG,tableCell:eY,tableRow:JG,text:nY,thematicBreak:rY,toml:$h,yaml:$h,definition:$h,footnoteDefinition:$h};function $h(){}const a5=-1,zp=0,xu=1,Yf=2,x0=3,S0=4,w0=5,C0=6,c5=7,u5=8,Fk=typeof self=="object"?self:globalThis,sY=(e,t)=>{const n=(s,l)=>(e.set(l,s),s),r=s=>{if(e.has(s))return e.get(s);const[l,a]=t[s];switch(l){case zp:case a5:return n(a,s);case xu:{const u=n([],s);for(const h of a)u.push(r(h));return u}case Yf:{const u=n({},s);for(const[h,d]of a)u[r(h)]=r(d);return u}case x0:return n(new Date(a),s);case S0:{const{source:u,flags:h}=a;return n(new RegExp(u,h),s)}case w0:{const u=n(new Map,s);for(const[h,d]of a)u.set(r(h),r(d));return u}case C0:{const u=n(new Set,s);for(const h of a)u.add(r(h));return u}case c5:{const{name:u,message:h}=a;return n(new Fk[u](h),s)}case u5: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:u}=new Uint8Array(a);return n(new DataView(u),a)}}return n(new Fk[l](a),s)};return r},Uk=e=>sY(new Map,e)(0),oa="",{toString:oY}={},{keys:lY}=Object,eu=e=>{const t=typeof e;if(t!=="object"||!e)return[zp,t];const n=oY.call(e).slice(8,-1);switch(n){case"Array":return[xu,oa];case"Object":return[Yf,oa];case"Date":return[x0,oa];case"RegExp":return[S0,oa];case"Map":return[w0,oa];case"Set":return[C0,oa];case"DataView":return[xu,n]}return n.includes("Array")?[xu,n]:n.includes("Error")?[c5,n]:[Yf,n]},Wh=([e,t])=>e===zp&&(t==="function"||t==="symbol"),aY=(e,t,n,r)=>{const s=(a,u)=>{const h=r.push(a)-1;return n.set(u,h),h},l=a=>{if(n.has(a))return n.get(a);let[u,h]=eu(a);switch(u){case zp:{let p=a;switch(h){case"bigint":u=u5,p=a.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+h);p=null;break;case"undefined":return s([a5],a)}return s([u,p],a)}case xu:{if(h){let _=a;return h==="DataView"?_=new Uint8Array(a.buffer):h==="ArrayBuffer"&&(_=new Uint8Array(a)),s([h,[..._]],a)}const p=[],m=s([u,p],a);for(const _ of a)p.push(l(_));return m}case Yf:{if(h)switch(h){case"BigInt":return s([h,a.toString()],a);case"Boolean":case"Number":case"String":return s([h,a.valueOf()],a)}if(t&&"toJSON"in a)return l(a.toJSON());const p=[],m=s([u,p],a);for(const _ of lY(a))(e||!Wh(eu(a[_])))&&p.push([l(_),l(a[_])]);return m}case x0:return s([u,a.toISOString()],a);case S0:{const{source:p,flags:m}=a;return s([u,{source:p,flags:m}],a)}case w0:{const p=[],m=s([u,p],a);for(const[_,y]of a)(e||!(Wh(eu(_))||Wh(eu(y))))&&p.push([l(_),l(y)]);return m}case C0:{const p=[],m=s([u,p],a);for(const _ of a)(e||!Wh(eu(_)))&&p.push(l(_));return m}}const{message:d}=a;return s([u,{name:h,message:d}],a)};return l},$k=(e,{json:t,lossy:n}={})=>{const r=[];return aY(!(t||n),!!t,new Map,r)(e),r},Xf=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?Uk($k(e,t)):structuredClone(e):(e,t)=>Uk($k(e,t));function cY(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function uY(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function dY(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||cY,r=e.options.footnoteBackLabel||uY,s=e.options.footnoteLabel||"Footnotes",l=e.options.footnoteLabelTagName||"h2",a=e.options.footnoteLabelProperties||{className:["sr-only"]},u=[];let h=-1;for(;++h<e.footnoteOrder.length;){const d=e.footnoteById.get(e.footnoteOrder[h]);if(!d)continue;const p=e.all(d),m=String(d.identifier).toUpperCase(),_=Wa(m.toLowerCase());let y=0;const w=[],S=e.footnoteCounts.get(m);for(;S!==void 0&&++y<=S;){w.length>0&&w.push({type:"text",value:" "});let T=typeof n=="string"?n:n(h,y);typeof T=="string"&&(T={type:"text",value:T}),w.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+_+(y>1?"-"+y:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(h,y),className:["data-footnote-backref"]},children:Array.isArray(T)?T:[T]})}const C=p[p.length-1];if(C&&C.type==="element"&&C.tagName==="p"){const T=C.children[C.children.length-1];T&&T.type==="text"?T.value+=" ":C.children.push({type:"text",value:" "}),C.children.push(...w)}else p.push(...w);const k={type:"element",tagName:"li",properties:{id:t+"fn-"+_},children:e.wrap(p,!0)};e.patch(d,k),u.push(k)}if(u.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:l,properties:{...Xf(a),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:`
495
+ `},{type:"element",tagName:"ol",properties:{},children:e.wrap(u,!0)},{type:"text",value:`
496
+ `}]}}const Pp=(function(e){if(e==null)return mY;if(typeof e=="function")return Bp(e);if(typeof e=="object")return Array.isArray(e)?hY(e):fY(e);if(typeof e=="string")return pY(e);throw new Error("Expected function, string, or object as test")});function hY(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Pp(e[n]);return Bp(r);function r(...s){let l=-1;for(;++l<t.length;)if(t[l].apply(this,s))return!0;return!1}}function fY(e){const t=e;return Bp(n);function n(r){const s=r;let l;for(l in e)if(s[l]!==t[l])return!1;return!0}}function pY(e){return Bp(t);function t(n){return n&&n.type===e}}function Bp(e){return t;function t(n,r,s){return!!(gY(n)&&e.call(this,n,typeof r=="number"?r:void 0,s||void 0))}}function mY(){return!0}function gY(e){return e!==null&&typeof e=="object"&&"type"in e}const d5=[],vY=!0,Dy=!1,_Y="skip";function h5(e,t,n,r){let s;typeof t=="function"&&typeof n!="function"?(r=n,n=t):s=t;const l=Pp(s),a=r?-1:1;u(e,void 0,[])();function u(h,d,p){const m=h&&typeof h=="object"?h:{};if(typeof m.type=="string"){const y=typeof m.tagName=="string"?m.tagName:typeof m.name=="string"?m.name:void 0;Object.defineProperty(_,"name",{value:"node ("+(h.type+(y?"<"+y+">":""))+")"})}return _;function _(){let y=d5,w,S,C;if((!t||l(h,d,p[p.length-1]||void 0))&&(y=yY(n(h,p)),y[0]===Dy))return y;if("children"in h&&h.children){const k=h;if(k.children&&y[0]!==_Y)for(S=(r?k.children.length:-1)+a,C=p.concat(k);S>-1&&S<k.children.length;){const T=k.children[S];if(w=u(T,S,C)(),w[0]===Dy)return w;S=typeof w[1]=="number"?w[1]:S+a}}return y}}}function yY(e){return Array.isArray(e)?e:typeof e=="number"?[vY,e]:e==null?d5:[e]}function k0(e,t,n,r){let s,l,a;typeof t=="function"&&typeof n!="function"?(l=void 0,a=t,s=n):(l=t,a=n,s=r),h5(e,l,u,s);function u(h,d){const p=d[d.length-1],m=p?p.children.indexOf(h):void 0;return a(h,m,p)}}const Oy={}.hasOwnProperty,bY={};function xY(e,t){const n=t||bY,r=new Map,s=new Map,l=new Map,a={...iY,...n.handlers},u={all:d,applyData:wY,definitionById:r,footnoteById:s,footnoteCounts:l,footnoteOrder:[],handlers:a,one:h,options:n,patch:SY,wrap:kY};return k0(e,function(p){if(p.type==="definition"||p.type==="footnoteDefinition"){const m=p.type==="definition"?r:s,_=String(p.identifier).toUpperCase();m.has(_)||m.set(_,p)}}),u;function h(p,m){const _=p.type,y=u.handlers[_];if(Oy.call(u.handlers,_)&&y)return y(u,p,m);if(u.options.passThrough&&u.options.passThrough.includes(_)){if("children"in p){const{children:S,...C}=p,k=Xf(C);return k.children=u.all(p),k}return Xf(p)}return(u.options.unknownHandler||CY)(u,p,m)}function d(p){const m=[];if("children"in p){const _=p.children;let y=-1;for(;++y<_.length;){const w=u.one(_[y],p);if(w){if(y&&_[y-1].type==="break"&&(!Array.isArray(w)&&w.type==="text"&&(w.value=Wk(w.value)),!Array.isArray(w)&&w.type==="element")){const S=w.children[0];S&&S.type==="text"&&(S.value=Wk(S.value))}Array.isArray(w)?m.push(...w):m.push(w)}}}return m}}function SY(e,t){e.position&&(t.position=uq(e))}function wY(e,t){let n=t;if(e&&e.data){const r=e.data.hName,s=e.data.hChildren,l=e.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"&&l&&Object.assign(n.properties,Xf(l)),"children"in n&&n.children&&s!==null&&s!==void 0&&(n.children=s)}return n}function CY(e,t){const n=t.data||{},r="value"in t&&!(Oy.call(n,"hProperties")||Oy.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function kY(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
497
+ `});++r<e.length;)r&&n.push({type:"text",value:`
498
+ `}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
499
+ `}),n}function Wk(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function Vk(e,t){const n=xY(e,t),r=n.one(e,void 0),s=dY(n),l=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return s&&l.children.push({type:"text",value:`
500
+ `},s),l}function EY(e,t){return e&&"run"in e?async function(n,r){const s=Vk(n,{file:r,...t});await e.run(s,r)}:function(n,r){return Vk(n,{file:r,...e||t})}}function qk(e){if(e)throw e}var Kv,Kk;function RY(){if(Kk)return Kv;Kk=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,s=function(d){return typeof Array.isArray=="function"?Array.isArray(d):t.call(d)==="[object Array]"},l=function(d){if(!d||t.call(d)!=="[object Object]")return!1;var p=e.call(d,"constructor"),m=d.constructor&&d.constructor.prototype&&e.call(d.constructor.prototype,"isPrototypeOf");if(d.constructor&&!p&&!m)return!1;var _;for(_ in d);return typeof _>"u"||e.call(d,_)},a=function(d,p){n&&p.name==="__proto__"?n(d,p.name,{enumerable:!0,configurable:!0,value:p.newValue,writable:!0}):d[p.name]=p.newValue},u=function(d,p){if(p==="__proto__")if(e.call(d,p)){if(r)return r(d,p).value}else return;return d[p]};return Kv=function h(){var d,p,m,_,y,w,S=arguments[0],C=1,k=arguments.length,T=!1;for(typeof S=="boolean"&&(T=S,S=arguments[1]||{},C=2),(S==null||typeof S!="object"&&typeof S!="function")&&(S={});C<k;++C)if(d=arguments[C],d!=null)for(p in d)m=u(S,p),_=u(d,p),S!==_&&(T&&_&&(l(_)||(y=s(_)))?(y?(y=!1,w=m&&s(m)?m:[]):w=m&&l(m)?m:{},a(S,{name:p,newValue:h(T,w,_)})):typeof _<"u"&&a(S,{name:p,newValue:_}));return S},Kv}var TY=RY();const Gv=ep(TY);function Ly(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function MY(){const e=[],t={run:n,use:r};return t;function n(...s){let l=-1;const a=s.pop();if(typeof a!="function")throw new TypeError("Expected function as last argument, not "+a);u(null,...s);function u(h,...d){const p=e[++l];let m=-1;if(h){a(h);return}for(;++m<s.length;)(d[m]===null||d[m]===void 0)&&(d[m]=s[m]);s=d,p?NY(p,u)(...d):a(null,...d)}}function r(s){if(typeof s!="function")throw new TypeError("Expected `middelware` to be a function, not "+s);return e.push(s),t}}function NY(e,t){let n;return r;function r(...a){const u=e.length>a.length;let h;u&&a.push(s);try{h=e.apply(this,a)}catch(d){const p=d;if(u&&n)throw p;return s(p)}u||(h&&h.then&&typeof h.then=="function"?h.then(l,s):h instanceof Error?s(h):l(h))}function s(a,...u){n||(n=!0,t(a,...u))}function l(a){s(null,a)}}const bi={basename:AY,dirname:DY,extname:OY,join:LY,sep:"/"};function AY(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');sd(e);let n=0,r=-1,s=e.length,l;if(t===void 0||t.length===0||t.length>e.length){for(;s--;)if(e.codePointAt(s)===47){if(l){n=s+1;break}}else r<0&&(l=!0,r=s+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let a=-1,u=t.length-1;for(;s--;)if(e.codePointAt(s)===47){if(l){n=s+1;break}}else a<0&&(l=!0,a=s+1),u>-1&&(e.codePointAt(s)===t.codePointAt(u--)?u<0&&(r=s):(u=-1,r=a));return n===r?r=a:r<0&&(r=e.length),e.slice(n,r)}function DY(e){if(sd(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function OY(e){sd(e);let t=e.length,n=-1,r=0,s=-1,l=0,a;for(;t--;){const u=e.codePointAt(t);if(u===47){if(a){r=t+1;break}continue}n<0&&(a=!0,n=t+1),u===46?s<0?s=t:l!==1&&(l=1):s>-1&&(l=-1)}return s<0||n<0||l===0||l===1&&s===n-1&&s===r+1?"":e.slice(s,n)}function LY(...e){let t=-1,n;for(;++t<e.length;)sd(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":jY(n)}function jY(e){sd(e);const t=e.codePointAt(0)===47;let n=zY(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function zY(e,t){let n="",r=0,s=-1,l=0,a=-1,u,h;for(;++a<=e.length;){if(a<e.length)u=e.codePointAt(a);else{if(u===47)break;u=47}if(u===47){if(!(s===a-1||l===1))if(s!==a-1&&l===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(h=n.lastIndexOf("/"),h!==n.length-1){h<0?(n="",r=0):(n=n.slice(0,h),r=n.length-1-n.lastIndexOf("/")),s=a,l=0;continue}}else if(n.length>0){n="",r=0,s=a,l=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(s+1,a):n=e.slice(s+1,a),r=a-s-1;s=a,l=0}else u===46&&l>-1?l++:l=-1}return n}function sd(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const PY={cwd:BY};function BY(){return"/"}function jy(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function IY(e){if(typeof e=="string")e=new URL(e);else if(!jy(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return HY(e)}function HY(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const s=new TypeError("File URL path must not include encoded / characters");throw s.code="ERR_INVALID_FILE_URL_PATH",s}}return decodeURIComponent(t)}const Yv=["history","path","basename","stem","extname","dirname"];class f5{constructor(t){let n;t?jy(t)?n={path:t}:typeof t=="string"||FY(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":PY.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Yv.length;){const l=Yv[r];l in n&&n[l]!==void 0&&n[l]!==null&&(this[l]=l==="history"?[...n[l]]:n[l])}let s;for(s in n)Yv.includes(s)||(this[s]=n[s])}get basename(){return typeof this.path=="string"?bi.basename(this.path):void 0}set basename(t){Zv(t,"basename"),Xv(t,"basename"),this.path=bi.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?bi.dirname(this.path):void 0}set dirname(t){Gk(this.basename,"dirname"),this.path=bi.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?bi.extname(this.path):void 0}set extname(t){if(Xv(t,"extname"),Gk(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=bi.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){jy(t)&&(t=IY(t)),Zv(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?bi.basename(this.path,this.extname):void 0}set stem(t){Zv(t,"stem"),Xv(t,"stem"),this.path=bi.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const s=this.message(t,n,r);throw s.fatal=!0,s}info(t,n,r){const s=this.message(t,n,r);return s.fatal=void 0,s}message(t,n,r){const s=new Pn(t,n,r);return this.path&&(s.name=this.path+":"+s.name,s.file=this.path),s.fatal=!1,this.messages.push(s),s}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Xv(e,t){if(e&&e.includes(bi.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+bi.sep+"`")}function Zv(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Gk(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function FY(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const UY=(function(e){const r=this.constructor.prototype,s=r[e],l=function(){return s.apply(l,arguments)};return Object.setPrototypeOf(l,r),l}),$Y={}.hasOwnProperty;class E0 extends UY{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=MY()}copy(){const t=new E0;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Gv(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(e_("data",this.frozen),this.namespace[t]=n,this):$Y.call(this.namespace,t)&&this.namespace[t]||void 0:t?(e_("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const s=n.call(t,...r);typeof s=="function"&&this.transformers.use(s)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=Vh(t),r=this.parser||this.Parser;return Qv("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Qv("process",this.parser||this.Parser),Jv("process",this.compiler||this.Compiler),n?s(void 0,n):new Promise(s);function s(l,a){const u=Vh(t),h=r.parse(u);r.run(h,u,function(p,m,_){if(p||!m||!_)return d(p);const y=m,w=r.stringify(y,_);qY(w)?_.value=w:_.result=w,d(p,_)});function d(p,m){p||!m?a(p):l?l(m):n(void 0,m)}}}processSync(t){let n=!1,r;return this.freeze(),Qv("processSync",this.parser||this.Parser),Jv("processSync",this.compiler||this.Compiler),this.process(t,s),Xk("processSync","process",n),r;function s(l,a){n=!0,qk(l),r=a}}run(t,n,r){Yk(t),this.freeze();const s=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?l(void 0,r):new Promise(l);function l(a,u){const h=Vh(n);s.run(t,h,d);function d(p,m,_){const y=m||t;p?u(p):a?a(y):r(void 0,y,_)}}}runSync(t,n){let r=!1,s;return this.run(t,n,l),Xk("runSync","run",r),s;function l(a,u){qk(a),s=u,r=!0}}stringify(t,n){this.freeze();const r=Vh(n),s=this.compiler||this.Compiler;return Jv("stringify",s),Yk(t),s(t,r)}use(t,...n){const r=this.attachers,s=this.namespace;if(e_("use",this.frozen),t!=null)if(typeof t=="function")h(t,n);else if(typeof t=="object")Array.isArray(t)?u(t):a(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function l(d){if(typeof d=="function")h(d,[]);else if(typeof d=="object")if(Array.isArray(d)){const[p,...m]=d;h(p,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");u(d.plugins),d.settings&&(s.settings=Gv(!0,s.settings,d.settings))}function u(d){let p=-1;if(d!=null)if(Array.isArray(d))for(;++p<d.length;){const m=d[p];l(m)}else throw new TypeError("Expected a list of plugins, not `"+d+"`")}function h(d,p){let m=-1,_=-1;for(;++m<r.length;)if(r[m][0]===d){_=m;break}if(_===-1)r.push([d,...p]);else if(p.length>0){let[y,...w]=p;const S=r[_][1];Ly(S)&&Ly(y)&&(y=Gv(!0,S,y)),r[_]=[d,y,...w]}}}}const WY=new E0().freeze();function Qv(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Jv(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function e_(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Yk(e){if(!Ly(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Xk(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Vh(e){return VY(e)?e:new f5(e)}function VY(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function qY(e){return typeof e=="string"||KY(e)}function KY(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const GY="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Zk=[],Qk={allowDangerousHtml:!0},YY=/^(https?|ircs?|mailto|xmpp)$/i,XY=[{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 od(e){const t=ZY(e),n=QY(e);return JY(t.runSync(t.parse(n),n),e)}function ZY(e){const t=e.rehypePlugins||Zk,n=e.remarkPlugins||Zk,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Qk}:Qk;return WY().use(DG).use(n).use(EY,r).use(t)}function QY(e){const t=e.children||"",n=new f5;return typeof t=="string"&&(n.value=t),n}function JY(e,t){const n=t.allowedElements,r=t.allowElement,s=t.components,l=t.disallowedElements,a=t.skipHtml,u=t.unwrapDisallowed,h=t.urlTransform||eX;for(const p of XY)Object.hasOwn(t,p.from)&&(""+p.from+(p.to?"use `"+p.to+"` instead":"remove it")+GY+p.id,void 0);return k0(e,d),mq(e,{Fragment:g.Fragment,components:s,ignoreInvalidStyle:!0,jsx:g.jsx,jsxs:g.jsxs,passKeys:!0,passNode:!0});function d(p,m,_){if(p.type==="raw"&&_&&typeof m=="number")return a?_.children.splice(m,1):_.children[m]={type:"text",value:p.value},m;if(p.type==="element"){let y;for(y in Wv)if(Object.hasOwn(Wv,y)&&Object.hasOwn(p.properties,y)){const w=p.properties[y],S=Wv[y];(S===null||S.includes(p.tagName))&&(p.properties[y]=h(String(w||""),y,p))}}if(p.type==="element"){let y=n?!n.includes(p.tagName):l?l.includes(p.tagName):!1;if(!y&&r&&typeof m=="number"&&(y=!r(p,m,_)),y&&_&&typeof m=="number")return u&&p.children?_.children.splice(m,1,...p.children):_.children.splice(m,1),m}}}function eX(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),s=e.indexOf("/");return t===-1||s!==-1&&t>s||n!==-1&&t>n||r!==-1&&t>r||YY.test(e.slice(0,t))?e:""}function Jk(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,s=n.indexOf(t);for(;s!==-1;)r++,s=n.indexOf(t,s+t.length);return r}function tX(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function nX(e,t,n){const s=Pp((n||{}).ignore||[]),l=rX(t);let a=-1;for(;++a<l.length;)h5(e,"text",u);function u(d,p){let m=-1,_;for(;++m<p.length;){const y=p[m],w=_?_.children:void 0;if(s(y,w?w.indexOf(y):void 0,_))return;_=y}if(_)return h(d,p)}function h(d,p){const m=p[p.length-1],_=l[a][0],y=l[a][1];let w=0;const C=m.children.indexOf(d);let k=!1,T=[];_.lastIndex=0;let R=_.exec(d.value);for(;R;){const N=R.index,j={index:R.index,input:R.input,stack:[...p,d]};let A=y(...R,j);if(typeof A=="string"&&(A=A.length>0?{type:"text",value:A}:void 0),A===!1?_.lastIndex=N+1:(w!==N&&T.push({type:"text",value:d.value.slice(w,N)}),Array.isArray(A)?T.push(...A):A&&T.push(A),w=N+R[0].length,k=!0),!_.global)break;R=_.exec(d.value)}return k?(w<d.value.length&&T.push({type:"text",value:d.value.slice(w)}),m.children.splice(C,1,...T)):T=[d],C+T.length}}function rX(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let r=-1;for(;++r<n.length;){const s=n[r];t.push([iX(s[0]),sX(s[1])])}return t}function iX(e){return typeof e=="string"?new RegExp(tX(e),"g"):e}function sX(e){return typeof e=="function"?e:function(){return e}}const t_="phrasing",n_=["autolink","link","image","label"];function oX(){return{transforms:[fX],enter:{literalAutolink:aX,literalAutolinkEmail:r_,literalAutolinkHttp:r_,literalAutolinkWww:r_},exit:{literalAutolink:hX,literalAutolinkEmail:dX,literalAutolinkHttp:cX,literalAutolinkWww:uX}}}function lX(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:t_,notInConstruct:n_},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:t_,notInConstruct:n_},{character:":",before:"[ps]",after:"\\/",inConstruct:t_,notInConstruct:n_}]}}function aX(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function r_(e){this.config.enter.autolinkProtocol.call(this,e)}function cX(e){this.config.exit.autolinkProtocol.call(this,e)}function uX(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function dX(e){this.config.exit.autolinkEmail.call(this,e)}function hX(e){this.exit(e)}function fX(e){nX(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,pX],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),mX]],{ignore:["link","linkReference"]})}function pX(e,t,n,r,s){let l="";if(!p5(s)||(/^w/i.test(t)&&(n=t+n,t="",l="http://"),!gX(n)))return!1;const a=vX(n+r);if(!a[0])return!1;const u={type:"link",title:null,url:l+t+a[0],children:[{type:"text",value:t+a[0]}]};return a[1]?[u,{type:"text",value:a[1]}]:u}function mX(e,t,n,r){return!p5(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function gX(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function vX(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const s=Jk(e,"(");let l=Jk(e,")");for(;r!==-1&&s>l;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),l++;return[e,n]}function p5(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||il(n)||Lp(n))&&(!t||n!==47)}m5.peek=EX;function _X(){this.buffer()}function yX(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function bX(){this.buffer()}function xX(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function SX(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=si(this.sliceSerialize(e)).toLowerCase(),n.label=t}function wX(e){this.exit(e)}function CX(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=si(this.sliceSerialize(e)).toLowerCase(),n.label=t}function kX(e){this.exit(e)}function EX(){return"["}function m5(e,t,n,r){const s=n.createTracker(r);let l=s.move("[^");const a=n.enter("footnoteReference"),u=n.enter("reference");return l+=s.move(n.safe(n.associationId(e),{after:"]",before:l})),u(),a(),l+=s.move("]"),l}function RX(){return{enter:{gfmFootnoteCallString:_X,gfmFootnoteCall:yX,gfmFootnoteDefinitionLabelString:bX,gfmFootnoteDefinition:xX},exit:{gfmFootnoteCallString:SX,gfmFootnoteCall:wX,gfmFootnoteDefinitionLabelString:CX,gfmFootnoteDefinition:kX}}}function TX(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:m5},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,s,l,a){const u=l.createTracker(a);let h=u.move("[^");const d=l.enter("footnoteDefinition"),p=l.enter("label");return h+=u.move(l.safe(l.associationId(r),{before:h,after:"]"})),p(),h+=u.move("]:"),r.children&&r.children.length>0&&(u.shift(4),h+=u.move((t?`
501
+ `:" ")+l.indentLines(l.containerFlow(r,u.current()),t?g5:MX))),d(),h}}function MX(e,t,n){return t===0?e:g5(e,t,n)}function g5(e,t,n){return(n?"":" ")+e}const NX=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];v5.peek=jX;function AX(){return{canContainEols:["delete"],enter:{strikethrough:OX},exit:{strikethrough:LX}}}function DX(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:NX}],handlers:{delete:v5}}}function OX(e){this.enter({type:"delete",children:[]},e)}function LX(e){this.exit(e)}function v5(e,t,n,r){const s=n.createTracker(r),l=n.enter("strikethrough");let a=s.move("~~");return a+=n.containerPhrasing(e,{...s.current(),before:a,after:"~"}),a+=s.move("~~"),l(),a}function jX(){return"~"}function zX(e){return e.length}function PX(e,t){const n=t||{},r=(n.align||[]).concat(),s=n.stringLength||zX,l=[],a=[],u=[],h=[];let d=0,p=-1;for(;++p<e.length;){const S=[],C=[];let k=-1;for(e[p].length>d&&(d=e[p].length);++k<e[p].length;){const T=BX(e[p][k]);if(n.alignDelimiters!==!1){const R=s(T);C[k]=R,(h[k]===void 0||R>h[k])&&(h[k]=R)}S.push(T)}a[p]=S,u[p]=C}let m=-1;if(typeof r=="object"&&"length"in r)for(;++m<d;)l[m]=eE(r[m]);else{const S=eE(r);for(;++m<d;)l[m]=S}m=-1;const _=[],y=[];for(;++m<d;){const S=l[m];let C="",k="";S===99?(C=":",k=":"):S===108?C=":":S===114&&(k=":");let T=n.alignDelimiters===!1?1:Math.max(1,h[m]-C.length-k.length);const R=C+"-".repeat(T)+k;n.alignDelimiters!==!1&&(T=C.length+T+k.length,T>h[m]&&(h[m]=T),y[m]=T),_[m]=R}a.splice(1,0,_),u.splice(1,0,y),p=-1;const w=[];for(;++p<a.length;){const S=a[p],C=u[p];m=-1;const k=[];for(;++m<d;){const T=S[m]||"";let R="",N="";if(n.alignDelimiters!==!1){const j=h[m]-(C[m]||0),A=l[m];A===114?R=" ".repeat(j):A===99?j%2?(R=" ".repeat(j/2+.5),N=" ".repeat(j/2-.5)):(R=" ".repeat(j/2),N=R):N=" ".repeat(j)}n.delimiterStart!==!1&&!m&&k.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&T==="")&&(n.delimiterStart!==!1||m)&&k.push(" "),n.alignDelimiters!==!1&&k.push(R),k.push(T),n.alignDelimiters!==!1&&k.push(N),n.padding!==!1&&k.push(" "),(n.delimiterEnd!==!1||m!==d-1)&&k.push("|")}w.push(n.delimiterEnd===!1?k.join("").replace(/ +$/,""):k.join(""))}return w.join(`
502
+ `)}function BX(e){return e==null?"":String(e)}function eE(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function IX(e,t,n,r){const s=n.enter("blockquote"),l=n.createTracker(r);l.move("> "),l.shift(2);const a=n.indentLines(n.containerFlow(e,l.current()),HX);return s(),a}function HX(e,t,n){return">"+(n?"":" ")+e}function FX(e,t){return tE(e,t.inConstruct,!0)&&!tE(e,t.notInConstruct,!1)}function tE(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function nE(e,t,n,r){let s=-1;for(;++s<n.unsafe.length;)if(n.unsafe[s].character===`
503
+ `&&FX(n.stack,n.unsafe[s]))return/[ \t]/.test(r.before)?"":" ";return`\\
504
+ `}function UX(e,t){const n=String(e);let r=n.indexOf(t),s=r,l=0,a=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===s?++l>a&&(a=l):l=1,s=r+t.length,r=n.indexOf(t,s);return a}function $X(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function WX(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function VX(e,t,n,r){const s=WX(n),l=e.value||"",a=s==="`"?"GraveAccent":"Tilde";if($X(e,n)){const m=n.enter("codeIndented"),_=n.indentLines(l,qX);return m(),_}const u=n.createTracker(r),h=s.repeat(Math.max(UX(l,s)+1,3)),d=n.enter("codeFenced");let p=u.move(h);if(e.lang){const m=n.enter(`codeFencedLang${a}`);p+=u.move(n.safe(e.lang,{before:p,after:" ",encode:["`"],...u.current()})),m()}if(e.lang&&e.meta){const m=n.enter(`codeFencedMeta${a}`);p+=u.move(" "),p+=u.move(n.safe(e.meta,{before:p,after:`
505
+ `,encode:["`"],...u.current()})),m()}return p+=u.move(`
506
+ `),l&&(p+=u.move(l+`
507
+ `)),p+=u.move(h),d(),p}function qX(e,t,n){return(n?"":" ")+e}function R0(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function KX(e,t,n,r){const s=R0(n),l=s==='"'?"Quote":"Apostrophe",a=n.enter("definition");let u=n.enter("label");const h=n.createTracker(r);let d=h.move("[");return d+=h.move(n.safe(n.associationId(e),{before:d,after:"]",...h.current()})),d+=h.move("]: "),u(),!e.url||/[\0- \u007F]/.test(e.url)?(u=n.enter("destinationLiteral"),d+=h.move("<"),d+=h.move(n.safe(e.url,{before:d,after:">",...h.current()})),d+=h.move(">")):(u=n.enter("destinationRaw"),d+=h.move(n.safe(e.url,{before:d,after:e.title?" ":`
508
+ `,...h.current()}))),u(),e.title&&(u=n.enter(`title${l}`),d+=h.move(" "+s),d+=h.move(n.safe(e.title,{before:d,after:s,...h.current()})),d+=h.move(s),u()),a(),d}function GX(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function Bu(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Zf(e,t,n){const r=Ea(e),s=Ea(t);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}}_5.peek=YX;function _5(e,t,n,r){const s=GX(n),l=n.enter("emphasis"),a=n.createTracker(r),u=a.move(s);let h=a.move(n.containerPhrasing(e,{after:s,before:u,...a.current()}));const d=h.charCodeAt(0),p=Zf(r.before.charCodeAt(r.before.length-1),d,s);p.inside&&(h=Bu(d)+h.slice(1));const m=h.charCodeAt(h.length-1),_=Zf(r.after.charCodeAt(0),m,s);_.inside&&(h=h.slice(0,-1)+Bu(m));const y=a.move(s);return l(),n.attentionEncodeSurroundingInfo={after:_.outside,before:p.outside},u+h+y}function YX(e,t,n){return n.options.emphasis||"*"}function XX(e,t){let n=!1;return k0(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,Dy}),!!((!e.depth||e.depth<3)&&_0(e)&&(t.options.setext||n))}function ZX(e,t,n,r){const s=Math.max(Math.min(6,e.depth||1),1),l=n.createTracker(r);if(XX(e,n)){const p=n.enter("headingSetext"),m=n.enter("phrasing"),_=n.containerPhrasing(e,{...l.current(),before:`
509
+ `,after:`
510
+ `});return m(),p(),_+`
511
+ `+(s===1?"=":"-").repeat(_.length-(Math.max(_.lastIndexOf("\r"),_.lastIndexOf(`
512
+ `))+1))}const a="#".repeat(s),u=n.enter("headingAtx"),h=n.enter("phrasing");l.move(a+" ");let d=n.containerPhrasing(e,{before:"# ",after:`
513
+ `,...l.current()});return/^[\t ]/.test(d)&&(d=Bu(d.charCodeAt(0))+d.slice(1)),d=d?a+" "+d:a,n.options.closeAtx&&(d+=" "+a),h(),u(),d}y5.peek=QX;function y5(e){return e.value||""}function QX(){return"<"}b5.peek=JX;function b5(e,t,n,r){const s=R0(n),l=s==='"'?"Quote":"Apostrophe",a=n.enter("image");let u=n.enter("label");const h=n.createTracker(r);let d=h.move("![");return d+=h.move(n.safe(e.alt,{before:d,after:"]",...h.current()})),d+=h.move("]("),u(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(u=n.enter("destinationLiteral"),d+=h.move("<"),d+=h.move(n.safe(e.url,{before:d,after:">",...h.current()})),d+=h.move(">")):(u=n.enter("destinationRaw"),d+=h.move(n.safe(e.url,{before:d,after:e.title?" ":")",...h.current()}))),u(),e.title&&(u=n.enter(`title${l}`),d+=h.move(" "+s),d+=h.move(n.safe(e.title,{before:d,after:s,...h.current()})),d+=h.move(s),u()),d+=h.move(")"),a(),d}function JX(){return"!"}x5.peek=eZ;function x5(e,t,n,r){const s=e.referenceType,l=n.enter("imageReference");let a=n.enter("label");const u=n.createTracker(r);let h=u.move("![");const d=n.safe(e.alt,{before:h,after:"]",...u.current()});h+=u.move(d+"]["),a();const p=n.stack;n.stack=[],a=n.enter("reference");const m=n.safe(n.associationId(e),{before:h,after:"]",...u.current()});return a(),n.stack=p,l(),s==="full"||!d||d!==m?h+=u.move(m+"]"):s==="shortcut"?h=h.slice(0,-1):h+=u.move("]"),h}function eZ(){return"!"}S5.peek=tZ;function S5(e,t,n){let r=e.value||"",s="`",l=-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+" ");++l<n.unsafe.length;){const a=n.unsafe[l],u=n.compilePattern(a);let h;if(a.atBreak)for(;h=u.exec(r);){let d=h.index;r.charCodeAt(d)===10&&r.charCodeAt(d-1)===13&&d--,r=r.slice(0,d)+" "+r.slice(h.index+1)}}return s+r+s}function tZ(){return"`"}function w5(e,t){const n=_0(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}C5.peek=nZ;function C5(e,t,n,r){const s=R0(n),l=s==='"'?"Quote":"Apostrophe",a=n.createTracker(r);let u,h;if(w5(e,n)){const p=n.stack;n.stack=[],u=n.enter("autolink");let m=a.move("<");return m+=a.move(n.containerPhrasing(e,{before:m,after:">",...a.current()})),m+=a.move(">"),u(),n.stack=p,m}u=n.enter("link"),h=n.enter("label");let d=a.move("[");return d+=a.move(n.containerPhrasing(e,{before:d,after:"](",...a.current()})),d+=a.move("]("),h(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(h=n.enter("destinationLiteral"),d+=a.move("<"),d+=a.move(n.safe(e.url,{before:d,after:">",...a.current()})),d+=a.move(">")):(h=n.enter("destinationRaw"),d+=a.move(n.safe(e.url,{before:d,after:e.title?" ":")",...a.current()}))),h(),e.title&&(h=n.enter(`title${l}`),d+=a.move(" "+s),d+=a.move(n.safe(e.title,{before:d,after:s,...a.current()})),d+=a.move(s),h()),d+=a.move(")"),u(),d}function nZ(e,t,n){return w5(e,n)?"<":"["}k5.peek=rZ;function k5(e,t,n,r){const s=e.referenceType,l=n.enter("linkReference");let a=n.enter("label");const u=n.createTracker(r);let h=u.move("[");const d=n.containerPhrasing(e,{before:h,after:"]",...u.current()});h+=u.move(d+"]["),a();const p=n.stack;n.stack=[],a=n.enter("reference");const m=n.safe(n.associationId(e),{before:h,after:"]",...u.current()});return a(),n.stack=p,l(),s==="full"||!d||d!==m?h+=u.move(m+"]"):s==="shortcut"?h=h.slice(0,-1):h+=u.move("]"),h}function rZ(){return"["}function T0(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function iZ(e){const t=T0(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function sZ(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function E5(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function oZ(e,t,n,r){const s=n.enter("list"),l=n.bulletCurrent;let a=e.ordered?sZ(n):T0(n);const u=e.ordered?a==="."?")":".":iZ(n);let h=t&&n.bulletLastUsed?a===n.bulletLastUsed:!1;if(!e.ordered){const p=e.children?e.children[0]:void 0;if((a==="*"||a==="-")&&p&&(!p.children||!p.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&&(h=!0),E5(n)===a&&p){let m=-1;for(;++m<e.children.length;){const _=e.children[m];if(_&&_.type==="listItem"&&_.children&&_.children[0]&&_.children[0].type==="thematicBreak"){h=!0;break}}}}h&&(a=u),n.bulletCurrent=a;const d=n.containerFlow(e,r);return n.bulletLastUsed=a,n.bulletCurrent=l,s(),d}function lZ(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function aZ(e,t,n,r){const s=lZ(n);let l=n.bulletCurrent||T0(n);t&&t.type==="list"&&t.ordered&&(l=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+l);let a=l.length+1;(s==="tab"||s==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(a=Math.ceil(a/4)*4);const u=n.createTracker(r);u.move(l+" ".repeat(a-l.length)),u.shift(a);const h=n.enter("listItem"),d=n.indentLines(n.containerFlow(e,u.current()),p);return h(),d;function p(m,_,y){return _?(y?"":" ".repeat(a))+m:(y?l:l+" ".repeat(a-l.length))+m}}function cZ(e,t,n,r){const s=n.enter("paragraph"),l=n.enter("phrasing"),a=n.containerPhrasing(e,r);return l(),s(),a}const uZ=Pp(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function dZ(e,t,n,r){return(e.children.some(function(a){return uZ(a)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function hZ(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}R5.peek=fZ;function R5(e,t,n,r){const s=hZ(n),l=n.enter("strong"),a=n.createTracker(r),u=a.move(s+s);let h=a.move(n.containerPhrasing(e,{after:s,before:u,...a.current()}));const d=h.charCodeAt(0),p=Zf(r.before.charCodeAt(r.before.length-1),d,s);p.inside&&(h=Bu(d)+h.slice(1));const m=h.charCodeAt(h.length-1),_=Zf(r.after.charCodeAt(0),m,s);_.inside&&(h=h.slice(0,-1)+Bu(m));const y=a.move(s+s);return l(),n.attentionEncodeSurroundingInfo={after:_.outside,before:p.outside},u+h+y}function fZ(e,t,n){return n.options.strong||"*"}function pZ(e,t,n,r){return n.safe(e.value,r)}function mZ(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function gZ(e,t,n){const r=(E5(n)+(n.options.ruleSpaces?" ":"")).repeat(mZ(n));return n.options.ruleSpaces?r.slice(0,-1):r}const T5={blockquote:IX,break:nE,code:VX,definition:KX,emphasis:_5,hardBreak:nE,heading:ZX,html:y5,image:b5,imageReference:x5,inlineCode:S5,link:C5,linkReference:k5,list:oZ,listItem:aZ,paragraph:cZ,root:dZ,strong:R5,text:pZ,thematicBreak:gZ};function vZ(){return{enter:{table:_Z,tableData:rE,tableHeader:rE,tableRow:bZ},exit:{codeText:xZ,table:yZ,tableData:i_,tableHeader:i_,tableRow:i_}}}function _Z(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function yZ(e){this.exit(e),this.data.inTable=void 0}function bZ(e){this.enter({type:"tableRow",children:[]},e)}function i_(e){this.exit(e)}function rE(e){this.enter({type:"tableCell",children:[]},e)}function xZ(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,SZ));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function SZ(e,t){return t==="|"?t:e}function wZ(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,s=t.stringLength,l=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
514
+ `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:_,table:a,tableCell:h,tableRow:u}};function a(y,w,S,C){return d(p(y,S,C),y.align)}function u(y,w,S,C){const k=m(y,S,C),T=d([k]);return T.slice(0,T.indexOf(`
515
+ `))}function h(y,w,S,C){const k=S.enter("tableCell"),T=S.enter("phrasing"),R=S.containerPhrasing(y,{...C,before:l,after:l});return T(),k(),R}function d(y,w){return PX(y,{align:w,alignDelimiters:r,padding:n,stringLength:s})}function p(y,w,S){const C=y.children;let k=-1;const T=[],R=w.enter("table");for(;++k<C.length;)T[k]=m(C[k],w,S);return R(),T}function m(y,w,S){const C=y.children;let k=-1;const T=[],R=w.enter("tableRow");for(;++k<C.length;)T[k]=h(C[k],y,w,S);return R(),T}function _(y,w,S){let C=T5.inlineCode(y,w,S);return S.stack.includes("tableCell")&&(C=C.replace(/\|/g,"\\$&")),C}}function CZ(){return{exit:{taskListCheckValueChecked:iE,taskListCheckValueUnchecked:iE,paragraph:EZ}}}function kZ(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:RZ}}}function iE(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function EZ(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const s=t.children;let l=-1,a;for(;++l<s.length;){const u=s[l];if(u.type==="paragraph"){a=u;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(e)}function RZ(e,t,n,r){const s=e.children[0],l=typeof e.checked=="boolean"&&s&&s.type==="paragraph",a="["+(e.checked?"x":" ")+"] ",u=n.createTracker(r);l&&u.move(a);let h=T5.listItem(e,t,n,{...r,...u.current()});return l&&(h=h.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,d)),h;function d(p){return p+a}}function TZ(){return[oX(),RX(),AX(),vZ(),CZ()]}function MZ(e){return{extensions:[lX(),TX(e),DX(),wZ(e),kZ()]}}const NZ={tokenize:zZ,partial:!0},M5={tokenize:PZ,partial:!0},N5={tokenize:BZ,partial:!0},A5={tokenize:IZ,partial:!0},AZ={tokenize:HZ,partial:!0},D5={name:"wwwAutolink",tokenize:LZ,previous:L5},O5={name:"protocolAutolink",tokenize:jZ,previous:j5},ys={name:"emailAutolink",tokenize:OZ,previous:z5},Li={};function DZ(){return{text:Li}}let Io=48;for(;Io<123;)Li[Io]=ys,Io++,Io===58?Io=65:Io===91&&(Io=97);Li[43]=ys;Li[45]=ys;Li[46]=ys;Li[95]=ys;Li[72]=[ys,O5];Li[104]=[ys,O5];Li[87]=[ys,D5];Li[119]=[ys,D5];function OZ(e,t,n){const r=this;let s,l;return a;function a(m){return!zy(m)||!z5.call(r,r.previous)||M0(r.events)?n(m):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),u(m))}function u(m){return zy(m)?(e.consume(m),u):m===64?(e.consume(m),h):n(m)}function h(m){return m===46?e.check(AZ,p,d)(m):m===45||m===95||jn(m)?(l=!0,e.consume(m),h):p(m)}function d(m){return e.consume(m),s=!0,h}function p(m){return l&&s&&Wn(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(m)):n(m)}}function LZ(e,t,n){const r=this;return s;function s(a){return a!==87&&a!==119||!L5.call(r,r.previous)||M0(r.events)?n(a):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(NZ,e.attempt(M5,e.attempt(N5,l),n),n)(a))}function l(a){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(a)}}function jZ(e,t,n){const r=this;let s="",l=!1;return a;function a(m){return(m===72||m===104)&&j5.call(r,r.previous)&&!M0(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),s+=String.fromCodePoint(m),e.consume(m),u):n(m)}function u(m){if(Wn(m)&&s.length<5)return s+=String.fromCodePoint(m),e.consume(m),u;if(m===58){const _=s.toLowerCase();if(_==="http"||_==="https")return e.consume(m),h}return n(m)}function h(m){return m===47?(e.consume(m),l?d:(l=!0,h)):n(m)}function d(m){return m===null||Gf(m)||xt(m)||il(m)||Lp(m)?n(m):e.attempt(M5,e.attempt(N5,p),n)(m)}function p(m){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(m)}}function zZ(e,t,n){let r=0;return s;function s(a){return(a===87||a===119)&&r<3?(r++,e.consume(a),s):a===46&&r===3?(e.consume(a),l):n(a)}function l(a){return a===null?n(a):t(a)}}function PZ(e,t,n){let r,s,l;return a;function a(d){return d===46||d===95?e.check(A5,h,u)(d):d===null||xt(d)||il(d)||d!==45&&Lp(d)?h(d):(l=!0,e.consume(d),a)}function u(d){return d===95?r=!0:(s=r,r=void 0),e.consume(d),a}function h(d){return s||r||!l?n(d):t(d)}}function BZ(e,t){let n=0,r=0;return s;function s(a){return a===40?(n++,e.consume(a),s):a===41&&r<n?l(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?e.check(A5,t,l)(a):a===null||xt(a)||il(a)?t(a):(e.consume(a),s)}function l(a){return a===41&&r++,e.consume(a),s}}function IZ(e,t,n){return r;function r(u){return u===33||u===34||u===39||u===41||u===42||u===44||u===46||u===58||u===59||u===63||u===95||u===126?(e.consume(u),r):u===38?(e.consume(u),l):u===93?(e.consume(u),s):u===60||u===null||xt(u)||il(u)?t(u):n(u)}function s(u){return u===null||u===40||u===91||xt(u)||il(u)?t(u):r(u)}function l(u){return Wn(u)?a(u):n(u)}function a(u){return u===59?(e.consume(u),r):Wn(u)?(e.consume(u),a):n(u)}}function HZ(e,t,n){return r;function r(l){return e.consume(l),s}function s(l){return jn(l)?n(l):t(l)}}function L5(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||xt(e)}function j5(e){return!Wn(e)}function z5(e){return!(e===47||zy(e))}function zy(e){return e===43||e===45||e===46||e===95||jn(e)}function M0(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const FZ={tokenize:YZ,partial:!0};function UZ(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:qZ,continuation:{tokenize:KZ},exit:GZ}},text:{91:{name:"gfmFootnoteCall",tokenize:VZ},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:$Z,resolveTo:WZ}}}}function $Z(e,t,n){const r=this;let s=r.events.length;const l=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a;for(;s--;){const h=r.events[s][1];if(h.type==="labelImage"){a=h;break}if(h.type==="gfmFootnoteCall"||h.type==="labelLink"||h.type==="label"||h.type==="image"||h.type==="link")break}return u;function u(h){if(!a||!a._balanced)return n(h);const d=si(r.sliceSerialize({start:a.end,end:r.now()}));return d.codePointAt(0)!==94||!l.includes(d.slice(1))?n(h):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),t(h))}}function WZ(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},s={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};s.end.column++,s.end.offset++,s.end._bufferIndex++;const l={type:"gfmFootnoteCallString",start:Object.assign({},s.end),end:Object.assign({},e[e.length-1][1].start)},a={type:"chunkString",contentType:"string",start:Object.assign({},l.start),end:Object.assign({},l.end)},u=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",s,t],["exit",s,t],["enter",l,t],["enter",a,t],["exit",a,t],["exit",l,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...u),e}function VZ(e,t,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let l=0,a;return u;function u(m){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),h}function h(m){return m!==94?n(m):(e.enter("gfmFootnoteCallMarker"),e.consume(m),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",d)}function d(m){if(l>999||m===93&&!a||m===null||m===91||xt(m))return n(m);if(m===93){e.exit("chunkString");const _=e.exit("gfmFootnoteCallString");return s.includes(si(r.sliceSerialize(_)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(m)}return xt(m)||(a=!0),l++,e.consume(m),m===92?p:d}function p(m){return m===91||m===92||m===93?(e.consume(m),l++,d):d(m)}}function qZ(e,t,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let l,a=0,u;return h;function h(w){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(w),e.exit("gfmFootnoteDefinitionLabelMarker"),d}function d(w){return w===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(w),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",p):n(w)}function p(w){if(a>999||w===93&&!u||w===null||w===91||xt(w))return n(w);if(w===93){e.exit("chunkString");const S=e.exit("gfmFootnoteDefinitionLabelString");return l=si(r.sliceSerialize(S)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(w),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),_}return xt(w)||(u=!0),a++,e.consume(w),w===92?m:p}function m(w){return w===91||w===92||w===93?(e.consume(w),a++,p):p(w)}function _(w){return w===58?(e.enter("definitionMarker"),e.consume(w),e.exit("definitionMarker"),s.includes(l)||s.push(l),it(e,y,"gfmFootnoteDefinitionWhitespace")):n(w)}function y(w){return t(w)}}function KZ(e,t,n){return e.check(id,t,e.attempt(FZ,t,n))}function GZ(e){e.exit("gfmFootnoteDefinition")}function YZ(e,t,n){const r=this;return it(e,s,"gfmFootnoteDefinitionIndent",5);function s(l){const a=r.events[r.events.length-1];return a&&a[1].type==="gfmFootnoteDefinitionIndent"&&a[2].sliceSerialize(a[1],!0).length===4?t(l):n(l)}}function XZ(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:l,resolveAll:s};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function s(a,u){let h=-1;for(;++h<a.length;)if(a[h][0]==="enter"&&a[h][1].type==="strikethroughSequenceTemporary"&&a[h][1]._close){let d=h;for(;d--;)if(a[d][0]==="exit"&&a[d][1].type==="strikethroughSequenceTemporary"&&a[d][1]._open&&a[h][1].end.offset-a[h][1].start.offset===a[d][1].end.offset-a[d][1].start.offset){a[h][1].type="strikethroughSequence",a[d][1].type="strikethroughSequence";const p={type:"strikethrough",start:Object.assign({},a[d][1].start),end:Object.assign({},a[h][1].end)},m={type:"strikethroughText",start:Object.assign({},a[d][1].end),end:Object.assign({},a[h][1].start)},_=[["enter",p,u],["enter",a[d][1],u],["exit",a[d][1],u],["enter",m,u]],y=u.parser.constructs.insideSpan.null;y&&Cr(_,_.length,0,jp(y,a.slice(d+1,h),u)),Cr(_,_.length,0,[["exit",m,u],["enter",a[h][1],u],["exit",a[h][1],u],["exit",p,u]]),Cr(a,d-1,h-d+3,_),h=d+_.length-2;break}}for(h=-1;++h<a.length;)a[h][1].type==="strikethroughSequenceTemporary"&&(a[h][1].type="data");return a}function l(a,u,h){const d=this.previous,p=this.events;let m=0;return _;function _(w){return d===126&&p[p.length-1][1].type!=="characterEscape"?h(w):(a.enter("strikethroughSequenceTemporary"),y(w))}function y(w){const S=Ea(d);if(w===126)return m>1?h(w):(a.consume(w),m++,y);if(m<2&&!n)return h(w);const C=a.exit("strikethroughSequenceTemporary"),k=Ea(w);return C._open=!k||k===2&&!!S,C._close=!S||S===2&&!!k,u(w)}}}class ZZ{constructor(){this.map=[]}add(t,n,r){QZ(this,t,n,r)}consume(t){if(this.map.sort(function(l,a){return l[0]-a[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let s=r.pop();for(;s;){for(const l of s)t.push(l);s=r.pop()}this.map.length=0}}function QZ(e,t,n,r){let s=0;if(!(n===0&&r.length===0)){for(;s<e.map.length;){if(e.map[s][0]===t){e.map[s][1]+=n,e.map[s][2].push(...r);return}s+=1}e.map.push([t,n,r])}}function JZ(e,t){let n=!1;const r=[];for(;t<e.length;){const s=e[t];if(n){if(s[0]==="enter")s[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(s[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const l=r.length-1;r[l]=r[l]==="left"?"center":"right"}}else if(s[1].type==="tableDelimiterRow")break}else s[0]==="enter"&&s[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function eQ(){return{flow:{null:{name:"table",tokenize:tQ,resolveAll:nQ}}}}function tQ(e,t,n){const r=this;let s=0,l=0,a;return u;function u(z){let U=r.events.length-1;for(;U>-1;){const q=r.events[U][1].type;if(q==="lineEnding"||q==="linePrefix")U--;else break}const H=U>-1?r.events[U][1].type:null,F=H==="tableHead"||H==="tableRow"?A:h;return F===A&&r.parser.lazy[r.now().line]?n(z):F(z)}function h(z){return e.enter("tableHead"),e.enter("tableRow"),d(z)}function d(z){return z===124||(a=!0,l+=1),p(z)}function p(z){return z===null?n(z):je(z)?l>1?(l=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(z),e.exit("lineEnding"),y):n(z):Qe(z)?it(e,p,"whitespace")(z):(l+=1,a&&(a=!1,s+=1),z===124?(e.enter("tableCellDivider"),e.consume(z),e.exit("tableCellDivider"),a=!0,p):(e.enter("data"),m(z)))}function m(z){return z===null||z===124||xt(z)?(e.exit("data"),p(z)):(e.consume(z),z===92?_:m)}function _(z){return z===92||z===124?(e.consume(z),m):m(z)}function y(z){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(z):(e.enter("tableDelimiterRow"),a=!1,Qe(z)?it(e,w,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(z):w(z))}function w(z){return z===45||z===58?C(z):z===124?(a=!0,e.enter("tableCellDivider"),e.consume(z),e.exit("tableCellDivider"),S):j(z)}function S(z){return Qe(z)?it(e,C,"whitespace")(z):C(z)}function C(z){return z===58?(l+=1,a=!0,e.enter("tableDelimiterMarker"),e.consume(z),e.exit("tableDelimiterMarker"),k):z===45?(l+=1,k(z)):z===null||je(z)?N(z):j(z)}function k(z){return z===45?(e.enter("tableDelimiterFiller"),T(z)):j(z)}function T(z){return z===45?(e.consume(z),T):z===58?(a=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(z),e.exit("tableDelimiterMarker"),R):(e.exit("tableDelimiterFiller"),R(z))}function R(z){return Qe(z)?it(e,N,"whitespace")(z):N(z)}function N(z){return z===124?w(z):z===null||je(z)?!a||s!==l?j(z):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(z)):j(z)}function j(z){return n(z)}function A(z){return e.enter("tableRow"),D(z)}function D(z){return z===124?(e.enter("tableCellDivider"),e.consume(z),e.exit("tableCellDivider"),D):z===null||je(z)?(e.exit("tableRow"),t(z)):Qe(z)?it(e,D,"whitespace")(z):(e.enter("data"),B(z))}function B(z){return z===null||z===124||xt(z)?(e.exit("data"),D(z)):(e.consume(z),z===92?K:B)}function K(z){return z===92||z===124?(e.consume(z),B):B(z)}}function nQ(e,t){let n=-1,r=!0,s=0,l=[0,0,0,0],a=[0,0,0,0],u=!1,h=0,d,p,m;const _=new ZZ;for(;++n<e.length;){const y=e[n],w=y[1];y[0]==="enter"?w.type==="tableHead"?(u=!1,h!==0&&(sE(_,t,h,d,p),p=void 0,h=0),d={type:"table",start:Object.assign({},w.start),end:Object.assign({},w.end)},_.add(n,0,[["enter",d,t]])):w.type==="tableRow"||w.type==="tableDelimiterRow"?(r=!0,m=void 0,l=[0,0,0,0],a=[0,n+1,0,0],u&&(u=!1,p={type:"tableBody",start:Object.assign({},w.start),end:Object.assign({},w.end)},_.add(n,0,[["enter",p,t]])),s=w.type==="tableDelimiterRow"?2:p?3:1):s&&(w.type==="data"||w.type==="tableDelimiterMarker"||w.type==="tableDelimiterFiller")?(r=!1,a[2]===0&&(l[1]!==0&&(a[0]=a[1],m=qh(_,t,l,s,void 0,m),l=[0,0,0,0]),a[2]=n)):w.type==="tableCellDivider"&&(r?r=!1:(l[1]!==0&&(a[0]=a[1],m=qh(_,t,l,s,void 0,m)),l=a,a=[l[1],n,0,0])):w.type==="tableHead"?(u=!0,h=n):w.type==="tableRow"||w.type==="tableDelimiterRow"?(h=n,l[1]!==0?(a[0]=a[1],m=qh(_,t,l,s,n,m)):a[1]!==0&&(m=qh(_,t,a,s,n,m)),s=0):s&&(w.type==="data"||w.type==="tableDelimiterMarker"||w.type==="tableDelimiterFiller")&&(a[3]=n)}for(h!==0&&sE(_,t,h,d,p),_.consume(t.events),n=-1;++n<t.events.length;){const y=t.events[n];y[0]==="enter"&&y[1].type==="table"&&(y[1]._align=JZ(t.events,n))}return e}function qh(e,t,n,r,s,l){const a=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",u="tableContent";n[0]!==0&&(l.end=Object.assign({},aa(t.events,n[0])),e.add(n[0],0,[["exit",l,t]]));const h=aa(t.events,n[1]);if(l={type:a,start:Object.assign({},h),end:Object.assign({},h)},e.add(n[1],0,[["enter",l,t]]),n[2]!==0){const d=aa(t.events,n[2]),p=aa(t.events,n[3]),m={type:u,start:Object.assign({},d),end:Object.assign({},p)};if(e.add(n[2],0,[["enter",m,t]]),r!==2){const _=t.events[n[2]],y=t.events[n[3]];if(_[1].end=Object.assign({},y[1].end),_[1].type="chunkText",_[1].contentType="text",n[3]>n[2]+1){const w=n[2]+1,S=n[3]-n[2]-1;e.add(w,S,[])}}e.add(n[3]+1,0,[["exit",m,t]])}return s!==void 0&&(l.end=Object.assign({},aa(t.events,s)),e.add(s,0,[["exit",l,t]]),l=void 0),l}function sE(e,t,n,r,s){const l=[],a=aa(t.events,n);s&&(s.end=Object.assign({},a),l.push(["exit",s,t])),r.end=Object.assign({},a),l.push(["exit",r,t]),e.add(n+1,0,l)}function aa(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const rQ={name:"tasklistCheck",tokenize:sQ};function iQ(){return{text:{91:rQ}}}function sQ(e,t,n){const r=this;return s;function s(h){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(h):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(h),e.exit("taskListCheckMarker"),l)}function l(h){return xt(h)?(e.enter("taskListCheckValueUnchecked"),e.consume(h),e.exit("taskListCheckValueUnchecked"),a):h===88||h===120?(e.enter("taskListCheckValueChecked"),e.consume(h),e.exit("taskListCheckValueChecked"),a):n(h)}function a(h){return h===93?(e.enter("taskListCheckMarker"),e.consume(h),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),u):n(h)}function u(h){return je(h)?t(h):Qe(h)?e.check({tokenize:oQ},t,n)(h):n(h)}}function oQ(e,t,n){return it(e,r,"whitespace");function r(s){return s===null?n(s):t(s)}}function lQ(e){return KA([DZ(),UZ(),XZ(e),eQ(),iQ()])}const aQ={};function ld(e){const t=this,n=e||aQ,r=t.data(),s=r.micromarkExtensions||(r.micromarkExtensions=[]),l=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),a=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);s.push(lQ(n)),l.push(TZ()),a.push(MZ(n))}function cQ({content:e}){return g.jsx("div",{className:"flex gap-2 justify-end",children:g.jsx("div",{className:"max-w-[85%] sm:max-w-[80%] rounded-[20px] py-1.5 px-3.5 bg-muted text-primary border border-border prose prose-sm prose-invert [&_p]:whitespace-pre-line",children:g.jsx(od,{remarkPlugins:[ld],components:Dp(),children:e})})})}function uQ({json:e}){return g.jsx("div",{className:"flex gap-3 justify-start",children:g.jsx("div",{className:"flex-1 max-w-[90%]",children:g.jsx("pre",{className:"text-xs font-mono whitespace-pre-wrap break-words bg-muted rounded-lg p-3 overflow-auto max-h-96",children:e})})})}function P5({title:e,count:t,children:n,badge:r}){const[s,l]=b.useState(!1);return t===0?null:g.jsxs("div",{className:"flex flex-col gap-1.5",children:[g.jsxs("button",{onClick:()=>l(!s),className:"flex items-center gap-1 cursor-pointer group/section hover:opacity-60 transition-opacity",children:[g.jsx(ds,{className:xe("h-3.5 w-3.5 text-muted-foreground transition-transform duration-200",s&&"rotate-90")}),g.jsx("span",{className:"text-muted-foreground font-medium",children:e}),g.jsx("span",{className:"text-muted-foreground/60",children:t}),r]}),s&&g.jsx("div",{className:"ml-5",children:n})]})}function s_({title:e,items:t,icon:n,getIcon:r}){return t.length===0?null:g.jsx(P5,{title:e,count:t.length,children:g.jsx("div",{className:"flex flex-wrap gap-1.5",children:t.map(s=>g.jsx(kA,{icon:r?r(s):n,children:s},s))})})}function dQ(e){const t=e.match(/^mcp__([^_]+)__(.+)$/);return t?{server:t[1],tool:t[2]}:null}function B5({status:e}){const t=e==="connected"?"bg-emerald-500":e==="pending"?"bg-yellow-500":"bg-red-500";return g.jsx("span",{className:xe("inline-block h-2 w-2 rounded-full shrink-0",t)})}function hQ(e){switch(e){case"connected":return"Connected";case"failed":return"Failed";case"needs-auth":return"Needs auth";case"pending":return"Connecting...";case"disabled":return"Disabled";default:return e}}function oE({server:e}){const[t,n]=b.useState(!1),r=e.status==="connected";return g.jsxs("div",{className:"flex flex-col gap-1.5",children:[g.jsxs("button",{onClick:()=>r&&e.tools.length>0&&n(!t),className:xe("flex items-center gap-1.5",r&&e.tools.length>0&&"cursor-pointer hover:opacity-60 transition-opacity"),children:[r&&e.tools.length>0&&g.jsx(ds,{className:xe("h-3 w-3 text-muted-foreground transition-transform duration-200",t&&"rotate-90")}),g.jsx(B5,{status:e.status}),g.jsx("span",{className:"text-muted-foreground font-medium",children:b_(e.name)}),r?g.jsxs("span",{className:"text-muted-foreground/50",children:[e.tools.length," tools"]}):g.jsx("span",{className:"text-muted-foreground/50",children:hQ(e.status)})]}),!r&&e.error&&g.jsx("span",{className:"text-destructive ml-5",children:e.error}),t&&e.tools.length>0&&g.jsx("div",{className:"flex flex-wrap gap-1.5 ml-5",children:e.tools.map(s=>g.jsx(kA,{icon:CA(`mcp__${e.name}__${s}`),children:s},s))})]})}function fQ({servers:e}){if(e.length===0)return null;const t=e.filter(s=>s.status==="connected"),n=e.filter(s=>s.status!=="connected"),r=n.length>0?g.jsxs("span",{className:"flex items-center gap-1 ml-1",children:[g.jsx(B5,{status:"failed"}),g.jsxs("span",{className:"text-muted-foreground/60",children:[n.length," disconnected"]})]}):null;return g.jsx(P5,{title:"MCP Servers",count:e.length,badge:r,children:g.jsxs("div",{className:"flex flex-col gap-2",children:[t.map(s=>g.jsx(oE,{server:s},s.name)),n.map(s=>g.jsx(oE,{server:s},s.name))]})})}function pQ({rawJson:e}){const[t,n]=b.useState(!1);return g.jsxs("div",{className:"flex flex-col gap-1.5",children:[g.jsxs("button",{onClick:()=>n(!t),className:"flex items-center gap-1 cursor-pointer group/section hover:opacity-60 transition-opacity",children:[g.jsx(ds,{className:xe("h-3.5 w-3.5 text-muted-foreground transition-transform duration-200",t&&"rotate-90")}),g.jsx("span",{className:"text-muted-foreground font-medium",children:"Raw Message"})]}),t&&g.jsx("pre",{className:"ml-5 text-xs whitespace-pre-wrap break-all border border-border rounded-md p-3 overflow-x-auto max-h-96 overflow-y-auto",children:e})]})}function mQ({message:e,rawJson:t}){const{coreTools:n,mcpServersWithTools:r}=b.useMemo(()=>{const s=new Map,l=[];for(const u of e.tools){const h=dQ(u);if(h){const d=s.get(h.server)||[];d.push(h.tool),s.set(h.server,d)}else l.push(u)}const a=e.mcpServers.map(u=>({name:u.name,status:u.status,error:u.error,tools:s.get(u.name)||[]}));return{coreTools:l,mcpServersWithTools:a}},[e.tools,e.mcpServers]);return g.jsx(fo,{children:g.jsxs(Np,{expandedContent:g.jsx(Ap,{className:"my-4 text-xs",children:g.jsxs("div",{className:"flex flex-col gap-3",children:[g.jsx(gV,{children:e.model}),g.jsx(s_,{title:"Tools",items:n,getIcon:s=>_y[s]??wA}),g.jsx(s_,{title:"Agents",items:e.agents,icon:cb}),g.jsx(s_,{title:"Commands",items:e.slashCommands,icon:AP}),g.jsx(fQ,{servers:r}),t&&g.jsx(pQ,{rawJson:t})]})}),children:[g.jsx(m6,{className:"h-5 w-5 text-logo"}),g.jsx(ao,{children:"Session Started"})]})})}function gQ({message:e}){return g.jsx(fo,{className:"hidden",children:g.jsxs(Np,{expandedContent:g.jsx(Ap,{className:"my-4 text-xs",children:g.jsx("pre",{className:"font-mono whitespace-pre-wrap break-all bg-muted border border-border rounded-lg p-2 max-h-64 overflow-auto",children:JSON.stringify(e.accountInfo,null,2)})}),children:[g.jsx("div",{className:"size-5 flex justify-center items-center ",children:g.jsx(cb,{className:"h-4 w-4 text-muted-foreground"})}),g.jsx(ao,{children:"Account"})]})})}function vQ({message:e}){return g.jsx("div",{className:"text-pretty prose prose-sm dark:prose-invert px-0.5 w-full max-w-full space-y-4",children:g.jsx(od,{remarkPlugins:[ld],components:Dp(),children:e.text})})}function _Q({question:e,currentIndex:t,totalQuestions:n,onBack:r,children:s}){const l=r&&t>0;return g.jsxs("div",{className:"rounded-2xl border border-border overflow-hidden",children:[g.jsxs("div",{className:"relative",children:[g.jsxs("h3",{className:"font-medium text-foreground text-sm p-3 px-4 bg-card border-b border-border text-foreground flex flex-row items-center gap-2",children:[l?g.jsx("button",{onClick:r,className:" text-muted-foreground hover:opacity-60 transition-all flex items-center",children:g.jsx(E6,{className:"h-4 w-4 -ml-0.5",strokeWidth:3})}):n>1?g.jsxs("span",{className:"font-bold text-muted-foreground whitespace-nowrap",children:[t+1," of ",n]}):null,e]}),n>1&&g.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-border",children:g.jsx("div",{className:"h-full bg-muted-foreground/40 transition-all duration-300",style:{width:`${t/n*100}%`}})})]}),s]})}function lE({label:e,description:t}){return g.jsxs(g.Fragment,{children:[g.jsx("span",{className:"text-foreground text-sm",children:e}),t&&g.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:t})]})}function I5({selected:e,multiSelect:t,onClick:n}){return g.jsx("button",{type:"button",onClick:n,className:xe("flex-shrink-0 w-5 h-5 border-1 flex items-center justify-center",t?"rounded":"rounded-full",e?"border-slate-500/0 bg-foreground":"border-muted-foreground/50 bg-background",n&&e&&"cursor-pointer"),children:e&&g.jsx(so,{strokeWidth:3,className:"translate-y-[0.5px] h-3 w-3 text-white dark:text-background"})})}function yQ({option:e,selected:t,multiSelect:n,onClick:r,isLast:s}){const l="w-full text-left p-3 pt-2.5 pl-4 pr-5 bg-background",a=s?"":"border-b border-border";return r?g.jsx("button",{onClick:r,className:xe(l,a,"transition-all cursor-pointer"),children:g.jsxs("div",{className:"flex items-center justify-between gap-3",children:[g.jsx("div",{className:"flex-1 min-w-0",children:g.jsx(lE,{label:e.label,description:e.description})}),g.jsx(I5,{selected:t,multiSelect:n})]})}):g.jsx("div",{className:xe(l,a),children:g.jsx(lE,{label:e.label,description:e.description})})}function bQ(e){return e==null?void 0:e.answers}function ti(e){return e.id||e.question}function xQ({message:e,onSubmit:t,isLatest:n}){var P,V;const r=e.input.questions,s=!!e.result,l=bQ(e.result),a=((P=e.result)==null?void 0:P.discarded)===!0,[u,h]=b.useState(0),[d,p]=b.useState({}),[m,_]=b.useState({}),[y,w]=b.useState(l??null),[S,C]=b.useState(s),k=(W,Z)=>{var oe;const M=(oe=m[W])==null?void 0:oe.trim(),I=d[W]||"",X=Z||r.find(ae=>ti(ae)===W);if(X!=null&&X.multiSelect)return[I,M].filter(Boolean).flatMap(ae=>ae.split(", ").filter(Boolean));const L=M||I;return L?[L]:[]},T=W=>{const Z=d[ti(W)]||"";return W.multiSelect?Z.split(", ").filter(Boolean):[Z]},R=(W,Z)=>{const M=ti(W);if(W.multiSelect){const I=d[M]?d[M].split(", ").filter(Boolean):[],X=I.includes(Z)?I.filter(L=>L!==Z):[...I,Z];p({...d,[M]:X.join(", ")})}else p({...d,[M]:Z}),_({...m,[M]:""}),u<r.length-1&&setTimeout(()=>h(u+1),150)},N=(W,Z)=>{const M=ti(W);_({...m,[M]:Z}),Z&&!W.multiSelect&&p({...d,[M]:""})},j=W=>{const Z=ti(W);W.multiSelect&&m[Z]&&_({...m,[Z]:""})},A=r.every(W=>k(ti(W),W).length>0),D=r[u],B=u===r.length-1,K=D&&k(ti(D),D).length>0,z=()=>{u<r.length-1&&h(u+1)},U=()=>{u>0&&h(u-1)},H=()=>{if(!A)return;const W={};for(const Z of r){const M=ti(Z);W[M]=k(M,Z)}w(W),C(!0),t(e.toolId,r,W)},F=W=>{if(W.key==="Enter"&&!(!D||!K)){if(W.preventDefault(),B){H();return}z()}};if(S||s){const W=l||y||{};return g.jsx("div",{className:"w-full",children:g.jsxs("div",{className:"rounded-2xl border border-border overflow-hidden",children:[g.jsxs("div",{className:"font-medium text-sm p-3 px-4 pr-5 bg-muted border-b border-border flex flex-row items-center justify-between",children:[g.jsxs("p",{children:["Question",r.length!==1?"s":""]}),g.jsx("p",{className:"",children:a?"Discarded":"Answers"})]}),r.map((Z,M)=>{const I=W[ti(Z)]||W[Z.question]||[],X=M===r.length-1;return g.jsxs("div",{className:xe("w-full p-3 pt-2.5 pl-4 pr-5 bg-background flex items-center justify-between gap-3",!X&&"border-b border-border"),children:[g.jsx("div",{className:"text-sm text-pretty",children:Z.question}),I.length>0&&g.jsx("div",{className:"text-sm font-medium text-right max-w-[50%] text-pretty",children:I.join(", ")}),I.length===0&&g.jsx("div",{className:"text-sm font-medium text-right italic",children:a?"Discarded":"No Response"})]},ti(Z))})]})})}if(!n)return g.jsx("div",{className:"w-full py-2",children:g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(WR,{className:"h-4 w-4 text-muted-foreground"}),g.jsx("span",{className:"text-sm text-muted-foreground",children:"Questions pending (newer question active)"})]})});if(!D)return null;const q=T(D),$=m[ti(D)]||"";return g.jsxs("div",{className:"w-full space-y-3",children:[g.jsxs(_Q,{question:D.question,currentIndex:u,totalQuestions:r.length,onBack:u>0?U:void 0,children:[(V=D.options)==null?void 0:V.map(W=>g.jsx(yQ,{option:W,selected:q.includes(W.label),multiSelect:D.multiSelect,onClick:()=>R(D,W.label)},W.label)),g.jsx("div",{className:"transition-all bg-background",children:g.jsxs("div",{className:"flex pr-5 items-center justify-between gap-3",children:[g.jsx("input",{type:"text",value:$,onChange:W=>N(D,W.target.value),onKeyDown:F,placeholder:"Other...",className:"flex-1 px-3 !py-1 pl-4 min-h-[55px] min-w-0 text-sm bg-transparent outline-none text-foreground placeholder:text-muted-foreground"}),g.jsx(I5,{selected:!!$,multiSelect:D.multiSelect,onClick:D.multiSelect&&$?()=>j(D):void 0})]})})]}),g.jsxs("div",{className:"flex justify-end gap-2 mx-2",children:[!B&&K&&(D.multiSelect||!!$)&&g.jsx(nt,{size:"sm",onClick:z,children:"Next"}),B&&g.jsx(nt,{size:"sm",onClick:H,disabled:!A,className:xe(!A&&"opacity-50 cursor-not-allowed","rounded-full"),children:"Submit"})]})]})}function SQ({message:e,onConfirm:t,isLatest:n}){const r=!!e.result,[s,l]=b.useState(!1),[a,u]=b.useState(!1),[h,d]=b.useState(!1),[p,m]=b.useState(""),_=b.useRef(null),y=e.input;b.useEffect(()=>{h&&_.current&&_.current.focus()},[h]);const w=async()=>{y!=null&&y.plan&&(await navigator.clipboard.writeText(y.plan),u(!0),setTimeout(()=>u(!1),2e3))},S=r?e.result:null,C=(S==null?void 0:S.discarded)===!0;return g.jsxs("div",{className:"flex flex-col gap-3",children:[g.jsxs("div",{className:"relative rounded-2xl border border-border overflow-hidden group/plan",children:[(y==null?void 0:y.plan)&&g.jsx(nt,{variant:"ghost",size:"icon",className:xe("absolute top-2 right-2 z-10 h-8 w-8 rounded-md text-muted-foreground opacity-0 group-hover/plan:opacity-100 transition-opacity",!a&&"hover:text-foreground",a&&"hover:!bg-transparent hover:!border-transparent"),onClick:w,children:a?g.jsx(so,{className:"h-4 w-4 text-green-400"}):g.jsx(ap,{className:"h-4 w-4"})}),g.jsxs("div",{className:xe("!pt-5 !pb-0 px-4 md:py-4.5 md:px-5.5 bg-muted dark:bg-card overflow-scroll no-pre-highlight transition-all",r&&!s?"max-h-[min(400px,40vh)] ":"",r?"hover:!pb-[32px]":""),children:[r&&g.jsxs(nt,{variant:"ghost",className:"absolute z-10 bottom-2 pr-2.5 !pl-3.5 h-[34px] inline-flex gap-1 text-sm left-[50%] -translate-x-[50%] text-muted-foreground backdrop-blur-sm hover:text-foreground opacity-0 group-hover/plan:opacity-100 transition-all rounded-full border border-border",onClick:()=>l(!s),children:[s?"Show Less":"Show More",g.jsx(ib,{className:`size-3.5 transition-transform ${s?"rotate-180":""}`})]}),y!=null&&y.plan?g.jsxs("div",{className:"prose prose-sm dark:prose-invert max-w-none",children:[g.jsx(od,{remarkPlugins:[ld],components:Dp(),children:y.plan}),g.jsx("div",{className:"mt-5"})]}):g.jsx("p",{className:"text-sm text-muted-foreground",children:"No plan provided"})]})]}),r?g.jsx("div",{className:"flex justify-end mx-2",children:g.jsxs("span",{className:"pl-4 inline text-sm font-medium bg-background text-foreground/60 border border-border py-1.5 px-3 rounded-[20px] leading-relaxed max-w-[85%] sm:max-w-[80%]",children:[g.jsx("em",{children:C?"Discarded":S!=null&&S.clearContext?"Approved & Cleared Context":S!=null&&S.confirmed?"Approved":S!=null&&S.message?`Adjusted: "${S.message}"`:"Adjusted Plan"}),g.jsx(H6,{className:"inline h-4 w-4 ml-1.5 -mt-0.5"})]})}):n?g.jsxs("div",{className:"flex flex-col gap-3",children:[!h&&g.jsxs("div",{className:"flex flex-col md:flex-row items-stretch md:items-center justify-end gap-2 mx-2",children:[g.jsxs(nt,{size:"sm",onClick:()=>t(e.toolId,!0,!0),className:"rounded-full bg-primary text-background pr-4 md:order-last",children:[g.jsx(b6,{className:"h-4 w-4 mr-1.5"}),"Approve & Clear"]}),g.jsxs("div",{className:"flex items-stretch md:items-center gap-2 md:contents",children:[g.jsxs(nt,{size:"sm",variant:"outline",onClick:()=>d(!0),className:"rounded-full border-border flex-1 md:flex-initial md:order-first",children:[g.jsx(qR,{className:"h-4 w-4 mr-1.5"}),"Suggest Edits"]}),g.jsxs(nt,{size:"sm",variant:"outline",onClick:()=>t(e.toolId,!0),className:"rounded-full border-border flex-1 md:flex-initial",children:[g.jsx(so,{className:"h-4 w-4 mr-1.5"}),"Approve"]})]})]}),h&&g.jsxs("div",{className:"flex flex-col gap-2",children:[g.jsx("textarea",{ref:_,value:p,onChange:k=>m(k.target.value),onKeyDown:k=>{k.key==="Enter"&&!k.shiftKey&&p.trim()&&(k.preventDefault(),t(e.toolId,!1,void 0,p.trim())),k.key==="Escape"&&(d(!1),m(""))},placeholder:"Describe what you'd like to change...",rows:3,className:"w-full rounded-2xl border border-border bg-muted dark:bg-card px-4 py-3 text-sm text-foreground placeholder:text-muted-foreground resize-none outline-none"}),g.jsxs("div",{className:"flex items-center justify-end gap-2 mx-2",children:[g.jsx(nt,{size:"sm",variant:"ghost",onClick:()=>{d(!1),m("")},className:"rounded-full text-muted-foreground",children:"Cancel"}),g.jsxs(nt,{size:"sm",disabled:!p.trim(),onClick:()=>t(e.toolId,!1,void 0,p.trim()),className:"rounded-full bg-primary text-background disabled:opacity-50 disabled:pointer-events-none",children:[g.jsx(kP,{className:"h-4 w-4 mr-1.5"}),"Adjust Plan"]})]})]})]}):g.jsx("div",{className:"flex justify-end mx-2",children:g.jsx("span",{className:"inline text-sm text-muted-foreground italic",children:"Plan pending (newer prompt active)"})})]})}const wQ={completed:{Icon:so,iconClass:"text-emerald-500",textClass:"text-muted-foreground"},in_progress:{Icon:Ni,iconClass:"text-foreground animate-spin",textClass:"text-foreground font-medium"},pending:{Icon:O6,iconClass:"text-muted-foreground",textClass:"text-muted-foreground"}};function CQ({message:e}){const t=e.input.todos;return t.length?g.jsx("div",{className:"w-full",children:g.jsxs("div",{className:"rounded-2xl border border-border overflow-hidden",children:[g.jsxs("h3",{className:"font-medium text-foreground text-sm p-3 px-4 bg-card border-b border-border flex items-center gap-2",children:[g.jsx(rP,{className:"h-4 w-4 text-muted-foreground"}),"Progress"]}),g.jsx("div",{children:t.map((n,r)=>{const s=r===t.length-1,{Icon:l,iconClass:a,textClass:u}=wQ[n.status];return g.jsxs("div",{className:xe("flex items-center gap-3 px-4 py-2.5 bg-background",!s&&"border-b border-border"),children:[g.jsx(l,{className:xe("h-4 w-4 flex-shrink-0",a)}),g.jsx("span",{className:xe("text-sm",u),children:n.status==="in_progress"?n.activeForm:n.content})]},r)})})]})}):null}function kQ(e){const t=e.split(`
516
+ `),n=/^\s*(\d+)→(.*)$/;return t.map(r=>{const s=r.match(n);return s?{lineNumber:parseInt(s[1],10),content:s[2]}:{lineNumber:null,content:r}})}function EQ(e){return e.replace(/<[^>]+>/g,"")}function RQ(e,t){const n=e.split(`
517
+ `),r=t.split(`
518
+ `),s=TQ(n,r),l=MQ(n,r,s);return NQ(l)}function TQ(e,t){const n=e.length,r=t.length,s=Array.from({length:n+1},()=>Array(r+1).fill(0));for(let l=1;l<=n;l++)for(let a=1;a<=r;a++)s[l][a]=e[l-1]===t[a-1]?s[l-1][a-1]+1:Math.max(s[l-1][a],s[l][a-1]);return s}function MQ(e,t,n){const r=[];let s=e.length,l=t.length;for(;s>0||l>0;)s>0&&l>0&&e[s-1]===t[l-1]?(r.push({type:"context",text:e[s-1],oldIdx:s,newIdx:l}),s--,l--):l>0&&(s===0||n[s][l-1]>=n[s-1][l])?(r.push({type:"added",text:t[l-1],oldIdx:s,newIdx:l}),l--):(r.push({type:"removed",text:e[s-1],oldIdx:s,newIdx:l}),s--);return r.reverse()}function NQ(e){return e.map(t=>{const n=t.type==="removed"?"-":t.type==="added"?"+":" ";return{type:t.type,content:`${n}${t.text}`}})}function o_({content:e,isDiff:t=!1,oldString:n,newString:r}){const s=b.useMemo(()=>t&&n!==void 0&&r!==void 0?RQ(n,r):[],[t,n,r]),l=b.useMemo(()=>t?[]:kQ(e),[e,t]),a=b.useMemo(()=>l.some(u=>u.lineNumber!==null),[l]);return t&&s.length>0?g.jsx("div",{className:"my-1 rounded-lg border border-border overflow-hidden",children:g.jsx("div",{className:"overflow-auto max-h-64 md:max-h-[50vh]",children:g.jsx("table",{className:"w-full border-collapse text-xs font-mono",children:g.jsx("tbody",{children:s.map((u,h)=>{const d=u.type==="removed"?"bg-red-500/10 dark:bg-red-500/15":u.type==="added"?"bg-green-500/10 dark:bg-green-500/15":"",p=u.type==="removed"?"text-red-700 dark:text-red-400":u.type==="added"?"text-green-700 dark:text-green-400":"text-foreground";return g.jsxs("tr",{className:d,children:[g.jsx("td",{className:`px-2 py-0 select-none w-0 whitespace-nowrap ${u.type==="removed"?"text-red-500/50":u.type==="added"?"text-green-500/50":"text-muted-foreground/50"}`,children:u.type==="removed"?"-":u.type==="added"?"+":" "}),g.jsx("td",{className:`px-2 py-0 whitespace-pre select-all ${p}`,children:u.content.slice(1)})]},h)})})})})}):g.jsx("div",{className:"my-1 rounded-lg border border-border overflow-hidden",children:g.jsx("div",{className:"overflow-auto max-h-64 md:max-h-[50vh]",children:g.jsx("table",{className:"w-full border-collapse text-xs font-mono",children:g.jsx("tbody",{children:l.map((u,h)=>g.jsxs("tr",{children:[a&&g.jsx("td",{className:"px-2 py-0 select-none w-0 whitespace-nowrap text-muted-foreground/50 text-right",children:u.lineNumber!==null?u.lineNumber:""}),g.jsx("td",{className:"px-2 py-0 whitespace-pre select-all text-foreground",children:EQ(u.content)})]},h))})})})})}function H5({message:e,isLoading:t=!1,localPath:n}){var w;const r=e.result!==void 0,s=!r&&t,l=b.useMemo(()=>{if(e.toolKind==="skill")return e.input.skill;if(e.toolKind==="glob")return`Search files ${e.input.pattern==="**/*"?"in all directories":`matching ${e.input.pattern}`}`;if(e.toolKind==="grep"){const S=e.input.pattern,C=e.input.outputMode;return C==="count"?`Count \`${S}\` occurrences`:C==="content"?`Find \`${S}\` in text`:`Find \`${S}\` in files`}return e.toolKind==="bash"?e.input.description||(e.input.command?YI(e.input.command):"Bash"):e.toolKind==="web_search"?e.input.query||"Web Search":e.toolKind==="read_file"?`Read ${Pv(e.input.filePath,n)}`:e.toolKind==="write_file"?`Write ${Pv(e.input.filePath,n)}`:e.toolKind==="edit_file"?`Edit ${Pv(e.input.filePath,n)}`:e.toolKind==="mcp_generic"?`${b_(e.input.tool)} from ${b_(e.input.server)}`:e.toolKind==="subagent_task"&&e.input.subagentType||e.toolName},[e.input,e.toolName,n]),a=b.useMemo(()=>e.toolKind==="subagent_task",[e.toolKind]),u=b.useMemo(()=>{if(e.toolKind==="skill")return e.input.skill},[e.input,e.toolKind]),h=e.toolKind==="bash",d=e.toolKind==="write_file",p=e.toolKind==="edit_file",m=e.toolKind==="read_file",_=b.useMemo(()=>{if(typeof e.result=="string")return e.result;if(!e.result)return"";if(typeof e.result=="object"&&e.result!==null&&"content"in e.result){const S=e.result.content;if(typeof S=="string")return S}return JSON.stringify(e.result,null,2)},[e.result]),y=b.useMemo(()=>{switch(e.toolKind){case"bash":return e.input.command;case"write_file":return e.input.content;default:return JSON.stringify(e.input,null,2)}},[e]);return g.jsx(fo,{className:"w-full",children:g.jsxs(Np,{expandedContent:g.jsx(Ap,{className:"my-4 text-sm",children:g.jsxs("div",{className:"flex flex-col gap-2",children:[p?g.jsx(o_,{content:"",isDiff:!0,oldString:e.input.oldString,newString:e.input.newString}):!m&&!d&&g.jsx(dk,{label:h?g.jsxs("span",{className:"flex items-center gap-2 w-full",children:[g.jsx("span",{children:"Command"}),!!e.input.timeoutMs&&g.jsxs("span",{className:"text-muted-foreground",children:["timeout: ",String(e.input.timeoutMs),"ms"]}),!!e.input.runInBackground&&g.jsx("span",{className:"text-muted-foreground",children:"background"})]}):d?"Contents":"Input",copyText:y,children:y}),r&&m&&!e.isError&&g.jsx(o_,{content:_}),d&&!e.isError&&g.jsx(o_,{content:e.input.content}),r&&!m&&!(d&&!e.isError)&&!(p&&!e.isError)&&g.jsx(dk,{label:e.isError?"Error":"Result",copyText:_,children:_})]})}),children:[g.jsx("div",{className:"w-5 h-5 relative flex items-center justify-center",children:(()=>{if(e.isError)return g.jsx(Oa,{className:"size-4 text-destructive"});if(a)return g.jsx(cb,{className:"size-4 text-muted-icon"});const S=CA(e.toolName);return g.jsx(S,{className:"size-4 text-muted-icon"})})()}),g.jsx(ao,{className:"text-left transition-opacity duration-200 truncate",children:g.jsx(yp,{animate:s,shimmerWidth:Math.max(20,(((w=u||l)==null?void 0:w.length)??33)*3),children:u||l})})]})})}function AQ({message:e}){const t=n=>{if(n<1e3)return`${n}ms`;const r=Math.floor(n/1e3),s=Math.floor(r/3600),l=Math.floor(r%3600/60),a=r%60;return s>0?`${s}h${l>0?` ${l}m`:""}`:l>0?`${l}m${a>0?` ${a}s`:""}`:`${a}s`};return e.success?g.jsxs(fo,{className:`px-0.5 text-xs tracking-wide ${e.durationMs>6e4?"":"hidden"}`,children:[g.jsx("div",{className:"w-full h-[1px] bg-border"}),g.jsxs(ao,{className:"whitespace-nowrap text-[11px] tracking-widest text-muted-foreground/60 uppercase flex-shrink-0",children:["Worked for ",t(e.durationMs)]}),g.jsx("div",{className:"w-full h-[1px] bg-border"})]}):g.jsx("div",{className:"px-4 py-3 mx-2 my-1 rounded-lg bg-destructive/10 border border-destructive/20 text-destructive text-sm",children:e.result||"An unknown error occurred."})}function DQ({message:e}){return g.jsx("div",{className:"flex items-center justify-end gap-2 text-sm text-muted-foreground my-3",children:g.jsxs("div",{className:"inline-flex gap-1.5 items-center justify-center whitespace-nowrap text-sm font-medium bg-background text-foreground/60 border border-border h-9 pl-1 pr-4 rounded-full",children:[g.jsx(A6,{className:"h-4 w-4 ml-1.5"}),g.jsx("em",{children:"Interrupted"})]})})}function Qf({size:e=4}){return g.jsxs("svg",{className:"flex-1",viewBox:`0 0 100 ${e}`,preserveAspectRatio:"none",style:{height:`${e}px`},children:[g.jsx("pattern",{id:"zigzag",width:e,height:e,patternUnits:"userSpaceOnUse",children:g.jsx("path",{d:`M0 ${e} L${e/2} 0 L${e} ${e}`,fill:"none",stroke:"currentColor",strokeWidth:"0.5",className:"text-muted-foreground/30",style:{stroke:"currentColor"}})}),g.jsx("rect",{width:"100%",height:e,fill:"url(#zigzag)",className:"text-muted-foreground/30"})]})}function OQ(){return g.jsxs("div",{className:"flex items-center gap-3",children:[g.jsx(Qf,{}),g.jsx("span",{className:"text-[11px] tracking-widest text-muted-foreground uppercase flex-shrink-0",children:"Compacted"}),g.jsx(Qf,{})]})}function LQ(){return g.jsxs("div",{className:"flex items-center gap-3",children:[g.jsx(Qf,{}),g.jsx("span",{className:"text-[11px] tracking-widest text-muted-foreground uppercase flex-shrink-0",children:"Context Cleared"}),g.jsx(Qf,{})]})}function jQ({message:e}){return g.jsx(fo,{children:g.jsxs(Np,{expandedContent:g.jsx(Ap,{className:"my-4 text-xs",children:g.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none",children:g.jsx(od,{remarkPlugins:[ld],components:Dp(),children:e.summary})})}),children:[g.jsx("div",{className:"w-5 h-5 relative flex items-center justify-center",children:g.jsx(VR,{className:"h-4.5 w-4.5 text-muted-foreground"})}),g.jsx(ao,{children:"Summarized"})]})})}const zQ={compacting:"Compacting..."};function PQ({message:e}){const t=zQ[e.status]||e.status;return g.jsxs(fo,{className:"grid grid-cols-[auto_1fr] items-center gap-1.5 text-sm animate-pulse",children:[g.jsx("div",{className:"w-5 h-5 relative flex items-center justify-center",children:g.jsx(VR,{className:"h-4.5 w-4.5 text-muted-foreground"})}),g.jsx(ao,{className:"text-left transition-opacity duration-200 truncate",children:t})]})}const BQ={read_file:{key:"read",singular:"read",plural:"reads"},edit_file:{key:"edit",singular:"edit",plural:"edits"},write_file:{key:"write",singular:"write",plural:"writes"},bash:{key:"bash",singular:"command",plural:"commands"},grep:{key:"grep",singular:"search",plural:"searches"},glob:{key:"glob",singular:"glob",plural:"globs"},subagent_task:{key:"task",singular:"agent",plural:"agents"},web_search:{key:"websearch",singular:"web search",plural:"web searches"},skill:{key:"skill",singular:"skill",plural:"skills"},todo_write:{key:"todo",singular:"todo update",plural:"todo updates"}},IQ={key:"other",singular:"tool call",plural:"tool calls"};function HQ(e){return BQ[e]??IQ}function FQ(e){const t=new Map,n=[];for(const r of e){const s=r.toolKind,l=HQ(s),a=t.get(l.key);a?a.count++:(t.set(l.key,{category:l,count:1}),n.push(l.key))}return n.map(r=>{const{category:s,count:l}=t.get(r);return`${l} ${l===1?s.singular:s.plural}`}).join(", ")}function UQ({messages:e,isLoading:t,localPath:n}){const[r,s]=b.useState(!1),l=b.useMemo(()=>FQ(e),[e]),u=e.some(h=>h.result===void 0)&&t;return g.jsx(fo,{className:"w-full",children:g.jsxs("div",{className:"flex flex-col w-full",children:[g.jsx("button",{onClick:()=>s(!r),className:`group cursor-pointer grid grid-cols-[auto_1fr] items-center gap-1 text-sm ${!r&&!u?"hover:opacity-60 transition-opacity":""}`,children:g.jsxs("div",{className:"grid grid-cols-[auto_1fr] items-center gap-1.5",children:[g.jsx("div",{className:"w-5 h-5 relative flex items-center justify-center",children:g.jsx(ds,{className:`h-4.5 w-4.5 text-muted-icon transition-all duration-200 ${r?"rotate-90":""}`})}),g.jsx(ao,{className:"text-left",children:g.jsx(yp,{animate:u,children:l})})]})}),r&&g.jsxs("div",{className:"my-4 flex flex-col gap-3",children:[e.map(h=>g.jsx(H5,{message:h,isLoading:t,localPath:n},h.id)),e.length>5&&g.jsx("button",{onClick:()=>s(!1),className:"cursor-pointer grid grid-cols-[auto_1fr] items-center gap-1 text-xs hover:opacity-80 transition-opacity",children:g.jsxs("div",{className:"grid grid-cols-[auto_1fr] items-center gap-1.5",children:[g.jsx("div",{className:"w-5 h-5 relative flex items-center justify-center",children:g.jsx(ds,{className:"h-4.5 w-4.5 text-muted-icon -rotate-90"})}),g.jsx(ao,{className:"text-left",children:"Collapse"})]})})]})]})})}const $Q=new Set(["AskUserQuestion","ExitPlanMode","TodoWrite"]);function aE(e){if(e.kind!=="tool")return!1;const t=e.toolName;return!$Q.has(t)}function WQ(e){const t=[];let n=0;for(;n<e.length;){const r=e[n];if(aE(r)){const s=[r],l=n;for(n+=1;n<e.length&&aE(e[n]);)s.push(e[n]),n+=1;s.length>=2?t.push({type:"tool-group",messages:s,startIndex:l}):t.push({type:"single",message:r,index:l});continue}t.push({type:"single",message:r,index:n}),n+=1}return t}function VQ({messages:e,isLoading:t,localPath:n,latestToolIds:r,onOpenLocalLink:s,onAskUserQuestionSubmit:l,onExitPlanModeConfirm:a}){const u=b.useMemo(()=>WQ(e),[e]);function h(d,p){if(d.kind==="user_prompt")return g.jsx(cQ,{content:d.content},d.id);switch(d.kind){case"unknown":return g.jsx(uQ,{json:d.json},d.id);case"system_init":return e.findIndex(_=>_.kind==="system_init")===p?g.jsx(mQ,{message:d,rawJson:d.debugRaw},d.id):null;case"account_info":return e.findIndex(_=>_.kind==="account_info")===p?g.jsx(gQ,{message:d},d.id):null;case"assistant_text":return g.jsx(vQ,{message:d},d.id);case"tool":return d.toolKind==="ask_user_question"?g.jsx(xQ,{message:d,onSubmit:l,isLatest:d.id===r.AskUserQuestion},d.id):d.toolKind==="exit_plan_mode"?g.jsx(SQ,{message:d,onConfirm:a,isLatest:d.id===r.ExitPlanMode},d.id):d.toolKind==="todo_write"?d.id!==r.TodoWrite?null:g.jsx(CQ,{message:d},d.id):g.jsx(H5,{message:d,isLoading:t,localPath:n},d.id);case"result":{const m=e[p+1],_=e[p-1];return(m==null?void 0:m.kind)==="context_cleared"||(_==null?void 0:_.kind)==="context_cleared"?null:g.jsx(AQ,{message:d},d.id)}case"interrupted":return g.jsx(DQ,{message:d},d.id);case"compact_boundary":return g.jsx(OQ,{},d.id);case"context_cleared":return g.jsx(LQ,{},d.id);case"compact_summary":return g.jsx(jQ,{message:d},d.id);case"status":return p===e.length-1?g.jsx(PQ,{message:d},d.id):null}}return g.jsx(pV,{onOpenLocalLink:s,children:u.map(d=>{if(d.type==="tool-group")return g.jsx("div",{className:"group relative",[kf]:"",children:g.jsx(UQ,{messages:d.messages,isLoading:t,localPath:n})},`group-${d.startIndex}`);const p=h(d.message,d.index);return p?g.jsx("div",{id:`msg-${d.message.id}`,className:"group relative",[kf]:"",children:p},d.message.id):null})})}function qQ({rootRef:e,fallbackRef:t,enabled:n,canCancel:r}){b.useEffect(()=>{if(!n)return;let s=0,l=null;const a=m=>{const _=m instanceof Element?m:null,y=e.current,w=t.current;if(gC({trigger:"pointer",activeElement:document.activeElement,pointerStartTarget:l,pointerEndTarget:_,root:y,fallback:w,hasActiveOverlay:mC(document),hasActiveSelection:KP(window.getSelection())})!=="restore"){l=null;return}w==null||w.focus({preventScroll:!0}),l=null},u=m=>{cancelAnimationFrame(s),l=m.target instanceof Element?m.target:null},h=m=>{cancelAnimationFrame(s),s=window.requestAnimationFrame(()=>{a(m.target)})},d=()=>{l=null;const m=t.current;!m||m.disabled||m.focus({preventScroll:!0})},p=m=>{if(m.key!=="Escape")return;const _=t.current;gC({trigger:"escape",activeElement:document.activeElement,fallback:_,hasActiveOverlay:mC(document),canCancel:r,defaultPrevented:m.defaultPrevented})==="escape-focus"&&(m.preventDefault(),_==null||_.focus({preventScroll:!0}))};return window.addEventListener("pointerdown",u,!0),window.addEventListener("pointerup",h,!0),window.addEventListener("keydown",p,!0),window.addEventListener(Cf,d),()=>{cancelAnimationFrame(s),window.removeEventListener("pointerdown",u,!0),window.removeEventListener("pointerup",h,!0),window.removeEventListener("keydown",p,!0),window.removeEventListener(Cf,d)}},[r,n,t,e])}const Kh="What are we building?",KQ=19,GQ=72,YQ=120;function XQ(){var se,J,re,he,ve,Ce;const e=Ky(),t=b.useRef(null),n=b.useRef(null),r=b.useRef(null),[s,l]=b.useState(""),[a,u]=b.useState(!1),[h,d]=b.useState(0),p=((se=e.runtime)==null?void 0:se.projectId)??null,_=Wo(ce=>p?ce.projects[p]:void 0)??MV,w=mf(ce=>p?ce.projects[p]:void 0)??CV,S=Wo(ce=>ce.addTerminal),C=Wo(ce=>ce.removeTerminal),k=Wo(ce=>ce.toggleVisibility),T=Wo(ce=>ce.setMainSizes),R=Wo(ce=>ce.setTerminalSizes),N=mf(ce=>ce.toggleVisibility),j=mf(ce=>ce.setSize),A=Ur(ce=>ce.scrollbackLines),D=Ur(ce=>ce.minColumnWidth),B=e.keybindings,K=b.useMemo(()=>TA(B),[B]),z=_.terminals.length>0,U=!!(p&&_.isVisible&&z),H=!!(p&&z),F=!!(p&&w.isVisible),q=!!p,{isAnimating:$,mainPanelGroupRef:P,terminalFocusRequestVersion:V,terminalPanelRef:W,terminalVisualRef:Z}=HV({showTerminalPane:U,shouldRenderTerminalLayout:H,projectId:p,terminalLayout:_,chatInputRef:r}),{isAnimating:M,panelGroupRef:I,sidebarPanelRef:X,sidebarVisualRef:L}=BV({projectId:p,shouldRenderRightSidebarLayout:q,showRightSidebar:F,rightSidebarSize:w.size});qQ({rootRef:n,fallbackRef:r,enabled:e.hasSelectedProject&&((J=e.runtime)==null?void 0:J.status)!=="waiting_for_user",canCancel:e.canCancel}),b.useEffect(()=>{if(e.messages.length!==0)return;l(""),u(!1);let ce=0;const _e=window.setInterval(()=>{ce+=1,l(Kh.slice(0,ce)),ce>=Kh.length&&(window.clearInterval(_e),u(!0))},KQ);return()=>window.clearInterval(_e)},[e.activeChatId,e.messages.length]),b.useEffect(()=>{function ce(_e){if(p){if(Yc(K,"toggleEmbeddedTerminal",_e)){if(_e.preventDefault(),z){k(p);return}S(p);return}if(Yc(K,"toggleRightSidebar",_e)){_e.preventDefault(),N(p);return}if(Yc(K,"openInFinder",_e)){_e.preventDefault(),e.handleOpenExternal("open_finder");return}if(Yc(K,"openInEditor",_e)){_e.preventDefault(),e.handleOpenExternal("open_editor");return}Yc(K,"addSplitTerminal",_e)&&(_e.preventDefault(),S(p))}}return window.addEventListener("keydown",ce),()=>window.removeEventListener("keydown",ce)},[S,z,p,K,N,k]),b.useEffect(()=>{if(e.messages.length===0)return;const ce=window.requestAnimationFrame(()=>{const _e=e.scrollRef.current;_e&&_e.scrollTo({top:_e.scrollHeight,behavior:"auto"})});return()=>window.cancelAnimationFrame(ce)},[e.messages.length,e.scrollRef]),b.useEffect(()=>{const ce=window.requestAnimationFrame(()=>{e.updateScrollState()}),_e=window.setTimeout(()=>{e.updateScrollState()},ha);return()=>{window.cancelAnimationFrame(ce),window.clearTimeout(_e)}},[H,U,e.updateScrollState]),b.useEffect(()=>{function ce(){e.updateScrollState()}return window.addEventListener("resize",ce),()=>window.removeEventListener("resize",ce)},[e.updateScrollState]),b.useEffect(()=>{const ce=t.current;if(!ce||!H)return;const _e=()=>{const St=ce.getBoundingClientRect().height;if(St<=0)return;const yt=St*(_.mainSizes[1]/100);yt<=0||d($t=>Math.abs($t-yt)<1?$t:yt)},Le=new ResizeObserver(_e);return Le.observe(ce),_e(),()=>Le.disconnect()},[p,H,_.mainSizes]);const oe=ce=>Number.isFinite(ce)?Math.min(yy,Math.max(Op,ce)):w.size,ae=g.jsxs(nN,{ref:n,className:"bg-background h-full flex flex-col overflow-hidden border-0 rounded-none relative",children:[g.jsxs(iN,{className:"flex flex-1 min-h-0 flex-col p-0 overflow-hidden relative",children:[g.jsx(rF,{sidebarCollapsed:e.sidebarCollapsed,onOpenSidebar:e.openSidebar,onExpandSidebar:e.expandSidebar,onNewChat:e.handleCompose,localPath:e.navbarLocalPath,embeddedTerminalVisible:U,onToggleEmbeddedTerminal:p?()=>{if(z){k(p);return}S(p)}:void 0,rightSidebarVisible:F,onToggleRightSidebar:p?()=>N(p):void 0,onOpenExternal:ce=>{e.handleOpenExternal(ce)},editorLabel:e.editorLabel,finderShortcut:K.bindings.openInFinder,editorShortcut:K.bindings.openInEditor,terminalShortcut:K.bindings.toggleEmbeddedTerminal,rightSidebarShortcut:K.bindings.toggleRightSidebar}),g.jsxs(EA,{ref:e.scrollRef,onScroll:e.updateScrollState,className:"flex-1 min-h-0 px-4 scroll-pt-[72px]",children:[e.messages.length===0?g.jsx("div",{style:{height:e.transcriptPaddingBottom},"aria-hidden":"true"}):null,e.messages.length>0?g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"animate-fade-in space-y-5 pt-[72px] max-w-[800px] mx-auto",children:[g.jsx(VQ,{messages:e.messages,isLoading:e.isProcessing,localPath:(re=e.runtime)==null?void 0:re.localPath,latestToolIds:e.latestToolIds,onOpenLocalLink:e.handleOpenLocalLink,onAskUserQuestionSubmit:e.handleAskUserQuestion,onExitPlanModeConfirm:e.handleExitPlanMode}),e.isProcessing?g.jsx(_V,{status:(he=e.runtime)==null?void 0:he.status}):null,e.commandError?g.jsx("div",{className:"text-sm text-destructive border border-destructive/20 bg-destructive/5 rounded-xl px-4 py-3",children:e.commandError}):null]}),g.jsx("div",{style:{height:250},"aria-hidden":"true"})]}):null]}),e.messages.length===0?g.jsx("div",{className:"pointer-events-none absolute inset-x-4 animate-fade-in",style:{top:GQ,bottom:e.transcriptPaddingBottom},children:g.jsx("div",{className:"mx-auto flex h-full max-w-[800px] items-center justify-center",children:g.jsxs("div",{className:"flex flex-col items-center justify-center text-muted-foreground gap-4 opacity-70",children:[g.jsx(fu,{strokeWidth:1.5,className:"size-8 text-muted-foreground kanna-empty-state-flower"}),g.jsx("div",{className:"text-base font-normal text-muted-foreground text-center max-w-xs flex items-center kanna-empty-state-text","aria-label":Kh,children:g.jsxs("span",{className:"relative inline-grid place-items-start",children:[g.jsxs("span",{className:"invisible col-start-1 row-start-1 whitespace-pre flex items-center",children:[g.jsx("span",{children:Kh}),g.jsx("span",{className:"kanna-typewriter-cursor-slot","aria-hidden":"true"})]}),g.jsxs("span",{className:"col-start-1 row-start-1 whitespace-pre flex items-center",children:[g.jsx("span",{children:s}),g.jsx("span",{className:"kanna-typewriter-cursor-slot","aria-hidden":"true",children:g.jsx("span",{className:"kanna-typewriter-cursor","data-typing-complete":a?"true":"false"})})]})]})})]})})},e.activeChatId??"new-chat"):null,g.jsx("div",{style:{bottom:YQ},className:xe("absolute left-1/2 -translate-x-1/2 z-10 transition-all",e.showScrollButton?"scale-100 duration-300 ease-[cubic-bezier(0.34,1.56,0.64,1)]":"scale-60 duration-300 ease-out pointer-events-none blur-sm opacity-0"),children:g.jsx("button",{onClick:e.scrollToBottom,className:"flex items-center transition-colors gap-1.5 px-2 bg-white hover:bg-muted border border-border rounded-full aspect-square cursor-pointer text-sm text-primary hover:text-foreground dark:bg-slate-700 dark:hover:bg-slate-600 dark:text-slate-100 dark:border-slate-600",children:g.jsx(c6,{className:"h-5 w-5"})})})]}),g.jsx("div",{className:"absolute bottom-0 left-0 right-0 z-20 pointer-events-none",children:g.jsx("div",{className:"bg-gradient-to-t from-background via-background pointer-events-auto",ref:e.inputRef,children:g.jsx(JH,{ref:r,onSubmit:e.handleSend,onCancel:()=>{e.handleCancel()},disabled:!e.hasSelectedProject||((ve=e.runtime)==null?void 0:ve.status)==="waiting_for_user",canCancel:e.canCancel,chatId:e.activeChatId,activeProvider:((Ce=e.runtime)==null?void 0:Ce.provider)??null,availableProviders:e.availableProviders},e.activeChatId??"new-chat")})})]});return g.jsx("div",{ref:t,className:"flex-1 flex flex-col min-w-0 relative",children:q&&p?g.jsxs(sf,{groupRef:I,orientation:"horizontal",className:"flex-1 min-h-0",onLayoutChange:ce=>{var Le;if(!F||M.current)return;const _e=oe(ce.rightSidebar);Math.abs(_e-ce.rightSidebar)<.1||(Le=I.current)==null||Le.setLayout({workspace:100-_e,rightSidebar:_e})},onLayoutChanged:ce=>{!F||M.current||j(p,oe(ce.rightSidebar))},children:[g.jsx(Fo,{id:"workspace",defaultSize:`${100-w.size}%`,minSize:"50%",className:"min-h-0 min-w-0",children:H?g.jsxs(sf,{groupRef:P,orientation:"vertical",className:"flex-1 min-h-0",onLayoutChanged:ce=>{!U||$.current||T(p,[ce.chat,ce.terminal])},children:[g.jsx(Fo,{id:"chat",defaultSize:`${_.mainSizes[0]}%`,minSize:"25%",className:"min-h-0",children:ae}),g.jsx(of,{withHandle:!0,orientation:"vertical",className:xe(!U&&"pointer-events-none opacity-0")}),g.jsx(Fo,{id:"terminal",defaultSize:`${_.mainSizes[1]}%`,minSize:"0%",className:"min-h-0",elementRef:W,children:g.jsx("div",{ref:Z,className:"h-full min-h-0 overflow-hidden relative","data-terminal-open":U?"true":"false","data-terminal-animated":"false","data-terminal-visual":!0,style:{"--terminal-toggle-duration":`${ha}ms`},children:g.jsx("div",{style:h>0?{height:`${h}px`}:void 0,children:g.jsx(ck,{projectId:p,layout:_,onAddTerminal:S,socket:e.socket,connectionStatus:e.connectionStatus,scrollback:A,minColumnWidth:D,splitTerminalShortcut:K.bindings.addSplitTerminal,focusRequestVersion:V,onRemoveTerminal:(ce,_e)=>{e.socket.command({type:"terminal.close",terminalId:_e}).catch(()=>{}),C(ce,_e)},onTerminalLayout:R})})})})]},p):ae}),g.jsx(of,{withHandle:!0,orientation:"horizontal",disabled:!F,className:xe(!F&&"pointer-events-none opacity-0")}),g.jsx(Fo,{id:"rightSidebar",defaultSize:`${w.size}%`,maxSize:`${yy}%`,className:"min-h-0 min-w-0",elementRef:X,children:g.jsx("div",{ref:L,className:"h-full min-h-0 overflow-hidden","data-right-sidebar-open":F?"true":"false","data-right-sidebar-animated":"false","data-right-sidebar-visual":!0,style:{"--terminal-toggle-duration":`${ha}ms`},children:g.jsx(iF,{onClose:()=>N(p)})})})]},`${p}-right-sidebar`):H&&p?g.jsxs(sf,{groupRef:P,orientation:"vertical",className:"flex-1 min-h-0",onLayoutChanged:ce=>{!U||$.current||T(p,[ce.chat,ce.terminal])},children:[g.jsx(Fo,{id:"chat",defaultSize:`${_.mainSizes[0]}%`,minSize:"25%",className:"min-h-0",children:ae}),g.jsx(of,{withHandle:!0,orientation:"vertical",className:xe(!U&&"pointer-events-none opacity-0")}),g.jsx(Fo,{id:"terminal",defaultSize:`${_.mainSizes[1]}%`,minSize:"0%",className:"min-h-0",elementRef:W,children:g.jsx("div",{ref:Z,className:"h-full min-h-0 overflow-hidden relative","data-terminal-open":U?"true":"false","data-terminal-animated":"false","data-terminal-visual":!0,style:{"--terminal-toggle-duration":`${ha}ms`},children:g.jsx("div",{style:h>0?{height:`${h}px`}:void 0,children:g.jsx(ck,{projectId:p,layout:_,onAddTerminal:S,socket:e.socket,connectionStatus:e.connectionStatus,scrollback:A,minColumnWidth:D,splitTerminalShortcut:K.bindings.addSplitTerminal,focusRequestVersion:V,onRemoveTerminal:(ce,_e)=>{e.socket.command({type:"terminal.close",terminalId:_e}).catch(()=>{}),C(ce,_e)},onTerminalLayout:R})})})})]},p):ae})}function cE({narrow:e=!1,title:t,subtitle:n,icon:r=sb}){return g.jsxs("div",{className:xe("w-full",e?"max-w-2xl px-6 pt-16 mx-auto":"px-6 pt-16 mb-10"),children:[g.jsxs("div",{className:xe("flex items-center gap-1 mb-2",e&&"justify-center"),children:[g.jsx("div",{className:"p-2 pl-0 rounded-lg",children:g.jsx(r,{className:"h-6 w-6 text-muted-foreground"})}),g.jsx("h1",{className:"text-2xl font-semibold text-foreground",children:t})]}),n&&g.jsx("p",{className:xe("text-muted-foreground",e&&"mb-10 text-center"),children:n})]})}const ZQ={sm:"text-sm px-2.5 py-1",md:"text-sm px-3 py-1.5"};function F5({value:e,onValueChange:t,options:n,size:r="md",className:s,optionClassName:l}){return g.jsx("div",{className:xe("inline-flex items-center rounded-lg border border-border p-[3px] ",s),children:n.map(a=>{const u=a.value===e,h=a.icon,d=h?b.isValidElement(h)?h:(()=>{const m=h;return g.jsx(m,{className:r==="sm"?"h-3.5 w-3.5":"h-4 w-4"})})():null,p=g.jsxs("button",{type:"button",onClick:()=>t(a.value),disabled:a.disabled,"aria-pressed":u,className:xe("rounded-[4px] border transition-colors",h?"grid grid-cols-[auto_auto] items-center gap-2":"inline-flex items-center gap-1.5",ZQ[r],u?"bg-white dark:bg-muted text-slate-900 dark:text-slate-200 border-slate-300 dark:border-white/10 bg-slate-200 ":"border-transparent text-slate-800 hover:text-slate-900 dark:text-muted-foreground dark:hover:text-foreground",a.disabled&&"opacity-50 pointer-events-none",l),children:[d,g.jsx("span",{children:a.label})]},a.value);return a.tooltip?g.jsxs(Nf,{children:[g.jsx(Af,{asChild:!0,children:p}),g.jsx(Ru,{children:a.tooltip})]},a.value):p})})}function QQ(e){return e.toLowerCase().replace(/[\s_]+/g,"-").replace(/[^a-z0-9-]/g,"").replace(/-+/g,"-").replace(/^-|-$/g,"")}function JQ({open:e,onOpenChange:t,onConfirm:n}){const[r,s]=b.useState("new"),[l,a]=b.useState(""),[u,h]=b.useState(""),d=b.useRef(null),p=b.useRef(null);b.useEffect(()=>{e&&(s("new"),a(""),h(""),setTimeout(()=>{var C;return(C=d.current)==null?void 0:C.focus()},0))},[e]),b.useEffect(()=>{e&&setTimeout(()=>{var C,k;r==="new"?(C=d.current)==null||C.focus():(k=p.current)==null||k.focus()},0)},[r,e]);const m=QQ(l),_=m?`${$I}/${m}`:"",y=u.trim(),w=r==="new"?!!m:!!y,S=()=>{if(w){if(r==="new")n({mode:"new",localPath:_,title:l.trim()});else{const C=y.split("/").pop()||y;n({mode:"existing",localPath:y,title:C})}t(!1)}};return g.jsx(YR,{open:e,onOpenChange:t,children:g.jsxs(db,{size:"sm",children:[g.jsxs(QR,{className:"space-y-4",children:[g.jsx(ZR,{children:"Add Project"}),g.jsx(F5,{value:r,onValueChange:s,options:[{value:"new",label:"New Folder"},{value:"existing",label:"Existing Path"}],className:"w-full",optionClassName:"flex-1 justify-center"}),r==="new"?g.jsxs("div",{className:"space-y-2",children:[g.jsx("input",{ref:d,type:"text",value:l,onChange:C=>a(C.target.value),onKeyDown:C=>{C.key==="Enter"&&S(),C.key==="Escape"&&t(!1)},className:"w-full px-3 py-2 text-sm border border-border rounded-md bg-background outline-none",placeholder:"Project name"}),_&&g.jsx("p",{className:"text-xs text-muted-foreground font-mono",children:_})]}):g.jsxs("div",{className:"space-y-2",children:[g.jsx("input",{ref:p,type:"text",value:u,onChange:C=>h(C.target.value),onKeyDown:C=>{C.key==="Enter"&&S(),C.key==="Escape"&&t(!1)},className:"w-full px-3 py-2 text-sm border border-border rounded-md bg-background outline-none",placeholder:"~/Projects/my-app"}),g.jsx("p",{className:"text-xs text-muted-foreground",children:"The folder will be created if it doesn't exist."})]})]}),g.jsxs(JR,{children:[g.jsx(nt,{variant:"ghost",size:"sm",onClick:()=>t(!1),children:"Cancel"}),g.jsx(nt,{variant:"secondary",size:"sm",onClick:S,disabled:!w,children:"Create"})]})]})})}function eJ({text:e}){const[t,n]=b.useState(!1);async function r(){await navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),2e3)}return g.jsx(nt,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:()=>void r(),children:t?g.jsx(so,{className:"h-4 w-4 text-green-400"}):g.jsx(ap,{className:"h-4 w-4"})})}function uE({children:e}){return g.jsxs("div",{className:"grid grid-cols-[1fr_auto] items-center group bg-background border border-border text-foreground rounded-xl p-1.5 pl-3 font-mono text-sm",children:[g.jsxs("pre",{className:"inline-flex items-center gap-2 overflow-x-auto",children:[g.jsx(ds,{className:"inline h-4 w-4 opacity-40"}),g.jsx("code",{children:e})]}),g.jsx(eJ,{text:e})]})}function Gh({children:e}){return g.jsx("div",{className:"bg-card border border-border rounded-2xl p-4",children:e})}function l_({children:e}){return g.jsx("h2",{className:"text-[13px] font-medium text-muted-foreground uppercase tracking-wider mb-3",children:e})}function a_({icon:e,title:t,subtitle:n,iconClassName:r}){return g.jsxs("div",{className:"flex flex-col items-center gap-0",children:[g.jsx("div",{className:"p-3 mb-2 rounded-xl bg-background border border-border",children:g.jsx(e,{className:r||"h-8 w-8 text-muted-foreground"})}),g.jsx("span",{className:"text-sm font-medium",children:t}),g.jsx("span",{className:"text-xs text-muted-foreground",children:n})]})}function dE(){return g.jsx(d6,{className:"h-4 w-4 text-muted-foreground"})}function hE({number:e,title:t,children:n}){return g.jsx("div",{className:"flex gap-4",children:g.jsxs("div",{className:"flex-1 min-w-0",children:[g.jsxs("div",{className:"grid grid-cols-[auto_1fr] items-baseline gap-3",children:[g.jsxs("div",{className:"flex-shrink-0 flex items-center justify-center font-medium text-logo",children:[e,"."]}),g.jsx("h3",{className:"font-medium text-foreground mb-2",children:t})]}),g.jsx("div",{className:"text-muted-foreground text-sm space-y-3",children:n})]})})}function tJ({localPath:e,loading:t,onClick:n}){return g.jsxs(Nf,{children:[g.jsx(Af,{asChild:!0,children:g.jsxs("button",{className:xe("border border-border hover:border-primary/30 group rounded-lg bg-card px-4 py-3 flex items-center gap-3 w-full text-left hover:bg-muted/50 transition-colors",t&&"opacity-50 cursor-not-allowed"),disabled:t,onClick:n,children:[g.jsx(Q6,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),g.jsx("span",{className:"font-medium text-foreground truncate flex-1",children:zT(e)}),t?g.jsx(Ni,{className:"h-4 w-4 text-muted-foreground group-hover:text-primary animate-spin flex-shrink-0"}):g.jsx(lb,{className:"h-4 w-4 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity flex-shrink-0"})]})}),g.jsx(Ru,{children:g.jsx("p",{children:e})})]})}function nJ({connectionStatus:e,ready:t,snapshot:n,startingLocalPath:r,commandError:s,onOpenProject:l,onCreateProject:a}){const[u,h]=b.useState(!1),d=b.useMemo(()=>(n==null?void 0:n.projects)??[],[n==null?void 0:n.projects]),p=e==="connecting"||!t,m=e==="connected"&&t;return g.jsxs("div",{className:"flex-1 flex flex-col min-w-0 bg-background overflow-y-auto",children:[m?g.jsxs(g.Fragment,{children:[g.jsx(cE,{title:(n==null?void 0:n.machine.displayName)??"Local Projects",subtitle:`${Un} is connected, choose a project below to get started.`}),g.jsxs("div",{className:"w-full px-6 mb-10",children:[g.jsxs("div",{className:"flex items-baseline justify-between mb-3",children:[g.jsx("h2",{className:"text-[13px] font-medium text-muted-foreground uppercase tracking-wider",children:"Projects"}),g.jsxs(nt,{variant:"default",size:"sm",onClick:()=>h(!0),children:[g.jsx(ob,{className:"h-4 w-4 mr-1.5"}),"Add Project"]})]}),d.length>0?g.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-4 3xl:grid-cols-5 gap-2",children:d.map(_=>g.jsx(tJ,{localPath:_.localPath,loading:r===_.localPath,onClick:()=>{l(_.localPath)}},_.localPath))}):g.jsx(Gh,{children:g.jsx("p",{className:"text-sm text-muted-foreground",children:"No local projects discovered yet. Open one with Claude or Codex, or create a new project here."})}),s?g.jsx("div",{className:"text-sm text-destructive border border-destructive/20 bg-destructive/5 rounded-xl px-4 py-3 mt-4",children:s}):null]})]}):g.jsxs(g.Fragment,{children:[g.jsx(cE,{narrow:!0,icon:hC,title:p?`Connecting ${Un}`:`Connect ${Un}`,subtitle:p?`${Un} is starting up and loading your local projects.`:`Run ${Un} directly on your machine with full access to your local files and agent project history.`}),g.jsxs("div",{className:"max-w-2xl w-full mx-auto pb-12 px-6",children:[g.jsx(l_,{children:"Status"}),g.jsx("div",{className:"mb-8",children:g.jsx(Gh,{children:g.jsxs("div",{className:"flex items-center gap-3",children:[g.jsx(Ni,{className:"h-4 w-4 text-muted-foreground animate-spin"}),g.jsx("span",{className:"text-sm text-muted-foreground",children:p?`Connecting to your local ${Un} server...`:g.jsxs(g.Fragment,{children:["Not connected. Run ",g.jsx("code",{className:"bg-background border border-border rounded-md mx-0.5 p-1 font-mono text-xs text-foreground",children:Mh()})," from any terminal on this machine."]})})]})})}),p?null:g.jsxs("div",{className:"mb-10",children:[g.jsx(l_,{children:"How it works"}),g.jsx(Gh,{children:g.jsxs("div",{className:"flex items-center justify-around gap-6 py-4 px-2",children:[g.jsx(a_,{icon:ab,title:`${Un} CLI`,subtitle:"On Your Machine"}),g.jsx(dE,{}),g.jsx(a_,{icon:sb,title:`${Un} Server`,subtitle:"Local WebSocket"}),g.jsx(dE,{}),g.jsx(a_,{icon:hC,title:`${Un} UI`,subtitle:"Project Chat"})]})})]}),p?null:g.jsxs("div",{className:"mb-10",children:[g.jsx(l_,{children:"Setup"}),g.jsx(Gh,{children:g.jsxs("div",{className:"space-y-4",children:[g.jsxs(hE,{number:1,title:`Start ${Un}`,children:[g.jsx("p",{children:"Run this command in your terminal:"}),g.jsx(uE,{children:Mh()})]}),g.jsxs(hE,{number:2,title:"Open the local UI",children:[g.jsxs("p",{children:[Un," serves the app locally and opens the Local Projects page in an app-style browser window."]}),g.jsx(uE,{children:"http://localhost:3210/local"})]}),g.jsxs("div",{className:"mt-8",children:[g.jsx("h3",{className:"text-sm font-medium text-muted-foreground uppercase tracking-wider mb-4",children:"Notes"}),g.jsxs("div",{className:"space-y-3 text-sm",children:[g.jsxs("div",{className:"flex gap-4",children:[g.jsx("code",{className:"font-mono text-foreground whitespace-nowrap",children:Mh("").trim()}),g.jsx("span",{className:"text-muted-foreground",children:"Start in the current directory"})]}),g.jsxs("div",{className:"flex gap-4",children:[g.jsx("code",{className:"font-mono text-foreground whitespace-nowrap",children:Mh("--no-open")}),g.jsx("span",{className:"text-muted-foreground",children:"Start the server without opening the browser"})]})]})]})]})})]})]})]}),g.jsx(JQ,{open:u,onOpenChange:h,onConfirm:_=>{a(_)}}),g.jsx("div",{className:"py-4 text-center",children:g.jsxs("span",{className:"text-xs text-muted-foreground/50",children:["v",wb.split("/")[1]]})})]})}function rJ(){const e=Ky();return g.jsx("div",{className:"flex-1 flex flex-col min-w-0 relative",children:g.jsx(nJ,{connectionStatus:e.connectionStatus,ready:e.localProjectsReady,snapshot:e.localProjects,startingLocalPath:e.startingLocalPath,commandError:e.commandError,onOpenProject:e.handleOpenLocalProject,onCreateProject:e.handleCreateProject})})}function fE(e,[t,n]){return Math.min(n,Math.max(t,e))}function iJ(e){const t=b.useRef({value:e,previous:e});return b.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var sJ=[" ","Enter","ArrowUp","ArrowDown"],oJ=[" ","Enter"],sl="Select",[Ip,Hp,lJ]=Lb(sl),[Va]=ms(sl,[lJ,uo]),Fp=uo(),[aJ,mo]=Va(sl),[cJ,uJ]=Va(sl),U5=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:s,onOpenChange:l,value:a,defaultValue:u,onValueChange:h,dir:d,name:p,autoComplete:m,disabled:_,required:y,form:w}=e,S=Fp(t),[C,k]=b.useState(null),[T,R]=b.useState(null),[N,j]=b.useState(!1),A=jb(d),[D,B]=ba({prop:r,defaultProp:s??!1,onChange:l,caller:sl}),[K,z]=ba({prop:a,defaultProp:u,onChange:h,caller:sl}),U=b.useRef(null),H=C?w||!!C.closest("form"):!0,[F,q]=b.useState(new Set),$=Array.from(F).map(P=>P.props.value).join(";");return g.jsx(fp,{...S,children:g.jsxs(aJ,{required:y,scope:t,trigger:C,onTriggerChange:k,valueNode:T,onValueNodeChange:R,valueNodeHasChildren:N,onValueNodeHasChildrenChange:j,contentId:cs(),value:K,onValueChange:z,open:D,onOpenChange:B,dir:A,triggerPointerDownPosRef:U,disabled:_,children:[g.jsx(Ip.Provider,{scope:t,children:g.jsx(cJ,{scope:e.__scopeSelect,onNativeOptionAdd:b.useCallback(P=>{q(V=>new Set(V).add(P))},[]),onNativeOptionRemove:b.useCallback(P=>{q(V=>{const W=new Set(V);return W.delete(P),W})},[]),children:n})}),H?g.jsxs(fD,{"aria-hidden":!0,required:y,tabIndex:-1,name:p,autoComplete:m,value:K,onChange:P=>z(P.target.value),disabled:_,form:w,children:[K===void 0?g.jsx("option",{value:""}):null,Array.from(F)]},$):null]})})};U5.displayName=sl;var $5="SelectTrigger",W5=b.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...s}=e,l=Fp(n),a=mo($5,n),u=a.disabled||r,h=dt(t,a.onTriggerChange),d=Hp(n),p=b.useRef("touch"),[m,_,y]=mD(S=>{const C=d().filter(R=>!R.disabled),k=C.find(R=>R.value===a.value),T=gD(C,S,k);T!==void 0&&a.onValueChange(T.value)}),w=S=>{u||(a.onOpenChange(!0),y()),S&&(a.triggerPointerDownPosRef.current={x:Math.round(S.pageX),y:Math.round(S.pageY)})};return g.jsx(Wu,{asChild:!0,...l,children:g.jsx(Je.button,{type:"button",role:"combobox","aria-controls":a.contentId,"aria-expanded":a.open,"aria-required":a.required,"aria-autocomplete":"none",dir:a.dir,"data-state":a.open?"open":"closed",disabled:u,"data-disabled":u?"":void 0,"data-placeholder":pD(a.value)?"":void 0,...s,ref:h,onClick:Ee(s.onClick,S=>{S.currentTarget.focus(),p.current!=="mouse"&&w(S)}),onPointerDown:Ee(s.onPointerDown,S=>{p.current=S.pointerType;const C=S.target;C.hasPointerCapture(S.pointerId)&&C.releasePointerCapture(S.pointerId),S.button===0&&S.ctrlKey===!1&&S.pointerType==="mouse"&&(w(S),S.preventDefault())}),onKeyDown:Ee(s.onKeyDown,S=>{const C=m.current!=="";!(S.ctrlKey||S.altKey||S.metaKey)&&S.key.length===1&&_(S.key),!(C&&S.key===" ")&&sJ.includes(S.key)&&(w(),S.preventDefault())})})})});W5.displayName=$5;var V5="SelectValue",q5=b.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:s,children:l,placeholder:a="",...u}=e,h=mo(V5,n),{onValueNodeHasChildrenChange:d}=h,p=l!==void 0,m=dt(t,h.onValueNodeChange);return zn(()=>{d(p)},[d,p]),g.jsx(Je.span,{...u,ref:m,style:{pointerEvents:"none"},children:pD(h.value)?g.jsx(g.Fragment,{children:a}):l})});q5.displayName=V5;var dJ="SelectIcon",K5=b.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...s}=e;return g.jsx(Je.span,{"aria-hidden":!0,...s,ref:t,children:r||"▼"})});K5.displayName=dJ;var hJ="SelectPortal",G5=e=>g.jsx(Da,{asChild:!0,...e});G5.displayName=hJ;var ol="SelectContent",Y5=b.forwardRef((e,t)=>{const n=mo(ol,e.__scopeSelect),[r,s]=b.useState();if(zn(()=>{s(new DocumentFragment)},[]),!n.open){const l=r;return l?wi.createPortal(g.jsx(X5,{scope:e.__scopeSelect,children:g.jsx(Ip.Slot,{scope:e.__scopeSelect,children:g.jsx("div",{children:e.children})})}),l):null}return g.jsx(Z5,{...e,ref:t})});Y5.displayName=ol;var ii=10,[X5,go]=Va(ol),fJ="SelectContentImpl",pJ=Xo("SelectContent.RemoveScroll"),Z5=b.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:l,onPointerDownOutside:a,side:u,sideOffset:h,align:d,alignOffset:p,arrowPadding:m,collisionBoundary:_,collisionPadding:y,sticky:w,hideWhenDetached:S,avoidCollisions:C,...k}=e,T=mo(ol,n),[R,N]=b.useState(null),[j,A]=b.useState(null),D=dt(t,J=>N(J)),[B,K]=b.useState(null),[z,U]=b.useState(null),H=Hp(n),[F,q]=b.useState(!1),$=b.useRef(!1);b.useEffect(()=>{if(R)return op(R)},[R]),ip();const P=b.useCallback(J=>{const[re,...he]=H().map(ce=>ce.ref.current),[ve]=he.slice(-1),Ce=document.activeElement;for(const ce of J)if(ce===Ce||(ce==null||ce.scrollIntoView({block:"nearest"}),ce===re&&j&&(j.scrollTop=0),ce===ve&&j&&(j.scrollTop=j.scrollHeight),ce==null||ce.focus(),document.activeElement!==Ce))return},[H,j]),V=b.useCallback(()=>P([B,R]),[P,B,R]);b.useEffect(()=>{F&&V()},[F,V]);const{onOpenChange:W,triggerPointerDownPosRef:Z}=T;b.useEffect(()=>{if(R){let J={x:0,y:0};const re=ve=>{var Ce,ce;J={x:Math.abs(Math.round(ve.pageX)-(((Ce=Z.current)==null?void 0:Ce.x)??0)),y:Math.abs(Math.round(ve.pageY)-(((ce=Z.current)==null?void 0:ce.y)??0))}},he=ve=>{J.x<=10&&J.y<=10?ve.preventDefault():R.contains(ve.target)||W(!1),document.removeEventListener("pointermove",re),Z.current=null};return Z.current!==null&&(document.addEventListener("pointermove",re),document.addEventListener("pointerup",he,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",re),document.removeEventListener("pointerup",he,{capture:!0})}}},[R,W,Z]),b.useEffect(()=>{const J=()=>W(!1);return window.addEventListener("blur",J),window.addEventListener("resize",J),()=>{window.removeEventListener("blur",J),window.removeEventListener("resize",J)}},[W]);const[M,I]=mD(J=>{const re=H().filter(Ce=>!Ce.disabled),he=re.find(Ce=>Ce.ref.current===document.activeElement),ve=gD(re,J,he);ve&&setTimeout(()=>ve.ref.current.focus())}),X=b.useCallback((J,re,he)=>{const ve=!$.current&&!he;(T.value!==void 0&&T.value===re||ve)&&(K(J),ve&&($.current=!0))},[T.value]),L=b.useCallback(()=>R==null?void 0:R.focus(),[R]),oe=b.useCallback((J,re,he)=>{const ve=!$.current&&!he;(T.value!==void 0&&T.value===re||ve)&&U(J)},[T.value]),ae=r==="popper"?Py:Q5,se=ae===Py?{side:u,sideOffset:h,align:d,alignOffset:p,arrowPadding:m,collisionBoundary:_,collisionPadding:y,sticky:w,hideWhenDetached:S,avoidCollisions:C}:{};return g.jsx(X5,{scope:n,content:R,viewport:j,onViewportChange:A,itemRefCallback:X,selectedItem:B,onItemLeave:L,itemTextRefCallback:oe,focusSelectedItem:V,selectedItemText:z,position:r,isPositioned:F,searchRef:M,children:g.jsx(Uu,{as:pJ,allowPinchZoom:!0,children:g.jsx(Fu,{asChild:!0,trapped:T.open,onMountAutoFocus:J=>{J.preventDefault()},onUnmountAutoFocus:Ee(s,J=>{var re;(re=T.trigger)==null||re.focus({preventScroll:!0}),J.preventDefault()}),children:g.jsx(Aa,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:l,onPointerDownOutside:a,onFocusOutside:J=>J.preventDefault(),onDismiss:()=>T.onOpenChange(!1),children:g.jsx(ae,{role:"listbox",id:T.contentId,"data-state":T.open?"open":"closed",dir:T.dir,onContextMenu:J=>J.preventDefault(),...k,...se,onPlaced:()=>q(!0),ref:D,style:{display:"flex",flexDirection:"column",outline:"none",...k.style},onKeyDown:Ee(k.onKeyDown,J=>{const re=J.ctrlKey||J.altKey||J.metaKey;if(J.key==="Tab"&&J.preventDefault(),!re&&J.key.length===1&&I(J.key),["ArrowUp","ArrowDown","Home","End"].includes(J.key)){let ve=H().filter(Ce=>!Ce.disabled).map(Ce=>Ce.ref.current);if(["ArrowUp","End"].includes(J.key)&&(ve=ve.slice().reverse()),["ArrowUp","ArrowDown"].includes(J.key)){const Ce=J.target,ce=ve.indexOf(Ce);ve=ve.slice(ce+1)}setTimeout(()=>P(ve)),J.preventDefault()}})})})})})})});Z5.displayName=fJ;var mJ="SelectItemAlignedPosition",Q5=b.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...s}=e,l=mo(ol,n),a=go(ol,n),[u,h]=b.useState(null),[d,p]=b.useState(null),m=dt(t,D=>p(D)),_=Hp(n),y=b.useRef(!1),w=b.useRef(!0),{viewport:S,selectedItem:C,selectedItemText:k,focusSelectedItem:T}=a,R=b.useCallback(()=>{if(l.trigger&&l.valueNode&&u&&d&&S&&C&&k){const D=l.trigger.getBoundingClientRect(),B=d.getBoundingClientRect(),K=l.valueNode.getBoundingClientRect(),z=k.getBoundingClientRect();if(l.dir!=="rtl"){const Ce=z.left-B.left,ce=K.left-Ce,_e=D.left-ce,Le=D.width+_e,St=Math.max(Le,B.width),yt=window.innerWidth-ii,$t=fE(ce,[ii,Math.max(ii,yt-St)]);u.style.minWidth=Le+"px",u.style.left=$t+"px"}else{const Ce=B.right-z.right,ce=window.innerWidth-K.right-Ce,_e=window.innerWidth-D.right-ce,Le=D.width+_e,St=Math.max(Le,B.width),yt=window.innerWidth-ii,$t=fE(ce,[ii,Math.max(ii,yt-St)]);u.style.minWidth=Le+"px",u.style.right=$t+"px"}const U=_(),H=window.innerHeight-ii*2,F=S.scrollHeight,q=window.getComputedStyle(d),$=parseInt(q.borderTopWidth,10),P=parseInt(q.paddingTop,10),V=parseInt(q.borderBottomWidth,10),W=parseInt(q.paddingBottom,10),Z=$+P+F+W+V,M=Math.min(C.offsetHeight*5,Z),I=window.getComputedStyle(S),X=parseInt(I.paddingTop,10),L=parseInt(I.paddingBottom,10),oe=D.top+D.height/2-ii,ae=H-oe,se=C.offsetHeight/2,J=C.offsetTop+se,re=$+P+J,he=Z-re;if(re<=oe){const Ce=U.length>0&&C===U[U.length-1].ref.current;u.style.bottom="0px";const ce=d.clientHeight-S.offsetTop-S.offsetHeight,_e=Math.max(ae,se+(Ce?L:0)+ce+V),Le=re+_e;u.style.height=Le+"px"}else{const Ce=U.length>0&&C===U[0].ref.current;u.style.top="0px";const _e=Math.max(oe,$+S.offsetTop+(Ce?X:0)+se)+he;u.style.height=_e+"px",S.scrollTop=re-oe+S.offsetTop}u.style.margin=`${ii}px 0`,u.style.minHeight=M+"px",u.style.maxHeight=H+"px",r==null||r(),requestAnimationFrame(()=>y.current=!0)}},[_,l.trigger,l.valueNode,u,d,S,C,k,l.dir,r]);zn(()=>R(),[R]);const[N,j]=b.useState();zn(()=>{d&&j(window.getComputedStyle(d).zIndex)},[d]);const A=b.useCallback(D=>{D&&w.current===!0&&(R(),T==null||T(),w.current=!1)},[R,T]);return g.jsx(vJ,{scope:n,contentWrapper:u,shouldExpandOnScrollRef:y,onScrollButtonChange:A,children:g.jsx("div",{ref:h,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:N},children:g.jsx(Je.div,{...s,ref:m,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});Q5.displayName=mJ;var gJ="SelectPopperPosition",Py=b.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:s=ii,...l}=e,a=Fp(n);return g.jsx(pp,{...a,...l,ref:t,align:r,collisionPadding:s,style:{boxSizing:"border-box",...l.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Py.displayName=gJ;var[vJ,N0]=Va(ol,{}),By="SelectViewport",J5=b.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...s}=e,l=go(By,n),a=N0(By,n),u=dt(t,l.onViewportChange),h=b.useRef(0);return g.jsxs(g.Fragment,{children:[g.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),g.jsx(Ip.Slot,{scope:n,children:g.jsx(Je.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:u,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:Ee(s.onScroll,d=>{const p=d.currentTarget,{contentWrapper:m,shouldExpandOnScrollRef:_}=a;if(_!=null&&_.current&&m){const y=Math.abs(h.current-p.scrollTop);if(y>0){const w=window.innerHeight-ii*2,S=parseFloat(m.style.minHeight),C=parseFloat(m.style.height),k=Math.max(S,C);if(k<w){const T=k+y,R=Math.min(w,T),N=T-R;m.style.height=R+"px",m.style.bottom==="0px"&&(p.scrollTop=N>0?N:0,m.style.justifyContent="flex-end")}}}h.current=p.scrollTop})})})]})});J5.displayName=By;var eD="SelectGroup",[_J,yJ]=Va(eD),tD=b.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=cs();return g.jsx(_J,{scope:n,id:s,children:g.jsx(Je.div,{role:"group","aria-labelledby":s,...r,ref:t})})});tD.displayName=eD;var nD="SelectLabel",rD=b.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=yJ(nD,n);return g.jsx(Je.div,{id:s.id,...r,ref:t})});rD.displayName=nD;var Jf="SelectItem",[bJ,iD]=Va(Jf),sD=b.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:s=!1,textValue:l,...a}=e,u=mo(Jf,n),h=go(Jf,n),d=u.value===r,[p,m]=b.useState(l??""),[_,y]=b.useState(!1),w=dt(t,T=>{var R;return(R=h.itemRefCallback)==null?void 0:R.call(h,T,r,s)}),S=cs(),C=b.useRef("touch"),k=()=>{s||(u.onValueChange(r),u.onOpenChange(!1))};if(r==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return g.jsx(bJ,{scope:n,value:r,disabled:s,textId:S,isSelected:d,onItemTextChange:b.useCallback(T=>{m(R=>R||((T==null?void 0:T.textContent)??"").trim())},[]),children:g.jsx(Ip.ItemSlot,{scope:n,value:r,disabled:s,textValue:p,children:g.jsx(Je.div,{role:"option","aria-labelledby":S,"data-highlighted":_?"":void 0,"aria-selected":d&&_,"data-state":d?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...a,ref:w,onFocus:Ee(a.onFocus,()=>y(!0)),onBlur:Ee(a.onBlur,()=>y(!1)),onClick:Ee(a.onClick,()=>{C.current!=="mouse"&&k()}),onPointerUp:Ee(a.onPointerUp,()=>{C.current==="mouse"&&k()}),onPointerDown:Ee(a.onPointerDown,T=>{C.current=T.pointerType}),onPointerMove:Ee(a.onPointerMove,T=>{var R;C.current=T.pointerType,s?(R=h.onItemLeave)==null||R.call(h):C.current==="mouse"&&T.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Ee(a.onPointerLeave,T=>{var R;T.currentTarget===document.activeElement&&((R=h.onItemLeave)==null||R.call(h))}),onKeyDown:Ee(a.onKeyDown,T=>{var N;((N=h.searchRef)==null?void 0:N.current)!==""&&T.key===" "||(oJ.includes(T.key)&&k(),T.key===" "&&T.preventDefault())})})})})});sD.displayName=Jf;var uu="SelectItemText",oD=b.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:s,...l}=e,a=mo(uu,n),u=go(uu,n),h=iD(uu,n),d=uJ(uu,n),[p,m]=b.useState(null),_=dt(t,k=>m(k),h.onItemTextChange,k=>{var T;return(T=u.itemTextRefCallback)==null?void 0:T.call(u,k,h.value,h.disabled)}),y=p==null?void 0:p.textContent,w=b.useMemo(()=>g.jsx("option",{value:h.value,disabled:h.disabled,children:y},h.value),[h.disabled,h.value,y]),{onNativeOptionAdd:S,onNativeOptionRemove:C}=d;return zn(()=>(S(w),()=>C(w)),[S,C,w]),g.jsxs(g.Fragment,{children:[g.jsx(Je.span,{id:h.textId,...l,ref:_}),h.isSelected&&a.valueNode&&!a.valueNodeHasChildren?wi.createPortal(l.children,a.valueNode):null]})});oD.displayName=uu;var lD="SelectItemIndicator",aD=b.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return iD(lD,n).isSelected?g.jsx(Je.span,{"aria-hidden":!0,...r,ref:t}):null});aD.displayName=lD;var Iy="SelectScrollUpButton",cD=b.forwardRef((e,t)=>{const n=go(Iy,e.__scopeSelect),r=N0(Iy,e.__scopeSelect),[s,l]=b.useState(!1),a=dt(t,r.onScrollButtonChange);return zn(()=>{if(n.viewport&&n.isPositioned){let u=function(){const d=h.scrollTop>0;l(d)};const h=n.viewport;return u(),h.addEventListener("scroll",u),()=>h.removeEventListener("scroll",u)}},[n.viewport,n.isPositioned]),s?g.jsx(dD,{...e,ref:a,onAutoScroll:()=>{const{viewport:u,selectedItem:h}=n;u&&h&&(u.scrollTop=u.scrollTop-h.offsetHeight)}}):null});cD.displayName=Iy;var Hy="SelectScrollDownButton",uD=b.forwardRef((e,t)=>{const n=go(Hy,e.__scopeSelect),r=N0(Hy,e.__scopeSelect),[s,l]=b.useState(!1),a=dt(t,r.onScrollButtonChange);return zn(()=>{if(n.viewport&&n.isPositioned){let u=function(){const d=h.scrollHeight-h.clientHeight,p=Math.ceil(h.scrollTop)<d;l(p)};const h=n.viewport;return u(),h.addEventListener("scroll",u),()=>h.removeEventListener("scroll",u)}},[n.viewport,n.isPositioned]),s?g.jsx(dD,{...e,ref:a,onAutoScroll:()=>{const{viewport:u,selectedItem:h}=n;u&&h&&(u.scrollTop=u.scrollTop+h.offsetHeight)}}):null});uD.displayName=Hy;var dD=b.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...s}=e,l=go("SelectScrollButton",n),a=b.useRef(null),u=Hp(n),h=b.useCallback(()=>{a.current!==null&&(window.clearInterval(a.current),a.current=null)},[]);return b.useEffect(()=>()=>h(),[h]),zn(()=>{var p;const d=u().find(m=>m.ref.current===document.activeElement);(p=d==null?void 0:d.ref.current)==null||p.scrollIntoView({block:"nearest"})},[u]),g.jsx(Je.div,{"aria-hidden":!0,...s,ref:t,style:{flexShrink:0,...s.style},onPointerDown:Ee(s.onPointerDown,()=>{a.current===null&&(a.current=window.setInterval(r,50))}),onPointerMove:Ee(s.onPointerMove,()=>{var d;(d=l.onItemLeave)==null||d.call(l),a.current===null&&(a.current=window.setInterval(r,50))}),onPointerLeave:Ee(s.onPointerLeave,()=>{h()})})}),xJ="SelectSeparator",hD=b.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return g.jsx(Je.div,{"aria-hidden":!0,...r,ref:t})});hD.displayName=xJ;var Fy="SelectArrow",SJ=b.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=Fp(n),l=mo(Fy,n),a=go(Fy,n);return l.open&&a.position==="popper"?g.jsx(mp,{...s,...r,ref:t}):null});SJ.displayName=Fy;var wJ="SelectBubbleInput",fD=b.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{const s=b.useRef(null),l=dt(r,s),a=iJ(t);return b.useEffect(()=>{const u=s.current;if(!u)return;const h=window.HTMLSelectElement.prototype,p=Object.getOwnPropertyDescriptor(h,"value").set;if(a!==t&&p){const m=new Event("change",{bubbles:!0});p.call(u,t),u.dispatchEvent(m)}},[a,t]),g.jsx(Je.select,{...n,style:{...ST,...n.style},ref:l,defaultValue:t})});fD.displayName=wJ;function pD(e){return e===""||e===void 0}function mD(e){const t=li(e),n=b.useRef(""),r=b.useRef(0),s=b.useCallback(a=>{const u=n.current+a;t(u),(function h(d){n.current=d,window.clearTimeout(r.current),d!==""&&(r.current=window.setTimeout(()=>h(""),1e3))})(u)},[t]),l=b.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return b.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,s,l]}function gD(e,t,n){const s=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,l=n?e.indexOf(n):-1;let a=CJ(e,Math.max(l,0));s.length===1&&(a=a.filter(d=>d!==n));const h=a.find(d=>d.textValue.toLowerCase().startsWith(s.toLowerCase()));return h!==n?h:void 0}function CJ(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var kJ=U5,vD=W5,EJ=q5,RJ=K5,TJ=G5,_D=Y5,MJ=J5,NJ=tD,yD=rD,bD=sD,AJ=oD,DJ=aD,xD=cD,SD=uD,wD=hD;const pE=kJ,mE=NJ,gE=EJ,Uy=b.forwardRef(({className:e,children:t,...n},r)=>g.jsxs(vD,{ref:r,className:xe("flex h-9 w-full items-center justify-between gap-2 rounded-lg border border-border bg-background px-3 py-2 text-sm text-foreground outline-none transition-colors","placeholder:text-muted-foreground","focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:ring-offset-background","disabled:cursor-not-allowed disabled:opacity-50","[&>span]:line-clamp-1",e),...n,children:[t,g.jsx(RJ,{asChild:!0,children:g.jsx(ib,{className:"h-4 w-4 shrink-0 opacity-50"})})]}));Uy.displayName=vD.displayName;const CD=b.forwardRef(({className:e,...t},n)=>g.jsx(xD,{ref:n,className:xe("flex cursor-default items-center justify-center py-1",e),...t,children:g.jsx(M6,{className:"h-4 w-4"})}));CD.displayName=xD.displayName;const kD=b.forwardRef(({className:e,...t},n)=>g.jsx(SD,{ref:n,className:xe("flex cursor-default items-center justify-center py-1",e),...t,children:g.jsx(ib,{className:"h-4 w-4"})}));kD.displayName=SD.displayName;const $y=b.forwardRef(({className:e,children:t,position:n="popper",...r},s)=>g.jsx(TJ,{children:g.jsxs(_D,{ref:s,className:xe("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-lg border border-border bg-background text-foreground shadow-md","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95","data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...r,children:[g.jsx(CD,{}),g.jsx(MJ,{className:xe("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),g.jsx(kD,{})]})}));$y.displayName=_D.displayName;const OJ=b.forwardRef(({className:e,...t},n)=>g.jsx(yD,{ref:n,className:xe("px-2 py-1.5 text-sm font-semibold",e),...t}));OJ.displayName=yD.displayName;const vf=b.forwardRef(({className:e,children:t,...n},r)=>g.jsxs(bD,{ref:r,className:xe("relative flex w-full cursor-default select-none items-center rounded-md py-1.5 pl-2 pr-8 text-sm outline-none","focus:bg-accent focus:text-accent-foreground","data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[g.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:g.jsx(DJ,{children:g.jsx(so,{className:"h-4 w-4"})})}),g.jsx(AJ,{children:t})]}));vf.displayName=bD.displayName;const LJ=b.forwardRef(({className:e,...t},n)=>g.jsx(wD,{ref:n,className:xe("-mx-1 my-1 h-px bg-border",e),...t}));LJ.displayName=wD.displayName;const _f=[{id:"general",label:"General",icon:MP,subtitle:"Manage appearance, editor behavior, and embedded terminal defaults."},{id:"providers",label:"Providers",icon:dP,subtitle:"Manage the default chat provider and saved model defaults for Claude Code and Codex."},{id:"keybindings",label:"Keybindings",icon:P6,subtitle:"Edit global app shortcuts stored in the active keybindings file."},{id:"changelog",label:"Changelog",icon:v6,subtitle:"Release notes pulled from the public GitHub releases feed."}];function vE(e){return e&&_f.some(t=>t.id===e)?e:null}const jJ=[{value:"light",label:"Light",icon:PP},{value:"dark",label:"Dark",icon:mP},{value:"system",label:"System",icon:sb}],zJ=[{value:"cursor",label:"Cursor"},{value:"vscode",label:"VS Code"},{value:"windsurf",label:"Windsurf"},{value:"custom",label:"Custom"}],PJ="https://api.github.com/repos/jakemor/kanna/releases",BJ=300*1e3;let fa=null;const _E=Object.keys(RA);function IJ(e){return`Edit global app shortcuts stored in ${e}.`}async function HJ(e=fetch){const t=await e(PJ,{headers:{Accept:"application/vnd.github+json"}});if(!t.ok)throw new Error(`GitHub releases request failed with status ${t.status}`);return(await t.json()).filter(r=>!r.draft)}function FJ(){return fa?Date.now()>=fa.expiresAt?(fa=null,null):fa.releases:null}function UJ(e){fa={releases:e,expiresAt:Date.now()+BJ}}async function yE(e){const t=e!=null&&e.force?null:FJ();if(t)return t;const n=await HJ(e==null?void 0:e.fetchImpl);return UJ(n),n}function $J(e){if(!e)return"Unpublished";const t=new Date(e);return Number.isNaN(t.getTime())?"Unknown date":new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",year:"numeric"}).format(t)}function WJ({status:e,releases:t,error:n,onRetry:r}){return g.jsxs("div",{className:"space-y-4",children:[e==="loading"||e==="idle"?g.jsx("div",{className:"flex min-h-[180px] items-center justify-center rounded-2xl border border-border bg-card/40 px-6 py-8 text-sm text-muted-foreground",children:g.jsxs("div",{className:"flex items-center gap-3",children:[g.jsx(Ni,{className:"h-4 w-4 animate-spin"}),g.jsx("span",{children:"Loading release notes…"})]})}):null,e==="error"?g.jsx("div",{className:"rounded-2xl border border-destructive/20 bg-destructive/5 px-6 py-5",children:g.jsxs("div",{className:"flex items-start justify-between gap-4",children:[g.jsxs("div",{children:[g.jsx("div",{className:"text-sm font-medium text-foreground",children:"Could not load changelog"}),g.jsx("div",{className:"mt-1 text-sm text-muted-foreground",children:n??"Unable to load changelog."})]}),g.jsx("button",{type:"button",onClick:r,className:"rounded-lg border border-border bg-background px-3 py-2 text-sm text-foreground transition-colors hover:bg-muted",children:"Retry"})]})}):null,e==="success"&&t.length===0?g.jsxs("div",{className:"rounded-2xl border border-border bg-card/30 px-6 py-8",children:[g.jsx("div",{className:"text-sm font-medium text-foreground",children:"No releases yet"}),g.jsx("div",{className:"mt-2 text-sm text-muted-foreground",children:"GitHub did not return any published releases for this repository."})]}):null,e==="success"&&t.length>0?t.map(s=>{var l,a;return g.jsxs("article",{className:"rounded-xl border border-border bg-card/30 pl-6 pr-4 py-4",children:[g.jsxs("div",{className:"flex flex-row items-center min-w-0 flex-1 gap-3 ",children:[g.jsxs("div",{className:"flex flex-row items-center min-w-0 flex-1 gap-3 ",children:[g.jsx("div",{className:"text-lg font-semibold tracking-[-0.2px] text-foreground",children:((l=s.name)==null?void 0:l.trim())||s.tag_name}),g.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[g.jsx("span",{children:$J(s.published_at)}),s.prerelease?g.jsx("span",{className:"rounded-full border border-border px-2.5 py-1 uppercase tracking-wide",children:"Prerelease"}):null]})]}),g.jsxs("div",{className:"flex flex-row items-center justify-end min-w-0 flex-1 gap-3 ",children:[g.jsx("div",{className:"flex min-w-0 flex-wrap items-center gap-2 text-xs text-muted-foreground",children:g.jsx("span",{className:"rounded-full bg-muted px-2.5 py-1 font-mono text-foreground/80",children:s.tag_name})}),g.jsx("a",{href:s.html_url,target:"_blank",rel:"noopener noreferrer","aria-label":"View release on GitHub",className:xe(hu({variant:"ghost",size:"icon-sm"}),"h-8 w-8 shrink-0 rounded-md"),children:g.jsx(VJ,{className:"h-4 w-4"})})]})]}),(a=s.body)!=null&&a.trim()?g.jsx("div",{className:"prose prose-sm mt-5 max-w-none text-foreground dark:prose-invert",children:g.jsx(od,{remarkPlugins:[ld],components:d0,children:s.body})}):g.jsx("div",{className:"mt-5 text-sm text-muted-foreground",children:"No release notes were provided."})]},s.id)}):null]})}function VJ({className:e}){return g.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",className:e,children:g.jsx("path",{d:"M12 .5C5.649.5.5 5.649.5 12A11.5 11.5 0 0 0 8.36 22.04c.575.106.785-.25.785-.556 0-.274-.01-1-.015-1.962-3.181.691-3.853-1.532-3.853-1.532-.52-1.322-1.27-1.674-1.27-1.674-1.038-.71.08-.695.08-.695 1.148.08 1.752 1.178 1.752 1.178 1.02 1.748 2.676 1.243 3.328.95.103-.738.399-1.243.725-1.53-2.54-.289-5.211-1.27-5.211-5.65 0-1.248.446-2.27 1.177-3.07-.118-.288-.51-1.45.112-3.024 0 0 .96-.307 3.145 1.173A10.91 10.91 0 0 1 12 6.03c.973.004 1.954.132 2.87.387 2.182-1.48 3.14-1.173 3.14-1.173.625 1.573.233 2.736.115 3.024.734.8 1.175 1.822 1.175 3.07 0 4.39-2.676 5.358-5.224 5.642.41.353.776 1.05.776 2.117 0 1.528-.014 2.761-.014 3.136 0 .309.207.668.79.555A11.502 11.502 0 0 0 23.5 12C23.5 5.649 18.351.5 12 .5Z"})})}function ss({title:e,description:t,children:n,bordered:r=!0,alignStart:s=!1}){return g.jsx("div",{className:r?"border-t border-border":void 0,children:g.jsxs("div",{className:`flex justify-between gap-8 py-5 ${s?"items-start":"items-center"}`,children:[g.jsxs("div",{className:"min-w-0 max-w-xl",children:[g.jsx("div",{className:"text-sm font-medium text-foreground",children:e}),g.jsx("div",{className:"mt-1 text-[13px] text-muted-foreground",children:t})]}),g.jsx("div",{className:"flex shrink-0 items-center justify-end",children:n})]})})}function qJ(){var un,cr;const e=Na(),{sectionId:t}=IE(),n=Ky(),{theme:r,setTheme:s}=_A(),[l,a]=b.useState("idle"),[u,h]=b.useState([]),[d,p]=b.useState(null),m=vE(t)??"general",_=n.connectionStatus==="connecting"||!n.localProjectsReady,y=((un=n.localProjects)==null?void 0:un.machine.displayName)??"Unavailable",w=((cr=n.localProjects)==null?void 0:cr.projects.length)??0,S=wb.split("/")[1]??"unknown",C=Ur(pe=>pe.scrollbackLines),k=Ur(pe=>pe.minColumnWidth),T=Ur(pe=>pe.editorPreset),R=Ur(pe=>pe.editorCommandTemplate),N=Ur(pe=>pe.setScrollbackLines),j=Ur(pe=>pe.setMinColumnWidth),A=Ur(pe=>pe.setEditorPreset),D=Ur(pe=>pe.setEditorCommandTemplate),B=n.keybindings,K=ls(pe=>pe.defaultProvider),z=ls(pe=>pe.providerDefaults),U=ls(pe=>pe.setDefaultProvider),H=ls(pe=>pe.setProviderDefaultModel),F=ls(pe=>pe.setProviderDefaultModelOptions),q=ls(pe=>pe.setProviderDefaultPlanMode),$=b.useMemo(()=>TA(B),[B]),P=$.filePathDisplay||KI(),[V,W]=b.useState(String(C)),[Z,M]=b.useState(String(k)),[I,X]=b.useState(R),[L,oe]=b.useState({}),[ae,se]=b.useState(null),J=n.updateSnapshot,re=(J==null?void 0:J.status)==="checking"?"Checking for updates…":(J==null?void 0:J.status)==="updating"?"Installing update…":(J==null?void 0:J.status)==="restart_pending"?"Restarting Kanna…":(J==null?void 0:J.status)==="available"?`Update available${J.latestVersion?`: ${J.latestVersion}`:""}`:(J==null?void 0:J.status)==="up_to_date"?"Up to date":(J==null?void 0:J.status)==="error"?"Update check failed":"Not checked yet";b.useEffect(()=>{W(String(C))},[C]),b.useEffect(()=>{M(String(k))},[k]),b.useEffect(()=>{X(R)},[R]),b.useEffect(()=>{oe(Object.fromEntries(_E.map(pe=>[pe,Bv($.bindings[pe])])))},[$]),b.useEffect(()=>{t&&(vE(t)||e("/settings/general",{replace:!0}))},[e,t]),b.useEffect(()=>{if(m!=="changelog"||_)return;let pe=!1;return a("loading"),p(null),yE().then(Ge=>{pe||(h(Ge),a("success"))}).catch(Ge=>{pe||(p(Ge instanceof Error?Ge.message:"Unable to load changelog."),a("error"))}),()=>{pe=!0}},[_,m]);function he(){const pe=Number(V);if(!Number.isFinite(pe)){W(String(C));return}N(pe)}function ve(){const pe=Number(Z);if(!Number.isFinite(pe)){M(String(k));return}j(pe)}function Ce(pe,Ge){pe.key==="Enter"&&(Ge(),pe.currentTarget.blur())}function ce(pe,Ge){pe.key==="Enter"&&(Ge(),pe.currentTarget.blur())}function _e(){D(I)}async function Le(){try{se(null),await n.socket.command({type:"settings.writeKeybindings",bindings:bE(L)})}catch(pe){se(pe instanceof Error?pe.message:"Unable to save keybindings.")}}async function St(pe){const Ge={...L,[pe]:Bv(eo[pe])};oe(Ge);try{se(null),await n.socket.command({type:"settings.writeKeybindings",bindings:bE(Ge)})}catch(ur){se(ur instanceof Error?ur.message:"Unable to save keybindings.")}}function yt(){fa=null,a("loading"),p(null),yE({force:!0}).then(pe=>{h(pe),a("success")}).catch(pe=>{p(pe instanceof Error?pe.message:"Unable to load changelog."),a("error")})}const $t=I.replaceAll("{path}","/Users/jake/Projects/kanna/src/client/app/App.tsx").replaceAll("{line}","12").replaceAll("{column}","1"),Gn=_f.find(pe=>pe.id===m)??_f[0],Jt=m==="keybindings"?IJ(P):Gn.subtitle,Wt=!_;return g.jsxs("div",{className:"relative flex h-full flex-1 min-w-0 bg-background",children:[g.jsxs("div",{className:"flex min-w-0 flex-1",children:[g.jsx("aside",{className:`hidden w-[200px] shrink-0 md:block ${Wt?"pb-[89px]":""}`,children:g.jsxs("div",{className:"flex flex-col gap-1 px-4 py-6",children:[g.jsx("div",{className:"px-3 pb-5 text-[22px] font-extrabold tracking-[-0.5px] text-foreground",children:"Settings"}),_f.map(pe=>g.jsx("button",{type:"button",onClick:()=>e(`/settings/${pe.id}`),className:`cursor-pointer rounded-lg px-3 py-2 text-sm ${pe.id===m?"bg-muted font-medium text-foreground":"text-muted-foreground hover:bg-muted/50 hover:text-foreground"}`,children:g.jsxs("div",{className:"flex items-center gap-2.5",children:[g.jsx(pe.icon,{className:"h-4 w-4 shrink-0"}),g.jsx("span",{children:pe.label})]})},pe.label))]})}),g.jsx("div",{className:"min-w-0 flex-1 overflow-y-auto",children:g.jsxs("div",{className:"w-full px-6 pt-16 pb-32",children:[_?g.jsx("div",{className:"flex min-h-[240px] items-center justify-center rounded-2xl border border-border bg-card/40 px-4 py-6 text-sm text-muted-foreground",children:g.jsxs("div",{className:"flex items-center gap-3",children:[g.jsx(Ni,{className:"h-4 w-4 animate-spin"}),g.jsx("span",{children:"Loading machine settings…"})]})}):g.jsxs("div",{className:"mx-auto max-w-4xl",children:[g.jsxs("div",{className:"pb-6",children:[g.jsxs("div",{className:"flex items-center justify-between gap-4",children:[g.jsx("div",{className:"text-lg font-semibold tracking-[-0.2px] text-foreground",children:Gn.label}),m==="keybindings"?g.jsxs("button",{type:"button",onClick:()=>{n.handleOpenExternalPath("open_editor",P)},className:xe(hu({variant:"outline",size:"sm"}),"gap-2 rounded-lg"),children:[g.jsx(FR,{className:"h-4 w-4"}),g.jsxs("span",{children:["Open in ",n.editorLabel]})]}):null,m==="general"?g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsxs("button",{type:"button",onClick:()=>{n.handleCheckForUpdates({force:!0})},disabled:(J==null?void 0:J.status)==="checking"||(J==null?void 0:J.status)==="updating",className:xe(hu({variant:"outline",size:"sm"}),"gap-2 rounded-lg"),children:[g.jsx(SP,{className:`h-4 w-4 ${(J==null?void 0:J.status)==="checking"?"animate-spin":""}`}),g.jsx("span",{children:"Check for updates"})]}),J!=null&&J.updateAvailable?g.jsx("button",{type:"button",onClick:()=>{n.handleInstallUpdate()},disabled:J.status==="updating"||J.status==="restart_pending",className:xe(hu({variant:"default",size:"sm"}),"rounded-lg"),children:"Update now"}):null]}):null]}),g.jsx("div",{className:"mt-1 text-sm text-muted-foreground",children:Jt})]}),m==="general"?g.jsx(g.Fragment,{children:g.jsxs("div",{className:"border-b border-border",children:[g.jsx(ss,{title:"Application Update",description:g.jsxs(g.Fragment,{children:[g.jsxs("span",{children:[re,"."]}),J!=null&&J.lastCheckedAt?g.jsxs("span",{children:[" Last checked ",new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}).format(J.lastCheckedAt),"."]}):null,J!=null&&J.error?g.jsxs("span",{children:[" ",J.error]}):null]}),bordered:!1,children:g.jsxs("div",{className:"text-right text-sm text-foreground",children:[g.jsxs("div",{children:["Current: ",(J==null?void 0:J.currentVersion)??S]}),g.jsxs("div",{className:"text-xs text-muted-foreground",children:["Latest: ",(J==null?void 0:J.latestVersion)??"Unknown"]})]})}),g.jsx(ss,{title:"Theme",description:"Choose between light, dark, or system appearance",children:g.jsx(F5,{value:r,onValueChange:s,options:jJ,size:"sm"})}),g.jsx(ss,{title:"Default Editor",description:"Used by the navbar code button and local file links in chat",alignStart:!0,children:g.jsxs(pE,{value:T,onValueChange:pe=>A(pe),children:[g.jsx(Uy,{className:"min-w-[180px]",children:g.jsx(gE,{})}),g.jsx($y,{children:g.jsx(mE,{children:zJ.map(pe=>g.jsx(vf,{value:pe.value,children:pe.label},pe.value))})})]})}),T==="custom"?g.jsx("div",{className:"border-t border-border",children:g.jsxs("div",{className:"flex justify-between gap-8 py-5 pl-6",children:[g.jsxs("div",{className:"min-w-0 max-w-xl",children:[g.jsx("div",{className:"text-sm font-medium text-foreground",children:"Command Template"}),g.jsxs("div",{className:"mt-1 text-[13px] text-muted-foreground",children:["Include ","{path}"," and optionally ","{line}"," and ","{column}"," in your command."]})]}),g.jsxs("div",{className:"flex min-w-0 max-w-[420px] flex-1 flex-col items-stretch gap-2",children:[g.jsx("input",{type:"text",value:I,onChange:pe=>X(pe.target.value),onBlur:_e,onKeyDown:pe=>ce(pe,_e),className:"w-full rounded-lg border border-border bg-background px-3 py-2 font-mono text-sm text-foreground outline-none"}),g.jsxs("div",{className:"text-xs text-muted-foreground",children:["Preview: ",g.jsx("span",{className:"font-mono",children:$t})]})]})]})}):null,g.jsx(ss,{title:"Terminal Scrollback",description:"Lines retained for embedded terminal history",children:g.jsxs("div",{className:"flex min-w-0 flex-col items-end gap-2",children:[g.jsx("input",{type:"number",min:by,max:xy,step:100,value:V,onChange:pe=>W(pe.target.value),onBlur:he,onKeyDown:pe=>Ce(pe,he),className:"hide-number-steppers w-28 rounded-lg border border-border bg-background px-3 py-2 text-right font-mono text-sm text-foreground outline-none"}),g.jsxs("div",{className:"text-right text-xs text-muted-foreground",children:[by,"-",xy," lines",C===qf?" (default)":""]})]})}),g.jsx(ss,{title:"Terminal Min Column Width",description:"Minimum width for each terminal pane",children:g.jsxs("div",{className:"flex min-w-0 flex-col items-end gap-2",children:[g.jsx("input",{type:"number",min:Sy,max:wy,step:10,value:Z,onChange:pe=>M(pe.target.value),onBlur:ve,onKeyDown:pe=>Ce(pe,ve),className:"hide-number-steppers w-28 rounded-lg border border-border bg-background px-3 py-2 text-right font-mono text-sm text-foreground outline-none"}),g.jsxs("div",{className:"text-right text-xs text-muted-foreground",children:[Sy,"-",wy," px",k===Kf?" (default)":""]})]})})]})}):m==="providers"?g.jsxs("div",{className:"border-b border-border",children:[g.jsx(ss,{title:"Default Provider",description:"The default harness used for new chats before a provider is locked by an existing session.",bordered:!1,children:g.jsxs(pE,{value:K,onValueChange:pe=>U(pe),children:[g.jsx(Uy,{className:"min-w-[180px]",children:g.jsx(gE,{})}),g.jsx($y,{children:g.jsxs(mE,{children:[g.jsx(vf,{value:"last_used",children:"Last Used"}),nf.map(pe=>g.jsx(vf,{value:pe.id,children:pe.label},pe.id))]})})]})}),g.jsx(ss,{title:"Claude Code Defaults",description:"Saved defaults when using Claude Code.",alignStart:!0,children:g.jsx("div",{className:"max-w-[420px]",children:g.jsx(D_,{availableProviders:nf,selectedProvider:"claude",showProviderPicker:!1,providerLocked:!0,model:z.claude.model,modelOptions:z.claude.modelOptions,onModelChange:(pe,Ge)=>{H("claude",Ge)},onClaudeReasoningEffortChange:pe=>{F("claude",{reasoningEffort:pe})},onCodexReasoningEffortChange:()=>{},onCodexFastModeChange:()=>{},planMode:z.claude.planMode,onPlanModeChange:pe=>q("claude",pe),includePlanMode:!0,className:"justify-start flex-wrap"})})}),g.jsx(ss,{title:"Codex Defaults",description:"Saved defaults when using Codex.",alignStart:!0,children:g.jsx("div",{className:"max-w-[420px]",children:g.jsx(D_,{availableProviders:nf,selectedProvider:"codex",showProviderPicker:!1,providerLocked:!0,model:z.codex.model,modelOptions:z.codex.modelOptions,onModelChange:(pe,Ge)=>{H("codex",Ge)},onClaudeReasoningEffortChange:()=>{},onCodexReasoningEffortChange:pe=>{F("codex",{reasoningEffort:pe})},onCodexFastModeChange:pe=>{F("codex",{fastMode:pe})},planMode:z.codex.planMode,onPlanModeChange:pe=>q("codex",pe),includePlanMode:!0,className:"justify-start flex-wrap"})})})]}):m==="keybindings"?g.jsxs("div",{className:"border-b border-border",children:[ae?g.jsx("div",{className:"mb-4 rounded-2xl border border-destructive/20 bg-destructive/5 px-4 py-3 text-sm text-destructive",children:ae}):null,$.warning?g.jsx("div",{className:"mb-4 rounded-2xl border border-border bg-card/30 px-4 py-3 text-sm text-muted-foreground",children:$.warning}):null,_E.map((pe,Ge)=>{const ur=Bv(eo[pe]),ue=L[pe]??"",ye=ue!==ur;return g.jsx(ss,{title:RA[pe],description:g.jsxs(g.Fragment,{children:[g.jsx("span",{children:"Comma-separated shortcuts."}),ye?g.jsxs(g.Fragment,{children:[g.jsx("span",{children:" "}),g.jsxs("button",{type:"button",onClick:()=>{St(pe)},className:"inline rounded text-foreground hover:text-foreground/80",children:["Restore: ",ur]})]}):null]}),bordered:Ge!==0,alignStart:!0,children:g.jsx("div",{className:"flex min-w-0 max-w-[420px] flex-1 flex-col items-stretch gap-2",children:g.jsx("input",{type:"text",value:ue,onChange:Ae=>{const Be=Ae.target.value;oe(Ye=>({...Ye,[pe]:Be}))},onBlur:()=>{Le()},onKeyDown:Ae=>ce(Ae,()=>{Le()}),className:"w-full rounded-lg border border-border bg-background px-3 py-2 font-mono text-sm text-foreground outline-none"})})},pe)})]}):g.jsx(WJ,{status:l,releases:u,error:d,onRetry:yt})]}),n.commandError?g.jsxs("div",{className:"mx-auto mt-4 flex max-w-4xl items-start gap-3 rounded-2xl border border-destructive/20 bg-destructive/5 px-4 py-3 text-sm text-destructive",children:[g.jsx(tP,{className:"mt-0.5 h-4 w-4 flex-shrink-0"}),g.jsx("span",{children:n.commandError})]}):null]})})]}),Wt?g.jsx("div",{className:"absolute bottom-0 left-0 right-0 border-t border-border bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/80",children:g.jsx("div",{className:"px-6 py-[14.25px]",children:g.jsxs("div",{className:"grid gap-3 text-xs text-muted-foreground sm:grid-cols-2 lg:grid-cols-4",children:[g.jsxs("div",{children:[g.jsx("div",{className:"mb-1 uppercase tracking-wide text-[11px] text-muted-foreground/80",children:"Machine"}),g.jsx("div",{className:"text-foreground/80",children:y})]}),g.jsxs("div",{children:[g.jsx("div",{className:"mb-1 uppercase tracking-wide text-[11px] text-muted-foreground/80",children:"Connection"}),g.jsx("div",{className:"text-foreground/80",children:n.connectionStatus})]}),g.jsxs("div",{children:[g.jsx("div",{className:"mb-1 uppercase tracking-wide text-[11px] text-muted-foreground/80",children:"Projects Indexed"}),g.jsx("div",{className:"text-foreground/80",children:w})]}),g.jsxs("div",{children:[g.jsx("div",{className:"mb-1 uppercase tracking-wide text-[11px] text-muted-foreground/80",children:"App Version"}),g.jsx("div",{className:"text-foreground/80",children:S})]})]})})}):null]})}function bE(e){return{toggleEmbeddedTerminal:Gc(e.toggleEmbeddedTerminal??""),toggleRightSidebar:Gc(e.toggleRightSidebar??""),openInFinder:Gc(e.openInFinder??""),openInEditor:Gc(e.openInEditor??""),addSplitTerminal:Gc(e.addSplitTerminal??"")}}function Yh(e){return!e||typeof e!="object"||Array.isArray(e)?null:e}function KJ(e){if(typeof e!="string")return e;try{return JSON.parse(e)}catch{return e}}function GJ(e,t){const n=KJ(t);switch(e.toolKind){case"ask_user_question":{const s=Yh(n),l=Yh(s==null?void 0:s.answers)??(s||{});return{answers:Object.fromEntries(Object.entries(l).map(([a,u])=>Array.isArray(u)?[a,u.map(h=>String(h))]:u&&typeof u=="object"&&Array.isArray(u.answers)?[a,u.answers.map(h=>String(h))]:u==null||u===""?[a,[]]:[a,[String(u)]])),...(s==null?void 0:s.discarded)===!0?{discarded:!0}:{}}}case"exit_plan_mode":{const s=Yh(n);return{confirmed:typeof(s==null?void 0:s.confirmed)=="boolean"?s.confirmed:void 0,clearContext:typeof(s==null?void 0:s.clearContext)=="boolean"?s.clearContext:void 0,message:typeof(s==null?void 0:s.message)=="string"?s.message:void 0,...(s==null?void 0:s.discarded)===!0?{discarded:!0}:{}}}case"read_file":if(typeof n=="string")return n;const r=Yh(n);return{content:typeof(r==null?void 0:r.content)=="string"?r.content:JSON.stringify(n,null,2)};default:return n}}function ED(e){return new Date(e).toISOString()}function ni(e){return{id:e._id,messageId:e.messageId,timestamp:ED(e.createdAt),hidden:e.hidden}}function YJ(e){return{id:e._id,messageId:e.messageId,hidden:e.hidden,kind:"tool",toolKind:e.tool.toolKind,toolName:e.tool.toolName,toolId:e.tool.toolId,input:e.tool.input,timestamp:ED(e.createdAt)}}function XJ(e){if(e.debugRaw)try{return JSON.parse(e.debugRaw).tool_use_result}catch{return}}function ZJ(e){const t=new Map,n=[];for(const r of e)switch(r.kind){case"user_prompt":n.push({...ni(r),kind:"user_prompt",content:r.content});break;case"system_init":n.push({...ni(r),kind:"system_init",provider:r.provider,model:r.model,tools:r.tools,agents:r.agents,slashCommands:r.slashCommands,mcpServers:r.mcpServers,debugRaw:r.debugRaw});break;case"account_info":n.push({...ni(r),kind:"account_info",accountInfo:r.accountInfo});break;case"assistant_text":n.push({...ni(r),kind:"assistant_text",text:r.text});break;case"tool_call":{const s=YJ(r);t.set(r.tool.toolId,{hydrated:s,normalized:r.tool}),n.push(s);break}case"tool_result":{const s=t.get(r.toolId);if(s){const l=s.normalized.toolKind==="ask_user_question"||s.normalized.toolKind==="exit_plan_mode"?XJ(r)??r.content:r.content;s.hydrated.result=GJ(s.normalized,l),s.hydrated.rawResult=l,s.hydrated.isError=r.isError}break}case"result":n.push({...ni(r),kind:"result",success:!r.isError,cancelled:r.subtype==="cancelled",result:r.result,durationMs:r.durationMs,costUsd:r.costUsd});break;case"status":n.push({...ni(r),kind:"status",status:r.status});break;case"compact_boundary":n.push({...ni(r),kind:"compact_boundary"});break;case"compact_summary":n.push({...ni(r),kind:"compact_summary",summary:r.summary});break;case"context_cleared":n.push({...ni(r),kind:"context_cleared"});break;case"interrupted":n.push({...ni(r),kind:"interrupted"});break;default:n.push({...ni(r),kind:"unknown",json:JSON.stringify(r,null,2)});break}return n}const QJ=["AskUserQuestion","ExitPlanMode","TodoWrite"],JJ=new Set(["TodoWrite"]);function eee(e,t){for(let n=e.length-1;n>=0;n-=1){const r=e[n];if(r.kind!=="tool")continue;const s=r;if(s.toolName===t&&!s.result)return s.id}return null}function tee(e,t){for(let n=e.length-1;n>=0;n-=1){const r=e[n];if(r.kind!=="tool")continue;const s=r;if(s.toolName===t)return s.id}return null}function nee(e){const t={};for(const n of QJ)t[n]=JJ.has(n)?tee(e,n):eee(e,n);return t}function ree(e){return e==="starting"||e==="running"||e==="waiting_for_user"}function iee(e){return e==="starting"||e==="running"||e==="waiting_for_user"}const see=25e3,oee=15e3,lee=4e3;class aee{constructor(t){rn(this,"url");rn(this,"ws",null);rn(this,"started",!1);rn(this,"reconnectTimer",null);rn(this,"reconnectDelayMs",750);rn(this,"subscriptions",new Map);rn(this,"pending",new Map);rn(this,"outboundQueue",[]);rn(this,"statusListeners",new Set);rn(this,"heartbeatTimer",null);rn(this,"pingTimeoutTimer",null);rn(this,"pingPromise",null);rn(this,"lastOpenAt",0);rn(this,"lastMessageAt",0);rn(this,"reconnectImmediatelyOnClose",!1);rn(this,"handleWindowFocus",()=>{this.ensureHealthyConnection()});rn(this,"handleVisibilityChange",()=>{if(document.visibilityState==="visible"){this.startHeartbeat(),this.ensureHealthyConnection();return}this.stopHeartbeat()});rn(this,"handleOnline",()=>{this.ensureHealthyConnection()});this.url=t}start(){this.started||(this.started=!0,window.addEventListener("focus",this.handleWindowFocus),window.addEventListener("online",this.handleOnline),document.addEventListener("visibilitychange",this.handleVisibilityChange),this.connect())}dispose(){var t;this.started=!1,this.reconnectTimer&&(window.clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.stopHeartbeat(),this.clearPingState(),window.removeEventListener("focus",this.handleWindowFocus),window.removeEventListener("online",this.handleOnline),document.removeEventListener("visibilitychange",this.handleVisibilityChange),(t=this.ws)==null||t.close(),this.ws=null;for(const n of this.pending.values())n.reject(new Error("Socket disposed"));this.pending.clear()}onStatus(t){return this.statusListeners.add(t),t(this.getStatus()),()=>{this.statusListeners.delete(t)}}subscribe(t,n,r){const s=crypto.randomUUID();return this.subscriptions.set(s,{topic:t,listener:n,eventListener:r}),this.enqueue({v:1,type:"subscribe",id:s,topic:t}),()=>{this.subscriptions.delete(s),this.enqueue({v:1,type:"unsubscribe",id:s})}}subscribeTerminal(t,n){const r=crypto.randomUUID(),s={type:"terminal",terminalId:t};return this.subscriptions.set(r,{topic:s,listener:n.onSnapshot,eventListener:n.onEvent}),this.enqueue({v:1,type:"subscribe",id:r,topic:s}),()=>{this.subscriptions.delete(r),this.enqueue({v:1,type:"unsubscribe",id:r})}}command(t){const n=crypto.randomUUID(),r={v:1,type:"command",id:n,command:t};return new Promise((s,l)=>{this.pending.set(n,{resolve:s,reject:l}),this.enqueue(r)})}ensureHealthyConnection(){return!this.ws||this.ws.readyState===WebSocket.CLOSED||this.ws.readyState===WebSocket.CLOSING?(this.reconnectNow(),Promise.resolve()):this.ws.readyState===WebSocket.CONNECTING||!this.isConnectionStale()?Promise.resolve():this.sendPing()}connect(){this.started&&(this.emitStatus("connecting"),this.ws=new WebSocket(this.url),this.ws.addEventListener("open",()=>{this.reconnectDelayMs=750,this.reconnectImmediatelyOnClose=!1,this.lastOpenAt=Date.now(),this.lastMessageAt=this.lastOpenAt,this.emitStatus("connected"),this.startHeartbeat();for(const[t,n]of this.subscriptions.entries())this.sendNow({v:1,type:"subscribe",id:t,topic:n.topic});for(;this.outboundQueue.length>0;){const t=this.outboundQueue.shift();t&&this.sendNow(t)}}),this.ws.addEventListener("message",t=>{var r;this.lastMessageAt=Date.now();let n;try{n=JSON.parse(String(t.data))}catch{return}if(n.type==="snapshot"){const s=this.subscriptions.get(n.id);s==null||s.listener(n.snapshot.data);return}if(n.type==="event"){const s=this.subscriptions.get(n.id);(r=s==null?void 0:s.eventListener)==null||r.call(s,n.event);return}if(n.type==="ack"){const s=this.pending.get(n.id);if(!s)return;this.pending.delete(n.id),s.resolve(n.result);return}if(n.type==="error"){if(!n.id){console.error(UI,n.message);return}const s=this.pending.get(n.id);if(!s)return;this.pending.delete(n.id),s.reject(new Error(n.message))}}),this.ws.addEventListener("close",()=>{if(!this.started)return;const t=this.reconnectImmediatelyOnClose;this.reconnectImmediatelyOnClose=!1,this.stopHeartbeat(),this.clearPingState(),this.emitStatus("disconnected");for(const n of this.pending.values())n.reject(new Error("Disconnected"));if(this.pending.clear(),t){this.connect();return}this.scheduleReconnect()}))}scheduleReconnect(){this.reconnectTimer===null&&(this.reconnectTimer=window.setTimeout(()=>{this.reconnectTimer=null,this.connect(),this.reconnectDelayMs=Math.min(this.reconnectDelayMs*2,5e3)},this.reconnectDelayMs))}getStatus(){var t,n;return((t=this.ws)==null?void 0:t.readyState)===WebSocket.OPEN?"connected":((n=this.ws)==null?void 0:n.readyState)===WebSocket.CONNECTING?"connecting":"disconnected"}emitStatus(t){for(const n of this.statusListeners)n(t)}isConnectionStale(){const t=Math.max(this.lastMessageAt,this.lastOpenAt);return t>0&&Date.now()-t>=see}sendPing(){if(this.pingPromise)return this.pingPromise;const t=this.command({type:"system.ping"}).then(()=>{this.clearPingState()}).catch(n=>{throw this.clearPingState(),this.reconnectNow(),n});return this.pingTimeoutTimer=window.setTimeout(()=>{this.clearPingState(),this.reconnectNow()},lee),this.pingPromise=t,t}reconnectNow(){if(this.reconnectTimer!==null&&(window.clearTimeout(this.reconnectTimer),this.reconnectTimer=null),!this.ws||this.ws.readyState===WebSocket.CLOSED){this.connect();return}this.ws.readyState!==WebSocket.CONNECTING&&(this.reconnectImmediatelyOnClose=!0,this.ws.close())}startHeartbeat(){document.visibilityState==="visible"&&this.heartbeatTimer===null&&(this.heartbeatTimer=window.setInterval(()=>{var t;if(document.visibilityState!=="visible"){this.stopHeartbeat();return}((t=this.ws)==null?void 0:t.readyState)===WebSocket.OPEN&&this.ensureHealthyConnection()},oee))}stopHeartbeat(){this.heartbeatTimer!==null&&(window.clearInterval(this.heartbeatTimer),this.heartbeatTimer=null)}clearPingState(){this.pingTimeoutTimer!==null&&(window.clearTimeout(this.pingTimeoutTimer),this.pingTimeoutTimer=null),this.pingPromise=null}enqueue(t){var n;if(((n=this.ws)==null?void 0:n.readyState)===WebSocket.OPEN){this.sendNow(t);return}this.outboundQueue.push(t)}sendNow(t){var n;(n=this.ws)==null||n.send(JSON.stringify(t))}}function cee(e,t){var r;const n=e.find(s=>s.chats.some(l=>l.chatId===t));return n?((r=n.chats.find(s=>s.chatId!==t))==null?void 0:r.chatId)??null:null}function uee(){return`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws`}function dee(){const e=b.useRef(null);return e.current||(e.current=new aee(uee())),b.useEffect(()=>{const t=e.current;return t==null||t.start(),()=>{t==null||t.dispose()}},[]),e.current}function du(e,t){if(t===void 0){console.info(`[useKannaState] ${e}`);return}console.info(`[useKannaState] ${e}`,t)}function hee(e){return e<120}const fee=320;function pee(e){const t=e.selectedProjectId??e.sidebarProjectId??null;return t?{kind:"project_id",projectId:t}:e.fallbackLocalProjectPath?{kind:"local_path",localPath:e.fallbackLocalProjectPath}:null}function mee(e,t){return!e||!t?null:e.runtime.chatId!==t?(du("stale snapshot masked",{routeChatId:t,snapshotChatId:e.runtime.chatId,snapshotProvider:e.runtime.provider}),null):e}function gee(e){var Sn,pl,ji;const t=Na(),n=dee(),r=JP(),[s,l]=b.useState({projectGroups:[]}),[a,u]=b.useState(null),[h,d]=b.useState(null),[p,m]=b.useState(null),[_,y]=b.useState(null),[w,S]=b.useState("connecting"),[C,k]=b.useState(!1),[T,R]=b.useState(!1),[N,j]=b.useState(!1),[A,D]=b.useState(null),[B,K]=b.useState(!1),[z,U]=b.useState(!1),[H,F]=b.useState(148),[q,$]=b.useState(!0),[P,V]=b.useState(null),[W,Z]=b.useState(null),[M,I]=b.useState(null),X=NV(Ur(le=>le.editorPreset)),L=b.useRef(null),oe=b.useRef(null);b.useEffect(()=>n.onStatus(S),[n]),b.useEffect(()=>n.subscribe({type:"sidebar"},le=>{l(le),k(!0),V(null)}),[n]),b.useEffect(()=>n.subscribe({type:"local-projects"},le=>{u(le),R(!0),V(null)}),[n]),b.useEffect(()=>n.subscribe({type:"update"},le=>{d(le),V(null)}),[n]),b.useEffect(()=>{w==="connected"&&n.command({type:"update.check",force:!0}).catch(le=>{V(le instanceof Error?le.message:String(le))})},[w,n]),b.useEffect(()=>{function le(){h!=null&&h.lastCheckedAt&&(Date.now()-h.lastCheckedAt<=3600*1e3||n.command({type:"update.check"}).catch(Se=>{V(Se instanceof Error?Se.message:String(Se))}))}return window.addEventListener("focus",le),()=>{window.removeEventListener("focus",le)}},[n,h==null?void 0:h.lastCheckedAt]),b.useEffect(()=>n.subscribe({type:"keybindings"},le=>{y(le),V(null)}),[n]),b.useEffect(()=>{if(!e){du("clearing chat snapshot for non-chat route"),m(null),j(!0);return}return du("subscribing to chat",{activeChatId:e}),m(null),j(!1),n.subscribe({type:"chat",chatId:e},le=>{du("chat snapshot received",{activeChatId:e,snapshotChatId:(le==null?void 0:le.runtime.chatId)??null,snapshotProvider:(le==null?void 0:le.runtime.provider)??null,snapshotStatus:(le==null?void 0:le.runtime.status)??null}),m(le),j(!0),V(null)})},[e,n]),b.useEffect(()=>{if(A)return;const le=s.projectGroups[0];le&&D(le.groupKey)},[A,s.projectGroups]),b.useEffect(()=>{if(!e||!C||!N)return;if(s.projectGroups.some(Se=>Se.chats.some(Pe=>Pe.chatId===e))){M===e&&I(null);return}M!==e&&t("/")},[e,N,t,M,s.projectGroups,C]),b.useEffect(()=>{p&&(D(p.runtime.projectId),M===p.runtime.chatId&&I(null))},[p,M]),b.useLayoutEffect(()=>{const le=oe.current;if(!le)return;const Se=new ResizeObserver(()=>{F(le.getBoundingClientRect().height)});return Se.observe(le),F(le.getBoundingClientRect().height),()=>Se.disconnect()},[]);const ae=b.useMemo(()=>mee(p,e),[e,p]);b.useEffect(()=>{du("active snapshot resolved",{routeChatId:e,rawSnapshotChatId:(p==null?void 0:p.runtime.chatId)??null,rawSnapshotProvider:(p==null?void 0:p.runtime.provider)??null,activeSnapshotChatId:(ae==null?void 0:ae.runtime.chatId)??null,activeSnapshotProvider:(ae==null?void 0:ae.runtime.provider)??null,pendingChatId:M})},[e,ae,p,M]);const se=b.useMemo(()=>ZJ((ae==null?void 0:ae.messages)??[]),[ae==null?void 0:ae.messages]),J=b.useMemo(()=>nee(se),[se]),re=(ae==null?void 0:ae.runtime)??null,he=(ae==null?void 0:ae.availableProviders)??nf,ve=iee(re==null?void 0:re.status),Ce=ree(re==null?void 0:re.status),ce=fee,_e=!q&&se.length>0,Le=((Sn=a==null?void 0:a.projects[0])==null?void 0:Sn.localPath)??null,St=(re==null?void 0:re.localPath)??Le??((pl=s.projectGroups[0])==null?void 0:pl.localPath),yt=!!(A??(re==null?void 0:re.projectId)??((ji=s.projectGroups[0])==null?void 0:ji.groupKey)??Le);b.useEffect(()=>{const le=L.current;if(!le)return;const Se=le.scrollHeight-le.scrollTop-le.clientHeight;hee(Se)&&le.scrollTo({top:le.scrollHeight,behavior:"smooth"})},[e,H,se.length,re==null?void 0:re.status]);function $t(){const le=L.current;if(!le)return;const Se=le.scrollHeight-le.scrollTop-le.clientHeight;$(Se<24)}function Gn(){const le=L.current;le&&le.scrollTo({top:le.scrollHeight,behavior:"smooth"})}async function Jt(le){ls.getState().initializeComposerForNewChat();const Se=await n.command({type:"chat.create",projectId:le});D(le),I(Se.chatId),t(`/chat/${Se.chatId}`),K(!1),V(null)}async function Wt(le){return le.kind==="project_id"?{projectId:le.projectId}:le.kind==="local_path"?{projectId:(await n.command({type:"project.open",localPath:le.localPath})).projectId,localPath:le.localPath}:{projectId:(await n.command(le.project.mode==="new"?{type:"project.create",localPath:le.project.localPath,title:le.project.title}:{type:"project.open",localPath:le.project.localPath})).projectId,localPath:le.project.localPath}}async function un(le){try{const Se=le.kind==="project_id"?null:le.kind==="local_path"?le.localPath:le.project.localPath;Se&&Z(Se);const{projectId:Pe}=await Wt(le);await Jt(Pe)}catch(Se){V(Se instanceof Error?Se.message:String(Se))}finally{Z(null)}}async function cr(le){await un({kind:"project_id",projectId:le})}async function pe(le){await un({kind:"local_path",localPath:le})}async function Ge(le){await un({kind:"project_request",project:le})}async function ur(le){try{await n.command({type:"update.check",force:le==null?void 0:le.force}),V(null)}catch(Se){V(Se instanceof Error?Se.message:String(Se))}}async function ue(){try{const le=await n.command({type:"update.install"});if(le.ok&&le.action==="reload"){window.location.reload();return}V(null)}catch(le){V(le instanceof Error?le.message:String(le))}}async function ye(le,Se){var Pe;try{let We=A??((Pe=s.projectGroups[0])==null?void 0:Pe.groupKey)??null;if(!e&&!We&&Le&&(We=(await n.command({type:"project.open",localPath:Le})).projectId,D(We)),!e&&!We)throw new Error("Open a project first");const ot=await n.command({type:"chat.send",chatId:e??void 0,projectId:e?void 0:We??void 0,provider:Se==null?void 0:Se.provider,content:le,model:Se==null?void 0:Se.model,modelOptions:Se==null?void 0:Se.modelOptions,planMode:Se==null?void 0:Se.planMode});!e&&ot.chatId&&(I(ot.chatId),t(`/chat/${ot.chatId}`)),V(null)}catch(We){throw V(We instanceof Error?We.message:String(We)),We}}async function Ae(){if(e)try{await n.command({type:"chat.cancel",chatId:e})}catch(le){V(le instanceof Error?le.message:String(le))}}async function Be(le){if(await r.confirm({title:"Delete Chat",description:`Delete "${le.title}"? This cannot be undone.`,confirmLabel:"Delete",confirmVariant:"destructive"}))try{if(await n.command({type:"chat.delete",chatId:le.chatId}),le.chatId===e){const Pe=cee(s.projectGroups,le.chatId);t(Pe?`/chat/${Pe}`:"/")}}catch(Pe){V(Pe instanceof Error?Pe.message:String(Pe))}}async function Ye(le){const Se=s.projectGroups.find(ot=>ot.groupKey===le);if(!Se)return;const Pe=Se.localPath.split("/").filter(Boolean).pop()??Se.localPath;if(await r.confirm({title:"Remove",description:`Remove "${Pe}" from the sidebar? Existing chats will be removed from ${Un}.`,confirmLabel:"Remove",confirmVariant:"destructive"}))try{await n.command({type:"project.remove",projectId:le}),Wo.getState().clearProject(le),mf.getState().clearProject(le),(re==null?void 0:re.projectId)===le&&t("/"),V(null)}catch(ot){V(ot instanceof Error?ot.message:String(ot))}}async function Mt(le){var Pe,We;const Se=(re==null?void 0:re.localPath)??((Pe=a==null?void 0:a.projects[0])==null?void 0:Pe.localPath)??((We=s.projectGroups[0])==null?void 0:We.localPath);if(Se)try{await kt({action:le,localPath:Se})}catch(ot){V(ot instanceof Error?ot.message:String(ot))}}async function Yn(le){try{await kt({action:"open_editor",localPath:le.path,line:le.line,column:le.column})}catch(Se){V(Se instanceof Error?Se.message:String(Se))}}async function en(le,Se){try{await kt({action:le,localPath:Se})}catch(Pe){V(Pe instanceof Error?Pe.message:String(Pe))}}async function kt(le){const Se=Ur.getState();V(null),await n.command({type:"system.openExternal",...le,editor:le.action==="open_editor"?{preset:Se.editorPreset,commandTemplate:Se.editorCommandTemplate}:void 0})}function Vt(){var Se;const le=pee({selectedProjectId:A,sidebarProjectId:(Se=s.projectGroups[0])==null?void 0:Se.groupKey,fallbackLocalProjectPath:Le});if(le){un(le);return}t("/")}async function st(le,Se,Pe){if(e)try{await n.command({type:"chat.respondTool",chatId:e,toolUseId:le,result:{questions:Se,answers:Pe}})}catch(We){V(We instanceof Error?We.message:String(We))}}async function Er(le,Se,Pe,We){if(e){Se&&ls.getState().setComposerPlanMode(!1);try{await n.command({type:"chat.respondTool",chatId:e,toolUseId:le,result:{confirmed:Se,...Pe?{clearContext:!0}:{},...We?{message:We}:{}}})}catch(ot){V(ot instanceof Error?ot.message:String(ot))}}}return{socket:n,activeChatId:e,sidebarData:s,localProjects:a,updateSnapshot:h,chatSnapshot:p,keybindings:_,connectionStatus:w,sidebarReady:C,localProjectsReady:T,commandError:P,startingLocalPath:W,sidebarOpen:B,sidebarCollapsed:z,scrollRef:L,inputRef:oe,messages:se,latestToolIds:J,runtime:re,availableProviders:he,isProcessing:ve,canCancel:Ce,transcriptPaddingBottom:ce,showScrollButton:_e,navbarLocalPath:St,editorLabel:X,hasSelectedProject:yt,openSidebar:()=>K(!0),closeSidebar:()=>K(!1),collapseSidebar:()=>U(!0),expandSidebar:()=>U(!1),updateScrollState:$t,scrollToBottom:Gn,handleCreateChat:cr,handleOpenLocalProject:pe,handleCreateProject:Ge,handleCheckForUpdates:ur,handleInstallUpdate:ue,handleSend:ye,handleCancel:Ae,handleDeleteChat:Be,handleRemoveProject:Ye,handleOpenExternal:Mt,handleOpenExternalPath:en,handleOpenLocalLink:Yn,handleCompose:Vt,handleAskUserQuestion:st,handleExitPlanMode:Er}}const xE="kanna:last-seen-version";function vee(e,t,n){return e==="/"&&!!t&&n!==t}function _ee(){const e=di(),t=Na(),n=IE(),r=gee(n.chatId??null),s=e.pathname==="/"||e.pathname.startsWith("/settings"),l=wb.split("/")[1]??"unknown";return b.useEffect(()=>{const a=window.localStorage.getItem(xE),u=vee(e.pathname,l,a);window.localStorage.setItem(xE,l),u&&t("/settings/changelog",{replace:!0})},[l,e.pathname,t]),g.jsxs("div",{className:"flex h-[100dvh] min-h-[100dvh] overflow-hidden",children:[g.jsx(kH,{data:r.sidebarData,activeChatId:r.activeChatId,connectionStatus:r.connectionStatus,ready:r.sidebarReady,open:r.sidebarOpen,collapsed:r.sidebarCollapsed,showMobileOpenButton:s,onOpen:r.openSidebar,onClose:r.closeSidebar,onCollapse:r.collapseSidebar,onExpand:r.expandSidebar,onCreateChat:a=>{r.handleCreateChat(a)},onDeleteChat:a=>{r.handleDeleteChat(a)},onRemoveProject:a=>{r.handleRemoveProject(a)},updateSnapshot:r.updateSnapshot,onInstallUpdate:()=>{r.handleInstallUpdate()}}),g.jsx(G4,{context:r})]})}function yee(){return g.jsx(jI,{children:g.jsx(QP,{children:g.jsx(X4,{children:g.jsxs(la,{element:g.jsx(_ee,{}),children:[g.jsx(la,{path:"/",element:g.jsx(rJ,{})}),g.jsx(la,{path:"/settings",element:g.jsx(K4,{to:"/settings/general",replace:!0})}),g.jsx(la,{path:"/settings/:sectionId",element:g.jsx(qJ,{})}),g.jsx(la,{path:"/chat/:chatId",element:g.jsx(XQ,{})})]})})})})}const RD=document.getElementById("root");if(!RD)throw new Error("Missing #root");XO.createRoot(RD).render(g.jsx(b.StrictMode,{children:g.jsx(bL,{children:g.jsx(lV,{children:g.jsx(yee,{})})})}));